From 1c86b63b9b1893a8f04d724b94824da154c4cd47 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sat, 29 Nov 2014 19:18:21 +0000 Subject: [PATCH] Target triple OS detection tidyup. NFC Use Triple::isOS*() helpers where possible. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222960 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/StackProtector.cpp | 4 ++-- lib/CodeGen/TargetLoweringBase.cpp | 2 +- lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp | 4 +--- lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp | 3 +-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/CodeGen/StackProtector.cpp b/lib/CodeGen/StackProtector.cpp index 45f97acaeac..3fc0a36dd22 100644 --- a/lib/CodeGen/StackProtector.cpp +++ b/lib/CodeGen/StackProtector.cpp @@ -346,7 +346,7 @@ static bool CreatePrologue(Function *F, Module *M, ReturnInst *RI, StackGuardVar = ConstantExpr::getIntToPtr( OffsetVal, PointerType::get(PtrTy, AddressSpace)); - } else if (Trip.getOS() == llvm::Triple::OpenBSD) { + } else if (Trip.isOSOpenBSD()) { StackGuardVar = M->getOrInsertGlobal("__guard_local", PtrTy); cast(StackGuardVar) ->setVisibility(GlobalValue::HiddenVisibility); @@ -477,7 +477,7 @@ BasicBlock *StackProtector::CreateFailBB() { LLVMContext &Context = F->getContext(); BasicBlock *FailBB = BasicBlock::Create(Context, "CallStackCheckFailBlk", F); IRBuilder<> B(FailBB); - if (Trip.getOS() == llvm::Triple::OpenBSD) { + if (Trip.isOSOpenBSD()) { Constant *StackChkFail = M->getOrInsertFunction( "__stack_smash_handler", Type::getVoidTy(Context), Type::getInt8PtrTy(Context), nullptr); diff --git a/lib/CodeGen/TargetLoweringBase.cpp b/lib/CodeGen/TargetLoweringBase.cpp index e833fd36cc8..bd5cd4c8cc2 100644 --- a/lib/CodeGen/TargetLoweringBase.cpp +++ b/lib/CodeGen/TargetLoweringBase.cpp @@ -414,7 +414,7 @@ static void InitLibcallNames(const char **Names, const Triple &TT) { Names[RTLIB::SINCOS_PPCF128] = nullptr; } - if (TT.getOS() != Triple::OpenBSD) { + if (!TT.isOSOpenBSD()) { Names[RTLIB::STACKPROTECTOR_CHECK_FAIL] = "__stack_chk_fail"; } else { // These are generally not available. diff --git a/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp b/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp index 893aae3d3f0..1be7b482b6a 100644 --- a/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp +++ b/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp @@ -74,9 +74,7 @@ PPCELFMCAsmInfo::PPCELFMCAsmInfo(bool is64Bit, const Triple& T) { AssemblerDialect = 1; // New-Style mnemonics. LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment; - if (T.getOS() == llvm::Triple::FreeBSD || - (T.getOS() == llvm::Triple::NetBSD && !is64Bit) || - (T.getOS() == llvm::Triple::OpenBSD && !is64Bit)) + if (T.isOSFreeBSD() || ((T.isOSNetBSD() || T.isOSOpenBSD()) && !is64Bit)) UseIntegratedAssembler = true; } diff --git a/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp b/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp index 3a9c987dcdb..42690206e8c 100644 --- a/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp +++ b/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp @@ -42,8 +42,7 @@ SparcELFMCAsmInfo::SparcELFMCAsmInfo(StringRef TT) { SunStyleELFSectionSwitchSyntax = true; UsesELFSectionDirectiveForBSS = true; - if (TheTriple.getOS() == llvm::Triple::Solaris || - TheTriple.getOS() == llvm::Triple::OpenBSD) + if (TheTriple.isOSSolaris() || TheTriple.isOSOpenBSD()) UseIntegratedAssembler = true; }