• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2 * Copyright (C) 2017 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(_WIN32)
34 #pragma warning(disable : 4146 4244 4267 4800 4996)
35 #endif
36 
37 // llvm 3.7+ reuses "DEBUG" as an enum value
38 #pragma push_macro("DEBUG")
39 #undef DEBUG
40 
41 #include "llvm/IR/DataLayout.h"
42 #include "llvm/IR/Instructions.h"
43 #include "llvm/IR/LLVMContext.h"
44 #include "llvm/IR/Module.h"
45 #include "llvm/IR/Type.h"
46 #include "llvm/IR/IRBuilder.h"
47 #include "llvm/IR/IntrinsicInst.h"
48 #include "llvm/ExecutionEngine/ObjectCache.h"
49 
50 #include "llvm/Config/llvm-config.h"
51 
52 #include "llvm/IR/Verifier.h"
53 #include "llvm/ExecutionEngine/MCJIT.h"
54 #include "llvm/Support/FileSystem.h"
55 #define LLVM_F_NONE sys::fs::F_None
56 
57 #include "llvm/Analysis/Passes.h"
58 
59 #include "llvm/IR/LegacyPassManager.h"
60 using FunctionPassManager = llvm::legacy::FunctionPassManager;
61 using PassManager = llvm::legacy::PassManager;
62 
63 #include "llvm/CodeGen/Passes.h"
64 #include "llvm/ExecutionEngine/ExecutionEngine.h"
65 #include "llvm/Support/raw_ostream.h"
66 #include "llvm/Support/TargetSelect.h"
67 #include "llvm/Support/DynamicLibrary.h"
68 #include "llvm/Transforms/IPO.h"
69 #include "llvm/Transforms/Scalar.h"
70 #include "llvm/Support/Host.h"
71 #include "llvm/Support/DynamicLibrary.h"
72 
73 #include "llvm/IR/DIBuilder.h"
74 #include "llvm/IR/Function.h"
75 #include "llvm/IR/Constants.h"
76 #include "llvm/IR/Type.h"
77 #include "llvm/IR/Value.h"
78 #include "llvm/IR/Instructions.h"
79 #include "llvm/Pass.h"
80 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
81 #include "llvm/Transforms/Utils/Cloning.h"
82 #include "llvm/IR/InstIterator.h"
83 #include "llvm/ADT/PostOrderIterator.h"
84 #include "llvm/ADT/SCCIterator.h"
85 #include "llvm/IR/Dominators.h"
86 #include "llvm/Analysis/PostDominators.h"
87 #include "llvm/Analysis/LoopInfo.h"
88 
89 #include "llvm/Transforms/Utils/Cloning.h"
90 
91 
92 #if defined(_WIN32)
93 #include "llvm/ADT/Triple.h"
94 #endif
95 #include "llvm/IR/Function.h"
96 
97 #include "llvm/Support/MemoryBuffer.h"
98 #include "llvm/Support/SourceMgr.h"
99 
100 #include "llvm/Analysis/CFGPrinter.h"
101 #include "llvm/IRReader/IRReader.h"
102 #include "llvm/Target/TargetMachine.h"
103 #include "llvm/Support/FormattedStream.h"
104 #include "llvm/Support/Path.h"
105 #include "llvm/Support/MemoryBuffer.h"
106 #include "llvm/Config/llvm-config.h"
107 
108 #if LLVM_VERSION_MAJOR < 4
109 #include "llvm/Bitcode/ReaderWriter.h"
110 #else
111 #include "llvm/Bitcode/BitcodeWriter.h"
112 #include "llvm/Bitcode/BitcodeReader.h"
113 #endif
114 
115 #if LLVM_USE_INTEL_JITEVENTS
116 #include "llvm/ExecutionEngine/JITEventListener.h"
117 #endif
118 
119 #pragma pop_macro("DEBUG")
120 
121 
122 #include <deque>
123 #include <list>
124 #include <unordered_map>
125 #include <unordered_set>
126 #include <iostream>
127 #include <sstream>
128 #include <type_traits>
129 #include <cstdint>
130 #include <vector>
131 #include <tuple>
132 #include <mutex>
133 
134 #include "common/os.h"
135 
136 #if defined(_WIN32)
137 #define JIT_OBJ_EXT ".obj"
138 #else
139 #define JIT_OBJ_EXT ".o"
140 #endif // _WIN32
141