|
| 1 | +#ifndef INCLUDED_RUSTC_LLVM_LLVMWRAPPER_H |
| 2 | +#define INCLUDED_RUSTC_LLVM_LLVMWRAPPER_H |
| 3 | + |
1 | 4 | #include "SuppressLLVMWarnings.h" |
2 | 5 |
|
3 | | -#include "llvm-c/BitReader.h" |
4 | | -#include "llvm-c/Core.h" |
5 | | -#include "llvm-c/Object.h" |
6 | | -#include "llvm/ADT/ArrayRef.h" |
7 | | -#include "llvm/ADT/DenseSet.h" |
8 | | -#include "llvm/ADT/SmallVector.h" |
9 | | -#include "llvm/Analysis/Lint.h" |
10 | | -#include "llvm/Analysis/Passes.h" |
11 | | -#include "llvm/IR/IRBuilder.h" |
12 | | -#include "llvm/IR/InlineAsm.h" |
13 | | -#include "llvm/IR/LLVMContext.h" |
14 | | -#include "llvm/IR/Module.h" |
15 | | -#include "llvm/Support/CommandLine.h" |
16 | | -#include "llvm/Support/Debug.h" |
17 | | -#include "llvm/Support/DynamicLibrary.h" |
18 | | -#include "llvm/Support/FormattedStream.h" |
19 | | -#include "llvm/Support/JSON.h" |
20 | | -#include "llvm/Support/Memory.h" |
21 | | -#include "llvm/Support/SourceMgr.h" |
22 | | -#include "llvm/Support/TargetSelect.h" |
23 | | -#include "llvm/Support/Timer.h" |
24 | | -#include "llvm/Support/raw_ostream.h" |
25 | | -#include "llvm/Target/TargetMachine.h" |
26 | | -#include "llvm/Target/TargetOptions.h" |
27 | | -#include "llvm/Transforms/IPO.h" |
28 | | -#include "llvm/Transforms/Scalar.h" |
| 6 | +#include "llvm/Config/llvm-config.h" // LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR |
| 7 | +#include "llvm/Support/raw_ostream.h" // llvm::raw_ostream |
| 8 | +#include <cstddef> // size_t etc |
| 9 | +#include <cstdint> // uint64_t etc |
29 | 10 |
|
30 | 11 | #define LLVM_VERSION_GE(major, minor) \ |
31 | 12 | (LLVM_VERSION_MAJOR > (major) || \ |
32 | 13 | LLVM_VERSION_MAJOR == (major) && LLVM_VERSION_MINOR >= (minor)) |
33 | 14 |
|
34 | 15 | #define LLVM_VERSION_LT(major, minor) (!LLVM_VERSION_GE((major), (minor))) |
35 | 16 |
|
36 | | -#if LLVM_VERSION_GE(20, 0) |
37 | | -#include "llvm/Transforms/Utils/Instrumentation.h" |
38 | | -#else |
39 | | -#include "llvm/Transforms/Instrumentation.h" |
40 | | -#endif |
41 | | - |
42 | | -#include "llvm/IR/LegacyPassManager.h" |
43 | | - |
44 | | -#include "llvm/Bitcode/BitcodeReader.h" |
45 | | -#include "llvm/Bitcode/BitcodeWriter.h" |
46 | | - |
47 | | -#include "llvm/IR/DIBuilder.h" |
48 | | -#include "llvm/IR/DebugInfo.h" |
49 | | -#include "llvm/IR/IRPrintingPasses.h" |
50 | | -#include "llvm/Linker/Linker.h" |
51 | | - |
52 | | -#include "llvm/TargetParser/Triple.h" |
53 | | - |
54 | 17 | extern "C" void LLVMRustSetLastError(const char *); |
55 | 18 |
|
56 | 19 | enum class LLVMRustResult { Success, Failure }; |
57 | 20 |
|
58 | | -enum LLVMRustAttribute { |
59 | | - AlwaysInline = 0, |
60 | | - ByVal = 1, |
61 | | - Cold = 2, |
62 | | - InlineHint = 3, |
63 | | - MinSize = 4, |
64 | | - Naked = 5, |
65 | | - NoAlias = 6, |
66 | | - NoCapture = 7, |
67 | | - NoInline = 8, |
68 | | - NonNull = 9, |
69 | | - NoRedZone = 10, |
70 | | - NoReturn = 11, |
71 | | - NoUnwind = 12, |
72 | | - OptimizeForSize = 13, |
73 | | - ReadOnly = 14, |
74 | | - SExt = 15, |
75 | | - StructRet = 16, |
76 | | - UWTable = 17, |
77 | | - ZExt = 18, |
78 | | - InReg = 19, |
79 | | - SanitizeThread = 20, |
80 | | - SanitizeAddress = 21, |
81 | | - SanitizeMemory = 22, |
82 | | - NonLazyBind = 23, |
83 | | - OptimizeNone = 24, |
84 | | - ReadNone = 26, |
85 | | - SanitizeHWAddress = 28, |
86 | | - WillReturn = 29, |
87 | | - StackProtectReq = 30, |
88 | | - StackProtectStrong = 31, |
89 | | - StackProtect = 32, |
90 | | - NoUndef = 33, |
91 | | - SanitizeMemTag = 34, |
92 | | - NoCfCheck = 35, |
93 | | - ShadowCallStack = 36, |
94 | | - AllocSize = 37, |
95 | | - AllocatedPointer = 38, |
96 | | - AllocAlign = 39, |
97 | | - SanitizeSafeStack = 40, |
98 | | - FnRetThunkExtern = 41, |
99 | | - Writable = 42, |
100 | | - DeadOnUnwind = 43, |
101 | | -}; |
102 | | - |
103 | 21 | typedef struct OpaqueRustString *RustStringRef; |
104 | 22 | typedef struct LLVMOpaqueTwine *LLVMTwineRef; |
105 | 23 | typedef struct LLVMOpaqueSMDiagnostic *LLVMSMDiagnosticRef; |
@@ -127,3 +45,5 @@ class RawRustStringOstream : public llvm::raw_ostream { |
127 | 45 | flush(); |
128 | 46 | } |
129 | 47 | }; |
| 48 | + |
| 49 | +#endif // INCLUDED_RUSTC_LLVM_LLVMWRAPPER_H |
0 commit comments