summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/AsmParser/ARMAsmLexer.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2010-12-24 00:03:39 +0000
committerJim Grosbach <grosbach@apple.com>2010-12-24 00:03:39 +0000
commitffaea0f01778a824af9c599bac6f3f76e2ed92ab (patch)
treea3b871713b175d958b0c145d16608bfc74f7bed2 /llvm/lib/Target/ARM/AsmParser/ARMAsmLexer.cpp
parent226ac14afb74b67007d133e3bb16ca05642b4caa (diff)
downloadbcm5719-llvm-ffaea0f01778a824af9c599bac6f3f76e2ed92ab.tar.gz
bcm5719-llvm-ffaea0f01778a824af9c599bac6f3f76e2ed92ab.zip
Use a StringSwitch<> instead of a manually constructed string matcher.
llvm-svn: 122530
Diffstat (limited to 'llvm/lib/Target/ARM/AsmParser/ARMAsmLexer.cpp')
-rw-r--r--llvm/lib/Target/ARM/AsmParser/ARMAsmLexer.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmLexer.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmLexer.cpp
index c93fb248e7a..0cc60794109 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmLexer.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmLexer.cpp
@@ -13,6 +13,7 @@
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringSwitch.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCParser/MCAsmLexer.h"
@@ -128,16 +129,12 @@ AsmToken ARMBaseAsmLexer::LexTokenUAL() {
// 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;
+ regID = StringSwitch<unsigned>(lowerCase)
+ .Case("r13", ARM::SP)
+ .Case("r14", ARM::LR)
+ .Case("r15", ARM::PC)
+ .Case("ip", ARM::R12)
+ .Default(0);
}
if (regID) {
OpenPOWER on IntegriCloud