mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 04:33:05 +00:00
Change the signature of replaceUsesOfWithOnConstant. The bool was always
true dynamically. Finally, pass the Use* that replaceAllUsesWith has into the method for future use. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23626 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
40cdedecf5
commit
d0ff1adbdb
@ -815,14 +815,6 @@ void ConstantAggregateZero::destroyConstant() {
|
|||||||
destroyConstantImpl();
|
destroyConstantImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConstantAggregateZero::replaceUsesOfWithOnConstant(Value *From, Value *To,
|
|
||||||
bool DisableChecking) {
|
|
||||||
assert(0 && "No uses!");
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---- ConstantArray::get() implementation...
|
//---- ConstantArray::get() implementation...
|
||||||
//
|
//
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
@ -1395,7 +1387,7 @@ const char *ConstantExpr::getOpcodeName() const {
|
|||||||
// replaceUsesOfWithOnConstant implementations
|
// replaceUsesOfWithOnConstant implementations
|
||||||
|
|
||||||
void ConstantArray::replaceUsesOfWithOnConstant(Value *From, Value *To,
|
void ConstantArray::replaceUsesOfWithOnConstant(Value *From, Value *To,
|
||||||
bool DisableChecking) {
|
Use *U) {
|
||||||
assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!");
|
assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!");
|
||||||
Constant *ToC = cast<Constant>(To);
|
Constant *ToC = cast<Constant>(To);
|
||||||
|
|
||||||
@ -1448,18 +1440,15 @@ void ConstantArray::replaceUsesOfWithOnConstant(Value *From, Value *To,
|
|||||||
// Otherwise, I do need to replace this with an existing value.
|
// Otherwise, I do need to replace this with an existing value.
|
||||||
assert(Replacement != this && "I didn't contain From!");
|
assert(Replacement != this && "I didn't contain From!");
|
||||||
|
|
||||||
// Everyone using this now uses the replacement...
|
// Everyone using this now uses the replacement.
|
||||||
if (DisableChecking)
|
uncheckedReplaceAllUsesWith(Replacement);
|
||||||
uncheckedReplaceAllUsesWith(Replacement);
|
|
||||||
else
|
|
||||||
replaceAllUsesWith(Replacement);
|
|
||||||
|
|
||||||
// Delete the old constant!
|
// Delete the old constant!
|
||||||
destroyConstant();
|
destroyConstant();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConstantStruct::replaceUsesOfWithOnConstant(Value *From, Value *To,
|
void ConstantStruct::replaceUsesOfWithOnConstant(Value *From, Value *To,
|
||||||
bool DisableChecking) {
|
Use *U) {
|
||||||
assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!");
|
assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!");
|
||||||
Constant *ToC = cast<Constant>(To);
|
Constant *ToC = cast<Constant>(To);
|
||||||
|
|
||||||
@ -1511,18 +1500,15 @@ void ConstantStruct::replaceUsesOfWithOnConstant(Value *From, Value *To,
|
|||||||
|
|
||||||
assert(Replacement != this && "I didn't contain From!");
|
assert(Replacement != this && "I didn't contain From!");
|
||||||
|
|
||||||
// Everyone using this now uses the replacement...
|
// Everyone using this now uses the replacement.
|
||||||
if (DisableChecking)
|
uncheckedReplaceAllUsesWith(Replacement);
|
||||||
uncheckedReplaceAllUsesWith(Replacement);
|
|
||||||
else
|
|
||||||
replaceAllUsesWith(Replacement);
|
|
||||||
|
|
||||||
// Delete the old constant!
|
// Delete the old constant!
|
||||||
destroyConstant();
|
destroyConstant();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConstantPacked::replaceUsesOfWithOnConstant(Value *From, Value *To,
|
void ConstantPacked::replaceUsesOfWithOnConstant(Value *From, Value *To,
|
||||||
bool DisableChecking) {
|
Use *U) {
|
||||||
assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!");
|
assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!");
|
||||||
|
|
||||||
std::vector<Constant*> Values;
|
std::vector<Constant*> Values;
|
||||||
@ -1536,18 +1522,15 @@ void ConstantPacked::replaceUsesOfWithOnConstant(Value *From, Value *To,
|
|||||||
Constant *Replacement = ConstantPacked::get(getType(), Values);
|
Constant *Replacement = ConstantPacked::get(getType(), Values);
|
||||||
assert(Replacement != this && "I didn't contain From!");
|
assert(Replacement != this && "I didn't contain From!");
|
||||||
|
|
||||||
// Everyone using this now uses the replacement...
|
// Everyone using this now uses the replacement.
|
||||||
if (DisableChecking)
|
uncheckedReplaceAllUsesWith(Replacement);
|
||||||
uncheckedReplaceAllUsesWith(Replacement);
|
|
||||||
else
|
|
||||||
replaceAllUsesWith(Replacement);
|
|
||||||
|
|
||||||
// Delete the old constant!
|
// Delete the old constant!
|
||||||
destroyConstant();
|
destroyConstant();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConstantExpr::replaceUsesOfWithOnConstant(Value *From, Value *ToV,
|
void ConstantExpr::replaceUsesOfWithOnConstant(Value *From, Value *ToV,
|
||||||
bool DisableChecking) {
|
Use *U) {
|
||||||
assert(isa<Constant>(ToV) && "Cannot make Constant refer to non-constant!");
|
assert(isa<Constant>(ToV) && "Cannot make Constant refer to non-constant!");
|
||||||
Constant *To = cast<Constant>(ToV);
|
Constant *To = cast<Constant>(ToV);
|
||||||
|
|
||||||
@ -1588,11 +1571,8 @@ void ConstantExpr::replaceUsesOfWithOnConstant(Value *From, Value *ToV,
|
|||||||
|
|
||||||
assert(Replacement != this && "I didn't contain From!");
|
assert(Replacement != this && "I didn't contain From!");
|
||||||
|
|
||||||
// Everyone using this now uses the replacement...
|
// Everyone using this now uses the replacement.
|
||||||
if (DisableChecking)
|
uncheckedReplaceAllUsesWith(Replacement);
|
||||||
uncheckedReplaceAllUsesWith(Replacement);
|
|
||||||
else
|
|
||||||
replaceAllUsesWith(Replacement);
|
|
||||||
|
|
||||||
// Delete the old constant!
|
// Delete the old constant!
|
||||||
destroyConstant();
|
destroyConstant();
|
||||||
|
@ -108,7 +108,7 @@ void GlobalVariable::eraseFromParent() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GlobalVariable::replaceUsesOfWithOnConstant(Value *From, Value *To,
|
void GlobalVariable::replaceUsesOfWithOnConstant(Value *From, Value *To,
|
||||||
bool DisableChecking) {
|
Use *U) {
|
||||||
// If you call this, then you better know this GVar has a constant
|
// If you call this, then you better know this GVar has a constant
|
||||||
// initializer worth replacing. Enforce that here.
|
// initializer worth replacing. Enforce that here.
|
||||||
assert(getNumOperands() == 1 &&
|
assert(getNumOperands() == 1 &&
|
||||||
@ -126,6 +126,3 @@ void GlobalVariable::replaceUsesOfWithOnConstant(Value *From, Value *To,
|
|||||||
// Okay, preconditions out of the way, replace the constant initializer.
|
// Okay, preconditions out of the way, replace the constant initializer.
|
||||||
this->setOperand(0, cast<Constant>(To));
|
this->setOperand(0, cast<Constant>(To));
|
||||||
}
|
}
|
||||||
|
|
||||||
// vim: sw=2 ai
|
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ void Value::uncheckedReplaceAllUsesWith(Value *New) {
|
|||||||
// constant!
|
// constant!
|
||||||
if (Constant *C = dyn_cast<Constant>(U.getUser())) {
|
if (Constant *C = dyn_cast<Constant>(U.getUser())) {
|
||||||
if (!isa<GlobalValue>(C))
|
if (!isa<GlobalValue>(C))
|
||||||
C->replaceUsesOfWithOnConstant(this, New, true);
|
C->replaceUsesOfWithOnConstant(this, New, &U);
|
||||||
else
|
else
|
||||||
U.set(New);
|
U.set(New);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user