mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 00:24:26 +00:00
PR9214: Convert ConstantExpr::getIndices() to return an ArrayRef, plus
related tweaks to ExprMapKeyType. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129443 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -885,7 +885,7 @@ public:
|
|||||||
|
|
||||||
/// getIndices - Assert that this is an insertvalue or exactvalue
|
/// getIndices - Assert that this is an insertvalue or exactvalue
|
||||||
/// expression and return the list of indices.
|
/// expression and return the list of indices.
|
||||||
const SmallVector<unsigned, 4> &getIndices() const;
|
ArrayRef<unsigned> getIndices() const;
|
||||||
|
|
||||||
/// getOpcodeName - Return a string representation for an opcode.
|
/// getOpcodeName - Return a string representation for an opcode.
|
||||||
const char *getOpcodeName() const;
|
const char *getOpcodeName() const;
|
||||||
|
@ -606,7 +606,7 @@ Value *Lint::findValueImpl(Value *V, bool OffsetOk,
|
|||||||
Type::getInt64Ty(V->getContext())))
|
Type::getInt64Ty(V->getContext())))
|
||||||
return findValueImpl(CE->getOperand(0), OffsetOk, Visited);
|
return findValueImpl(CE->getOperand(0), OffsetOk, Visited);
|
||||||
} else if (CE->getOpcode() == Instruction::ExtractValue) {
|
} else if (CE->getOpcode() == Instruction::ExtractValue) {
|
||||||
const SmallVector<unsigned, 4> &Indices = CE->getIndices();
|
ArrayRef<unsigned> Indices = CE->getIndices();
|
||||||
if (Value *W = FindInsertedValue(CE->getOperand(0),
|
if (Value *W = FindInsertedValue(CE->getOperand(0),
|
||||||
Indices.begin(),
|
Indices.begin(),
|
||||||
Indices.end()))
|
Indices.end()))
|
||||||
|
@ -1075,7 +1075,7 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (CE->hasIndices()) {
|
if (CE->hasIndices()) {
|
||||||
const SmallVector<unsigned, 4> &Indices = CE->getIndices();
|
ArrayRef<unsigned> Indices = CE->getIndices();
|
||||||
for (unsigned i = 0, e = Indices.size(); i != e; ++i)
|
for (unsigned i = 0, e = Indices.size(); i != e; ++i)
|
||||||
Out << ", " << Indices[i];
|
Out << ", " << Indices[i];
|
||||||
}
|
}
|
||||||
|
@ -771,7 +771,7 @@ bool ConstantExpr::hasIndices() const {
|
|||||||
getOpcode() == Instruction::InsertValue;
|
getOpcode() == Instruction::InsertValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SmallVector<unsigned, 4> &ConstantExpr::getIndices() const {
|
ArrayRef<unsigned> ConstantExpr::getIndices() const {
|
||||||
if (const ExtractValueConstantExpr *EVCE =
|
if (const ExtractValueConstantExpr *EVCE =
|
||||||
dyn_cast<ExtractValueConstantExpr>(this))
|
dyn_cast<ExtractValueConstantExpr>(this))
|
||||||
return EVCE->Indices;
|
return EVCE->Indices;
|
||||||
@ -2151,7 +2151,7 @@ void ConstantExpr::replaceUsesOfWithOnConstant(Value *From, Value *ToV,
|
|||||||
Constant *Agg = getOperand(0);
|
Constant *Agg = getOperand(0);
|
||||||
if (Agg == From) Agg = To;
|
if (Agg == From) Agg = To;
|
||||||
|
|
||||||
const SmallVector<unsigned, 4> &Indices = getIndices();
|
ArrayRef<unsigned> Indices = getIndices();
|
||||||
Replacement = ConstantExpr::getExtractValue(Agg,
|
Replacement = ConstantExpr::getExtractValue(Agg,
|
||||||
&Indices[0], Indices.size());
|
&Indices[0], Indices.size());
|
||||||
} else if (getOpcode() == Instruction::InsertValue) {
|
} else if (getOpcode() == Instruction::InsertValue) {
|
||||||
@ -2160,7 +2160,7 @@ void ConstantExpr::replaceUsesOfWithOnConstant(Value *From, Value *ToV,
|
|||||||
if (Agg == From) Agg = To;
|
if (Agg == From) Agg = To;
|
||||||
if (Val == From) Val = To;
|
if (Val == From) Val = To;
|
||||||
|
|
||||||
const SmallVector<unsigned, 4> &Indices = getIndices();
|
ArrayRef<unsigned> Indices = getIndices();
|
||||||
Replacement = ConstantExpr::getInsertValue(Agg, Val,
|
Replacement = ConstantExpr::getInsertValue(Agg, Val,
|
||||||
&Indices[0], Indices.size());
|
&Indices[0], Indices.size());
|
||||||
} else if (isCast()) {
|
} else if (isCast()) {
|
||||||
|
@ -301,20 +301,18 @@ struct OperandTraits<CompareConstantExpr> :
|
|||||||
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CompareConstantExpr, Value)
|
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CompareConstantExpr, Value)
|
||||||
|
|
||||||
struct ExprMapKeyType {
|
struct ExprMapKeyType {
|
||||||
typedef SmallVector<unsigned, 4> IndexList;
|
|
||||||
|
|
||||||
ExprMapKeyType(unsigned opc,
|
ExprMapKeyType(unsigned opc,
|
||||||
const std::vector<Constant*> &ops,
|
ArrayRef<Constant*> ops,
|
||||||
unsigned short flags = 0,
|
unsigned short flags = 0,
|
||||||
unsigned short optionalflags = 0,
|
unsigned short optionalflags = 0,
|
||||||
const IndexList &inds = IndexList())
|
ArrayRef<unsigned> inds = ArrayRef<unsigned>())
|
||||||
: opcode(opc), subclassoptionaldata(optionalflags), subclassdata(flags),
|
: opcode(opc), subclassoptionaldata(optionalflags), subclassdata(flags),
|
||||||
operands(ops), indices(inds) {}
|
operands(ops.begin(), ops.end()), indices(inds.begin(), inds.end()) {}
|
||||||
uint8_t opcode;
|
uint8_t opcode;
|
||||||
uint8_t subclassoptionaldata;
|
uint8_t subclassoptionaldata;
|
||||||
uint16_t subclassdata;
|
uint16_t subclassdata;
|
||||||
std::vector<Constant*> operands;
|
std::vector<Constant*> operands;
|
||||||
IndexList indices;
|
SmallVector<unsigned, 4> indices;
|
||||||
bool operator==(const ExprMapKeyType& that) const {
|
bool operator==(const ExprMapKeyType& that) const {
|
||||||
return this->opcode == that.opcode &&
|
return this->opcode == that.opcode &&
|
||||||
this->subclassdata == that.subclassdata &&
|
this->subclassdata == that.subclassdata &&
|
||||||
@ -465,7 +463,7 @@ struct ConstantKeyData<ConstantExpr> {
|
|||||||
CE->isCompare() ? CE->getPredicate() : 0,
|
CE->isCompare() ? CE->getPredicate() : 0,
|
||||||
CE->getRawSubclassOptionalData(),
|
CE->getRawSubclassOptionalData(),
|
||||||
CE->hasIndices() ?
|
CE->hasIndices() ?
|
||||||
CE->getIndices() : SmallVector<unsigned, 4>());
|
CE->getIndices() : ArrayRef<unsigned>());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user