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