Index: lib/Target/ARM/ARMInstrInfo.td =================================================================== --- lib/Target/ARM/ARMInstrInfo.td +++ lib/Target/ARM/ARMInstrInfo.td @@ -444,12 +444,13 @@ class ImmAsmOperand : AsmOperandClass { let RenderMethod = "addImmOperands"; let PredicateMethod = "isImmediate<" # Low # "," # High # ">"; - let DiagnosticType = "ImmRange" # Low # "_" # High; + let DiagnosticString = "immediate operand must be in the range [" # Low # "," # High # "]"; } class ImmAsmOperandMinusOne : AsmOperandClass { let PredicateMethod = "isImmediate<" # Low # "," # High # ">"; let DiagnosticType = "ImmRange" # Low # "_" # High; + let DiagnosticString = "immediate operand must be in the range [" # Low # "," # High # "]"; } // Operands that are part of a memory addressing mode. @@ -738,7 +739,6 @@ /// imm0_15 predicate - Immediate in the range [0,15]. def Imm0_15AsmOperand: ImmAsmOperand<0,15> { let Name = "Imm0_15"; - let DiagnosticType = "ImmRange0_15"; } def imm0_15 : Operand, ImmLeaf= 0 && Imm < 16; @@ -773,7 +773,6 @@ /// imm0_239 predicate - Immediate in the range [0,239]. def Imm0_239AsmOperand : ImmAsmOperand<0,239> { let Name = "Imm0_239"; - let DiagnosticType = "ImmRange0_239"; } def imm0_239 : Operand, ImmLeaf= 0 && Imm < 240; }]> { let ParserMatchClass = Imm0_239AsmOperand; @@ -820,7 +819,10 @@ } /// imm24b - True if the 32-bit immediate is encodable in 24 bits. -def Imm24bitAsmOperand: ImmAsmOperand<0,0xffffff> { let Name = "Imm24bit"; } +def Imm24bitAsmOperand: ImmAsmOperand<0,0xffffff> { + let Name = "Imm24bit"; + let DiagnosticString = "immediate operand must be in the range [0,0xffffff]"; +} def imm24b : Operand, ImmLeaf= 0 && Imm <= 0xffffff; }]> { @@ -1111,7 +1113,7 @@ // VLD/VST instructions and checking the alignment is not specified. def AddrMode6AlignNoneAsmOperand : AsmOperandClass { let Name = "AlignedMemoryNone"; - let DiagnosticType = "AlignedMemoryRequiresNone"; + let DiagnosticString = "alignment must be omitted"; } def addrmode6alignNone : AddrMode6Align { // The alignment specifier can only be omitted. @@ -1122,7 +1124,7 @@ // VLD/VST instructions and checking the alignment value. def AddrMode6Align16AsmOperand : AsmOperandClass { let Name = "AlignedMemory16"; - let DiagnosticType = "AlignedMemoryRequires16"; + let DiagnosticString = "alignment must be 16 or omitted"; } def addrmode6align16 : AddrMode6Align { // The alignment specifier can only be 16 or omitted. @@ -1133,7 +1135,7 @@ // VLD/VST instructions and checking the alignment value. def AddrMode6Align32AsmOperand : AsmOperandClass { let Name = "AlignedMemory32"; - let DiagnosticType = "AlignedMemoryRequires32"; + let DiagnosticString = "alignment must be 32 or omitted"; } def addrmode6align32 : AddrMode6Align { // The alignment specifier can only be 32 or omitted. @@ -1144,7 +1146,7 @@ // VLD/VST instructions and checking the alignment value. def AddrMode6Align64AsmOperand : AsmOperandClass { let Name = "AlignedMemory64"; - let DiagnosticType = "AlignedMemoryRequires64"; + let DiagnosticString = "alignment must be 64 or omitted"; } def addrmode6align64 : AddrMode6Align { // The alignment specifier can only be 64 or omitted. @@ -1155,7 +1157,7 @@ // for VLD/VST instructions and checking the alignment value. def AddrMode6Align64or128AsmOperand : AsmOperandClass { let Name = "AlignedMemory64or128"; - let DiagnosticType = "AlignedMemoryRequires64or128"; + let DiagnosticString = "alignment must be 64, 128 or omitted"; } def addrmode6align64or128 : AddrMode6Align { // The alignment specifier can only be 64, 128 or omitted. @@ -1166,7 +1168,7 @@ // encoding for VLD/VST instructions and checking the alignment value. def AddrMode6Align64or128or256AsmOperand : AsmOperandClass { let Name = "AlignedMemory64or128or256"; - let DiagnosticType = "AlignedMemoryRequires64or128or256"; + let DiagnosticString = "alignment must be 64, 128, 256 or omitted"; } def addrmode6align64or128or256 : AddrMode6Align { // The alignment specifier can only be 64, 128, 256 or omitted. @@ -1197,7 +1199,7 @@ // VLD-dup instruction and checking the alignment is not specified. def AddrMode6dupAlignNoneAsmOperand : AsmOperandClass { let Name = "DupAlignedMemoryNone"; - let DiagnosticType = "DupAlignedMemoryRequiresNone"; + let DiagnosticString = "alignment must be omitted"; } def addrmode6dupalignNone : AddrMode6DupAlign { // The alignment specifier can only be omitted. @@ -1208,7 +1210,7 @@ // instruction and checking the alignment value. def AddrMode6dupAlign16AsmOperand : AsmOperandClass { let Name = "DupAlignedMemory16"; - let DiagnosticType = "DupAlignedMemoryRequires16"; + let DiagnosticString = "alignment must be 16 or omitted"; } def addrmode6dupalign16 : AddrMode6DupAlign { // The alignment specifier can only be 16 or omitted. @@ -1219,7 +1221,7 @@ // instruction and checking the alignment value. def AddrMode6dupAlign32AsmOperand : AsmOperandClass { let Name = "DupAlignedMemory32"; - let DiagnosticType = "DupAlignedMemoryRequires32"; + let DiagnosticString = "alignment must be 32 or omitted"; } def addrmode6dupalign32 : AddrMode6DupAlign { // The alignment specifier can only be 32 or omitted. @@ -1230,7 +1232,7 @@ // instructions and checking the alignment value. def AddrMode6dupAlign64AsmOperand : AsmOperandClass { let Name = "DupAlignedMemory64"; - let DiagnosticType = "DupAlignedMemoryRequires64"; + let DiagnosticString = "alignment must be 64 or omitted"; } def addrmode6dupalign64 : AddrMode6DupAlign { // The alignment specifier can only be 64 or omitted. @@ -1241,7 +1243,7 @@ // for VLD instructions and checking the alignment value. def AddrMode6dupAlign64or128AsmOperand : AsmOperandClass { let Name = "DupAlignedMemory64or128"; - let DiagnosticType = "DupAlignedMemoryRequires64or128"; + let DiagnosticString = "alignment must be 64, 128 or omitted"; } def addrmode6dupalign64or128 : AddrMode6DupAlign { // The alignment specifier can only be 64, 128 or omitted. Index: lib/Target/ARM/AsmParser/ARMAsmParser.cpp =================================================================== --- lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -576,7 +576,6 @@ SmallString<128> Message; }; - const char *getOperandMatchFailDiag(ARMMatchResultTy Error); void FilterNearMisses(SmallVectorImpl &NearMissesIn, SmallVectorImpl &NearMissesOut, SMLoc IDLoc, OperandVector &Operands); @@ -10080,76 +10079,6 @@ #define GET_MATCHER_IMPLEMENTATION #include "ARMGenAsmMatcher.inc" -const char *ARMAsmParser::getOperandMatchFailDiag(ARMMatchResultTy Error) { - switch (Error) { - case Match_AlignedMemoryRequiresNone: - case Match_DupAlignedMemoryRequiresNone: - return "alignment must be omitted"; - case Match_AlignedMemoryRequires16: - case Match_DupAlignedMemoryRequires16: - return "alignment must be 16 or omitted"; - case Match_AlignedMemoryRequires32: - case Match_DupAlignedMemoryRequires32: - return "alignment must be 32 or omitted"; - case Match_AlignedMemoryRequires64: - case Match_DupAlignedMemoryRequires64: - return "alignment must be 64 or omitted"; - case Match_AlignedMemoryRequires64or128: - case Match_DupAlignedMemoryRequires64or128: - return "alignment must be 64, 128 or omitted"; - case Match_AlignedMemoryRequires64or128or256: - return "alignment must be 64, 128, 256 or omitted"; - case Match_ImmRange0_1: - return "immediate operand must be in the range [0,1]"; - case Match_ImmRange0_3: - return "immediate operand must be in the range [0,3]"; - case Match_ImmRange0_7: - return "immediate operand must be in the range [0,7]"; - case Match_ImmRange0_15: - return "immediate operand must be in the range [0,15]"; - case Match_ImmRange0_31: - return "immediate operand must be in the range [0,31]"; - case Match_ImmRange0_32: - return "immediate operand must be in the range [0,32]"; - case Match_ImmRange0_63: - return "immediate operand must be in the range [0,63]"; - case Match_ImmRange0_239: - return "immediate operand must be in the range [0,239]"; - case Match_ImmRange0_255: - return "immediate operand must be in the range [0,255]"; - case Match_ImmRange0_4095: - return "immediate operand must be in the range [0,4095]"; - case Match_ImmRange0_65535: - return "immediate operand must be in the range [0,65535]"; - case Match_ImmRange1_7: - return "immediate operand must be in the range [1,7]"; - case Match_ImmRange1_8: - return "immediate operand must be in the range [1,8]"; - case Match_ImmRange1_15: - return "immediate operand must be in the range [1,15]"; - case Match_ImmRange1_16: - return "immediate operand must be in the range [1,16]"; - case Match_ImmRange1_31: - return "immediate operand must be in the range [1,31]"; - case Match_ImmRange1_32: - return "immediate operand must be in the range [1,32]"; - case Match_ImmRange1_64: - return "immediate operand must be in the range [1,64]"; - case Match_ImmRange8_8: - return "immediate operand must be 8."; - case Match_ImmRange16_16: - return "immediate operand must be 16."; - case Match_ImmRange32_32: - return "immediate operand must be 32."; - case Match_ImmRange256_65535: - return "immediate operand must be in the range [255,65535]"; - case Match_ImmRange0_16777215: - return "immediate operand must be in the range [0,0xffffff]"; - default: - return nullptr; - } -} - // Process the list of near-misses, throwing away ones we don't want to report // to the user, and converting the rest to a source location and string that // should be reported. @@ -10180,7 +10109,7 @@ SMLoc OperandLoc = ((ARMOperand &)*Operands[I.getOperandIndex()]).getStartLoc(); const char *OperandDiag = - getOperandMatchFailDiag((ARMMatchResultTy)I.getOperandError()); + getMatchKindDiag((ARMMatchResultTy)I.getOperandError()); // If we have already emitted a message for a superclass, don't also report // the sub-class. We consider all operand classes that we don't have a Index: test/MC/ARM/thumb2-diagnostics.s =================================================================== --- test/MC/ARM/thumb2-diagnostics.s +++ test/MC/ARM/thumb2-diagnostics.s @@ -83,7 +83,7 @@ movt r0, foo2 @ CHECK-ERRORS: error: invalid instruction, multiple near-miss encodings found @ CHECK-ERRORS: instruction requires: arm-mode -@ CHECK-ERRORS: note: for one encoding: immediate operand must be in the range [255,65535] +@ CHECK-ERRORS: note: for one encoding: immediate operand must be in the range [256,65535] @ CHECK-ERRORS: immediate expression for mov requires :lower16: or :upper16 @ CHECK-ERRORS: ^ @ CHECK-ERRORS: immediate expression for mov requires :lower16: or :upper16