1 module llvm.functions; 2 3 import std.array : array; 4 import std.algorithm.iteration : map, joiner; 5 import std.range : chain; 6 7 import llvm.config; 8 import llvm.types; 9 10 private nothrow auto orEmpty(T)(T v) 11 { 12 return v? v : ""; 13 } 14 15 nothrow void LLVMInitializeAllTargetInfos() 16 { 17 mixin(LLVM_Targets.map!(t => "LLVMInitialize" ~ t ~ "TargetInfo();").joiner.array.orEmpty); 18 } 19 20 nothrow void LLVMInitializeAllTargets() 21 { 22 mixin(LLVM_Targets.map!(t => "LLVMInitialize" ~ t ~ "Target();").joiner.array.orEmpty); 23 } 24 25 nothrow void LLVMInitializeAllTargetMCs() 26 { 27 mixin(LLVM_Targets.map!(t => "LLVMInitialize" ~ t ~ "TargetMC();").joiner.array.orEmpty); 28 } 29 30 nothrow void LLVMInitializeAllAsmPrinters() 31 { 32 mixin(LLVM_AsmPrinters.map!(t => "LLVMInitialize" ~ t ~ "AsmPrinter();").joiner.array.orEmpty); 33 } 34 35 nothrow void LLVMInitializeAllAsmParsers() 36 { 37 mixin(LLVM_AsmParsers.map!(t => "LLVMInitialize" ~ t ~ "AsmParser();").joiner.array.orEmpty); 38 } 39 40 nothrow void LLVMInitializeAllDisassemblers() 41 { 42 mixin(LLVM_Disassemblers.map!(t => "LLVMInitialize" ~ t ~ "Disassembler();").joiner.array.orEmpty); 43 } 44 45 nothrow LLVMBool LLVMInitializeNativeTarget() 46 { 47 static if (LLVM_NativeTarget != "") { 48 mixin("LLVMInitialize" ~ LLVM_NativeTarget ~ "TargetInfo();"); 49 mixin("LLVMInitialize" ~ LLVM_NativeTarget ~ "Target();"); 50 mixin("LLVMInitialize" ~ LLVM_NativeTarget ~ "TargetMC();"); 51 return 0; 52 } else { 53 return 1; 54 } 55 } 56 57 static if (LLVM_Version >= asVersion(3, 4, 0)) 58 { 59 nothrow LLVMBool LLVMInitializeNativeAsmParser() 60 { 61 static if (LLVM_NativeTarget != "") { 62 mixin("LLVMInitialize" ~ LLVM_NativeTarget ~ "AsmParser();"); 63 return 0; 64 } else { 65 return 1; 66 } 67 } 68 69 nothrow LLVMBool LLVMInitializeNativeAsmPrinter() 70 { 71 static if (LLVM_NativeTarget != "") { 72 mixin("LLVMInitialize" ~ LLVM_NativeTarget ~ "AsmPrinter();"); 73 return 0; 74 } else { 75 return 1; 76 } 77 } 78 79 nothrow LLVMBool LLVMInitializeNativeDisassembler() 80 { 81 static if (LLVM_NativeTarget != "") { 82 mixin("LLVMInitialize" ~ LLVM_NativeTarget ~ "Disassembler();"); 83 return 0; 84 } else { 85 return 1; 86 } 87 } 88 } 89 90 __gshared extern(System) nothrow: 91 92 /+ Analysis +/ 93 94 LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action, char** OutMessage); 95 LLVMBool LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action); 96 void LLVMViewFunctionCFG(LLVMValueRef Fn); 97 void LLVMViewFunctionCFGOnly(LLVMValueRef Fn); 98 99 /+ Bit Reader +/ 100 101 static if (LLVM_Version < asVersion(3, 9, 0)) { 102 LLVMBool LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMModuleRef* OutModule, char** OutMessage); 103 } 104 105 static if (LLVM_Version >= asVersion(3, 8, 0)) { 106 LLVMBool LLVMParseBitcode2(LLVMMemoryBufferRef MemBuf, LLVMModuleRef* OutModule); 107 } 108 109 static if (LLVM_Version < asVersion(3, 9, 0)) { 110 LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, LLVMModuleRef* OutModule, char** OutMessage); 111 } 112 113 static if (LLVM_Version >= asVersion(3, 8, 0)) { 114 LLVMBool LLVMParseBitcodeInContext2(LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, LLVMModuleRef* OutModule); 115 } 116 117 static if (LLVM_Version < asVersion(3, 9, 0)) { 118 LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, LLVMModuleRef* OutM, char** OutMessage); 119 } 120 121 static if (LLVM_Version >= asVersion(3, 8, 0)) { 122 LLVMBool LLVMGetBitcodeModuleInContext2(LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, LLVMModuleRef* OutM); 123 } 124 125 static if (LLVM_Version < asVersion(3, 9, 0)) { 126 LLVMBool LLVMGetBitcodeModule(LLVMMemoryBufferRef MemBuf, LLVMModuleRef* OutM, char** OutMessage); 127 } 128 129 static if (LLVM_Version >= asVersion(3, 8, 0)) { 130 LLVMBool LLVMGetBitcodeModule2(LLVMMemoryBufferRef MemBuf, LLVMModuleRef* OutM); 131 } 132 133 static if (LLVM_Version < asVersion(3, 8, 0)) { 134 LLVMBool LLVMGetBitcodeModuleProviderInContext(LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, LLVMModuleProviderRef* OutMP, char** OutMessage); 135 } 136 137 static if (LLVM_Version < asVersion(3, 8, 0)) { 138 LLVMBool LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf, LLVMModuleProviderRef* OutMP, char** OutMessage); 139 } 140 141 /+ Bit Writer +/ 142 143 int LLVMWriteBitcodeToFile(LLVMModuleRef M, const(char)* Path); 144 int LLVMWriteBitcodeToFD(LLVMModuleRef M, int FD, int ShouldClose, int Unbuffered); 145 int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int Handle); 146 static if (LLVM_Version >= asVersion(3, 6, 0)) { 147 LLVMMemoryBufferRef LLVMWriteBitcodeToMemoryBuffer(LLVMModuleRef M); 148 } 149 150 /+ Transforms +/ 151 152 /++ Interprocedural transformations ++/ 153 154 void LLVMAddArgumentPromotionPass(LLVMPassManagerRef PM); 155 void LLVMAddConstantMergePass(LLVMPassManagerRef PM); 156 void LLVMAddDeadArgEliminationPass(LLVMPassManagerRef PM); 157 void LLVMAddFunctionAttrsPass(LLVMPassManagerRef PM); 158 void LLVMAddFunctionInliningPass(LLVMPassManagerRef PM); 159 void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM); 160 void LLVMAddGlobalDCEPass(LLVMPassManagerRef PM); 161 void LLVMAddGlobalOptimizerPass(LLVMPassManagerRef PM); 162 void LLVMAddIPConstantPropagationPass(LLVMPassManagerRef PM); 163 void LLVMAddPruneEHPass(LLVMPassManagerRef PM); 164 void LLVMAddIPSCCPPass(LLVMPassManagerRef PM); 165 void LLVMAddInternalizePass(LLVMPassManagerRef, uint AllButMain); 166 void LLVMAddStripDeadPrototypesPass(LLVMPassManagerRef PM); 167 void LLVMAddStripSymbolsPass(LLVMPassManagerRef PM); 168 169 /++ Pass manager builder ++/ 170 171 LLVMPassManagerBuilderRef LLVMPassManagerBuilderCreate(); 172 void LLVMPassManagerBuilderDispose(LLVMPassManagerBuilderRef PMB); 173 void LLVMPassManagerBuilderSetOptLevel(LLVMPassManagerBuilderRef PMB, uint OptLevel); 174 void LLVMPassManagerBuilderSetSizeLevel(LLVMPassManagerBuilderRef PMB, uint SizeLevel); 175 void LLVMPassManagerBuilderSetDisableUnitAtATime(LLVMPassManagerBuilderRef PMB, LLVMBool Value); 176 void LLVMPassManagerBuilderSetDisableUnrollLoops(LLVMPassManagerBuilderRef PMB, LLVMBool Value); 177 void LLVMPassManagerBuilderSetDisableSimplifyLibCalls(LLVMPassManagerBuilderRef PMB, LLVMBool Value); 178 void LLVMPassManagerBuilderUseInlinerWithThreshold(LLVMPassManagerBuilderRef PMB, uint Threshold); 179 void LLVMPassManagerBuilderPopulateFunctionPassManager(LLVMPassManagerBuilderRef PMB, LLVMPassManagerRef PM); 180 void LLVMPassManagerBuilderPopulateModulePassManager(LLVMPassManagerBuilderRef PMB, LLVMPassManagerRef PM); 181 void LLVMPassManagerBuilderPopulateLTOPassManager(LLVMPassManagerBuilderRef PMB, LLVMPassManagerRef PM, LLVMBool Internalize, LLVMBool RunInliner); 182 183 /++ Scalar transformations ++/ 184 185 void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM); 186 static if (LLVM_Version >= asVersion(3, 7, 0)) { 187 void LLVMAddBitTrackingDCEPass(LLVMPassManagerRef PM); 188 } 189 static if (LLVM_Version >= asVersion(3, 6, 0)) { 190 void LLVMAddAlignmentFromAssumptionsPass(LLVMPassManagerRef PM); 191 } 192 void LLVMAddCFGSimplificationPass(LLVMPassManagerRef PM); 193 void LLVMAddDeadStoreEliminationPass(LLVMPassManagerRef PM); 194 static if (LLVM_Version >= asVersion(3, 5, 0)) { 195 void LLVMAddScalarizerPass(LLVMPassManagerRef PM); 196 } 197 static if (LLVM_Version >= asVersion(3, 5, 0)) { 198 void LLVMAddMergedLoadStoreMotionPass(LLVMPassManagerRef PM); 199 } 200 void LLVMAddGVNPass(LLVMPassManagerRef PM); 201 static if (LLVM_Version >= asVersion(4, 0, 0)) { 202 void LLVMAddNewGVNPass(LLVMPassManagerRef PM); 203 } 204 void LLVMAddIndVarSimplifyPass(LLVMPassManagerRef PM); 205 void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM); 206 void LLVMAddJumpThreadingPass(LLVMPassManagerRef PM); 207 void LLVMAddLICMPass(LLVMPassManagerRef PM); 208 void LLVMAddLoopDeletionPass(LLVMPassManagerRef PM); 209 void LLVMAddLoopIdiomPass(LLVMPassManagerRef PM); 210 void LLVMAddLoopRotatePass(LLVMPassManagerRef PM); 211 static if (LLVM_Version >= asVersion(3, 4, 0)) { 212 void LLVMAddLoopRerollPass(LLVMPassManagerRef PM); 213 } 214 void LLVMAddLoopUnrollPass(LLVMPassManagerRef PM); 215 void LLVMAddLoopUnswitchPass(LLVMPassManagerRef PM); 216 void LLVMAddMemCpyOptPass(LLVMPassManagerRef PM); 217 static if (LLVM_Version >= asVersion(3, 4, 0)) { 218 void LLVMAddPartiallyInlineLibCallsPass(LLVMPassManagerRef PM); 219 } 220 static if (LLVM_Version >= asVersion(3, 6, 0)) { 221 void LLVMAddLowerSwitchPass(LLVMPassManagerRef PM); 222 } 223 void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM); 224 void LLVMAddReassociatePass(LLVMPassManagerRef PM); 225 void LLVMAddSCCPPass(LLVMPassManagerRef PM); 226 void LLVMAddScalarReplAggregatesPass(LLVMPassManagerRef PM); 227 void LLVMAddScalarReplAggregatesPassSSA(LLVMPassManagerRef PM); 228 void LLVMAddScalarReplAggregatesPassWithThreshold(LLVMPassManagerRef PM, int Threshold); 229 void LLVMAddSimplifyLibCallsPass(LLVMPassManagerRef PM); 230 void LLVMAddTailCallEliminationPass(LLVMPassManagerRef PM); 231 void LLVMAddConstantPropagationPass(LLVMPassManagerRef PM); 232 void LLVMAddDemoteMemoryToRegisterPass(LLVMPassManagerRef PM); 233 void LLVMAddVerifierPass(LLVMPassManagerRef PM); 234 void LLVMAddCorrelatedValuePropagationPass(LLVMPassManagerRef PM); 235 void LLVMAddEarlyCSEPass(LLVMPassManagerRef PM); 236 static if (LLVM_Version >= asVersion(4, 0, 0)) { 237 void LLVMAddEarlyCSEMemSSAPass(LLVMPassManagerRef PM); 238 } 239 void LLVMAddLowerExpectIntrinsicPass(LLVMPassManagerRef PM); 240 void LLVMAddTypeBasedAliasAnalysisPass(LLVMPassManagerRef PM); 241 static if (LLVM_Version >= asVersion(3, 6, 0)) { 242 void LLVMAddScopedNoAliasAAPass(LLVMPassManagerRef PM); 243 } 244 void LLVMAddBasicAliasAnalysisPass(LLVMPassManagerRef PM); 245 246 /++ Vectorization transformations ++/ 247 248 void LLVMAddBBVectorizePass(LLVMPassManagerRef PM); 249 static if (LLVM_Version >= asVersion(3, 2, 0)) { 250 void LLVMAddLoopVectorizePass(LLVMPassManagerRef PM); 251 } 252 253 /+ Core +/ 254 255 static if (LLVM_Version >= asVersion(3, 3, 0)) { 256 void LLVMShutdown(); 257 } 258 static if (LLVM_Version >= asVersion(3, 4, 0)) { 259 char* LLVMCreateMessage(const(char)* Message); 260 } 261 void LLVMDisposeMessage(char* Message); 262 static if (LLVM_Version >= asVersion(3, 4, 0)) { 263 void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler); 264 } 265 static if (LLVM_Version >= asVersion(3, 4, 0)) { 266 void LLVMResetFatalErrorHandler(); 267 } 268 static if (LLVM_Version >= asVersion(3, 4, 0)) { 269 void LLVMEnablePrettyStackTrace(); 270 } 271 272 /++ Contexts ++/ 273 274 LLVMContextRef LLVMContextCreate(); 275 LLVMContextRef LLVMGetGlobalContext(); 276 void LLVMContextDispose(LLVMContextRef C); 277 uint LLVMGetMDKindIDInContext(LLVMContextRef C, const(char)* Name, uint SLen); 278 uint LLVMGetMDKindID(const(char)* Name, uint SLen); 279 280 281 static if (LLVM_Version >= asVersion(3, 9, 0)) { 282 uint LLVMGetEnumAttributeKindForName(const(char)*Name, size_t SLen); 283 } 284 static if (LLVM_Version >= asVersion(3, 9, 0)) { 285 uint LLVMGetLastEnumAttributeKind(); 286 } 287 static if (LLVM_Version >= asVersion(3, 9, 0)) { 288 LLVMAttributeRef LLVMCreateEnumAttribute(LLVMContextRef C, uint KindID, ulong Val); 289 } 290 static if (LLVM_Version >= asVersion(3, 9, 0)) { 291 uint LLVMGetEnumAttributeKind(LLVMAttributeRef A); 292 } 293 static if (LLVM_Version >= asVersion(3, 9, 0)) { 294 ulong LLVMGetEnumAttributeValue(LLVMAttributeRef A); 295 } 296 static if (LLVM_Version >= asVersion(3, 9, 0)) { 297 LLVMAttributeRef LLVMCreateStringAttribute(LLVMContextRef C, const(char)*K, uint KLength, const(char)*V, uint VLength); 298 } 299 static if (LLVM_Version >= asVersion(3, 9, 0)) { 300 const(char)* LLVMGetStringAttributeKind(LLVMAttributeRef A, uint *Length); 301 } 302 static if (LLVM_Version >= asVersion(3, 9, 0)) { 303 const(char)* LLVMGetStringAttributeValue(LLVMAttributeRef A, uint *Length); 304 } 305 static if (LLVM_Version >= asVersion(3, 9, 0)) { 306 LLVMBool LLVMIsEnumAttribute(LLVMAttributeRef A); 307 } 308 static if (LLVM_Version >= asVersion(3, 9, 0)) { 309 LLVMBool LLVMIsStringAttribute(LLVMAttributeRef A); 310 } 311 312 static if (LLVM_Version >= asVersion(3, 5, 0)) { 313 void LLVMContextSetDiagnosticHandler (LLVMContextRef C, LLVMDiagnosticHandler Handler, void *DiagnosticContext); 314 } 315 316 static if (LLVM_Version >= asVersion(3, 9, 0)) { 317 LLVMDiagnosticHandler LLVMContextGetDiagnosticHandler(LLVMContextRef C); 318 } 319 static if (LLVM_Version >= asVersion(3, 9, 0)) { 320 void* LLVMContextGetDiagnosticContext(LLVMContextRef C); 321 } 322 323 static if (LLVM_Version >= asVersion(3, 5, 0)) { 324 char* LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI); 325 } 326 327 static if (LLVM_Version >= asVersion(3, 5, 0)) { 328 LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI); 329 } 330 static if (LLVM_Version >= asVersion(3, 5, 0)) { 331 void LLVMContextSetYieldCallback(LLVMContextRef C, LLVMYieldCallback Callback, void *OpaqueHandle); 332 } 333 334 /++ Modules ++/ 335 336 LLVMModuleRef LLVMModuleCreateWithName(const(char)* ModuleID); 337 LLVMModuleRef LLVMModuleCreateWithNameInContext(const(char)* ModuleID, LLVMContextRef C); 338 static if (LLVM_Version >= asVersion(3, 6, 0)) { 339 LLVMModuleRef LLVMCloneModule(LLVMModuleRef M); 340 } 341 void LLVMDisposeModule(LLVMModuleRef M); 342 343 static if (LLVM_Version >= asVersion(3, 9, 0)) { 344 const(char)* LLVMGetModuleIdentifier(LLVMModuleRef M, size_t *Len); 345 } 346 static if (LLVM_Version >= asVersion(3, 9, 0)) { 347 void LLVMSetModuleIdentifier(LLVMModuleRef M, const(char)* Ident, size_t Len); 348 } 349 350 const(char)* LLVMGetDataLayout(LLVMModuleRef M); 351 352 static if (LLVM_Version >= asVersion(3, 9, 0)) { 353 const(char)* LLVMGetDataLayoutStr(LLVMModuleRef M); 354 } 355 356 void LLVMSetDataLayout(LLVMModuleRef M, const(char)* Triple); 357 const(char)* LLVMGetTarget(LLVMModuleRef M); 358 void LLVMSetTarget(LLVMModuleRef M, const(char)* Triple); 359 void LLVMDumpModule(LLVMModuleRef M); 360 static if (LLVM_Version >= asVersion(3, 2, 0)) { 361 LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const(char)* Filename, char** ErrorMessage); 362 } 363 static if (LLVM_Version >= asVersion(3, 4, 0)) { 364 char* LLVMPrintModuleToString(LLVMModuleRef M); 365 } 366 void LLVMSetModuleInlineAsm(LLVMModuleRef M, const(char)* Asm); 367 LLVMContextRef LLVMGetModuleContext(LLVMModuleRef M); 368 LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const(char)* Name); 369 uint LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const(char)* name); 370 void LLVMGetNamedMetadataOperands(LLVMModuleRef M, const(char)* name, LLVMValueRef *Dest); 371 void LLVMAddNamedMetadataOperand(LLVMModuleRef M, const(char)* name, LLVMValueRef Val); 372 LLVMValueRef LLVMAddFunction(LLVMModuleRef M, const(char)* Name, LLVMTypeRef FunctionTy); 373 LLVMValueRef LLVMGetNamedFunction(LLVMModuleRef M, const(char)* Name); 374 LLVMValueRef LLVMGetFirstFunction(LLVMModuleRef M); 375 LLVMValueRef LLVMGetLastFunction(LLVMModuleRef M); 376 LLVMValueRef LLVMGetNextFunction(LLVMValueRef Fn); 377 LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn); 378 379 /++ Types ++/ 380 381 LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty); 382 LLVMBool LLVMTypeIsSized(LLVMTypeRef Ty); 383 LLVMContextRef LLVMGetTypeContext(LLVMTypeRef Ty); 384 static if (LLVM_Version >= asVersion(3, 4, 0)) { 385 void LLVMDumpType(LLVMTypeRef Val); 386 } 387 static if (LLVM_Version >= asVersion(3, 4, 0)) { 388 char* LLVMPrintTypeToString(LLVMTypeRef Val); 389 } 390 391 /+++ Integer Types +++/ 392 393 LLVMTypeRef LLVMInt1TypeInContext(LLVMContextRef C); 394 LLVMTypeRef LLVMInt8TypeInContext(LLVMContextRef C); 395 LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C); 396 LLVMTypeRef LLVMInt32TypeInContext(LLVMContextRef C); 397 LLVMTypeRef LLVMInt64TypeInContext(LLVMContextRef C); 398 static if (LLVM_Version >= asVersion(3, 8, 0)) { 399 LLVMTypeRef LLVMInt128TypeInContext(LLVMContextRef C); 400 } 401 LLVMTypeRef LLVMIntTypeInContext(LLVMContextRef C, uint NumBits); 402 LLVMTypeRef LLVMInt1Type(); 403 LLVMTypeRef LLVMInt8Type(); 404 LLVMTypeRef LLVMInt16Type(); 405 LLVMTypeRef LLVMInt32Type(); 406 LLVMTypeRef LLVMInt64Type(); 407 static if (LLVM_Version >= asVersion(3, 8, 0)) { 408 LLVMTypeRef LLVMInt128Type(); 409 } 410 LLVMTypeRef LLVMIntType(uint NumBits); 411 uint LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy); 412 413 /+++ Floating Point Types +++/ 414 415 LLVMTypeRef LLVMHalfTypeInContext(LLVMContextRef C); 416 LLVMTypeRef LLVMFloatTypeInContext(LLVMContextRef C); 417 LLVMTypeRef LLVMDoubleTypeInContext(LLVMContextRef C); 418 LLVMTypeRef LLVMX86FP80TypeInContext(LLVMContextRef C); 419 LLVMTypeRef LLVMFP128TypeInContext(LLVMContextRef C); 420 LLVMTypeRef LLVMPPCFP128TypeInContext(LLVMContextRef C); 421 LLVMTypeRef LLVMHalfType(); 422 LLVMTypeRef LLVMFloatType(); 423 LLVMTypeRef LLVMDoubleType(); 424 LLVMTypeRef LLVMX86FP80Type(); 425 LLVMTypeRef LLVMFP128Type(); 426 LLVMTypeRef LLVMPPCFP128Type(); 427 428 /+++ Function Types +++/ 429 430 LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType, LLVMTypeRef* ParamTypes, uint ParamCount, LLVMBool IsVarArg); 431 LLVMBool LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy); 432 LLVMTypeRef LLVMGetReturnType(LLVMTypeRef FunctionTy); 433 uint LLVMCountParamTypes(LLVMTypeRef FunctionTy); 434 void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef* Dest); 435 436 /+++ Structure Types +++/ 437 438 LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef* ElementTypes, uint ElementCount, LLVMBool Packed); 439 LLVMTypeRef LLVMStructType(LLVMTypeRef* ElementTypes, uint ElementCount, LLVMBool Packed); 440 LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const(char)* Name); 441 const(char)* LLVMGetStructName(LLVMTypeRef Ty); 442 void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef* ElementTypes, uint ElementCount, LLVMBool Packed); 443 uint LLVMCountStructElementTypes(LLVMTypeRef StructTy); 444 void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef* Dest); 445 static if (LLVM_Version >= asVersion(3, 7, 0)) { 446 LLVMTypeRef LLVMStructGetTypeAtIndex(LLVMTypeRef StructTy, uint i); 447 } 448 LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy); 449 LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy); 450 451 /+++ Sequential Types +++/ 452 453 LLVMTypeRef LLVMGetElementType(LLVMTypeRef Ty); 454 LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, uint ElementCount); 455 uint LLVMGetArrayLength(LLVMTypeRef ArrayTy); 456 LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, uint AddressSpace); 457 uint LLVMGetPointerAddressSpace(LLVMTypeRef PointerTy); 458 LLVMTypeRef LLVMVectorType(LLVMTypeRef ElementType, uint ElementCount); 459 uint LLVMGetVectorSize(LLVMTypeRef VectorTy); 460 461 /+++ Other Types +++/ 462 463 LLVMTypeRef LLVMVoidTypeInContext(LLVMContextRef C); 464 LLVMTypeRef LLVMLabelTypeInContext(LLVMContextRef C); 465 LLVMTypeRef LLVMX86MMXTypeInContext(LLVMContextRef C); 466 LLVMTypeRef LLVMVoidType(); 467 LLVMTypeRef LLVMLabelType(); 468 LLVMTypeRef LLVMX86MMXType(); 469 470 /++ Values ++/ 471 472 /+++ General APIs +++/ 473 474 LLVMTypeRef LLVMTypeOf(LLVMValueRef Val); 475 static if (LLVM_Version >= asVersion(3, 9, 0)) { 476 LLVMValueKind LLVMGetValueKind(LLVMValueRef Val); 477 } 478 const(char)* LLVMGetValueName(LLVMValueRef Val); 479 void LLVMSetValueName(LLVMValueRef Val, const(char )*Name); 480 void LLVMDumpValue(LLVMValueRef Val); 481 static if (LLVM_Version >= asVersion(3, 4, 0)) { 482 char* LLVMPrintValueToString(LLVMValueRef Val); 483 } 484 void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal); 485 LLVMBool LLVMIsConstant(LLVMValueRef Val); 486 LLVMBool LLVMIsUndef(LLVMValueRef Val); 487 488 LLVMValueRef LLVMIsAAllocaInst(LLVMValueRef Val); 489 LLVMValueRef LLVMIsAArgument(LLVMValueRef Val); 490 LLVMValueRef LLVMIsABasicBlock(LLVMValueRef Val); 491 LLVMValueRef LLVMIsABinaryOperator(LLVMValueRef Val); 492 LLVMValueRef LLVMIsABitCastInst(LLVMValueRef Val); 493 LLVMValueRef LLVMIsABlockAddress(LLVMValueRef Val); 494 LLVMValueRef LLVMIsABranchInst(LLVMValueRef Val); 495 LLVMValueRef LLVMIsACallInst(LLVMValueRef Val); 496 LLVMValueRef LLVMIsACastInst(LLVMValueRef Val); 497 static if (LLVM_Version >= asVersion(3, 4, 0)) { 498 LLVMValueRef LLVMIsAAddrSpaceCastInst(LLVMValueRef Val); 499 } 500 LLVMValueRef LLVMIsACmpInst(LLVMValueRef Val); 501 LLVMValueRef LLVMIsAConstantAggregateZero(LLVMValueRef Val); 502 LLVMValueRef LLVMIsAConstantArray(LLVMValueRef Val); 503 static if (LLVM_Version >= asVersion(3, 4, 0)) { 504 LLVMValueRef LLVMIsAConstantDataSequential(LLVMValueRef Val); 505 } 506 static if (LLVM_Version >= asVersion(3, 4, 0)) { 507 LLVMValueRef LLVMIsAConstantDataArray(LLVMValueRef Val); 508 } 509 static if (LLVM_Version >= asVersion(3, 4, 0)) { 510 LLVMValueRef LLVMIsAConstantDataVector(LLVMValueRef Val); 511 } 512 513 LLVMValueRef LLVMIsAConstantExpr(LLVMValueRef Val); 514 LLVMValueRef LLVMIsAConstantFP(LLVMValueRef Val); 515 LLVMValueRef LLVMIsAConstantInt(LLVMValueRef Val); 516 LLVMValueRef LLVMIsAConstant(LLVMValueRef Val); 517 LLVMValueRef LLVMIsAConstantPointerNull(LLVMValueRef Val); 518 LLVMValueRef LLVMIsAConstantStruct(LLVMValueRef Val); 519 static if (LLVM_Version >= asVersion(3, 8, 0)) { 520 LLVMValueRef LLVMIsAConstantTokenNone(LLVMValueRef Val); 521 } 522 LLVMValueRef LLVMIsAConstantVector(LLVMValueRef Val); 523 LLVMValueRef LLVMIsADbgDeclareInst(LLVMValueRef Val); 524 LLVMValueRef LLVMIsADbgInfoIntrinsic(LLVMValueRef Val); 525 LLVMValueRef LLVMIsAExtractElementInst(LLVMValueRef Val); 526 LLVMValueRef LLVMIsAExtractValueInst(LLVMValueRef Val); 527 LLVMValueRef LLVMIsAFCmpInst(LLVMValueRef Val); 528 LLVMValueRef LLVMIsAFPExtInst(LLVMValueRef Val); 529 LLVMValueRef LLVMIsAFPToSIInst(LLVMValueRef Val); 530 LLVMValueRef LLVMIsAFPToUIInst(LLVMValueRef Val); 531 LLVMValueRef LLVMIsAFPTruncInst(LLVMValueRef Val); 532 LLVMValueRef LLVMIsAGetElementPtrInst(LLVMValueRef Val); 533 LLVMValueRef LLVMIsAGlobalValue(LLVMValueRef Val); 534 LLVMValueRef LLVMIsAGlobalAlias(LLVMValueRef Val); 535 LLVMValueRef LLVMIsAGlobalObject(LLVMValueRef Val); 536 LLVMValueRef LLVMIsAFunction(LLVMValueRef Val); 537 LLVMValueRef LLVMIsAGlobalVariable(LLVMValueRef Val); 538 LLVMValueRef LLVMIsAICmpInst(LLVMValueRef Val); 539 LLVMValueRef LLVMIsAIndirectBrInst(LLVMValueRef Val); 540 LLVMValueRef LLVMIsAInlineAsm(LLVMValueRef Val); 541 LLVMValueRef LLVMIsAInsertElementInst(LLVMValueRef Val); 542 LLVMValueRef LLVMIsAInsertValueInst(LLVMValueRef Val); 543 LLVMValueRef LLVMIsAInstruction(LLVMValueRef Val); 544 LLVMValueRef LLVMIsAIntrinsicInst(LLVMValueRef Val); 545 LLVMValueRef LLVMIsAIntToPtrInst(LLVMValueRef Val); 546 LLVMValueRef LLVMIsAInvokeInst(LLVMValueRef Val); 547 LLVMValueRef LLVMIsALandingPadInst(LLVMValueRef Val); 548 LLVMValueRef LLVMIsALoadInst(LLVMValueRef Val); 549 LLVMValueRef LLVMIsAMDNode(LLVMValueRef Val); 550 LLVMValueRef LLVMIsAMDString(LLVMValueRef Val); 551 LLVMValueRef LLVMIsAMemCpyInst(LLVMValueRef Val); 552 LLVMValueRef LLVMIsAMemIntrinsic(LLVMValueRef Val); 553 LLVMValueRef LLVMIsAMemMoveInst(LLVMValueRef Val); 554 LLVMValueRef LLVMIsAMemSetInst(LLVMValueRef Val); 555 LLVMValueRef LLVMIsAPHINode(LLVMValueRef Val); 556 LLVMValueRef LLVMIsAPtrToIntInst(LLVMValueRef Val); 557 LLVMValueRef LLVMIsAResumeInst(LLVMValueRef Val); 558 static if (LLVM_Version >= asVersion(3, 8, 0)) { 559 LLVMValueRef LLVMIsACleanupReturnInst(LLVMValueRef Val); 560 } 561 static if (LLVM_Version >= asVersion(3, 8, 0)) { 562 LLVMValueRef LLVMIsACatchReturnInst(LLVMValueRef Val); 563 } 564 static if (LLVM_Version >= asVersion(3, 8, 0)) { 565 LLVMValueRef LLVMIsAFuncletPadInst(LLVMValueRef Val); 566 } 567 static if (LLVM_Version >= asVersion(3, 8, 0)) { 568 LLVMValueRef LLVMIsACatchPadInst(LLVMValueRef Val); 569 } 570 static if (LLVM_Version >= asVersion(3, 8, 0)) { 571 LLVMValueRef LLVMIsACleanupPadInst(LLVMValueRef Val); 572 } 573 LLVMValueRef LLVMIsAReturnInst(LLVMValueRef Val); 574 LLVMValueRef LLVMIsASelectInst(LLVMValueRef Val); 575 LLVMValueRef LLVMIsASExtInst(LLVMValueRef Val); 576 LLVMValueRef LLVMIsAShuffleVectorInst(LLVMValueRef Val); 577 LLVMValueRef LLVMIsASIToFPInst(LLVMValueRef Val); 578 LLVMValueRef LLVMIsAStoreInst(LLVMValueRef Val); 579 LLVMValueRef LLVMIsASwitchInst(LLVMValueRef Val); 580 LLVMValueRef LLVMIsATerminatorInst(LLVMValueRef Val); 581 LLVMValueRef LLVMIsATruncInst(LLVMValueRef Val); 582 LLVMValueRef LLVMIsAUIToFPInst(LLVMValueRef Val); 583 LLVMValueRef LLVMIsAUnaryInstruction(LLVMValueRef Val); 584 LLVMValueRef LLVMIsAUndefValue(LLVMValueRef Val); 585 LLVMValueRef LLVMIsAUnreachableInst(LLVMValueRef Val); 586 LLVMValueRef LLVMIsAUser(LLVMValueRef Val); 587 LLVMValueRef LLVMIsAVAArgInst(LLVMValueRef Val); 588 LLVMValueRef LLVMIsAZExtInst(LLVMValueRef Val); 589 590 /+++ Usage +++/ 591 592 LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val); 593 LLVMUseRef LLVMGetNextUse(LLVMUseRef U); 594 LLVMValueRef LLVMGetUser(LLVMUseRef U); 595 LLVMValueRef LLVMGetUsedValue(LLVMUseRef U); 596 597 /+++ User value +++/ 598 599 LLVMValueRef LLVMGetOperand(LLVMValueRef Val, uint Index); 600 static if (LLVM_Version >= asVersion(3, 6, 0)) { 601 LLVMUseRef LLVMGetOperandUse(LLVMValueRef Val, uint Index); 602 } 603 void LLVMSetOperand(LLVMValueRef User, uint Index, LLVMValueRef Val); 604 int LLVMGetNumOperands(LLVMValueRef Val); 605 606 /+++ Constants +++/ 607 608 LLVMValueRef LLVMConstNull(LLVMTypeRef Ty); 609 LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty); 610 LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty); 611 LLVMBool LLVMIsNull(LLVMValueRef Val); 612 LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty); 613 614 /++++ Scalar constants ++++/ 615 616 LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, ulong N, LLVMBool SignExtend); 617 LLVMValueRef LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy, uint NumWords, const(ulong)* Words); 618 LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const(char)* Text, ubyte Radix); 619 LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const(char)* Text, uint SLen, ubyte Radix); 620 LLVMValueRef LLVMConstReal(LLVMTypeRef RealTy, double N); 621 LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const(char)* Text); 622 LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const(char)* Text, uint SLen); 623 ulong LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal); 624 long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal); 625 static if (LLVM_Version >= asVersion(3, 6, 0)) { 626 double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *losesInfo); 627 } 628 629 /++++ Composite Constants ++++/ 630 631 LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const(char)* Str, uint Length, LLVMBool DontNullTerminate); 632 LLVMValueRef LLVMConstString(const(char)* Str, uint Length, LLVMBool DontNullTerminate); 633 static if (LLVM_Version >= asVersion(3, 6, 0)) { 634 LLVMBool LLVMIsConstantString(LLVMValueRef c); 635 } 636 static if (LLVM_Version >= asVersion(3, 6, 0)) { 637 const(char*) LLVMGetAsString(LLVMValueRef c, size_t* Length); 638 } 639 LLVMValueRef LLVMConstStructInContext(LLVMContextRef C, LLVMValueRef* ConstantVals, uint Count, LLVMBool Packed); 640 LLVMValueRef LLVMConstStruct(LLVMValueRef* ConstantVals, uint Count, LLVMBool Packed); 641 LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy, LLVMValueRef* ConstantVals, uint Length); 642 LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy, LLVMValueRef* ConstantVals, uint Count); 643 static if (LLVM_Version >= asVersion(3, 6, 0)) { 644 LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef c, uint idx); 645 } 646 LLVMValueRef LLVMConstVector(LLVMValueRef* ScalarConstantVals, uint Size); 647 648 /++++ Constant Expressions ++++/ 649 650 LLVMOpcode LLVMGetConstOpcode(LLVMValueRef ConstantVal); 651 LLVMValueRef LLVMAlignOf(LLVMTypeRef Ty); 652 LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty); 653 LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal); 654 LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal); 655 LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal); 656 LLVMValueRef LLVMConstFNeg(LLVMValueRef ConstantVal); 657 LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal); 658 LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 659 LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 660 LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 661 LLVMValueRef LLVMConstFAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 662 LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 663 LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 664 LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 665 LLVMValueRef LLVMConstFSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 666 LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 667 LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 668 LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 669 LLVMValueRef LLVMConstFMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 670 LLVMValueRef LLVMConstUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 671 static if (LLVM_Version >= asVersion(4, 0, 0)) { 672 LLVMValueRef LLVMConstExactUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 673 } 674 LLVMValueRef LLVMConstSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 675 LLVMValueRef LLVMConstExactSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 676 LLVMValueRef LLVMConstFDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 677 LLVMValueRef LLVMConstURem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 678 LLVMValueRef LLVMConstSRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 679 LLVMValueRef LLVMConstFRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 680 LLVMValueRef LLVMConstAnd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 681 LLVMValueRef LLVMConstOr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 682 LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 683 LLVMValueRef LLVMConstICmp(LLVMIntPredicate Predicate, LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 684 LLVMValueRef LLVMConstFCmp(LLVMRealPredicate Predicate, LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 685 LLVMValueRef LLVMConstShl(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 686 LLVMValueRef LLVMConstLShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 687 LLVMValueRef LLVMConstAShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant); 688 LLVMValueRef LLVMConstGEP(LLVMValueRef ConstantVal, LLVMValueRef* ConstantIndices, uint NumIndices); 689 LLVMValueRef LLVMConstInBoundsGEP(LLVMValueRef ConstantVal, LLVMValueRef* ConstantIndices, uint NumIndices); 690 LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 691 LLVMValueRef LLVMConstSExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 692 LLVMValueRef LLVMConstZExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 693 LLVMValueRef LLVMConstFPTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 694 LLVMValueRef LLVMConstFPExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 695 LLVMValueRef LLVMConstUIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 696 LLVMValueRef LLVMConstSIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 697 LLVMValueRef LLVMConstFPToUI(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 698 LLVMValueRef LLVMConstFPToSI(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 699 LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 700 LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 701 LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 702 static if (LLVM_Version >= asVersion(3, 4, 0)) { 703 LLVMValueRef LLVMConstAddrSpaceCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 704 } 705 LLVMValueRef LLVMConstZExtOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 706 LLVMValueRef LLVMConstSExtOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 707 LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 708 LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 709 LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType, LLVMBool isSigned); 710 LLVMValueRef LLVMConstFPCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType); 711 LLVMValueRef LLVMConstSelect(LLVMValueRef ConstantCondition, LLVMValueRef ConstantIfTrue, LLVMValueRef ConstantIfFalse); 712 LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, LLVMValueRef IndexConstant); 713 LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant, LLVMValueRef ElementValueConstant, LLVMValueRef IndexConstant); 714 LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant, LLVMValueRef VectorBConstant, LLVMValueRef MaskConstant); 715 LLVMValueRef LLVMConstExtractValue(LLVMValueRef AggConstant, uint* IdxList, uint NumIdx); 716 LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant, LLVMValueRef ElementValueConstant, uint* IdxList, uint NumIdx); 717 LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const(char)* AsmString, const(char)* Constraints, LLVMBool HasSideEffects, LLVMBool IsAlignStack); 718 LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB); 719 720 /++++ Global Values ++++/ 721 722 LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global); 723 LLVMBool LLVMIsDeclaration(LLVMValueRef Global); 724 LLVMLinkage LLVMGetLinkage(LLVMValueRef Global); 725 void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage); 726 const(char)* LLVMGetSection(LLVMValueRef Global); 727 void LLVMSetSection(LLVMValueRef Global, const(char)* Section); 728 LLVMVisibility LLVMGetVisibility(LLVMValueRef Global); 729 void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz); 730 static if (LLVM_Version >= asVersion(3, 5, 0)) { 731 LLVMDLLStorageClass LLVMGetDLLStorageClass(LLVMValueRef Global); 732 } 733 static if (LLVM_Version >= asVersion(3, 5, 0)) { 734 void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class); 735 } 736 static if (LLVM_Version >= asVersion(3, 5, 0)) { 737 LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global); 738 } 739 static if (LLVM_Version >= asVersion(3, 5, 0)) { 740 void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr); 741 } 742 uint LLVMGetAlignment(LLVMValueRef Global); 743 void LLVMSetAlignment(LLVMValueRef Global, uint Bytes); 744 745 /+++++ Global Variables +++++/ 746 747 LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const(char)* Name); 748 LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty, const(char)* Name, uint AddressSpace); 749 LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const(char)* Name); 750 LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M); 751 LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M); 752 LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar); 753 LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar); 754 void LLVMDeleteGlobal(LLVMValueRef GlobalVar); 755 LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar); 756 void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal); 757 LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar); 758 void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal); 759 LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar); 760 void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant); 761 static if (LLVM_Version >= asVersion(3, 3, 0)) { 762 LLVMThreadLocalMode LLVMGetThreadLocalMode(LLVMValueRef GlobalVar); 763 } 764 static if (LLVM_Version >= asVersion(3, 3, 0)) { 765 void LLVMSetThreadLocalMode(LLVMValueRef GlobalVar, LLVMThreadLocalMode Mode); 766 } 767 static if (LLVM_Version >= asVersion(3, 3, 0)) { 768 LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar); 769 } 770 static if (LLVM_Version >= asVersion(3, 3, 0)) { 771 void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit); 772 } 773 774 /+++++ Global Aliases +++++/ 775 776 LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee, const(char)* Name); 777 778 /+++++ Function values +++++/ 779 780 void LLVMDeleteFunction(LLVMValueRef Fn); 781 static if (LLVM_Version >= asVersion(3, 9, 0)) { 782 LLVMBool LLVMHasPersonalityFn(LLVMValueRef Fn); 783 } 784 static if (LLVM_Version >= asVersion(3, 7, 0)) { 785 LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn); 786 } 787 static if (LLVM_Version >= asVersion(3, 7, 0)) { 788 void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn); 789 } 790 uint LLVMGetIntrinsicID(LLVMValueRef Fn); 791 uint LLVMGetFunctionCallConv(LLVMValueRef Fn); 792 void LLVMSetFunctionCallConv(LLVMValueRef Fn, uint CC); 793 const(char)* LLVMGetGC(LLVMValueRef Fn); 794 void LLVMSetGC(LLVMValueRef Fn, const(char)* Name); 795 static if (LLVM_Version < asVersion(4, 0, 0)) { 796 void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA); 797 } 798 799 static if (LLVM_Version >= asVersion(3, 9, 0)) { 800 void LLVMAddAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef A); 801 } 802 static if (LLVM_Version >= asVersion(3, 9, 0)) { 803 uint LLVMGetAttributeCountAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx); 804 } 805 static if (LLVM_Version >= asVersion(3, 9, 0)) { 806 void LLVMGetAttributesAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs); 807 } 808 static if (LLVM_Version >= asVersion(3, 9, 0)) { 809 LLVMAttributeRef LLVMGetEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, uint KindID); 810 } 811 static if (LLVM_Version >= asVersion(3, 9, 0)) { 812 LLVMAttributeRef LLVMGetStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const(char)* K, uint KLen); 813 } 814 static if (LLVM_Version >= asVersion(3, 9, 0)) { 815 void LLVMRemoveEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, uint KindID); 816 } 817 static if (LLVM_Version >= asVersion(3, 9, 0)) { 818 void LLVMRemoveStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const(char)* K, uint KLen); 819 } 820 821 822 823 static if (LLVM_Version >= asVersion(3, 3, 0)) { 824 void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const(char)* A, const(char)* V); 825 } 826 827 static if (LLVM_Version < asVersion(4, 0, 0)) { 828 LLVMAttribute LLVMGetFunctionAttr(LLVMValueRef Fn); 829 void LLVMRemoveFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA); 830 } 831 /++++++ Function Parameters ++++++/ 832 833 uint LLVMCountParams(LLVMValueRef Fn); 834 void LLVMGetParams(LLVMValueRef Fn, LLVMValueRef* Params); 835 LLVMValueRef LLVMGetParam(LLVMValueRef Fn, uint Index); 836 LLVMValueRef LLVMGetParamParent(LLVMValueRef Inst); 837 LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn); 838 LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn); 839 LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg); 840 LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg); 841 842 static if (LLVM_Version < asVersion(4, 0, 0)) { 843 void LLVMAddAttribute(LLVMValueRef Arg, LLVMAttribute PA); 844 void LLVMRemoveAttribute(LLVMValueRef Arg, LLVMAttribute PA); 845 LLVMAttribute LLVMGetAttribute(LLVMValueRef Arg); 846 } 847 848 void LLVMSetParamAlignment(LLVMValueRef Arg, uint Align); 849 850 /+++ Metadata +++/ 851 852 LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const(char)* Str, uint SLen); 853 LLVMValueRef LLVMMDString(const(char)* Str, uint SLen); 854 LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef* Vals, uint Count); 855 LLVMValueRef LLVMMDNode(LLVMValueRef* Vals, uint Count); 856 const(char)* LLVMGetMDString(LLVMValueRef V, uint* Len); 857 static if (LLVM_Version >= asVersion(3, 2, 0)) { 858 uint LLVMGetMDNodeNumOperands(LLVMValueRef V); 859 } 860 static if (LLVM_Version >= asVersion(3, 2, 0)) { 861 void LLVMGetMDNodeOperands(LLVMValueRef V, LLVMValueRef *Dest); 862 } 863 864 /+++ Basic Block +++/ 865 866 LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB); 867 LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val); 868 LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val); 869 static if (LLVM_Version >= asVersion(3, 9, 0)) { 870 const(char)* LLVMGetBasicBlockName(LLVMBasicBlockRef BB); 871 } 872 LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB); 873 LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB); 874 uint LLVMCountBasicBlocks(LLVMValueRef Fn); 875 void LLVMGetBasicBlocks(LLVMValueRef Fn, LLVMBasicBlockRef* BasicBlocks); 876 LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn); 877 LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn); 878 LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB); 879 LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB); 880 LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn); 881 LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C, LLVMValueRef Fn, const(char)* Name); 882 LLVMBasicBlockRef LLVMAppendBasicBlock(LLVMValueRef Fn, const(char)* Name); 883 LLVMBasicBlockRef LLVMInsertBasicBlockInContext(LLVMContextRef C, LLVMBasicBlockRef BB, const(char)* Name); 884 LLVMBasicBlockRef LLVMInsertBasicBlock(LLVMBasicBlockRef InsertBeforeBB, const(char)* Name); 885 void LLVMDeleteBasicBlock(LLVMBasicBlockRef BB); 886 void LLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BB); 887 void LLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos); 888 void LLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos); 889 LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB); 890 LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB); 891 892 /+++ Instructions +++/ 893 894 int LLVMHasMetadata(LLVMValueRef Val); 895 LLVMValueRef LLVMGetMetadata(LLVMValueRef Val, uint KindID); 896 void LLVMSetMetadata(LLVMValueRef Val, uint KindID, LLVMValueRef Node); 897 LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst); 898 LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst); 899 LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst); 900 static if (LLVM_Version >= asVersion(3, 9, 0)) { 901 void LLVMInstructionRemoveFromParent(LLVMValueRef Inst); 902 } 903 void LLVMInstructionEraseFromParent(LLVMValueRef Inst); 904 LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst); 905 LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst); 906 static if (LLVM_Version >= asVersion(3, 6, 0)) { 907 LLVMRealPredicate LLVMGetFCmpPredicate(LLVMValueRef Inst); 908 } 909 static if (LLVM_Version >= asVersion(3, 6, 0)) { 910 LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst); 911 } 912 LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef SwitchInstr); 913 914 915 static if (LLVM_Version >= asVersion(3, 9, 0)) { 916 LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca); 917 } 918 static if (LLVM_Version >= asVersion(3, 9, 0)) { 919 LLVMBool LLVMIsInBounds(LLVMValueRef GEP); 920 } 921 static if (LLVM_Version >= asVersion(3, 9, 0)) { 922 void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds); 923 } 924 925 /++++ Call Sites and Invocations ++++/ 926 927 static if (LLVM_Version >= asVersion(3, 9, 0)) { 928 uint LLVMGetNumArgOperands(LLVMValueRef Instr); 929 } 930 void LLVMSetInstructionCallConv(LLVMValueRef Instr, uint CC); 931 uint LLVMGetInstructionCallConv(LLVMValueRef Instr); 932 933 static if (LLVM_Version < asVersion(4, 0, 0)) { 934 void LLVMAddInstrAttribute(LLVMValueRef Instr, uint index, LLVMAttribute); 935 void LLVMRemoveInstrAttribute(LLVMValueRef Instr, uint index, LLVMAttribute); 936 } 937 void LLVMSetInstrParamAlignment(LLVMValueRef Instr, uint index, uint Align); 938 939 static if (LLVM_Version >= asVersion(3, 9, 0)) { 940 void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef A); 941 } 942 static if (LLVM_Version >= asVersion(3, 9, 0)) { 943 uint LLVMGetCallSiteAttributeCount(LLVMValueRef C, LLVMAttributeIndex Idx); 944 } 945 static if (LLVM_Version >= asVersion(3, 9, 0)) { 946 void LLVMGetCallSiteAttributes(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs); 947 } 948 static if (LLVM_Version >= asVersion(3, 9, 0)) { 949 LLVMAttributeRef LLVMGetCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, uint KindID); 950 } 951 static if (LLVM_Version >= asVersion(3, 9, 0)) { 952 LLVMAttributeRef LLVMGetCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const(char)* K, uint KLen); 953 } 954 static if (LLVM_Version >= asVersion(3, 9, 0)) { 955 void LLVMRemoveCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, uint KindID); 956 } 957 static if (LLVM_Version >= asVersion(3, 9, 0)) { 958 void LLVMRemoveCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const(char)* K, uint KLen); 959 } 960 961 static if (LLVM_Version >= asVersion(3, 9, 0)) { 962 LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr); 963 } 964 965 LLVMBool LLVMIsTailCall(LLVMValueRef CallInst); 966 967 static if (LLVM_Version >= asVersion(3, 9, 0)) { 968 LLVMBasicBlockRef LLVMGetNormalDest(LLVMValueRef InvokeInst); 969 } 970 static if (LLVM_Version >= asVersion(3, 9, 0)) { 971 LLVMBasicBlockRef LLVMGetUnwindDest(LLVMValueRef InvokeInst); 972 } 973 static if (LLVM_Version >= asVersion(3, 9, 0)) { 974 void LLVMSetNormalDest(LLVMValueRef InvokeInst, LLVMBasicBlockRef B); 975 } 976 static if (LLVM_Version >= asVersion(3, 9, 0)) { 977 void LLVMSetUnwindDest(LLVMValueRef InvokeInst, LLVMBasicBlockRef B); 978 } 979 980 void LLVMSetTailCall(LLVMValueRef CallInst, LLVMBool IsTailCall); 981 static if (LLVM_Version >= asVersion(3, 6, 0)) { 982 uint LLVMGetNumSuccessors(LLVMValueRef Term); 983 } 984 static if (LLVM_Version >= asVersion(3, 6, 0)) { 985 LLVMBasicBlockRef LLVMGetSuccessor(LLVMValueRef Term, uint i); 986 } 987 static if (LLVM_Version >= asVersion(3, 6, 0)) { 988 void LLVMSetSuccessor(LLVMValueRef Term, uint i, LLVMBasicBlockRef block); 989 } 990 static if (LLVM_Version >= asVersion(3, 6, 0)) { 991 LLVMBool LLVMIsConditional(LLVMValueRef Branch); 992 } 993 static if (LLVM_Version >= asVersion(3, 6, 0)) { 994 LLVMValueRef LLVMGetCondition(LLVMValueRef Branch); 995 } 996 static if (LLVM_Version >= asVersion(3, 6, 0)) { 997 void LLVMSetCondition(LLVMValueRef Branch, LLVMValueRef Cond); 998 } 999 1000 /++++ PHI Nodes ++++/ 1001 1002 void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef* IncomingValues, LLVMBasicBlockRef* IncomingBlocks, uint Count); 1003 uint LLVMCountIncoming(LLVMValueRef PhiNode); 1004 LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, uint Index); 1005 LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, uint Index); 1006 1007 1008 1009 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1010 uint LLVMGetNumIndices(LLVMValueRef Inst); 1011 } 1012 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1013 const(uint)* LLVMGetIndices(LLVMValueRef Inst); 1014 } 1015 1016 /++ Instruction Builders ++/ 1017 1018 LLVMBuilderRef LLVMCreateBuilderInContext(LLVMContextRef C); 1019 LLVMBuilderRef LLVMCreateBuilder(); 1020 void LLVMPositionBuilder(LLVMBuilderRef Builder, LLVMBasicBlockRef Block, LLVMValueRef Instr); 1021 void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr); 1022 void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block); 1023 LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder); 1024 void LLVMClearInsertionPosition(LLVMBuilderRef Builder); 1025 void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr); 1026 void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr, const(char)* Name); 1027 void LLVMDisposeBuilder(LLVMBuilderRef Builder); 1028 void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L); 1029 LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder); 1030 void LLVMSetInstDebugLocation(LLVMBuilderRef Builder, LLVMValueRef Inst); 1031 LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef); 1032 LLVMValueRef LLVMBuildRet(LLVMBuilderRef, LLVMValueRef V); 1033 LLVMValueRef LLVMBuildAggregateRet(LLVMBuilderRef, LLVMValueRef* RetVals, uint N); 1034 LLVMValueRef LLVMBuildBr(LLVMBuilderRef, LLVMBasicBlockRef Dest); 1035 LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef, LLVMValueRef If, LLVMBasicBlockRef Then, LLVMBasicBlockRef Else); 1036 LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef, LLVMValueRef V, LLVMBasicBlockRef Else, uint NumCases); 1037 LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr, uint NumDests); 1038 LLVMValueRef LLVMBuildInvoke(LLVMBuilderRef, LLVMValueRef Fn, LLVMValueRef* Args, uint NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, const(char)* Name); 1039 static if (LLVM_Version >= asVersion(3, 7, 0)) { 1040 LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PersFn, uint NumClauses, const(char)* Name); 1041 } else { 1042 LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, uint NumClauses, const(char)* Name); 1043 } 1044 LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn); 1045 LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef); 1046 void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal, LLVMBasicBlockRef Dest); 1047 void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest); 1048 1049 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1050 uint LLVMGetNumClauses(LLVMValueRef LandingPad); 1051 } 1052 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1053 LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, uint Idx); 1054 } 1055 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1056 LLVMBool LLVMIsCleanup(LLVMValueRef LandingPad); 1057 } 1058 1059 void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal); 1060 void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val); 1061 LLVMValueRef LLVMBuildAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1062 LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1063 LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1064 LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1065 LLVMValueRef LLVMBuildSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1066 LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1067 LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1068 LLVMValueRef LLVMBuildFSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1069 LLVMValueRef LLVMBuildMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1070 LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1071 LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1072 LLVMValueRef LLVMBuildFMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1073 LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1074 static if (LLVM_Version >= asVersion(4, 0, 0)) { 1075 LLVMValueRef LLVMBuildExactUDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1076 } 1077 LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1078 LLVMValueRef LLVMBuildExactSDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1079 LLVMValueRef LLVMBuildFDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1080 LLVMValueRef LLVMBuildURem(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1081 LLVMValueRef LLVMBuildSRem(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1082 LLVMValueRef LLVMBuildFRem(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1083 LLVMValueRef LLVMBuildShl(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1084 LLVMValueRef LLVMBuildLShr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1085 LLVMValueRef LLVMBuildAShr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1086 LLVMValueRef LLVMBuildAnd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1087 LLVMValueRef LLVMBuildOr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1088 LLVMValueRef LLVMBuildXor(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1089 LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1090 LLVMValueRef LLVMBuildNeg(LLVMBuilderRef, LLVMValueRef V, const(char)* Name); 1091 LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V, const(char)* Name); 1092 LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V, const(char)* Name); 1093 LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef, LLVMValueRef V, const(char)* Name); 1094 LLVMValueRef LLVMBuildNot(LLVMBuilderRef, LLVMValueRef V, const(char)* Name); 1095 LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef, LLVMTypeRef Ty, const(char)* Name); 1096 LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef, LLVMTypeRef Ty, LLVMValueRef Val, const(char)* Name); 1097 LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef, LLVMTypeRef Ty, const(char)* Name); 1098 LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef, LLVMTypeRef Ty, LLVMValueRef Val, const(char)* Name); 1099 LLVMValueRef LLVMBuildFree(LLVMBuilderRef, LLVMValueRef PointerVal); 1100 LLVMValueRef LLVMBuildLoad(LLVMBuilderRef, LLVMValueRef PointerVal, const(char)* Name); 1101 LLVMValueRef LLVMBuildStore(LLVMBuilderRef, LLVMValueRef Val, LLVMValueRef Ptr); 1102 LLVMValueRef LLVMBuildGEP(LLVMBuilderRef B, LLVMValueRef Pointer, LLVMValueRef* Indices, uint NumIndices, const(char)* Name); 1103 LLVMValueRef LLVMBuildInBoundsGEP(LLVMBuilderRef B, LLVMValueRef Pointer, LLVMValueRef* Indices, uint NumIndices, const(char)* Name); 1104 LLVMValueRef LLVMBuildStructGEP(LLVMBuilderRef B, LLVMValueRef Pointer, uint Idx, const(char)* Name); 1105 LLVMValueRef LLVMBuildGlobalString(LLVMBuilderRef B, const(char)* Str, const(char)* Name); 1106 LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const(char)* Str, const(char)* Name); 1107 LLVMBool LLVMGetVolatile(LLVMValueRef MemoryAccessInst); 1108 void LLVMSetVolatile(LLVMValueRef MemoryAccessInst, LLVMBool IsVolatile); 1109 static if (LLVM_Version >= asVersion(3, 8, 0)) { 1110 LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemoryAccessInst); 1111 } 1112 static if (LLVM_Version >= asVersion(3, 8, 0)) { 1113 void LLVMSetOrdering(LLVMValueRef MemoryAccessInst, LLVMAtomicOrdering Ordering); 1114 } 1115 LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1116 LLVMValueRef LLVMBuildZExt(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1117 LLVMValueRef LLVMBuildSExt(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1118 LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1119 LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1120 LLVMValueRef LLVMBuildUIToFP(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1121 LLVMValueRef LLVMBuildSIToFP(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1122 LLVMValueRef LLVMBuildFPTrunc(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1123 LLVMValueRef LLVMBuildFPExt(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1124 LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1125 LLVMValueRef LLVMBuildIntToPtr(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1126 LLVMValueRef LLVMBuildBitCast(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1127 static if (LLVM_Version >= asVersion(3, 4, 0)) { 1128 LLVMValueRef LLVMBuildAddrSpaceCast(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1129 } 1130 LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1131 LLVMValueRef LLVMBuildSExtOrBitCast(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1132 LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1133 LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1134 LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1135 LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1136 LLVMValueRef LLVMBuildFPCast(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const(char)* Name); 1137 LLVMValueRef LLVMBuildICmp(LLVMBuilderRef, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1138 LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef, LLVMRealPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1139 LLVMValueRef LLVMBuildPhi(LLVMBuilderRef, LLVMTypeRef Ty, const(char)* Name); 1140 LLVMValueRef LLVMBuildCall(LLVMBuilderRef, LLVMValueRef Fn, LLVMValueRef* Args, uint NumArgs, const(char)* Name); 1141 LLVMValueRef LLVMBuildSelect(LLVMBuilderRef, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, const(char)* Name); 1142 LLVMValueRef LLVMBuildVAArg(LLVMBuilderRef, LLVMValueRef List, LLVMTypeRef Ty, const(char)* Name); 1143 LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef, LLVMValueRef VecVal, LLVMValueRef Index, const(char)* Name); 1144 LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, const(char)* Name); 1145 LLVMValueRef LLVMBuildShuffleVector(LLVMBuilderRef, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, const(char)* Name); 1146 LLVMValueRef LLVMBuildExtractValue(LLVMBuilderRef, LLVMValueRef AggVal, uint Index, const(char)* Name); 1147 LLVMValueRef LLVMBuildInsertValue(LLVMBuilderRef, LLVMValueRef AggVal, LLVMValueRef EltVal, uint Index, const(char)* Name); 1148 LLVMValueRef LLVMBuildIsNull(LLVMBuilderRef, LLVMValueRef Val, const(char)* Name); 1149 LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef, LLVMValueRef Val, const(char)* Name); 1150 LLVMValueRef LLVMBuildPtrDiff(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const(char)* Name); 1151 static if (LLVM_Version >= asVersion(3, 3, 0)) { 1152 LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, LLVMBool singleThread); 1153 } 1154 1155 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1156 LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, LLVMBool SingleThread); 1157 } 1158 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1159 LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst); 1160 } 1161 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1162 void LLVMSetAtomicSingleThread(LLVMValueRef AtomicInst, LLVMBool SingleThread); 1163 } 1164 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1165 LLVMAtomicOrdering LLVMGetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst); 1166 } 1167 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1168 void LLVMSetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering); 1169 } 1170 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1171 LLVMAtomicOrdering LLVMGetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst); 1172 } 1173 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1174 void LLVMSetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering); 1175 } 1176 1177 static if (LLVM_Version >= asVersion(3, 5, 0)) { 1178 LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering ordering, LLVMBool singleThread, const(char)*Name); 1179 } 1180 1181 /++ Module Providers ++/ 1182 1183 LLVMModuleProviderRef LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M); 1184 void LLVMDisposeModuleProvider(LLVMModuleProviderRef M); 1185 1186 /++ Memory Buffers ++/ 1187 1188 LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const(char)* Path, LLVMMemoryBufferRef* OutMemBuf, char** OutMessage); 1189 LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef* OutMemBuf, char** OutMessage); 1190 static if (LLVM_Version >= asVersion(3, 3, 0)) { 1191 LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange(const(char)* InputData, size_t InputDataLength, const(char)* BufferName, LLVMBool RequiresNullTerminator); 1192 } 1193 static if (LLVM_Version >= asVersion(3, 3, 0)) { 1194 LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const(char)* InputData, size_t InputDataLength, const(char)* BufferName); 1195 } 1196 static if (LLVM_Version >= asVersion(3, 3, 0)) { 1197 const(char)* LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf); 1198 } 1199 static if (LLVM_Version >= asVersion(3, 3, 0)) { 1200 size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf); 1201 } 1202 void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf); 1203 1204 /++ Pass Registry ++/ 1205 1206 LLVMPassRegistryRef LLVMGetGlobalPassRegistry(); 1207 1208 /++ Pass Managers ++/ 1209 1210 LLVMPassManagerRef LLVMCreatePassManager(); 1211 LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M); 1212 LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef MP); 1213 LLVMBool LLVMRunPassManager(LLVMPassManagerRef PM, LLVMModuleRef M); 1214 LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM); 1215 LLVMBool LLVMRunFunctionPassManager(LLVMPassManagerRef FPM, LLVMValueRef F); 1216 LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM); 1217 void LLVMDisposePassManager(LLVMPassManagerRef PM); 1218 1219 /++ Threading ++/ 1220 1221 static if (LLVM_Version >= asVersion(3, 3, 0) && LLVM_Version < asVersion(3, 5, 0)) { 1222 LLVMBool LLVMStartMultithreaded(); 1223 } 1224 static if (LLVM_Version >= asVersion(3, 3, 0) && LLVM_Version < asVersion(3, 5, 0)) { 1225 void LLVMStopMultithreaded(); 1226 } 1227 static if (LLVM_Version >= asVersion(3, 3, 0)) { 1228 LLVMBool LLVMIsMultithreaded(); 1229 } 1230 1231 /+ Disassembler +/ 1232 1233 LLVMDisasmContextRef LLVMCreateDisasm(const(char)* TripleName, void* DisInfo, int TagType, LLVMOpInfoCallback GetOpInfo, LLVMSymbolLookupCallback SymbolLookUp); 1234 static if (LLVM_Version >= asVersion(3, 3, 0)) { 1235 LLVMDisasmContextRef LLVMCreateDisasmCPU(const(char)* Triple, const(char)* CPU, void* DisInfo, int TagType, LLVMOpInfoCallback GetOpInfo, LLVMSymbolLookupCallback SymbolLookUp); 1236 } 1237 static if (LLVM_Version >= asVersion(3, 6, 0)) { 1238 LLVMDisasmContextRef LLVMCreateDisasmCPUFeatures(const(char)* Triple, const(char)* CPU, const(char)* Features, void *DisInfo, int TagType, LLVMOpInfoCallback GetOpInfo, LLVMSymbolLookupCallback SymbolLookUp); 1239 } 1240 static if (LLVM_Version >= asVersion(3, 2, 0)) { 1241 int LLVMSetDisasmOptions(LLVMDisasmContextRef DC, ulong Options); 1242 } 1243 void LLVMDisasmDispose(LLVMDisasmContextRef DC); 1244 size_t LLVMDisasmInstruction(LLVMDisasmContextRef DC, ubyte* Bytes, ulong BytesSize, ulong PC, char* OutString, size_t OutStringSize); 1245 1246 /+ Enhanced Disassembly +/ 1247 1248 static if (LLVM_Version < asVersion(3, 3, 0)) { 1249 int EDGetDisassembler(EDDisassemblerRef* disassembler, const(char)* triple, EDAssemblySyntax_t syntax); 1250 } 1251 static if (LLVM_Version < asVersion(3, 3, 0)) { 1252 int EDGetRegisterName(const(char)** regName, EDDisassemblerRef disassembler, uint regID); 1253 } 1254 static if (LLVM_Version < asVersion(3, 3, 0)) { 1255 int EDRegisterIsStackPointer(EDDisassemblerRef disassembler, uint regID); 1256 } 1257 static if (LLVM_Version < asVersion(3, 3, 0)) { 1258 int EDRegisterIsProgramCounter(EDDisassemblerRef disassembler, uint regID); 1259 } 1260 static if (LLVM_Version < asVersion(3, 3, 0)) { 1261 uint EDCreateInsts(EDInstRef* insts, uint count, EDDisassemblerRef disassembler, EDByteReaderCallback byteReader, ulong address, void* arg); 1262 } 1263 static if (LLVM_Version < asVersion(3, 3, 0)) { 1264 void EDReleaseInst(EDInstRef inst); 1265 } 1266 static if (LLVM_Version < asVersion(3, 3, 0)) { 1267 int EDInstByteSize(EDInstRef inst); 1268 } 1269 static if (LLVM_Version < asVersion(3, 3, 0)) { 1270 int EDGetInstString(const(char)** buf, EDInstRef inst); 1271 } 1272 static if (LLVM_Version < asVersion(3, 3, 0)) { 1273 int EDInstID(uint* instID, EDInstRef inst); 1274 } 1275 static if (LLVM_Version < asVersion(3, 3, 0)) { 1276 int EDInstIsBranch(EDInstRef inst); 1277 } 1278 static if (LLVM_Version < asVersion(3, 3, 0)) { 1279 int EDInstIsMove(EDInstRef inst); 1280 } 1281 static if (LLVM_Version < asVersion(3, 3, 0)) { 1282 int EDBranchTargetID(EDInstRef inst); 1283 } 1284 static if (LLVM_Version < asVersion(3, 3, 0)) { 1285 int EDMoveSourceID(EDInstRef inst); 1286 } 1287 static if (LLVM_Version < asVersion(3, 3, 0)) { 1288 int EDMoveTargetID(EDInstRef inst); 1289 } 1290 static if (LLVM_Version < asVersion(3, 3, 0)) { 1291 int EDNumTokens(EDInstRef inst); 1292 } 1293 static if (LLVM_Version < asVersion(3, 3, 0)) { 1294 int EDGetToken(EDTokenRef* token, EDInstRef inst, int index); 1295 } 1296 static if (LLVM_Version < asVersion(3, 3, 0)) { 1297 int EDGetTokenString(const(char)** buf, EDTokenRef token); 1298 } 1299 static if (LLVM_Version < asVersion(3, 3, 0)) { 1300 int EDOperandIndexForToken(EDTokenRef token); 1301 } 1302 static if (LLVM_Version < asVersion(3, 3, 0)) { 1303 int EDTokenIsWhitespace(EDTokenRef token); 1304 } 1305 static if (LLVM_Version < asVersion(3, 3, 0)) { 1306 int EDTokenIsPunctuation(EDTokenRef token); 1307 } 1308 static if (LLVM_Version < asVersion(3, 3, 0)) { 1309 int EDTokenIsOpcode(EDTokenRef token); 1310 } 1311 static if (LLVM_Version < asVersion(3, 3, 0)) { 1312 int EDTokenIsLiteral(EDTokenRef token); 1313 } 1314 static if (LLVM_Version < asVersion(3, 3, 0)) { 1315 int EDTokenIsRegister(EDTokenRef token); 1316 } 1317 static if (LLVM_Version < asVersion(3, 3, 0)) { 1318 int EDTokenIsNegativeLiteral(EDTokenRef token); 1319 } 1320 static if (LLVM_Version < asVersion(3, 3, 0)) { 1321 int EDLiteralTokenAbsoluteValue(ulong* value, EDTokenRef token); 1322 } 1323 static if (LLVM_Version < asVersion(3, 3, 0)) { 1324 int EDRegisterTokenValue(uint* registerID, EDTokenRef token); 1325 } 1326 static if (LLVM_Version < asVersion(3, 3, 0)) { 1327 int EDNumOperands(EDInstRef inst); 1328 } 1329 static if (LLVM_Version < asVersion(3, 3, 0)) { 1330 int EDGetOperand(EDOperandRef* operand, EDInstRef inst, int index); 1331 } 1332 static if (LLVM_Version < asVersion(3, 3, 0)) { 1333 int EDOperandIsRegister(EDOperandRef operand); 1334 } 1335 static if (LLVM_Version < asVersion(3, 3, 0)) { 1336 int EDOperandIsImmediate(EDOperandRef operand); 1337 } 1338 static if (LLVM_Version < asVersion(3, 3, 0)) { 1339 int EDOperandIsMemory(EDOperandRef operand); 1340 } 1341 static if (LLVM_Version < asVersion(3, 3, 0)) { 1342 int EDRegisterOperandValue(uint* value, EDOperandRef operand); 1343 } 1344 static if (LLVM_Version < asVersion(3, 3, 0)) { 1345 int EDImmediateOperandValue(ulong* value, EDOperandRef operand); 1346 } 1347 static if (LLVM_Version < asVersion(3, 3, 0)) { 1348 int EDEvaluateOperand(ulong* result, EDOperandRef operand, EDRegisterReaderCallback regReader, void* arg); 1349 } 1350 static if (LLVM_Version < asVersion(3, 3, 0)) { 1351 uint EDBlockCreateInsts(EDInstRef* insts, int count, EDDisassemblerRef disassembler, EDByteBlock_t byteBlock, ulong address); 1352 } 1353 static if (LLVM_Version < asVersion(3, 3, 0)) { 1354 int EDBlockEvaluateOperand(ulong* result, EDOperandRef operand, EDRegisterBlock_t regBlock); 1355 } 1356 static if (LLVM_Version < asVersion(3, 3, 0)) { 1357 int EDBlockVisitTokens(EDInstRef inst, EDTokenVisitor_t visitor); 1358 } 1359 1360 /+ Execution Engine +/ 1361 1362 LLVMGenericValueRef LLVMCreateGenericValueOfInt(LLVMTypeRef Ty, ulong N, LLVMBool IsSigned); 1363 LLVMGenericValueRef LLVMCreateGenericValueOfPointer(void* P); 1364 LLVMGenericValueRef LLVMCreateGenericValueOfFloat(LLVMTypeRef Ty, double N); 1365 uint LLVMGenericValueIntWidth(LLVMGenericValueRef GenValRef); 1366 ulong LLVMGenericValueToInt(LLVMGenericValueRef GenVal, LLVMBool IsSigned); 1367 void* LLVMGenericValueToPointer(LLVMGenericValueRef GenVal); 1368 double LLVMGenericValueToFloat(LLVMTypeRef TyRef, LLVMGenericValueRef GenVal); 1369 void LLVMDisposeGenericValue(LLVMGenericValueRef GenVal); 1370 LLVMBool LLVMCreateExecutionEngineForModule(LLVMExecutionEngineRef* OutEE, LLVMModuleRef M, char** OutError); 1371 LLVMBool LLVMCreateInterpreterForModule(LLVMExecutionEngineRef* OutInterp, LLVMModuleRef M, char** OutError); 1372 LLVMBool LLVMCreateJITCompilerForModule(LLVMExecutionEngineRef* OutJIT, LLVMModuleRef M, uint OptLevel, char** OutError); 1373 static if (LLVM_Version >= asVersion(3, 3, 0)) { 1374 void LLVMInitializeMCJITCompilerOptions(LLVMMCJITCompilerOptions* Options, size_t SizeOfOptions); 1375 } 1376 static if (LLVM_Version >= asVersion(3, 3, 0)) { 1377 LLVMBool LLVMCreateMCJITCompilerForModule(LLVMExecutionEngineRef* OutJIT, LLVMModuleRef M, LLVMMCJITCompilerOptions* Options, size_t SizeOfOptions, char** OutError); 1378 } 1379 static if (LLVM_Version < asVersion(3, 8, 0)) { 1380 LLVMBool LLVMCreateExecutionEngine(LLVMExecutionEngineRef* OutEE, LLVMModuleProviderRef MP, char** OutError); 1381 } 1382 static if (LLVM_Version < asVersion(3, 8, 0)) { 1383 LLVMBool LLVMCreateInterpreter(LLVMExecutionEngineRef* OutInterp, LLVMModuleProviderRef MP, char** OutError); 1384 } 1385 static if (LLVM_Version < asVersion(3, 8, 0)) { 1386 LLVMBool LLVMCreateJITCompiler(LLVMExecutionEngineRef* OutJIT, LLVMModuleProviderRef MP, uint OptLevel, char** OutError); 1387 } 1388 void LLVMDisposeExecutionEngine(LLVMExecutionEngineRef EE); 1389 void LLVMRunStaticConstructors(LLVMExecutionEngineRef EE); 1390 void LLVMRunStaticDestructors(LLVMExecutionEngineRef EE); 1391 int LLVMRunFunctionAsMain(LLVMExecutionEngineRef EE, LLVMValueRef F, uint ArgC, const(char*)* ArgV, const(char*)* EnvP); 1392 LLVMGenericValueRef LLVMRunFunction(LLVMExecutionEngineRef EE, LLVMValueRef F, uint NumArgs, LLVMGenericValueRef* Args); 1393 void LLVMFreeMachineCodeForFunction(LLVMExecutionEngineRef EE, LLVMValueRef F); 1394 void LLVMAddModule(LLVMExecutionEngineRef EE, LLVMModuleRef M); 1395 static if (LLVM_Version < asVersion(3, 8, 0)) { 1396 void LLVMAddModuleProvider(LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP); 1397 } 1398 LLVMBool LLVMRemoveModule(LLVMExecutionEngineRef EE, LLVMModuleRef M, LLVMModuleRef* OutMod, char** OutError); 1399 static if (LLVM_Version < asVersion(3, 8, 0)) { 1400 LLVMBool LLVMRemoveModuleProvider(LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP, LLVMModuleRef* OutMod, char** OutError); 1401 } 1402 LLVMBool LLVMFindFunction(LLVMExecutionEngineRef EE, const(char)* Name, LLVMValueRef* OutFn); 1403 void* LLVMRecompileAndRelinkFunction(LLVMExecutionEngineRef EE, LLVMValueRef Fn); 1404 LLVMTargetDataRef LLVMGetExecutionEngineTargetData(LLVMExecutionEngineRef EE); 1405 static if (LLVM_Version >= asVersion(3, 5, 0)) { 1406 LLVMTargetMachineRef LLVMGetExecutionEngineTargetMachine(LLVMExecutionEngineRef EE); 1407 } 1408 void LLVMAddGlobalMapping(LLVMExecutionEngineRef EE, LLVMValueRef Global, void* Addr); 1409 void* LLVMGetPointerToGlobal(LLVMExecutionEngineRef EE, LLVMValueRef Global); 1410 static if (LLVM_Version >= asVersion(3, 6, 0)) { 1411 ulong LLVMGetGlobalValueAddress(LLVMExecutionEngineRef EE, const(char)*Name); 1412 } 1413 static if (LLVM_Version >= asVersion(3, 6, 0)) { 1414 ulong LLVMGetFunctionAddress(LLVMExecutionEngineRef EE, const(char)*Name); 1415 } 1416 static if (LLVM_Version >= asVersion(3, 4, 0)) { 1417 LLVMMCJITMemoryManagerRef LLVMCreateSimpleMCJITMemoryManager(void* Opaque, LLVMMemoryManagerAllocateCodeSectionCallback AllocateCodeSection, LLVMMemoryManagerAllocateDataSectionCallback AllocateDataSection, LLVMMemoryManagerFinalizeMemoryCallback FinalizeMemory, LLVMMemoryManagerDestroyCallback Destroy); 1418 } 1419 static if (LLVM_Version >= asVersion(3, 4, 0)) { 1420 void LLVMDisposeMCJITMemoryManager(LLVMMCJITMemoryManagerRef MM); 1421 } 1422 1423 /+ Initialization Routines +/ 1424 1425 void LLVMInitializeCore(LLVMPassRegistryRef R); 1426 void LLVMInitializeTransformUtils(LLVMPassRegistryRef R); 1427 void LLVMInitializeScalarOpts(LLVMPassRegistryRef R); 1428 static if (LLVM_Version >= asVersion(3, 3, 0)) { 1429 void LLVMInitializeObjCARCOpts(LLVMPassRegistryRef R); 1430 } 1431 void LLVMInitializeVectorization(LLVMPassRegistryRef R); 1432 void LLVMInitializeInstCombine(LLVMPassRegistryRef R); 1433 void LLVMInitializeIPO(LLVMPassRegistryRef R); 1434 void LLVMInitializeInstrumentation(LLVMPassRegistryRef R); 1435 void LLVMInitializeAnalysis(LLVMPassRegistryRef R); 1436 void LLVMInitializeIPA(LLVMPassRegistryRef R); 1437 void LLVMInitializeCodeGen(LLVMPassRegistryRef R); 1438 void LLVMInitializeTarget(LLVMPassRegistryRef R); 1439 1440 /+ Linker +/ 1441 1442 static if (LLVM_Version >= asVersion(3, 2, 0) && LLVM_Version < asVersion(3, 9, 0)) { 1443 LLVMBool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src, LLVMLinkerMode Mode, char** OutMessage); 1444 } 1445 static if (LLVM_Version >= asVersion(3, 8, 0)) { 1446 LLVMBool LLVMLinkModules2(LLVMModuleRef Dest, LLVMModuleRef Src); 1447 } 1448 1449 /+ Link Time Optimization +/ 1450 1451 llvm_lto_t llvm_create_optimizer(); 1452 void llvm_destroy_optimizer(llvm_lto_t lto); 1453 llvm_lto_status_t llvm_read_object_file(llvm_lto_t lto, const(char)* input_filename); 1454 llvm_lto_status_t llvm_optimize_modules(llvm_lto_t lto, const(char)* output_filename); 1455 1456 /+ LTO +/ 1457 1458 const(char)* lto_get_version(); 1459 const(char)* lto_get_error_message(); 1460 bool lto_module_is_object_file(const(char)* path); 1461 bool lto_module_is_object_file_for_target(const(char)* path, const(char)* target_triple_prefix); 1462 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1463 lto_bool_t lto_module_has_objc_category(const(void)* mem, size_t length); 1464 } 1465 bool lto_module_is_object_file_in_memory(const(void)* mem, size_t length); 1466 bool lto_module_is_object_file_in_memory_for_target(const(void)* mem, size_t length, const(char)* target_triple_prefix); 1467 lto_module_t lto_module_create(const(char)* path); 1468 lto_module_t lto_module_create_from_memory(const(void)* mem, size_t length); 1469 static if (LLVM_Version >= asVersion(3, 5, 0)) { 1470 lto_module_t lto_module_create_from_memory_with_path(const(void)* mem, size_t length, const(char)*path); 1471 } 1472 1473 static if (LLVM_Version >= asVersion(3, 6, 0)) { 1474 lto_module_t lto_module_create_in_local_context(const void *mem, size_t length, const(char)*path); 1475 } 1476 static if (LLVM_Version >= asVersion(3, 6, 0)) { 1477 lto_module_t lto_module_create_in_codegen_context(const void *mem, size_t length, const(char)*path, lto_code_gen_t cg); 1478 } 1479 lto_module_t lto_module_create_from_fd(int fd, const(char)* path, size_t file_size); 1480 lto_module_t lto_module_create_from_fd_at_offset(int fd, const(char)* path, size_t file_size, size_t map_size, size_t offset); 1481 void lto_module_dispose(lto_module_t mod); 1482 const(char)* lto_module_get_target_triple(lto_module_t mod); 1483 void lto_module_set_target_triple(lto_module_t mod, const(char)* triple); 1484 uint lto_module_get_num_symbols(lto_module_t mod); 1485 const(char)* lto_module_get_symbol_name(lto_module_t mod, uint index); 1486 lto_symbol_attributes lto_module_get_symbol_attribute(lto_module_t mod, uint index); 1487 static if (LLVM_Version >= asVersion(3, 5, 0) && LLVM_Version < asVersion(3, 7, 0)) { 1488 uint lto_module_get_num_deplibs(lto_module_t mod); 1489 } 1490 static if (LLVM_Version >= asVersion(3, 5, 0) && LLVM_Version < asVersion(3, 7, 0)) { 1491 const(char)* lto_module_get_deplib(lto_module_t mod, uint index); 1492 } 1493 static if (LLVM_Version >= asVersion(3, 5, 0) && LLVM_Version < asVersion(3, 7, 0)) { 1494 uint lto_module_get_num_linkeropts(lto_module_t mod); 1495 } 1496 static if (LLVM_Version >= asVersion(3, 5, 0) && LLVM_Version < asVersion(3, 7, 0)) { 1497 const(char)* lto_module_get_linkeropt(lto_module_t mod, uint index); 1498 } 1499 static if (LLVM_Version >= asVersion(3, 7, 0)) { 1500 const(char)* lto_module_get_linkeropts(lto_module_t mod); 1501 } 1502 static if (LLVM_Version >= asVersion(3, 5, 0)) { 1503 void lto_codegen_set_diagnostic_handler(lto_code_gen_t, lto_diagnostic_handler_t, void *); 1504 } 1505 lto_code_gen_t lto_codegen_create(); 1506 static if (LLVM_Version >= asVersion(3, 6, 0)) { 1507 lto_code_gen_t lto_codegen_create_in_local_context(); 1508 } 1509 void lto_codegen_dispose(lto_code_gen_t); 1510 bool lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod); 1511 bool lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model); 1512 bool lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model); 1513 void lto_codegen_set_cpu(lto_code_gen_t cg, const(char)* cpu); 1514 void lto_codegen_set_assembler_path(lto_code_gen_t cg, const(char)* path); 1515 void lto_codegen_set_assembler_args(lto_code_gen_t cg, const(char)** args, int nargs); 1516 void lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg, const(char)* symbol); 1517 bool lto_codegen_write_merged_modules(lto_code_gen_t cg, const(char)* path); 1518 const(void)* lto_codegen_compile(lto_code_gen_t cg, size_t* length); 1519 bool lto_codegen_compile_to_file(lto_code_gen_t cg, const(char)** name); 1520 static if (LLVM_Version >= asVersion(3, 7, 0)) { 1521 bool lto_codegen_optimize(lto_code_gen_t cg); 1522 } 1523 static if (LLVM_Version >= asVersion(3, 7, 0)) { 1524 const(void)* lto_codegen_compile_optimized(lto_code_gen_t cg, size_t* length); 1525 } 1526 static if (LLVM_Version >= asVersion(3, 7, 0)) { 1527 uint lto_api_version(); 1528 } 1529 void lto_codegen_debug_options(lto_code_gen_t cg, const(char)* ); 1530 static if (LLVM_Version >= asVersion(3, 3, 0)) { 1531 void lto_initialize_disassembler(); 1532 } 1533 static if (LLVM_Version >= asVersion(3, 7, 0)) { 1534 void lto_codegen_set_should_internalize(lto_code_gen_t cg, bool ShouldInternalize); 1535 } 1536 static if (LLVM_Version >= asVersion(3, 7, 0)) { 1537 void lto_codegen_set_should_embed_uselists(lto_code_gen_t cg, bool ShouldEmbedUselists); 1538 } 1539 1540 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1541 thinlto_code_gen_t thinlto_create_codegen(); 1542 } 1543 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1544 void thinlto_codegen_dispose(thinlto_code_gen_t cg); 1545 } 1546 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1547 void thinlto_codegen_add_module(thinlto_code_gen_t cg, const(char)* identifier, const(char)* data, int length); 1548 } 1549 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1550 void thinlto_codegen_process(thinlto_code_gen_t cg); 1551 } 1552 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1553 uint thinlto_module_get_num_objects(thinlto_code_gen_t cg); 1554 } 1555 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1556 LTOObjectBuffer thinlto_module_get_object(thinlto_code_gen_t cg, uint index); 1557 } 1558 static if (LLVM_Version >= asVersion(4, 0, 0)) { 1559 uint thinlto_module_get_num_object_files(thinlto_code_gen_t cg); 1560 const(char)* thinlto_module_get_object_file(thinlto_code_gen_t cg, uint index); 1561 } 1562 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1563 lto_bool_t thinlto_codegen_set_pic_model(thinlto_code_gen_t cg, lto_codegen_model); 1564 } 1565 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1566 void thinlto_codegen_set_cache_dir(thinlto_code_gen_t cg, const(char)* cache_dir); 1567 } 1568 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1569 void thinlto_codegen_set_cache_pruning_interval(thinlto_code_gen_t cg, int interval); 1570 } 1571 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1572 void thinlto_codegen_set_final_cache_size_relative_to_available_space(thinlto_code_gen_t cg, uint percentage); 1573 } 1574 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1575 void thinlto_codegen_set_cache_entry_expiration(thinlto_code_gen_t cg, uint expiration); 1576 } 1577 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1578 void thinlto_codegen_set_savetemps_dir(thinlto_code_gen_t cg, const(char)* save_temps_dir); 1579 } 1580 static if (LLVM_Version >= asVersion(4, 0, 0)) { 1581 void thinlto_set_generated_objects_dir(thinlto_code_gen_t cg, const(char)* save_temps_dir); 1582 } 1583 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1584 void thinlto_codegen_set_cpu(thinlto_code_gen_t cg, const(char)* cpu); 1585 } 1586 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1587 void thinlto_codegen_disable_codegen(thinlto_code_gen_t cg, lto_bool_t disable); 1588 } 1589 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1590 void thinlto_codegen_set_codegen_only(thinlto_code_gen_t cg, lto_bool_t codegen_only); 1591 } 1592 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1593 void thinlto_debug_options(const(char*) *options, int number); 1594 } 1595 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1596 lto_bool_t lto_module_is_thinlto(lto_module_t mod); 1597 } 1598 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1599 void thinlto_codegen_add_must_preserve_symbol(thinlto_code_gen_t cg, const(char)* name, int length); 1600 } 1601 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1602 void thinlto_codegen_add_cross_referenced_symbol(thinlto_code_gen_t cg, const(char)* name, int length); 1603 } 1604 /+ Object file reading and writing +/ 1605 1606 LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf); 1607 void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile); 1608 LLVMSectionIteratorRef LLVMGetSections(LLVMObjectFileRef ObjectFile); 1609 void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI); 1610 LLVMBool LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef ObjectFile, LLVMSectionIteratorRef SI); 1611 void LLVMMoveToNextSection(LLVMSectionIteratorRef SI); 1612 void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect, LLVMSymbolIteratorRef Sym); 1613 LLVMSymbolIteratorRef LLVMGetSymbols(LLVMObjectFileRef ObjectFile); 1614 void LLVMDisposeSymbolIterator(LLVMSymbolIteratorRef SI); 1615 LLVMBool LLVMIsSymbolIteratorAtEnd(LLVMObjectFileRef ObjectFile, LLVMSymbolIteratorRef SI); 1616 void LLVMMoveToNextSymbol(LLVMSymbolIteratorRef SI); 1617 const(char)* LLVMGetSectionName(LLVMSectionIteratorRef SI); 1618 ulong LLVMGetSectionSize(LLVMSectionIteratorRef SI); 1619 const(char)* LLVMGetSectionContents(LLVMSectionIteratorRef SI); 1620 ulong LLVMGetSectionAddress(LLVMSectionIteratorRef SI); 1621 LLVMBool LLVMGetSectionContainsSymbol(LLVMSectionIteratorRef SI, LLVMSymbolIteratorRef Sym); 1622 LLVMRelocationIteratorRef LLVMGetRelocations(LLVMSectionIteratorRef Section); 1623 void LLVMDisposeRelocationIterator(LLVMRelocationIteratorRef RI); 1624 LLVMBool LLVMIsRelocationIteratorAtEnd(LLVMSectionIteratorRef Section, LLVMRelocationIteratorRef RI); 1625 void LLVMMoveToNextRelocation(LLVMRelocationIteratorRef RI); 1626 const(char)* LLVMGetSymbolName(LLVMSymbolIteratorRef SI); 1627 ulong LLVMGetSymbolAddress(LLVMSymbolIteratorRef SI); 1628 static if (LLVM_Version < asVersion(3, 5, 0)) { 1629 ulong LLVMGetSymbolFileOffset(LLVMSymbolIteratorRef SI); 1630 } 1631 ulong LLVMGetSymbolSize(LLVMSymbolIteratorRef SI); 1632 static if (LLVM_Version < asVersion(3, 7, 0)) { 1633 ulong LLVMGetRelocationAddress(LLVMRelocationIteratorRef RI); 1634 } 1635 ulong LLVMGetRelocationOffset(LLVMRelocationIteratorRef RI); 1636 LLVMSymbolIteratorRef LLVMGetRelocationSymbol(LLVMRelocationIteratorRef RI); 1637 ulong LLVMGetRelocationType(LLVMRelocationIteratorRef RI); 1638 const(char)* LLVMGetRelocationTypeName(LLVMRelocationIteratorRef RI); 1639 const(char)* LLVMGetRelocationValueString(LLVMRelocationIteratorRef RI); 1640 1641 /+ Target information +/ 1642 1643 mixin(LLVM_Targets.map!(t => "nothrow void LLVMInitialize" ~ t ~ "TargetInfo();").joiner.array.orEmpty); 1644 mixin(LLVM_Targets.map!(t => "nothrow void LLVMInitialize" ~ t ~ "Target();").joiner.array.orEmpty); 1645 mixin(LLVM_Targets.map!(t => "nothrow void LLVMInitialize" ~ t ~ "TargetMC();").joiner.array.orEmpty); 1646 mixin(LLVM_AsmPrinters.map!(t => "nothrow void LLVMInitialize" ~ t ~ "AsmPrinter();").joiner.array.orEmpty); 1647 mixin(LLVM_AsmParsers.map!(t => "nothrow void LLVMInitialize" ~ t ~ "AsmParser();").joiner.array.orEmpty); 1648 mixin(LLVM_Disassemblers.map!(t => "nothrow void LLVMInitialize" ~ t ~ "Disassembler();").joiner.array.orEmpty); 1649 1650 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1651 LLVMTargetDataRef LLVMGetModuleDataLayout(LLVMModuleRef M); 1652 } 1653 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1654 void LLVMSetModuleDataLayout(LLVMModuleRef M, LLVMTargetDataRef DL); 1655 } 1656 LLVMTargetDataRef LLVMCreateTargetData(const(char)* StringRep); 1657 static if (LLVM_Version < asVersion(3, 9, 0)) { 1658 void LLVMAddTargetData(LLVMTargetDataRef TD, LLVMPassManagerRef PM); 1659 } 1660 void LLVMAddTargetLibraryInfo(LLVMTargetLibraryInfoRef TLI, LLVMPassManagerRef PM); 1661 char* LLVMCopyStringRepOfTargetData(LLVMTargetDataRef TD); 1662 LLVMByteOrdering LLVMByteOrder(LLVMTargetDataRef TD); 1663 uint LLVMPointerSize(LLVMTargetDataRef TD); 1664 static if (LLVM_Version >= asVersion(3, 2, 0)) { 1665 uint LLVMPointerSizeForAS(LLVMTargetDataRef TD, uint AS); 1666 } 1667 LLVMTypeRef LLVMIntPtrType(LLVMTargetDataRef TD); 1668 static if (LLVM_Version >= asVersion(3, 2, 0)) { 1669 LLVMTypeRef LLVMIntPtrTypeForAS(LLVMTargetDataRef TD, uint AS); 1670 } 1671 static if (LLVM_Version >= asVersion(3, 4, 0)) { 1672 LLVMTypeRef LLVMIntPtrTypeInContext(LLVMContextRef C, LLVMTargetDataRef TD); 1673 } 1674 static if (LLVM_Version >= asVersion(3, 4, 0)) { 1675 LLVMTypeRef LLVMIntPtrTypeForASInContext(LLVMContextRef C, LLVMTargetDataRef TD, uint AS); 1676 } 1677 ulong LLVMSizeOfTypeInBits(LLVMTargetDataRef TD, LLVMTypeRef Ty); 1678 ulong LLVMStoreSizeOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty); 1679 ulong LLVMABISizeOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty); 1680 uint LLVMABIAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty); 1681 uint LLVMCallFrameAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty); 1682 uint LLVMPreferredAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty); 1683 uint LLVMPreferredAlignmentOfGlobal(LLVMTargetDataRef TD, LLVMValueRef GlobalVar); 1684 uint LLVMElementAtOffset(LLVMTargetDataRef TD, LLVMTypeRef StructTy, ulong Offset); 1685 ulong LLVMOffsetOfElement(LLVMTargetDataRef TD, LLVMTypeRef StructTy, uint Element); 1686 void LLVMDisposeTargetData(LLVMTargetDataRef TD); 1687 1688 /+ Target machine +/ 1689 1690 LLVMTargetRef LLVMGetFirstTarget(); 1691 LLVMTargetRef LLVMGetNextTarget(LLVMTargetRef T); 1692 static if (LLVM_Version >= asVersion(3, 4, 0)) { 1693 LLVMTargetRef LLVMGetTargetFromName(const(char)* Name); 1694 } 1695 static if (LLVM_Version >= asVersion(3, 4, 0)) { 1696 LLVMBool LLVMGetTargetFromTriple(const(char)* Triple, LLVMTargetRef* T, char** ErrorMessage); 1697 } 1698 const(char)* LLVMGetTargetName(LLVMTargetRef T); 1699 const(char)* LLVMGetTargetDescription(LLVMTargetRef T); 1700 LLVMBool LLVMTargetHasJIT(LLVMTargetRef T); 1701 LLVMBool LLVMTargetHasTargetMachine(LLVMTargetRef T); 1702 LLVMBool LLVMTargetHasAsmBackend(LLVMTargetRef T); 1703 LLVMTargetMachineRef LLVMCreateTargetMachine(LLVMTargetRef T, const(char)* Triple, const(char)* CPU, const(char)* Features, LLVMCodeGenOptLevel Level, LLVMRelocMode Reloc, LLVMCodeModel CodeModel); 1704 void LLVMDisposeTargetMachine(LLVMTargetMachineRef T); 1705 LLVMTargetRef LLVMGetTargetMachineTarget(LLVMTargetMachineRef T); 1706 char* LLVMGetTargetMachineTriple(LLVMTargetMachineRef T); 1707 char* LLVMGetTargetMachineCPU(LLVMTargetMachineRef T); 1708 char* LLVMGetTargetMachineFeatureString(LLVMTargetMachineRef T); 1709 static if (LLVM_Version < asVersion(3, 7, 0)) { 1710 LLVMTargetDataRef LLVMGetTargetMachineData(LLVMTargetMachineRef T); 1711 } 1712 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1713 LLVMTargetDataRef LLVMCreateTargetDataLayout(LLVMTargetMachineRef T); 1714 } 1715 static if (LLVM_Version >= asVersion(3, 4, 0)) { 1716 void LLVMSetTargetMachineAsmVerbosity(LLVMTargetMachineRef T, LLVMBool VerboseAsm); 1717 } 1718 LLVMBool LLVMTargetMachineEmitToFile(LLVMTargetMachineRef T, LLVMModuleRef M, char* Filename, LLVMCodeGenFileType codegen, char** ErrorMessage); 1719 static if (LLVM_Version >= asVersion(3, 3, 0)) { 1720 LLVMBool LLVMTargetMachineEmitToMemoryBuffer(LLVMTargetMachineRef T, LLVMModuleRef M, LLVMCodeGenFileType codegen, char** ErrorMessage, LLVMMemoryBufferRef* OutMemBuf); 1721 } 1722 static if (LLVM_Version >= asVersion(3, 4, 0)) { 1723 char* LLVMGetDefaultTargetTriple(); 1724 } 1725 static if (LLVM_Version >= asVersion(3, 5, 0)) { 1726 void LLVMAddAnalysisPasses(LLVMTargetMachineRef T, LLVMPassManagerRef PM); 1727 } 1728 1729 /+ Support +/ 1730 static if (LLVM_Version >= asVersion(3, 4, 0)) { 1731 LLVMBool LLVMLoadLibraryPermanently(const(char)* Filename); 1732 } 1733 static if (LLVM_Version >= asVersion(3, 6, 0)) { 1734 void LLVMParseCommandLineOptions(int argc, const(char*)* argv, const(char)* Overview); 1735 } 1736 static if (LLVM_Version >= asVersion(3, 7, 0)) { 1737 void* LLVMSearchForAddressOfSymbol(const(char)* symbolName); 1738 } 1739 static if (LLVM_Version >= asVersion(3, 7, 0)) { 1740 void LLVMAddSymbol(const(char) *symbolName, void *symbolValue); 1741 } 1742 1743 /+ IRReader +/ 1744 static if (LLVM_Version >= asVersion(3, 4, 0)) { 1745 LLVMBool LLVMParseIRInContext(LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, LLVMModuleRef* OutM, char** OutMessage); 1746 } 1747 1748 /+ JIT compilation of LLVM IR +/ 1749 static if (LLVM_Version >= asVersion(3, 8, 0)) { 1750 LLVMOrcJITStackRef LLVMOrcCreateInstance(LLVMTargetMachineRef TM); 1751 } 1752 static if (LLVM_Version >= asVersion(3, 9, 0)) { 1753 const(char)* LLVMOrcGetErrorMsg(LLVMOrcJITStackRef JITStack); 1754 } 1755 static if (LLVM_Version >= asVersion(3, 8, 0)) { 1756 void LLVMOrcGetMangledSymbol(LLVMOrcJITStackRef JITStack, char** MangledSymbol, const(char)* Symbol); 1757 } 1758 static if (LLVM_Version >= asVersion(3, 8, 0)) { 1759 void LLVMOrcDisposeMangledSymbol(char* MangledSymbol); 1760 } 1761 static if (LLVM_Version >= asVersion(3, 8, 0)) { 1762 LLVMOrcTargetAddress LLVMOrcCreateLazyCompileCallback(LLVMOrcJITStackRef JITStack, LLVMOrcLazyCompileCallbackFn Callback, void* CallbackCtx); 1763 } 1764 static if (LLVM_Version >= asVersion(3, 8, 0)) { 1765 void LLVMOrcCreateIndirectStub(LLVMOrcJITStackRef JITStack, const(char)* StubName, LLVMOrcTargetAddress InitAddr); 1766 } 1767 static if (LLVM_Version >= asVersion(3, 8, 0)) { 1768 void LLVMOrcSetIndirectStubPointer(LLVMOrcJITStackRef JITStack, const(char)* StubName, LLVMOrcTargetAddress NewAddr); 1769 } 1770 static if (LLVM_Version >= asVersion(3, 8, 0)) { 1771 LLVMOrcModuleHandle LLVMOrcAddEagerlyCompiledIR(LLVMOrcJITStackRef JITStack, LLVMModuleRef Mod, LLVMOrcSymbolResolverFn SymbolResolver, void* SymbolResolverCtx); 1772 } 1773 static if (LLVM_Version >= asVersion(3, 8, 0)) { 1774 LLVMOrcModuleHandle LLVMOrcAddLazilyCompiledIR(LLVMOrcJITStackRef JITStack, LLVMModuleRef Mod, LLVMOrcSymbolResolverFn SymbolResolver, void* SymbolResolverCtx); 1775 } 1776 static if (LLVM_Version >= asVersion(3, 8, 0)) { 1777 LLVMOrcModuleHandle LLVMOrcAddObjectFile(LLVMOrcJITStackRef JITStack, LLVMObjectFileRef Obj, LLVMOrcSymbolResolverFn SymbolResolver, void* SymbolResolverCtx); 1778 } 1779 static if (LLVM_Version >= asVersion(3, 8, 0)) { 1780 void LLVMOrcRemoveModule(LLVMOrcJITStackRef JITStack, LLVMOrcModuleHandle H); 1781 } 1782 static if (LLVM_Version >= asVersion(3, 8, 0)) { 1783 LLVMOrcTargetAddress LLVMOrcGetSymbolAddress(LLVMOrcJITStackRef JITStack, const(char)* SymbolName); 1784 } 1785 static if (LLVM_Version >= asVersion(3, 8, 0)) { 1786 void LLVMOrcDisposeInstance(LLVMOrcJITStackRef JITStack); 1787 }