llvm_sys/
target_machine.rs1use super::prelude::*;
4use super::target::LLVMTargetDataRef;
5
6#[derive(Debug)]
7pub enum LLVMOpaqueTargetMachine {}
8
9pub type LLVMTargetMachineRef = *mut LLVMOpaqueTargetMachine;
10
11#[derive(Debug)]
12pub enum LLVMOpaqueTargetMachineOptions {}
13
14pub type LLVMTargetMachineOptionsRef = *mut LLVMOpaqueTargetMachineOptions;
15
16#[derive(Debug)]
17pub enum LLVMTarget {}
18
19pub type LLVMTargetRef = *mut LLVMTarget;
20
21#[repr(C)]
22#[derive(Clone, Copy, Debug, PartialEq)]
23pub enum LLVMCodeGenOptLevel {
24 LLVMCodeGenLevelNone = 0,
25 LLVMCodeGenLevelLess = 1,
26 LLVMCodeGenLevelDefault = 2,
27 LLVMCodeGenLevelAggressive = 3,
28}
29
30#[repr(C)]
31#[derive(Clone, Copy, Debug, PartialEq)]
32pub enum LLVMRelocMode {
33 LLVMRelocDefault = 0,
34 LLVMRelocStatic = 1,
35 LLVMRelocPIC = 2,
36 LLVMRelocDynamicNoPic = 3,
37 LLVMRelocROPI = 4,
38 LLVMRelocRWPI = 5,
39 LLVMRelocROPI_RWPI = 6,
40}
41
42#[repr(C)]
43#[derive(Clone, Copy, Debug, PartialEq)]
44pub enum LLVMCodeModel {
45 LLVMCodeModelDefault = 0,
46 LLVMCodeModelJITDefault = 1,
47 LLVMCodeModelTiny = 2,
48 LLVMCodeModelSmall = 3,
49 LLVMCodeModelKernel = 4,
50 LLVMCodeModelMedium = 5,
51 LLVMCodeModelLarge = 6,
52}
53
54#[repr(C)]
55#[derive(Clone, Copy, Debug, PartialEq)]
56pub enum LLVMCodeGenFileType {
57 LLVMAssemblyFile = 0,
58 LLVMObjectFile = 1,
59}
60
61#[repr(C)]
62#[derive(Clone, Copy, Debug, PartialEq)]
63pub enum LLVMGlobalISelAbortMode {
64 LLVMGlobalISelAbortEnable,
65 LLVMGlobalISelAbortDisable,
66 LLVMGlobalISelAbortDisableWithDiag,
67}
68
69extern "C" {
70 pub fn LLVMGetFirstTarget() -> LLVMTargetRef;
71 pub fn LLVMGetNextTarget(T: LLVMTargetRef) -> LLVMTargetRef;
72 pub fn LLVMGetTargetFromName(Name: *const ::libc::c_char) -> LLVMTargetRef;
73 pub fn LLVMGetTargetFromTriple(
74 Triple: *const ::libc::c_char,
75 T: *mut LLVMTargetRef,
76 ErrorMessage: *mut *mut ::libc::c_char,
77 ) -> LLVMBool;
78 pub fn LLVMGetTargetName(T: LLVMTargetRef) -> *const ::libc::c_char;
79 pub fn LLVMGetTargetDescription(T: LLVMTargetRef) -> *const ::libc::c_char;
80 pub fn LLVMTargetHasJIT(T: LLVMTargetRef) -> LLVMBool;
81 pub fn LLVMTargetHasTargetMachine(T: LLVMTargetRef) -> LLVMBool;
82 pub fn LLVMTargetHasAsmBackend(T: LLVMTargetRef) -> LLVMBool;
83
84 pub fn LLVMCreateTargetMachineOptions() -> LLVMTargetMachineOptionsRef;
90 pub fn LLVMDisposeTargetMachineOptions(Options: LLVMTargetMachineOptionsRef);
92 pub fn LLVMTargetMachineOptionsSetCPU(
93 Options: LLVMTargetMachineOptionsRef,
94 CPU: *const ::libc::c_char,
95 );
96 pub fn LLVMTargetMachineOptionsSetFeatures(
100 Options: LLVMTargetMachineOptionsRef,
101 Features: *const ::libc::c_char,
102 );
103 pub fn LLVMTargetMachineOptionsSetABI(
104 Options: LLVMTargetMachineOptionsRef,
105 ABI: *const ::libc::c_char,
106 );
107 pub fn LLVMTargetMachineOptionsSetCodeGenOptLevel(
108 Options: LLVMTargetMachineOptionsRef,
109 Level: LLVMCodeGenOptLevel,
110 );
111 pub fn LLVMTargetMachineOptionsSetRelocMode(
112 Options: LLVMTargetMachineOptionsRef,
113 Reloc: LLVMRelocMode,
114 );
115 pub fn LLVMTargetMachineOptionsSetCodeModel(
116 Options: LLVMTargetMachineOptionsRef,
117 CodeModel: LLVMCodeModel,
118 );
119 pub fn LLVMCreateTargetMachineWithOptions(
120 T: LLVMTargetRef,
121 Triple: *const ::libc::c_char,
122 Options: LLVMTargetMachineOptionsRef,
123 ) -> LLVMTargetMachineRef;
124
125 pub fn LLVMCreateTargetMachine(
126 T: LLVMTargetRef,
127 Triple: *const ::libc::c_char,
128 CPU: *const ::libc::c_char,
129 Features: *const ::libc::c_char,
130 Level: LLVMCodeGenOptLevel,
131 Reloc: LLVMRelocMode,
132 CodeModel: LLVMCodeModel,
133 ) -> LLVMTargetMachineRef;
134 pub fn LLVMDisposeTargetMachine(T: LLVMTargetMachineRef);
135 pub fn LLVMGetTargetMachineTarget(T: LLVMTargetMachineRef) -> LLVMTargetRef;
136 pub fn LLVMGetTargetMachineTriple(T: LLVMTargetMachineRef) -> *mut ::libc::c_char;
137 pub fn LLVMGetTargetMachineCPU(T: LLVMTargetMachineRef) -> *mut ::libc::c_char;
138 pub fn LLVMGetTargetMachineFeatureString(T: LLVMTargetMachineRef) -> *mut ::libc::c_char;
139 pub fn LLVMCreateTargetDataLayout(T: LLVMTargetMachineRef) -> LLVMTargetDataRef;
141 pub fn LLVMSetTargetMachineAsmVerbosity(T: LLVMTargetMachineRef, VerboseAsm: LLVMBool);
142
143 pub fn LLVMSetTargetMachineFastISel(T: LLVMTargetMachineRef, Enable: LLVMBool);
145 pub fn LLVMSetTargetMachineGlobalISel(T: LLVMTargetMachineRef, Enable: LLVMBool);
147 pub fn LLVMSetTargetMachineGlobalISelAbort(
149 T: LLVMTargetMachineRef,
150 Mode: LLVMGlobalISelAbortMode,
151 );
152 pub fn LLVMSetTargetMachineMachineOutliner(T: LLVMTargetMachineRef, Enable: LLVMBool);
154
155 pub fn LLVMTargetMachineEmitToFile(
156 T: LLVMTargetMachineRef,
157 M: LLVMModuleRef,
158 Filename: *const ::libc::c_char,
159 codegen: LLVMCodeGenFileType,
160 ErrorMessage: *mut *mut ::libc::c_char,
161 ) -> LLVMBool;
162 pub fn LLVMTargetMachineEmitToMemoryBuffer(
163 T: LLVMTargetMachineRef,
164 M: LLVMModuleRef,
165 codegen: LLVMCodeGenFileType,
166 ErrorMessage: *mut *mut ::libc::c_char,
167 OutMemBuf: *mut LLVMMemoryBufferRef,
168 ) -> LLVMBool;
169
170 pub fn LLVMGetDefaultTargetTriple() -> *mut ::libc::c_char;
171 pub fn LLVMNormalizeTargetTriple(triple: *const ::libc::c_char) -> *mut ::libc::c_char;
173 pub fn LLVMGetHostCPUName() -> *mut ::libc::c_char;
175 pub fn LLVMGetHostCPUFeatures() -> *mut ::libc::c_char;
177
178 pub fn LLVMAddAnalysisPasses(T: LLVMTargetMachineRef, PM: LLVMPassManagerRef);
179}