summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2010-01-23 00:40:33 +0000
committerSean Callanan <scallanan@apple.com>2010-01-23 00:40:33 +0000
commite9b466d4f09de3b46c0d0d1e71cabddc7cc9021b (patch)
tree26a471cbeb0ff7ccba02e6a91557d98d31d39479 /utils
parent2e369930dc9e36728f7953a238d63925d3660612 (diff)
downloadllvm-e9b466d4f09de3b46c0d0d1e71cabddc7cc9021b.tar.gz
llvm-e9b466d4f09de3b46c0d0d1e71cabddc7cc9021b.tar.bz2
llvm-e9b466d4f09de3b46c0d0d1e71cabddc7cc9021b.tar.xz
Modified the register matcher function in AsmMatcher to
be static. Also made it possible for clients to get it and no other functions from ...GenAsmMatcher.inc by defining REGISTERS_ONLY before including GenAsmMatcher.inc. This sets the stage for target-specific lexers that can identify registers and return AsmToken::Register as appropriate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94266 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/AsmMatcherEmitter.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/utils/TableGen/AsmMatcherEmitter.cpp b/utils/TableGen/AsmMatcherEmitter.cpp
index 8c37c3aabe..ce1521d86a 100644
--- a/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/utils/TableGen/AsmMatcherEmitter.cpp
@@ -1390,9 +1390,7 @@ static void EmitMatchRegisterName(CodeGenTarget &Target, Record *AsmParser,
"return " + utostr(i + 1) + ";"));
}
- OS << "unsigned " << Target.getName()
- << AsmParser->getValueAsString("AsmParserClassName")
- << "::MatchRegisterName(const StringRef &Name) {\n";
+ OS << "static unsigned MatchRegisterName(const StringRef &Name) {\n";
EmitStringMatcher("Name", Matches, OS);
@@ -1451,6 +1449,8 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
// Emit the function to match a register name to number.
EmitMatchRegisterName(Target, AsmParser, OS);
+
+ OS << "#ifndef REGISTERS_ONLY\n\n";
// Generate the unified function to convert operands into an MCInst.
EmitConvertToMCInst(Target, Info.Instructions, OS);
@@ -1550,4 +1550,6 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
OS << " return true;\n";
OS << "}\n\n";
+
+ OS << "#endif // REGISTERS_ONLY\n";
}