aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-04 01:58:23 +0000
committerChris Lattner <sabre@nondot.org>2010-11-04 01:58:23 +0000
commit5f4280cd2d2d1aeb527c8b161acaa1870cf6ee82 (patch)
treedaed2840337156ec79cf1d92ce834886c81d6b5b
parentba3b5b638287e374d0c98fc5efdf866a3cee33b6 (diff)
downloadexternal_llvm-5f4280cd2d2d1aeb527c8b161acaa1870cf6ee82.zip
external_llvm-5f4280cd2d2d1aeb527c8b161acaa1870cf6ee82.tar.gz
external_llvm-5f4280cd2d2d1aeb527c8b161acaa1870cf6ee82.tar.bz2
pull name slicing out of BuildInstructionOperandReference so
it doesn't do any lexical stuff anymore. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118230 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--utils/TableGen/AsmMatcherEmitter.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/utils/TableGen/AsmMatcherEmitter.cpp b/utils/TableGen/AsmMatcherEmitter.cpp
index d85d098..2ffdd13 100644
--- a/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/utils/TableGen/AsmMatcherEmitter.cpp
@@ -500,8 +500,7 @@ private:
ClassInfo *getTokenClass(StringRef Token);
/// getOperandClass - Lookup or create the class for the given operand.
- ClassInfo *getOperandClass(StringRef Token,
- const CGIOperandList::OperandInfo &OI);
+ ClassInfo *getOperandClass(const CGIOperandList::OperandInfo &OI);
/// BuildRegisterClasses - Build the ClassInfo* instances for register
/// classes.
@@ -511,7 +510,7 @@ private:
/// operand classes.
void BuildOperandClasses();
- void BuildInstructionOperandReference(MatchableInfo *II,
+ void BuildInstructionOperandReference(MatchableInfo *II, StringRef OpName,
MatchableInfo::AsmOperand &Op);
public:
@@ -778,8 +777,7 @@ ClassInfo *AsmMatcherInfo::getTokenClass(StringRef Token) {
}
ClassInfo *
-AsmMatcherInfo::getOperandClass(StringRef Token,
- const CGIOperandList::OperandInfo &OI) {
+AsmMatcherInfo::getOperandClass(const CGIOperandList::OperandInfo &OI) {
if (OI.Rec->isSubClassOf("RegisterClass")) {
if (ClassInfo *CI = RegisterClassClasses[OI.Rec])
return CI;
@@ -1102,8 +1100,14 @@ void AsmMatcherInfo::BuildInfo() {
continue;
}
+ StringRef OperandName;
+ if (Token[1] == '{')
+ OperandName = Token.substr(2, Token.size() - 3);
+ else
+ OperandName = Token.substr(1);
+
// Otherwise this is an operand reference.
- BuildInstructionOperandReference(II, Op);
+ BuildInstructionOperandReference(II, OperandName, Op);
}
II->BuildResultOperands();
@@ -1117,16 +1121,8 @@ void AsmMatcherInfo::BuildInfo() {
/// named operand such as $src. Resolve the Class and OperandInfo pointers.
void AsmMatcherInfo::
BuildInstructionOperandReference(MatchableInfo *II,
+ StringRef OperandName,
MatchableInfo::AsmOperand &Op) {
- StringRef Token = Op.Token;
- assert(Token[0] == '$' && "Not an operand name ref");
-
- StringRef OperandName;
- if (Token[1] == '{')
- OperandName = Token.substr(2, Token.size() - 3);
- else
- OperandName = Token.substr(1);
-
const CGIOperandList &Operands = II->TheOperandList;
@@ -1137,7 +1133,7 @@ BuildInstructionOperandReference(MatchableInfo *II,
OperandName.str() + "'");
// Set up the operand class.
- Op.Class = getOperandClass(Token, Operands[Idx]);
+ Op.Class = getOperandClass(Operands[Idx]);
// If the named operand is tied, canonicalize it to the untied operand.
// For example, something like: