summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-08 21:22:41 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-08 21:22:41 +0000
commit66f4f54e8af0601af9d7b73dd7f4968aa430488e (patch)
tree2d7d824cd82bf17d8d59cc5457d1a43ce2560875 /llvm/lib
parent59410aaea61d31d2473a18d07362b1ec90e35fd0 (diff)
downloadbcm5719-llvm-66f4f54e8af0601af9d7b73dd7f4968aa430488e.tar.gz
bcm5719-llvm-66f4f54e8af0601af9d7b73dd7f4968aa430488e.zip
llvm-mc/AsmMatcher: Switch token matching to use the new string matcher.
Also, redefined MatchRegisterName to just return the register value or a sentinel, to simplify the generated code. llvm-svn: 78504
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 841b42743f3..ea5528a951a 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -46,7 +46,9 @@ private:
bool MatchInstruction(SmallVectorImpl<X86Operand> &Operands,
MCInst &Inst);
- bool MatchRegisterName(const StringRef &Name, unsigned &RegNo);
+ /// MatchRegisterName - Match the given string to a register name, or 0 if
+ /// there is no match.
+ unsigned MatchRegisterName(const StringRef &Name);
/// }
@@ -214,7 +216,9 @@ bool X86ATTAsmParser::ParseRegister(X86Operand &Op) {
// validation later, so maybe there is no need for this here.
unsigned RegNo;
assert(Tok.getString().startswith("%") && "Invalid register name!");
- if (MatchRegisterName(Tok.getString().substr(1), RegNo))
+
+ RegNo = MatchRegisterName(Tok.getString().substr(1));
+ if (RegNo == 0)
return Error(Tok.getLoc(), "invalid register name");
Op = X86Operand::CreateReg(RegNo);
OpenPOWER on IntegriCloud