Halide 22.0.0 Halide compiler and libraries

Loading...
Searching...
No Matches
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 >= 200
5// We're good to go
6#else
7#error "Compiling Halide requires LLVM 20.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#include <llvm/Transforms/Instrumentation/AddressSanitizer.h>
89#include <llvm/Transforms/Instrumentation/SanitizerCoverage.h>
90#include <llvm/Transforms/Instrumentation/ThreadSanitizer.h>
91#include <llvm/Transforms/Scalar/GVN.h>
92#include <llvm/Transforms/Utils/ModuleUtils.h>
93#include <llvm/Transforms/Utils/RelLookupTableConverter.h>
94#include <llvm/Transforms/Utils/SymbolRewriter.h>
95
96// IWYU pragma: end_exports
97
98// No msvc warnings from llvm headers please
99#ifdef _MSC_VER
100#pragma warning(pop)
101#endif
102
103// llvm may sometimes define NDEBUG, which is annoying, because we always want asserts
104#ifdef NDEBUG
105#undef NDEBUG
106#include <assert.h>
107#define NDEBUG
108#endif
109
110 namespace Halide {
111 namespace Internal {
112
113 template<typename T>
114 auto iterator_to_pointer(T iter) -> decltype(&*std::declval<T>()) {
115 return &*iter;
116}
117
118 inline std::string get_llvm_function_name(const llvm::Function *f) {
119 return f->getName().str();
120}
121
122 inline std::string get_llvm_function_name(const llvm::Function &f) {
123 return f.getName().str();
124}
125
126 inline llvm::StructType *get_llvm_struct_type_by_name(llvm::Module *module, const char *name) {
127 return llvm::StructType::getTypeByName(module->getContext(), name);
128}
129
130} // namespace Internal
131} // namespace Halide
132
133#endif
Halide::Internal::get_llvm_struct_type_by_name
llvm::StructType * get_llvm_struct_type_by_name(llvm::Module *module, const char *name)
Definition LLVM_Headers.h:126
Halide::Internal::iterator_to_pointer
auto iterator_to_pointer(T iter) -> decltype(&*std::declval< T >())
Definition LLVM_Headers.h:114
Halide::Internal::get_llvm_function_name
std::string get_llvm_function_name(const llvm::Function *f)
Definition LLVM_Headers.h:118
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition AbstractGenerator.h:19
Halide::LinkageType::Internal
@ Internal
Not visible externally, similar to 'static' linkage in C.
Halide::cast
Internal::ConstantInterval cast(Type t, const Internal::ConstantInterval &a)
Cast operators for ConstantIntervals.