From af909c02002ce8405b9af898f93063fc17d3be5c Mon Sep 17 00:00:00 2001 From: Tim Rowley Date: Fri, 7 Apr 2017 07:57:11 -0500 Subject: [PATCH] swr: [rasterizer jitter] Remove HAVE_LLVM tests supporting llvm < 3.8 Reviewed-by: Bruce Cherniak --- .../drivers/swr/rasterizer/jitter/JitManager.cpp | 10 ------- .../drivers/swr/rasterizer/jitter/JitManager.h | 6 ----- .../drivers/swr/rasterizer/jitter/builder_misc.cpp | 31 ---------------------- .../drivers/swr/rasterizer/jitter/builder_misc.h | 5 ---- 4 files changed, 52 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp index bdb8a52..8d1d259 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp @@ -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(); diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h index 170bdde..d97ae87 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h +++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h @@ -61,15 +61,9 @@ #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" diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp index c28d2ed..09b69c7 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp @@ -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 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 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 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 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 diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h index 9d55ce2..aea39c5 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h @@ -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 &indexList); Value *GEP(Value* ptr, const std::initializer_list &indexList); CallInst *CALL(Value *Callee, const std::initializer_list &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 &offset, const llvm::Twine& name = ""); LoadInst *LOADV(Value *BasePtr, const std::initializer_list &offset, const llvm::Twine& name = ""); -- 2.7.4