Recognize a few more documented register name aliases for ARM in the asm lexer.

llvm-svn: 122523
This commit is contained in:
Jim Grosbach 2010-12-23 23:19:54 +00:00
parent 0d0a965b62
commit bcfa4a945a
1 changed files with 18 additions and 0 deletions

View File

@ -121,6 +121,24 @@ AsmToken ARMBaseAsmLexer::LexTokenUAL() {
StringRef lowerRef(lowerCase);
unsigned regID = MatchRegisterName(lowerRef);
// Check for register aliases.
// r13 -> sp
// r14 -> lr
// r15 -> pc
// ip -> r12
// FIXME: Some assemblers support lots of others. Do we want them all?
if (!regID) {
if (lowerCase.size() == 3 && lowerCase[0] == 'r'
&& lowerCase[1] == '1') {
switch (lowerCase[2]) {
default: break;
case '3': regID = ARM::SP;
case '4': regID = ARM::LR;
case '5': regID = ARM::PC;
}
} else if (lowerCase == "ip")
regID = ARM::R12;
}
if (regID) {
return AsmToken(AsmToken::Register,