diff options
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp')
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp b/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp index 5678fcea94d..fc0d5b327b8 100644 --- a/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp +++ b/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp @@ -99,11 +99,22 @@ llvm::MCOperand &InstructionInstance::getValueFor(const Variable &Var) { return VariableValues[Var.Index]; } +const llvm::MCOperand & +InstructionInstance::getValueFor(const Variable &Var) const { + return VariableValues[Var.Index]; +} + llvm::MCOperand &InstructionInstance::getValueFor(const Operand &Op) { assert(Op.VariableIndex >= 0); return getValueFor(Instr.Variables[Op.VariableIndex]); } +const llvm::MCOperand & +InstructionInstance::getValueFor(const Operand &Op) const { + assert(Op.VariableIndex >= 0); + return getValueFor(Instr.Variables[Op.VariableIndex]); +} + // forward declaration. static void randomize(const Instruction &Instr, const Variable &Var, llvm::MCOperand &AssignedValue); @@ -118,12 +129,15 @@ bool InstructionInstance::hasImmediateVariables() const { }); } -llvm::MCInst InstructionInstance::randomizeUnsetVariablesAndBuild() { +void InstructionInstance::randomizeUnsetVariables() { for (const Variable &Var : Instr.Variables) { llvm::MCOperand &AssignedValue = getValueFor(Var); if (!AssignedValue.isValid()) randomize(Instr, Var, AssignedValue); } +} + +llvm::MCInst InstructionInstance::build() const { llvm::MCInst Result; Result.setOpcode(Instr.Description->Opcode); for (const auto &Op : Instr.Operands) |