llvm.org GIT mirror llvm / 91bc1bb
[ARM] Better error message for invalid flag-preserving Thumb1 insts When we see a non flag-setting instruction for which only the flag-setting version is available in Thumb1, we should give a better error message than "invalid instruction". Differential Revision: https://reviews.llvm.org/D27414 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288805 91177308-0d34-0410-b5e6-96231b3b80d8 Oliver Stannard 3 years ago
2 changed file(s) with 5 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
522522 Match_RequiresV6,
523523 Match_RequiresThumb2,
524524 Match_RequiresV8,
525 Match_RequiresFlagSetting,
525526 #define GET_OPERAND_DIAGNOSTIC_TYPES
526527 #include "ARMGenAsmMatcher.inc"
527528
89048905 ;
89058906 // If we're parsing Thumb1, reject it completely.
89068907 if (isThumbOne() && Inst.getOperand(OpNo).getReg() != ARM::CPSR)
8907 return Match_MnemonicFail;
8908 return Match_RequiresFlagSetting;
89088909 // If we're parsing Thumb2, which form is legal depends on whether we're
89098910 // in an IT block.
89108911 if (isThumbTwo() && Inst.getOperand(OpNo).getReg() != ARM::CPSR &&
91709171 return Error(IDLoc, "instruction variant requires Thumb2");
91719172 case Match_RequiresV8:
91729173 return Error(IDLoc, "instruction variant requires ARMv8 or later");
9174 case Match_RequiresFlagSetting:
9175 return Error(IDLoc, "no flag-preserving variant of this instruction available");
91739176 case Match_ImmRange0_15: {
91749177 SMLoc ErrorLoc = ((ARMOperand &)*Operands[ErrorInfo]).getStartLoc();
91759178 if (ErrorLoc == SMLoc()) ErrorLoc = IDLoc;
1010
1111 @ ADD instruction w/o 'S' suffix.
1212 add r1, r2, r3
13 @ CHECK-ERRORS: error: invalid instruction
13 @ CHECK-ERRORS: error: no flag-preserving variant of this instruction available
1414 @ CHECK-ERRORS: add r1, r2, r3
1515 @ CHECK-ERRORS: ^
1616