[llvm] [llvm-exegesis] [AArch64] Resolving "not all operands are initialized by snippet generator" (PR #142529)

David Green via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 24 03:33:31 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:
----------------
davemgreen wrote:

For things where it is easy enough (in this case `move_vec_shift`), my preference would be to mark the operands with either OPERAND_IMMEDIATE or a new operand kind. That way we can re-use it to validate immediate ranges during ISel. Some are more difficult, I remember looking at the add complex operands in the past for a similar reason.
My hope is this isn't much more work than listing the opcodes here. Let me know if it looks like it is.

https://github.com/llvm/llvm-project/pull/142529


More information about the llvm-commits mailing list