diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2009-08-10 21:00:45 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2009-08-10 21:00:45 +0000 |
| commit | aeb1feb67a2bf503868b0966133a8b95b36dbf60 (patch) | |
| tree | b449e31937d773e545ad2a78843b610de34c4333 /llvm/utils | |
| parent | 009ac1ae04feb57af9c2dd9687e92629185928be (diff) | |
| download | bcm5719-llvm-aeb1feb67a2bf503868b0966133a8b95b36dbf60.tar.gz bcm5719-llvm-aeb1feb67a2bf503868b0966133a8b95b36dbf60.zip | |
llvm-mc/AsmParser: Allow .td users to redefine the names of the methods to call
on target specific operands for testing class membership and converting to
MCInst operands.
llvm-svn: 78597
Diffstat (limited to 'llvm/utils')
| -rw-r--r-- | llvm/utils/TableGen/AsmMatcherEmitter.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp index 0f3f9ed97f6..019348bf944 100644 --- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp +++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp @@ -589,8 +589,27 @@ void AsmMatcherInfo::BuildInfo(CodeGenTarget &Target) { CI->ClassName = (*it)->getValueAsString("Name"); CI->Name = "MCK_" + CI->ClassName; CI->ValueName = (*it)->getName(); - CI->PredicateMethod = "is" + CI->ClassName; - CI->RenderMethod = "add" + CI->ClassName + "Operands"; + + // Get or construct the predicate method name. + Init *PMName = (*it)->getValueInit("PredicateMethod"); + if (StringInit *SI = dynamic_cast<StringInit*>(PMName)) { + CI->PredicateMethod = SI->getValue(); + } else { + assert(dynamic_cast<UnsetInit*>(PMName) && + "Unexpected PredicateMethod field!"); + CI->PredicateMethod = "is" + CI->ClassName; + } + + // Get or construct the render method name. + Init *RMName = (*it)->getValueInit("RenderMethod"); + if (StringInit *SI = dynamic_cast<StringInit*>(RMName)) { + CI->RenderMethod = SI->getValue(); + } else { + assert(dynamic_cast<UnsetInit*>(RMName) && + "Unexpected RenderMethod field!"); + CI->RenderMethod = "add" + CI->ClassName + "Operands"; + } + AsmOperandClasses[*it] = CI; Classes.push_back(CI); } |

