Target triple OS detection tidyup. NFC
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 29 Nov 2014 19:18:21 +0000 (19:18 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 29 Nov 2014 19:18:21 +0000 (19:18 +0000)
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
lib/CodeGen/TargetLoweringBase.cpp
lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp
lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp

index 45f97acaeacffe2348502245c20b02262a2821b6..3fc0a36dd22f94a8b698e185ec518e9149cc350e 100644 (file)
@@ -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<GlobalValue>(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);
index e833fd36cc82d84b28ab0a46abf13eede571e8e1..bd5cd4c8cc2d29b270b68bce6d156c99062e8d79 100644 (file)
@@ -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.
index 893aae3d3f00d8b41022a69c75038b5c0d4c5020..1be7b482b6a32b46f52a2dd78b11d4a9f65647a9 100644 (file)
@@ -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;
 }
 
index 3a9c987dcdb4aa2f38b531550baf22a1366a0ef4..42690206e8c73468d3d51a127a7f3a55cb2260c6 100644 (file)
@@ -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;
 }