@@ -161,17 +161,23 @@ Error ExegesisAArch64Target::randomizeTargetMCOperand(
161161 const BitVector &ForbiddenRegs) const {
162162 const Operand &Op = Instr.getPrimaryOperand (Var);
163163 const auto OperandType = Op.getExplicitOperandInfo ().OperandType ;
164- // FIXME: Implement opcode-specific immediate value handling for system
165- // instructions:
164+ // NOTE: To resolve "Not all operands were initialized by snippet generator"
165+ // Requires OperandType to be defined for such opcode's operands in AArch64
166+ // tablegen files. And omit introduced OperandType(s).
167+
168+ // Hacky temporary fix works by defaulting all OPERAND_UNKNOWN to
169+ // immediate value 0, but this introduce illegal instruction error for below
170+ // system instructions will need to be omitted with OperandType or opcode
171+ // specific values to avoid generating invalid encodings or unreliable
172+ // benchmark results for these system-level instructions.
173+ // Implement opcode-specific immediate value handling for system instrs:
166174 // - MRS/MSR: Use valid system register encodings (e.g., NZCV, FPCR, FPSR)
167175 // - MSRpstatesvcrImm1: Use valid PSTATE field encodings (e.g., SPSel,
168176 // DAIFSet)
169177 // - SYSLxt/SYSxt: Use valid system instruction encodings with proper
170178 // CRn/CRm/op values
171179 // - UDF: Use valid undefined instruction immediate ranges (0-65535)
172- // Currently defaulting to immediate value 0, which may cause invalid
173- // encodings or unreliable benchmark results for these system-level
174- // instructions.
180+
175181 switch (OperandType) {
176182 // MSL (Masking Shift Left) imm operand for 32-bit splatted SIMD constants
177183 // Correspond to AArch64InstructionSelector::tryAdvSIMDModImm321s()
@@ -186,9 +192,11 @@ Error ExegesisAArch64Target::randomizeTargetMCOperand(
186192 return Error::success ();
187193 }
188194 case llvm::AArch64::OPERAND_IMPLICIT_IMM_0:
189- case MCOI::OperandType::OPERAND_PCREL:
190195 AssignedValue = MCOperand::createImm (0 );
191196 return Error::success ();
197+ case MCOI::OperandType::OPERAND_PCREL:
198+ AssignedValue = MCOperand::createImm (8 );
199+ return Error::success ();
192200 default :
193201 break ;
194202 }
0 commit comments