Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1 | #![allow(non_camel_case_types)] |
| 2 | #![allow(non_upper_case_globals)] |
| 3 | |
| 4 | use rustc_codegen_ssa::coverageinfo::map as coverage_map; |
| 5 | |
| 6 | use super::debuginfo::{ |
| 7 | DIArray, DIBasicType, DIBuilder, DICompositeType, DIDerivedType, DIDescriptor, DIEnumerator, |
Thiébaud Weksteen | 5bd94c1 | 2021-01-06 15:18:42 +0100 | [diff] [blame] | 8 | DIFile, DIFlags, DIGlobalVariableExpression, DILexicalBlock, DILocation, DINameSpace, |
| 9 | DISPFlags, DIScope, DISubprogram, DISubrange, DITemplateTypeParameter, DIType, DIVariable, |
| 10 | DebugEmissionKind, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 11 | }; |
| 12 | |
| 13 | use libc::{c_char, c_int, c_uint, size_t}; |
| 14 | use libc::{c_ulonglong, c_void}; |
| 15 | |
| 16 | use std::marker::PhantomData; |
| 17 | |
| 18 | use super::RustString; |
| 19 | |
| 20 | pub type Bool = c_uint; |
| 21 | |
| 22 | pub const True: Bool = 1 as Bool; |
| 23 | pub const False: Bool = 0 as Bool; |
| 24 | |
| 25 | #[derive(Copy, Clone, PartialEq)] |
| 26 | #[repr(C)] |
| 27 | #[allow(dead_code)] // Variants constructed by C++. |
| 28 | pub enum LLVMRustResult { |
| 29 | Success, |
| 30 | Failure, |
| 31 | } |
Chris Wailes | 2f3fdfe | 2021-07-29 10:56:18 -0700 | [diff] [blame] | 32 | |
| 33 | // Rust version of the C struct with the same name in rustc_llvm/llvm-wrapper/RustWrapper.cpp. |
| 34 | #[repr(C)] |
| 35 | pub struct LLVMRustCOFFShortExport { |
| 36 | pub name: *const c_char, |
Chris Wailes | a153842 | 2021-12-02 10:37:12 -0800 | [diff] [blame] | 37 | pub ordinal_present: bool, |
| 38 | // value of `ordinal` only important when `ordinal_present` is true |
| 39 | pub ordinal: u16, |
Chris Wailes | 2f3fdfe | 2021-07-29 10:56:18 -0700 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | impl LLVMRustCOFFShortExport { |
Chris Wailes | a153842 | 2021-12-02 10:37:12 -0800 | [diff] [blame] | 43 | pub fn new(name: *const c_char, ordinal: Option<u16>) -> LLVMRustCOFFShortExport { |
| 44 | LLVMRustCOFFShortExport { |
| 45 | name, |
| 46 | ordinal_present: ordinal.is_some(), |
| 47 | ordinal: ordinal.unwrap_or(0), |
| 48 | } |
Chris Wailes | 2f3fdfe | 2021-07-29 10:56:18 -0700 | [diff] [blame] | 49 | } |
| 50 | } |
| 51 | |
| 52 | /// Translation of LLVM's MachineTypes enum, defined in llvm\include\llvm\BinaryFormat\COFF.h. |
| 53 | /// |
| 54 | /// We include only architectures supported on Windows. |
| 55 | #[derive(Copy, Clone, PartialEq)] |
| 56 | #[repr(C)] |
| 57 | pub enum LLVMMachineType { |
| 58 | AMD64 = 0x8664, |
| 59 | I386 = 0x14c, |
| 60 | ARM64 = 0xaa64, |
| 61 | ARM = 0x01c0, |
| 62 | } |
| 63 | |
Chris Wailes | 2805eef | 2022-04-07 11:22:56 -0700 | [diff] [blame] | 64 | /// LLVM's Module::ModFlagBehavior, defined in llvm/include/llvm/IR/Module.h. |
| 65 | /// |
| 66 | /// When merging modules (e.g. during LTO), their metadata flags are combined. Conflicts are |
| 67 | /// resolved according to the merge behaviors specified here. Flags differing only in merge |
| 68 | /// behavior are still considered to be in conflict. |
| 69 | /// |
| 70 | /// In order for Rust-C LTO to work, we must specify behaviors compatible with Clang. Notably, |
| 71 | /// 'Error' and 'Warning' cannot be mixed for a given flag. |
| 72 | #[derive(Copy, Clone, PartialEq)] |
| 73 | #[repr(C)] |
| 74 | pub enum LLVMModFlagBehavior { |
| 75 | Error = 1, |
| 76 | Warning = 2, |
| 77 | Require = 3, |
| 78 | Override = 4, |
| 79 | Append = 5, |
| 80 | AppendUnique = 6, |
| 81 | Max = 7, |
| 82 | } |
| 83 | |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 84 | // Consts for the LLVM CallConv type, pre-cast to usize. |
| 85 | |
| 86 | /// LLVM CallingConv::ID. Should we wrap this? |
| 87 | #[derive(Copy, Clone, PartialEq, Debug)] |
| 88 | #[repr(C)] |
| 89 | pub enum CallConv { |
| 90 | CCallConv = 0, |
| 91 | FastCallConv = 8, |
| 92 | ColdCallConv = 9, |
| 93 | X86StdcallCallConv = 64, |
| 94 | X86FastcallCallConv = 65, |
| 95 | ArmAapcsCallConv = 67, |
| 96 | Msp430Intr = 69, |
| 97 | X86_ThisCall = 70, |
| 98 | PtxKernel = 71, |
| 99 | X86_64_SysV = 78, |
| 100 | X86_64_Win64 = 79, |
| 101 | X86_VectorCall = 80, |
| 102 | X86_Intr = 83, |
| 103 | AvrNonBlockingInterrupt = 84, |
| 104 | AvrInterrupt = 85, |
| 105 | AmdGpuKernel = 91, |
| 106 | } |
| 107 | |
| 108 | /// LLVMRustLinkage |
Chris Wailes | 2f3fdfe | 2021-07-29 10:56:18 -0700 | [diff] [blame] | 109 | #[derive(Copy, Clone, PartialEq)] |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 110 | #[repr(C)] |
| 111 | pub enum Linkage { |
| 112 | ExternalLinkage = 0, |
| 113 | AvailableExternallyLinkage = 1, |
| 114 | LinkOnceAnyLinkage = 2, |
| 115 | LinkOnceODRLinkage = 3, |
| 116 | WeakAnyLinkage = 4, |
| 117 | WeakODRLinkage = 5, |
| 118 | AppendingLinkage = 6, |
| 119 | InternalLinkage = 7, |
| 120 | PrivateLinkage = 8, |
| 121 | ExternalWeakLinkage = 9, |
| 122 | CommonLinkage = 10, |
| 123 | } |
| 124 | |
| 125 | // LLVMRustVisibility |
| 126 | #[repr(C)] |
Chris Wailes | 2f3fdfe | 2021-07-29 10:56:18 -0700 | [diff] [blame] | 127 | #[derive(Copy, Clone, PartialEq)] |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 128 | pub enum Visibility { |
| 129 | Default = 0, |
| 130 | Hidden = 1, |
| 131 | Protected = 2, |
| 132 | } |
| 133 | |
| 134 | /// LLVMUnnamedAddr |
| 135 | #[repr(C)] |
| 136 | pub enum UnnamedAddr { |
| 137 | No, |
| 138 | Local, |
| 139 | Global, |
| 140 | } |
| 141 | |
| 142 | /// LLVMDLLStorageClass |
| 143 | #[derive(Copy, Clone)] |
| 144 | #[repr(C)] |
| 145 | pub enum DLLStorageClass { |
| 146 | #[allow(dead_code)] |
| 147 | Default = 0, |
| 148 | DllImport = 1, // Function to be imported from DLL. |
| 149 | #[allow(dead_code)] |
| 150 | DllExport = 2, // Function to be accessible from DLL. |
| 151 | } |
| 152 | |
| 153 | /// Matches LLVMRustAttribute in LLVMWrapper.h |
| 154 | /// Semantically a subset of the C++ enum llvm::Attribute::AttrKind, |
| 155 | /// though it is not ABI compatible (since it's a C++ enum) |
| 156 | #[repr(C)] |
| 157 | #[derive(Copy, Clone, Debug)] |
Charisee | 341341c | 2022-05-20 05:14:50 +0000 | [diff] [blame] | 158 | pub enum AttributeKind { |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 159 | AlwaysInline = 0, |
| 160 | ByVal = 1, |
| 161 | Cold = 2, |
| 162 | InlineHint = 3, |
| 163 | MinSize = 4, |
| 164 | Naked = 5, |
| 165 | NoAlias = 6, |
| 166 | NoCapture = 7, |
| 167 | NoInline = 8, |
| 168 | NonNull = 9, |
| 169 | NoRedZone = 10, |
| 170 | NoReturn = 11, |
| 171 | NoUnwind = 12, |
| 172 | OptimizeForSize = 13, |
| 173 | ReadOnly = 14, |
| 174 | SExt = 15, |
| 175 | StructRet = 16, |
| 176 | UWTable = 17, |
| 177 | ZExt = 18, |
| 178 | InReg = 19, |
| 179 | SanitizeThread = 20, |
| 180 | SanitizeAddress = 21, |
| 181 | SanitizeMemory = 22, |
| 182 | NonLazyBind = 23, |
| 183 | OptimizeNone = 24, |
| 184 | ReturnsTwice = 25, |
| 185 | ReadNone = 26, |
| 186 | InaccessibleMemOnly = 27, |
Chris Wailes | e3116c4 | 2021-07-13 14:40:48 -0700 | [diff] [blame] | 187 | SanitizeHWAddress = 28, |
| 188 | WillReturn = 29, |
Chris Wailes | 356b57e | 2022-01-13 10:08:24 -0800 | [diff] [blame] | 189 | StackProtectReq = 30, |
| 190 | StackProtectStrong = 31, |
| 191 | StackProtect = 32, |
Chris Wailes | 2805eef | 2022-04-07 11:22:56 -0700 | [diff] [blame] | 192 | NoUndef = 33, |
| 193 | SanitizeMemTag = 34, |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 194 | NoCfCheck = 35, |
| 195 | ShadowCallStack = 36, |
| 196 | AllocSize = 37, |
| 197 | AllocatedPointer = 38, |
| 198 | AllocAlign = 39, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | /// LLVMIntPredicate |
| 202 | #[derive(Copy, Clone)] |
| 203 | #[repr(C)] |
| 204 | pub enum IntPredicate { |
| 205 | IntEQ = 32, |
| 206 | IntNE = 33, |
| 207 | IntUGT = 34, |
| 208 | IntUGE = 35, |
| 209 | IntULT = 36, |
| 210 | IntULE = 37, |
| 211 | IntSGT = 38, |
| 212 | IntSGE = 39, |
| 213 | IntSLT = 40, |
| 214 | IntSLE = 41, |
| 215 | } |
| 216 | |
| 217 | impl IntPredicate { |
| 218 | pub fn from_generic(intpre: rustc_codegen_ssa::common::IntPredicate) -> Self { |
| 219 | match intpre { |
| 220 | rustc_codegen_ssa::common::IntPredicate::IntEQ => IntPredicate::IntEQ, |
| 221 | rustc_codegen_ssa::common::IntPredicate::IntNE => IntPredicate::IntNE, |
| 222 | rustc_codegen_ssa::common::IntPredicate::IntUGT => IntPredicate::IntUGT, |
| 223 | rustc_codegen_ssa::common::IntPredicate::IntUGE => IntPredicate::IntUGE, |
| 224 | rustc_codegen_ssa::common::IntPredicate::IntULT => IntPredicate::IntULT, |
| 225 | rustc_codegen_ssa::common::IntPredicate::IntULE => IntPredicate::IntULE, |
| 226 | rustc_codegen_ssa::common::IntPredicate::IntSGT => IntPredicate::IntSGT, |
| 227 | rustc_codegen_ssa::common::IntPredicate::IntSGE => IntPredicate::IntSGE, |
| 228 | rustc_codegen_ssa::common::IntPredicate::IntSLT => IntPredicate::IntSLT, |
| 229 | rustc_codegen_ssa::common::IntPredicate::IntSLE => IntPredicate::IntSLE, |
| 230 | } |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | /// LLVMRealPredicate |
| 235 | #[derive(Copy, Clone)] |
| 236 | #[repr(C)] |
| 237 | pub enum RealPredicate { |
| 238 | RealPredicateFalse = 0, |
| 239 | RealOEQ = 1, |
| 240 | RealOGT = 2, |
| 241 | RealOGE = 3, |
| 242 | RealOLT = 4, |
| 243 | RealOLE = 5, |
| 244 | RealONE = 6, |
| 245 | RealORD = 7, |
| 246 | RealUNO = 8, |
| 247 | RealUEQ = 9, |
| 248 | RealUGT = 10, |
| 249 | RealUGE = 11, |
| 250 | RealULT = 12, |
| 251 | RealULE = 13, |
| 252 | RealUNE = 14, |
| 253 | RealPredicateTrue = 15, |
| 254 | } |
| 255 | |
Chris Wailes | a153842 | 2021-12-02 10:37:12 -0800 | [diff] [blame] | 256 | impl RealPredicate { |
| 257 | pub fn from_generic(realp: rustc_codegen_ssa::common::RealPredicate) -> Self { |
| 258 | match realp { |
| 259 | rustc_codegen_ssa::common::RealPredicate::RealPredicateFalse => { |
| 260 | RealPredicate::RealPredicateFalse |
| 261 | } |
| 262 | rustc_codegen_ssa::common::RealPredicate::RealOEQ => RealPredicate::RealOEQ, |
| 263 | rustc_codegen_ssa::common::RealPredicate::RealOGT => RealPredicate::RealOGT, |
| 264 | rustc_codegen_ssa::common::RealPredicate::RealOGE => RealPredicate::RealOGE, |
| 265 | rustc_codegen_ssa::common::RealPredicate::RealOLT => RealPredicate::RealOLT, |
| 266 | rustc_codegen_ssa::common::RealPredicate::RealOLE => RealPredicate::RealOLE, |
| 267 | rustc_codegen_ssa::common::RealPredicate::RealONE => RealPredicate::RealONE, |
| 268 | rustc_codegen_ssa::common::RealPredicate::RealORD => RealPredicate::RealORD, |
| 269 | rustc_codegen_ssa::common::RealPredicate::RealUNO => RealPredicate::RealUNO, |
| 270 | rustc_codegen_ssa::common::RealPredicate::RealUEQ => RealPredicate::RealUEQ, |
| 271 | rustc_codegen_ssa::common::RealPredicate::RealUGT => RealPredicate::RealUGT, |
| 272 | rustc_codegen_ssa::common::RealPredicate::RealUGE => RealPredicate::RealUGE, |
| 273 | rustc_codegen_ssa::common::RealPredicate::RealULT => RealPredicate::RealULT, |
| 274 | rustc_codegen_ssa::common::RealPredicate::RealULE => RealPredicate::RealULE, |
| 275 | rustc_codegen_ssa::common::RealPredicate::RealUNE => RealPredicate::RealUNE, |
| 276 | rustc_codegen_ssa::common::RealPredicate::RealPredicateTrue => { |
| 277 | RealPredicate::RealPredicateTrue |
| 278 | } |
| 279 | } |
| 280 | } |
| 281 | } |
| 282 | |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 283 | /// LLVMTypeKind |
| 284 | #[derive(Copy, Clone, PartialEq, Debug)] |
| 285 | #[repr(C)] |
| 286 | pub enum TypeKind { |
| 287 | Void = 0, |
| 288 | Half = 1, |
| 289 | Float = 2, |
| 290 | Double = 3, |
| 291 | X86_FP80 = 4, |
| 292 | FP128 = 5, |
| 293 | PPC_FP128 = 6, |
| 294 | Label = 7, |
| 295 | Integer = 8, |
| 296 | Function = 9, |
| 297 | Struct = 10, |
| 298 | Array = 11, |
| 299 | Pointer = 12, |
| 300 | Vector = 13, |
| 301 | Metadata = 14, |
| 302 | X86_MMX = 15, |
| 303 | Token = 16, |
| 304 | ScalableVector = 17, |
| 305 | BFloat = 18, |
Chris Wailes | e3116c4 | 2021-07-13 14:40:48 -0700 | [diff] [blame] | 306 | X86_AMX = 19, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 307 | } |
| 308 | |
| 309 | impl TypeKind { |
| 310 | pub fn to_generic(self) -> rustc_codegen_ssa::common::TypeKind { |
| 311 | match self { |
| 312 | TypeKind::Void => rustc_codegen_ssa::common::TypeKind::Void, |
| 313 | TypeKind::Half => rustc_codegen_ssa::common::TypeKind::Half, |
| 314 | TypeKind::Float => rustc_codegen_ssa::common::TypeKind::Float, |
| 315 | TypeKind::Double => rustc_codegen_ssa::common::TypeKind::Double, |
| 316 | TypeKind::X86_FP80 => rustc_codegen_ssa::common::TypeKind::X86_FP80, |
| 317 | TypeKind::FP128 => rustc_codegen_ssa::common::TypeKind::FP128, |
| 318 | TypeKind::PPC_FP128 => rustc_codegen_ssa::common::TypeKind::PPC_FP128, |
| 319 | TypeKind::Label => rustc_codegen_ssa::common::TypeKind::Label, |
| 320 | TypeKind::Integer => rustc_codegen_ssa::common::TypeKind::Integer, |
| 321 | TypeKind::Function => rustc_codegen_ssa::common::TypeKind::Function, |
| 322 | TypeKind::Struct => rustc_codegen_ssa::common::TypeKind::Struct, |
| 323 | TypeKind::Array => rustc_codegen_ssa::common::TypeKind::Array, |
| 324 | TypeKind::Pointer => rustc_codegen_ssa::common::TypeKind::Pointer, |
| 325 | TypeKind::Vector => rustc_codegen_ssa::common::TypeKind::Vector, |
| 326 | TypeKind::Metadata => rustc_codegen_ssa::common::TypeKind::Metadata, |
| 327 | TypeKind::X86_MMX => rustc_codegen_ssa::common::TypeKind::X86_MMX, |
| 328 | TypeKind::Token => rustc_codegen_ssa::common::TypeKind::Token, |
| 329 | TypeKind::ScalableVector => rustc_codegen_ssa::common::TypeKind::ScalableVector, |
| 330 | TypeKind::BFloat => rustc_codegen_ssa::common::TypeKind::BFloat, |
Chris Wailes | e3116c4 | 2021-07-13 14:40:48 -0700 | [diff] [blame] | 331 | TypeKind::X86_AMX => rustc_codegen_ssa::common::TypeKind::X86_AMX, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 332 | } |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | /// LLVMAtomicRmwBinOp |
| 337 | #[derive(Copy, Clone)] |
| 338 | #[repr(C)] |
| 339 | pub enum AtomicRmwBinOp { |
| 340 | AtomicXchg = 0, |
| 341 | AtomicAdd = 1, |
| 342 | AtomicSub = 2, |
| 343 | AtomicAnd = 3, |
| 344 | AtomicNand = 4, |
| 345 | AtomicOr = 5, |
| 346 | AtomicXor = 6, |
| 347 | AtomicMax = 7, |
| 348 | AtomicMin = 8, |
| 349 | AtomicUMax = 9, |
| 350 | AtomicUMin = 10, |
| 351 | } |
| 352 | |
| 353 | impl AtomicRmwBinOp { |
| 354 | pub fn from_generic(op: rustc_codegen_ssa::common::AtomicRmwBinOp) -> Self { |
| 355 | match op { |
| 356 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXchg => AtomicRmwBinOp::AtomicXchg, |
| 357 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAdd => AtomicRmwBinOp::AtomicAdd, |
| 358 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicSub => AtomicRmwBinOp::AtomicSub, |
| 359 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAnd => AtomicRmwBinOp::AtomicAnd, |
| 360 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicNand => AtomicRmwBinOp::AtomicNand, |
| 361 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicOr => AtomicRmwBinOp::AtomicOr, |
| 362 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXor => AtomicRmwBinOp::AtomicXor, |
| 363 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMax => AtomicRmwBinOp::AtomicMax, |
| 364 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMin => AtomicRmwBinOp::AtomicMin, |
| 365 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMax => AtomicRmwBinOp::AtomicUMax, |
| 366 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMin => AtomicRmwBinOp::AtomicUMin, |
| 367 | } |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | /// LLVMAtomicOrdering |
| 372 | #[derive(Copy, Clone)] |
| 373 | #[repr(C)] |
| 374 | pub enum AtomicOrdering { |
| 375 | #[allow(dead_code)] |
| 376 | NotAtomic = 0, |
| 377 | Unordered = 1, |
| 378 | Monotonic = 2, |
| 379 | // Consume = 3, // Not specified yet. |
| 380 | Acquire = 4, |
| 381 | Release = 5, |
| 382 | AcquireRelease = 6, |
| 383 | SequentiallyConsistent = 7, |
| 384 | } |
| 385 | |
| 386 | impl AtomicOrdering { |
| 387 | pub fn from_generic(ao: rustc_codegen_ssa::common::AtomicOrdering) -> Self { |
| 388 | match ao { |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 389 | rustc_codegen_ssa::common::AtomicOrdering::Unordered => AtomicOrdering::Unordered, |
Chris Wailes | 6572058 | 2022-08-11 09:53:28 -0700 | [diff] [blame] | 390 | rustc_codegen_ssa::common::AtomicOrdering::Relaxed => AtomicOrdering::Monotonic, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 391 | rustc_codegen_ssa::common::AtomicOrdering::Acquire => AtomicOrdering::Acquire, |
| 392 | rustc_codegen_ssa::common::AtomicOrdering::Release => AtomicOrdering::Release, |
| 393 | rustc_codegen_ssa::common::AtomicOrdering::AcquireRelease => { |
| 394 | AtomicOrdering::AcquireRelease |
| 395 | } |
| 396 | rustc_codegen_ssa::common::AtomicOrdering::SequentiallyConsistent => { |
| 397 | AtomicOrdering::SequentiallyConsistent |
| 398 | } |
| 399 | } |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | /// LLVMRustSynchronizationScope |
| 404 | #[derive(Copy, Clone)] |
| 405 | #[repr(C)] |
| 406 | pub enum SynchronizationScope { |
| 407 | SingleThread, |
| 408 | CrossThread, |
| 409 | } |
| 410 | |
| 411 | impl SynchronizationScope { |
| 412 | pub fn from_generic(sc: rustc_codegen_ssa::common::SynchronizationScope) -> Self { |
| 413 | match sc { |
| 414 | rustc_codegen_ssa::common::SynchronizationScope::SingleThread => { |
| 415 | SynchronizationScope::SingleThread |
| 416 | } |
| 417 | rustc_codegen_ssa::common::SynchronizationScope::CrossThread => { |
| 418 | SynchronizationScope::CrossThread |
| 419 | } |
| 420 | } |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | /// LLVMRustFileType |
| 425 | #[derive(Copy, Clone)] |
| 426 | #[repr(C)] |
| 427 | pub enum FileType { |
| 428 | AssemblyFile, |
| 429 | ObjectFile, |
| 430 | } |
| 431 | |
| 432 | /// LLVMMetadataType |
| 433 | #[derive(Copy, Clone)] |
| 434 | #[repr(C)] |
| 435 | pub enum MetadataType { |
| 436 | MD_dbg = 0, |
| 437 | MD_tbaa = 1, |
| 438 | MD_prof = 2, |
| 439 | MD_fpmath = 3, |
| 440 | MD_range = 4, |
| 441 | MD_tbaa_struct = 5, |
| 442 | MD_invariant_load = 6, |
| 443 | MD_alias_scope = 7, |
| 444 | MD_noalias = 8, |
| 445 | MD_nontemporal = 9, |
| 446 | MD_mem_parallel_loop_access = 10, |
| 447 | MD_nonnull = 11, |
Charisee | 341341c | 2022-05-20 05:14:50 +0000 | [diff] [blame] | 448 | MD_align = 17, |
Chris Wailes | 356b57e | 2022-01-13 10:08:24 -0800 | [diff] [blame] | 449 | MD_type = 19, |
Chris Wailes | 6572058 | 2022-08-11 09:53:28 -0700 | [diff] [blame] | 450 | MD_vcall_visibility = 28, |
Charisee | 341341c | 2022-05-20 05:14:50 +0000 | [diff] [blame] | 451 | MD_noundef = 29, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 452 | } |
| 453 | |
| 454 | /// LLVMRustAsmDialect |
Chris Wailes | 2805eef | 2022-04-07 11:22:56 -0700 | [diff] [blame] | 455 | #[derive(Copy, Clone, PartialEq)] |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 456 | #[repr(C)] |
| 457 | pub enum AsmDialect { |
| 458 | Att, |
| 459 | Intel, |
| 460 | } |
| 461 | |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 462 | /// LLVMRustCodeGenOptLevel |
| 463 | #[derive(Copy, Clone, PartialEq)] |
| 464 | #[repr(C)] |
| 465 | pub enum CodeGenOptLevel { |
| 466 | None, |
| 467 | Less, |
| 468 | Default, |
| 469 | Aggressive, |
| 470 | } |
| 471 | |
| 472 | /// LLVMRustPassBuilderOptLevel |
| 473 | #[repr(C)] |
| 474 | pub enum PassBuilderOptLevel { |
| 475 | O0, |
| 476 | O1, |
| 477 | O2, |
| 478 | O3, |
| 479 | Os, |
| 480 | Oz, |
| 481 | } |
| 482 | |
| 483 | /// LLVMRustOptStage |
| 484 | #[derive(PartialEq)] |
| 485 | #[repr(C)] |
| 486 | pub enum OptStage { |
| 487 | PreLinkNoLTO, |
| 488 | PreLinkThinLTO, |
| 489 | PreLinkFatLTO, |
| 490 | ThinLTO, |
| 491 | FatLTO, |
| 492 | } |
| 493 | |
| 494 | /// LLVMRustSanitizerOptions |
| 495 | #[repr(C)] |
| 496 | pub struct SanitizerOptions { |
| 497 | pub sanitize_address: bool, |
| 498 | pub sanitize_address_recover: bool, |
| 499 | pub sanitize_memory: bool, |
| 500 | pub sanitize_memory_recover: bool, |
| 501 | pub sanitize_memory_track_origins: c_int, |
| 502 | pub sanitize_thread: bool, |
Chris Wailes | e3116c4 | 2021-07-13 14:40:48 -0700 | [diff] [blame] | 503 | pub sanitize_hwaddress: bool, |
| 504 | pub sanitize_hwaddress_recover: bool, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 505 | } |
| 506 | |
| 507 | /// LLVMRelocMode |
| 508 | #[derive(Copy, Clone, PartialEq)] |
| 509 | #[repr(C)] |
| 510 | pub enum RelocModel { |
| 511 | Static, |
| 512 | PIC, |
| 513 | DynamicNoPic, |
| 514 | ROPI, |
| 515 | RWPI, |
| 516 | ROPI_RWPI, |
| 517 | } |
| 518 | |
| 519 | /// LLVMRustCodeModel |
| 520 | #[derive(Copy, Clone)] |
| 521 | #[repr(C)] |
| 522 | pub enum CodeModel { |
| 523 | Tiny, |
| 524 | Small, |
| 525 | Kernel, |
| 526 | Medium, |
| 527 | Large, |
| 528 | None, |
| 529 | } |
| 530 | |
| 531 | /// LLVMRustDiagnosticKind |
| 532 | #[derive(Copy, Clone)] |
| 533 | #[repr(C)] |
| 534 | #[allow(dead_code)] // Variants constructed by C++. |
| 535 | pub enum DiagnosticKind { |
| 536 | Other, |
| 537 | InlineAsm, |
| 538 | StackSize, |
| 539 | DebugMetadataVersion, |
| 540 | SampleProfile, |
| 541 | OptimizationRemark, |
| 542 | OptimizationRemarkMissed, |
| 543 | OptimizationRemarkAnalysis, |
| 544 | OptimizationRemarkAnalysisFPCommute, |
| 545 | OptimizationRemarkAnalysisAliasing, |
| 546 | OptimizationRemarkOther, |
| 547 | OptimizationFailure, |
| 548 | PGOProfile, |
| 549 | Linker, |
| 550 | Unsupported, |
Chris Wailes | bcf972c | 2021-10-21 11:03:28 -0700 | [diff] [blame] | 551 | SrcMgr, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 552 | } |
| 553 | |
| 554 | /// LLVMRustDiagnosticLevel |
| 555 | #[derive(Copy, Clone)] |
| 556 | #[repr(C)] |
| 557 | #[allow(dead_code)] // Variants constructed by C++. |
| 558 | pub enum DiagnosticLevel { |
| 559 | Error, |
| 560 | Warning, |
| 561 | Note, |
| 562 | Remark, |
| 563 | } |
| 564 | |
| 565 | /// LLVMRustArchiveKind |
| 566 | #[derive(Copy, Clone)] |
| 567 | #[repr(C)] |
| 568 | pub enum ArchiveKind { |
| 569 | K_GNU, |
| 570 | K_BSD, |
| 571 | K_DARWIN, |
| 572 | K_COFF, |
| 573 | } |
| 574 | |
Charisee | 341341c | 2022-05-20 05:14:50 +0000 | [diff] [blame] | 575 | // LLVMRustThinLTOData |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 576 | extern "C" { |
| 577 | pub type ThinLTOData; |
| 578 | } |
| 579 | |
Charisee | 341341c | 2022-05-20 05:14:50 +0000 | [diff] [blame] | 580 | // LLVMRustThinLTOBuffer |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 581 | extern "C" { |
| 582 | pub type ThinLTOBuffer; |
| 583 | } |
| 584 | |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 585 | /// LLVMRustThinLTOModule |
| 586 | #[repr(C)] |
| 587 | pub struct ThinLTOModule { |
| 588 | pub identifier: *const c_char, |
| 589 | pub data: *const u8, |
| 590 | pub len: usize, |
| 591 | } |
| 592 | |
| 593 | /// LLVMThreadLocalMode |
| 594 | #[derive(Copy, Clone)] |
| 595 | #[repr(C)] |
| 596 | pub enum ThreadLocalMode { |
| 597 | NotThreadLocal, |
| 598 | GeneralDynamic, |
| 599 | LocalDynamic, |
| 600 | InitialExec, |
| 601 | LocalExec, |
| 602 | } |
| 603 | |
| 604 | /// LLVMRustChecksumKind |
| 605 | #[derive(Copy, Clone)] |
| 606 | #[repr(C)] |
| 607 | pub enum ChecksumKind { |
| 608 | None, |
| 609 | MD5, |
| 610 | SHA1, |
Thiébaud Weksteen | 5bd94c1 | 2021-01-06 15:18:42 +0100 | [diff] [blame] | 611 | SHA256, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 612 | } |
| 613 | |
| 614 | extern "C" { |
| 615 | type Opaque; |
| 616 | } |
| 617 | #[repr(C)] |
| 618 | struct InvariantOpaque<'a> { |
| 619 | _marker: PhantomData<&'a mut &'a ()>, |
| 620 | _opaque: Opaque, |
| 621 | } |
| 622 | |
| 623 | // Opaque pointer types |
| 624 | extern "C" { |
| 625 | pub type Module; |
| 626 | } |
| 627 | extern "C" { |
| 628 | pub type Context; |
| 629 | } |
| 630 | extern "C" { |
| 631 | pub type Type; |
| 632 | } |
| 633 | extern "C" { |
| 634 | pub type Value; |
| 635 | } |
| 636 | extern "C" { |
| 637 | pub type ConstantInt; |
| 638 | } |
| 639 | extern "C" { |
Charisee | 341341c | 2022-05-20 05:14:50 +0000 | [diff] [blame] | 640 | pub type Attribute; |
| 641 | } |
| 642 | extern "C" { |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 643 | pub type Metadata; |
| 644 | } |
| 645 | extern "C" { |
| 646 | pub type BasicBlock; |
| 647 | } |
| 648 | #[repr(C)] |
| 649 | pub struct Builder<'a>(InvariantOpaque<'a>); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 650 | #[repr(C)] |
| 651 | pub struct PassManager<'a>(InvariantOpaque<'a>); |
| 652 | extern "C" { |
| 653 | pub type PassManagerBuilder; |
| 654 | } |
| 655 | extern "C" { |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 656 | pub type Pass; |
| 657 | } |
| 658 | extern "C" { |
| 659 | pub type TargetMachine; |
| 660 | } |
| 661 | extern "C" { |
| 662 | pub type Archive; |
| 663 | } |
| 664 | #[repr(C)] |
| 665 | pub struct ArchiveIterator<'a>(InvariantOpaque<'a>); |
| 666 | #[repr(C)] |
| 667 | pub struct ArchiveChild<'a>(InvariantOpaque<'a>); |
| 668 | extern "C" { |
| 669 | pub type Twine; |
| 670 | } |
| 671 | extern "C" { |
| 672 | pub type DiagnosticInfo; |
| 673 | } |
| 674 | extern "C" { |
| 675 | pub type SMDiagnostic; |
| 676 | } |
| 677 | #[repr(C)] |
| 678 | pub struct RustArchiveMember<'a>(InvariantOpaque<'a>); |
| 679 | #[repr(C)] |
| 680 | pub struct OperandBundleDef<'a>(InvariantOpaque<'a>); |
| 681 | #[repr(C)] |
| 682 | pub struct Linker<'a>(InvariantOpaque<'a>); |
| 683 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 684 | extern "C" { |
| 685 | pub type DiagnosticHandler; |
| 686 | } |
| 687 | |
| 688 | pub type DiagnosticHandlerTy = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void); |
| 689 | pub type InlineAsmDiagHandlerTy = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 690 | |
| 691 | pub mod coverageinfo { |
| 692 | use super::coverage_map; |
| 693 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 694 | /// Aligns with [llvm::coverage::CounterMappingRegion::RegionKind](https://github.com/rust-lang/llvm-project/blob/rustc/13.0-2021-09-30/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h#L209-L230) |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 695 | #[derive(Copy, Clone, Debug)] |
| 696 | #[repr(C)] |
| 697 | pub enum RegionKind { |
| 698 | /// A CodeRegion associates some code with a counter |
| 699 | CodeRegion = 0, |
| 700 | |
| 701 | /// An ExpansionRegion represents a file expansion region that associates |
| 702 | /// a source range with the expansion of a virtual source file, such as |
| 703 | /// for a macro instantiation or #include file. |
| 704 | ExpansionRegion = 1, |
| 705 | |
| 706 | /// A SkippedRegion represents a source range with code that was skipped |
| 707 | /// by a preprocessor or similar means. |
| 708 | SkippedRegion = 2, |
| 709 | |
| 710 | /// A GapRegion is like a CodeRegion, but its count is only set as the |
| 711 | /// line execution count when its the only region in the line. |
| 712 | GapRegion = 3, |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 713 | |
| 714 | /// A BranchRegion represents leaf-level boolean expressions and is |
| 715 | /// associated with two counters, each representing the number of times the |
| 716 | /// expression evaluates to true or false. |
| 717 | BranchRegion = 4, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 718 | } |
| 719 | |
| 720 | /// This struct provides LLVM's representation of a "CoverageMappingRegion", encoded into the |
| 721 | /// coverage map, in accordance with the |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 722 | /// [LLVM Code Coverage Mapping Format](https://github.com/rust-lang/llvm-project/blob/rustc/13.0-2021-09-30/llvm/docs/CoverageMappingFormat.rst#llvm-code-coverage-mapping-format). |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 723 | /// The struct composes fields representing the `Counter` type and value(s) (injected counter |
| 724 | /// ID, or expression type and operands), the source file (an indirect index into a "filenames |
| 725 | /// array", encoded separately), and source location (start and end positions of the represented |
| 726 | /// code region). |
| 727 | /// |
Chris Wailes | e3116c4 | 2021-07-13 14:40:48 -0700 | [diff] [blame] | 728 | /// Matches LLVMRustCounterMappingRegion. |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 729 | #[derive(Copy, Clone, Debug)] |
| 730 | #[repr(C)] |
| 731 | pub struct CounterMappingRegion { |
| 732 | /// The counter type and type-dependent counter data, if any. |
| 733 | counter: coverage_map::Counter, |
| 734 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 735 | /// If the `RegionKind` is a `BranchRegion`, this represents the counter |
| 736 | /// for the false branch of the region. |
| 737 | false_counter: coverage_map::Counter, |
| 738 | |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 739 | /// An indirect reference to the source filename. In the LLVM Coverage Mapping Format, the |
| 740 | /// file_id is an index into a function-specific `virtual_file_mapping` array of indexes |
| 741 | /// that, in turn, are used to look up the filename for this region. |
| 742 | file_id: u32, |
| 743 | |
| 744 | /// If the `RegionKind` is an `ExpansionRegion`, the `expanded_file_id` can be used to find |
| 745 | /// the mapping regions created as a result of macro expansion, by checking if their file id |
| 746 | /// matches the expanded file id. |
| 747 | expanded_file_id: u32, |
| 748 | |
| 749 | /// 1-based starting line of the mapping region. |
| 750 | start_line: u32, |
| 751 | |
| 752 | /// 1-based starting column of the mapping region. |
| 753 | start_col: u32, |
| 754 | |
| 755 | /// 1-based ending line of the mapping region. |
| 756 | end_line: u32, |
| 757 | |
| 758 | /// 1-based ending column of the mapping region. If the high bit is set, the current |
| 759 | /// mapping region is a gap area. |
| 760 | end_col: u32, |
| 761 | |
| 762 | kind: RegionKind, |
| 763 | } |
| 764 | |
| 765 | impl CounterMappingRegion { |
Chris Wailes | 6572058 | 2022-08-11 09:53:28 -0700 | [diff] [blame] | 766 | pub(crate) fn code_region( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 767 | counter: coverage_map::Counter, |
| 768 | file_id: u32, |
| 769 | start_line: u32, |
| 770 | start_col: u32, |
| 771 | end_line: u32, |
| 772 | end_col: u32, |
| 773 | ) -> Self { |
| 774 | Self { |
| 775 | counter, |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 776 | false_counter: coverage_map::Counter::zero(), |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 777 | file_id, |
| 778 | expanded_file_id: 0, |
| 779 | start_line, |
| 780 | start_col, |
| 781 | end_line, |
| 782 | end_col, |
| 783 | kind: RegionKind::CodeRegion, |
| 784 | } |
| 785 | } |
| 786 | |
Chris Wailes | 32f7835 | 2021-07-20 14:04:55 -0700 | [diff] [blame] | 787 | // This function might be used in the future; the LLVM API is still evolving, as is coverage |
| 788 | // support. |
| 789 | #[allow(dead_code)] |
Chris Wailes | 6572058 | 2022-08-11 09:53:28 -0700 | [diff] [blame] | 790 | pub(crate) fn branch_region( |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 791 | counter: coverage_map::Counter, |
| 792 | false_counter: coverage_map::Counter, |
| 793 | file_id: u32, |
| 794 | start_line: u32, |
| 795 | start_col: u32, |
| 796 | end_line: u32, |
| 797 | end_col: u32, |
| 798 | ) -> Self { |
| 799 | Self { |
| 800 | counter, |
| 801 | false_counter, |
| 802 | file_id, |
| 803 | expanded_file_id: 0, |
| 804 | start_line, |
| 805 | start_col, |
| 806 | end_line, |
| 807 | end_col, |
| 808 | kind: RegionKind::BranchRegion, |
| 809 | } |
| 810 | } |
| 811 | |
| 812 | // This function might be used in the future; the LLVM API is still evolving, as is coverage |
| 813 | // support. |
| 814 | #[allow(dead_code)] |
Chris Wailes | 6572058 | 2022-08-11 09:53:28 -0700 | [diff] [blame] | 815 | pub(crate) fn expansion_region( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 816 | file_id: u32, |
| 817 | expanded_file_id: u32, |
| 818 | start_line: u32, |
| 819 | start_col: u32, |
| 820 | end_line: u32, |
| 821 | end_col: u32, |
| 822 | ) -> Self { |
| 823 | Self { |
| 824 | counter: coverage_map::Counter::zero(), |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 825 | false_counter: coverage_map::Counter::zero(), |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 826 | file_id, |
| 827 | expanded_file_id, |
| 828 | start_line, |
| 829 | start_col, |
| 830 | end_line, |
| 831 | end_col, |
| 832 | kind: RegionKind::ExpansionRegion, |
| 833 | } |
| 834 | } |
| 835 | |
Chris Wailes | 32f7835 | 2021-07-20 14:04:55 -0700 | [diff] [blame] | 836 | // This function might be used in the future; the LLVM API is still evolving, as is coverage |
| 837 | // support. |
| 838 | #[allow(dead_code)] |
Chris Wailes | 6572058 | 2022-08-11 09:53:28 -0700 | [diff] [blame] | 839 | pub(crate) fn skipped_region( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 840 | file_id: u32, |
| 841 | start_line: u32, |
| 842 | start_col: u32, |
| 843 | end_line: u32, |
| 844 | end_col: u32, |
| 845 | ) -> Self { |
| 846 | Self { |
| 847 | counter: coverage_map::Counter::zero(), |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 848 | false_counter: coverage_map::Counter::zero(), |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 849 | file_id, |
| 850 | expanded_file_id: 0, |
| 851 | start_line, |
| 852 | start_col, |
| 853 | end_line, |
| 854 | end_col, |
| 855 | kind: RegionKind::SkippedRegion, |
| 856 | } |
| 857 | } |
| 858 | |
Chris Wailes | 32f7835 | 2021-07-20 14:04:55 -0700 | [diff] [blame] | 859 | // This function might be used in the future; the LLVM API is still evolving, as is coverage |
| 860 | // support. |
| 861 | #[allow(dead_code)] |
Chris Wailes | 6572058 | 2022-08-11 09:53:28 -0700 | [diff] [blame] | 862 | pub(crate) fn gap_region( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 863 | counter: coverage_map::Counter, |
| 864 | file_id: u32, |
| 865 | start_line: u32, |
| 866 | start_col: u32, |
| 867 | end_line: u32, |
| 868 | end_col: u32, |
| 869 | ) -> Self { |
| 870 | Self { |
| 871 | counter, |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 872 | false_counter: coverage_map::Counter::zero(), |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 873 | file_id, |
| 874 | expanded_file_id: 0, |
| 875 | start_line, |
| 876 | start_col, |
| 877 | end_line, |
Chris Wailes | a153842 | 2021-12-02 10:37:12 -0800 | [diff] [blame] | 878 | end_col: (1_u32 << 31) | end_col, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 879 | kind: RegionKind::GapRegion, |
| 880 | } |
| 881 | } |
| 882 | } |
| 883 | } |
| 884 | |
| 885 | pub mod debuginfo { |
| 886 | use super::{InvariantOpaque, Metadata}; |
| 887 | use bitflags::bitflags; |
| 888 | |
| 889 | #[repr(C)] |
| 890 | pub struct DIBuilder<'a>(InvariantOpaque<'a>); |
| 891 | |
| 892 | pub type DIDescriptor = Metadata; |
Thiébaud Weksteen | 5bd94c1 | 2021-01-06 15:18:42 +0100 | [diff] [blame] | 893 | pub type DILocation = Metadata; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 894 | pub type DIScope = DIDescriptor; |
| 895 | pub type DIFile = DIScope; |
| 896 | pub type DILexicalBlock = DIScope; |
| 897 | pub type DISubprogram = DIScope; |
| 898 | pub type DINameSpace = DIScope; |
| 899 | pub type DIType = DIDescriptor; |
| 900 | pub type DIBasicType = DIType; |
| 901 | pub type DIDerivedType = DIType; |
| 902 | pub type DICompositeType = DIDerivedType; |
| 903 | pub type DIVariable = DIDescriptor; |
| 904 | pub type DIGlobalVariableExpression = DIDescriptor; |
| 905 | pub type DIArray = DIDescriptor; |
| 906 | pub type DISubrange = DIDescriptor; |
| 907 | pub type DIEnumerator = DIDescriptor; |
| 908 | pub type DITemplateTypeParameter = DIDescriptor; |
| 909 | |
| 910 | // These values **must** match with LLVMRustDIFlags!! |
| 911 | bitflags! { |
| 912 | #[repr(transparent)] |
| 913 | #[derive(Default)] |
| 914 | pub struct DIFlags: u32 { |
| 915 | const FlagZero = 0; |
| 916 | const FlagPrivate = 1; |
| 917 | const FlagProtected = 2; |
| 918 | const FlagPublic = 3; |
| 919 | const FlagFwdDecl = (1 << 2); |
| 920 | const FlagAppleBlock = (1 << 3); |
| 921 | const FlagBlockByrefStruct = (1 << 4); |
| 922 | const FlagVirtual = (1 << 5); |
| 923 | const FlagArtificial = (1 << 6); |
| 924 | const FlagExplicit = (1 << 7); |
| 925 | const FlagPrototyped = (1 << 8); |
| 926 | const FlagObjcClassComplete = (1 << 9); |
| 927 | const FlagObjectPointer = (1 << 10); |
| 928 | const FlagVector = (1 << 11); |
| 929 | const FlagStaticMember = (1 << 12); |
| 930 | const FlagLValueReference = (1 << 13); |
| 931 | const FlagRValueReference = (1 << 14); |
| 932 | const FlagExternalTypeRef = (1 << 15); |
| 933 | const FlagIntroducedVirtual = (1 << 18); |
| 934 | const FlagBitField = (1 << 19); |
| 935 | const FlagNoReturn = (1 << 20); |
| 936 | } |
| 937 | } |
| 938 | |
| 939 | // These values **must** match with LLVMRustDISPFlags!! |
| 940 | bitflags! { |
| 941 | #[repr(transparent)] |
| 942 | #[derive(Default)] |
| 943 | pub struct DISPFlags: u32 { |
| 944 | const SPFlagZero = 0; |
| 945 | const SPFlagVirtual = 1; |
| 946 | const SPFlagPureVirtual = 2; |
| 947 | const SPFlagLocalToUnit = (1 << 2); |
| 948 | const SPFlagDefinition = (1 << 3); |
| 949 | const SPFlagOptimized = (1 << 4); |
| 950 | const SPFlagMainSubprogram = (1 << 5); |
| 951 | } |
| 952 | } |
| 953 | |
| 954 | /// LLVMRustDebugEmissionKind |
| 955 | #[derive(Copy, Clone)] |
| 956 | #[repr(C)] |
| 957 | pub enum DebugEmissionKind { |
| 958 | NoDebug, |
| 959 | FullDebug, |
| 960 | LineTablesOnly, |
| 961 | } |
| 962 | |
| 963 | impl DebugEmissionKind { |
| 964 | pub fn from_generic(kind: rustc_session::config::DebugInfo) -> Self { |
| 965 | use rustc_session::config::DebugInfo; |
| 966 | match kind { |
| 967 | DebugInfo::None => DebugEmissionKind::NoDebug, |
| 968 | DebugInfo::Limited => DebugEmissionKind::LineTablesOnly, |
| 969 | DebugInfo::Full => DebugEmissionKind::FullDebug, |
| 970 | } |
| 971 | } |
| 972 | } |
| 973 | } |
| 974 | |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 975 | use bitflags::bitflags; |
| 976 | // These values **must** match with LLVMRustAllocKindFlags |
| 977 | bitflags! { |
| 978 | #[repr(transparent)] |
| 979 | #[derive(Default)] |
| 980 | pub struct AllocKindFlags : u64 { |
| 981 | const Unknown = 0; |
| 982 | const Alloc = 1; |
| 983 | const Realloc = 1 << 1; |
| 984 | const Free = 1 << 2; |
| 985 | const Uninitialized = 1 << 3; |
| 986 | const Zeroed = 1 << 4; |
| 987 | const Aligned = 1 << 5; |
| 988 | } |
| 989 | } |
| 990 | |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 991 | extern "C" { |
| 992 | pub type ModuleBuffer; |
| 993 | } |
| 994 | |
| 995 | pub type SelfProfileBeforePassCallback = |
| 996 | unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char); |
| 997 | pub type SelfProfileAfterPassCallback = unsafe extern "C" fn(*mut c_void); |
| 998 | |
| 999 | extern "C" { |
| 1000 | pub fn LLVMRustInstallFatalErrorHandler(); |
Chris Wailes | 2805eef | 2022-04-07 11:22:56 -0700 | [diff] [blame] | 1001 | pub fn LLVMRustDisableSystemDialogsOnCrash(); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1002 | |
| 1003 | // Create and destroy contexts. |
| 1004 | pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context; |
| 1005 | pub fn LLVMContextDispose(C: &'static mut Context); |
| 1006 | pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint; |
| 1007 | |
| 1008 | // Create modules. |
| 1009 | pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module; |
| 1010 | pub fn LLVMGetModuleContext(M: &Module) -> &Context; |
| 1011 | pub fn LLVMCloneModule(M: &Module) -> &Module; |
| 1012 | |
| 1013 | /// Data layout. See Module::getDataLayout. |
| 1014 | pub fn LLVMGetDataLayoutStr(M: &Module) -> *const c_char; |
| 1015 | pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char); |
| 1016 | |
| 1017 | /// See Module::setModuleInlineAsm. |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1018 | pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char, AsmLen: size_t); |
| 1019 | |
| 1020 | /// See llvm::LLVMTypeKind::getTypeID. |
| 1021 | pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind; |
| 1022 | |
| 1023 | // Operations on integer types |
| 1024 | pub fn LLVMInt1TypeInContext(C: &Context) -> &Type; |
| 1025 | pub fn LLVMInt8TypeInContext(C: &Context) -> &Type; |
| 1026 | pub fn LLVMInt16TypeInContext(C: &Context) -> &Type; |
| 1027 | pub fn LLVMInt32TypeInContext(C: &Context) -> &Type; |
| 1028 | pub fn LLVMInt64TypeInContext(C: &Context) -> &Type; |
| 1029 | pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type; |
| 1030 | |
| 1031 | pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint; |
| 1032 | |
| 1033 | // Operations on real types |
| 1034 | pub fn LLVMFloatTypeInContext(C: &Context) -> &Type; |
| 1035 | pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type; |
| 1036 | |
| 1037 | // Operations on function types |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1038 | pub fn LLVMFunctionType<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1039 | ReturnType: &'a Type, |
| 1040 | ParamTypes: *const &'a Type, |
| 1041 | ParamCount: c_uint, |
| 1042 | IsVarArg: Bool, |
| 1043 | ) -> &'a Type; |
| 1044 | pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1045 | pub fn LLVMGetParamTypes<'a>(FunctionTy: &'a Type, Dest: *mut &'a Type); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1046 | |
| 1047 | // Operations on struct types |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1048 | pub fn LLVMStructTypeInContext<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1049 | C: &'a Context, |
| 1050 | ElementTypes: *const &'a Type, |
| 1051 | ElementCount: c_uint, |
| 1052 | Packed: Bool, |
| 1053 | ) -> &'a Type; |
| 1054 | |
| 1055 | // Operations on array, pointer, and vector types (sequence types) |
| 1056 | pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type; |
| 1057 | pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type; |
| 1058 | pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type; |
| 1059 | |
| 1060 | pub fn LLVMGetElementType(Ty: &Type) -> &Type; |
| 1061 | pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint; |
| 1062 | |
| 1063 | // Operations on other types |
| 1064 | pub fn LLVMVoidTypeInContext(C: &Context) -> &Type; |
| 1065 | pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type; |
| 1066 | |
| 1067 | // Operations on all values |
| 1068 | pub fn LLVMTypeOf(Val: &Value) -> &Type; |
| 1069 | pub fn LLVMGetValueName2(Val: &Value, Length: *mut size_t) -> *const c_char; |
| 1070 | pub fn LLVMSetValueName2(Val: &Value, Name: *const c_char, NameLen: size_t); |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1071 | pub fn LLVMReplaceAllUsesWith<'a>(OldVal: &'a Value, NewVal: &'a Value); |
| 1072 | pub fn LLVMSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Node: &'a Value); |
| 1073 | pub fn LLVMGlobalSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata); |
Chris Wailes | 6572058 | 2022-08-11 09:53:28 -0700 | [diff] [blame] | 1074 | pub fn LLVMRustGlobalAddMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata); |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1075 | pub fn LLVMValueAsMetadata(Node: &Value) -> &Metadata; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1076 | |
| 1077 | // Operations on constants of any type |
| 1078 | pub fn LLVMConstNull(Ty: &Type) -> &Value; |
| 1079 | pub fn LLVMGetUndef(Ty: &Type) -> &Value; |
| 1080 | |
| 1081 | // Operations on metadata |
| 1082 | pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1083 | pub fn LLVMMDNodeInContext<'a>( |
| 1084 | C: &'a Context, |
| 1085 | Vals: *const &'a Value, |
| 1086 | Count: c_uint, |
| 1087 | ) -> &'a Value; |
Chris Wailes | 6572058 | 2022-08-11 09:53:28 -0700 | [diff] [blame] | 1088 | pub fn LLVMMDNodeInContext2<'a>( |
| 1089 | C: &'a Context, |
| 1090 | Vals: *const &'a Metadata, |
| 1091 | Count: size_t, |
| 1092 | ) -> &'a Metadata; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1093 | pub fn LLVMAddNamedMetadataOperand<'a>(M: &'a Module, Name: *const c_char, Val: &'a Value); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1094 | |
| 1095 | // Operations on scalar constants |
| 1096 | pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value; |
| 1097 | pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value; |
| 1098 | pub fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value; |
| 1099 | pub fn LLVMConstIntGetZExtValue(ConstantVal: &ConstantInt) -> c_ulonglong; |
| 1100 | pub fn LLVMRustConstInt128Get( |
| 1101 | ConstantVal: &ConstantInt, |
| 1102 | SExt: bool, |
| 1103 | high: &mut u64, |
| 1104 | low: &mut u64, |
| 1105 | ) -> bool; |
| 1106 | |
| 1107 | // Operations on composite constants |
| 1108 | pub fn LLVMConstStringInContext( |
| 1109 | C: &Context, |
| 1110 | Str: *const c_char, |
| 1111 | Length: c_uint, |
| 1112 | DontNullTerminate: Bool, |
| 1113 | ) -> &Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1114 | pub fn LLVMConstStructInContext<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1115 | C: &'a Context, |
| 1116 | ConstantVals: *const &'a Value, |
| 1117 | Count: c_uint, |
| 1118 | Packed: Bool, |
| 1119 | ) -> &'a Value; |
| 1120 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1121 | pub fn LLVMConstArray<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1122 | ElementTy: &'a Type, |
| 1123 | ConstantVals: *const &'a Value, |
| 1124 | Length: c_uint, |
| 1125 | ) -> &'a Value; |
| 1126 | pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value; |
| 1127 | |
| 1128 | // Constant expressions |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1129 | pub fn LLVMRustConstInBoundsGEP2<'a>( |
Chris Wailes | bcf972c | 2021-10-21 11:03:28 -0700 | [diff] [blame] | 1130 | ty: &'a Type, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1131 | ConstantVal: &'a Value, |
| 1132 | ConstantIndices: *const &'a Value, |
| 1133 | NumIndices: c_uint, |
| 1134 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1135 | pub fn LLVMConstZExt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value; |
| 1136 | pub fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value; |
| 1137 | pub fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value; |
| 1138 | pub fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value; |
| 1139 | pub fn LLVMConstPointerCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value; |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 1140 | pub fn LLVMGetAggregateElement(ConstantVal: &Value, Idx: c_uint) -> Option<&Value>; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1141 | |
| 1142 | // Operations on global variables, functions, and aliases (globals) |
| 1143 | pub fn LLVMIsDeclaration(Global: &Value) -> Bool; |
| 1144 | pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage; |
| 1145 | pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage); |
| 1146 | pub fn LLVMSetSection(Global: &Value, Section: *const c_char); |
| 1147 | pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility; |
| 1148 | pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility); |
Chris Wailes | 32f7835 | 2021-07-20 14:04:55 -0700 | [diff] [blame] | 1149 | pub fn LLVMRustSetDSOLocal(Global: &Value, is_dso_local: bool); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1150 | pub fn LLVMGetAlignment(Global: &Value) -> c_uint; |
| 1151 | pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint); |
| 1152 | pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass); |
| 1153 | |
| 1154 | // Operations on global variables |
| 1155 | pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1156 | pub fn LLVMAddGlobal<'a>(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1157 | pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1158 | pub fn LLVMRustGetOrInsertGlobal<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1159 | M: &'a Module, |
| 1160 | Name: *const c_char, |
| 1161 | NameLen: size_t, |
| 1162 | T: &'a Type, |
| 1163 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1164 | pub fn LLVMRustInsertPrivateGlobal<'a>(M: &'a Module, T: &'a Type) -> &'a Value; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1165 | pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>; |
| 1166 | pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>; |
| 1167 | pub fn LLVMDeleteGlobal(GlobalVar: &Value); |
| 1168 | pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1169 | pub fn LLVMSetInitializer<'a>(GlobalVar: &'a Value, ConstantVal: &'a Value); |
Chris Wailes | 2f3fdfe | 2021-07-29 10:56:18 -0700 | [diff] [blame] | 1170 | pub fn LLVMIsThreadLocal(GlobalVar: &Value) -> Bool; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1171 | pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode); |
| 1172 | pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool; |
| 1173 | pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool); |
| 1174 | pub fn LLVMRustGetNamedValue( |
| 1175 | M: &Module, |
| 1176 | Name: *const c_char, |
| 1177 | NameLen: size_t, |
| 1178 | ) -> Option<&Value>; |
| 1179 | pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool); |
| 1180 | |
Charisee | 341341c | 2022-05-20 05:14:50 +0000 | [diff] [blame] | 1181 | // Operations on attributes |
| 1182 | pub fn LLVMRustCreateAttrNoValue(C: &Context, attr: AttributeKind) -> &Attribute; |
| 1183 | pub fn LLVMCreateStringAttribute( |
| 1184 | C: &Context, |
| 1185 | Name: *const c_char, |
| 1186 | NameLen: c_uint, |
| 1187 | Value: *const c_char, |
| 1188 | ValueLen: c_uint, |
| 1189 | ) -> &Attribute; |
| 1190 | pub fn LLVMRustCreateAlignmentAttr(C: &Context, bytes: u64) -> &Attribute; |
| 1191 | pub fn LLVMRustCreateDereferenceableAttr(C: &Context, bytes: u64) -> &Attribute; |
| 1192 | pub fn LLVMRustCreateDereferenceableOrNullAttr(C: &Context, bytes: u64) -> &Attribute; |
| 1193 | pub fn LLVMRustCreateByValAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute; |
| 1194 | pub fn LLVMRustCreateStructRetAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute; |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 1195 | pub fn LLVMRustCreateElementTypeAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute; |
Charisee | 341341c | 2022-05-20 05:14:50 +0000 | [diff] [blame] | 1196 | pub fn LLVMRustCreateUWTableAttr(C: &Context, async_: bool) -> &Attribute; |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 1197 | pub fn LLVMRustCreateAllocSizeAttr(C: &Context, size_arg: u32) -> &Attribute; |
| 1198 | pub fn LLVMRustCreateAllocKindAttr(C: &Context, size_arg: u64) -> &Attribute; |
Charisee | 341341c | 2022-05-20 05:14:50 +0000 | [diff] [blame] | 1199 | |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1200 | // Operations on functions |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1201 | pub fn LLVMRustGetOrInsertFunction<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1202 | M: &'a Module, |
| 1203 | Name: *const c_char, |
| 1204 | NameLen: size_t, |
| 1205 | FunctionTy: &'a Type, |
| 1206 | ) -> &'a Value; |
| 1207 | pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint); |
Charisee | 341341c | 2022-05-20 05:14:50 +0000 | [diff] [blame] | 1208 | pub fn LLVMRustAddFunctionAttributes<'a>( |
| 1209 | Fn: &'a Value, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1210 | index: c_uint, |
Charisee | 341341c | 2022-05-20 05:14:50 +0000 | [diff] [blame] | 1211 | Attrs: *const &'a Attribute, |
| 1212 | AttrsLen: size_t, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1213 | ); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1214 | |
| 1215 | // Operations on parameters |
| 1216 | pub fn LLVMIsAArgument(Val: &Value) -> Option<&Value>; |
| 1217 | pub fn LLVMCountParams(Fn: &Value) -> c_uint; |
| 1218 | pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value; |
| 1219 | |
| 1220 | // Operations on basic blocks |
| 1221 | pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1222 | pub fn LLVMAppendBasicBlockInContext<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1223 | C: &'a Context, |
| 1224 | Fn: &'a Value, |
| 1225 | Name: *const c_char, |
| 1226 | ) -> &'a BasicBlock; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1227 | |
| 1228 | // Operations on instructions |
| 1229 | pub fn LLVMIsAInstruction(Val: &Value) -> Option<&Value>; |
| 1230 | pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock; |
| 1231 | |
| 1232 | // Operations on call sites |
| 1233 | pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint); |
Charisee | 341341c | 2022-05-20 05:14:50 +0000 | [diff] [blame] | 1234 | pub fn LLVMRustAddCallSiteAttributes<'a>( |
| 1235 | Instr: &'a Value, |
| 1236 | index: c_uint, |
| 1237 | Attrs: *const &'a Attribute, |
| 1238 | AttrsLen: size_t, |
| 1239 | ); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1240 | |
| 1241 | // Operations on load/store instructions (only) |
| 1242 | pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool); |
| 1243 | |
| 1244 | // Operations on phi nodes |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1245 | pub fn LLVMAddIncoming<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1246 | PhiNode: &'a Value, |
| 1247 | IncomingValues: *const &'a Value, |
| 1248 | IncomingBlocks: *const &'a BasicBlock, |
| 1249 | Count: c_uint, |
| 1250 | ); |
| 1251 | |
| 1252 | // Instruction builders |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1253 | pub fn LLVMCreateBuilderInContext(C: &Context) -> &mut Builder<'_>; |
| 1254 | pub fn LLVMPositionBuilderAtEnd<'a>(Builder: &Builder<'a>, Block: &'a BasicBlock); |
| 1255 | pub fn LLVMGetInsertBlock<'a>(Builder: &Builder<'a>) -> &'a BasicBlock; |
| 1256 | pub fn LLVMDisposeBuilder<'a>(Builder: &'a mut Builder<'a>); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1257 | |
| 1258 | // Metadata |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1259 | pub fn LLVMSetCurrentDebugLocation<'a>(Builder: &Builder<'a>, L: &'a Value); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1260 | |
| 1261 | // Terminators |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1262 | pub fn LLVMBuildRetVoid<'a>(B: &Builder<'a>) -> &'a Value; |
| 1263 | pub fn LLVMBuildRet<'a>(B: &Builder<'a>, V: &'a Value) -> &'a Value; |
| 1264 | pub fn LLVMBuildBr<'a>(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value; |
| 1265 | pub fn LLVMBuildCondBr<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1266 | B: &Builder<'a>, |
| 1267 | If: &'a Value, |
| 1268 | Then: &'a BasicBlock, |
| 1269 | Else: &'a BasicBlock, |
| 1270 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1271 | pub fn LLVMBuildSwitch<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1272 | B: &Builder<'a>, |
| 1273 | V: &'a Value, |
| 1274 | Else: &'a BasicBlock, |
| 1275 | NumCases: c_uint, |
| 1276 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1277 | pub fn LLVMRustBuildInvoke<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1278 | B: &Builder<'a>, |
Chris Wailes | bcf972c | 2021-10-21 11:03:28 -0700 | [diff] [blame] | 1279 | Ty: &'a Type, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1280 | Fn: &'a Value, |
| 1281 | Args: *const &'a Value, |
| 1282 | NumArgs: c_uint, |
| 1283 | Then: &'a BasicBlock, |
| 1284 | Catch: &'a BasicBlock, |
| 1285 | Bundle: Option<&OperandBundleDef<'a>>, |
| 1286 | Name: *const c_char, |
| 1287 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1288 | pub fn LLVMBuildLandingPad<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1289 | B: &Builder<'a>, |
| 1290 | Ty: &'a Type, |
Chris Wailes | 54272ac | 2021-09-09 16:08:13 -0700 | [diff] [blame] | 1291 | PersFn: Option<&'a Value>, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1292 | NumClauses: c_uint, |
| 1293 | Name: *const c_char, |
| 1294 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1295 | pub fn LLVMBuildResume<'a>(B: &Builder<'a>, Exn: &'a Value) -> &'a Value; |
| 1296 | pub fn LLVMBuildUnreachable<'a>(B: &Builder<'a>) -> &'a Value; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1297 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1298 | pub fn LLVMRustBuildCleanupPad<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1299 | B: &Builder<'a>, |
| 1300 | ParentPad: Option<&'a Value>, |
| 1301 | ArgCnt: c_uint, |
| 1302 | Args: *const &'a Value, |
| 1303 | Name: *const c_char, |
| 1304 | ) -> Option<&'a Value>; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1305 | pub fn LLVMRustBuildCleanupRet<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1306 | B: &Builder<'a>, |
| 1307 | CleanupPad: &'a Value, |
| 1308 | UnwindBB: Option<&'a BasicBlock>, |
| 1309 | ) -> Option<&'a Value>; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1310 | pub fn LLVMRustBuildCatchPad<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1311 | B: &Builder<'a>, |
| 1312 | ParentPad: &'a Value, |
| 1313 | ArgCnt: c_uint, |
| 1314 | Args: *const &'a Value, |
| 1315 | Name: *const c_char, |
| 1316 | ) -> Option<&'a Value>; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1317 | pub fn LLVMRustBuildCatchRet<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1318 | B: &Builder<'a>, |
| 1319 | Pad: &'a Value, |
| 1320 | BB: &'a BasicBlock, |
| 1321 | ) -> Option<&'a Value>; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1322 | pub fn LLVMRustBuildCatchSwitch<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1323 | Builder: &Builder<'a>, |
| 1324 | ParentPad: Option<&'a Value>, |
| 1325 | BB: Option<&'a BasicBlock>, |
| 1326 | NumHandlers: c_uint, |
| 1327 | Name: *const c_char, |
| 1328 | ) -> Option<&'a Value>; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1329 | pub fn LLVMRustAddHandler<'a>(CatchSwitch: &'a Value, Handler: &'a BasicBlock); |
| 1330 | pub fn LLVMSetPersonalityFn<'a>(Func: &'a Value, Pers: &'a Value); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1331 | |
| 1332 | // Add a case to the switch instruction |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1333 | pub fn LLVMAddCase<'a>(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1334 | |
| 1335 | // Add a clause to the landing pad instruction |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1336 | pub fn LLVMAddClause<'a>(LandingPad: &'a Value, ClauseVal: &'a Value); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1337 | |
| 1338 | // Set the cleanup on a landing pad instruction |
| 1339 | pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool); |
| 1340 | |
| 1341 | // Arithmetic |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1342 | pub fn LLVMBuildAdd<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1343 | B: &Builder<'a>, |
| 1344 | LHS: &'a Value, |
| 1345 | RHS: &'a Value, |
| 1346 | Name: *const c_char, |
| 1347 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1348 | pub fn LLVMBuildFAdd<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1349 | B: &Builder<'a>, |
| 1350 | LHS: &'a Value, |
| 1351 | RHS: &'a Value, |
| 1352 | Name: *const c_char, |
| 1353 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1354 | pub fn LLVMBuildSub<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1355 | B: &Builder<'a>, |
| 1356 | LHS: &'a Value, |
| 1357 | RHS: &'a Value, |
| 1358 | Name: *const c_char, |
| 1359 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1360 | pub fn LLVMBuildFSub<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1361 | B: &Builder<'a>, |
| 1362 | LHS: &'a Value, |
| 1363 | RHS: &'a Value, |
| 1364 | Name: *const c_char, |
| 1365 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1366 | pub fn LLVMBuildMul<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1367 | B: &Builder<'a>, |
| 1368 | LHS: &'a Value, |
| 1369 | RHS: &'a Value, |
| 1370 | Name: *const c_char, |
| 1371 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1372 | pub fn LLVMBuildFMul<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1373 | B: &Builder<'a>, |
| 1374 | LHS: &'a Value, |
| 1375 | RHS: &'a Value, |
| 1376 | Name: *const c_char, |
| 1377 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1378 | pub fn LLVMBuildUDiv<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1379 | B: &Builder<'a>, |
| 1380 | LHS: &'a Value, |
| 1381 | RHS: &'a Value, |
| 1382 | Name: *const c_char, |
| 1383 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1384 | pub fn LLVMBuildExactUDiv<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1385 | B: &Builder<'a>, |
| 1386 | LHS: &'a Value, |
| 1387 | RHS: &'a Value, |
| 1388 | Name: *const c_char, |
| 1389 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1390 | pub fn LLVMBuildSDiv<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1391 | B: &Builder<'a>, |
| 1392 | LHS: &'a Value, |
| 1393 | RHS: &'a Value, |
| 1394 | Name: *const c_char, |
| 1395 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1396 | pub fn LLVMBuildExactSDiv<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1397 | B: &Builder<'a>, |
| 1398 | LHS: &'a Value, |
| 1399 | RHS: &'a Value, |
| 1400 | Name: *const c_char, |
| 1401 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1402 | pub fn LLVMBuildFDiv<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1403 | B: &Builder<'a>, |
| 1404 | LHS: &'a Value, |
| 1405 | RHS: &'a Value, |
| 1406 | Name: *const c_char, |
| 1407 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1408 | pub fn LLVMBuildURem<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1409 | B: &Builder<'a>, |
| 1410 | LHS: &'a Value, |
| 1411 | RHS: &'a Value, |
| 1412 | Name: *const c_char, |
| 1413 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1414 | pub fn LLVMBuildSRem<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1415 | B: &Builder<'a>, |
| 1416 | LHS: &'a Value, |
| 1417 | RHS: &'a Value, |
| 1418 | Name: *const c_char, |
| 1419 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1420 | pub fn LLVMBuildFRem<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1421 | B: &Builder<'a>, |
| 1422 | LHS: &'a Value, |
| 1423 | RHS: &'a Value, |
| 1424 | Name: *const c_char, |
| 1425 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1426 | pub fn LLVMBuildShl<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1427 | B: &Builder<'a>, |
| 1428 | LHS: &'a Value, |
| 1429 | RHS: &'a Value, |
| 1430 | Name: *const c_char, |
| 1431 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1432 | pub fn LLVMBuildLShr<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1433 | B: &Builder<'a>, |
| 1434 | LHS: &'a Value, |
| 1435 | RHS: &'a Value, |
| 1436 | Name: *const c_char, |
| 1437 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1438 | pub fn LLVMBuildAShr<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1439 | B: &Builder<'a>, |
| 1440 | LHS: &'a Value, |
| 1441 | RHS: &'a Value, |
| 1442 | Name: *const c_char, |
| 1443 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1444 | pub fn LLVMBuildNSWAdd<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1445 | B: &Builder<'a>, |
| 1446 | LHS: &'a Value, |
| 1447 | RHS: &'a Value, |
| 1448 | Name: *const c_char, |
| 1449 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1450 | pub fn LLVMBuildNUWAdd<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1451 | B: &Builder<'a>, |
| 1452 | LHS: &'a Value, |
| 1453 | RHS: &'a Value, |
| 1454 | Name: *const c_char, |
| 1455 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1456 | pub fn LLVMBuildNSWSub<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1457 | B: &Builder<'a>, |
| 1458 | LHS: &'a Value, |
| 1459 | RHS: &'a Value, |
| 1460 | Name: *const c_char, |
| 1461 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1462 | pub fn LLVMBuildNUWSub<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1463 | B: &Builder<'a>, |
| 1464 | LHS: &'a Value, |
| 1465 | RHS: &'a Value, |
| 1466 | Name: *const c_char, |
| 1467 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1468 | pub fn LLVMBuildNSWMul<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1469 | B: &Builder<'a>, |
| 1470 | LHS: &'a Value, |
| 1471 | RHS: &'a Value, |
| 1472 | Name: *const c_char, |
| 1473 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1474 | pub fn LLVMBuildNUWMul<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1475 | B: &Builder<'a>, |
| 1476 | LHS: &'a Value, |
| 1477 | RHS: &'a Value, |
| 1478 | Name: *const c_char, |
| 1479 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1480 | pub fn LLVMBuildAnd<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1481 | B: &Builder<'a>, |
| 1482 | LHS: &'a Value, |
| 1483 | RHS: &'a Value, |
| 1484 | Name: *const c_char, |
| 1485 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1486 | pub fn LLVMBuildOr<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1487 | B: &Builder<'a>, |
| 1488 | LHS: &'a Value, |
| 1489 | RHS: &'a Value, |
| 1490 | Name: *const c_char, |
| 1491 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1492 | pub fn LLVMBuildXor<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1493 | B: &Builder<'a>, |
| 1494 | LHS: &'a Value, |
| 1495 | RHS: &'a Value, |
| 1496 | Name: *const c_char, |
| 1497 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1498 | pub fn LLVMBuildNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value; |
| 1499 | pub fn LLVMBuildFNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value; |
| 1500 | pub fn LLVMBuildNot<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value; |
Chris Wailes | 32f7835 | 2021-07-20 14:04:55 -0700 | [diff] [blame] | 1501 | pub fn LLVMRustSetFastMath(Instr: &Value); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1502 | |
| 1503 | // Memory |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1504 | pub fn LLVMBuildAlloca<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value; |
| 1505 | pub fn LLVMBuildArrayAlloca<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1506 | B: &Builder<'a>, |
| 1507 | Ty: &'a Type, |
| 1508 | Val: &'a Value, |
| 1509 | Name: *const c_char, |
| 1510 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1511 | pub fn LLVMBuildLoad2<'a>( |
Chris Wailes | 54272ac | 2021-09-09 16:08:13 -0700 | [diff] [blame] | 1512 | B: &Builder<'a>, |
| 1513 | Ty: &'a Type, |
| 1514 | PointerVal: &'a Value, |
| 1515 | Name: *const c_char, |
| 1516 | ) -> &'a Value; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1517 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1518 | pub fn LLVMBuildStore<'a>(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1519 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1520 | pub fn LLVMBuildGEP2<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1521 | B: &Builder<'a>, |
Chris Wailes | bcf972c | 2021-10-21 11:03:28 -0700 | [diff] [blame] | 1522 | Ty: &'a Type, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1523 | Pointer: &'a Value, |
| 1524 | Indices: *const &'a Value, |
| 1525 | NumIndices: c_uint, |
| 1526 | Name: *const c_char, |
| 1527 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1528 | pub fn LLVMBuildInBoundsGEP2<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1529 | B: &Builder<'a>, |
Chris Wailes | bcf972c | 2021-10-21 11:03:28 -0700 | [diff] [blame] | 1530 | Ty: &'a Type, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1531 | Pointer: &'a Value, |
| 1532 | Indices: *const &'a Value, |
| 1533 | NumIndices: c_uint, |
| 1534 | Name: *const c_char, |
| 1535 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1536 | pub fn LLVMBuildStructGEP2<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1537 | B: &Builder<'a>, |
Chris Wailes | bcf972c | 2021-10-21 11:03:28 -0700 | [diff] [blame] | 1538 | Ty: &'a Type, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1539 | Pointer: &'a Value, |
| 1540 | Idx: c_uint, |
| 1541 | Name: *const c_char, |
| 1542 | ) -> &'a Value; |
| 1543 | |
| 1544 | // Casts |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1545 | pub fn LLVMBuildTrunc<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1546 | B: &Builder<'a>, |
| 1547 | Val: &'a Value, |
| 1548 | DestTy: &'a Type, |
| 1549 | Name: *const c_char, |
| 1550 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1551 | pub fn LLVMBuildZExt<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1552 | B: &Builder<'a>, |
| 1553 | Val: &'a Value, |
| 1554 | DestTy: &'a Type, |
| 1555 | Name: *const c_char, |
| 1556 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1557 | pub fn LLVMBuildSExt<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1558 | B: &Builder<'a>, |
| 1559 | Val: &'a Value, |
| 1560 | DestTy: &'a Type, |
| 1561 | Name: *const c_char, |
| 1562 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1563 | pub fn LLVMBuildFPToUI<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1564 | B: &Builder<'a>, |
| 1565 | Val: &'a Value, |
| 1566 | DestTy: &'a Type, |
| 1567 | Name: *const c_char, |
| 1568 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1569 | pub fn LLVMBuildFPToSI<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1570 | B: &Builder<'a>, |
| 1571 | Val: &'a Value, |
| 1572 | DestTy: &'a Type, |
| 1573 | Name: *const c_char, |
| 1574 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1575 | pub fn LLVMBuildUIToFP<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1576 | B: &Builder<'a>, |
| 1577 | Val: &'a Value, |
| 1578 | DestTy: &'a Type, |
| 1579 | Name: *const c_char, |
| 1580 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1581 | pub fn LLVMBuildSIToFP<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1582 | B: &Builder<'a>, |
| 1583 | Val: &'a Value, |
| 1584 | DestTy: &'a Type, |
| 1585 | Name: *const c_char, |
| 1586 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1587 | pub fn LLVMBuildFPTrunc<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1588 | B: &Builder<'a>, |
| 1589 | Val: &'a Value, |
| 1590 | DestTy: &'a Type, |
| 1591 | Name: *const c_char, |
| 1592 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1593 | pub fn LLVMBuildFPExt<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1594 | B: &Builder<'a>, |
| 1595 | Val: &'a Value, |
| 1596 | DestTy: &'a Type, |
| 1597 | Name: *const c_char, |
| 1598 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1599 | pub fn LLVMBuildPtrToInt<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1600 | B: &Builder<'a>, |
| 1601 | Val: &'a Value, |
| 1602 | DestTy: &'a Type, |
| 1603 | Name: *const c_char, |
| 1604 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1605 | pub fn LLVMBuildIntToPtr<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1606 | B: &Builder<'a>, |
| 1607 | Val: &'a Value, |
| 1608 | DestTy: &'a Type, |
| 1609 | Name: *const c_char, |
| 1610 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1611 | pub fn LLVMBuildBitCast<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1612 | B: &Builder<'a>, |
| 1613 | Val: &'a Value, |
| 1614 | DestTy: &'a Type, |
| 1615 | Name: *const c_char, |
| 1616 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1617 | pub fn LLVMBuildPointerCast<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1618 | B: &Builder<'a>, |
| 1619 | Val: &'a Value, |
| 1620 | DestTy: &'a Type, |
| 1621 | Name: *const c_char, |
| 1622 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1623 | pub fn LLVMRustBuildIntCast<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1624 | B: &Builder<'a>, |
| 1625 | Val: &'a Value, |
| 1626 | DestTy: &'a Type, |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 1627 | IsSigned: bool, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1628 | ) -> &'a Value; |
| 1629 | |
| 1630 | // Comparisons |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1631 | pub fn LLVMBuildICmp<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1632 | B: &Builder<'a>, |
| 1633 | Op: c_uint, |
| 1634 | LHS: &'a Value, |
| 1635 | RHS: &'a Value, |
| 1636 | Name: *const c_char, |
| 1637 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1638 | pub fn LLVMBuildFCmp<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1639 | B: &Builder<'a>, |
| 1640 | Op: c_uint, |
| 1641 | LHS: &'a Value, |
| 1642 | RHS: &'a Value, |
| 1643 | Name: *const c_char, |
| 1644 | ) -> &'a Value; |
| 1645 | |
| 1646 | // Miscellaneous instructions |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1647 | pub fn LLVMBuildPhi<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value; |
| 1648 | pub fn LLVMRustGetInstrProfIncrementIntrinsic(M: &Module) -> &Value; |
| 1649 | pub fn LLVMRustBuildCall<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1650 | B: &Builder<'a>, |
Chris Wailes | bcf972c | 2021-10-21 11:03:28 -0700 | [diff] [blame] | 1651 | Ty: &'a Type, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1652 | Fn: &'a Value, |
| 1653 | Args: *const &'a Value, |
| 1654 | NumArgs: c_uint, |
| 1655 | Bundle: Option<&OperandBundleDef<'a>>, |
| 1656 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1657 | pub fn LLVMRustBuildMemCpy<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1658 | B: &Builder<'a>, |
| 1659 | Dst: &'a Value, |
| 1660 | DstAlign: c_uint, |
| 1661 | Src: &'a Value, |
| 1662 | SrcAlign: c_uint, |
| 1663 | Size: &'a Value, |
| 1664 | IsVolatile: bool, |
| 1665 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1666 | pub fn LLVMRustBuildMemMove<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1667 | B: &Builder<'a>, |
| 1668 | Dst: &'a Value, |
| 1669 | DstAlign: c_uint, |
| 1670 | Src: &'a Value, |
| 1671 | SrcAlign: c_uint, |
| 1672 | Size: &'a Value, |
| 1673 | IsVolatile: bool, |
| 1674 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1675 | pub fn LLVMRustBuildMemSet<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1676 | B: &Builder<'a>, |
| 1677 | Dst: &'a Value, |
| 1678 | DstAlign: c_uint, |
| 1679 | Val: &'a Value, |
| 1680 | Size: &'a Value, |
| 1681 | IsVolatile: bool, |
| 1682 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1683 | pub fn LLVMBuildSelect<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1684 | B: &Builder<'a>, |
| 1685 | If: &'a Value, |
| 1686 | Then: &'a Value, |
| 1687 | Else: &'a Value, |
| 1688 | Name: *const c_char, |
| 1689 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1690 | pub fn LLVMBuildVAArg<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1691 | B: &Builder<'a>, |
| 1692 | list: &'a Value, |
| 1693 | Ty: &'a Type, |
| 1694 | Name: *const c_char, |
| 1695 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1696 | pub fn LLVMBuildExtractElement<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1697 | B: &Builder<'a>, |
| 1698 | VecVal: &'a Value, |
| 1699 | Index: &'a Value, |
| 1700 | Name: *const c_char, |
| 1701 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1702 | pub fn LLVMBuildInsertElement<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1703 | B: &Builder<'a>, |
| 1704 | VecVal: &'a Value, |
| 1705 | EltVal: &'a Value, |
| 1706 | Index: &'a Value, |
| 1707 | Name: *const c_char, |
| 1708 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1709 | pub fn LLVMBuildShuffleVector<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1710 | B: &Builder<'a>, |
| 1711 | V1: &'a Value, |
| 1712 | V2: &'a Value, |
| 1713 | Mask: &'a Value, |
| 1714 | Name: *const c_char, |
| 1715 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1716 | pub fn LLVMBuildExtractValue<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1717 | B: &Builder<'a>, |
| 1718 | AggVal: &'a Value, |
| 1719 | Index: c_uint, |
| 1720 | Name: *const c_char, |
| 1721 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1722 | pub fn LLVMBuildInsertValue<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1723 | B: &Builder<'a>, |
| 1724 | AggVal: &'a Value, |
| 1725 | EltVal: &'a Value, |
| 1726 | Index: c_uint, |
| 1727 | Name: *const c_char, |
| 1728 | ) -> &'a Value; |
| 1729 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1730 | pub fn LLVMRustBuildVectorReduceFAdd<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1731 | B: &Builder<'a>, |
| 1732 | Acc: &'a Value, |
| 1733 | Src: &'a Value, |
| 1734 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1735 | pub fn LLVMRustBuildVectorReduceFMul<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1736 | B: &Builder<'a>, |
| 1737 | Acc: &'a Value, |
| 1738 | Src: &'a Value, |
| 1739 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1740 | pub fn LLVMRustBuildVectorReduceAdd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value; |
| 1741 | pub fn LLVMRustBuildVectorReduceMul<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value; |
| 1742 | pub fn LLVMRustBuildVectorReduceAnd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value; |
| 1743 | pub fn LLVMRustBuildVectorReduceOr<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value; |
| 1744 | pub fn LLVMRustBuildVectorReduceXor<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value; |
| 1745 | pub fn LLVMRustBuildVectorReduceMin<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1746 | B: &Builder<'a>, |
| 1747 | Src: &'a Value, |
| 1748 | IsSigned: bool, |
| 1749 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1750 | pub fn LLVMRustBuildVectorReduceMax<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1751 | B: &Builder<'a>, |
| 1752 | Src: &'a Value, |
| 1753 | IsSigned: bool, |
| 1754 | ) -> &'a Value; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1755 | pub fn LLVMRustBuildVectorReduceFMin<'a>( |
| 1756 | B: &Builder<'a>, |
| 1757 | Src: &'a Value, |
| 1758 | IsNaN: bool, |
| 1759 | ) -> &'a Value; |
| 1760 | pub fn LLVMRustBuildVectorReduceFMax<'a>( |
| 1761 | B: &Builder<'a>, |
| 1762 | Src: &'a Value, |
| 1763 | IsNaN: bool, |
| 1764 | ) -> &'a Value; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1765 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1766 | pub fn LLVMRustBuildMinNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value; |
| 1767 | pub fn LLVMRustBuildMaxNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1768 | |
| 1769 | // Atomic Operations |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1770 | pub fn LLVMRustBuildAtomicLoad<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1771 | B: &Builder<'a>, |
Chris Wailes | 54272ac | 2021-09-09 16:08:13 -0700 | [diff] [blame] | 1772 | ElementType: &'a Type, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1773 | PointerVal: &'a Value, |
| 1774 | Name: *const c_char, |
| 1775 | Order: AtomicOrdering, |
| 1776 | ) -> &'a Value; |
| 1777 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1778 | pub fn LLVMRustBuildAtomicStore<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1779 | B: &Builder<'a>, |
| 1780 | Val: &'a Value, |
| 1781 | Ptr: &'a Value, |
| 1782 | Order: AtomicOrdering, |
| 1783 | ) -> &'a Value; |
| 1784 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1785 | pub fn LLVMRustBuildAtomicCmpXchg<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1786 | B: &Builder<'a>, |
| 1787 | LHS: &'a Value, |
| 1788 | CMP: &'a Value, |
| 1789 | RHS: &'a Value, |
| 1790 | Order: AtomicOrdering, |
| 1791 | FailureOrder: AtomicOrdering, |
| 1792 | Weak: Bool, |
| 1793 | ) -> &'a Value; |
| 1794 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1795 | pub fn LLVMBuildAtomicRMW<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1796 | B: &Builder<'a>, |
| 1797 | Op: AtomicRmwBinOp, |
| 1798 | LHS: &'a Value, |
| 1799 | RHS: &'a Value, |
| 1800 | Order: AtomicOrdering, |
| 1801 | SingleThreaded: Bool, |
| 1802 | ) -> &'a Value; |
| 1803 | |
| 1804 | pub fn LLVMRustBuildAtomicFence( |
| 1805 | B: &Builder<'_>, |
| 1806 | Order: AtomicOrdering, |
| 1807 | Scope: SynchronizationScope, |
| 1808 | ); |
| 1809 | |
| 1810 | /// Writes a module to the specified path. Returns 0 on success. |
| 1811 | pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int; |
| 1812 | |
| 1813 | /// Creates a pass manager. |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1814 | pub fn LLVMCreatePassManager<'a>() -> &'a mut PassManager<'a>; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1815 | |
| 1816 | /// Creates a function-by-function pass manager |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1817 | pub fn LLVMCreateFunctionPassManagerForModule(M: &Module) -> &mut PassManager<'_>; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1818 | |
| 1819 | /// Disposes a pass manager. |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1820 | pub fn LLVMDisposePassManager<'a>(PM: &'a mut PassManager<'a>); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1821 | |
| 1822 | /// Runs a pass manager on a module. |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1823 | pub fn LLVMRunPassManager<'a>(PM: &PassManager<'a>, M: &'a Module) -> Bool; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1824 | |
| 1825 | pub fn LLVMInitializePasses(); |
| 1826 | |
| 1827 | pub fn LLVMTimeTraceProfilerInitialize(); |
| 1828 | |
Chris Wailes | 356b57e | 2022-01-13 10:08:24 -0800 | [diff] [blame] | 1829 | pub fn LLVMTimeTraceProfilerFinishThread(); |
| 1830 | |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1831 | pub fn LLVMTimeTraceProfilerFinish(FileName: *const c_char); |
| 1832 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1833 | pub fn LLVMAddAnalysisPasses<'a>(T: &'a TargetMachine, PM: &PassManager<'a>); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1834 | |
Charisee | 9cf6780 | 2022-06-30 20:04:09 +0000 | [diff] [blame] | 1835 | pub fn LLVMRustPassManagerBuilderCreate() -> &'static mut PassManagerBuilder; |
| 1836 | pub fn LLVMRustPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder); |
| 1837 | pub fn LLVMRustPassManagerBuilderUseInlinerWithThreshold( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1838 | PMB: &PassManagerBuilder, |
| 1839 | threshold: c_uint, |
| 1840 | ); |
Charisee | 9cf6780 | 2022-06-30 20:04:09 +0000 | [diff] [blame] | 1841 | pub fn LLVMRustPassManagerBuilderPopulateModulePassManager( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1842 | PMB: &PassManagerBuilder, |
| 1843 | PM: &PassManager<'_>, |
| 1844 | ); |
| 1845 | |
Charisee | 9cf6780 | 2022-06-30 20:04:09 +0000 | [diff] [blame] | 1846 | pub fn LLVMRustPassManagerBuilderPopulateFunctionPassManager( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1847 | PMB: &PassManagerBuilder, |
| 1848 | PM: &PassManager<'_>, |
| 1849 | ); |
Charisee | 9cf6780 | 2022-06-30 20:04:09 +0000 | [diff] [blame] | 1850 | pub fn LLVMRustPassManagerBuilderPopulateLTOPassManager( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1851 | PMB: &PassManagerBuilder, |
| 1852 | PM: &PassManager<'_>, |
| 1853 | Internalize: Bool, |
| 1854 | RunInliner: Bool, |
| 1855 | ); |
| 1856 | pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager( |
| 1857 | PMB: &PassManagerBuilder, |
| 1858 | PM: &PassManager<'_>, |
| 1859 | ); |
| 1860 | |
Jeff Vander Stoep | 59fbe18 | 2021-03-29 10:17:52 +0200 | [diff] [blame] | 1861 | pub fn LLVMGetHostCPUFeatures() -> *mut c_char; |
| 1862 | |
| 1863 | pub fn LLVMDisposeMessage(message: *mut c_char); |
| 1864 | |
Chris Wailes | 356b57e | 2022-01-13 10:08:24 -0800 | [diff] [blame] | 1865 | pub fn LLVMIsMultithreaded() -> Bool; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1866 | |
| 1867 | /// Returns a string describing the last error caused by an LLVMRust* call. |
| 1868 | pub fn LLVMRustGetLastError() -> *const c_char; |
| 1869 | |
| 1870 | /// Print the pass timings since static dtors aren't picking them up. |
| 1871 | pub fn LLVMRustPrintPassTimings(); |
| 1872 | |
| 1873 | pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type; |
| 1874 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1875 | pub fn LLVMStructSetBody<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1876 | StructTy: &'a Type, |
| 1877 | ElementTypes: *const &'a Type, |
| 1878 | ElementCount: c_uint, |
| 1879 | Packed: Bool, |
| 1880 | ); |
| 1881 | |
| 1882 | /// Prepares inline assembly. |
| 1883 | pub fn LLVMRustInlineAsm( |
| 1884 | Ty: &Type, |
| 1885 | AsmString: *const c_char, |
| 1886 | AsmStringLen: size_t, |
| 1887 | Constraints: *const c_char, |
| 1888 | ConstraintsLen: size_t, |
| 1889 | SideEffects: Bool, |
| 1890 | AlignStack: Bool, |
| 1891 | Dialect: AsmDialect, |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1892 | CanThrow: Bool, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1893 | ) -> &Value; |
| 1894 | pub fn LLVMRustInlineAsmVerify( |
| 1895 | Ty: &Type, |
| 1896 | Constraints: *const c_char, |
| 1897 | ConstraintsLen: size_t, |
| 1898 | ) -> bool; |
| 1899 | |
| 1900 | #[allow(improper_ctypes)] |
| 1901 | pub fn LLVMRustCoverageWriteFilenamesSectionToBuffer( |
| 1902 | Filenames: *const *const c_char, |
| 1903 | FilenamesLen: size_t, |
| 1904 | BufferOut: &RustString, |
| 1905 | ); |
| 1906 | |
| 1907 | #[allow(improper_ctypes)] |
| 1908 | pub fn LLVMRustCoverageWriteMappingToBuffer( |
| 1909 | VirtualFileMappingIDs: *const c_uint, |
| 1910 | NumVirtualFileMappingIDs: c_uint, |
| 1911 | Expressions: *const coverage_map::CounterExpression, |
| 1912 | NumExpressions: c_uint, |
Chris Wailes | e3116c4 | 2021-07-13 14:40:48 -0700 | [diff] [blame] | 1913 | MappingRegions: *const coverageinfo::CounterMappingRegion, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1914 | NumMappingRegions: c_uint, |
| 1915 | BufferOut: &RustString, |
| 1916 | ); |
| 1917 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1918 | pub fn LLVMRustCoverageCreatePGOFuncNameVar(F: &Value, FuncName: *const c_char) -> &Value; |
Jeff Vander Stoep | d59a287 | 2021-02-15 10:22:21 +0100 | [diff] [blame] | 1919 | pub fn LLVMRustCoverageHashCString(StrVal: *const c_char) -> u64; |
| 1920 | pub fn LLVMRustCoverageHashByteArray(Bytes: *const c_char, NumBytes: size_t) -> u64; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1921 | |
| 1922 | #[allow(improper_ctypes)] |
Jeff Vander Stoep | d59a287 | 2021-02-15 10:22:21 +0100 | [diff] [blame] | 1923 | pub fn LLVMRustCoverageWriteMapSectionNameToString(M: &Module, Str: &RustString); |
| 1924 | |
| 1925 | #[allow(improper_ctypes)] |
| 1926 | pub fn LLVMRustCoverageWriteFuncSectionNameToString(M: &Module, Str: &RustString); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1927 | |
| 1928 | #[allow(improper_ctypes)] |
| 1929 | pub fn LLVMRustCoverageWriteMappingVarNameToString(Str: &RustString); |
| 1930 | |
| 1931 | pub fn LLVMRustCoverageMappingVersion() -> u32; |
| 1932 | pub fn LLVMRustDebugMetadataVersion() -> u32; |
| 1933 | pub fn LLVMRustVersionMajor() -> u32; |
| 1934 | pub fn LLVMRustVersionMinor() -> u32; |
Jeff Vander Stoep | 59fbe18 | 2021-03-29 10:17:52 +0200 | [diff] [blame] | 1935 | pub fn LLVMRustVersionPatch() -> u32; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1936 | |
Chris Wailes | 2805eef | 2022-04-07 11:22:56 -0700 | [diff] [blame] | 1937 | /// Add LLVM module flags. |
| 1938 | /// |
| 1939 | /// In order for Rust-C LTO to work, module flags must be compatible with Clang. What |
| 1940 | /// "compatible" means depends on the merge behaviors involved. |
| 1941 | pub fn LLVMRustAddModuleFlag( |
| 1942 | M: &Module, |
| 1943 | merge_behavior: LLVMModFlagBehavior, |
| 1944 | name: *const c_char, |
| 1945 | value: u32, |
| 1946 | ); |
Chris Wailes | 6572058 | 2022-08-11 09:53:28 -0700 | [diff] [blame] | 1947 | pub fn LLVMRustHasModuleFlag(M: &Module, name: *const c_char, len: size_t) -> bool; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1948 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1949 | pub fn LLVMRustMetadataAsValue<'a>(C: &'a Context, MD: &'a Metadata) -> &'a Value; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1950 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1951 | pub fn LLVMRustDIBuilderCreate(M: &Module) -> &mut DIBuilder<'_>; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1952 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1953 | pub fn LLVMRustDIBuilderDispose<'a>(Builder: &'a mut DIBuilder<'a>); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1954 | |
| 1955 | pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder<'_>); |
| 1956 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1957 | pub fn LLVMRustDIBuilderCreateCompileUnit<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1958 | Builder: &DIBuilder<'a>, |
| 1959 | Lang: c_uint, |
| 1960 | File: &'a DIFile, |
| 1961 | Producer: *const c_char, |
| 1962 | ProducerLen: size_t, |
| 1963 | isOptimized: bool, |
| 1964 | Flags: *const c_char, |
| 1965 | RuntimeVer: c_uint, |
| 1966 | SplitName: *const c_char, |
| 1967 | SplitNameLen: size_t, |
| 1968 | kind: DebugEmissionKind, |
Jeff Vander Stoep | d59a287 | 2021-02-15 10:22:21 +0100 | [diff] [blame] | 1969 | DWOId: u64, |
| 1970 | SplitDebugInlining: bool, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1971 | ) -> &'a DIDescriptor; |
| 1972 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1973 | pub fn LLVMRustDIBuilderCreateFile<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1974 | Builder: &DIBuilder<'a>, |
| 1975 | Filename: *const c_char, |
| 1976 | FilenameLen: size_t, |
| 1977 | Directory: *const c_char, |
| 1978 | DirectoryLen: size_t, |
| 1979 | CSKind: ChecksumKind, |
| 1980 | Checksum: *const c_char, |
| 1981 | ChecksumLen: size_t, |
| 1982 | ) -> &'a DIFile; |
| 1983 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1984 | pub fn LLVMRustDIBuilderCreateSubroutineType<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1985 | Builder: &DIBuilder<'a>, |
| 1986 | ParameterTypes: &'a DIArray, |
| 1987 | ) -> &'a DICompositeType; |
| 1988 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 1989 | pub fn LLVMRustDIBuilderCreateFunction<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 1990 | Builder: &DIBuilder<'a>, |
| 1991 | Scope: &'a DIDescriptor, |
| 1992 | Name: *const c_char, |
| 1993 | NameLen: size_t, |
| 1994 | LinkageName: *const c_char, |
| 1995 | LinkageNameLen: size_t, |
| 1996 | File: &'a DIFile, |
| 1997 | LineNo: c_uint, |
| 1998 | Ty: &'a DIType, |
| 1999 | ScopeLine: c_uint, |
| 2000 | Flags: DIFlags, |
| 2001 | SPFlags: DISPFlags, |
Thiébaud Weksteen | 5bd94c1 | 2021-01-06 15:18:42 +0100 | [diff] [blame] | 2002 | MaybeFn: Option<&'a Value>, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2003 | TParam: &'a DIArray, |
| 2004 | Decl: Option<&'a DIDescriptor>, |
| 2005 | ) -> &'a DISubprogram; |
| 2006 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2007 | pub fn LLVMRustDIBuilderCreateBasicType<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2008 | Builder: &DIBuilder<'a>, |
| 2009 | Name: *const c_char, |
| 2010 | NameLen: size_t, |
| 2011 | SizeInBits: u64, |
| 2012 | Encoding: c_uint, |
| 2013 | ) -> &'a DIBasicType; |
| 2014 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2015 | pub fn LLVMRustDIBuilderCreateTypedef<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2016 | Builder: &DIBuilder<'a>, |
| 2017 | Type: &'a DIBasicType, |
| 2018 | Name: *const c_char, |
| 2019 | NameLen: size_t, |
| 2020 | File: &'a DIFile, |
| 2021 | LineNo: c_uint, |
| 2022 | Scope: Option<&'a DIScope>, |
| 2023 | ) -> &'a DIDerivedType; |
| 2024 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2025 | pub fn LLVMRustDIBuilderCreatePointerType<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2026 | Builder: &DIBuilder<'a>, |
| 2027 | PointeeTy: &'a DIType, |
| 2028 | SizeInBits: u64, |
| 2029 | AlignInBits: u32, |
| 2030 | AddressSpace: c_uint, |
| 2031 | Name: *const c_char, |
| 2032 | NameLen: size_t, |
| 2033 | ) -> &'a DIDerivedType; |
| 2034 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2035 | pub fn LLVMRustDIBuilderCreateStructType<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2036 | Builder: &DIBuilder<'a>, |
| 2037 | Scope: Option<&'a DIDescriptor>, |
| 2038 | Name: *const c_char, |
| 2039 | NameLen: size_t, |
| 2040 | File: &'a DIFile, |
| 2041 | LineNumber: c_uint, |
| 2042 | SizeInBits: u64, |
| 2043 | AlignInBits: u32, |
| 2044 | Flags: DIFlags, |
| 2045 | DerivedFrom: Option<&'a DIType>, |
| 2046 | Elements: &'a DIArray, |
| 2047 | RunTimeLang: c_uint, |
| 2048 | VTableHolder: Option<&'a DIType>, |
| 2049 | UniqueId: *const c_char, |
| 2050 | UniqueIdLen: size_t, |
| 2051 | ) -> &'a DICompositeType; |
| 2052 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2053 | pub fn LLVMRustDIBuilderCreateMemberType<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2054 | Builder: &DIBuilder<'a>, |
| 2055 | Scope: &'a DIDescriptor, |
| 2056 | Name: *const c_char, |
| 2057 | NameLen: size_t, |
| 2058 | File: &'a DIFile, |
| 2059 | LineNo: c_uint, |
| 2060 | SizeInBits: u64, |
| 2061 | AlignInBits: u32, |
| 2062 | OffsetInBits: u64, |
| 2063 | Flags: DIFlags, |
| 2064 | Ty: &'a DIType, |
| 2065 | ) -> &'a DIDerivedType; |
| 2066 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2067 | pub fn LLVMRustDIBuilderCreateVariantMemberType<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2068 | Builder: &DIBuilder<'a>, |
| 2069 | Scope: &'a DIScope, |
| 2070 | Name: *const c_char, |
| 2071 | NameLen: size_t, |
| 2072 | File: &'a DIFile, |
| 2073 | LineNumber: c_uint, |
| 2074 | SizeInBits: u64, |
| 2075 | AlignInBits: u32, |
| 2076 | OffsetInBits: u64, |
| 2077 | Discriminant: Option<&'a Value>, |
| 2078 | Flags: DIFlags, |
| 2079 | Ty: &'a DIType, |
| 2080 | ) -> &'a DIType; |
| 2081 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2082 | pub fn LLVMRustDIBuilderCreateLexicalBlock<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2083 | Builder: &DIBuilder<'a>, |
| 2084 | Scope: &'a DIScope, |
| 2085 | File: &'a DIFile, |
| 2086 | Line: c_uint, |
| 2087 | Col: c_uint, |
| 2088 | ) -> &'a DILexicalBlock; |
| 2089 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2090 | pub fn LLVMRustDIBuilderCreateLexicalBlockFile<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2091 | Builder: &DIBuilder<'a>, |
| 2092 | Scope: &'a DIScope, |
| 2093 | File: &'a DIFile, |
| 2094 | ) -> &'a DILexicalBlock; |
| 2095 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2096 | pub fn LLVMRustDIBuilderCreateStaticVariable<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2097 | Builder: &DIBuilder<'a>, |
| 2098 | Context: Option<&'a DIScope>, |
| 2099 | Name: *const c_char, |
| 2100 | NameLen: size_t, |
| 2101 | LinkageName: *const c_char, |
| 2102 | LinkageNameLen: size_t, |
| 2103 | File: &'a DIFile, |
| 2104 | LineNo: c_uint, |
| 2105 | Ty: &'a DIType, |
| 2106 | isLocalToUnit: bool, |
| 2107 | Val: &'a Value, |
| 2108 | Decl: Option<&'a DIDescriptor>, |
| 2109 | AlignInBits: u32, |
| 2110 | ) -> &'a DIGlobalVariableExpression; |
| 2111 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2112 | pub fn LLVMRustDIBuilderCreateVariable<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2113 | Builder: &DIBuilder<'a>, |
| 2114 | Tag: c_uint, |
| 2115 | Scope: &'a DIDescriptor, |
| 2116 | Name: *const c_char, |
| 2117 | NameLen: size_t, |
| 2118 | File: &'a DIFile, |
| 2119 | LineNo: c_uint, |
| 2120 | Ty: &'a DIType, |
| 2121 | AlwaysPreserve: bool, |
| 2122 | Flags: DIFlags, |
| 2123 | ArgNo: c_uint, |
| 2124 | AlignInBits: u32, |
| 2125 | ) -> &'a DIVariable; |
| 2126 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2127 | pub fn LLVMRustDIBuilderCreateArrayType<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2128 | Builder: &DIBuilder<'a>, |
| 2129 | Size: u64, |
| 2130 | AlignInBits: u32, |
| 2131 | Ty: &'a DIType, |
| 2132 | Subscripts: &'a DIArray, |
| 2133 | ) -> &'a DIType; |
| 2134 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2135 | pub fn LLVMRustDIBuilderGetOrCreateSubrange<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2136 | Builder: &DIBuilder<'a>, |
| 2137 | Lo: i64, |
| 2138 | Count: i64, |
| 2139 | ) -> &'a DISubrange; |
| 2140 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2141 | pub fn LLVMRustDIBuilderGetOrCreateArray<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2142 | Builder: &DIBuilder<'a>, |
| 2143 | Ptr: *const Option<&'a DIDescriptor>, |
| 2144 | Count: c_uint, |
| 2145 | ) -> &'a DIArray; |
| 2146 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2147 | pub fn LLVMRustDIBuilderInsertDeclareAtEnd<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2148 | Builder: &DIBuilder<'a>, |
| 2149 | Val: &'a Value, |
| 2150 | VarInfo: &'a DIVariable, |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2151 | AddrOps: *const u64, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2152 | AddrOpsCount: c_uint, |
Thiébaud Weksteen | 5bd94c1 | 2021-01-06 15:18:42 +0100 | [diff] [blame] | 2153 | DL: &'a DILocation, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2154 | InsertAtEnd: &'a BasicBlock, |
| 2155 | ) -> &'a Value; |
| 2156 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2157 | pub fn LLVMRustDIBuilderCreateEnumerator<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2158 | Builder: &DIBuilder<'a>, |
| 2159 | Name: *const c_char, |
| 2160 | NameLen: size_t, |
| 2161 | Value: i64, |
| 2162 | IsUnsigned: bool, |
| 2163 | ) -> &'a DIEnumerator; |
| 2164 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2165 | pub fn LLVMRustDIBuilderCreateEnumerationType<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2166 | Builder: &DIBuilder<'a>, |
| 2167 | Scope: &'a DIScope, |
| 2168 | Name: *const c_char, |
| 2169 | NameLen: size_t, |
| 2170 | File: &'a DIFile, |
| 2171 | LineNumber: c_uint, |
| 2172 | SizeInBits: u64, |
| 2173 | AlignInBits: u32, |
| 2174 | Elements: &'a DIArray, |
| 2175 | ClassType: &'a DIType, |
| 2176 | IsScoped: bool, |
| 2177 | ) -> &'a DIType; |
| 2178 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2179 | pub fn LLVMRustDIBuilderCreateUnionType<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2180 | Builder: &DIBuilder<'a>, |
Chris Wailes | 2f3fdfe | 2021-07-29 10:56:18 -0700 | [diff] [blame] | 2181 | Scope: Option<&'a DIScope>, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2182 | Name: *const c_char, |
| 2183 | NameLen: size_t, |
| 2184 | File: &'a DIFile, |
| 2185 | LineNumber: c_uint, |
| 2186 | SizeInBits: u64, |
| 2187 | AlignInBits: u32, |
| 2188 | Flags: DIFlags, |
| 2189 | Elements: Option<&'a DIArray>, |
| 2190 | RunTimeLang: c_uint, |
| 2191 | UniqueId: *const c_char, |
| 2192 | UniqueIdLen: size_t, |
| 2193 | ) -> &'a DIType; |
| 2194 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2195 | pub fn LLVMRustDIBuilderCreateVariantPart<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2196 | Builder: &DIBuilder<'a>, |
| 2197 | Scope: &'a DIScope, |
| 2198 | Name: *const c_char, |
| 2199 | NameLen: size_t, |
| 2200 | File: &'a DIFile, |
| 2201 | LineNo: c_uint, |
| 2202 | SizeInBits: u64, |
| 2203 | AlignInBits: u32, |
| 2204 | Flags: DIFlags, |
| 2205 | Discriminator: Option<&'a DIDerivedType>, |
| 2206 | Elements: &'a DIArray, |
| 2207 | UniqueId: *const c_char, |
| 2208 | UniqueIdLen: size_t, |
| 2209 | ) -> &'a DIDerivedType; |
| 2210 | |
| 2211 | pub fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr); |
| 2212 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2213 | pub fn LLVMRustDIBuilderCreateTemplateTypeParameter<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2214 | Builder: &DIBuilder<'a>, |
| 2215 | Scope: Option<&'a DIScope>, |
| 2216 | Name: *const c_char, |
| 2217 | NameLen: size_t, |
| 2218 | Ty: &'a DIType, |
| 2219 | ) -> &'a DITemplateTypeParameter; |
| 2220 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2221 | pub fn LLVMRustDIBuilderCreateNameSpace<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2222 | Builder: &DIBuilder<'a>, |
| 2223 | Scope: Option<&'a DIScope>, |
| 2224 | Name: *const c_char, |
| 2225 | NameLen: size_t, |
| 2226 | ExportSymbols: bool, |
| 2227 | ) -> &'a DINameSpace; |
| 2228 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2229 | pub fn LLVMRustDICompositeTypeReplaceArrays<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2230 | Builder: &DIBuilder<'a>, |
| 2231 | CompositeType: &'a DIType, |
| 2232 | Elements: Option<&'a DIArray>, |
| 2233 | Params: Option<&'a DIArray>, |
| 2234 | ); |
| 2235 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2236 | pub fn LLVMRustDIBuilderCreateDebugLocation<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2237 | Line: c_uint, |
| 2238 | Column: c_uint, |
| 2239 | Scope: &'a DIScope, |
Thiébaud Weksteen | 5bd94c1 | 2021-01-06 15:18:42 +0100 | [diff] [blame] | 2240 | InlinedAt: Option<&'a DILocation>, |
| 2241 | ) -> &'a DILocation; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2242 | pub fn LLVMRustDIBuilderCreateOpDeref() -> u64; |
| 2243 | pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> u64; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2244 | |
| 2245 | #[allow(improper_ctypes)] |
| 2246 | pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString); |
| 2247 | #[allow(improper_ctypes)] |
| 2248 | pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString); |
| 2249 | |
| 2250 | pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&ConstantInt>; |
| 2251 | |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2252 | pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>; |
| 2253 | pub fn LLVMRustCreateAddressSanitizerFunctionPass(Recover: bool) -> &'static mut Pass; |
| 2254 | pub fn LLVMRustCreateModuleAddressSanitizerPass(Recover: bool) -> &'static mut Pass; |
| 2255 | pub fn LLVMRustCreateMemorySanitizerPass( |
| 2256 | TrackOrigins: c_int, |
| 2257 | Recover: bool, |
| 2258 | ) -> &'static mut Pass; |
| 2259 | pub fn LLVMRustCreateThreadSanitizerPass() -> &'static mut Pass; |
Chris Wailes | e3116c4 | 2021-07-13 14:40:48 -0700 | [diff] [blame] | 2260 | pub fn LLVMRustCreateHWAddressSanitizerPass(Recover: bool) -> &'static mut Pass; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2261 | pub fn LLVMRustAddPass(PM: &PassManager<'_>, Pass: &'static mut Pass); |
| 2262 | pub fn LLVMRustAddLastExtensionPasses( |
| 2263 | PMB: &PassManagerBuilder, |
| 2264 | Passes: *const &'static mut Pass, |
| 2265 | NumPasses: size_t, |
| 2266 | ); |
| 2267 | |
| 2268 | pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool; |
| 2269 | |
| 2270 | pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine); |
Chris Wailes | 32f7835 | 2021-07-20 14:04:55 -0700 | [diff] [blame] | 2271 | pub fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t; |
| 2272 | pub fn LLVMRustGetTargetFeature( |
| 2273 | T: &TargetMachine, |
| 2274 | Index: size_t, |
| 2275 | Feature: &mut *const c_char, |
| 2276 | Desc: &mut *const c_char, |
| 2277 | ); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2278 | |
| 2279 | pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char; |
| 2280 | pub fn LLVMRustCreateTargetMachine( |
| 2281 | Triple: *const c_char, |
| 2282 | CPU: *const c_char, |
| 2283 | Features: *const c_char, |
| 2284 | Abi: *const c_char, |
| 2285 | Model: CodeModel, |
| 2286 | Reloc: RelocModel, |
| 2287 | Level: CodeGenOptLevel, |
| 2288 | UseSoftFP: bool, |
| 2289 | FunctionSections: bool, |
| 2290 | DataSections: bool, |
Chris Wailes | 356b57e | 2022-01-13 10:08:24 -0800 | [diff] [blame] | 2291 | UniqueSectionNames: bool, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2292 | TrapUnreachable: bool, |
| 2293 | Singlethread: bool, |
| 2294 | AsmComments: bool, |
| 2295 | EmitStackSizeSection: bool, |
| 2296 | RelaxELFRelocations: bool, |
| 2297 | UseInitArray: bool, |
Jeff Vander Stoep | d59a287 | 2021-02-15 10:22:21 +0100 | [diff] [blame] | 2298 | SplitDwarfFile: *const c_char, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2299 | ) -> Option<&'static mut TargetMachine>; |
| 2300 | pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine); |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2301 | pub fn LLVMRustAddBuilderLibraryInfo<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2302 | PMB: &'a PassManagerBuilder, |
| 2303 | M: &'a Module, |
| 2304 | DisableSimplifyLibCalls: bool, |
| 2305 | ); |
| 2306 | pub fn LLVMRustConfigurePassManagerBuilder( |
| 2307 | PMB: &PassManagerBuilder, |
| 2308 | OptLevel: CodeGenOptLevel, |
| 2309 | MergeFunctions: bool, |
| 2310 | SLPVectorize: bool, |
| 2311 | LoopVectorize: bool, |
| 2312 | PrepareForThinLTO: bool, |
| 2313 | PGOGenPath: *const c_char, |
| 2314 | PGOUsePath: *const c_char, |
Chris Wailes | a153842 | 2021-12-02 10:37:12 -0800 | [diff] [blame] | 2315 | PGOSampleUsePath: *const c_char, |
Charisee | 9cf6780 | 2022-06-30 20:04:09 +0000 | [diff] [blame] | 2316 | SizeLevel: c_int, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2317 | ); |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2318 | pub fn LLVMRustAddLibraryInfo<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2319 | PM: &PassManager<'a>, |
| 2320 | M: &'a Module, |
| 2321 | DisableSimplifyLibCalls: bool, |
| 2322 | ); |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2323 | pub fn LLVMRustRunFunctionPassManager<'a>(PM: &PassManager<'a>, M: &'a Module); |
| 2324 | pub fn LLVMRustWriteOutputFile<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2325 | T: &'a TargetMachine, |
| 2326 | PM: &PassManager<'a>, |
| 2327 | M: &'a Module, |
| 2328 | Output: *const c_char, |
Jeff Vander Stoep | d59a287 | 2021-02-15 10:22:21 +0100 | [diff] [blame] | 2329 | DwoOutput: *const c_char, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2330 | FileType: FileType, |
| 2331 | ) -> LLVMRustResult; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2332 | pub fn LLVMRustOptimizeWithNewPassManager<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2333 | M: &'a Module, |
| 2334 | TM: &'a TargetMachine, |
| 2335 | OptLevel: PassBuilderOptLevel, |
| 2336 | OptStage: OptStage, |
| 2337 | NoPrepopulatePasses: bool, |
| 2338 | VerifyIR: bool, |
| 2339 | UseThinLTOBuffers: bool, |
| 2340 | MergeFunctions: bool, |
| 2341 | UnrollLoops: bool, |
| 2342 | SLPVectorize: bool, |
| 2343 | LoopVectorize: bool, |
| 2344 | DisableSimplifyLibCalls: bool, |
| 2345 | EmitLifetimeMarkers: bool, |
| 2346 | SanitizerOptions: Option<&SanitizerOptions>, |
| 2347 | PGOGenPath: *const c_char, |
| 2348 | PGOUsePath: *const c_char, |
Chris Wailes | 2f3fdfe | 2021-07-29 10:56:18 -0700 | [diff] [blame] | 2349 | InstrumentCoverage: bool, |
| 2350 | InstrumentGCOV: bool, |
Chris Wailes | a153842 | 2021-12-02 10:37:12 -0800 | [diff] [blame] | 2351 | PGOSampleUsePath: *const c_char, |
| 2352 | DebugInfoForProfiling: bool, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2353 | llvm_selfprofiler: *mut c_void, |
| 2354 | begin_callback: SelfProfileBeforePassCallback, |
| 2355 | end_callback: SelfProfileAfterPassCallback, |
Chris Wailes | 2f3fdfe | 2021-07-29 10:56:18 -0700 | [diff] [blame] | 2356 | ExtraPasses: *const c_char, |
| 2357 | ExtraPassesLen: size_t, |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2358 | LLVMPlugins: *const c_char, |
| 2359 | LLVMPluginsLen: size_t, |
Chris Wailes | 2f3fdfe | 2021-07-29 10:56:18 -0700 | [diff] [blame] | 2360 | ) -> LLVMRustResult; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2361 | pub fn LLVMRustPrintModule( |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2362 | M: &Module, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2363 | Output: *const c_char, |
| 2364 | Demangle: extern "C" fn(*const c_char, size_t, *mut c_char, size_t) -> size_t, |
| 2365 | ) -> LLVMRustResult; |
| 2366 | pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char); |
| 2367 | pub fn LLVMRustPrintPasses(); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2368 | pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char); |
| 2369 | pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool); |
| 2370 | pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2371 | |
| 2372 | pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2373 | pub fn LLVMRustArchiveIteratorNew(AR: &Archive) -> &mut ArchiveIterator<'_>; |
| 2374 | pub fn LLVMRustArchiveIteratorNext<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2375 | AIR: &ArchiveIterator<'a>, |
| 2376 | ) -> Option<&'a mut ArchiveChild<'a>>; |
| 2377 | pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char; |
| 2378 | pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2379 | pub fn LLVMRustArchiveChildFree<'a>(ACR: &'a mut ArchiveChild<'a>); |
| 2380 | pub fn LLVMRustArchiveIteratorFree<'a>(AIR: &'a mut ArchiveIterator<'a>); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2381 | pub fn LLVMRustDestroyArchive(AR: &'static mut Archive); |
| 2382 | |
| 2383 | #[allow(improper_ctypes)] |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2384 | pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString); |
| 2385 | |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2386 | #[allow(improper_ctypes)] |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2387 | pub fn LLVMRustUnpackOptimizationDiagnostic<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2388 | DI: &'a DiagnosticInfo, |
| 2389 | pass_name_out: &RustString, |
| 2390 | function_out: &mut Option<&'a Value>, |
| 2391 | loc_line_out: &mut c_uint, |
| 2392 | loc_column_out: &mut c_uint, |
| 2393 | loc_filename_out: &RustString, |
| 2394 | message_out: &RustString, |
| 2395 | ); |
| 2396 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2397 | pub fn LLVMRustUnpackInlineAsmDiagnostic<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2398 | DI: &'a DiagnosticInfo, |
| 2399 | level_out: &mut DiagnosticLevel, |
| 2400 | cookie_out: &mut c_uint, |
| 2401 | message_out: &mut Option<&'a Twine>, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2402 | ); |
| 2403 | |
| 2404 | #[allow(improper_ctypes)] |
| 2405 | pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString); |
| 2406 | pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind; |
| 2407 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2408 | pub fn LLVMRustGetSMDiagnostic<'a>( |
Chris Wailes | bcf972c | 2021-10-21 11:03:28 -0700 | [diff] [blame] | 2409 | DI: &'a DiagnosticInfo, |
| 2410 | cookie_out: &mut c_uint, |
| 2411 | ) -> &'a SMDiagnostic; |
| 2412 | |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2413 | pub fn LLVMRustSetInlineAsmDiagnosticHandler( |
| 2414 | C: &Context, |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2415 | H: InlineAsmDiagHandlerTy, |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2416 | CX: *mut c_void, |
| 2417 | ); |
| 2418 | |
| 2419 | #[allow(improper_ctypes)] |
| 2420 | pub fn LLVMRustUnpackSMDiagnostic( |
| 2421 | d: &SMDiagnostic, |
| 2422 | message_out: &RustString, |
| 2423 | buffer_out: &RustString, |
| 2424 | level_out: &mut DiagnosticLevel, |
| 2425 | loc_out: &mut c_uint, |
| 2426 | ranges_out: *mut c_uint, |
| 2427 | num_ranges: &mut usize, |
| 2428 | ) -> bool; |
| 2429 | |
| 2430 | pub fn LLVMRustWriteArchive( |
| 2431 | Dst: *const c_char, |
| 2432 | NumMembers: size_t, |
| 2433 | Members: *const &RustArchiveMember<'_>, |
| 2434 | WriteSymbtab: bool, |
| 2435 | Kind: ArchiveKind, |
| 2436 | ) -> LLVMRustResult; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2437 | pub fn LLVMRustArchiveMemberNew<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2438 | Filename: *const c_char, |
| 2439 | Name: *const c_char, |
| 2440 | Child: Option<&ArchiveChild<'a>>, |
| 2441 | ) -> &'a mut RustArchiveMember<'a>; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2442 | pub fn LLVMRustArchiveMemberFree<'a>(Member: &'a mut RustArchiveMember<'a>); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2443 | |
Chris Wailes | 2f3fdfe | 2021-07-29 10:56:18 -0700 | [diff] [blame] | 2444 | pub fn LLVMRustWriteImportLibrary( |
| 2445 | ImportName: *const c_char, |
| 2446 | Path: *const c_char, |
| 2447 | Exports: *const LLVMRustCOFFShortExport, |
| 2448 | NumExports: usize, |
| 2449 | Machine: u16, |
| 2450 | MinGW: bool, |
| 2451 | ) -> LLVMRustResult; |
| 2452 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2453 | pub fn LLVMRustSetDataLayoutFromTargetMachine<'a>(M: &'a Module, TM: &'a TargetMachine); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2454 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2455 | pub fn LLVMRustBuildOperandBundleDef<'a>( |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2456 | Name: *const c_char, |
| 2457 | Inputs: *const &'a Value, |
| 2458 | NumInputs: c_uint, |
| 2459 | ) -> &'a mut OperandBundleDef<'a>; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2460 | pub fn LLVMRustFreeOperandBundleDef<'a>(Bundle: &'a mut OperandBundleDef<'a>); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2461 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2462 | pub fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2463 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2464 | pub fn LLVMRustSetComdat<'a>(M: &'a Module, V: &'a Value, Name: *const c_char, NameLen: size_t); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2465 | pub fn LLVMRustSetModulePICLevel(M: &Module); |
| 2466 | pub fn LLVMRustSetModulePIELevel(M: &Module); |
Chris Wailes | e3116c4 | 2021-07-13 14:40:48 -0700 | [diff] [blame] | 2467 | pub fn LLVMRustSetModuleCodeModel(M: &Module, Model: CodeModel); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2468 | pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer; |
| 2469 | pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8; |
| 2470 | pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize; |
| 2471 | pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer); |
| 2472 | pub fn LLVMRustModuleCost(M: &Module) -> u64; |
| 2473 | |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 2474 | pub fn LLVMRustThinLTOBufferCreate(M: &Module, is_thin: bool) -> &'static mut ThinLTOBuffer; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2475 | pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer); |
| 2476 | pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char; |
| 2477 | pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t; |
| 2478 | pub fn LLVMRustCreateThinLTOData( |
| 2479 | Modules: *const ThinLTOModule, |
| 2480 | NumModules: c_uint, |
| 2481 | PreservedSymbols: *const *const c_char, |
| 2482 | PreservedSymbolsLen: c_uint, |
| 2483 | ) -> Option<&'static mut ThinLTOData>; |
| 2484 | pub fn LLVMRustPrepareThinLTORename( |
| 2485 | Data: &ThinLTOData, |
| 2486 | Module: &Module, |
| 2487 | Target: &TargetMachine, |
| 2488 | ) -> bool; |
| 2489 | pub fn LLVMRustPrepareThinLTOResolveWeak(Data: &ThinLTOData, Module: &Module) -> bool; |
| 2490 | pub fn LLVMRustPrepareThinLTOInternalize(Data: &ThinLTOData, Module: &Module) -> bool; |
| 2491 | pub fn LLVMRustPrepareThinLTOImport( |
| 2492 | Data: &ThinLTOData, |
| 2493 | Module: &Module, |
| 2494 | Target: &TargetMachine, |
| 2495 | ) -> bool; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2496 | pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData); |
| 2497 | pub fn LLVMRustParseBitcodeForLTO( |
| 2498 | Context: &Context, |
| 2499 | Data: *const u8, |
| 2500 | len: usize, |
| 2501 | Identifier: *const c_char, |
| 2502 | ) -> Option<&Module>; |
| 2503 | pub fn LLVMRustGetBitcodeSliceFromObjectData( |
| 2504 | Data: *const u8, |
| 2505 | len: usize, |
| 2506 | out_len: &mut usize, |
| 2507 | ) -> *const u8; |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 2508 | pub fn LLVMRustThinLTOGetDICompileUnit( |
| 2509 | M: &Module, |
| 2510 | CU1: &mut *mut c_void, |
| 2511 | CU2: &mut *mut c_void, |
| 2512 | ); |
| 2513 | pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2514 | |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2515 | pub fn LLVMRustLinkerNew(M: &Module) -> &mut Linker<'_>; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2516 | pub fn LLVMRustLinkerAdd( |
| 2517 | linker: &Linker<'_>, |
| 2518 | bytecode: *const c_char, |
| 2519 | bytecode_len: usize, |
| 2520 | ) -> bool; |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2521 | pub fn LLVMRustLinkerFree<'a>(linker: &'a mut Linker<'a>); |
Thiébaud Weksteen | 5bd94c1 | 2021-01-06 15:18:42 +0100 | [diff] [blame] | 2522 | #[allow(improper_ctypes)] |
| 2523 | pub fn LLVMRustComputeLTOCacheKey( |
| 2524 | key_out: &RustString, |
| 2525 | mod_id: *const c_char, |
| 2526 | data: &ThinLTOData, |
| 2527 | ); |
Charisee | 7878d54 | 2022-02-24 18:21:36 +0000 | [diff] [blame] | 2528 | |
| 2529 | pub fn LLVMRustContextGetDiagnosticHandler(Context: &Context) -> Option<&DiagnosticHandler>; |
| 2530 | pub fn LLVMRustContextSetDiagnosticHandler( |
| 2531 | context: &Context, |
| 2532 | diagnostic_handler: Option<&DiagnosticHandler>, |
| 2533 | ); |
| 2534 | pub fn LLVMRustContextConfigureDiagnosticHandler( |
| 2535 | context: &Context, |
| 2536 | diagnostic_handler_callback: DiagnosticHandlerTy, |
| 2537 | diagnostic_handler_context: *mut c_void, |
| 2538 | remark_all_passes: bool, |
| 2539 | remark_passes: *const *const c_char, |
| 2540 | remark_passes_len: usize, |
| 2541 | ); |
| 2542 | |
Charisee | 9cf6780 | 2022-06-30 20:04:09 +0000 | [diff] [blame] | 2543 | #[allow(improper_ctypes)] |
| 2544 | pub fn LLVMRustGetMangledName(V: &Value, out: &RustString); |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 2545 | |
| 2546 | pub fn LLVMRustGetElementTypeArgIndex(CallSite: &Value) -> i32; |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 2547 | } |