Path: blob/21.2-virgl/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
4574 views
/****************************************************************************1* Copyright (C) 2017-2020 Intel Corporation. All Rights Reserved.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*22* @file jit_pch.hpp23*24* @brief Pre-compiled header for jitter25*26* Notes:27*28******************************************************************************/2930#pragma once3132#if defined(_MSC_VER)33#pragma warning(disable : 4146 4244 4267 4800 4996)34#endif3536#include <llvm/Config/llvm-config.h>3738#if LLVM_VERSION_MAJOR < 739// llvm 3.7+ reuses "DEBUG" as an enum value40#pragma push_macro("DEBUG")41#undef DEBUG42#endif4344#include "llvm/IR/DataLayout.h"45#include "llvm/IR/Instructions.h"46#include "llvm/IR/LLVMContext.h"47#include "llvm/IR/Module.h"48#include "llvm/IR/Type.h"49#include "llvm/IR/IRBuilder.h"50#include "llvm/IR/IntrinsicInst.h"51#if LLVM_VERSION_MAJOR >= 1052#include "llvm/IR/IntrinsicsX86.h"53#endif54#include "llvm/ExecutionEngine/ObjectCache.h"5556#include "llvm/IR/Verifier.h"57#include "llvm/ExecutionEngine/MCJIT.h"58#include "llvm/Support/FileSystem.h"59#define LLVM_F_NONE sys::fs::F_None6061#include "llvm/Analysis/Passes.h"6263#include "llvm/IR/LegacyPassManager.h"64using FunctionPassManager = llvm::legacy::FunctionPassManager;65using PassManager = llvm::legacy::PassManager;6667#include "llvm/CodeGen/Passes.h"68#include "llvm/ExecutionEngine/ExecutionEngine.h"69#include "llvm/Support/raw_ostream.h"70#include "llvm/Support/TargetSelect.h"71#include "llvm/Support/DynamicLibrary.h"72#include "llvm/Transforms/IPO.h"73#include "llvm/Transforms/Scalar.h"74#if LLVM_VERSION_MAJOR >= 775#include "llvm/Transforms/Utils.h"76#include "llvm/Transforms/InstCombine/InstCombine.h"77#endif78#include "llvm/Support/Host.h"79#include "llvm/Support/DynamicLibrary.h"8081#include "llvm/IR/DIBuilder.h"82#include "llvm/IR/Function.h"83#include "llvm/IR/Constants.h"84#include "llvm/IR/Type.h"85#include "llvm/IR/Value.h"86#include "llvm/IR/Instructions.h"87#include "llvm/Pass.h"88#include "llvm/Transforms/Utils/BasicBlockUtils.h"89#include "llvm/Transforms/Utils/Cloning.h"90#include "llvm/IR/InstIterator.h"91#include "llvm/ADT/PostOrderIterator.h"92#include "llvm/ADT/SCCIterator.h"93#include "llvm/IR/Dominators.h"94#include "llvm/Analysis/PostDominators.h"95#include "llvm/Analysis/LoopInfo.h"9697#include "llvm/Transforms/Utils/Cloning.h"9899#if defined(_WIN32)100#include "llvm/ADT/Triple.h"101#endif102#include "llvm/IR/Function.h"103104#include "llvm/Support/MemoryBuffer.h"105#include "llvm/Support/SourceMgr.h"106107#include "llvm/Analysis/CFGPrinter.h"108#include "llvm/IRReader/IRReader.h"109#include "llvm/Target/TargetMachine.h"110#include "llvm/Support/FormattedStream.h"111#include "llvm/Support/Path.h"112#include "llvm/Support/MemoryBuffer.h"113#include "llvm/Config/llvm-config.h"114115#include "llvm/Bitcode/BitcodeWriter.h"116#include "llvm/Bitcode/BitcodeReader.h"117118#if LLVM_USE_INTEL_JITEVENTS119#include "llvm/ExecutionEngine/JITEventListener.h"120#endif121122#if LLVM_VERSION_MAJOR >= 5123static const auto Sync_CrossThread = llvm::SyncScope::System;124static const auto Attrib_FunctionIndex = llvm::AttributeList::FunctionIndex;125static inline llvm::AttributeSet GetFuncAttribSet(llvm::LLVMContext& ctx,126const llvm::AttrBuilder& b)127{128return llvm::AttributeSet::get(ctx, b);129}130#else131static const auto Sync_CrossThread = llvm::SynchronizationScope::CrossThread;132static const auto Attrib_FunctionIndex = llvm::AttributeSet::FunctionIndex;133static inline llvm::AttributeSet GetFuncAttribSet(llvm::LLVMContext& ctx,134const llvm::AttrBuilder& b)135{136return llvm::AttributeSet::get(ctx, Attrib_FunctionIndex, b);137}138#endif139140#if LLVM_VERSION_MAJOR >= 11141static inline llvm::VectorType* getVectorType(llvm::Type *ElementType, unsigned NumElements)142{143return llvm::VectorType::get(ElementType, NumElements, false);144}145#else146static inline llvm::VectorType* getVectorType(llvm::Type *ElementType, unsigned NumElements)147{148return llvm::VectorType::get(ElementType, NumElements);149}150#endif151152#if LLVM_VERSION_MAJOR < 7153#pragma pop_macro("DEBUG")154#endif155156#if LLVM_VERSION_MAJOR > 10157typedef unsigned IntrinsicID;158typedef llvm::Align AlignType;159#else160typedef llvm::Intrinsic::ID IntrinsicID;161typedef unsigned AlignType;162#endif163164#include <deque>165#include <list>166#include <unordered_map>167#include <unordered_set>168#include <iostream>169#include <sstream>170#include <type_traits>171#include <cstdint>172#include <vector>173#include <tuple>174#include <mutex>175176#include "common/os.h"177178#if defined(_WIN32)179#define JIT_OBJ_EXT ".obj"180#else181#define JIT_OBJ_EXT ".o"182#endif // _WIN32183184185