Halide  14.0.0
Halide compiler and libraries
LLVM_Headers.h
Go to the documentation of this file.
1 #ifndef HALIDE_LLVM_HEADERS_H
2 #define HALIDE_LLVM_HEADERS_H
3 
4 #if LLVM_VERSION >= 120
5 // We're good to go
6 #else
7 #error "Compiling Halide requires LLVM 12.0 or newer"
8 #endif
9 
10 // No msvc warnings from llvm headers please
11 #ifdef _MSC_VER
12 #pragma warning(push, 0)
13 #endif
14 #ifdef __GNUC__
15 #pragma GCC system_header
16 #endif
17 #ifdef __clang__
18 #pragma clang system_header
19 #endif
20 
21 // IWYU pragma: begin_exports
22 
23 #if WITH_WABT || WITH_V8
24 #include <lld/Common/Driver.h>
25 #endif
26 #include <llvm/ADT/APFloat.h>
27 #include <llvm/ADT/ArrayRef.h>
28 #include <llvm/ADT/SmallVector.h>
29 #include <llvm/ADT/StringMap.h>
30 #include <llvm/ADT/StringRef.h>
31 #include <llvm/ADT/Triple.h>
32 #include <llvm/ADT/Twine.h>
33 #include <llvm/Analysis/AliasAnalysis.h>
34 #include <llvm/Analysis/TargetLibraryInfo.h>
35 #include <llvm/Analysis/TargetTransformInfo.h>
36 #include <llvm/Bitcode/BitcodeReader.h>
37 #include <llvm/Bitcode/BitcodeWriter.h>
38 #include <llvm/ExecutionEngine/ExecutionEngine.h>
39 #include <llvm/ExecutionEngine/JITEventListener.h>
40 #include <llvm/ExecutionEngine/MCJIT.h>
41 #include <llvm/ExecutionEngine/SectionMemoryManager.h>
42 #include <llvm/IR/Constant.h>
43 #include <llvm/IR/Constants.h>
44 #include <llvm/IR/DataLayout.h>
45 #include <llvm/IR/DerivedTypes.h>
46 #include <llvm/IR/Function.h>
47 #include <llvm/IR/GlobalValue.h>
48 #include <llvm/IR/GlobalVariable.h>
49 #include <llvm/IR/IRBuilder.h>
50 #include <llvm/IR/Instructions.h>
51 #include <llvm/IR/Intrinsics.h>
52 #ifdef WITH_HEXAGON
53 #include <llvm/IR/IntrinsicsHexagon.h>
54 #endif
55 #include <llvm/IR/LegacyPassManager.h>
56 #include <llvm/IR/MDBuilder.h>
57 #include <llvm/IR/Metadata.h>
58 #include <llvm/IR/Module.h>
59 #include <llvm/IR/PassTimingInfo.h>
60 #include <llvm/IR/Type.h>
61 #include <llvm/IR/Value.h>
62 #include <llvm/IR/Verifier.h>
63 #include <llvm/Linker/Linker.h>
64 #include <llvm/MC/MCTargetOptions.h>
65 #include <llvm/Object/ArchiveWriter.h>
66 #include <llvm/Object/ObjectFile.h>
67 #include <llvm/Passes/PassBuilder.h>
68 #include <llvm/Support/Casting.h>
69 #include <llvm/Support/CodeGen.h>
70 #include <llvm/Support/CommandLine.h>
71 #include <llvm/Support/DataExtractor.h>
72 #include <llvm/Support/DynamicLibrary.h>
73 #include <llvm/Support/ErrorHandling.h>
74 #include <llvm/Support/FileSystem.h>
75 #include <llvm/Support/FormattedStream.h>
76 #if LLVM_VERSION >= 140
77 #include <llvm/MC/TargetRegistry.h>
78 #else
79 #include <llvm/Support/TargetRegistry.h>
80 #endif
81 #include <llvm/Support/TargetSelect.h>
82 #include <llvm/Support/TypeSize.h>
83 #include <llvm/Support/raw_os_ostream.h>
84 #include <llvm/Support/raw_ostream.h>
85 #include <llvm/Target/TargetMachine.h>
86 #include <llvm/Target/TargetOptions.h>
87 #include <llvm/Transforms/IPO.h>
88 #include <llvm/Transforms/IPO/AlwaysInliner.h>
89 #include <llvm/Transforms/IPO/Inliner.h>
90 #include <llvm/Transforms/IPO/PassManagerBuilder.h>
91 #include <llvm/Transforms/Instrumentation.h>
92 #include <llvm/Transforms/Instrumentation/AddressSanitizer.h>
93 #include <llvm/Transforms/Instrumentation/SanitizerCoverage.h>
94 #include <llvm/Transforms/Instrumentation/ThreadSanitizer.h>
95 #include <llvm/Transforms/Scalar/GVN.h>
96 #include <llvm/Transforms/Utils/ModuleUtils.h>
97 #include <llvm/Transforms/Utils/SymbolRewriter.h>
98 
99 // IWYU pragma: end_exports
100 
101 // No msvc warnings from llvm headers please
102 #ifdef _MSC_VER
103 #pragma warning(pop)
104 #endif
105 
106 // llvm may sometimes define NDEBUG, which is annoying, because we always want asserts
107 #ifdef NDEBUG
108 #undef NDEBUG
109 #include <assert.h>
110 #define NDEBUG
111 #endif
112 
113 namespace Halide {
114 namespace Internal {
115 
116 template<typename T>
117 auto iterator_to_pointer(T iter) -> decltype(&*std::declval<T>()) {
118  return &*iter;
119 }
120 
121 inline std::string get_llvm_function_name(const llvm::Function *f) {
122  return f->getName().str();
123 }
124 
125 inline std::string get_llvm_function_name(const llvm::Function &f) {
126  return f.getName().str();
127 }
128 
129 inline llvm::StructType *get_llvm_struct_type_by_name(llvm::Module *module, const char *name) {
130  return llvm::StructType::getTypeByName(module->getContext(), name);
131 }
132 
133 } // namespace Internal
134 } // namespace Halide
135 
136 #endif
auto iterator_to_pointer(T iter) -> decltype(&*std::declval< T >())
Definition: LLVM_Headers.h:117
std::string get_llvm_function_name(const llvm::Function *f)
Definition: LLVM_Headers.h:121
llvm::StructType * get_llvm_struct_type_by_name(llvm::Module *module, const char *name)
Definition: LLVM_Headers.h:129
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.