Use triple predicate functions instead of checking values directly. NFC.

llvm-svn: 220155
This commit is contained in:
Bob Wilson 2014-10-19 00:39:30 +00:00
parent ac97f7ce7c
commit 1e1f13862e
1 changed files with 7 additions and 24 deletions

View File

@ -217,31 +217,14 @@ static MCAsmInfo *createARMMCAsmInfo(const MCRegisterInfo &MRI, StringRef TT) {
Triple TheTriple(TT);
MCAsmInfo *MAI;
switch (TheTriple.getOS()) {
case llvm::Triple::Darwin:
case llvm::Triple::IOS:
case llvm::Triple::MacOSX:
if (TheTriple.isOSDarwin() || TheTriple.isOSBinFormatMachO())
MAI = new ARMMCAsmInfoDarwin(TT);
break;
case llvm::Triple::Win32:
switch (TheTriple.getEnvironment()) {
case llvm::Triple::Itanium:
MAI = new ARMCOFFMCAsmInfoGNU();
break;
case llvm::Triple::MSVC:
MAI = new ARMCOFFMCAsmInfoMicrosoft();
break;
default:
llvm_unreachable("invalid environment");
}
break;
default:
if (TheTriple.isOSBinFormatMachO())
MAI = new ARMMCAsmInfoDarwin(TT);
else
MAI = new ARMELFMCAsmInfo(TT);
break;
}
else if (TheTriple.isWindowsItaniumEnvironment())
MAI = new ARMCOFFMCAsmInfoGNU();
else if (TheTriple.isWindowsMSVCEnvironment())
MAI = new ARMCOFFMCAsmInfoMicrosoft();
else
MAI = new ARMELFMCAsmInfo(TT);
unsigned Reg = MRI.getDwarfRegNum(ARM::SP, true);
MAI->addInitialFrameState(MCCFIInstruction::createDefCfa(nullptr, Reg, 0));