forked from OSchip/llvm-project
Recognize alternative register names like ip -> r12.
Fixes <rdar://problem/8857982>. llvm-svn: 123409
This commit is contained in:
parent
bbb1a54b84
commit
a098d1505d
|
@ -24,6 +24,7 @@
|
||||||
#include "llvm/Support/SourceMgr.h"
|
#include "llvm/Support/SourceMgr.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/ADT/SmallVector.h"
|
#include "llvm/ADT/SmallVector.h"
|
||||||
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include "llvm/ADT/StringSwitch.h"
|
#include "llvm/ADT/StringSwitch.h"
|
||||||
#include "llvm/ADT/Twine.h"
|
#include "llvm/ADT/Twine.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
@ -495,9 +496,19 @@ int ARMAsmParser::TryParseRegister() {
|
||||||
|
|
||||||
// FIXME: Validate register for the current architecture; we have to do
|
// FIXME: Validate register for the current architecture; we have to do
|
||||||
// validation later, so maybe there is no need for this here.
|
// validation later, so maybe there is no need for this here.
|
||||||
unsigned RegNum = MatchRegisterName(Tok.getString());
|
std::string upperCase = Tok.getString().str();
|
||||||
if (RegNum == 0)
|
std::string lowerCase = LowercaseString(upperCase);
|
||||||
return -1;
|
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.
|
Parser.Lex(); // Eat identifier token.
|
||||||
return RegNum;
|
return RegNum;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue