swr: [rasterizer jitter] Remove HAVE_LLVM tests supporting llvm < 3.8
authorTim Rowley <timothy.o.rowley@intel.com>
Fri, 7 Apr 2017 12:57:11 +0000 (07:57 -0500)
committerTim Rowley <timothy.o.rowley@intel.com>
Tue, 11 Apr 2017 23:01:03 +0000 (18:01 -0500)
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
src/gallium/drivers/swr/rasterizer/jitter/JitManager.h
src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp
src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h

index bdb8a52e2fcb2508136af45cc0c7669a2a956c6a..8d1d259e62b53add5d13ab4c11d0154eecf8d055 100644 (file)
@@ -206,12 +206,7 @@ bool JitManager::SetupModuleFromIR(const uint8_t *pIR, size_t length)
         return false;
     }
 
-#if HAVE_LLVM == 0x307
-    // llvm-3.7 has mismatched setDataLyout/getDataLayout APIs
-    newModule->setDataLayout(*mpExec->getDataLayout());
-#else
     newModule->setDataLayout(mpExec->getDataLayout());
-#endif
 
     mpCurrentModule = newModule.get();
 #if defined(_WIN32)
@@ -256,12 +251,7 @@ void JitManager::DumpAsm(Function* pFunction, const char* fileName)
         sprintf(fName, "%s.%s.asm", funcName, fileName);
 #endif
 
-#if HAVE_LLVM == 0x306
-        raw_fd_ostream fd(fName, EC, llvm::sys::fs::F_None);
-        formatted_raw_ostream filestream(fd);
-#else
         raw_fd_ostream filestream(fName, EC, llvm::sys::fs::F_None);
-#endif
 
         legacy::PassManager* pMPasses = new legacy::PassManager();
         auto* pTarget = mpExec->getTargetMachine();
index 170bdde81a8a05774454178b37c914135e1bfb69..d97ae871c28fc399f826c2d33c0fd8b4c803ac06 100644 (file)
 
 #include "llvm/Analysis/Passes.h"
 
-#if HAVE_LLVM == 0x306
-#include "llvm/PassManager.h"
-using FunctionPassManager = llvm::FunctionPassManager;
-using PassManager = llvm::PassManager;
-#else
 #include "llvm/IR/LegacyPassManager.h"
 using FunctionPassManager = llvm::legacy::FunctionPassManager;
 using PassManager = llvm::legacy::PassManager;
-#endif
 
 #include "llvm/CodeGen/Passes.h"
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
index c28d2ede16127561b01c511132419a80b1e5f39f..09b69c726df1b2482f63a51523bddc6f070f5af4 100644 (file)
@@ -236,13 +236,6 @@ namespace SwrJit
         return UndefValue::get(VectorType::get(t, mVWidth));
     }
 
-    #if HAVE_LLVM == 0x306
-    Value *Builder::VINSERT(Value *vec, Value *val, uint64_t index)
-    {
-        return VINSERT(vec, val, C((int64_t)index));
-    }
-    #endif
-
     Value *Builder::VBROADCAST(Value *src)
     {
         // check if src is already a vector
@@ -324,7 +317,6 @@ namespace SwrJit
         return CALLA(Callee, args);
     }
 
-    #if HAVE_LLVM > 0x306
     CallInst *Builder::CALL(Value *Callee, Value* arg)
     {
         std::vector<Value*> args;
@@ -348,7 +340,6 @@ namespace SwrJit
         args.push_back(arg3);
         return CALLA(Callee, args);
     }
-    #endif
 
     //////////////////////////////////////////////////////////////////////////
     Value *Builder::DEBUGTRAP()
@@ -504,11 +495,7 @@ namespace SwrJit
 
         // get a pointer to the first character in the constant string array
         std::vector<Constant*> geplist{C(0),C(0)};
-    #if HAVE_LLVM == 0x306
-        Constant *strGEP = ConstantExpr::getGetElementPtr(gvPtr,geplist,false);
-    #else
         Constant *strGEP = ConstantExpr::getGetElementPtr(nullptr, gvPtr,geplist,false);
-    #endif
 
         // insert the pointer to the format string in the argument vector
         printCallArgs[0] = strGEP;
@@ -1536,11 +1523,7 @@ namespace SwrJit
     Value* Builder::STACKSAVE()
     {
         Function* pfnStackSave = Intrinsic::getDeclaration(JM()->mpCurrentModule, Intrinsic::stacksave);
-    #if HAVE_LLVM == 0x306
-        return CALL(pfnStackSave);
-    #else
         return CALLA(pfnStackSave);
-    #endif
     }
 
     void Builder::STACKRESTORE(Value* pSaved)
@@ -1594,29 +1577,16 @@ namespace SwrJit
 
     Value *Builder::VEXTRACTI128(Value* a, Constant* imm8)
     {
-    #if HAVE_LLVM == 0x306
-        Function *func =
-            Intrinsic::getDeclaration(JM()->mpCurrentModule,
-                                      Intrinsic::x86_avx_vextractf128_si_256);
-        return CALL(func, {a, imm8});
-    #else
         bool flag = !imm8->isZeroValue();
         SmallVector<Constant*,8> idx;
         for (unsigned i = 0; i < mVWidth / 2; i++) {
             idx.push_back(C(flag ? i + mVWidth / 2 : i));
         }
         return VSHUFFLE(a, VUNDEF_I(), ConstantVector::get(idx));
-    #endif
     }
 
     Value *Builder::VINSERTI128(Value* a, Value* b, Constant* imm8)
     {
-    #if HAVE_LLVM == 0x306
-        Function *func =
-            Intrinsic::getDeclaration(JM()->mpCurrentModule,
-                                      Intrinsic::x86_avx_vinsertf128_si_256);
-        return CALL(func, {a, b, imm8});
-    #else
         bool flag = !imm8->isZeroValue();
         SmallVector<Constant*,8> idx;
         for (unsigned i = 0; i < mVWidth; i++) {
@@ -1632,7 +1602,6 @@ namespace SwrJit
             idx2.push_back(C(flag ? i + mVWidth / 2 : i));
         }
         return VSHUFFLE(a, inter, ConstantVector::get(idx2));
-    #endif
     }
 
     // rdtsc buckets macros
index 9d55ce2fa241e1da0cebd0a095176f24d719666b..aea39c5b777e118d4c2e8f9a5a716be022bf8934 100644 (file)
@@ -59,9 +59,6 @@ Value *VUNDEF_F();
 Value *VUNDEF_I();
 Value *VUNDEF(Type* ty, uint32_t size);
 Value *VUNDEF_IPTR();
-#if HAVE_LLVM == 0x306
-Value *VINSERT(Value *vec, Value *val, uint64_t index);
-#endif
 Value *VBROADCAST(Value *src);
 Value *VRCP(Value *va);
 Value *VPLANEPS(Value* vA, Value* vB, Value* vC, Value* &vX, Value* &vY);
@@ -72,12 +69,10 @@ int32_t S_IMMED(Value* i);
 Value *GEP(Value* ptr, const std::initializer_list<Value*> &indexList);
 Value *GEP(Value* ptr, const std::initializer_list<uint32_t> &indexList);
 CallInst *CALL(Value *Callee, const std::initializer_list<Value*> &args);
-#if HAVE_LLVM > 0x306
 CallInst *CALL(Value *Callee) { return CALLA(Callee); }
 CallInst *CALL(Value *Callee, Value* arg);
 CallInst *CALL2(Value *Callee, Value* arg1, Value* arg2);
 CallInst *CALL3(Value *Callee, Value* arg1, Value* arg2, Value* arg3);
-#endif
 
 LoadInst *LOAD(Value *BasePtr, const std::initializer_list<uint32_t> &offset, const llvm::Twine& name = "");
 LoadInst *LOADV(Value *BasePtr, const std::initializer_list<Value*> &offset, const llvm::Twine& name = "");