Halide  20.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 >= 170
5 // We're good to go
6 #else
7 #error "Compiling Halide requires LLVM 17.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 #include <lld/Common/ErrorHandler.h>
26 #endif
27 #include <llvm/ADT/APFloat.h>
28 #include <llvm/ADT/ArrayRef.h>
29 #include <llvm/ADT/SmallVector.h>
30 #include <llvm/ADT/StringMap.h>
31 #include <llvm/ADT/StringRef.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/Orc/LLJIT.h>
39 #include <llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h>
40 #include <llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.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/InlineAsm.h>
51 #include <llvm/IR/Instructions.h>
52 #include <llvm/IR/Intrinsics.h>
53 #ifdef WITH_HEXAGON
54 #include <llvm/IR/IntrinsicsHexagon.h>
55 #endif
56 #include <llvm/IR/LegacyPassManager.h>
57 #include <llvm/IR/MDBuilder.h>
58 #include <llvm/IR/Metadata.h>
59 #include <llvm/IR/Module.h>
60 #include <llvm/IR/PassTimingInfo.h>
61 #include <llvm/IR/Type.h>
62 #include <llvm/IR/Value.h>
63 #include <llvm/IR/Verifier.h>
64 #include <llvm/Linker/Linker.h>
65 #include <llvm/MC/MCTargetOptions.h>
66 #include <llvm/MC/TargetRegistry.h>
67 #include <llvm/Object/ArchiveWriter.h>
68 #include <llvm/Object/ObjectFile.h>
69 #include <llvm/Passes/PassBuilder.h>
70 #include <llvm/Support/Casting.h>
71 #include <llvm/Support/CodeGen.h>
72 #include <llvm/Support/CommandLine.h>
73 #include <llvm/Support/DataExtractor.h>
74 #include <llvm/Support/DynamicLibrary.h>
75 #include <llvm/Support/ErrorHandling.h>
76 #include <llvm/Support/FileSystem.h>
77 #include <llvm/Support/FormattedStream.h>
78 #include <llvm/Support/TargetSelect.h>
79 #include <llvm/Support/TypeSize.h>
80 #include <llvm/Support/raw_os_ostream.h>
81 #include <llvm/Support/raw_ostream.h>
82 #include <llvm/Target/TargetMachine.h>
83 #include <llvm/Target/TargetOptions.h>
84 #include <llvm/TargetParser/Triple.h>
85 #include <llvm/Transforms/IPO.h>
86 #include <llvm/Transforms/IPO/AlwaysInliner.h>
87 #include <llvm/Transforms/IPO/Inliner.h>
88 #if LLVM_VERSION < 200
89 #include <llvm/Transforms/Instrumentation.h>
90 #endif
91 #include <llvm/Transforms/Instrumentation/AddressSanitizer.h>
92 #include <llvm/Transforms/Instrumentation/SanitizerCoverage.h>
93 #include <llvm/Transforms/Instrumentation/ThreadSanitizer.h>
94 #include <llvm/Transforms/Scalar/GVN.h>
95 #include <llvm/Transforms/Utils/ModuleUtils.h>
96 #include <llvm/Transforms/Utils/SymbolRewriter.h>
97 #if LLVM_VERSION >= 180
98 #include <llvm/Transforms/Utils/RelLookupTableConverter.h>
99 #endif
100 
101 // IWYU pragma: end_exports
102 
103 // No msvc warnings from llvm headers please
104 #ifdef _MSC_VER
105 #pragma warning(pop)
106 #endif
107 
108 // llvm may sometimes define NDEBUG, which is annoying, because we always want asserts
109 #ifdef NDEBUG
110 #undef NDEBUG
111 #include <assert.h>
112 #define NDEBUG
113 #endif
114 
115 namespace Halide {
116 namespace Internal {
117 
118 template<typename T>
119 auto iterator_to_pointer(T iter) -> decltype(&*std::declval<T>()) {
120  return &*iter;
121 }
122 
123 inline std::string get_llvm_function_name(const llvm::Function *f) {
124  return f->getName().str();
125 }
126 
127 inline std::string get_llvm_function_name(const llvm::Function &f) {
128  return f.getName().str();
129 }
130 
131 inline llvm::StructType *get_llvm_struct_type_by_name(llvm::Module *module, const char *name) {
132  return llvm::StructType::getTypeByName(module->getContext(), name);
133 }
134 
135 } // namespace Internal
136 } // namespace Halide
137 
138 #endif
auto iterator_to_pointer(T iter) -> decltype(&*std::declval< T >())
Definition: LLVM_Headers.h:119
std::string get_llvm_function_name(const llvm::Function *f)
Definition: LLVM_Headers.h:123
llvm::StructType * get_llvm_struct_type_by_name(llvm::Module *module, const char *name)
Definition: LLVM_Headers.h:131
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.