@@ -1986,9 +1986,9 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName,
1986
1986
}
1987
1987
CvtOS << " assert(Kind < CVT_NUM_SIGNATURES && \" Invalid signature!\" );\n " ;
1988
1988
CvtOS << " const uint8_t *Converter = ConversionTable[Kind];\n " ;
1989
- CvtOS << " unsigned OpIdx;\n " ;
1990
1989
CvtOS << " Inst.setOpcode(Opcode);\n " ;
1991
1990
CvtOS << " for (const uint8_t *p = Converter; *p; p += 2) {\n " ;
1991
+ CvtOS << " unsigned OpIdx;\n " ;
1992
1992
if (HasOptionalOperands) {
1993
1993
// When optional operands are involved, formal and actual operand indices
1994
1994
// may differ. Map the former to the latter by subtracting the number of
@@ -1999,16 +1999,17 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName,
1999
1999
}
2000
2000
CvtOS << " switch (*p) {\n " ;
2001
2001
CvtOS << " default: llvm_unreachable(\" invalid conversion entry!\" );\n " ;
2002
- CvtOS << " case CVT_Reg:\n " ;
2002
+ CvtOS << " case CVT_Reg:{ \n " ;
2003
2003
CvtOS << " static_cast<" << TargetOperandClass
2004
2004
<< " &>(*Operands[OpIdx]).addRegOperands(Inst, 1);\n " ;
2005
2005
CvtOS << " break;\n " ;
2006
+ CvtOS << " }\n " ;
2006
2007
CvtOS << " case CVT_Tied: {\n " ;
2007
- CvtOS << " assert(OpIdx < (size_t)(std::end(TiedAsmOperandTable) -\n " ;
2008
+ CvtOS << " assert(*(p + 1) < (size_t)(std::end(TiedAsmOperandTable) -\n " ;
2008
2009
CvtOS
2009
2010
<< " std::begin(TiedAsmOperandTable)) &&\n " ;
2010
2011
CvtOS << " \" Tied operand not found\" );\n " ;
2011
- CvtOS << " unsigned TiedResOpnd = TiedAsmOperandTable[OpIdx ][0];\n " ;
2012
+ CvtOS << " unsigned TiedResOpnd = TiedAsmOperandTable[*(p + 1) ][0];\n " ;
2012
2013
CvtOS << " if (TiedResOpnd != (uint8_t)-1)\n " ;
2013
2014
CvtOS << " Inst.addOperand(Inst.getOperand(TiedResOpnd));\n " ;
2014
2015
CvtOS << " break;\n " ;
0 commit comments