mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-02 02:55:35 +00:00
PR9214: Convert ConstantExpr::getWithOperands() to use ArrayRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129439 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d61895a4be
commit
b81e457eb0
@ -897,10 +897,7 @@ public:
|
|||||||
/// getWithOperands - This returns the current constant expression with the
|
/// getWithOperands - This returns the current constant expression with the
|
||||||
/// operands replaced with the specified values. The specified operands must
|
/// operands replaced with the specified values. The specified operands must
|
||||||
/// match count and type with the existing ones.
|
/// match count and type with the existing ones.
|
||||||
Constant *getWithOperands(const std::vector<Constant*> &Ops) const {
|
Constant *getWithOperands(llvm::ArrayRef<Constant*> Ops) const;
|
||||||
return getWithOperands(&Ops[0], (unsigned)Ops.size());
|
|
||||||
}
|
|
||||||
Constant *getWithOperands(Constant *const *Ops, unsigned NumOps) const;
|
|
||||||
|
|
||||||
virtual void destroyConstant();
|
virtual void destroyConstant();
|
||||||
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U);
|
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U);
|
||||||
|
@ -301,8 +301,7 @@ void BitcodeReaderValueList::ResolveConstantForwardRefs() {
|
|||||||
NewC = ConstantVector::get(NewOps);
|
NewC = ConstantVector::get(NewOps);
|
||||||
} else {
|
} else {
|
||||||
assert(isa<ConstantExpr>(UserC) && "Must be a ConstantExpr.");
|
assert(isa<ConstantExpr>(UserC) && "Must be a ConstantExpr.");
|
||||||
NewC = cast<ConstantExpr>(UserC)->getWithOperands(&NewOps[0],
|
NewC = cast<ConstantExpr>(UserC)->getWithOperands(NewOps);
|
||||||
NewOps.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UserC->replaceAllUsesWith(NewC);
|
UserC->replaceAllUsesWith(NewC);
|
||||||
|
@ -855,10 +855,10 @@ ConstantExpr::getWithOperandReplaced(unsigned OpNo, Constant *Op) const {
|
|||||||
/// operands replaced with the specified values. The specified operands must
|
/// operands replaced with the specified values. The specified operands must
|
||||||
/// match count and type with the existing ones.
|
/// match count and type with the existing ones.
|
||||||
Constant *ConstantExpr::
|
Constant *ConstantExpr::
|
||||||
getWithOperands(Constant *const *Ops, unsigned NumOps) const {
|
getWithOperands(llvm::ArrayRef<Constant*> Ops) const {
|
||||||
assert(NumOps == getNumOperands() && "Operand count mismatch!");
|
assert(Ops.size() == getNumOperands() && "Operand count mismatch!");
|
||||||
bool AnyChange = false;
|
bool AnyChange = false;
|
||||||
for (unsigned i = 0; i != NumOps; ++i) {
|
for (unsigned i = 0; i != Ops.size(); ++i) {
|
||||||
assert(Ops[i]->getType() == getOperand(i)->getType() &&
|
assert(Ops[i]->getType() == getOperand(i)->getType() &&
|
||||||
"Operand type mismatch!");
|
"Operand type mismatch!");
|
||||||
AnyChange |= Ops[i] != getOperand(i);
|
AnyChange |= Ops[i] != getOperand(i);
|
||||||
@ -890,8 +890,8 @@ getWithOperands(Constant *const *Ops, unsigned NumOps) const {
|
|||||||
return ConstantExpr::getShuffleVector(Ops[0], Ops[1], Ops[2]);
|
return ConstantExpr::getShuffleVector(Ops[0], Ops[1], Ops[2]);
|
||||||
case Instruction::GetElementPtr:
|
case Instruction::GetElementPtr:
|
||||||
return cast<GEPOperator>(this)->isInBounds() ?
|
return cast<GEPOperator>(this)->isInBounds() ?
|
||||||
ConstantExpr::getInBoundsGetElementPtr(Ops[0], &Ops[1], NumOps-1) :
|
ConstantExpr::getInBoundsGetElementPtr(Ops[0], &Ops[1], Ops.size()-1) :
|
||||||
ConstantExpr::getGetElementPtr(Ops[0], &Ops[1], NumOps-1);
|
ConstantExpr::getGetElementPtr(Ops[0], &Ops[1], Ops.size()-1);
|
||||||
case Instruction::ICmp:
|
case Instruction::ICmp:
|
||||||
case Instruction::FCmp:
|
case Instruction::FCmp:
|
||||||
return ConstantExpr::getCompare(getPredicate(), Ops[0], Ops[1]);
|
return ConstantExpr::getCompare(getPredicate(), Ops[0], Ops[1]);
|
||||||
|
Loading…
Reference in New Issue
Block a user