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