From d3a4c8057dfd31b562a8007a511f1de88a153528 Mon Sep 17 00:00:00 2001 From: Tim Rowley Date: Thu, 21 Dec 2017 11:01:37 -0600 Subject: [PATCH] swr/rast: shuffle header files for msvc pre-compiled header usage Reviewed-by: Bruce Cherniak --- src/gallium/drivers/swr/Makefile.sources | 1 + .../swr/rasterizer/jitter/JitManager.cpp | 36 +---- .../swr/rasterizer/jitter/JitManager.h | 46 +----- .../swr/rasterizer/jitter/blend_jit.cpp | 3 +- .../drivers/swr/rasterizer/jitter/builder.cpp | 1 + .../swr/rasterizer/jitter/builder_misc.cpp | 1 + .../swr/rasterizer/jitter/fetch_jit.cpp | 3 +- .../drivers/swr/rasterizer/jitter/jit_api.h | 1 - .../drivers/swr/rasterizer/jitter/jit_pch.hpp | 134 ++++++++++++++++++ .../swr/rasterizer/jitter/streamout_jit.cpp | 5 +- 10 files changed, 143 insertions(+), 88 deletions(-) create mode 100644 src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp diff --git a/src/gallium/drivers/swr/Makefile.sources b/src/gallium/drivers/swr/Makefile.sources index 53f8bf011b4..cd2040e1371 100644 --- a/src/gallium/drivers/swr/Makefile.sources +++ b/src/gallium/drivers/swr/Makefile.sources @@ -145,6 +145,7 @@ JITTER_CXX_SOURCES := \ rasterizer/jitter/fetch_jit.cpp \ rasterizer/jitter/fetch_jit.h \ rasterizer/jitter/jit_api.h \ + rasterizer/jitter/jit_pch.hpp \ rasterizer/jitter/JitManager.cpp \ rasterizer/jitter/JitManager.h \ rasterizer/jitter/streamout_jit.cpp \ diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp index 59672bb5458..883ac774827 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp @@ -27,41 +27,7 @@ * Notes: * ******************************************************************************/ -#if defined(_WIN32) -#pragma warning(disable: 4800 4146 4244 4267 4355 4996) -#endif - -#pragma push_macro("DEBUG") -#undef DEBUG - -#if defined(_WIN32) -#include "llvm/ADT/Triple.h" -#endif -#include "llvm/IR/Function.h" - -#include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/SourceMgr.h" - -#include "llvm/Analysis/CFGPrinter.h" -#include "llvm/IRReader/IRReader.h" -#include "llvm/Target/TargetMachine.h" -#include "llvm/Support/FormattedStream.h" -#include "llvm/Support/Path.h" -#include "llvm/Support/MemoryBuffer.h" -#include "llvm/Config/llvm-config.h" - -#if LLVM_VERSION_MAJOR < 4 -#include "llvm/Bitcode/ReaderWriter.h" -#else -#include "llvm/Bitcode/BitcodeWriter.h" -#include "llvm/Bitcode/BitcodeReader.h" -#endif - -#if LLVM_USE_INTEL_JITEVENTS -#include "llvm/ExecutionEngine/JITEventListener.h" -#endif - -#pragma pop_macro("DEBUG") +#include "jit_pch.hpp" #include "JitManager.h" #include "jit_api.h" diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h index c30a807222d..9e5e4cf2b6d 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h +++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h @@ -29,52 +29,9 @@ ******************************************************************************/ #pragma once -#if defined(_WIN32) -#pragma warning(disable : 4146 4244 4267 4800 4996) -#endif - -// llvm 3.7+ reuses "DEBUG" as an enum value -#pragma push_macro("DEBUG") -#undef DEBUG - -#include "llvm/IR/DataLayout.h" -#include "llvm/IR/Instructions.h" -#include "llvm/IR/LLVMContext.h" -#include "llvm/IR/Module.h" -#include "llvm/IR/Type.h" -#include "llvm/IR/IRBuilder.h" -#include "llvm/IR/IntrinsicInst.h" -#include "llvm/ExecutionEngine/ObjectCache.h" - -#include "llvm/Config/llvm-config.h" - -#include "llvm/IR/Verifier.h" -#include "llvm/ExecutionEngine/MCJIT.h" -#include "llvm/Support/FileSystem.h" -#define LLVM_F_NONE sys::fs::F_None - -#include "llvm/Analysis/Passes.h" - -#include "llvm/IR/LegacyPassManager.h" -using FunctionPassManager = llvm::legacy::FunctionPassManager; -using PassManager = llvm::legacy::PassManager; - -#include "llvm/CodeGen/Passes.h" -#include "llvm/ExecutionEngine/ExecutionEngine.h" -#include "llvm/Support/raw_ostream.h" -#include "llvm/Support/TargetSelect.h" -#include "llvm/Transforms/IPO.h" -#include "llvm/Transforms/Scalar.h" -#include "llvm/Support/Host.h" -#include "llvm/Support/DynamicLibrary.h" - - -#include "common/os.h" +#include "jit_pch.hpp" #include "common/isa.hpp" -#include - -#pragma pop_macro("DEBUG") ////////////////////////////////////////////////////////////////////////// /// JitInstructionSet @@ -173,6 +130,7 @@ struct JitManager uint32_t mVWidth; + // Built in types. llvm::Type* mInt8Ty; llvm::Type* mInt32Ty; diff --git a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp index 3258639d384..cc926229781 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp @@ -27,13 +27,12 @@ * Notes: * ******************************************************************************/ +#include "jit_pch.hpp" #include "builder.h" #include "jit_api.h" #include "blend_jit.h" #include "gen_state_llvm.h" -#include - // components with bit-widths <= the QUANTIZE_THRESHOLD will be quantized #define QUANTIZE_THRESHOLD 2 diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp index c46159a35ac..1b03d1c0709 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp @@ -28,6 +28,7 @@ * ******************************************************************************/ +#include "jit_pch.hpp" #include "builder.h" namespace SwrJit diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp index 92b07a5bfc0..7b29440010d 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp @@ -27,6 +27,7 @@ * Notes: * ******************************************************************************/ +#include "jit_pch.hpp" #include "builder.h" #include "common/rdtsc_buckets.h" diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp index c7605046c35..ac09a82f6c2 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp @@ -27,12 +27,11 @@ * Notes: * ******************************************************************************/ +#include "jit_pch.hpp" #include "builder.h" #include "jit_api.h" #include "fetch_jit.h" #include "gen_state_llvm.h" -#include -#include //#define FETCH_DUMP_VERTEX 1 using namespace llvm; diff --git a/src/gallium/drivers/swr/rasterizer/jitter/jit_api.h b/src/gallium/drivers/swr/rasterizer/jitter/jit_api.h index e589d2c6a7d..fb6cf9b3f0a 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/jit_api.h +++ b/src/gallium/drivers/swr/rasterizer/jitter/jit_api.h @@ -51,7 +51,6 @@ struct ShaderInfo; - ////////////////////////////////////////////////////////////////////////// /// Jit Compile Info Input ////////////////////////////////////////////////////////////////////////// diff --git a/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp b/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp new file mode 100644 index 00000000000..a35fc4c377b --- /dev/null +++ b/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp @@ -0,0 +1,134 @@ +/**************************************************************************** +* Copyright (C) 2017 Intel Corporation. All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +* +* @file jit_pch.hpp +* +* @brief Pre-compiled header for jitter +* +* Notes: +* +******************************************************************************/ + +#pragma once + +#if defined(_WIN32) +#pragma warning(disable : 4146 4244 4267 4800 4996) +#endif + +// llvm 3.7+ reuses "DEBUG" as an enum value +#pragma push_macro("DEBUG") +#undef DEBUG + +#include "llvm/IR/DataLayout.h" +#include "llvm/IR/Instructions.h" +#include "llvm/IR/LLVMContext.h" +#include "llvm/IR/Module.h" +#include "llvm/IR/Type.h" +#include "llvm/IR/IRBuilder.h" +#include "llvm/IR/IntrinsicInst.h" +#include "llvm/ExecutionEngine/ObjectCache.h" + +#include "llvm/Config/llvm-config.h" + +#include "llvm/IR/Verifier.h" +#include "llvm/ExecutionEngine/MCJIT.h" +#include "llvm/Support/FileSystem.h" +#define LLVM_F_NONE sys::fs::F_None + +#include "llvm/Analysis/Passes.h" + +#include "llvm/IR/LegacyPassManager.h" +using FunctionPassManager = llvm::legacy::FunctionPassManager; +using PassManager = llvm::legacy::PassManager; + +#include "llvm/CodeGen/Passes.h" +#include "llvm/ExecutionEngine/ExecutionEngine.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/TargetSelect.h" +#include "llvm/Support/DynamicLibrary.h" +#include "llvm/Transforms/IPO.h" +#include "llvm/Transforms/Scalar.h" +#include "llvm/Support/Host.h" +#include "llvm/Support/DynamicLibrary.h" + + +#include "llvm/IR/Function.h" +#include "llvm/IR/Constants.h" +#include "llvm/IR/Type.h" +#include "llvm/IR/Value.h" +#include "llvm/IR/Instructions.h" +#include "llvm/Pass.h" +#include "llvm/Transforms/Utils/BasicBlockUtils.h" +#include "llvm/Transforms/Utils/Cloning.h" +#include "llvm/IR/InstIterator.h" +#include "llvm/ADT/PostOrderIterator.h" +#include "llvm/ADT/SCCIterator.h" +#include "llvm/IR/Dominators.h" +#include "llvm/Analysis/PostDominators.h" +#include "llvm/Analysis/LoopInfo.h" + +#include "llvm/Transforms/Utils/Cloning.h" + + +#if defined(_WIN32) +#include "llvm/ADT/Triple.h" +#endif +#include "llvm/IR/Function.h" + +#include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/SourceMgr.h" + +#include "llvm/Analysis/CFGPrinter.h" +#include "llvm/IRReader/IRReader.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/Support/FormattedStream.h" +#include "llvm/Support/Path.h" +#include "llvm/Support/MemoryBuffer.h" +#include "llvm/Config/llvm-config.h" + +#if LLVM_VERSION_MAJOR < 4 +#include "llvm/Bitcode/ReaderWriter.h" +#else +#include "llvm/Bitcode/BitcodeWriter.h" +#include "llvm/Bitcode/BitcodeReader.h" +#endif + +#if LLVM_USE_INTEL_JITEVENTS +#include "llvm/ExecutionEngine/JITEventListener.h" +#endif + +#pragma pop_macro("DEBUG") + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "common/os.h" diff --git a/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp index fb80fe2d9cd..ac4436e5ebf 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp @@ -27,14 +27,11 @@ * Notes: * ******************************************************************************/ +#include "jit_pch.hpp" #include "builder.h" #include "jit_api.h" #include "streamout_jit.h" #include "gen_state_llvm.h" -#include "llvm/IR/DataLayout.h" - -#include -#include using namespace llvm; using namespace SwrJit; -- 2.30.2