summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-exegesis/lib/CodeTemplate.cpp
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2018-10-09 08:59:10 +0000
committerGuillaume Chatelet <gchatelet@google.com>2018-10-09 08:59:10 +0000
commit09c2839c02a0eabf8851d81a44eba644ec683791 (patch)
tree35b0e059c51056fbb4f3b727bb759c8b381b6b53 /llvm/tools/llvm-exegesis/lib/CodeTemplate.cpp
parent379daa29744cd96b0a87ed0d4a010fa4bc47ce73 (diff)
downloadbcm5719-llvm-09c2839c02a0eabf8851d81a44eba644ec683791.tar.gz
bcm5719-llvm-09c2839c02a0eabf8851d81a44eba644ec683791.zip
[llvm-exegesis][NFC] Use accessors for Operand.
Summary: This moves checking logic into the accessors and makes the structure smaller. It will also help when/if Operand are generated from the TD files. Subscribers: tschuett, courbet, llvm-commits Differential Revision: https://reviews.llvm.org/D52982 llvm-svn: 344028
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/CodeTemplate.cpp')
-rw-r--r--llvm/tools/llvm-exegesis/lib/CodeTemplate.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/CodeTemplate.cpp b/llvm/tools/llvm-exegesis/lib/CodeTemplate.cpp
index 389cc0dc0f2..34433daa231 100644
--- a/llvm/tools/llvm-exegesis/lib/CodeTemplate.cpp
+++ b/llvm/tools/llvm-exegesis/lib/CodeTemplate.cpp
@@ -33,32 +33,26 @@ unsigned InstructionTemplate::getOpcode() const {
}
llvm::MCOperand &InstructionTemplate::getValueFor(const Variable &Var) {
- return VariableValues[Var.Index];
+ return VariableValues[Var.getIndex()];
}
const llvm::MCOperand &
InstructionTemplate::getValueFor(const Variable &Var) const {
- return VariableValues[Var.Index];
+ return VariableValues[Var.getIndex()];
}
llvm::MCOperand &InstructionTemplate::getValueFor(const Operand &Op) {
- assert(Op.VariableIndex >= 0);
- return getValueFor(Instr.Variables[Op.VariableIndex]);
+ return getValueFor(Instr.Variables[Op.getVariableIndex()]);
}
const llvm::MCOperand &
InstructionTemplate::getValueFor(const Operand &Op) const {
- assert(Op.VariableIndex >= 0);
- return getValueFor(Instr.Variables[Op.VariableIndex]);
+ return getValueFor(Instr.Variables[Op.getVariableIndex()]);
}
bool InstructionTemplate::hasImmediateVariables() const {
return llvm::any_of(Instr.Variables, [this](const Variable &Var) {
- assert(!Var.TiedOperands.empty());
- const unsigned OpIndex = Var.TiedOperands[0];
- const Operand &Op = Instr.Operands[OpIndex];
- assert(Op.Info);
- return Op.Info->OperandType == llvm::MCOI::OPERAND_IMMEDIATE;
+ return Instr.getPrimaryOperand(Var).isImmediate();
});
}
@@ -66,7 +60,7 @@ llvm::MCInst InstructionTemplate::build() const {
llvm::MCInst Result;
Result.setOpcode(Instr.Description->Opcode);
for (const auto &Op : Instr.Operands)
- if (Op.IsExplicit)
+ if (Op.isExplicit())
Result.addOperand(getValueFor(Op));
return Result;
}
OpenPOWER on IntegriCloud