Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
4574 views
1
/****************************************************************************
2
* Copyright (C) 2017-2020 Intel Corporation. All Rights Reserved.
3
*
4
* Permission is hereby granted, free of charge, to any person obtaining a
5
* copy of this software and associated documentation files (the "Software"),
6
* to deal in the Software without restriction, including without limitation
7
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
* and/or sell copies of the Software, and to permit persons to whom the
9
* Software is furnished to do so, subject to the following conditions:
10
*
11
* The above copyright notice and this permission notice (including the next
12
* paragraph) shall be included in all copies or substantial portions of the
13
* Software.
14
*
15
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21
* IN THE SOFTWARE.
22
*
23
* @file jit_pch.hpp
24
*
25
* @brief Pre-compiled header for jitter
26
*
27
* Notes:
28
*
29
******************************************************************************/
30
31
#pragma once
32
33
#if defined(_MSC_VER)
34
#pragma warning(disable : 4146 4244 4267 4800 4996)
35
#endif
36
37
#include <llvm/Config/llvm-config.h>
38
39
#if LLVM_VERSION_MAJOR < 7
40
// llvm 3.7+ reuses "DEBUG" as an enum value
41
#pragma push_macro("DEBUG")
42
#undef DEBUG
43
#endif
44
45
#include "llvm/IR/DataLayout.h"
46
#include "llvm/IR/Instructions.h"
47
#include "llvm/IR/LLVMContext.h"
48
#include "llvm/IR/Module.h"
49
#include "llvm/IR/Type.h"
50
#include "llvm/IR/IRBuilder.h"
51
#include "llvm/IR/IntrinsicInst.h"
52
#if LLVM_VERSION_MAJOR >= 10
53
#include "llvm/IR/IntrinsicsX86.h"
54
#endif
55
#include "llvm/ExecutionEngine/ObjectCache.h"
56
57
#include "llvm/IR/Verifier.h"
58
#include "llvm/ExecutionEngine/MCJIT.h"
59
#include "llvm/Support/FileSystem.h"
60
#define LLVM_F_NONE sys::fs::F_None
61
62
#include "llvm/Analysis/Passes.h"
63
64
#include "llvm/IR/LegacyPassManager.h"
65
using FunctionPassManager = llvm::legacy::FunctionPassManager;
66
using PassManager = llvm::legacy::PassManager;
67
68
#include "llvm/CodeGen/Passes.h"
69
#include "llvm/ExecutionEngine/ExecutionEngine.h"
70
#include "llvm/Support/raw_ostream.h"
71
#include "llvm/Support/TargetSelect.h"
72
#include "llvm/Support/DynamicLibrary.h"
73
#include "llvm/Transforms/IPO.h"
74
#include "llvm/Transforms/Scalar.h"
75
#if LLVM_VERSION_MAJOR >= 7
76
#include "llvm/Transforms/Utils.h"
77
#include "llvm/Transforms/InstCombine/InstCombine.h"
78
#endif
79
#include "llvm/Support/Host.h"
80
#include "llvm/Support/DynamicLibrary.h"
81
82
#include "llvm/IR/DIBuilder.h"
83
#include "llvm/IR/Function.h"
84
#include "llvm/IR/Constants.h"
85
#include "llvm/IR/Type.h"
86
#include "llvm/IR/Value.h"
87
#include "llvm/IR/Instructions.h"
88
#include "llvm/Pass.h"
89
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
90
#include "llvm/Transforms/Utils/Cloning.h"
91
#include "llvm/IR/InstIterator.h"
92
#include "llvm/ADT/PostOrderIterator.h"
93
#include "llvm/ADT/SCCIterator.h"
94
#include "llvm/IR/Dominators.h"
95
#include "llvm/Analysis/PostDominators.h"
96
#include "llvm/Analysis/LoopInfo.h"
97
98
#include "llvm/Transforms/Utils/Cloning.h"
99
100
#if defined(_WIN32)
101
#include "llvm/ADT/Triple.h"
102
#endif
103
#include "llvm/IR/Function.h"
104
105
#include "llvm/Support/MemoryBuffer.h"
106
#include "llvm/Support/SourceMgr.h"
107
108
#include "llvm/Analysis/CFGPrinter.h"
109
#include "llvm/IRReader/IRReader.h"
110
#include "llvm/Target/TargetMachine.h"
111
#include "llvm/Support/FormattedStream.h"
112
#include "llvm/Support/Path.h"
113
#include "llvm/Support/MemoryBuffer.h"
114
#include "llvm/Config/llvm-config.h"
115
116
#include "llvm/Bitcode/BitcodeWriter.h"
117
#include "llvm/Bitcode/BitcodeReader.h"
118
119
#if LLVM_USE_INTEL_JITEVENTS
120
#include "llvm/ExecutionEngine/JITEventListener.h"
121
#endif
122
123
#if LLVM_VERSION_MAJOR >= 5
124
static const auto Sync_CrossThread = llvm::SyncScope::System;
125
static const auto Attrib_FunctionIndex = llvm::AttributeList::FunctionIndex;
126
static inline llvm::AttributeSet GetFuncAttribSet(llvm::LLVMContext& ctx,
127
const llvm::AttrBuilder& b)
128
{
129
return llvm::AttributeSet::get(ctx, b);
130
}
131
#else
132
static const auto Sync_CrossThread = llvm::SynchronizationScope::CrossThread;
133
static const auto Attrib_FunctionIndex = llvm::AttributeSet::FunctionIndex;
134
static inline llvm::AttributeSet GetFuncAttribSet(llvm::LLVMContext& ctx,
135
const llvm::AttrBuilder& b)
136
{
137
return llvm::AttributeSet::get(ctx, Attrib_FunctionIndex, b);
138
}
139
#endif
140
141
#if LLVM_VERSION_MAJOR >= 11
142
static inline llvm::VectorType* getVectorType(llvm::Type *ElementType, unsigned NumElements)
143
{
144
return llvm::VectorType::get(ElementType, NumElements, false);
145
}
146
#else
147
static inline llvm::VectorType* getVectorType(llvm::Type *ElementType, unsigned NumElements)
148
{
149
return llvm::VectorType::get(ElementType, NumElements);
150
}
151
#endif
152
153
#if LLVM_VERSION_MAJOR < 7
154
#pragma pop_macro("DEBUG")
155
#endif
156
157
#if LLVM_VERSION_MAJOR > 10
158
typedef unsigned IntrinsicID;
159
typedef llvm::Align AlignType;
160
#else
161
typedef llvm::Intrinsic::ID IntrinsicID;
162
typedef unsigned AlignType;
163
#endif
164
165
#include <deque>
166
#include <list>
167
#include <unordered_map>
168
#include <unordered_set>
169
#include <iostream>
170
#include <sstream>
171
#include <type_traits>
172
#include <cstdint>
173
#include <vector>
174
#include <tuple>
175
#include <mutex>
176
177
#include "common/os.h"
178
179
#if defined(_WIN32)
180
#define JIT_OBJ_EXT ".obj"
181
#else
182
#define JIT_OBJ_EXT ".o"
183
#endif // _WIN32
184
185