[llvm] [llvm-exegesis] [AArch64] Resolving "not all operands are initialized by snippet generator" (PR #142529)
Lakshay Kumar via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 24 04:24:48 PDT 2025
================
@@ -229,6 +233,41 @@ class ExegesisAArch64Target : public ExegesisTarget {
}
};
+Error ExegesisAArch64Target::randomizeTargetMCOperand(
+ const Instruction &Instr, const Variable &Var, MCOperand &AssignedValue,
+ const BitVector &ForbiddenRegs) const {
+ const Operand &Op = Instr.getPrimaryOperand(Var);
+ const auto OperandType = Op.getExplicitOperandInfo().OperandType;
+ // TODO: Look into immediate values to be opcode specific for
+ // MRS, MSR, MSRpstatesvcrImm1, SYSLxt, SYSxt, UDF (illegal instruction)
+ switch (OperandType) {
+ case MCOI::OperandType::OPERAND_UNKNOWN: {
+ unsigned Opcode = Instr.getOpcode();
+ switch (Opcode) {
+ case AArch64::MOVIv2s_msl:
+ case AArch64::MOVIv4s_msl:
+ case AArch64::MVNIv2s_msl:
+ case AArch64::MVNIv4s_msl:
+ AssignedValue = MCOperand::createImm(8); // or 16
+ return Error::success();
+ default:
+ AssignedValue = MCOperand::createImm(0);
+ return Error::success();
+ }
+ }
+ case MCOI::OperandType::OPERAND_PCREL:
+ case MCOI::OperandType::OPERAND_FIRST_TARGET:
+ AssignedValue = MCOperand::createImm(0);
+ return Error::success();
+ default:
----------------
lakshayk-nv wrote:
Currently, We are emitting error.
> return make_error<Failure>(
> Twine("Unimplemented operand type: MCOI::OperandType:")
> .concat(Twine(static_cast<int>(OperandType))));
>>
If we ignore or emit warning and not emit error, exegesis should throw "Not all operands initialized by snippet Generator".
Other arch (x86) also handles operand type similarly.
Given this, should we change to emit warning or ignore?
[For Completeness] There aren't any operand type that are would trigger default for AArch64 current implementation.
https://github.com/llvm/llvm-project/pull/142529
More information about the llvm-commits
mailing list