Follow up of commit r172472.

Refactor the big if/else sequence into one string switch for ARM subtype selection.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172475 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Quentin Colombet 2013-01-14 21:34:09 +00:00
parent 31659fa066
commit 19d5433716

View File

@ -11,6 +11,7 @@
#include "MCTargetDesc/ARMAddressingModes.h" #include "MCTargetDesc/ARMAddressingModes.h"
#include "MCTargetDesc/ARMBaseInfo.h" #include "MCTargetDesc/ARMBaseInfo.h"
#include "MCTargetDesc/ARMFixupKinds.h" #include "MCTargetDesc/ARMFixupKinds.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/MC/MCAsmBackend.h" #include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h" #include "llvm/MC/MCContext.h"
@ -663,34 +664,20 @@ MCAsmBackend *llvm::createARMAsmBackend(const Target &T, StringRef TT, StringRef
Triple TheTriple(TT); Triple TheTriple(TT);
if (TheTriple.isOSDarwin()) { if (TheTriple.isOSDarwin()) {
if (TheTriple.getArchName() == "armv4t" || object::mach::CPUSubtypeARM CS =
TheTriple.getArchName() == "thumbv4t") StringSwitch<object::mach::CPUSubtypeARM>(TheTriple.getArchName())
return new DarwinARMAsmBackend(T, TT, object::mach::CSARM_V4T); .Cases("armv4t", "thumbv4t", object::mach::CSARM_V4T)
else if (TheTriple.getArchName() == "armv5e" || .Cases("armv5e", "thumbv5e",object::mach::CSARM_V5TEJ)
TheTriple.getArchName() == "thumbv5e") .Cases("armv6", "thumbv6", object::mach::CSARM_V6)
return new DarwinARMAsmBackend(T, TT, object::mach::CSARM_V5TEJ); .Cases("armv6m", "thumbv6m", object::mach::CSARM_V6M)
else if (TheTriple.getArchName() == "armv6" || .Cases("armv7em", "thumbv7em", object::mach::CSARM_V7EM)
TheTriple.getArchName() == "thumbv6") .Cases("armv7f", "thumbv7f", object::mach::CSARM_V7F)
return new DarwinARMAsmBackend(T, TT, object::mach::CSARM_V6); .Cases("armv7k", "thumbv7k", object::mach::CSARM_V7K)
else if (TheTriple.getArchName() == "armv6m" || .Cases("armv7m", "thumbv7m", object::mach::CSARM_V7M)
TheTriple.getArchName() == "thumbv6m") .Cases("armv7s", "thumbv7s", object::mach::CSARM_V7S)
return new DarwinARMAsmBackend(T, TT, object::mach::CSARM_V6M); .Default(object::mach::CSARM_V7);
else if (TheTriple.getArchName() == "armv7em" ||
TheTriple.getArchName() == "thumbv7em") return new DarwinARMAsmBackend(T, TT, CS);
return new DarwinARMAsmBackend(T, TT, object::mach::CSARM_V7EM);
else if (TheTriple.getArchName() == "armv7f" ||
TheTriple.getArchName() == "thumbv7f")
return new DarwinARMAsmBackend(T, TT, object::mach::CSARM_V7F);
else if (TheTriple.getArchName() == "armv7k" ||
TheTriple.getArchName() == "thumbv7k")
return new DarwinARMAsmBackend(T, TT, object::mach::CSARM_V7K);
else if (TheTriple.getArchName() == "armv7m" ||
TheTriple.getArchName() == "thumbv7m")
return new DarwinARMAsmBackend(T, TT, object::mach::CSARM_V7M);
else if (TheTriple.getArchName() == "armv7s" ||
TheTriple.getArchName() == "thumbv7s")
return new DarwinARMAsmBackend(T, TT, object::mach::CSARM_V7S);
return new DarwinARMAsmBackend(T, TT, object::mach::CSARM_V7);
} }
if (TheTriple.isOSWindows()) if (TheTriple.isOSWindows())