TableGen: AsmMatcher support for better operand diagnostics.

"Invalid operand" may be a completely correct diagnostic, but it's often
insufficiently specific to really help identify and fix the problem in
assembly source. Allow a target to specify a more-specific diagnostic kind
for each AsmOperandClass derived definition and use that to provide
more detailed diagnostics when an operant of that class resulted in a
match failure.

rdar://8987109

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159050 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Grosbach
2012-06-22 23:56:44 +00:00
parent 009f7afbeb
commit 4dbfdfba6c
2 changed files with 74 additions and 16 deletions

View File

@@ -523,6 +523,11 @@ class AsmOperandClass {
/// to immediates or registers and are very instruction specific (as flags to
/// set in a processor register, coprocessor number, ...).
string ParserMethod = ?;
// The diagnostic type to present when referencing this operand in a
// match failure error message. By default, use a generic "invalid operand"
// diagnostic. The target AsmParser maps these codes to text.
string DiagnosticType = "";
}
def ImmAsmOperand : AsmOperandClass {