[llvm-commits] [llvm] r123409 - /llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
Owen Anderson
resistor at mac.com
Thu Jan 13 14:50:37 PST 2011
Author: resistor
Date: Thu Jan 13 16:50:36 2011
New Revision: 123409
URL: http://llvm.org/viewvc/llvm-project?rev=123409&view=rev
Log:
Recognize alternative register names like ip -> r12.
Fixes <rdar://problem/8857982>.
Modified:
llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=123409&r1=123408&r2=123409&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Thu Jan 13 16:50:36 2011
@@ -24,6 +24,7 @@
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Twine.h"
using namespace llvm;
@@ -495,9 +496,19 @@
// FIXME: Validate register for the current architecture; we have to do
// validation later, so maybe there is no need for this here.
- unsigned RegNum = MatchRegisterName(Tok.getString());
- if (RegNum == 0)
- return -1;
+ std::string upperCase = Tok.getString().str();
+ std::string lowerCase = LowercaseString(upperCase);
+ unsigned RegNum = MatchRegisterName(lowerCase);
+ if (!RegNum) {
+ RegNum = StringSwitch<unsigned>(lowerCase)
+ .Case("r13", ARM::SP)
+ .Case("r14", ARM::LR)
+ .Case("r15", ARM::PC)
+ .Case("ip", ARM::R12)
+ .Default(0);
+ }
+ if (!RegNum) return -1;
+
Parser.Lex(); // Eat identifier token.
return RegNum;
}
More information about the llvm-commits
mailing list