@@ -2002,9 +2002,9 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName,
2002
2002
}
2003
2003
CvtOS << " assert(Kind < CVT_NUM_SIGNATURES && \" Invalid signature!\" );\n " ;
2004
2004
CvtOS << " const uint8_t *Converter = ConversionTable[Kind];\n " ;
2005
- CvtOS << " unsigned OpIdx;\n " ;
2006
2005
CvtOS << " Inst.setOpcode(Opcode);\n " ;
2007
2006
CvtOS << " for (const uint8_t *p = Converter; *p; p += 2) {\n " ;
2007
+ CvtOS << " unsigned OpIdx;\n " ;
2008
2008
if (HasOptionalOperands) {
2009
2009
// When optional operands are involved, formal and actual operand indices
2010
2010
// may differ. Map the former to the latter by subtracting the number of
@@ -2015,16 +2015,17 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName,
2015
2015
}
2016
2016
CvtOS << " switch (*p) {\n " ;
2017
2017
CvtOS << " default: llvm_unreachable(\" invalid conversion entry!\" );\n " ;
2018
- CvtOS << " case CVT_Reg:\n " ;
2018
+ CvtOS << " case CVT_Reg:{ \n " ;
2019
2019
CvtOS << " static_cast<" << TargetOperandClass
2020
2020
<< " &>(*Operands[OpIdx]).addRegOperands(Inst, 1);\n " ;
2021
2021
CvtOS << " break;\n " ;
2022
+ CvtOS << " }\n " ;
2022
2023
CvtOS << " case CVT_Tied: {\n " ;
2023
- CvtOS << " assert(OpIdx < (size_t)(std::end(TiedAsmOperandTable) -\n " ;
2024
+ CvtOS << " assert(*(p + 1) < (size_t)(std::end(TiedAsmOperandTable) -\n " ;
2024
2025
CvtOS
2025
2026
<< " std::begin(TiedAsmOperandTable)) &&\n " ;
2026
2027
CvtOS << " \" Tied operand not found\" );\n " ;
2027
- CvtOS << " unsigned TiedResOpnd = TiedAsmOperandTable[OpIdx ][0];\n " ;
2028
+ CvtOS << " unsigned TiedResOpnd = TiedAsmOperandTable[*(p + 1) ][0];\n " ;
2028
2029
CvtOS << " if (TiedResOpnd != (uint8_t)-1)\n " ;
2029
2030
CvtOS << " Inst.addOperand(Inst.getOperand(TiedResOpnd));\n " ;
2030
2031
CvtOS << " break;\n " ;
0 commit comments