Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
Core.cpp
Go to the documentation of this file.
1//===-- Core.cpp ----------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements the common infrastructure (including the C bindings)
10// for libLLVMCore.a, which implements the LLVM intermediate representation.
11//
12//===----------------------------------------------------------------------===//
13
14#include "llvm-c/Core.h"
15#include "llvm-c/Types.h"
16#include "llvm/IR/Attributes.h"
17#include "llvm/IR/BasicBlock.h"
18#include "llvm/IR/ConstantRange.h"
19#include "llvm/IR/Constants.h"
20#include "llvm/IR/DebugInfoMetadata.h"
21#include "llvm/IR/DebugProgramInstruction.h"
22#include "llvm/IR/DerivedTypes.h"
23#include "llvm/IR/DiagnosticInfo.h"
24#include "llvm/IR/DiagnosticPrinter.h"
25#include "llvm/IR/GlobalAlias.h"
26#include "llvm/IR/GlobalVariable.h"
27#include "llvm/IR/IRBuilder.h"
28#include "llvm/IR/InlineAsm.h"
29#include "llvm/IR/Instructions.h"
30#include "llvm/IR/IntrinsicInst.h"
31#include "llvm/IR/LLVMContext.h"
32#include "llvm/IR/LegacyPassManager.h"
33#include "llvm/IR/Module.h"
34#include "llvm/InitializePasses.h"
35#include "llvm/PassRegistry.h"
36#include "llvm/Support/Debug.h"
37#include "llvm/Support/ErrorHandling.h"
38#include "llvm/Support/FileSystem.h"
39#include "llvm/Support/ManagedStatic.h"
40#include "llvm/Support/MathExtras.h"
41#include "llvm/Support/MemoryBuffer.h"
42#include "llvm/Support/Threading.h"
43#include "llvm/Support/raw_ostream.h"
44#include <cassert>
45#include <cstdlib>
46#include <cstring>
47#include <system_error>
48
49using namespacellvm;
50
51DEFINE_SIMPLE_CONVERSION_FUNCTIONS(OperandBundleDef,LLVMOperandBundleRef)
52
53inlineBasicBlock **unwrap(LLVMBasicBlockRef *BBs) {
54returnreinterpret_cast<BasicBlock **>(BBs);
55}
56
57#define DEBUG_TYPE "ir"
58
59voidllvm::initializeCore(PassRegistry &Registry) {
60initializeDominatorTreeWrapperPassPass(Registry);
61initializePrintModulePassWrapperPass(Registry);
62initializePrintFunctionPassWrapperPass(Registry);
63initializeSafepointIRVerifierPass(Registry);
64initializeVerifierLegacyPassPass(Registry);
65}
66
67voidLLVMShutdown() {
68llvm_shutdown();
69}
70
71/*===-- Version query -----------------------------------------------------===*/
72
73voidLLVMGetVersion(unsigned *Major,unsigned *Minor,unsigned *Patch) {
74if (Major)
75 *Major = LLVM_VERSION_MAJOR;
76if (Minor)
77 *Minor = LLVM_VERSION_MINOR;
78if (Patch)
79 *Patch = LLVM_VERSION_PATCH;
80}
81
82/*===-- Error handling ----------------------------------------------------===*/
83
84char *LLVMCreateMessage(constchar *Message) {
85return strdup(Message);
86}
87
88voidLLVMDisposeMessage(char *Message) {
89 free(Message);
90}
91
92
93/*===-- Operations on contexts --------------------------------------------===*/
94
95staticLLVMContext &getGlobalContext() {
96staticLLVMContext GlobalContext;
97return GlobalContext;
98}
99
100LLVMContextRefLLVMContextCreate() {
101returnwrap(newLLVMContext());
102}
103
104LLVMContextRefLLVMGetGlobalContext() {returnwrap(&getGlobalContext()); }
105
106voidLLVMContextSetDiagnosticHandler(LLVMContextRefC,
107LLVMDiagnosticHandler Handler,
108void *DiagnosticContext) {
109unwrap(C)->setDiagnosticHandlerCallBack(
110LLVM_EXTENSIONreinterpret_cast<DiagnosticHandler::DiagnosticHandlerTy>(
111 Handler),
112 DiagnosticContext);
113}
114
115LLVMDiagnosticHandlerLLVMContextGetDiagnosticHandler(LLVMContextRefC) {
116returnLLVM_EXTENSIONreinterpret_cast<LLVMDiagnosticHandler>(
117unwrap(C)->getDiagnosticHandlerCallBack());
118}
119
120void *LLVMContextGetDiagnosticContext(LLVMContextRefC) {
121returnunwrap(C)->getDiagnosticContext();
122}
123
124voidLLVMContextSetYieldCallback(LLVMContextRefC,LLVMYieldCallback Callback,
125void *OpaqueHandle) {
126auto YieldCallback =
127LLVM_EXTENSIONreinterpret_cast<LLVMContext::YieldCallbackTy>(Callback);
128unwrap(C)->setYieldCallback(YieldCallback, OpaqueHandle);
129}
130
131LLVMBoolLLVMContextShouldDiscardValueNames(LLVMContextRefC) {
132returnunwrap(C)->shouldDiscardValueNames();
133}
134
135voidLLVMContextSetDiscardValueNames(LLVMContextRefC,LLVMBool Discard) {
136unwrap(C)->setDiscardValueNames(Discard);
137}
138
139voidLLVMContextDispose(LLVMContextRefC) {
140deleteunwrap(C);
141}
142
143unsignedLLVMGetMDKindIDInContext(LLVMContextRefC,constchar *Name,
144unsigned SLen) {
145returnunwrap(C)->getMDKindID(StringRef(Name, SLen));
146}
147
148unsignedLLVMGetMDKindID(constchar *Name,unsigned SLen) {
149returnLLVMGetMDKindIDInContext(LLVMGetGlobalContext(),Name, SLen);
150}
151
152unsignedLLVMGetSyncScopeID(LLVMContextRefC,constchar *Name,size_t SLen) {
153returnunwrap(C)->getOrInsertSyncScopeID(StringRef(Name, SLen));
154}
155
156unsignedLLVMGetEnumAttributeKindForName(constchar *Name,size_t SLen) {
157returnAttribute::getAttrKindFromName(StringRef(Name, SLen));
158}
159
160unsignedLLVMGetLastEnumAttributeKind(void) {
161return Attribute::AttrKind::EndAttrKinds;
162}
163
164LLVMAttributeRefLLVMCreateEnumAttribute(LLVMContextRefC,unsigned KindID,
165uint64_t Val) {
166auto &Ctx = *unwrap(C);
167auto AttrKind = (Attribute::AttrKind)KindID;
168returnwrap(Attribute::get(Ctx, AttrKind, Val));
169}
170
171unsignedLLVMGetEnumAttributeKind(LLVMAttributeRefA) {
172returnunwrap(A).getKindAsEnum();
173}
174
175uint64_tLLVMGetEnumAttributeValue(LLVMAttributeRefA) {
176auto Attr =unwrap(A);
177if (Attr.isEnumAttribute())
178return 0;
179return Attr.getValueAsInt();
180}
181
182LLVMAttributeRefLLVMCreateTypeAttribute(LLVMContextRefC,unsigned KindID,
183LLVMTypeRef type_ref) {
184auto &Ctx = *unwrap(C);
185auto AttrKind = (Attribute::AttrKind)KindID;
186returnwrap(Attribute::get(Ctx, AttrKind,unwrap(type_ref)));
187}
188
189LLVMTypeRefLLVMGetTypeAttributeValue(LLVMAttributeRefA) {
190auto Attr =unwrap(A);
191returnwrap(Attr.getValueAsType());
192}
193
194LLVMAttributeRefLLVMCreateConstantRangeAttribute(LLVMContextRefC,
195unsigned KindID,
196unsigned NumBits,
197constuint64_t LowerWords[],
198constuint64_t UpperWords[]) {
199auto &Ctx = *unwrap(C);
200auto AttrKind = (Attribute::AttrKind)KindID;
201unsigned NumWords =divideCeil(NumBits, 64);
202returnwrap(Attribute::get(
203 Ctx, AttrKind,
204ConstantRange(APInt(NumBits,ArrayRef(LowerWords, NumWords)),
205APInt(NumBits,ArrayRef(UpperWords, NumWords)))));
206}
207
208LLVMAttributeRefLLVMCreateStringAttribute(LLVMContextRefC,
209constchar *K,unsigned KLength,
210constchar *V,unsigned VLength) {
211returnwrap(Attribute::get(*unwrap(C),StringRef(K, KLength),
212StringRef(V, VLength)));
213}
214
215constchar *LLVMGetStringAttributeKind(LLVMAttributeRefA,
216unsigned *Length) {
217auto S =unwrap(A).getKindAsString();
218 *Length = S.size();
219return S.data();
220}
221
222constchar *LLVMGetStringAttributeValue(LLVMAttributeRefA,
223unsigned *Length) {
224auto S =unwrap(A).getValueAsString();
225 *Length = S.size();
226return S.data();
227}
228
229LLVMBoolLLVMIsEnumAttribute(LLVMAttributeRefA) {
230auto Attr =unwrap(A);
231return Attr.isEnumAttribute() || Attr.isIntAttribute();
232}
233
234LLVMBoolLLVMIsStringAttribute(LLVMAttributeRefA) {
235returnunwrap(A).isStringAttribute();
236}
237
238LLVMBoolLLVMIsTypeAttribute(LLVMAttributeRefA) {
239returnunwrap(A).isTypeAttribute();
240}
241
242char *LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI) {
243 std::string MsgStorage;
244raw_string_ostream Stream(MsgStorage);
245DiagnosticPrinterRawOStream DP(Stream);
246
247unwrap(DI)->print(DP);
248 Stream.flush();
249
250returnLLVMCreateMessage(MsgStorage.c_str());
251}
252
253LLVMDiagnosticSeverityLLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI) {
254LLVMDiagnosticSeverity severity;
255
256switch(unwrap(DI)->getSeverity()) {
257default:
258 severity =LLVMDSError;
259break;
260caseDS_Warning:
261 severity =LLVMDSWarning;
262break;
263caseDS_Remark:
264 severity =LLVMDSRemark;
265break;
266caseDS_Note:
267 severity =LLVMDSNote;
268break;
269 }
270
271return severity;
272}
273
274/*===-- Operations on modules ---------------------------------------------===*/
275
276LLVMModuleRefLLVMModuleCreateWithName(constchar *ModuleID) {
277returnwrap(newModule(ModuleID,getGlobalContext()));
278}
279
280LLVMModuleRefLLVMModuleCreateWithNameInContext(constchar *ModuleID,
281LLVMContextRefC) {
282returnwrap(newModule(ModuleID, *unwrap(C)));
283}
284
285voidLLVMDisposeModule(LLVMModuleRef M) {
286deleteunwrap(M);
287}
288
289constchar *LLVMGetModuleIdentifier(LLVMModuleRef M,size_t *Len) {
290auto &Str =unwrap(M)->getModuleIdentifier();
291 *Len = Str.length();
292return Str.c_str();
293}
294
295voidLLVMSetModuleIdentifier(LLVMModuleRef M,constchar *Ident,size_t Len) {
296unwrap(M)->setModuleIdentifier(StringRef(Ident, Len));
297}
298
299constchar *LLVMGetSourceFileName(LLVMModuleRef M,size_t *Len) {
300auto &Str =unwrap(M)->getSourceFileName();
301 *Len = Str.length();
302return Str.c_str();
303}
304
305voidLLVMSetSourceFileName(LLVMModuleRef M,constchar *Name,size_t Len) {
306unwrap(M)->setSourceFileName(StringRef(Name, Len));
307}
308
309/*--.. Data layout .........................................................--*/
310constchar *LLVMGetDataLayoutStr(LLVMModuleRef M) {
311returnunwrap(M)->getDataLayoutStr().c_str();
312}
313
314constchar *LLVMGetDataLayout(LLVMModuleRef M) {
315returnLLVMGetDataLayoutStr(M);
316}
317
318voidLLVMSetDataLayout(LLVMModuleRef M,constchar *DataLayoutStr) {
319unwrap(M)->setDataLayout(DataLayoutStr);
320}
321
322/*--.. Target triple .......................................................--*/
323constchar *LLVMGetTarget(LLVMModuleRef M) {
324returnunwrap(M)->getTargetTriple().c_str();
325}
326
327voidLLVMSetTarget(LLVMModuleRef M,constchar *Triple) {
328unwrap(M)->setTargetTriple(Triple);
329}
330
331/*--.. Module flags ........................................................--*/
332structLLVMOpaqueModuleFlagEntry {
333LLVMModuleFlagBehaviorBehavior;
334constchar *Key;
335size_tKeyLen;
336LLVMMetadataRefMetadata;
337};
338
339staticModule::ModFlagBehavior
340map_to_llvmModFlagBehavior(LLVMModuleFlagBehavior Behavior) {
341switch (Behavior) {
342caseLLVMModuleFlagBehaviorError:
343return Module::ModFlagBehavior::Error;
344caseLLVMModuleFlagBehaviorWarning:
345return Module::ModFlagBehavior::Warning;
346caseLLVMModuleFlagBehaviorRequire:
347return Module::ModFlagBehavior::Require;
348caseLLVMModuleFlagBehaviorOverride:
349return Module::ModFlagBehavior::Override;
350caseLLVMModuleFlagBehaviorAppend:
351return Module::ModFlagBehavior::Append;
352caseLLVMModuleFlagBehaviorAppendUnique:
353return Module::ModFlagBehavior::AppendUnique;
354 }
355llvm_unreachable("Unknown LLVMModuleFlagBehavior");
356}
357
358staticLLVMModuleFlagBehavior
359map_from_llvmModFlagBehavior(Module::ModFlagBehavior Behavior) {
360switch (Behavior) {
361case Module::ModFlagBehavior::Error:
362returnLLVMModuleFlagBehaviorError;
363case Module::ModFlagBehavior::Warning:
364returnLLVMModuleFlagBehaviorWarning;
365case Module::ModFlagBehavior::Require:
366returnLLVMModuleFlagBehaviorRequire;
367case Module::ModFlagBehavior::Override:
368returnLLVMModuleFlagBehaviorOverride;
369case Module::ModFlagBehavior::Append:
370returnLLVMModuleFlagBehaviorAppend;
371case Module::ModFlagBehavior::AppendUnique:
372returnLLVMModuleFlagBehaviorAppendUnique;
373default:
374llvm_unreachable("Unhandled Flag Behavior");
375 }
376}
377
378LLVMModuleFlagEntry *LLVMCopyModuleFlagsMetadata(LLVMModuleRef M,size_t *Len) {
379SmallVector<Module::ModuleFlagEntry, 8> MFEs;
380unwrap(M)->getModuleFlagsMetadata(MFEs);
381
382LLVMOpaqueModuleFlagEntry *Result =static_cast<LLVMOpaqueModuleFlagEntry *>(
383safe_malloc(MFEs.size() *sizeof(LLVMOpaqueModuleFlagEntry)));
384for (unsigned i = 0; i < MFEs.size(); ++i) {
385constauto &ModuleFlag = MFEs[i];
386 Result[i].Behavior =map_from_llvmModFlagBehavior(ModuleFlag.Behavior);
387 Result[i].Key = ModuleFlag.Key->getString().data();
388 Result[i].KeyLen = ModuleFlag.Key->getString().size();
389 Result[i].Metadata =wrap(ModuleFlag.Val);
390 }
391 *Len = MFEs.size();
392return Result;
393}
394
395voidLLVMDisposeModuleFlagsMetadata(LLVMModuleFlagEntry *Entries) {
396 free(Entries);
397}
398
399LLVMModuleFlagBehavior
400LLVMModuleFlagEntriesGetFlagBehavior(LLVMModuleFlagEntry *Entries,
401unsigned Index) {
402LLVMOpaqueModuleFlagEntry MFE =
403static_cast<LLVMOpaqueModuleFlagEntry>(Entries[Index]);
404return MFE.Behavior;
405}
406
407constchar *LLVMModuleFlagEntriesGetKey(LLVMModuleFlagEntry *Entries,
408unsigned Index,size_t *Len) {
409LLVMOpaqueModuleFlagEntry MFE =
410static_cast<LLVMOpaqueModuleFlagEntry>(Entries[Index]);
411 *Len = MFE.KeyLen;
412return MFE.Key;
413}
414
415LLVMMetadataRefLLVMModuleFlagEntriesGetMetadata(LLVMModuleFlagEntry *Entries,
416unsigned Index) {
417LLVMOpaqueModuleFlagEntry MFE =
418static_cast<LLVMOpaqueModuleFlagEntry>(Entries[Index]);
419return MFE.Metadata;
420}
421
422LLVMMetadataRefLLVMGetModuleFlag(LLVMModuleRef M,
423constchar *Key,size_t KeyLen) {
424returnwrap(unwrap(M)->getModuleFlag({Key, KeyLen}));
425}
426
427voidLLVMAddModuleFlag(LLVMModuleRef M,LLVMModuleFlagBehavior Behavior,
428constchar *Key,size_t KeyLen,
429LLVMMetadataRef Val) {
430unwrap(M)->addModuleFlag(map_to_llvmModFlagBehavior(Behavior),
431 {Key, KeyLen},unwrap(Val));
432}
433
434LLVMBoolLLVMIsNewDbgInfoFormat(LLVMModuleRef M) {
435returnunwrap(M)->IsNewDbgInfoFormat;
436}
437
438voidLLVMSetIsNewDbgInfoFormat(LLVMModuleRef M,LLVMBool UseNewFormat) {
439unwrap(M)->setIsNewDbgInfoFormat(UseNewFormat);
440}
441
442/*--.. Printing modules ....................................................--*/
443
444voidLLVMDumpModule(LLVMModuleRef M) {
445unwrap(M)->print(errs(),nullptr,
446/*ShouldPreserveUseListOrder=*/false,/*IsForDebug=*/true);
447}
448
449LLVMBoolLLVMPrintModuleToFile(LLVMModuleRef M,constchar *Filename,
450char **ErrorMessage) {
451 std::error_code EC;
452raw_fd_ostream dest(Filename, EC,sys::fs::OF_TextWithCRLF);
453if (EC) {
454 *ErrorMessage = strdup(EC.message().c_str());
455returntrue;
456 }
457
458unwrap(M)->print(dest,nullptr);
459
460 dest.close();
461
462if (dest.has_error()) {
463 std::string E ="Error printing to file: " + dest.error().message();
464 *ErrorMessage = strdup(E.c_str());
465returntrue;
466 }
467
468returnfalse;
469}
470
471char *LLVMPrintModuleToString(LLVMModuleRef M) {
472 std::string buf;
473raw_string_ostream os(buf);
474
475unwrap(M)->print(os,nullptr);
476 os.flush();
477
478return strdup(buf.c_str());
479}
480
481/*--.. Operations on inline assembler ......................................--*/
482voidLLVMSetModuleInlineAsm2(LLVMModuleRef M,constchar *Asm,size_t Len) {
483unwrap(M)->setModuleInlineAsm(StringRef(Asm, Len));
484}
485
486voidLLVMSetModuleInlineAsm(LLVMModuleRef M,constchar *Asm) {
487unwrap(M)->setModuleInlineAsm(StringRef(Asm));
488}
489
490voidLLVMAppendModuleInlineAsm(LLVMModuleRef M,constchar *Asm,size_t Len) {
491unwrap(M)->appendModuleInlineAsm(StringRef(Asm, Len));
492}
493
494constchar *LLVMGetModuleInlineAsm(LLVMModuleRef M,size_t *Len) {
495auto &Str =unwrap(M)->getModuleInlineAsm();
496 *Len = Str.length();
497return Str.c_str();
498}
499
500LLVMValueRefLLVMGetInlineAsm(LLVMTypeRef Ty,constchar *AsmString,
501size_t AsmStringSize,constchar *Constraints,
502size_t ConstraintsSize,LLVMBool HasSideEffects,
503LLVMBool IsAlignStack,
504LLVMInlineAsmDialect Dialect,LLVMBool CanThrow) {
505InlineAsm::AsmDialect AD;
506switch (Dialect) {
507caseLLVMInlineAsmDialectATT:
508 AD =InlineAsm::AD_ATT;
509break;
510caseLLVMInlineAsmDialectIntel:
511 AD =InlineAsm::AD_Intel;
512break;
513 }
514returnwrap(InlineAsm::get(unwrap<FunctionType>(Ty),
515StringRef(AsmString, AsmStringSize),
516StringRef(Constraints, ConstraintsSize),
517 HasSideEffects, IsAlignStack, AD, CanThrow));
518}
519
520constchar *LLVMGetInlineAsmAsmString(LLVMValueRef InlineAsmVal,size_t *Len) {
521
522Value *Val = unwrap<Value>(InlineAsmVal);
523const std::string &AsmString = cast<InlineAsm>(Val)->getAsmString();
524
525 *Len = AsmString.length();
526return AsmString.c_str();
527}
528
529constchar *LLVMGetInlineAsmConstraintString(LLVMValueRef InlineAsmVal,
530size_t *Len) {
531Value *Val = unwrap<Value>(InlineAsmVal);
532const std::string &ConstraintString =
533 cast<InlineAsm>(Val)->getConstraintString();
534
535 *Len = ConstraintString.length();
536return ConstraintString.c_str();
537}
538
539LLVMInlineAsmDialectLLVMGetInlineAsmDialect(LLVMValueRef InlineAsmVal) {
540
541Value *Val = unwrap<Value>(InlineAsmVal);
542InlineAsm::AsmDialect Dialect = cast<InlineAsm>(Val)->getDialect();
543
544switch (Dialect) {
545caseInlineAsm::AD_ATT:
546returnLLVMInlineAsmDialectATT;
547caseInlineAsm::AD_Intel:
548returnLLVMInlineAsmDialectIntel;
549 }
550
551llvm_unreachable("Unrecognized inline assembly dialect");
552returnLLVMInlineAsmDialectATT;
553}
554
555LLVMTypeRefLLVMGetInlineAsmFunctionType(LLVMValueRef InlineAsmVal) {
556Value *Val = unwrap<Value>(InlineAsmVal);
557return (LLVMTypeRef)cast<InlineAsm>(Val)->getFunctionType();
558}
559
560LLVMBoolLLVMGetInlineAsmHasSideEffects(LLVMValueRef InlineAsmVal) {
561Value *Val = unwrap<Value>(InlineAsmVal);
562return cast<InlineAsm>(Val)->hasSideEffects();
563}
564
565LLVMBoolLLVMGetInlineAsmNeedsAlignedStack(LLVMValueRef InlineAsmVal) {
566Value *Val = unwrap<Value>(InlineAsmVal);
567return cast<InlineAsm>(Val)->isAlignStack();
568}
569
570LLVMBoolLLVMGetInlineAsmCanUnwind(LLVMValueRef InlineAsmVal) {
571Value *Val = unwrap<Value>(InlineAsmVal);
572return cast<InlineAsm>(Val)->canThrow();
573}
574
575/*--.. Operations on module contexts ......................................--*/
576LLVMContextRefLLVMGetModuleContext(LLVMModuleRef M) {
577returnwrap(&unwrap(M)->getContext());
578}
579
580
581/*===-- Operations on types -----------------------------------------------===*/
582
583/*--.. Operations on all types (mostly) ....................................--*/
584
585LLVMTypeKindLLVMGetTypeKind(LLVMTypeRef Ty) {
586switch (unwrap(Ty)->getTypeID()) {
587caseType::VoidTyID:
588returnLLVMVoidTypeKind;
589caseType::HalfTyID:
590returnLLVMHalfTypeKind;
591caseType::BFloatTyID:
592returnLLVMBFloatTypeKind;
593caseType::FloatTyID:
594returnLLVMFloatTypeKind;
595caseType::DoubleTyID:
596returnLLVMDoubleTypeKind;
597caseType::X86_FP80TyID:
598returnLLVMX86_FP80TypeKind;
599caseType::FP128TyID:
600returnLLVMFP128TypeKind;
601caseType::PPC_FP128TyID:
602returnLLVMPPC_FP128TypeKind;
603caseType::LabelTyID:
604returnLLVMLabelTypeKind;
605caseType::MetadataTyID:
606returnLLVMMetadataTypeKind;
607caseType::IntegerTyID:
608returnLLVMIntegerTypeKind;
609caseType::FunctionTyID:
610returnLLVMFunctionTypeKind;
611caseType::StructTyID:
612returnLLVMStructTypeKind;
613caseType::ArrayTyID:
614returnLLVMArrayTypeKind;
615caseType::PointerTyID:
616returnLLVMPointerTypeKind;
617caseType::FixedVectorTyID:
618returnLLVMVectorTypeKind;
619caseType::X86_AMXTyID:
620returnLLVMX86_AMXTypeKind;
621caseType::TokenTyID:
622returnLLVMTokenTypeKind;
623caseType::ScalableVectorTyID:
624returnLLVMScalableVectorTypeKind;
625caseType::TargetExtTyID:
626returnLLVMTargetExtTypeKind;
627caseType::TypedPointerTyID:
628llvm_unreachable("Typed pointers are unsupported via the C API");
629 }
630llvm_unreachable("Unhandled TypeID.");
631}
632
633LLVMBoolLLVMTypeIsSized(LLVMTypeRef Ty)
634{
635returnunwrap(Ty)->isSized();
636}
637
638LLVMContextRefLLVMGetTypeContext(LLVMTypeRef Ty) {
639returnwrap(&unwrap(Ty)->getContext());
640}
641
642voidLLVMDumpType(LLVMTypeRef Ty) {
643returnunwrap(Ty)->print(errs(),/*IsForDebug=*/true);
644}
645
646char *LLVMPrintTypeToString(LLVMTypeRef Ty) {
647 std::string buf;
648raw_string_ostream os(buf);
649
650if (unwrap(Ty))
651unwrap(Ty)->print(os);
652else
653 os <<"Printing <null> Type";
654
655 os.flush();
656
657return strdup(buf.c_str());
658}
659
660/*--.. Operations on integer types .........................................--*/
661
662LLVMTypeRefLLVMInt1TypeInContext(LLVMContextRefC) {
663return (LLVMTypeRef)Type::getInt1Ty(*unwrap(C));
664}
665LLVMTypeRefLLVMInt8TypeInContext(LLVMContextRefC) {
666return (LLVMTypeRef)Type::getInt8Ty(*unwrap(C));
667}
668LLVMTypeRefLLVMInt16TypeInContext(LLVMContextRefC) {
669return (LLVMTypeRef)Type::getInt16Ty(*unwrap(C));
670}
671LLVMTypeRefLLVMInt32TypeInContext(LLVMContextRefC) {
672return (LLVMTypeRef)Type::getInt32Ty(*unwrap(C));
673}
674LLVMTypeRefLLVMInt64TypeInContext(LLVMContextRefC) {
675return (LLVMTypeRef)Type::getInt64Ty(*unwrap(C));
676}
677LLVMTypeRefLLVMInt128TypeInContext(LLVMContextRefC) {
678return (LLVMTypeRef)Type::getInt128Ty(*unwrap(C));
679}
680LLVMTypeRefLLVMIntTypeInContext(LLVMContextRefC,unsigned NumBits) {
681returnwrap(IntegerType::get(*unwrap(C), NumBits));
682}
683
684LLVMTypeRefLLVMInt1Type(void) {
685returnLLVMInt1TypeInContext(LLVMGetGlobalContext());
686}
687LLVMTypeRefLLVMInt8Type(void) {
688returnLLVMInt8TypeInContext(LLVMGetGlobalContext());
689}
690LLVMTypeRefLLVMInt16Type(void) {
691returnLLVMInt16TypeInContext(LLVMGetGlobalContext());
692}
693LLVMTypeRefLLVMInt32Type(void) {
694returnLLVMInt32TypeInContext(LLVMGetGlobalContext());
695}
696LLVMTypeRefLLVMInt64Type(void) {
697returnLLVMInt64TypeInContext(LLVMGetGlobalContext());
698}
699LLVMTypeRefLLVMInt128Type(void) {
700returnLLVMInt128TypeInContext(LLVMGetGlobalContext());
701}
702LLVMTypeRefLLVMIntType(unsigned NumBits) {
703returnLLVMIntTypeInContext(LLVMGetGlobalContext(), NumBits);
704}
705
706unsignedLLVMGetIntTypeWidth(LLVMTypeRef IntegerTy) {
707return unwrap<IntegerType>(IntegerTy)->getBitWidth();
708}
709
710/*--.. Operations on real types ............................................--*/
711
712LLVMTypeRefLLVMHalfTypeInContext(LLVMContextRefC) {
713return (LLVMTypeRef)Type::getHalfTy(*unwrap(C));
714}
715LLVMTypeRefLLVMBFloatTypeInContext(LLVMContextRefC) {
716return (LLVMTypeRef)Type::getBFloatTy(*unwrap(C));
717}
718LLVMTypeRefLLVMFloatTypeInContext(LLVMContextRefC) {
719return (LLVMTypeRef)Type::getFloatTy(*unwrap(C));
720}
721LLVMTypeRefLLVMDoubleTypeInContext(LLVMContextRefC) {
722return (LLVMTypeRef)Type::getDoubleTy(*unwrap(C));
723}
724LLVMTypeRefLLVMX86FP80TypeInContext(LLVMContextRefC) {
725return (LLVMTypeRef)Type::getX86_FP80Ty(*unwrap(C));
726}
727LLVMTypeRefLLVMFP128TypeInContext(LLVMContextRefC) {
728return (LLVMTypeRef)Type::getFP128Ty(*unwrap(C));
729}
730LLVMTypeRefLLVMPPCFP128TypeInContext(LLVMContextRefC) {
731return (LLVMTypeRef)Type::getPPC_FP128Ty(*unwrap(C));
732}
733LLVMTypeRefLLVMX86AMXTypeInContext(LLVMContextRefC) {
734return (LLVMTypeRef)Type::getX86_AMXTy(*unwrap(C));
735}
736
737LLVMTypeRefLLVMHalfType(void) {
738returnLLVMHalfTypeInContext(LLVMGetGlobalContext());
739}
740LLVMTypeRefLLVMBFloatType(void) {
741returnLLVMBFloatTypeInContext(LLVMGetGlobalContext());
742}
743LLVMTypeRefLLVMFloatType(void) {
744returnLLVMFloatTypeInContext(LLVMGetGlobalContext());
745}
746LLVMTypeRefLLVMDoubleType(void) {
747returnLLVMDoubleTypeInContext(LLVMGetGlobalContext());
748}
749LLVMTypeRefLLVMX86FP80Type(void) {
750returnLLVMX86FP80TypeInContext(LLVMGetGlobalContext());
751}
752LLVMTypeRefLLVMFP128Type(void) {
753returnLLVMFP128TypeInContext(LLVMGetGlobalContext());
754}
755LLVMTypeRefLLVMPPCFP128Type(void) {
756returnLLVMPPCFP128TypeInContext(LLVMGetGlobalContext());
757}
758LLVMTypeRefLLVMX86AMXType(void) {
759returnLLVMX86AMXTypeInContext(LLVMGetGlobalContext());
760}
761
762/*--.. Operations on function types ........................................--*/
763
764LLVMTypeRefLLVMFunctionType(LLVMTypeRef ReturnType,
765LLVMTypeRef *ParamTypes,unsigned ParamCount,
766LLVMBool IsVarArg) {
767ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
768returnwrap(FunctionType::get(unwrap(ReturnType), Tys, IsVarArg != 0));
769}
770
771LLVMBoolLLVMIsFunctionVarArg(LLVMTypeRef FunctionTy) {
772return unwrap<FunctionType>(FunctionTy)->isVarArg();
773}
774
775LLVMTypeRefLLVMGetReturnType(LLVMTypeRef FunctionTy) {
776returnwrap(unwrap<FunctionType>(FunctionTy)->getReturnType());
777}
778
779unsignedLLVMCountParamTypes(LLVMTypeRef FunctionTy) {
780return unwrap<FunctionType>(FunctionTy)->getNumParams();
781}
782
783voidLLVMGetParamTypes(LLVMTypeRef FunctionTy,LLVMTypeRef *Dest) {
784FunctionType *Ty = unwrap<FunctionType>(FunctionTy);
785for (Type *T : Ty->params())
786 *Dest++ =wrap(T);
787}
788
789/*--.. Operations on struct types ..........................................--*/
790
791LLVMTypeRefLLVMStructTypeInContext(LLVMContextRefC,LLVMTypeRef *ElementTypes,
792unsignedElementCount,LLVMBool Packed) {
793ArrayRef<Type*> Tys(unwrap(ElementTypes),ElementCount);
794returnwrap(StructType::get(*unwrap(C), Tys, Packed != 0));
795}
796
797LLVMTypeRefLLVMStructType(LLVMTypeRef *ElementTypes,
798unsignedElementCount,LLVMBool Packed) {
799returnLLVMStructTypeInContext(LLVMGetGlobalContext(), ElementTypes,
800ElementCount, Packed);
801}
802
803LLVMTypeRefLLVMStructCreateNamed(LLVMContextRefC,constchar *Name)
804{
805returnwrap(StructType::create(*unwrap(C),Name));
806}
807
808constchar *LLVMGetStructName(LLVMTypeRef Ty)
809{
810StructType *Type = unwrap<StructType>(Ty);
811if (!Type->hasName())
812returnnullptr;
813returnType->getName().data();
814}
815
816voidLLVMStructSetBody(LLVMTypeRef StructTy,LLVMTypeRef *ElementTypes,
817unsignedElementCount,LLVMBool Packed) {
818ArrayRef<Type*> Tys(unwrap(ElementTypes),ElementCount);
819 unwrap<StructType>(StructTy)->setBody(Tys, Packed != 0);
820}
821
822unsignedLLVMCountStructElementTypes(LLVMTypeRef StructTy) {
823return unwrap<StructType>(StructTy)->getNumElements();
824}
825
826voidLLVMGetStructElementTypes(LLVMTypeRef StructTy,LLVMTypeRef *Dest) {
827StructType *Ty = unwrap<StructType>(StructTy);
828for (Type *T : Ty->elements())
829 *Dest++ =wrap(T);
830}
831
832LLVMTypeRefLLVMStructGetTypeAtIndex(LLVMTypeRef StructTy,unsigned i) {
833StructType *Ty = unwrap<StructType>(StructTy);
834returnwrap(Ty->getTypeAtIndex(i));
835}
836
837LLVMBoolLLVMIsPackedStruct(LLVMTypeRef StructTy) {
838return unwrap<StructType>(StructTy)->isPacked();
839}
840
841LLVMBoolLLVMIsOpaqueStruct(LLVMTypeRef StructTy) {
842return unwrap<StructType>(StructTy)->isOpaque();
843}
844
845LLVMBoolLLVMIsLiteralStruct(LLVMTypeRef StructTy) {
846return unwrap<StructType>(StructTy)->isLiteral();
847}
848
849LLVMTypeRefLLVMGetTypeByName(LLVMModuleRef M,constchar *Name) {
850returnwrap(StructType::getTypeByName(unwrap(M)->getContext(),Name));
851}
852
853LLVMTypeRefLLVMGetTypeByName2(LLVMContextRefC,constchar *Name) {
854returnwrap(StructType::getTypeByName(*unwrap(C),Name));
855}
856
857/*--.. Operations on array, pointer, and vector types (sequence types) .....--*/
858
859voidLLVMGetSubtypes(LLVMTypeRef Tp,LLVMTypeRef *Arr) {
860int i = 0;
861for (auto *T :unwrap(Tp)->subtypes()) {
862 Arr[i] =wrap(T);
863 i++;
864 }
865}
866
867LLVMTypeRefLLVMArrayType(LLVMTypeRef ElementType,unsignedElementCount) {
868returnwrap(ArrayType::get(unwrap(ElementType),ElementCount));
869}
870
871LLVMTypeRefLLVMArrayType2(LLVMTypeRef ElementType,uint64_tElementCount) {
872returnwrap(ArrayType::get(unwrap(ElementType),ElementCount));
873}
874
875LLVMTypeRefLLVMPointerType(LLVMTypeRef ElementType,unsignedAddressSpace) {
876returnwrap(
877 PointerType::get(unwrap(ElementType)->getContext(),AddressSpace));
878}
879
880LLVMBoolLLVMPointerTypeIsOpaque(LLVMTypeRef Ty) {
881returntrue;
882}
883
884LLVMTypeRefLLVMVectorType(LLVMTypeRef ElementType,unsignedElementCount) {
885returnwrap(FixedVectorType::get(unwrap(ElementType),ElementCount));
886}
887
888LLVMTypeRefLLVMScalableVectorType(LLVMTypeRef ElementType,
889unsignedElementCount) {
890returnwrap(ScalableVectorType::get(unwrap(ElementType),ElementCount));
891}
892
893LLVMTypeRefLLVMGetElementType(LLVMTypeRef WrappedTy) {
894auto *Ty =unwrap(WrappedTy);
895if (auto *ATy = dyn_cast<ArrayType>(Ty))
896returnwrap(ATy->getElementType());
897returnwrap(cast<VectorType>(Ty)->getElementType());
898}
899
900unsignedLLVMGetNumContainedTypes(LLVMTypeRef Tp) {
901returnunwrap(Tp)->getNumContainedTypes();
902}
903
904unsignedLLVMGetArrayLength(LLVMTypeRef ArrayTy) {
905return unwrap<ArrayType>(ArrayTy)->getNumElements();
906}
907
908uint64_tLLVMGetArrayLength2(LLVMTypeRef ArrayTy) {
909return unwrap<ArrayType>(ArrayTy)->getNumElements();
910}
911
912unsignedLLVMGetPointerAddressSpace(LLVMTypeRefPointerTy) {
913return unwrap<PointerType>(PointerTy)->getAddressSpace();
914}
915
916unsignedLLVMGetVectorSize(LLVMTypeRef VectorTy) {
917return unwrap<VectorType>(VectorTy)->getElementCount().getKnownMinValue();
918}
919
920LLVMValueRefLLVMGetConstantPtrAuthPointer(LLVMValueRef PtrAuth) {
921returnwrap(unwrap<ConstantPtrAuth>(PtrAuth)->getPointer());
922}
923
924LLVMValueRefLLVMGetConstantPtrAuthKey(LLVMValueRef PtrAuth) {
925returnwrap(unwrap<ConstantPtrAuth>(PtrAuth)->getKey());
926}
927
928LLVMValueRefLLVMGetConstantPtrAuthDiscriminator(LLVMValueRef PtrAuth) {
929returnwrap(unwrap<ConstantPtrAuth>(PtrAuth)->getDiscriminator());
930}
931
932LLVMValueRefLLVMGetConstantPtrAuthAddrDiscriminator(LLVMValueRef PtrAuth) {
933returnwrap(unwrap<ConstantPtrAuth>(PtrAuth)->getAddrDiscriminator());
934}
935
936/*--.. Operations on other types ...........................................--*/
937
938LLVMTypeRefLLVMPointerTypeInContext(LLVMContextRefC,unsignedAddressSpace) {
939returnwrap(PointerType::get(*unwrap(C),AddressSpace));
940}
941
942LLVMTypeRefLLVMVoidTypeInContext(LLVMContextRefC) {
943returnwrap(Type::getVoidTy(*unwrap(C)));
944}
945LLVMTypeRefLLVMLabelTypeInContext(LLVMContextRefC) {
946returnwrap(Type::getLabelTy(*unwrap(C)));
947}
948LLVMTypeRefLLVMTokenTypeInContext(LLVMContextRefC) {
949returnwrap(Type::getTokenTy(*unwrap(C)));
950}
951LLVMTypeRefLLVMMetadataTypeInContext(LLVMContextRefC) {
952returnwrap(Type::getMetadataTy(*unwrap(C)));
953}
954
955LLVMTypeRefLLVMVoidType(void) {
956returnLLVMVoidTypeInContext(LLVMGetGlobalContext());
957}
958LLVMTypeRefLLVMLabelType(void) {
959returnLLVMLabelTypeInContext(LLVMGetGlobalContext());
960}
961
962LLVMTypeRefLLVMTargetExtTypeInContext(LLVMContextRefC,constchar *Name,
963LLVMTypeRef *TypeParams,
964unsigned TypeParamCount,
965unsigned *IntParams,
966unsigned IntParamCount) {
967ArrayRef<Type *> TypeParamArray(unwrap(TypeParams), TypeParamCount);
968ArrayRef<unsigned> IntParamArray(IntParams, IntParamCount);
969returnwrap(
970TargetExtType::get(*unwrap(C),Name, TypeParamArray, IntParamArray));
971}
972
973constchar *LLVMGetTargetExtTypeName(LLVMTypeRef TargetExtTy) {
974TargetExtType *Type = unwrap<TargetExtType>(TargetExtTy);
975returnType->getName().data();
976}
977
978unsignedLLVMGetTargetExtTypeNumTypeParams(LLVMTypeRef TargetExtTy) {
979TargetExtType *Type = unwrap<TargetExtType>(TargetExtTy);
980returnType->getNumTypeParameters();
981}
982
983LLVMTypeRefLLVMGetTargetExtTypeTypeParam(LLVMTypeRef TargetExtTy,
984unsignedIdx) {
985TargetExtType *Type = unwrap<TargetExtType>(TargetExtTy);
986returnwrap(Type->getTypeParameter(Idx));
987}
988
989unsignedLLVMGetTargetExtTypeNumIntParams(LLVMTypeRef TargetExtTy) {
990TargetExtType *Type = unwrap<TargetExtType>(TargetExtTy);
991returnType->getNumIntParameters();
992}
993
994unsignedLLVMGetTargetExtTypeIntParam(LLVMTypeRef TargetExtTy,unsignedIdx) {
995TargetExtType *Type = unwrap<TargetExtType>(TargetExtTy);
996returnType->getIntParameter(Idx);
997}
998
999/*===-- Operations on values ----------------------------------------------===*/
1000
1001/*--.. Operations on all values ............................................--*/
1002
1003LLVMTypeRefLLVMTypeOf(LLVMValueRef Val) {
1004returnwrap(unwrap(Val)->getType());
1005}
1006
1007LLVMValueKindLLVMGetValueKind(LLVMValueRef Val) {
1008switch(unwrap(Val)->getValueID()) {
1009#define LLVM_C_API 1
1010#define HANDLE_VALUE(Name) \
1011 case Value::Name##Val: \
1012 return LLVM##Name##ValueKind;
1013#include "llvm/IR/Value.def"
1014default:
1015returnLLVMInstructionValueKind;
1016 }
1017}
1018
1019constchar *LLVMGetValueName2(LLVMValueRef Val,size_t *Length) {
1020auto *V =unwrap(Val);
1021 *Length = V->getName().size();
1022return V->getName().data();
1023}
1024
1025voidLLVMSetValueName2(LLVMValueRef Val,constchar *Name,size_t NameLen) {
1026unwrap(Val)->setName(StringRef(Name, NameLen));
1027}
1028
1029constchar *LLVMGetValueName(LLVMValueRef Val) {
1030returnunwrap(Val)->getName().data();
1031}
1032
1033voidLLVMSetValueName(LLVMValueRef Val,constchar *Name) {
1034unwrap(Val)->setName(Name);
1035}
1036
1037voidLLVMDumpValue(LLVMValueRef Val) {
1038unwrap(Val)->print(errs(),/*IsForDebug=*/true);
1039}
1040
1041char*LLVMPrintValueToString(LLVMValueRef Val) {
1042 std::string buf;
1043raw_string_ostream os(buf);
1044
1045if (unwrap(Val))
1046unwrap(Val)->print(os);
1047else
1048 os <<"Printing <null> Value";
1049
1050 os.flush();
1051
1052return strdup(buf.c_str());
1053}
1054
1055LLVMContextRefLLVMGetValueContext(LLVMValueRef Val) {
1056returnwrap(&unwrap(Val)->getContext());
1057}
1058
1059char *LLVMPrintDbgRecordToString(LLVMDbgRecordRefRecord) {
1060 std::string buf;
1061raw_string_ostream os(buf);
1062
1063if (unwrap(Record))
1064unwrap(Record)->print(os);
1065else
1066 os <<"Printing <null> DbgRecord";
1067
1068 os.flush();
1069
1070return strdup(buf.c_str());
1071}
1072
1073voidLLVMReplaceAllUsesWith(LLVMValueRef OldVal,LLVMValueRef NewVal) {
1074unwrap(OldVal)->replaceAllUsesWith(unwrap(NewVal));
1075}
1076
1077intLLVMHasMetadata(LLVMValueRef Inst) {
1078return unwrap<Instruction>(Inst)->hasMetadata();
1079}
1080
1081LLVMValueRefLLVMGetMetadata(LLVMValueRef Inst,unsigned KindID) {
1082auto *I = unwrap<Instruction>(Inst);
1083assert(I &&"Expected instruction");
1084if (auto *MD =I->getMetadata(KindID))
1085returnwrap(MetadataAsValue::get(I->getContext(), MD));
1086returnnullptr;
1087}
1088
1089// MetadataAsValue uses a canonical format which strips the actual MDNode for
1090// MDNode with just a single constant value, storing just a ConstantAsMetadata
1091// This undoes this canonicalization, reconstructing the MDNode.
1092staticMDNode *extractMDNode(MetadataAsValue *MAV) {
1093Metadata *MD = MAV->getMetadata();
1094assert((isa<MDNode>(MD) || isa<ConstantAsMetadata>(MD)) &&
1095"Expected a metadata node or a canonicalized constant");
1096
1097if (MDNode *N = dyn_cast<MDNode>(MD))
1098returnN;
1099
1100returnMDNode::get(MAV->getContext(), MD);
1101}
1102
1103voidLLVMSetMetadata(LLVMValueRef Inst,unsigned KindID,LLVMValueRef Val) {
1104MDNode *N = Val ?extractMDNode(unwrap<MetadataAsValue>(Val)) :nullptr;
1105
1106 unwrap<Instruction>(Inst)->setMetadata(KindID,N);
1107}
1108
1109structLLVMOpaqueValueMetadataEntry {
1110unsignedKind;
1111LLVMMetadataRefMetadata;
1112};
1113
1114usingMetadataEntries =SmallVectorImpl<std::pair<unsigned, MDNode *>>;
1115staticLLVMValueMetadataEntry *
1116llvm_getMetadata(size_t *NumEntries,
1117llvm::function_ref<void(MetadataEntries &)> AccessMD) {
1118SmallVector<std::pair<unsigned, MDNode *>, 8> MVEs;
1119 AccessMD(MVEs);
1120
1121LLVMOpaqueValueMetadataEntry *Result =
1122static_cast<LLVMOpaqueValueMetadataEntry *>(
1123safe_malloc(MVEs.size() *sizeof(LLVMOpaqueValueMetadataEntry)));
1124for (unsigned i = 0; i < MVEs.size(); ++i) {
1125constauto &ModuleFlag = MVEs[i];
1126 Result[i].Kind = ModuleFlag.first;
1127 Result[i].Metadata =wrap(ModuleFlag.second);
1128 }
1129 *NumEntries = MVEs.size();
1130return Result;
1131}
1132
1133LLVMValueMetadataEntry *
1134LLVMInstructionGetAllMetadataOtherThanDebugLoc(LLVMValueRefValue,
1135size_t *NumEntries) {
1136returnllvm_getMetadata(NumEntries, [&Value](MetadataEntries &Entries) {
1137 Entries.clear();
1138 unwrap<Instruction>(Value)->getAllMetadata(Entries);
1139 });
1140}
1141
1142/*--.. Conversion functions ................................................--*/
1143
1144#define LLVM_DEFINE_VALUE_CAST(name) \
1145 LLVMValueRef LLVMIsA##name(LLVMValueRef Val) { \
1146 return wrap(static_cast<Value*>(dyn_cast_or_null<name>(unwrap(Val)))); \
1147 }
1148
1149LLVM_FOR_EACH_VALUE_SUBCLASS(LLVM_DEFINE_VALUE_CAST)
1150
1151LLVMValueRefLLVMIsAMDNode(LLVMValueRef Val) {
1152if (auto *MD = dyn_cast_or_null<MetadataAsValue>(unwrap(Val)))
1153if (isa<MDNode>(MD->getMetadata()) ||
1154 isa<ValueAsMetadata>(MD->getMetadata()))
1155return Val;
1156returnnullptr;
1157}
1158
1159LLVMValueRefLLVMIsAValueAsMetadata(LLVMValueRef Val) {
1160if (auto *MD = dyn_cast_or_null<MetadataAsValue>(unwrap(Val)))
1161if (isa<ValueAsMetadata>(MD->getMetadata()))
1162return Val;
1163returnnullptr;
1164}
1165
1166LLVMValueRefLLVMIsAMDString(LLVMValueRef Val) {
1167if (auto *MD = dyn_cast_or_null<MetadataAsValue>(unwrap(Val)))
1168if (isa<MDString>(MD->getMetadata()))
1169return Val;
1170returnnullptr;
1171}
1172
1173/*--.. Operations on Uses ..................................................--*/
1174LLVMUseRefLLVMGetFirstUse(LLVMValueRef Val) {
1175Value *V =unwrap(Val);
1176Value::use_iteratorI = V->use_begin();
1177if (I == V->use_end())
1178returnnullptr;
1179returnwrap(&*I);
1180}
1181
1182LLVMUseRefLLVMGetNextUse(LLVMUseRef U) {
1183Use *Next =unwrap(U)->getNext();
1184if (Next)
1185returnwrap(Next);
1186returnnullptr;
1187}
1188
1189LLVMValueRefLLVMGetUser(LLVMUseRef U) {
1190returnwrap(unwrap(U)->getUser());
1191}
1192
1193LLVMValueRefLLVMGetUsedValue(LLVMUseRef U) {
1194returnwrap(unwrap(U)->get());
1195}
1196
1197/*--.. Operations on Users .................................................--*/
1198
1199staticLLVMValueRefgetMDNodeOperandImpl(LLVMContext &Context,constMDNode *N,
1200unsigned Index) {
1201Metadata *Op =N->getOperand(Index);
1202if (!Op)
1203returnnullptr;
1204if (auto *C = dyn_cast<ConstantAsMetadata>(Op))
1205returnwrap(C->getValue());
1206returnwrap(MetadataAsValue::get(Context,Op));
1207}
1208
1209LLVMValueRefLLVMGetOperand(LLVMValueRef Val,unsigned Index) {
1210Value *V =unwrap(Val);
1211if (auto *MD = dyn_cast<MetadataAsValue>(V)) {
1212if (auto *L = dyn_cast<ValueAsMetadata>(MD->getMetadata())) {
1213assert(Index == 0 &&"Function-local metadata can only have one operand");
1214returnwrap(L->getValue());
1215 }
1216returngetMDNodeOperandImpl(V->getContext(),
1217 cast<MDNode>(MD->getMetadata()), Index);
1218 }
1219
1220returnwrap(cast<User>(V)->getOperand(Index));
1221}
1222
1223LLVMUseRefLLVMGetOperandUse(LLVMValueRef Val,unsigned Index) {
1224Value *V =unwrap(Val);
1225returnwrap(&cast<User>(V)->getOperandUse(Index));
1226}
1227
1228voidLLVMSetOperand(LLVMValueRef Val,unsigned Index,LLVMValueRefOp) {
1229 unwrap<User>(Val)->setOperand(Index,unwrap(Op));
1230}
1231
1232intLLVMGetNumOperands(LLVMValueRef Val) {
1233Value *V =unwrap(Val);
1234if (isa<MetadataAsValue>(V))
1235returnLLVMGetMDNodeNumOperands(Val);
1236
1237return cast<User>(V)->getNumOperands();
1238}
1239
1240/*--.. Operations on constants of any type .................................--*/
1241
1242LLVMValueRefLLVMConstNull(LLVMTypeRef Ty) {
1243returnwrap(Constant::getNullValue(unwrap(Ty)));
1244}
1245
1246LLVMValueRefLLVMConstAllOnes(LLVMTypeRef Ty) {
1247returnwrap(Constant::getAllOnesValue(unwrap(Ty)));
1248}
1249
1250LLVMValueRefLLVMGetUndef(LLVMTypeRef Ty) {
1251returnwrap(UndefValue::get(unwrap(Ty)));
1252}
1253
1254LLVMValueRefLLVMGetPoison(LLVMTypeRef Ty) {
1255returnwrap(PoisonValue::get(unwrap(Ty)));
1256}
1257
1258LLVMBoolLLVMIsConstant(LLVMValueRef Ty) {
1259return isa<Constant>(unwrap(Ty));
1260}
1261
1262LLVMBoolLLVMIsNull(LLVMValueRef Val) {
1263if (Constant *C = dyn_cast<Constant>(unwrap(Val)))
1264returnC->isNullValue();
1265returnfalse;
1266}
1267
1268LLVMBoolLLVMIsUndef(LLVMValueRef Val) {
1269return isa<UndefValue>(unwrap(Val));
1270}
1271
1272LLVMBoolLLVMIsPoison(LLVMValueRef Val) {
1273return isa<PoisonValue>(unwrap(Val));
1274}
1275
1276LLVMValueRefLLVMConstPointerNull(LLVMTypeRef Ty) {
1277returnwrap(ConstantPointerNull::get(unwrap<PointerType>(Ty)));
1278}
1279
1280/*--.. Operations on metadata nodes ........................................--*/
1281
1282LLVMMetadataRefLLVMMDStringInContext2(LLVMContextRefC,constchar *Str,
1283size_t SLen) {
1284returnwrap(MDString::get(*unwrap(C),StringRef(Str, SLen)));
1285}
1286
1287LLVMMetadataRefLLVMMDNodeInContext2(LLVMContextRefC,LLVMMetadataRef *MDs,
1288size_t Count) {
1289returnwrap(MDNode::get(*unwrap(C),ArrayRef<Metadata*>(unwrap(MDs), Count)));
1290}
1291
1292LLVMValueRefLLVMMDStringInContext(LLVMContextRefC,constchar *Str,
1293unsigned SLen) {
1294LLVMContext &Context = *unwrap(C);
1295returnwrap(MetadataAsValue::get(
1296 Context,MDString::get(Context,StringRef(Str, SLen))));
1297}
1298
1299LLVMValueRefLLVMMDString(constchar *Str,unsigned SLen) {
1300returnLLVMMDStringInContext(LLVMGetGlobalContext(), Str, SLen);
1301}
1302
1303LLVMValueRefLLVMMDNodeInContext(LLVMContextRefC,LLVMValueRef *Vals,
1304unsigned Count) {
1305LLVMContext &Context = *unwrap(C);
1306SmallVector<Metadata *, 8> MDs;
1307for (auto *OV :ArrayRef(Vals, Count)) {
1308Value *V =unwrap(OV);
1309Metadata *MD;
1310if (!V)
1311 MD =nullptr;
1312elseif (auto *C = dyn_cast<Constant>(V))
1313 MD =ConstantAsMetadata::get(C);
1314elseif (auto *MDV = dyn_cast<MetadataAsValue>(V)) {
1315 MD = MDV->getMetadata();
1316assert(!isa<LocalAsMetadata>(MD) &&"Unexpected function-local metadata "
1317"outside of direct argument to call");
1318 }else {
1319// This is function-local metadata. Pretend to make an MDNode.
1320assert(Count == 1 &&
1321"Expected only one operand to function-local metadata");
1322returnwrap(MetadataAsValue::get(Context,LocalAsMetadata::get(V)));
1323 }
1324
1325 MDs.push_back(MD);
1326 }
1327returnwrap(MetadataAsValue::get(Context,MDNode::get(Context, MDs)));
1328}
1329
1330LLVMValueRefLLVMMDNode(LLVMValueRef *Vals,unsigned Count) {
1331returnLLVMMDNodeInContext(LLVMGetGlobalContext(), Vals, Count);
1332}
1333
1334LLVMValueRefLLVMMetadataAsValue(LLVMContextRefC,LLVMMetadataRef MD) {
1335returnwrap(MetadataAsValue::get(*unwrap(C),unwrap(MD)));
1336}
1337
1338LLVMMetadataRefLLVMValueAsMetadata(LLVMValueRef Val) {
1339auto *V =unwrap(Val);
1340if (auto *C = dyn_cast<Constant>(V))
1341returnwrap(ConstantAsMetadata::get(C));
1342if (auto *MAV = dyn_cast<MetadataAsValue>(V))
1343returnwrap(MAV->getMetadata());
1344returnwrap(ValueAsMetadata::get(V));
1345}
1346
1347constchar *LLVMGetMDString(LLVMValueRef V,unsigned *Length) {
1348if (constauto *MD = dyn_cast<MetadataAsValue>(unwrap(V)))
1349if (constMDString *S = dyn_cast<MDString>(MD->getMetadata())) {
1350 *Length = S->getString().size();
1351return S->getString().data();
1352 }
1353 *Length = 0;
1354returnnullptr;
1355}
1356
1357unsignedLLVMGetMDNodeNumOperands(LLVMValueRef V) {
1358auto *MD = unwrap<MetadataAsValue>(V);
1359if (isa<ValueAsMetadata>(MD->getMetadata()))
1360return 1;
1361return cast<MDNode>(MD->getMetadata())->getNumOperands();
1362}
1363
1364LLVMNamedMDNodeRefLLVMGetFirstNamedMetadata(LLVMModuleRef M) {
1365Module *Mod =unwrap(M);
1366Module::named_metadata_iteratorI =Mod->named_metadata_begin();
1367if (I ==Mod->named_metadata_end())
1368returnnullptr;
1369returnwrap(&*I);
1370}
1371
1372LLVMNamedMDNodeRefLLVMGetLastNamedMetadata(LLVMModuleRef M) {
1373Module *Mod =unwrap(M);
1374Module::named_metadata_iteratorI =Mod->named_metadata_end();
1375if (I ==Mod->named_metadata_begin())
1376returnnullptr;
1377returnwrap(&*--I);
1378}
1379
1380LLVMNamedMDNodeRefLLVMGetNextNamedMetadata(LLVMNamedMDNodeRef NMD) {
1381NamedMDNode *NamedNode =unwrap(NMD);
1382Module::named_metadata_iteratorI(NamedNode);
1383if (++I == NamedNode->getParent()->named_metadata_end())
1384returnnullptr;
1385returnwrap(&*I);
1386}
1387
1388LLVMNamedMDNodeRefLLVMGetPreviousNamedMetadata(LLVMNamedMDNodeRef NMD) {
1389NamedMDNode *NamedNode =unwrap(NMD);
1390Module::named_metadata_iteratorI(NamedNode);
1391if (I == NamedNode->getParent()->named_metadata_begin())
1392returnnullptr;
1393returnwrap(&*--I);
1394}
1395
1396LLVMNamedMDNodeRefLLVMGetNamedMetadata(LLVMModuleRef M,
1397constchar *Name,size_t NameLen) {
1398returnwrap(unwrap(M)->getNamedMetadata(StringRef(Name, NameLen)));
1399}
1400
1401LLVMNamedMDNodeRefLLVMGetOrInsertNamedMetadata(LLVMModuleRef M,
1402constchar *Name,size_t NameLen) {
1403returnwrap(unwrap(M)->getOrInsertNamedMetadata({Name, NameLen}));
1404}
1405
1406constchar *LLVMGetNamedMetadataName(LLVMNamedMDNodeRef NMD,size_t *NameLen) {
1407NamedMDNode *NamedNode =unwrap(NMD);
1408 *NameLen = NamedNode->getName().size();
1409return NamedNode->getName().data();
1410}
1411
1412voidLLVMGetMDNodeOperands(LLVMValueRef V,LLVMValueRef *Dest) {
1413auto *MD = unwrap<MetadataAsValue>(V);
1414if (auto *MDV = dyn_cast<ValueAsMetadata>(MD->getMetadata())) {
1415 *Dest =wrap(MDV->getValue());
1416return;
1417 }
1418constauto *N = cast<MDNode>(MD->getMetadata());
1419constunsigned numOperands =N->getNumOperands();
1420LLVMContext &Context =unwrap(V)->getContext();
1421for (unsigned i = 0; i < numOperands; i++)
1422 Dest[i] =getMDNodeOperandImpl(Context,N, i);
1423}
1424
1425voidLLVMReplaceMDNodeOperandWith(LLVMValueRef V,unsigned Index,
1426LLVMMetadataRef Replacement) {
1427auto *MD = cast<MetadataAsValue>(unwrap(V));
1428auto *N = cast<MDNode>(MD->getMetadata());
1429N->replaceOperandWith(Index, unwrap<Metadata>(Replacement));
1430}
1431
1432unsignedLLVMGetNamedMetadataNumOperands(LLVMModuleRef M,constchar *Name) {
1433if (NamedMDNode *N =unwrap(M)->getNamedMetadata(Name)) {
1434returnN->getNumOperands();
1435 }
1436return 0;
1437}
1438
1439voidLLVMGetNamedMetadataOperands(LLVMModuleRef M,constchar *Name,
1440LLVMValueRef *Dest) {
1441NamedMDNode *N =unwrap(M)->getNamedMetadata(Name);
1442if (!N)
1443return;
1444LLVMContext &Context =unwrap(M)->getContext();
1445for (unsigned i=0;i<N->getNumOperands();i++)
1446 Dest[i] =wrap(MetadataAsValue::get(Context,N->getOperand(i)));
1447}
1448
1449voidLLVMAddNamedMetadataOperand(LLVMModuleRef M,constchar *Name,
1450LLVMValueRef Val) {
1451NamedMDNode *N =unwrap(M)->getOrInsertNamedMetadata(Name);
1452if (!N)
1453return;
1454if (!Val)
1455return;
1456N->addOperand(extractMDNode(unwrap<MetadataAsValue>(Val)));
1457}
1458
1459constchar *LLVMGetDebugLocDirectory(LLVMValueRef Val,unsigned *Length) {
1460if (!Length)returnnullptr;
1461StringRef S;
1462if (constauto *I = dyn_cast<Instruction>(unwrap(Val))) {
1463if (constauto &DL =I->getDebugLoc()) {
1464 S =DL->getDirectory();
1465 }
1466 }elseif (constauto *GV = dyn_cast<GlobalVariable>(unwrap(Val))) {
1467SmallVector<DIGlobalVariableExpression *, 1> GVEs;
1468 GV->getDebugInfo(GVEs);
1469if (GVEs.size())
1470if (constDIGlobalVariable *DGV = GVEs[0]->getVariable())
1471 S = DGV->getDirectory();
1472 }elseif (constauto *F = dyn_cast<Function>(unwrap(Val))) {
1473if (constDISubprogram *DSP =F->getSubprogram())
1474 S = DSP->getDirectory();
1475 }else {
1476assert(0 &&"Expected Instruction, GlobalVariable or Function");
1477returnnullptr;
1478 }
1479 *Length = S.size();
1480return S.data();
1481}
1482
1483constchar *LLVMGetDebugLocFilename(LLVMValueRef Val,unsigned *Length) {
1484if (!Length)returnnullptr;
1485StringRef S;
1486if (constauto *I = dyn_cast<Instruction>(unwrap(Val))) {
1487if (constauto &DL =I->getDebugLoc()) {
1488 S =DL->getFilename();
1489 }
1490 }elseif (constauto *GV = dyn_cast<GlobalVariable>(unwrap(Val))) {
1491SmallVector<DIGlobalVariableExpression *, 1> GVEs;
1492 GV->getDebugInfo(GVEs);
1493if (GVEs.size())
1494if (constDIGlobalVariable *DGV = GVEs[0]->getVariable())
1495 S = DGV->getFilename();
1496 }elseif (constauto *F = dyn_cast<Function>(unwrap(Val))) {
1497if (constDISubprogram *DSP =F->getSubprogram())
1498 S = DSP->getFilename();
1499 }else {
1500assert(0 &&"Expected Instruction, GlobalVariable or Function");
1501returnnullptr;
1502 }
1503 *Length = S.size();
1504return S.data();
1505}
1506
1507unsignedLLVMGetDebugLocLine(LLVMValueRef Val) {
1508unsigned L = 0;
1509if (constauto *I = dyn_cast<Instruction>(unwrap(Val))) {
1510if (constauto &DL =I->getDebugLoc()) {
1511 L =DL->getLine();
1512 }
1513 }elseif (constauto *GV = dyn_cast<GlobalVariable>(unwrap(Val))) {
1514SmallVector<DIGlobalVariableExpression *, 1> GVEs;
1515 GV->getDebugInfo(GVEs);
1516if (GVEs.size())
1517if (constDIGlobalVariable *DGV = GVEs[0]->getVariable())
1518 L = DGV->getLine();
1519 }elseif (constauto *F = dyn_cast<Function>(unwrap(Val))) {
1520if (constDISubprogram *DSP =F->getSubprogram())
1521 L = DSP->getLine();
1522 }else {
1523assert(0 &&"Expected Instruction, GlobalVariable or Function");
1524return -1;
1525 }
1526return L;
1527}
1528
1529unsignedLLVMGetDebugLocColumn(LLVMValueRef Val) {
1530unsignedC = 0;
1531if (constauto *I = dyn_cast<Instruction>(unwrap(Val)))
1532if (constauto &DL =I->getDebugLoc())
1533C =DL->getColumn();
1534returnC;
1535}
1536
1537/*--.. Operations on scalar constants ......................................--*/
1538
1539LLVMValueRefLLVMConstInt(LLVMTypeRef IntTy,unsignedlonglongN,
1540LLVMBool SignExtend) {
1541returnwrap(ConstantInt::get(unwrap<IntegerType>(IntTy),N, SignExtend != 0));
1542}
1543
1544LLVMValueRefLLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy,
1545unsigned NumWords,
1546constuint64_t Words[]) {
1547IntegerType *Ty = unwrap<IntegerType>(IntTy);
1548returnwrap(ConstantInt::get(
1549 Ty->getContext(),APInt(Ty->getBitWidth(),ArrayRef(Words, NumWords))));
1550}
1551
1552LLVMValueRefLLVMConstIntOfString(LLVMTypeRef IntTy,constchar Str[],
1553uint8_t Radix) {
1554returnwrap(ConstantInt::get(unwrap<IntegerType>(IntTy),StringRef(Str),
1555 Radix));
1556}
1557
1558LLVMValueRefLLVMConstIntOfStringAndSize(LLVMTypeRef IntTy,constchar Str[],
1559unsigned SLen,uint8_t Radix) {
1560returnwrap(ConstantInt::get(unwrap<IntegerType>(IntTy),StringRef(Str, SLen),
1561 Radix));
1562}
1563
1564LLVMValueRefLLVMConstReal(LLVMTypeRef RealTy,doubleN) {
1565returnwrap(ConstantFP::get(unwrap(RealTy),N));
1566}
1567
1568LLVMValueRefLLVMConstRealOfString(LLVMTypeRef RealTy,constchar *Text) {
1569returnwrap(ConstantFP::get(unwrap(RealTy),StringRef(Text)));
1570}
1571
1572LLVMValueRefLLVMConstRealOfStringAndSize(LLVMTypeRef RealTy,constchar Str[],
1573unsigned SLen) {
1574returnwrap(ConstantFP::get(unwrap(RealTy),StringRef(Str, SLen)));
1575}
1576
1577unsignedlonglongLLVMConstIntGetZExtValue(LLVMValueRef ConstantVal) {
1578return unwrap<ConstantInt>(ConstantVal)->getZExtValue();
1579}
1580
1581longlongLLVMConstIntGetSExtValue(LLVMValueRef ConstantVal) {
1582return unwrap<ConstantInt>(ConstantVal)->getSExtValue();
1583}
1584
1585doubleLLVMConstRealGetDouble(LLVMValueRef ConstantVal,LLVMBool *LosesInfo) {
1586ConstantFP *cFP = unwrap<ConstantFP>(ConstantVal) ;
1587Type *Ty = cFP->getType();
1588
1589if (Ty->isHalfTy() || Ty->isBFloatTy() || Ty->isFloatTy() ||
1590 Ty->isDoubleTy()) {
1591 *LosesInfo =false;
1592return cFP->getValueAPF().convertToDouble();
1593 }
1594
1595bool APFLosesInfo;
1596APFloat APF = cFP->getValueAPF();
1597 APF.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven, &APFLosesInfo);
1598 *LosesInfo = APFLosesInfo;
1599return APF.convertToDouble();
1600}
1601
1602/*--.. Operations on composite constants ...................................--*/
1603
1604LLVMValueRefLLVMConstStringInContext(LLVMContextRefC,constchar *Str,
1605unsignedLength,
1606LLVMBool DontNullTerminate) {
1607/* Inverted the sense of AddNull because ', 0)' is a
1608 better mnemonic for null termination than ', 1)'. */
1609returnwrap(ConstantDataArray::getString(*unwrap(C),StringRef(Str,Length),
1610 DontNullTerminate == 0));
1611}
1612
1613LLVMValueRefLLVMConstStringInContext2(LLVMContextRefC,constchar *Str,
1614size_tLength,
1615LLVMBool DontNullTerminate) {
1616/* Inverted the sense of AddNull because ', 0)' is a
1617 better mnemonic for null termination than ', 1)'. */
1618returnwrap(ConstantDataArray::getString(*unwrap(C),StringRef(Str,Length),
1619 DontNullTerminate == 0));
1620}
1621
1622LLVMValueRefLLVMConstString(constchar *Str,unsignedLength,
1623LLVMBool DontNullTerminate) {
1624returnLLVMConstStringInContext(LLVMGetGlobalContext(), Str,Length,
1625 DontNullTerminate);
1626}
1627
1628LLVMValueRefLLVMGetAggregateElement(LLVMValueRefC,unsignedIdx) {
1629returnwrap(unwrap<Constant>(C)->getAggregateElement(Idx));
1630}
1631
1632LLVMValueRefLLVMGetElementAsConstant(LLVMValueRefC,unsigned idx) {
1633returnwrap(unwrap<ConstantDataSequential>(C)->getElementAsConstant(idx));
1634}
1635
1636LLVMBoolLLVMIsConstantString(LLVMValueRefC) {
1637return unwrap<ConstantDataSequential>(C)->isString();
1638}
1639
1640constchar *LLVMGetAsString(LLVMValueRefC,size_t *Length) {
1641StringRef Str = unwrap<ConstantDataSequential>(C)->getAsString();
1642 *Length = Str.size();
1643return Str.data();
1644}
1645
1646LLVMValueRefLLVMConstArray(LLVMTypeRef ElementTy,
1647LLVMValueRef *ConstantVals,unsignedLength) {
1648ArrayRef<Constant*> V(unwrap<Constant>(ConstantVals,Length),Length);
1649returnwrap(ConstantArray::get(ArrayType::get(unwrap(ElementTy),Length), V));
1650}
1651
1652LLVMValueRefLLVMConstArray2(LLVMTypeRef ElementTy,LLVMValueRef *ConstantVals,
1653uint64_tLength) {
1654ArrayRef<Constant *> V(unwrap<Constant>(ConstantVals,Length),Length);
1655returnwrap(ConstantArray::get(ArrayType::get(unwrap(ElementTy),Length), V));
1656}
1657
1658LLVMValueRefLLVMConstStructInContext(LLVMContextRefC,
1659LLVMValueRef *ConstantVals,
1660unsigned Count,LLVMBool Packed) {
1661Constant **Elements = unwrap<Constant>(ConstantVals, Count);
1662returnwrap(ConstantStruct::getAnon(*unwrap(C),ArrayRef(Elements, Count),
1663 Packed != 0));
1664}
1665
1666LLVMValueRefLLVMConstStruct(LLVMValueRef *ConstantVals,unsigned Count,
1667LLVMBool Packed) {
1668returnLLVMConstStructInContext(LLVMGetGlobalContext(), ConstantVals, Count,
1669 Packed);
1670}
1671
1672LLVMValueRefLLVMConstNamedStruct(LLVMTypeRef StructTy,
1673LLVMValueRef *ConstantVals,
1674unsigned Count) {
1675Constant **Elements = unwrap<Constant>(ConstantVals, Count);
1676StructType *Ty = unwrap<StructType>(StructTy);
1677
1678returnwrap(ConstantStruct::get(Ty,ArrayRef(Elements, Count)));
1679}
1680
1681LLVMValueRefLLVMConstVector(LLVMValueRef *ScalarConstantVals,unsignedSize) {
1682returnwrap(ConstantVector::get(
1683ArrayRef(unwrap<Constant>(ScalarConstantVals,Size),Size)));
1684}
1685
1686LLVMValueRefLLVMConstantPtrAuth(LLVMValueRefPtr,LLVMValueRef Key,
1687LLVMValueRef Disc,LLVMValueRef AddrDisc) {
1688returnwrap(ConstantPtrAuth::get(
1689 unwrap<Constant>(Ptr), unwrap<ConstantInt>(Key),
1690 unwrap<ConstantInt>(Disc), unwrap<Constant>(AddrDisc)));
1691}
1692
1693/*-- Opcode mapping */
1694
1695staticLLVMOpcodemap_to_llvmopcode(int opcode)
1696{
1697switch (opcode) {
1698default:llvm_unreachable("Unhandled Opcode.");
1699#define HANDLE_INST(num, opc, clas) case num: return LLVM##opc;
1700#include "llvm/IR/Instruction.def"
1701#undef HANDLE_INST
1702 }
1703}
1704
1705staticintmap_from_llvmopcode(LLVMOpcode code)
1706{
1707switch (code) {
1708#define HANDLE_INST(num, opc, clas) case LLVM##opc: return num;
1709#include "llvm/IR/Instruction.def"
1710#undef HANDLE_INST
1711 }
1712llvm_unreachable("Unhandled Opcode.");
1713}
1714
1715/*-- GEP wrap flag conversions */
1716
1717staticGEPNoWrapFlagsmapFromLLVMGEPNoWrapFlags(LLVMGEPNoWrapFlags GEPFlags) {
1718GEPNoWrapFlags NewGEPFlags;
1719if ((GEPFlags &LLVMGEPFlagInBounds) != 0)
1720 NewGEPFlags |=GEPNoWrapFlags::inBounds();
1721if ((GEPFlags &LLVMGEPFlagNUSW) != 0)
1722 NewGEPFlags |=GEPNoWrapFlags::noUnsignedSignedWrap();
1723if ((GEPFlags &LLVMGEPFlagNUW) != 0)
1724 NewGEPFlags |=GEPNoWrapFlags::noUnsignedWrap();
1725
1726return NewGEPFlags;
1727}
1728
1729staticLLVMGEPNoWrapFlagsmapToLLVMGEPNoWrapFlags(GEPNoWrapFlags GEPFlags) {
1730LLVMGEPNoWrapFlags NewGEPFlags = 0;
1731if (GEPFlags.isInBounds())
1732 NewGEPFlags |=LLVMGEPFlagInBounds;
1733if (GEPFlags.hasNoUnsignedSignedWrap())
1734 NewGEPFlags |=LLVMGEPFlagNUSW;
1735if (GEPFlags.hasNoUnsignedWrap())
1736 NewGEPFlags |=LLVMGEPFlagNUW;
1737
1738return NewGEPFlags;
1739}
1740
1741/*--.. Constant expressions ................................................--*/
1742
1743LLVMOpcodeLLVMGetConstOpcode(LLVMValueRef ConstantVal) {
1744returnmap_to_llvmopcode(unwrap<ConstantExpr>(ConstantVal)->getOpcode());
1745}
1746
1747LLVMValueRefLLVMAlignOf(LLVMTypeRef Ty) {
1748returnwrap(ConstantExpr::getAlignOf(unwrap(Ty)));
1749}
1750
1751LLVMValueRefLLVMSizeOf(LLVMTypeRef Ty) {
1752returnwrap(ConstantExpr::getSizeOf(unwrap(Ty)));
1753}
1754
1755LLVMValueRefLLVMConstNeg(LLVMValueRef ConstantVal) {
1756returnwrap(ConstantExpr::getNeg(unwrap<Constant>(ConstantVal)));
1757}
1758
1759LLVMValueRefLLVMConstNSWNeg(LLVMValueRef ConstantVal) {
1760returnwrap(ConstantExpr::getNSWNeg(unwrap<Constant>(ConstantVal)));
1761}
1762
1763LLVMValueRefLLVMConstNUWNeg(LLVMValueRef ConstantVal) {
1764returnwrap(ConstantExpr::getNeg(unwrap<Constant>(ConstantVal)));
1765}
1766
1767
1768LLVMValueRefLLVMConstNot(LLVMValueRef ConstantVal) {
1769returnwrap(ConstantExpr::getNot(unwrap<Constant>(ConstantVal)));
1770}
1771
1772LLVMValueRefLLVMConstAdd(LLVMValueRef LHSConstant,LLVMValueRef RHSConstant) {
1773returnwrap(ConstantExpr::getAdd(unwrap<Constant>(LHSConstant),
1774 unwrap<Constant>(RHSConstant)));
1775}
1776
1777LLVMValueRefLLVMConstNSWAdd(LLVMValueRef LHSConstant,
1778LLVMValueRef RHSConstant) {
1779returnwrap(ConstantExpr::getNSWAdd(unwrap<Constant>(LHSConstant),
1780 unwrap<Constant>(RHSConstant)));
1781}
1782
1783LLVMValueRefLLVMConstNUWAdd(LLVMValueRef LHSConstant,
1784LLVMValueRef RHSConstant) {
1785returnwrap(ConstantExpr::getNUWAdd(unwrap<Constant>(LHSConstant),
1786 unwrap<Constant>(RHSConstant)));
1787}
1788
1789LLVMValueRefLLVMConstSub(LLVMValueRef LHSConstant,LLVMValueRef RHSConstant) {
1790returnwrap(ConstantExpr::getSub(unwrap<Constant>(LHSConstant),
1791 unwrap<Constant>(RHSConstant)));
1792}
1793
1794LLVMValueRefLLVMConstNSWSub(LLVMValueRef LHSConstant,
1795LLVMValueRef RHSConstant) {
1796returnwrap(ConstantExpr::getNSWSub(unwrap<Constant>(LHSConstant),
1797 unwrap<Constant>(RHSConstant)));
1798}
1799
1800LLVMValueRefLLVMConstNUWSub(LLVMValueRef LHSConstant,
1801LLVMValueRef RHSConstant) {
1802returnwrap(ConstantExpr::getNUWSub(unwrap<Constant>(LHSConstant),
1803 unwrap<Constant>(RHSConstant)));
1804}
1805
1806LLVMValueRefLLVMConstMul(LLVMValueRef LHSConstant,LLVMValueRef RHSConstant) {
1807returnwrap(ConstantExpr::getMul(unwrap<Constant>(LHSConstant),
1808 unwrap<Constant>(RHSConstant)));
1809}
1810
1811LLVMValueRefLLVMConstNSWMul(LLVMValueRef LHSConstant,
1812LLVMValueRef RHSConstant) {
1813returnwrap(ConstantExpr::getNSWMul(unwrap<Constant>(LHSConstant),
1814 unwrap<Constant>(RHSConstant)));
1815}
1816
1817LLVMValueRefLLVMConstNUWMul(LLVMValueRef LHSConstant,
1818LLVMValueRef RHSConstant) {
1819returnwrap(ConstantExpr::getNUWMul(unwrap<Constant>(LHSConstant),
1820 unwrap<Constant>(RHSConstant)));
1821}
1822
1823LLVMValueRefLLVMConstXor(LLVMValueRef LHSConstant,LLVMValueRef RHSConstant) {
1824returnwrap(ConstantExpr::getXor(unwrap<Constant>(LHSConstant),
1825 unwrap<Constant>(RHSConstant)));
1826}
1827
1828LLVMValueRefLLVMConstGEP2(LLVMTypeRef Ty,LLVMValueRef ConstantVal,
1829LLVMValueRef *ConstantIndices,unsigned NumIndices) {
1830ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1831 NumIndices);
1832Constant *Val = unwrap<Constant>(ConstantVal);
1833returnwrap(ConstantExpr::getGetElementPtr(unwrap(Ty), Val, IdxList));
1834}
1835
1836LLVMValueRefLLVMConstInBoundsGEP2(LLVMTypeRef Ty,LLVMValueRef ConstantVal,
1837LLVMValueRef *ConstantIndices,
1838unsigned NumIndices) {
1839ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1840 NumIndices);
1841Constant *Val = unwrap<Constant>(ConstantVal);
1842returnwrap(ConstantExpr::getInBoundsGetElementPtr(unwrap(Ty), Val, IdxList));
1843}
1844
1845LLVMValueRefLLVMConstGEPWithNoWrapFlags(LLVMTypeRef Ty,
1846LLVMValueRef ConstantVal,
1847LLVMValueRef *ConstantIndices,
1848unsigned NumIndices,
1849LLVMGEPNoWrapFlags NoWrapFlags) {
1850ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1851 NumIndices);
1852Constant *Val = unwrap<Constant>(ConstantVal);
1853returnwrap(ConstantExpr::getGetElementPtr(
1854unwrap(Ty), Val, IdxList,mapFromLLVMGEPNoWrapFlags(NoWrapFlags)));
1855}
1856
1857LLVMValueRefLLVMConstTrunc(LLVMValueRef ConstantVal,LLVMTypeRef ToType) {
1858returnwrap(ConstantExpr::getTrunc(unwrap<Constant>(ConstantVal),
1859unwrap(ToType)));
1860}
1861
1862LLVMValueRefLLVMConstPtrToInt(LLVMValueRef ConstantVal,LLVMTypeRef ToType) {
1863returnwrap(ConstantExpr::getPtrToInt(unwrap<Constant>(ConstantVal),
1864unwrap(ToType)));
1865}
1866
1867LLVMValueRefLLVMConstIntToPtr(LLVMValueRef ConstantVal,LLVMTypeRef ToType) {
1868returnwrap(ConstantExpr::getIntToPtr(unwrap<Constant>(ConstantVal),
1869unwrap(ToType)));
1870}
1871
1872LLVMValueRefLLVMConstBitCast(LLVMValueRef ConstantVal,LLVMTypeRef ToType) {
1873returnwrap(ConstantExpr::getBitCast(unwrap<Constant>(ConstantVal),
1874unwrap(ToType)));
1875}
1876
1877LLVMValueRefLLVMConstAddrSpaceCast(LLVMValueRef ConstantVal,
1878LLVMTypeRef ToType) {
1879returnwrap(ConstantExpr::getAddrSpaceCast(unwrap<Constant>(ConstantVal),
1880unwrap(ToType)));
1881}
1882
1883LLVMValueRefLLVMConstTruncOrBitCast(LLVMValueRef ConstantVal,
1884LLVMTypeRef ToType) {
1885returnwrap(ConstantExpr::getTruncOrBitCast(unwrap<Constant>(ConstantVal),
1886unwrap(ToType)));
1887}
1888
1889LLVMValueRefLLVMConstPointerCast(LLVMValueRef ConstantVal,
1890LLVMTypeRef ToType) {
1891returnwrap(ConstantExpr::getPointerCast(unwrap<Constant>(ConstantVal),
1892unwrap(ToType)));
1893}
1894
1895LLVMValueRefLLVMConstExtractElement(LLVMValueRef VectorConstant,
1896LLVMValueRef IndexConstant) {
1897returnwrap(ConstantExpr::getExtractElement(unwrap<Constant>(VectorConstant),
1898 unwrap<Constant>(IndexConstant)));
1899}
1900
1901LLVMValueRefLLVMConstInsertElement(LLVMValueRef VectorConstant,
1902LLVMValueRef ElementValueConstant,
1903LLVMValueRef IndexConstant) {
1904returnwrap(ConstantExpr::getInsertElement(unwrap<Constant>(VectorConstant),
1905 unwrap<Constant>(ElementValueConstant),
1906 unwrap<Constant>(IndexConstant)));
1907}
1908
1909LLVMValueRefLLVMConstShuffleVector(LLVMValueRef VectorAConstant,
1910LLVMValueRef VectorBConstant,
1911LLVMValueRef MaskConstant) {
1912SmallVector<int, 16> IntMask;
1913ShuffleVectorInst::getShuffleMask(unwrap<Constant>(MaskConstant), IntMask);
1914returnwrap(ConstantExpr::getShuffleVector(unwrap<Constant>(VectorAConstant),
1915 unwrap<Constant>(VectorBConstant),
1916 IntMask));
1917}
1918
1919LLVMValueRefLLVMConstInlineAsm(LLVMTypeRef Ty,constchar *AsmString,
1920constchar *Constraints,
1921LLVMBool HasSideEffects,
1922LLVMBool IsAlignStack) {
1923returnwrap(InlineAsm::get(dyn_cast<FunctionType>(unwrap(Ty)), AsmString,
1924 Constraints, HasSideEffects, IsAlignStack));
1925}
1926
1927LLVMValueRefLLVMBlockAddress(LLVMValueRefF,LLVMBasicBlockRef BB) {
1928returnwrap(BlockAddress::get(unwrap<Function>(F),unwrap(BB)));
1929}
1930
1931LLVMValueRefLLVMGetBlockAddressFunction(LLVMValueRef BlockAddr) {
1932returnwrap(unwrap<BlockAddress>(BlockAddr)->getFunction());
1933}
1934
1935LLVMBasicBlockRefLLVMGetBlockAddressBasicBlock(LLVMValueRef BlockAddr) {
1936returnwrap(unwrap<BlockAddress>(BlockAddr)->getBasicBlock());
1937}
1938
1939/*--.. Operations on global variables, functions, and aliases (globals) ....--*/
1940
1941LLVMModuleRefLLVMGetGlobalParent(LLVMValueRefGlobal) {
1942returnwrap(unwrap<GlobalValue>(Global)->getParent());
1943}
1944
1945LLVMBoolLLVMIsDeclaration(LLVMValueRefGlobal) {
1946return unwrap<GlobalValue>(Global)->isDeclaration();
1947}
1948
1949LLVMLinkageLLVMGetLinkage(LLVMValueRefGlobal) {
1950switch (unwrap<GlobalValue>(Global)->getLinkage()) {
1951caseGlobalValue::ExternalLinkage:
1952returnLLVMExternalLinkage;
1953caseGlobalValue::AvailableExternallyLinkage:
1954returnLLVMAvailableExternallyLinkage;
1955caseGlobalValue::LinkOnceAnyLinkage:
1956returnLLVMLinkOnceAnyLinkage;
1957caseGlobalValue::LinkOnceODRLinkage:
1958returnLLVMLinkOnceODRLinkage;
1959caseGlobalValue::WeakAnyLinkage:
1960returnLLVMWeakAnyLinkage;
1961caseGlobalValue::WeakODRLinkage:
1962returnLLVMWeakODRLinkage;
1963caseGlobalValue::AppendingLinkage:
1964returnLLVMAppendingLinkage;
1965caseGlobalValue::InternalLinkage:
1966returnLLVMInternalLinkage;
1967caseGlobalValue::PrivateLinkage:
1968returnLLVMPrivateLinkage;
1969caseGlobalValue::ExternalWeakLinkage:
1970returnLLVMExternalWeakLinkage;
1971caseGlobalValue::CommonLinkage:
1972returnLLVMCommonLinkage;
1973 }
1974
1975llvm_unreachable("Invalid GlobalValue linkage!");
1976}
1977
1978voidLLVMSetLinkage(LLVMValueRefGlobal,LLVMLinkage Linkage) {
1979GlobalValue *GV = unwrap<GlobalValue>(Global);
1980
1981switch (Linkage) {
1982caseLLVMExternalLinkage:
1983 GV->setLinkage(GlobalValue::ExternalLinkage);
1984break;
1985caseLLVMAvailableExternallyLinkage:
1986 GV->setLinkage(GlobalValue::AvailableExternallyLinkage);
1987break;
1988caseLLVMLinkOnceAnyLinkage:
1989 GV->setLinkage(GlobalValue::LinkOnceAnyLinkage);
1990break;
1991caseLLVMLinkOnceODRLinkage:
1992 GV->setLinkage(GlobalValue::LinkOnceODRLinkage);
1993break;
1994caseLLVMLinkOnceODRAutoHideLinkage:
1995LLVM_DEBUG(
1996errs() <<"LLVMSetLinkage(): LLVMLinkOnceODRAutoHideLinkage is no "
1997"longer supported.");
1998break;
1999caseLLVMWeakAnyLinkage:
2000 GV->setLinkage(GlobalValue::WeakAnyLinkage);
2001break;
2002caseLLVMWeakODRLinkage:
2003 GV->setLinkage(GlobalValue::WeakODRLinkage);
2004break;
2005caseLLVMAppendingLinkage:
2006 GV->setLinkage(GlobalValue::AppendingLinkage);
2007break;
2008caseLLVMInternalLinkage:
2009 GV->setLinkage(GlobalValue::InternalLinkage);
2010break;
2011caseLLVMPrivateLinkage:
2012 GV->setLinkage(GlobalValue::PrivateLinkage);
2013break;
2014caseLLVMLinkerPrivateLinkage:
2015 GV->setLinkage(GlobalValue::PrivateLinkage);
2016break;
2017caseLLVMLinkerPrivateWeakLinkage:
2018 GV->setLinkage(GlobalValue::PrivateLinkage);
2019break;
2020caseLLVMDLLImportLinkage:
2021LLVM_DEBUG(
2022errs()
2023 <<"LLVMSetLinkage(): LLVMDLLImportLinkage is no longer supported.");
2024break;
2025caseLLVMDLLExportLinkage:
2026LLVM_DEBUG(
2027errs()
2028 <<"LLVMSetLinkage(): LLVMDLLExportLinkage is no longer supported.");
2029break;
2030caseLLVMExternalWeakLinkage:
2031 GV->setLinkage(GlobalValue::ExternalWeakLinkage);
2032break;
2033caseLLVMGhostLinkage:
2034LLVM_DEBUG(
2035errs() <<"LLVMSetLinkage(): LLVMGhostLinkage is no longer supported.");
2036break;
2037caseLLVMCommonLinkage:
2038 GV->setLinkage(GlobalValue::CommonLinkage);
2039break;
2040 }
2041}
2042
2043constchar *LLVMGetSection(LLVMValueRefGlobal) {
2044// Using .data() is safe because of how GlobalObject::setSection is
2045// implemented.
2046return unwrap<GlobalValue>(Global)->getSection().data();
2047}
2048
2049voidLLVMSetSection(LLVMValueRefGlobal,constchar *Section) {
2050 unwrap<GlobalObject>(Global)->setSection(Section);
2051}
2052
2053LLVMVisibilityLLVMGetVisibility(LLVMValueRefGlobal) {
2054returnstatic_cast<LLVMVisibility>(
2055 unwrap<GlobalValue>(Global)->getVisibility());
2056}
2057
2058voidLLVMSetVisibility(LLVMValueRefGlobal,LLVMVisibility Viz) {
2059 unwrap<GlobalValue>(Global)
2060 ->setVisibility(static_cast<GlobalValue::VisibilityTypes>(Viz));
2061}
2062
2063LLVMDLLStorageClassLLVMGetDLLStorageClass(LLVMValueRefGlobal) {
2064returnstatic_cast<LLVMDLLStorageClass>(
2065 unwrap<GlobalValue>(Global)->getDLLStorageClass());
2066}
2067
2068voidLLVMSetDLLStorageClass(LLVMValueRefGlobal,LLVMDLLStorageClass Class) {
2069 unwrap<GlobalValue>(Global)->setDLLStorageClass(
2070static_cast<GlobalValue::DLLStorageClassTypes>(Class));
2071}
2072
2073LLVMUnnamedAddrLLVMGetUnnamedAddress(LLVMValueRefGlobal) {
2074switch (unwrap<GlobalValue>(Global)->getUnnamedAddr()) {
2075case GlobalVariable::UnnamedAddr::None:
2076returnLLVMNoUnnamedAddr;
2077case GlobalVariable::UnnamedAddr::Local:
2078returnLLVMLocalUnnamedAddr;
2079case GlobalVariable::UnnamedAddr::Global:
2080returnLLVMGlobalUnnamedAddr;
2081 }
2082llvm_unreachable("Unknown UnnamedAddr kind!");
2083}
2084
2085voidLLVMSetUnnamedAddress(LLVMValueRefGlobal,LLVMUnnamedAddr UnnamedAddr) {
2086GlobalValue *GV = unwrap<GlobalValue>(Global);
2087
2088switch (UnnamedAddr) {
2089caseLLVMNoUnnamedAddr:
2090return GV->setUnnamedAddr(GlobalVariable::UnnamedAddr::None);
2091caseLLVMLocalUnnamedAddr:
2092return GV->setUnnamedAddr(GlobalVariable::UnnamedAddr::Local);
2093caseLLVMGlobalUnnamedAddr:
2094return GV->setUnnamedAddr(GlobalVariable::UnnamedAddr::Global);
2095 }
2096}
2097
2098LLVMBoolLLVMHasUnnamedAddr(LLVMValueRefGlobal) {
2099return unwrap<GlobalValue>(Global)->hasGlobalUnnamedAddr();
2100}
2101
2102voidLLVMSetUnnamedAddr(LLVMValueRefGlobal,LLVMBool HasUnnamedAddr) {
2103 unwrap<GlobalValue>(Global)->setUnnamedAddr(
2104 HasUnnamedAddr ? GlobalValue::UnnamedAddr::Global
2105 : GlobalValue::UnnamedAddr::None);
2106}
2107
2108LLVMTypeRefLLVMGlobalGetValueType(LLVMValueRefGlobal) {
2109returnwrap(unwrap<GlobalValue>(Global)->getValueType());
2110}
2111
2112/*--.. Operations on global variables, load and store instructions .........--*/
2113
2114unsignedLLVMGetAlignment(LLVMValueRef V) {
2115Value *P =unwrap(V);
2116if (GlobalObject *GV = dyn_cast<GlobalObject>(P))
2117return GV->getAlign() ? GV->getAlign()->value() : 0;
2118if (AllocaInst *AI = dyn_cast<AllocaInst>(P))
2119return AI->getAlign().value();
2120if (LoadInst *LI = dyn_cast<LoadInst>(P))
2121return LI->getAlign().value();
2122if (StoreInst *SI = dyn_cast<StoreInst>(P))
2123return SI->getAlign().value();
2124if (AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(P))
2125return RMWI->getAlign().value();
2126if (AtomicCmpXchgInst *CXI = dyn_cast<AtomicCmpXchgInst>(P))
2127return CXI->getAlign().value();
2128
2129llvm_unreachable(
2130"only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, "
2131"and AtomicCmpXchgInst have alignment");
2132}
2133
2134voidLLVMSetAlignment(LLVMValueRef V,unsigned Bytes) {
2135Value *P =unwrap(V);
2136if (GlobalObject *GV = dyn_cast<GlobalObject>(P))
2137 GV->setAlignment(MaybeAlign(Bytes));
2138elseif (AllocaInst *AI = dyn_cast<AllocaInst>(P))
2139 AI->setAlignment(Align(Bytes));
2140elseif (LoadInst *LI = dyn_cast<LoadInst>(P))
2141 LI->setAlignment(Align(Bytes));
2142elseif (StoreInst *SI = dyn_cast<StoreInst>(P))
2143 SI->setAlignment(Align(Bytes));
2144elseif (AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(P))
2145 RMWI->setAlignment(Align(Bytes));
2146elseif (AtomicCmpXchgInst *CXI = dyn_cast<AtomicCmpXchgInst>(P))
2147 CXI->setAlignment(Align(Bytes));
2148else
2149llvm_unreachable(
2150"only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, and "
2151"and AtomicCmpXchgInst have alignment");
2152}
2153
2154LLVMValueMetadataEntry *LLVMGlobalCopyAllMetadata(LLVMValueRefValue,
2155size_t *NumEntries) {
2156returnllvm_getMetadata(NumEntries, [&Value](MetadataEntries &Entries) {
2157 Entries.clear();
2158if (Instruction *Instr = dyn_cast<Instruction>(unwrap(Value))) {
2159 Instr->getAllMetadata(Entries);
2160 }else {
2161 unwrap<GlobalObject>(Value)->getAllMetadata(Entries);
2162 }
2163 });
2164}
2165
2166unsignedLLVMValueMetadataEntriesGetKind(LLVMValueMetadataEntry *Entries,
2167unsigned Index) {
2168LLVMOpaqueValueMetadataEntry MVE =
2169static_cast<LLVMOpaqueValueMetadataEntry>(Entries[Index]);
2170return MVE.Kind;
2171}
2172
2173LLVMMetadataRef
2174LLVMValueMetadataEntriesGetMetadata(LLVMValueMetadataEntry *Entries,
2175unsigned Index) {
2176LLVMOpaqueValueMetadataEntry MVE =
2177static_cast<LLVMOpaqueValueMetadataEntry>(Entries[Index]);
2178return MVE.Metadata;
2179}
2180
2181voidLLVMDisposeValueMetadataEntries(LLVMValueMetadataEntry *Entries) {
2182 free(Entries);
2183}
2184
2185voidLLVMGlobalSetMetadata(LLVMValueRefGlobal,unsigned Kind,
2186LLVMMetadataRef MD) {
2187 unwrap<GlobalObject>(Global)->setMetadata(Kind, unwrap<MDNode>(MD));
2188}
2189
2190voidLLVMGlobalEraseMetadata(LLVMValueRefGlobal,unsigned Kind) {
2191 unwrap<GlobalObject>(Global)->eraseMetadata(Kind);
2192}
2193
2194voidLLVMGlobalClearMetadata(LLVMValueRefGlobal) {
2195 unwrap<GlobalObject>(Global)->clearMetadata();
2196}
2197
2198/*--.. Operations on global variables ......................................--*/
2199
2200LLVMValueRefLLVMAddGlobal(LLVMModuleRef M,LLVMTypeRef Ty,constchar *Name) {
2201returnwrap(newGlobalVariable(*unwrap(M),unwrap(Ty),false,
2202GlobalValue::ExternalLinkage,nullptr,Name));
2203}
2204
2205LLVMValueRefLLVMAddGlobalInAddressSpace(LLVMModuleRef M,LLVMTypeRef Ty,
2206constchar *Name,
2207unsignedAddressSpace) {
2208returnwrap(newGlobalVariable(*unwrap(M),unwrap(Ty),false,
2209GlobalValue::ExternalLinkage,nullptr,Name,
2210nullptr, GlobalVariable::NotThreadLocal,
2211AddressSpace));
2212}
2213
2214LLVMValueRefLLVMGetNamedGlobal(LLVMModuleRef M,constchar *Name) {
2215returnwrap(unwrap(M)->getNamedGlobal(Name));
2216}
2217
2218LLVMValueRefLLVMGetNamedGlobalWithLength(LLVMModuleRef M,constchar *Name,
2219size_tLength) {
2220returnwrap(unwrap(M)->getNamedGlobal(StringRef(Name,Length)));
2221}
2222
2223LLVMValueRefLLVMGetFirstGlobal(LLVMModuleRef M) {
2224Module *Mod =unwrap(M);
2225Module::global_iteratorI =Mod->global_begin();
2226if (I ==Mod->global_end())
2227returnnullptr;
2228returnwrap(&*I);
2229}
2230
2231LLVMValueRefLLVMGetLastGlobal(LLVMModuleRef M) {
2232Module *Mod =unwrap(M);
2233Module::global_iteratorI =Mod->global_end();
2234if (I ==Mod->global_begin())
2235returnnullptr;
2236returnwrap(&*--I);
2237}
2238
2239LLVMValueRefLLVMGetNextGlobal(LLVMValueRef GlobalVar) {
2240GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2241Module::global_iteratorI(GV);
2242if (++I == GV->getParent()->global_end())
2243returnnullptr;
2244returnwrap(&*I);
2245}
2246
2247LLVMValueRefLLVMGetPreviousGlobal(LLVMValueRef GlobalVar) {
2248GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2249Module::global_iteratorI(GV);
2250if (I == GV->getParent()->global_begin())
2251returnnullptr;
2252returnwrap(&*--I);
2253}
2254
2255voidLLVMDeleteGlobal(LLVMValueRef GlobalVar) {
2256 unwrap<GlobalVariable>(GlobalVar)->eraseFromParent();
2257}
2258
2259LLVMValueRefLLVMGetInitializer(LLVMValueRef GlobalVar) {
2260GlobalVariable* GV = unwrap<GlobalVariable>(GlobalVar);
2261if ( !GV->hasInitializer() )
2262returnnullptr;
2263returnwrap(GV->getInitializer());
2264}
2265
2266voidLLVMSetInitializer(LLVMValueRef GlobalVar,LLVMValueRef ConstantVal) {
2267 unwrap<GlobalVariable>(GlobalVar)->setInitializer(
2268 ConstantVal ? unwrap<Constant>(ConstantVal) :nullptr);
2269}
2270
2271LLVMBoolLLVMIsThreadLocal(LLVMValueRef GlobalVar) {
2272return unwrap<GlobalVariable>(GlobalVar)->isThreadLocal();
2273}
2274
2275voidLLVMSetThreadLocal(LLVMValueRef GlobalVar,LLVMBool IsThreadLocal) {
2276 unwrap<GlobalVariable>(GlobalVar)->setThreadLocal(IsThreadLocal != 0);
2277}
2278
2279LLVMBoolLLVMIsGlobalConstant(LLVMValueRef GlobalVar) {
2280return unwrap<GlobalVariable>(GlobalVar)->isConstant();
2281}
2282
2283voidLLVMSetGlobalConstant(LLVMValueRef GlobalVar,LLVMBool IsConstant) {
2284 unwrap<GlobalVariable>(GlobalVar)->setConstant(IsConstant != 0);
2285}
2286
2287LLVMThreadLocalModeLLVMGetThreadLocalMode(LLVMValueRef GlobalVar) {
2288switch (unwrap<GlobalVariable>(GlobalVar)->getThreadLocalMode()) {
2289case GlobalVariable::NotThreadLocal:
2290returnLLVMNotThreadLocal;
2291case GlobalVariable::GeneralDynamicTLSModel:
2292returnLLVMGeneralDynamicTLSModel;
2293case GlobalVariable::LocalDynamicTLSModel:
2294returnLLVMLocalDynamicTLSModel;
2295case GlobalVariable::InitialExecTLSModel:
2296returnLLVMInitialExecTLSModel;
2297case GlobalVariable::LocalExecTLSModel:
2298returnLLVMLocalExecTLSModel;
2299 }
2300
2301llvm_unreachable("Invalid GlobalVariable thread local mode");
2302}
2303
2304voidLLVMSetThreadLocalMode(LLVMValueRef GlobalVar,LLVMThreadLocalMode Mode) {
2305GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2306
2307switch (Mode) {
2308caseLLVMNotThreadLocal:
2309 GV->setThreadLocalMode(GlobalVariable::NotThreadLocal);
2310break;
2311caseLLVMGeneralDynamicTLSModel:
2312 GV->setThreadLocalMode(GlobalVariable::GeneralDynamicTLSModel);
2313break;
2314caseLLVMLocalDynamicTLSModel:
2315 GV->setThreadLocalMode(GlobalVariable::LocalDynamicTLSModel);
2316break;
2317caseLLVMInitialExecTLSModel:
2318 GV->setThreadLocalMode(GlobalVariable::InitialExecTLSModel);
2319break;
2320caseLLVMLocalExecTLSModel:
2321 GV->setThreadLocalMode(GlobalVariable::LocalExecTLSModel);
2322break;
2323 }
2324}
2325
2326LLVMBoolLLVMIsExternallyInitialized(LLVMValueRef GlobalVar) {
2327return unwrap<GlobalVariable>(GlobalVar)->isExternallyInitialized();
2328}
2329
2330voidLLVMSetExternallyInitialized(LLVMValueRef GlobalVar,LLVMBool IsExtInit) {
2331 unwrap<GlobalVariable>(GlobalVar)->setExternallyInitialized(IsExtInit);
2332}
2333
2334/*--.. Operations on aliases ......................................--*/
2335
2336LLVMValueRefLLVMAddAlias2(LLVMModuleRef M,LLVMTypeRef ValueTy,
2337unsigned AddrSpace,LLVMValueRef Aliasee,
2338constchar *Name) {
2339returnwrap(GlobalAlias::create(unwrap(ValueTy), AddrSpace,
2340GlobalValue::ExternalLinkage,Name,
2341 unwrap<Constant>(Aliasee),unwrap(M)));
2342}
2343
2344LLVMValueRefLLVMGetNamedGlobalAlias(LLVMModuleRef M,
2345constchar *Name,size_t NameLen) {
2346returnwrap(unwrap(M)->getNamedAlias(StringRef(Name, NameLen)));
2347}
2348
2349LLVMValueRefLLVMGetFirstGlobalAlias(LLVMModuleRef M) {
2350Module *Mod =unwrap(M);
2351Module::alias_iteratorI =Mod->alias_begin();
2352if (I ==Mod->alias_end())
2353returnnullptr;
2354returnwrap(&*I);
2355}
2356
2357LLVMValueRefLLVMGetLastGlobalAlias(LLVMModuleRef M) {
2358Module *Mod =unwrap(M);
2359Module::alias_iteratorI =Mod->alias_end();
2360if (I ==Mod->alias_begin())
2361returnnullptr;
2362returnwrap(&*--I);
2363}
2364
2365LLVMValueRefLLVMGetNextGlobalAlias(LLVMValueRef GA) {
2366GlobalAlias *Alias = unwrap<GlobalAlias>(GA);
2367Module::alias_iteratorI(Alias);
2368if (++I == Alias->getParent()->alias_end())
2369returnnullptr;
2370returnwrap(&*I);
2371}
2372
2373LLVMValueRefLLVMGetPreviousGlobalAlias(LLVMValueRef GA) {
2374GlobalAlias *Alias = unwrap<GlobalAlias>(GA);
2375Module::alias_iteratorI(Alias);
2376if (I == Alias->getParent()->alias_begin())
2377returnnullptr;
2378returnwrap(&*--I);
2379}
2380
2381LLVMValueRefLLVMAliasGetAliasee(LLVMValueRef Alias) {
2382returnwrap(unwrap<GlobalAlias>(Alias)->getAliasee());
2383}
2384
2385voidLLVMAliasSetAliasee(LLVMValueRef Alias,LLVMValueRef Aliasee) {
2386 unwrap<GlobalAlias>(Alias)->setAliasee(unwrap<Constant>(Aliasee));
2387}
2388
2389/*--.. Operations on functions .............................................--*/
2390
2391LLVMValueRefLLVMAddFunction(LLVMModuleRef M,constchar *Name,
2392LLVMTypeRef FunctionTy) {
2393returnwrap(Function::Create(unwrap<FunctionType>(FunctionTy),
2394GlobalValue::ExternalLinkage,Name,unwrap(M)));
2395}
2396
2397LLVMValueRefLLVMGetNamedFunction(LLVMModuleRef M,constchar *Name) {
2398returnwrap(unwrap(M)->getFunction(Name));
2399}
2400
2401LLVMValueRefLLVMGetNamedFunctionWithLength(LLVMModuleRef M,constchar *Name,
2402size_tLength) {
2403returnwrap(unwrap(M)->getFunction(StringRef(Name,Length)));
2404}
2405
2406LLVMValueRefLLVMGetFirstFunction(LLVMModuleRef M) {
2407Module *Mod =unwrap(M);
2408Module::iteratorI =Mod->begin();
2409if (I ==Mod->end())
2410returnnullptr;
2411returnwrap(&*I);
2412}
2413
2414LLVMValueRefLLVMGetLastFunction(LLVMModuleRef M) {
2415Module *Mod =unwrap(M);
2416Module::iteratorI =Mod->end();
2417if (I ==Mod->begin())
2418returnnullptr;
2419returnwrap(&*--I);
2420}
2421
2422LLVMValueRefLLVMGetNextFunction(LLVMValueRef Fn) {
2423Function *Func = unwrap<Function>(Fn);
2424Module::iteratorI(Func);
2425if (++I == Func->getParent()->end())
2426returnnullptr;
2427returnwrap(&*I);
2428}
2429
2430LLVMValueRefLLVMGetPreviousFunction(LLVMValueRef Fn) {
2431Function *Func = unwrap<Function>(Fn);
2432Module::iteratorI(Func);
2433if (I == Func->getParent()->begin())
2434returnnullptr;
2435returnwrap(&*--I);
2436}
2437
2438voidLLVMDeleteFunction(LLVMValueRef Fn) {
2439 unwrap<Function>(Fn)->eraseFromParent();
2440}
2441
2442LLVMBoolLLVMHasPersonalityFn(LLVMValueRef Fn) {
2443return unwrap<Function>(Fn)->hasPersonalityFn();
2444}
2445
2446LLVMValueRefLLVMGetPersonalityFn(LLVMValueRef Fn) {
2447returnwrap(unwrap<Function>(Fn)->getPersonalityFn());
2448}
2449
2450voidLLVMSetPersonalityFn(LLVMValueRef Fn,LLVMValueRef PersonalityFn) {
2451 unwrap<Function>(Fn)->setPersonalityFn(
2452 PersonalityFn ? unwrap<Constant>(PersonalityFn) :nullptr);
2453}
2454
2455unsignedLLVMGetIntrinsicID(LLVMValueRef Fn) {
2456if (Function *F = dyn_cast<Function>(unwrap(Fn)))
2457returnF->getIntrinsicID();
2458return 0;
2459}
2460
2461staticIntrinsic::IDllvm_map_to_intrinsic_id(unsignedID) {
2462assert(ID < llvm::Intrinsic::num_intrinsics &&"Intrinsic ID out of range");
2463returnllvm::Intrinsic::ID(ID);
2464}
2465
2466LLVMValueRefLLVMGetIntrinsicDeclaration(LLVMModuleRefMod,
2467unsignedID,
2468LLVMTypeRef *ParamTypes,
2469size_t ParamCount) {
2470ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
2471auto IID =llvm_map_to_intrinsic_id(ID);
2472returnwrap(llvm::Intrinsic::getOrInsertDeclaration(unwrap(Mod), IID, Tys));
2473}
2474
2475constchar *LLVMIntrinsicGetName(unsignedID,size_t *NameLength) {
2476auto IID =llvm_map_to_intrinsic_id(ID);
2477auto Str =llvm::Intrinsic::getName(IID);
2478 *NameLength = Str.size();
2479return Str.data();
2480}
2481
2482LLVMTypeRefLLVMIntrinsicGetType(LLVMContextRef Ctx,unsignedID,
2483LLVMTypeRef *ParamTypes,size_t ParamCount) {
2484auto IID =llvm_map_to_intrinsic_id(ID);
2485ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
2486returnwrap(llvm::Intrinsic::getType(*unwrap(Ctx), IID, Tys));
2487}
2488
2489char *LLVMIntrinsicCopyOverloadedName(unsignedID,LLVMTypeRef *ParamTypes,
2490size_t ParamCount,size_t *NameLength) {
2491auto IID =llvm_map_to_intrinsic_id(ID);
2492ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
2493auto Str =llvm::Intrinsic::getNameNoUnnamedTypes(IID, Tys);
2494 *NameLength = Str.length();
2495return strdup(Str.c_str());
2496}
2497
2498char *LLVMIntrinsicCopyOverloadedName2(LLVMModuleRefMod,unsignedID,
2499LLVMTypeRef *ParamTypes,
2500size_t ParamCount,size_t *NameLength) {
2501auto IID =llvm_map_to_intrinsic_id(ID);
2502ArrayRef<Type *> Tys(unwrap(ParamTypes), ParamCount);
2503auto Str =llvm::Intrinsic::getName(IID, Tys,unwrap(Mod));
2504 *NameLength = Str.length();
2505return strdup(Str.c_str());
2506}
2507
2508unsignedLLVMLookupIntrinsicID(constchar *Name,size_t NameLen) {
2509returnIntrinsic::lookupIntrinsicID({Name, NameLen});
2510}
2511
2512LLVMBoolLLVMIntrinsicIsOverloaded(unsignedID) {
2513auto IID =llvm_map_to_intrinsic_id(ID);
2514returnllvm::Intrinsic::isOverloaded(IID);
2515}
2516
2517unsignedLLVMGetFunctionCallConv(LLVMValueRef Fn) {
2518return unwrap<Function>(Fn)->getCallingConv();
2519}
2520
2521voidLLVMSetFunctionCallConv(LLVMValueRef Fn,unsignedCC) {
2522return unwrap<Function>(Fn)->setCallingConv(
2523static_cast<CallingConv::ID>(CC));
2524}
2525
2526constchar *LLVMGetGC(LLVMValueRef Fn) {
2527Function *F = unwrap<Function>(Fn);
2528returnF->hasGC()?F->getGC().c_str() :nullptr;
2529}
2530
2531voidLLVMSetGC(LLVMValueRef Fn,constchar *GC) {
2532Function *F = unwrap<Function>(Fn);
2533if (GC)
2534F->setGC(GC);
2535else
2536F->clearGC();
2537}
2538
2539LLVMValueRefLLVMGetPrefixData(LLVMValueRef Fn) {
2540Function *F = unwrap<Function>(Fn);
2541returnwrap(F->getPrefixData());
2542}
2543
2544LLVMBoolLLVMHasPrefixData(LLVMValueRef Fn) {
2545Function *F = unwrap<Function>(Fn);
2546returnF->hasPrefixData();
2547}
2548
2549voidLLVMSetPrefixData(LLVMValueRef Fn,LLVMValueRef prefixData) {
2550Function *F = unwrap<Function>(Fn);
2551Constant *prefix = unwrap<Constant>(prefixData);
2552F->setPrefixData(prefix);
2553}
2554
2555LLVMValueRefLLVMGetPrologueData(LLVMValueRef Fn) {
2556Function *F = unwrap<Function>(Fn);
2557returnwrap(F->getPrologueData());
2558}
2559
2560LLVMBoolLLVMHasPrologueData(LLVMValueRef Fn) {
2561Function *F = unwrap<Function>(Fn);
2562returnF->hasPrologueData();
2563}
2564
2565voidLLVMSetPrologueData(LLVMValueRef Fn,LLVMValueRef prologueData) {
2566Function *F = unwrap<Function>(Fn);
2567Constant *prologue = unwrap<Constant>(prologueData);
2568F->setPrologueData(prologue);
2569}
2570
2571voidLLVMAddAttributeAtIndex(LLVMValueRefF,LLVMAttributeIndexIdx,
2572LLVMAttributeRefA) {
2573 unwrap<Function>(F)->addAttributeAtIndex(Idx,unwrap(A));
2574}
2575
2576unsignedLLVMGetAttributeCountAtIndex(LLVMValueRefF,LLVMAttributeIndexIdx) {
2577auto AS = unwrap<Function>(F)->getAttributes().getAttributes(Idx);
2578return AS.getNumAttributes();
2579}
2580
2581voidLLVMGetAttributesAtIndex(LLVMValueRefF,LLVMAttributeIndexIdx,
2582LLVMAttributeRef *Attrs) {
2583auto AS = unwrap<Function>(F)->getAttributes().getAttributes(Idx);
2584for (autoA : AS)
2585 *Attrs++ =wrap(A);
2586}
2587
2588LLVMAttributeRefLLVMGetEnumAttributeAtIndex(LLVMValueRefF,
2589LLVMAttributeIndexIdx,
2590unsigned KindID) {
2591returnwrap(unwrap<Function>(F)->getAttributeAtIndex(
2592Idx, (Attribute::AttrKind)KindID));
2593}
2594
2595LLVMAttributeRefLLVMGetStringAttributeAtIndex(LLVMValueRefF,
2596LLVMAttributeIndexIdx,
2597constchar *K,unsigned KLen) {
2598returnwrap(
2599 unwrap<Function>(F)->getAttributeAtIndex(Idx,StringRef(K, KLen)));
2600}
2601
2602voidLLVMRemoveEnumAttributeAtIndex(LLVMValueRefF,LLVMAttributeIndexIdx,
2603unsigned KindID) {
2604 unwrap<Function>(F)->removeAttributeAtIndex(Idx, (Attribute::AttrKind)KindID);
2605}
2606
2607voidLLVMRemoveStringAttributeAtIndex(LLVMValueRefF,LLVMAttributeIndexIdx,
2608constchar *K,unsigned KLen) {
2609 unwrap<Function>(F)->removeAttributeAtIndex(Idx,StringRef(K, KLen));
2610}
2611
2612voidLLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn,constchar *A,
2613constchar *V) {
2614Function *Func = unwrap<Function>(Fn);
2615Attribute Attr =Attribute::get(Func->getContext(),A, V);
2616 Func->addFnAttr(Attr);
2617}
2618
2619/*--.. Operations on parameters ............................................--*/
2620
2621unsignedLLVMCountParams(LLVMValueRef FnRef) {
2622// This function is strictly redundant to
2623// LLVMCountParamTypes(LLVMGlobalGetValueType(FnRef))
2624return unwrap<Function>(FnRef)->arg_size();
2625}
2626
2627voidLLVMGetParams(LLVMValueRef FnRef,LLVMValueRef *ParamRefs) {
2628Function *Fn = unwrap<Function>(FnRef);
2629for (Argument &A : Fn->args())
2630 *ParamRefs++ =wrap(&A);
2631}
2632
2633LLVMValueRefLLVMGetParam(LLVMValueRef FnRef,unsigned index) {
2634Function *Fn = unwrap<Function>(FnRef);
2635returnwrap(&Fn->arg_begin()[index]);
2636}
2637
2638LLVMValueRefLLVMGetParamParent(LLVMValueRef V) {
2639returnwrap(unwrap<Argument>(V)->getParent());
2640}
2641
2642LLVMValueRefLLVMGetFirstParam(LLVMValueRef Fn) {
2643Function *Func = unwrap<Function>(Fn);
2644Function::arg_iteratorI = Func->arg_begin();
2645if (I == Func->arg_end())
2646returnnullptr;
2647returnwrap(&*I);
2648}
2649
2650LLVMValueRefLLVMGetLastParam(LLVMValueRef Fn) {
2651Function *Func = unwrap<Function>(Fn);
2652Function::arg_iteratorI = Func->arg_end();
2653if (I == Func->arg_begin())
2654returnnullptr;
2655returnwrap(&*--I);
2656}
2657
2658LLVMValueRefLLVMGetNextParam(LLVMValueRef Arg) {
2659Argument *A = unwrap<Argument>(Arg);
2660Function *Fn =A->getParent();
2661if (A->getArgNo() + 1 >= Fn->arg_size())
2662returnnullptr;
2663returnwrap(&Fn->arg_begin()[A->getArgNo() + 1]);
2664}
2665
2666LLVMValueRefLLVMGetPreviousParam(LLVMValueRef Arg) {
2667Argument *A = unwrap<Argument>(Arg);
2668if (A->getArgNo() == 0)
2669returnnullptr;
2670returnwrap(&A->getParent()->arg_begin()[A->getArgNo() - 1]);
2671}
2672
2673voidLLVMSetParamAlignment(LLVMValueRef Arg,unsigned align) {
2674Argument *A = unwrap<Argument>(Arg);
2675A->addAttr(Attribute::getWithAlignment(A->getContext(),Align(align)));
2676}
2677
2678/*--.. Operations on ifuncs ................................................--*/
2679
2680LLVMValueRefLLVMAddGlobalIFunc(LLVMModuleRef M,
2681constchar *Name,size_t NameLen,
2682LLVMTypeRef Ty,unsigned AddrSpace,
2683LLVMValueRefResolver) {
2684returnwrap(GlobalIFunc::create(unwrap(Ty), AddrSpace,
2685GlobalValue::ExternalLinkage,
2686StringRef(Name, NameLen),
2687 unwrap<Constant>(Resolver),unwrap(M)));
2688}
2689
2690LLVMValueRefLLVMGetNamedGlobalIFunc(LLVMModuleRef M,
2691constchar *Name,size_t NameLen) {
2692returnwrap(unwrap(M)->getNamedIFunc(StringRef(Name, NameLen)));
2693}
2694
2695LLVMValueRefLLVMGetFirstGlobalIFunc(LLVMModuleRef M) {
2696Module *Mod =unwrap(M);
2697Module::ifunc_iteratorI =Mod->ifunc_begin();
2698if (I ==Mod->ifunc_end())
2699returnnullptr;
2700returnwrap(&*I);
2701}
2702
2703LLVMValueRefLLVMGetLastGlobalIFunc(LLVMModuleRef M) {
2704Module *Mod =unwrap(M);
2705Module::ifunc_iteratorI =Mod->ifunc_end();
2706if (I ==Mod->ifunc_begin())
2707returnnullptr;
2708returnwrap(&*--I);
2709}
2710
2711LLVMValueRefLLVMGetNextGlobalIFunc(LLVMValueRef IFunc) {
2712GlobalIFunc *GIF = unwrap<GlobalIFunc>(IFunc);
2713Module::ifunc_iteratorI(GIF);
2714if (++I == GIF->getParent()->ifunc_end())
2715returnnullptr;
2716returnwrap(&*I);
2717}
2718
2719LLVMValueRefLLVMGetPreviousGlobalIFunc(LLVMValueRef IFunc) {
2720GlobalIFunc *GIF = unwrap<GlobalIFunc>(IFunc);
2721Module::ifunc_iteratorI(GIF);
2722if (I == GIF->getParent()->ifunc_begin())
2723returnnullptr;
2724returnwrap(&*--I);
2725}
2726
2727LLVMValueRefLLVMGetGlobalIFuncResolver(LLVMValueRef IFunc) {
2728returnwrap(unwrap<GlobalIFunc>(IFunc)->getResolver());
2729}
2730
2731voidLLVMSetGlobalIFuncResolver(LLVMValueRef IFunc,LLVMValueRefResolver) {
2732 unwrap<GlobalIFunc>(IFunc)->setResolver(unwrap<Constant>(Resolver));
2733}
2734
2735voidLLVMEraseGlobalIFunc(LLVMValueRef IFunc) {
2736 unwrap<GlobalIFunc>(IFunc)->eraseFromParent();
2737}
2738
2739voidLLVMRemoveGlobalIFunc(LLVMValueRef IFunc) {
2740 unwrap<GlobalIFunc>(IFunc)->removeFromParent();
2741}
2742
2743/*--.. Operations on operand bundles........................................--*/
2744
2745LLVMOperandBundleRefLLVMCreateOperandBundle(constchar *Tag,size_t TagLen,
2746LLVMValueRef *Args,
2747unsigned NumArgs) {
2748returnwrap(newOperandBundleDef(std::string(Tag, TagLen),
2749ArrayRef(unwrap(Args), NumArgs)));
2750}
2751
2752voidLLVMDisposeOperandBundle(LLVMOperandBundleRef Bundle) {
2753deleteunwrap(Bundle);
2754}
2755
2756constchar *LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle,size_t *Len) {
2757StringRef Str =unwrap(Bundle)->getTag();
2758 *Len = Str.size();
2759return Str.data();
2760}
2761
2762unsignedLLVMGetNumOperandBundleArgs(LLVMOperandBundleRef Bundle) {
2763returnunwrap(Bundle)->inputs().size();
2764}
2765
2766LLVMValueRefLLVMGetOperandBundleArgAtIndex(LLVMOperandBundleRef Bundle,
2767unsigned Index) {
2768returnwrap(unwrap(Bundle)->inputs()[Index]);
2769}
2770
2771/*--.. Operations on basic blocks ..........................................--*/
2772
2773LLVMValueRefLLVMBasicBlockAsValue(LLVMBasicBlockRef BB) {
2774returnwrap(static_cast<Value*>(unwrap(BB)));
2775}
2776
2777LLVMBoolLLVMValueIsBasicBlock(LLVMValueRef Val) {
2778return isa<BasicBlock>(unwrap(Val));
2779}
2780
2781LLVMBasicBlockRefLLVMValueAsBasicBlock(LLVMValueRef Val) {
2782returnwrap(unwrap<BasicBlock>(Val));
2783}
2784
2785constchar *LLVMGetBasicBlockName(LLVMBasicBlockRef BB) {
2786returnunwrap(BB)->getName().data();
2787}
2788
2789LLVMValueRefLLVMGetBasicBlockParent(LLVMBasicBlockRef BB) {
2790returnwrap(unwrap(BB)->getParent());
2791}
2792
2793LLVMValueRefLLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB) {
2794returnwrap(unwrap(BB)->getTerminator());
2795}
2796
2797unsignedLLVMCountBasicBlocks(LLVMValueRef FnRef) {
2798return unwrap<Function>(FnRef)->size();
2799}
2800
2801voidLLVMGetBasicBlocks(LLVMValueRef FnRef,LLVMBasicBlockRef *BasicBlocksRefs){
2802Function *Fn = unwrap<Function>(FnRef);
2803for (BasicBlock &BB : *Fn)
2804 *BasicBlocksRefs++ =wrap(&BB);
2805}
2806
2807LLVMBasicBlockRefLLVMGetEntryBasicBlock(LLVMValueRef Fn) {
2808returnwrap(&unwrap<Function>(Fn)->getEntryBlock());
2809}
2810
2811LLVMBasicBlockRefLLVMGetFirstBasicBlock(LLVMValueRef Fn) {
2812Function *Func = unwrap<Function>(Fn);
2813Function::iteratorI = Func->begin();
2814if (I == Func->end())
2815returnnullptr;
2816returnwrap(&*I);
2817}
2818
2819LLVMBasicBlockRefLLVMGetLastBasicBlock(LLVMValueRef Fn) {
2820Function *Func = unwrap<Function>(Fn);
2821Function::iteratorI = Func->end();
2822if (I == Func->begin())
2823returnnullptr;
2824returnwrap(&*--I);
2825}
2826
2827LLVMBasicBlockRefLLVMGetNextBasicBlock(LLVMBasicBlockRef BB) {
2828BasicBlock *Block =unwrap(BB);
2829Function::iteratorI(Block);
2830if (++I ==Block->getParent()->end())
2831returnnullptr;
2832returnwrap(&*I);
2833}
2834
2835LLVMBasicBlockRefLLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB) {
2836BasicBlock *Block =unwrap(BB);
2837Function::iteratorI(Block);
2838if (I ==Block->getParent()->begin())
2839returnnullptr;
2840returnwrap(&*--I);
2841}
2842
2843LLVMBasicBlockRefLLVMCreateBasicBlockInContext(LLVMContextRefC,
2844constchar *Name) {
2845returnwrap(llvm::BasicBlock::Create(*unwrap(C),Name));
2846}
2847
2848voidLLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder,
2849LLVMBasicBlockRef BB) {
2850BasicBlock *ToInsert =unwrap(BB);
2851BasicBlock *CurBB =unwrap(Builder)->GetInsertBlock();
2852assert(CurBB &&"current insertion point is invalid!");
2853 CurBB->getParent()->insert(std::next(CurBB->getIterator()), ToInsert);
2854}
2855
2856voidLLVMAppendExistingBasicBlock(LLVMValueRef Fn,
2857LLVMBasicBlockRef BB) {
2858 unwrap<Function>(Fn)->insert(unwrap<Function>(Fn)->end(),unwrap(BB));
2859}
2860
2861LLVMBasicBlockRefLLVMAppendBasicBlockInContext(LLVMContextRefC,
2862LLVMValueRef FnRef,
2863constchar *Name) {
2864returnwrap(BasicBlock::Create(*unwrap(C),Name, unwrap<Function>(FnRef)));
2865}
2866
2867LLVMBasicBlockRefLLVMAppendBasicBlock(LLVMValueRef FnRef,constchar *Name) {
2868returnLLVMAppendBasicBlockInContext(LLVMGetGlobalContext(), FnRef,Name);
2869}
2870
2871LLVMBasicBlockRefLLVMInsertBasicBlockInContext(LLVMContextRefC,
2872LLVMBasicBlockRef BBRef,
2873constchar *Name) {
2874BasicBlock *BB =unwrap(BBRef);
2875returnwrap(BasicBlock::Create(*unwrap(C),Name, BB->getParent(), BB));
2876}
2877
2878LLVMBasicBlockRefLLVMInsertBasicBlock(LLVMBasicBlockRef BBRef,
2879constchar *Name) {
2880returnLLVMInsertBasicBlockInContext(LLVMGetGlobalContext(), BBRef,Name);
2881}
2882
2883voidLLVMDeleteBasicBlock(LLVMBasicBlockRef BBRef) {
2884unwrap(BBRef)->eraseFromParent();
2885}
2886
2887voidLLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BBRef) {
2888unwrap(BBRef)->removeFromParent();
2889}
2890
2891voidLLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB,LLVMBasicBlockRef MovePos) {
2892unwrap(BB)->moveBefore(unwrap(MovePos));
2893}
2894
2895voidLLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB,LLVMBasicBlockRef MovePos) {
2896unwrap(BB)->moveAfter(unwrap(MovePos));
2897}
2898
2899/*--.. Operations on instructions ..........................................--*/
2900
2901LLVMBasicBlockRefLLVMGetInstructionParent(LLVMValueRef Inst) {
2902returnwrap(unwrap<Instruction>(Inst)->getParent());
2903}
2904
2905LLVMValueRefLLVMGetFirstInstruction(LLVMBasicBlockRef BB) {
2906BasicBlock *Block =unwrap(BB);
2907BasicBlock::iteratorI =Block->begin();
2908if (I ==Block->end())
2909returnnullptr;
2910returnwrap(&*I);
2911}
2912
2913LLVMValueRefLLVMGetLastInstruction(LLVMBasicBlockRef BB) {
2914BasicBlock *Block =unwrap(BB);
2915BasicBlock::iteratorI =Block->end();
2916if (I ==Block->begin())
2917returnnullptr;
2918returnwrap(&*--I);
2919}
2920
2921LLVMValueRefLLVMGetNextInstruction(LLVMValueRef Inst) {
2922Instruction *Instr = unwrap<Instruction>(Inst);
2923BasicBlock::iteratorI(Instr);
2924if (++I == Instr->getParent()->end())
2925returnnullptr;
2926returnwrap(&*I);
2927}
2928
2929LLVMValueRefLLVMGetPreviousInstruction(LLVMValueRef Inst) {
2930Instruction *Instr = unwrap<Instruction>(Inst);
2931BasicBlock::iteratorI(Instr);
2932if (I == Instr->getParent()->begin())
2933returnnullptr;
2934returnwrap(&*--I);
2935}
2936
2937voidLLVMInstructionRemoveFromParent(LLVMValueRef Inst) {
2938 unwrap<Instruction>(Inst)->removeFromParent();
2939}
2940
2941voidLLVMInstructionEraseFromParent(LLVMValueRef Inst) {
2942 unwrap<Instruction>(Inst)->eraseFromParent();
2943}
2944
2945voidLLVMDeleteInstruction(LLVMValueRef Inst) {
2946 unwrap<Instruction>(Inst)->deleteValue();
2947}
2948
2949LLVMIntPredicateLLVMGetICmpPredicate(LLVMValueRef Inst) {
2950if (ICmpInst *I = dyn_cast<ICmpInst>(unwrap(Inst)))
2951return (LLVMIntPredicate)I->getPredicate();
2952return (LLVMIntPredicate)0;
2953}
2954
2955LLVMRealPredicateLLVMGetFCmpPredicate(LLVMValueRef Inst) {
2956if (FCmpInst *I = dyn_cast<FCmpInst>(unwrap(Inst)))
2957return (LLVMRealPredicate)I->getPredicate();
2958return (LLVMRealPredicate)0;
2959}
2960
2961LLVMOpcodeLLVMGetInstructionOpcode(LLVMValueRef Inst) {
2962if (Instruction *C = dyn_cast<Instruction>(unwrap(Inst)))
2963returnmap_to_llvmopcode(C->getOpcode());
2964return (LLVMOpcode)0;
2965}
2966
2967LLVMValueRefLLVMInstructionClone(LLVMValueRef Inst) {
2968if (Instruction *C = dyn_cast<Instruction>(unwrap(Inst)))
2969returnwrap(C->clone());
2970returnnullptr;
2971}
2972
2973LLVMValueRefLLVMIsATerminatorInst(LLVMValueRef Inst) {
2974Instruction *I = dyn_cast<Instruction>(unwrap(Inst));
2975return (I &&I->isTerminator()) ?wrap(I) :nullptr;
2976}
2977
2978LLVMDbgRecordRefLLVMGetFirstDbgRecord(LLVMValueRef Inst) {
2979Instruction *Instr = unwrap<Instruction>(Inst);
2980autoI = Instr->DebugMarker->StoredDbgRecords.begin();
2981if (I == Instr->DebugMarker->StoredDbgRecords.end())
2982returnnullptr;
2983returnwrap(&*I);
2984}
2985
2986LLVMDbgRecordRefLLVMGetLastDbgRecord(LLVMValueRef Inst) {
2987Instruction *Instr = unwrap<Instruction>(Inst);
2988autoI = Instr->DebugMarker->StoredDbgRecords.rbegin();
2989if (I == Instr->DebugMarker->StoredDbgRecords.rend())
2990returnnullptr;
2991returnwrap(&*I);
2992}
2993
2994LLVMDbgRecordRefLLVMGetNextDbgRecord(LLVMDbgRecordRef Rec) {
2995DbgRecord *Record = unwrap<DbgRecord>(Rec);
2996simple_ilist<DbgRecord>::iteratorI(Record);
2997if (++I ==Record->getInstruction()->DebugMarker->StoredDbgRecords.end())
2998returnnullptr;
2999returnwrap(&*I);
3000}
3001
3002LLVMDbgRecordRefLLVMGetPreviousDbgRecord(LLVMDbgRecordRef Rec) {
3003DbgRecord *Record = unwrap<DbgRecord>(Rec);
3004simple_ilist<DbgRecord>::iteratorI(Record);
3005if (I ==Record->getInstruction()->DebugMarker->StoredDbgRecords.begin())
3006returnnullptr;
3007returnwrap(&*--I);
3008}
3009
3010unsignedLLVMGetNumArgOperands(LLVMValueRef Instr) {
3011if (FuncletPadInst *FPI = dyn_cast<FuncletPadInst>(unwrap(Instr))) {
3012return FPI->arg_size();
3013 }
3014return unwrap<CallBase>(Instr)->arg_size();
3015}
3016
3017/*--.. Call and invoke instructions ........................................--*/
3018
3019unsignedLLVMGetInstructionCallConv(LLVMValueRef Instr) {
3020return unwrap<CallBase>(Instr)->getCallingConv();
3021}
3022
3023voidLLVMSetInstructionCallConv(LLVMValueRef Instr,unsignedCC) {
3024return unwrap<CallBase>(Instr)->setCallingConv(
3025static_cast<CallingConv::ID>(CC));
3026}
3027
3028voidLLVMSetInstrParamAlignment(LLVMValueRef Instr,LLVMAttributeIndexIdx,
3029unsigned align) {
3030auto *Call = unwrap<CallBase>(Instr);
3031Attribute AlignAttr =
3032Attribute::getWithAlignment(Call->getContext(),Align(align));
3033 Call->addAttributeAtIndex(Idx, AlignAttr);
3034}
3035
3036voidLLVMAddCallSiteAttribute(LLVMValueRefC,LLVMAttributeIndexIdx,
3037LLVMAttributeRefA) {
3038 unwrap<CallBase>(C)->addAttributeAtIndex(Idx,unwrap(A));
3039}
3040
3041unsignedLLVMGetCallSiteAttributeCount(LLVMValueRefC,
3042LLVMAttributeIndexIdx) {
3043auto *Call = unwrap<CallBase>(C);
3044auto AS = Call->getAttributes().getAttributes(Idx);
3045return AS.getNumAttributes();
3046}
3047
3048voidLLVMGetCallSiteAttributes(LLVMValueRefC,LLVMAttributeIndexIdx,
3049LLVMAttributeRef *Attrs) {
3050auto *Call = unwrap<CallBase>(C);
3051auto AS = Call->getAttributes().getAttributes(Idx);
3052for (autoA : AS)
3053 *Attrs++ =wrap(A);
3054}
3055
3056LLVMAttributeRefLLVMGetCallSiteEnumAttribute(LLVMValueRefC,
3057LLVMAttributeIndexIdx,
3058unsigned KindID) {
3059returnwrap(unwrap<CallBase>(C)->getAttributeAtIndex(
3060Idx, (Attribute::AttrKind)KindID));
3061}
3062
3063LLVMAttributeRefLLVMGetCallSiteStringAttribute(LLVMValueRefC,
3064LLVMAttributeIndexIdx,
3065constchar *K,unsigned KLen) {
3066returnwrap(
3067 unwrap<CallBase>(C)->getAttributeAtIndex(Idx,StringRef(K, KLen)));
3068}
3069
3070voidLLVMRemoveCallSiteEnumAttribute(LLVMValueRefC,LLVMAttributeIndexIdx,
3071unsigned KindID) {
3072 unwrap<CallBase>(C)->removeAttributeAtIndex(Idx, (Attribute::AttrKind)KindID);
3073}
3074
3075voidLLVMRemoveCallSiteStringAttribute(LLVMValueRefC,LLVMAttributeIndexIdx,
3076constchar *K,unsigned KLen) {
3077 unwrap<CallBase>(C)->removeAttributeAtIndex(Idx,StringRef(K, KLen));
3078}
3079
3080LLVMValueRefLLVMGetCalledValue(LLVMValueRef Instr) {
3081returnwrap(unwrap<CallBase>(Instr)->getCalledOperand());
3082}
3083
3084LLVMTypeRefLLVMGetCalledFunctionType(LLVMValueRef Instr) {
3085returnwrap(unwrap<CallBase>(Instr)->getFunctionType());
3086}
3087
3088unsignedLLVMGetNumOperandBundles(LLVMValueRefC) {
3089return unwrap<CallBase>(C)->getNumOperandBundles();
3090}
3091
3092LLVMOperandBundleRefLLVMGetOperandBundleAtIndex(LLVMValueRefC,
3093unsigned Index) {
3094returnwrap(
3095newOperandBundleDef(unwrap<CallBase>(C)->getOperandBundleAt(Index)));
3096}
3097
3098/*--.. Operations on call instructions (only) ..............................--*/
3099
3100LLVMBoolLLVMIsTailCall(LLVMValueRef Call) {
3101return unwrap<CallInst>(Call)->isTailCall();
3102}
3103
3104voidLLVMSetTailCall(LLVMValueRef Call,LLVMBool isTailCall) {
3105 unwrap<CallInst>(Call)->setTailCall(isTailCall);
3106}
3107
3108LLVMTailCallKindLLVMGetTailCallKind(LLVMValueRef Call) {
3109return (LLVMTailCallKind)unwrap<CallInst>(Call)->getTailCallKind();
3110}
3111
3112voidLLVMSetTailCallKind(LLVMValueRef Call,LLVMTailCallKind kind) {
3113 unwrap<CallInst>(Call)->setTailCallKind((CallInst::TailCallKind)kind);
3114}
3115
3116/*--.. Operations on invoke instructions (only) ............................--*/
3117
3118LLVMBasicBlockRefLLVMGetNormalDest(LLVMValueRef Invoke) {
3119returnwrap(unwrap<InvokeInst>(Invoke)->getNormalDest());
3120}
3121
3122LLVMBasicBlockRefLLVMGetUnwindDest(LLVMValueRef Invoke) {
3123if (CleanupReturnInst *CRI = dyn_cast<CleanupReturnInst>(unwrap(Invoke))) {
3124returnwrap(CRI->getUnwindDest());
3125 }elseif (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {
3126returnwrap(CSI->getUnwindDest());
3127 }
3128returnwrap(unwrap<InvokeInst>(Invoke)->getUnwindDest());
3129}
3130
3131voidLLVMSetNormalDest(LLVMValueRef Invoke,LLVMBasicBlockRefB) {
3132 unwrap<InvokeInst>(Invoke)->setNormalDest(unwrap(B));
3133}
3134
3135voidLLVMSetUnwindDest(LLVMValueRef Invoke,LLVMBasicBlockRefB) {
3136if (CleanupReturnInst *CRI = dyn_cast<CleanupReturnInst>(unwrap(Invoke))) {
3137return CRI->setUnwindDest(unwrap(B));
3138 }elseif (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {
3139return CSI->setUnwindDest(unwrap(B));
3140 }
3141 unwrap<InvokeInst>(Invoke)->setUnwindDest(unwrap(B));
3142}
3143
3144LLVMBasicBlockRefLLVMGetCallBrDefaultDest(LLVMValueRef CallBr) {
3145returnwrap(unwrap<CallBrInst>(CallBr)->getDefaultDest());
3146}
3147
3148unsignedLLVMGetCallBrNumIndirectDests(LLVMValueRef CallBr) {
3149return unwrap<CallBrInst>(CallBr)->getNumIndirectDests();
3150}
3151
3152LLVMBasicBlockRefLLVMGetCallBrIndirectDest(LLVMValueRef CallBr,unsignedIdx) {
3153returnwrap(unwrap<CallBrInst>(CallBr)->getIndirectDest(Idx));
3154}
3155
3156/*--.. Operations on terminators ...........................................--*/
3157
3158unsignedLLVMGetNumSuccessors(LLVMValueRef Term) {
3159return unwrap<Instruction>(Term)->getNumSuccessors();
3160}
3161
3162LLVMBasicBlockRefLLVMGetSuccessor(LLVMValueRef Term,unsigned i) {
3163returnwrap(unwrap<Instruction>(Term)->getSuccessor(i));
3164}
3165
3166voidLLVMSetSuccessor(LLVMValueRef Term,unsigned i,LLVMBasicBlockRefblock) {
3167return unwrap<Instruction>(Term)->setSuccessor(i,unwrap(block));
3168}
3169
3170/*--.. Operations on branch instructions (only) ............................--*/
3171
3172LLVMBoolLLVMIsConditional(LLVMValueRef Branch) {
3173return unwrap<BranchInst>(Branch)->isConditional();
3174}
3175
3176LLVMValueRefLLVMGetCondition(LLVMValueRef Branch) {
3177returnwrap(unwrap<BranchInst>(Branch)->getCondition());
3178}
3179
3180voidLLVMSetCondition(LLVMValueRef Branch,LLVMValueRefCond) {
3181return unwrap<BranchInst>(Branch)->setCondition(unwrap(Cond));
3182}
3183
3184/*--.. Operations on switch instructions (only) ............................--*/
3185
3186LLVMBasicBlockRefLLVMGetSwitchDefaultDest(LLVMValueRef Switch) {
3187returnwrap(unwrap<SwitchInst>(Switch)->getDefaultDest());
3188}
3189
3190/*--.. Operations on alloca instructions (only) ............................--*/
3191
3192LLVMTypeRefLLVMGetAllocatedType(LLVMValueRef Alloca) {
3193returnwrap(unwrap<AllocaInst>(Alloca)->getAllocatedType());
3194}
3195
3196/*--.. Operations on gep instructions (only) ...............................--*/
3197
3198LLVMBoolLLVMIsInBounds(LLVMValueRefGEP) {
3199return unwrap<GEPOperator>(GEP)->isInBounds();
3200}
3201
3202voidLLVMSetIsInBounds(LLVMValueRefGEP,LLVMBool InBounds) {
3203return unwrap<GetElementPtrInst>(GEP)->setIsInBounds(InBounds);
3204}
3205
3206LLVMTypeRefLLVMGetGEPSourceElementType(LLVMValueRefGEP) {
3207returnwrap(unwrap<GEPOperator>(GEP)->getSourceElementType());
3208}
3209
3210LLVMGEPNoWrapFlagsLLVMGEPGetNoWrapFlags(LLVMValueRefGEP) {
3211GEPOperator *GEPOp = unwrap<GEPOperator>(GEP);
3212returnmapToLLVMGEPNoWrapFlags(GEPOp->getNoWrapFlags());
3213}
3214
3215voidLLVMGEPSetNoWrapFlags(LLVMValueRefGEP,LLVMGEPNoWrapFlags NoWrapFlags) {
3216GetElementPtrInst *GEPInst = unwrap<GetElementPtrInst>(GEP);
3217 GEPInst->setNoWrapFlags(mapFromLLVMGEPNoWrapFlags(NoWrapFlags));
3218}
3219
3220/*--.. Operations on phi nodes .............................................--*/
3221
3222voidLLVMAddIncoming(LLVMValueRef PhiNode,LLVMValueRef *IncomingValues,
3223LLVMBasicBlockRef *IncomingBlocks,unsigned Count) {
3224PHINode *PhiVal = unwrap<PHINode>(PhiNode);
3225for (unsignedI = 0;I != Count; ++I)
3226 PhiVal->addIncoming(unwrap(IncomingValues[I]),unwrap(IncomingBlocks[I]));
3227}
3228
3229unsignedLLVMCountIncoming(LLVMValueRef PhiNode) {
3230return unwrap<PHINode>(PhiNode)->getNumIncomingValues();
3231}
3232
3233LLVMValueRefLLVMGetIncomingValue(LLVMValueRef PhiNode,unsigned Index) {
3234returnwrap(unwrap<PHINode>(PhiNode)->getIncomingValue(Index));
3235}
3236
3237LLVMBasicBlockRefLLVMGetIncomingBlock(LLVMValueRef PhiNode,unsigned Index) {
3238returnwrap(unwrap<PHINode>(PhiNode)->getIncomingBlock(Index));
3239}
3240
3241/*--.. Operations on extractvalue and insertvalue nodes ....................--*/
3242
3243unsignedLLVMGetNumIndices(LLVMValueRef Inst) {
3244auto *I =unwrap(Inst);
3245if (auto *GEP = dyn_cast<GEPOperator>(I))
3246returnGEP->getNumIndices();
3247if (auto *EV = dyn_cast<ExtractValueInst>(I))
3248return EV->getNumIndices();
3249if (auto *IV = dyn_cast<InsertValueInst>(I))
3250returnIV->getNumIndices();
3251llvm_unreachable(
3252"LLVMGetNumIndices applies only to extractvalue and insertvalue!");
3253}
3254
3255constunsigned *LLVMGetIndices(LLVMValueRef Inst) {
3256auto *I =unwrap(Inst);
3257if (auto *EV = dyn_cast<ExtractValueInst>(I))
3258return EV->getIndices().data();
3259if (auto *IV = dyn_cast<InsertValueInst>(I))
3260returnIV->getIndices().data();
3261llvm_unreachable(
3262"LLVMGetIndices applies only to extractvalue and insertvalue!");
3263}
3264
3265
3266/*===-- Instruction builders ----------------------------------------------===*/
3267
3268LLVMBuilderRefLLVMCreateBuilderInContext(LLVMContextRefC) {
3269returnwrap(newIRBuilder<>(*unwrap(C)));
3270}
3271
3272LLVMBuilderRefLLVMCreateBuilder(void) {
3273returnLLVMCreateBuilderInContext(LLVMGetGlobalContext());
3274}
3275
3276staticvoidLLVMPositionBuilderImpl(IRBuilder<> *Builder,BasicBlock *Block,
3277Instruction *Instr,bool BeforeDbgRecords) {
3278BasicBlock::iteratorI = Instr ? Instr->getIterator() :Block->end();
3279I.setHeadBit(BeforeDbgRecords);
3280 Builder->SetInsertPoint(Block,I);
3281}
3282
3283voidLLVMPositionBuilder(LLVMBuilderRef Builder,LLVMBasicBlockRefBlock,
3284LLVMValueRef Instr) {
3285returnLLVMPositionBuilderImpl(unwrap(Builder),unwrap(Block),
3286 unwrap<Instruction>(Instr),false);
3287}
3288
3289voidLLVMPositionBuilderBeforeDbgRecords(LLVMBuilderRef Builder,
3290LLVMBasicBlockRefBlock,
3291LLVMValueRef Instr) {
3292returnLLVMPositionBuilderImpl(unwrap(Builder),unwrap(Block),
3293 unwrap<Instruction>(Instr),true);
3294}
3295
3296voidLLVMPositionBuilderBefore(LLVMBuilderRef Builder,LLVMValueRef Instr) {
3297Instruction *I = unwrap<Instruction>(Instr);
3298returnLLVMPositionBuilderImpl(unwrap(Builder),I->getParent(),I,false);
3299}
3300
3301voidLLVMPositionBuilderBeforeInstrAndDbgRecords(LLVMBuilderRef Builder,
3302LLVMValueRef Instr) {
3303Instruction *I = unwrap<Instruction>(Instr);
3304returnLLVMPositionBuilderImpl(unwrap(Builder),I->getParent(),I,true);
3305}
3306
3307voidLLVMPositionBuilderAtEnd(LLVMBuilderRef Builder,LLVMBasicBlockRefBlock) {
3308BasicBlock *BB =unwrap(Block);
3309unwrap(Builder)->SetInsertPoint(BB);
3310}
3311
3312LLVMBasicBlockRefLLVMGetInsertBlock(LLVMBuilderRef Builder) {
3313returnwrap(unwrap(Builder)->GetInsertBlock());
3314}
3315
3316voidLLVMClearInsertionPosition(LLVMBuilderRef Builder) {
3317unwrap(Builder)->ClearInsertionPoint();
3318}
3319
3320voidLLVMInsertIntoBuilder(LLVMBuilderRef Builder,LLVMValueRef Instr) {
3321unwrap(Builder)->Insert(unwrap<Instruction>(Instr));
3322}
3323
3324voidLLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder,LLVMValueRef Instr,
3325constchar *Name) {
3326unwrap(Builder)->Insert(unwrap<Instruction>(Instr),Name);
3327}
3328
3329voidLLVMDisposeBuilder(LLVMBuilderRef Builder) {
3330deleteunwrap(Builder);
3331}
3332
3333/*--.. Metadata builders ...................................................--*/
3334
3335LLVMMetadataRefLLVMGetCurrentDebugLocation2(LLVMBuilderRef Builder) {
3336returnwrap(unwrap(Builder)->getCurrentDebugLocation().getAsMDNode());
3337}
3338
3339voidLLVMSetCurrentDebugLocation2(LLVMBuilderRef Builder,LLVMMetadataRef Loc) {
3340if (Loc)
3341unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(unwrap<MDNode>(Loc)));
3342else
3343unwrap(Builder)->SetCurrentDebugLocation(DebugLoc());
3344}
3345
3346voidLLVMSetCurrentDebugLocation(LLVMBuilderRef Builder,LLVMValueRef L) {
3347MDNode *Loc =
3348 L ? cast<MDNode>(unwrap<MetadataAsValue>(L)->getMetadata()) :nullptr;
3349unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(Loc));
3350}
3351
3352LLVMValueRefLLVMGetCurrentDebugLocation(LLVMBuilderRef Builder) {
3353LLVMContext &Context =unwrap(Builder)->getContext();
3354returnwrap(MetadataAsValue::get(
3355 Context,unwrap(Builder)->getCurrentDebugLocation().getAsMDNode()));
3356}
3357
3358voidLLVMSetInstDebugLocation(LLVMBuilderRef Builder,LLVMValueRef Inst) {
3359unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
3360}
3361
3362voidLLVMAddMetadataToInst(LLVMBuilderRef Builder,LLVMValueRef Inst) {
3363unwrap(Builder)->AddMetadataToInst(unwrap<Instruction>(Inst));
3364}
3365
3366voidLLVMBuilderSetDefaultFPMathTag(LLVMBuilderRef Builder,
3367LLVMMetadataRef FPMathTag) {
3368
3369unwrap(Builder)->setDefaultFPMathTag(FPMathTag
3370 ? unwrap<MDNode>(FPMathTag)
3371 :nullptr);
3372}
3373
3374LLVMContextRefLLVMGetBuilderContext(LLVMBuilderRef Builder) {
3375returnwrap(&unwrap(Builder)->getContext());
3376}
3377
3378LLVMMetadataRefLLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder) {
3379returnwrap(unwrap(Builder)->getDefaultFPMathTag());
3380}
3381
3382/*--.. Instruction builders ................................................--*/
3383
3384LLVMValueRefLLVMBuildRetVoid(LLVMBuilderRefB) {
3385returnwrap(unwrap(B)->CreateRetVoid());
3386}
3387
3388LLVMValueRefLLVMBuildRet(LLVMBuilderRefB,LLVMValueRef V) {
3389returnwrap(unwrap(B)->CreateRet(unwrap(V)));
3390}
3391
3392LLVMValueRefLLVMBuildAggregateRet(LLVMBuilderRefB,LLVMValueRef *RetVals,
3393unsignedN) {
3394returnwrap(unwrap(B)->CreateAggregateRet(unwrap(RetVals),N));
3395}
3396
3397LLVMValueRefLLVMBuildBr(LLVMBuilderRefB,LLVMBasicBlockRef Dest) {
3398returnwrap(unwrap(B)->CreateBr(unwrap(Dest)));
3399}
3400
3401LLVMValueRefLLVMBuildCondBr(LLVMBuilderRefB,LLVMValueRef If,
3402LLVMBasicBlockRef Then,LLVMBasicBlockRef Else) {
3403returnwrap(unwrap(B)->CreateCondBr(unwrap(If),unwrap(Then),unwrap(Else)));
3404}
3405
3406LLVMValueRefLLVMBuildSwitch(LLVMBuilderRefB,LLVMValueRef V,
3407LLVMBasicBlockRef Else,unsigned NumCases) {
3408returnwrap(unwrap(B)->CreateSwitch(unwrap(V),unwrap(Else), NumCases));
3409}
3410
3411LLVMValueRefLLVMBuildIndirectBr(LLVMBuilderRefB,LLVMValueRefAddr,
3412unsigned NumDests) {
3413returnwrap(unwrap(B)->CreateIndirectBr(unwrap(Addr), NumDests));
3414}
3415
3416LLVMValueRefLLVMBuildCallBr(LLVMBuilderRefB,LLVMTypeRef Ty,LLVMValueRef Fn,
3417LLVMBasicBlockRef DefaultDest,
3418LLVMBasicBlockRef *IndirectDests,
3419unsigned NumIndirectDests,LLVMValueRef *Args,
3420unsigned NumArgs,LLVMOperandBundleRef *Bundles,
3421unsigned NumBundles,constchar *Name) {
3422
3423SmallVector<OperandBundleDef, 8> OBs;
3424for (auto *Bundle :ArrayRef(Bundles, NumBundles)) {
3425OperandBundleDef *OB =unwrap(Bundle);
3426 OBs.push_back(*OB);
3427 }
3428
3429returnwrap(unwrap(B)->CreateCallBr(
3430 unwrap<FunctionType>(Ty),unwrap(Fn),unwrap(DefaultDest),
3431ArrayRef(unwrap(IndirectDests), NumIndirectDests),
3432ArrayRef<Value *>(unwrap(Args), NumArgs), OBs,Name));
3433}
3434
3435LLVMValueRefLLVMBuildInvoke2(LLVMBuilderRefB,LLVMTypeRef Ty,LLVMValueRef Fn,
3436LLVMValueRef *Args,unsigned NumArgs,
3437LLVMBasicBlockRef Then,LLVMBasicBlockRefCatch,
3438constchar *Name) {
3439returnwrap(unwrap(B)->CreateInvoke(unwrap<FunctionType>(Ty),unwrap(Fn),
3440unwrap(Then),unwrap(Catch),
3441ArrayRef(unwrap(Args), NumArgs),Name));
3442}
3443
3444LLVMValueRefLLVMBuildInvokeWithOperandBundles(
3445LLVMBuilderRefB,LLVMTypeRef Ty,LLVMValueRef Fn,LLVMValueRef *Args,
3446unsigned NumArgs,LLVMBasicBlockRef Then,LLVMBasicBlockRefCatch,
3447LLVMOperandBundleRef *Bundles,unsigned NumBundles,constchar *Name) {
3448SmallVector<OperandBundleDef, 8> OBs;
3449for (auto *Bundle :ArrayRef(Bundles, NumBundles)) {
3450OperandBundleDef *OB =unwrap(Bundle);
3451 OBs.push_back(*OB);
3452 }
3453returnwrap(unwrap(B)->CreateInvoke(
3454 unwrap<FunctionType>(Ty),unwrap(Fn),unwrap(Then),unwrap(Catch),
3455ArrayRef(unwrap(Args), NumArgs), OBs,Name));
3456}
3457
3458LLVMValueRefLLVMBuildLandingPad(LLVMBuilderRefB,LLVMTypeRef Ty,
3459LLVMValueRef PersFn,unsigned NumClauses,
3460constchar *Name) {
3461// The personality used to live on the landingpad instruction, but now it
3462// lives on the parent function. For compatibility, take the provided
3463// personality and put it on the parent function.
3464if (PersFn)
3465unwrap(B)->GetInsertBlock()->getParent()->setPersonalityFn(
3466 unwrap<Function>(PersFn));
3467returnwrap(unwrap(B)->CreateLandingPad(unwrap(Ty), NumClauses,Name));
3468}
3469
3470LLVMValueRefLLVMBuildCatchPad(LLVMBuilderRefB,LLVMValueRef ParentPad,
3471LLVMValueRef *Args,unsigned NumArgs,
3472constchar *Name) {
3473returnwrap(unwrap(B)->CreateCatchPad(unwrap(ParentPad),
3474ArrayRef(unwrap(Args), NumArgs),Name));
3475}
3476
3477LLVMValueRefLLVMBuildCleanupPad(LLVMBuilderRefB,LLVMValueRef ParentPad,
3478LLVMValueRef *Args,unsigned NumArgs,
3479constchar *Name) {
3480if (ParentPad ==nullptr) {
3481Type *Ty =Type::getTokenTy(unwrap(B)->getContext());
3482 ParentPad =wrap(Constant::getNullValue(Ty));
3483 }
3484returnwrap(unwrap(B)->CreateCleanupPad(
3485unwrap(ParentPad),ArrayRef(unwrap(Args), NumArgs),Name));
3486}
3487
3488LLVMValueRefLLVMBuildResume(LLVMBuilderRefB,LLVMValueRef Exn) {
3489returnwrap(unwrap(B)->CreateResume(unwrap(Exn)));
3490}
3491
3492LLVMValueRefLLVMBuildCatchSwitch(LLVMBuilderRefB,LLVMValueRef ParentPad,
3493LLVMBasicBlockRef UnwindBB,
3494unsigned NumHandlers,constchar *Name) {
3495if (ParentPad ==nullptr) {
3496Type *Ty =Type::getTokenTy(unwrap(B)->getContext());
3497 ParentPad =wrap(Constant::getNullValue(Ty));
3498 }
3499returnwrap(unwrap(B)->CreateCatchSwitch(unwrap(ParentPad),unwrap(UnwindBB),
3500 NumHandlers,Name));
3501}
3502
3503LLVMValueRefLLVMBuildCatchRet(LLVMBuilderRefB,LLVMValueRef CatchPad,
3504LLVMBasicBlockRef BB) {
3505returnwrap(unwrap(B)->CreateCatchRet(unwrap<CatchPadInst>(CatchPad),
3506unwrap(BB)));
3507}
3508
3509LLVMValueRefLLVMBuildCleanupRet(LLVMBuilderRefB,LLVMValueRef CatchPad,
3510LLVMBasicBlockRef BB) {
3511returnwrap(unwrap(B)->CreateCleanupRet(unwrap<CleanupPadInst>(CatchPad),
3512unwrap(BB)));
3513}
3514
3515LLVMValueRefLLVMBuildUnreachable(LLVMBuilderRefB) {
3516returnwrap(unwrap(B)->CreateUnreachable());
3517}
3518
3519voidLLVMAddCase(LLVMValueRef Switch,LLVMValueRef OnVal,
3520LLVMBasicBlockRef Dest) {
3521 unwrap<SwitchInst>(Switch)->addCase(unwrap<ConstantInt>(OnVal),unwrap(Dest));
3522}
3523
3524voidLLVMAddDestination(LLVMValueRef IndirectBr,LLVMBasicBlockRef Dest) {
3525 unwrap<IndirectBrInst>(IndirectBr)->addDestination(unwrap(Dest));
3526}
3527
3528unsignedLLVMGetNumClauses(LLVMValueRef LandingPad) {
3529return unwrap<LandingPadInst>(LandingPad)->getNumClauses();
3530}
3531
3532LLVMValueRefLLVMGetClause(LLVMValueRef LandingPad,unsignedIdx) {
3533returnwrap(unwrap<LandingPadInst>(LandingPad)->getClause(Idx));
3534}
3535
3536voidLLVMAddClause(LLVMValueRef LandingPad,LLVMValueRefClauseVal) {
3537 unwrap<LandingPadInst>(LandingPad)->addClause(unwrap<Constant>(ClauseVal));
3538}
3539
3540LLVMBoolLLVMIsCleanup(LLVMValueRef LandingPad) {
3541return unwrap<LandingPadInst>(LandingPad)->isCleanup();
3542}
3543
3544voidLLVMSetCleanup(LLVMValueRef LandingPad,LLVMBool Val) {
3545 unwrap<LandingPadInst>(LandingPad)->setCleanup(Val);
3546}
3547
3548voidLLVMAddHandler(LLVMValueRef CatchSwitch,LLVMBasicBlockRef Dest) {
3549 unwrap<CatchSwitchInst>(CatchSwitch)->addHandler(unwrap(Dest));
3550}
3551
3552unsignedLLVMGetNumHandlers(LLVMValueRef CatchSwitch) {
3553return unwrap<CatchSwitchInst>(CatchSwitch)->getNumHandlers();
3554}
3555
3556voidLLVMGetHandlers(LLVMValueRef CatchSwitch,LLVMBasicBlockRef *Handlers) {
3557CatchSwitchInst *CSI = unwrap<CatchSwitchInst>(CatchSwitch);
3558for (constBasicBlock *H : CSI->handlers())
3559 *Handlers++ =wrap(H);
3560}
3561
3562LLVMValueRefLLVMGetParentCatchSwitch(LLVMValueRef CatchPad) {
3563returnwrap(unwrap<CatchPadInst>(CatchPad)->getCatchSwitch());
3564}
3565
3566voidLLVMSetParentCatchSwitch(LLVMValueRef CatchPad,LLVMValueRef CatchSwitch) {
3567 unwrap<CatchPadInst>(CatchPad)
3568 ->setCatchSwitch(unwrap<CatchSwitchInst>(CatchSwitch));
3569}
3570
3571/*--.. Funclets ...........................................................--*/
3572
3573LLVMValueRefLLVMGetArgOperand(LLVMValueRef Funclet,unsigned i) {
3574returnwrap(unwrap<FuncletPadInst>(Funclet)->getArgOperand(i));
3575}
3576
3577voidLLVMSetArgOperand(LLVMValueRef Funclet,unsigned i,LLVMValueRefvalue) {
3578 unwrap<FuncletPadInst>(Funclet)->setArgOperand(i,unwrap(value));
3579}
3580
3581/*--.. Arithmetic ..........................................................--*/
3582
3583staticFastMathFlagsmapFromLLVMFastMathFlags(LLVMFastMathFlags FMF) {
3584FastMathFlags NewFMF;
3585 NewFMF.setAllowReassoc((FMF &LLVMFastMathAllowReassoc) != 0);
3586 NewFMF.setNoNaNs((FMF &LLVMFastMathNoNaNs) != 0);
3587 NewFMF.setNoInfs((FMF &LLVMFastMathNoInfs) != 0);
3588 NewFMF.setNoSignedZeros((FMF &LLVMFastMathNoSignedZeros) != 0);
3589 NewFMF.setAllowReciprocal((FMF &LLVMFastMathAllowReciprocal) != 0);
3590 NewFMF.setAllowContract((FMF &LLVMFastMathAllowContract) != 0);
3591 NewFMF.setApproxFunc((FMF &LLVMFastMathApproxFunc) != 0);
3592
3593return NewFMF;
3594}
3595
3596staticLLVMFastMathFlagsmapToLLVMFastMathFlags(FastMathFlags FMF) {
3597LLVMFastMathFlags NewFMF =LLVMFastMathNone;
3598if (FMF.allowReassoc())
3599 NewFMF |=LLVMFastMathAllowReassoc;
3600if (FMF.noNaNs())
3601 NewFMF |=LLVMFastMathNoNaNs;
3602if (FMF.noInfs())
3603 NewFMF |=LLVMFastMathNoInfs;
3604if (FMF.noSignedZeros())
3605 NewFMF |=LLVMFastMathNoSignedZeros;
3606if (FMF.allowReciprocal())
3607 NewFMF |=LLVMFastMathAllowReciprocal;
3608if (FMF.allowContract())
3609 NewFMF |=LLVMFastMathAllowContract;
3610if (FMF.approxFunc())
3611 NewFMF |=LLVMFastMathApproxFunc;
3612
3613return NewFMF;
3614}
3615
3616LLVMValueRefLLVMBuildAdd(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3617constchar *Name) {
3618returnwrap(unwrap(B)->CreateAdd(unwrap(LHS),unwrap(RHS),Name));
3619}
3620
3621LLVMValueRefLLVMBuildNSWAdd(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3622constchar *Name) {
3623returnwrap(unwrap(B)->CreateNSWAdd(unwrap(LHS),unwrap(RHS),Name));
3624}
3625
3626LLVMValueRefLLVMBuildNUWAdd(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3627constchar *Name) {
3628returnwrap(unwrap(B)->CreateNUWAdd(unwrap(LHS),unwrap(RHS),Name));
3629}
3630
3631LLVMValueRefLLVMBuildFAdd(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3632constchar *Name) {
3633returnwrap(unwrap(B)->CreateFAdd(unwrap(LHS),unwrap(RHS),Name));
3634}
3635
3636LLVMValueRefLLVMBuildSub(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3637constchar *Name) {
3638returnwrap(unwrap(B)->CreateSub(unwrap(LHS),unwrap(RHS),Name));
3639}
3640
3641LLVMValueRefLLVMBuildNSWSub(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3642constchar *Name) {
3643returnwrap(unwrap(B)->CreateNSWSub(unwrap(LHS),unwrap(RHS),Name));
3644}
3645
3646LLVMValueRefLLVMBuildNUWSub(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3647constchar *Name) {
3648returnwrap(unwrap(B)->CreateNUWSub(unwrap(LHS),unwrap(RHS),Name));
3649}
3650
3651LLVMValueRefLLVMBuildFSub(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3652constchar *Name) {
3653returnwrap(unwrap(B)->CreateFSub(unwrap(LHS),unwrap(RHS),Name));
3654}
3655
3656LLVMValueRefLLVMBuildMul(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3657constchar *Name) {
3658returnwrap(unwrap(B)->CreateMul(unwrap(LHS),unwrap(RHS),Name));
3659}
3660
3661LLVMValueRefLLVMBuildNSWMul(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3662constchar *Name) {
3663returnwrap(unwrap(B)->CreateNSWMul(unwrap(LHS),unwrap(RHS),Name));
3664}
3665
3666LLVMValueRefLLVMBuildNUWMul(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3667constchar *Name) {
3668returnwrap(unwrap(B)->CreateNUWMul(unwrap(LHS),unwrap(RHS),Name));
3669}
3670
3671LLVMValueRefLLVMBuildFMul(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3672constchar *Name) {
3673returnwrap(unwrap(B)->CreateFMul(unwrap(LHS),unwrap(RHS),Name));
3674}
3675
3676LLVMValueRefLLVMBuildUDiv(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3677constchar *Name) {
3678returnwrap(unwrap(B)->CreateUDiv(unwrap(LHS),unwrap(RHS),Name));
3679}
3680
3681LLVMValueRefLLVMBuildExactUDiv(LLVMBuilderRefB,LLVMValueRef LHS,
3682LLVMValueRef RHS,constchar *Name) {
3683returnwrap(unwrap(B)->CreateExactUDiv(unwrap(LHS),unwrap(RHS),Name));
3684}
3685
3686LLVMValueRefLLVMBuildSDiv(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3687constchar *Name) {
3688returnwrap(unwrap(B)->CreateSDiv(unwrap(LHS),unwrap(RHS),Name));
3689}
3690
3691LLVMValueRefLLVMBuildExactSDiv(LLVMBuilderRefB,LLVMValueRef LHS,
3692LLVMValueRef RHS,constchar *Name) {
3693returnwrap(unwrap(B)->CreateExactSDiv(unwrap(LHS),unwrap(RHS),Name));
3694}
3695
3696LLVMValueRefLLVMBuildFDiv(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3697constchar *Name) {
3698returnwrap(unwrap(B)->CreateFDiv(unwrap(LHS),unwrap(RHS),Name));
3699}
3700
3701LLVMValueRefLLVMBuildURem(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3702constchar *Name) {
3703returnwrap(unwrap(B)->CreateURem(unwrap(LHS),unwrap(RHS),Name));
3704}
3705
3706LLVMValueRefLLVMBuildSRem(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3707constchar *Name) {
3708returnwrap(unwrap(B)->CreateSRem(unwrap(LHS),unwrap(RHS),Name));
3709}
3710
3711LLVMValueRefLLVMBuildFRem(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3712constchar *Name) {
3713returnwrap(unwrap(B)->CreateFRem(unwrap(LHS),unwrap(RHS),Name));
3714}
3715
3716LLVMValueRefLLVMBuildShl(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3717constchar *Name) {
3718returnwrap(unwrap(B)->CreateShl(unwrap(LHS),unwrap(RHS),Name));
3719}
3720
3721LLVMValueRefLLVMBuildLShr(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3722constchar *Name) {
3723returnwrap(unwrap(B)->CreateLShr(unwrap(LHS),unwrap(RHS),Name));
3724}
3725
3726LLVMValueRefLLVMBuildAShr(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3727constchar *Name) {
3728returnwrap(unwrap(B)->CreateAShr(unwrap(LHS),unwrap(RHS),Name));
3729}
3730
3731LLVMValueRefLLVMBuildAnd(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3732constchar *Name) {
3733returnwrap(unwrap(B)->CreateAnd(unwrap(LHS),unwrap(RHS),Name));
3734}
3735
3736LLVMValueRefLLVMBuildOr(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3737constchar *Name) {
3738returnwrap(unwrap(B)->CreateOr(unwrap(LHS),unwrap(RHS),Name));
3739}
3740
3741LLVMValueRefLLVMBuildXor(LLVMBuilderRefB,LLVMValueRef LHS,LLVMValueRef RHS,
3742constchar *Name) {
3743returnwrap(unwrap(B)->CreateXor(unwrap(LHS),unwrap(RHS),Name));
3744}
3745
3746LLVMValueRefLLVMBuildBinOp(LLVMBuilderRefB,LLVMOpcodeOp,
3747LLVMValueRef LHS,LLVMValueRef RHS,
3748constchar *Name) {
3749returnwrap(unwrap(B)->CreateBinOp(Instruction::BinaryOps(map_from_llvmopcode(Op)),unwrap(LHS),
3750unwrap(RHS),Name));
3751}
3752
3753LLVMValueRefLLVMBuildNeg(LLVMBuilderRefB,LLVMValueRef V,constchar *Name) {
3754returnwrap(unwrap(B)->CreateNeg(unwrap(V),Name));
3755}
3756
3757LLVMValueRefLLVMBuildNSWNeg(LLVMBuilderRefB,LLVMValueRef V,
3758constchar *Name) {
3759returnwrap(unwrap(B)->CreateNSWNeg(unwrap(V),Name));
3760}
3761
3762LLVMValueRefLLVMBuildNUWNeg(LLVMBuilderRefB,LLVMValueRef V,
3763constchar *Name) {
3764Value *Neg =unwrap(B)->CreateNeg(unwrap(V),Name);
3765if (auto *I = dyn_cast<BinaryOperator>(Neg))
3766I->setHasNoUnsignedWrap();
3767returnwrap(Neg);
3768}
3769
3770LLVMValueRefLLVMBuildFNeg(LLVMBuilderRefB,LLVMValueRef V,constchar *Name) {
3771returnwrap(unwrap(B)->CreateFNeg(unwrap(V),Name));
3772}
3773
3774LLVMValueRefLLVMBuildNot(LLVMBuilderRefB,LLVMValueRef V,constchar *Name) {
3775returnwrap(unwrap(B)->CreateNot(unwrap(V),Name));
3776}
3777
3778LLVMBoolLLVMGetNUW(LLVMValueRef ArithInst) {
3779Value *P = unwrap<Value>(ArithInst);
3780return cast<Instruction>(P)->hasNoUnsignedWrap();
3781}
3782
3783voidLLVMSetNUW(LLVMValueRef ArithInst,LLVMBool HasNUW) {
3784Value *P = unwrap<Value>(ArithInst);
3785 cast<Instruction>(P)->setHasNoUnsignedWrap(HasNUW);
3786}
3787
3788LLVMBoolLLVMGetNSW(LLVMValueRef ArithInst) {
3789Value *P = unwrap<Value>(ArithInst);
3790return cast<Instruction>(P)->hasNoSignedWrap();
3791}
3792
3793voidLLVMSetNSW(LLVMValueRef ArithInst,LLVMBool HasNSW) {
3794Value *P = unwrap<Value>(ArithInst);
3795 cast<Instruction>(P)->setHasNoSignedWrap(HasNSW);
3796}
3797
3798LLVMBoolLLVMGetExact(LLVMValueRef DivOrShrInst) {
3799Value *P = unwrap<Value>(DivOrShrInst);
3800return cast<Instruction>(P)->isExact();
3801}
3802
3803voidLLVMSetExact(LLVMValueRef DivOrShrInst,LLVMBool IsExact) {
3804Value *P = unwrap<Value>(DivOrShrInst);
3805 cast<Instruction>(P)->setIsExact(IsExact);
3806}
3807
3808LLVMBoolLLVMGetNNeg(LLVMValueRef NonNegInst) {
3809Value *P = unwrap<Value>(NonNegInst);
3810return cast<Instruction>(P)->hasNonNeg();
3811}
3812
3813voidLLVMSetNNeg(LLVMValueRef NonNegInst,LLVMBool IsNonNeg) {
3814Value *P = unwrap<Value>(NonNegInst);
3815 cast<Instruction>(P)->setNonNeg(IsNonNeg);
3816}
3817
3818LLVMFastMathFlagsLLVMGetFastMathFlags(LLVMValueRef FPMathInst) {
3819Value *P = unwrap<Value>(FPMathInst);
3820FastMathFlags FMF = cast<Instruction>(P)->getFastMathFlags();
3821returnmapToLLVMFastMathFlags(FMF);
3822}
3823
3824voidLLVMSetFastMathFlags(LLVMValueRef FPMathInst,LLVMFastMathFlags FMF) {
3825Value *P = unwrap<Value>(FPMathInst);
3826 cast<Instruction>(P)->setFastMathFlags(mapFromLLVMFastMathFlags(FMF));
3827}
3828
3829LLVMBoolLLVMCanValueUseFastMathFlags(LLVMValueRef V) {
3830Value *Val = unwrap<Value>(V);
3831return isa<FPMathOperator>(Val);
3832}
3833
3834LLVMBoolLLVMGetIsDisjoint(LLVMValueRef Inst) {
3835Value *P = unwrap<Value>(Inst);
3836return cast<PossiblyDisjointInst>(P)->isDisjoint();
3837}
3838
3839voidLLVMSetIsDisjoint(LLVMValueRef Inst,LLVMBool IsDisjoint) {
3840Value *P = unwrap<Value>(Inst);
3841 cast<PossiblyDisjointInst>(P)->setIsDisjoint(IsDisjoint);
3842}
3843
3844/*--.. Memory ..............................................................--*/
3845
3846LLVMValueRefLLVMBuildMalloc(LLVMBuilderRefB,LLVMTypeRef Ty,
3847constchar *Name) {
3848Type* ITy =Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext());
3849Constant* AllocSize =ConstantExpr::getSizeOf(unwrap(Ty));
3850 AllocSize =ConstantExpr::getTruncOrBitCast(AllocSize, ITy);
3851returnwrap(unwrap(B)->CreateMalloc(ITy,unwrap(Ty), AllocSize,nullptr,
3852nullptr,Name));
3853}
3854
3855LLVMValueRefLLVMBuildArrayMalloc(LLVMBuilderRefB,LLVMTypeRef Ty,
3856LLVMValueRef Val,constchar *Name) {
3857Type* ITy =Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext());
3858Constant* AllocSize =ConstantExpr::getSizeOf(unwrap(Ty));
3859 AllocSize =ConstantExpr::getTruncOrBitCast(AllocSize, ITy);
3860returnwrap(unwrap(B)->CreateMalloc(ITy,unwrap(Ty), AllocSize,unwrap(Val),
3861nullptr,Name));
3862}
3863
3864LLVMValueRefLLVMBuildMemSet(LLVMBuilderRefB,LLVMValueRefPtr,
3865LLVMValueRef Val,LLVMValueRef Len,
3866unsignedAlign) {
3867returnwrap(unwrap(B)->CreateMemSet(unwrap(Ptr),unwrap(Val),unwrap(Len),
3868MaybeAlign(Align)));
3869}
3870
3871LLVMValueRefLLVMBuildMemCpy(LLVMBuilderRefB,
3872LLVMValueRef Dst,unsigned DstAlign,
3873LLVMValueRef Src,unsigned SrcAlign,
3874LLVMValueRefSize) {
3875returnwrap(unwrap(B)->CreateMemCpy(unwrap(Dst),MaybeAlign(DstAlign),
3876unwrap(Src),MaybeAlign(SrcAlign),
3877unwrap(Size)));
3878}
3879
3880LLVMValueRefLLVMBuildMemMove(LLVMBuilderRefB,
3881LLVMValueRef Dst,unsigned DstAlign,
3882LLVMValueRef Src,unsigned SrcAlign,
3883LLVMValueRefSize) {
3884returnwrap(unwrap(B)->CreateMemMove(unwrap(Dst),MaybeAlign(DstAlign),
3885unwrap(Src),MaybeAlign(SrcAlign),
3886unwrap(Size)));
3887}
3888
3889LLVMValueRefLLVMBuildAlloca(LLVMBuilderRefB,LLVMTypeRef Ty,
3890constchar *Name) {
3891returnwrap(unwrap(B)->CreateAlloca(unwrap(Ty),nullptr,Name));
3892}
3893
3894LLVMValueRefLLVMBuildArrayAlloca(LLVMBuilderRefB,LLVMTypeRef Ty,
3895LLVMValueRef Val,constchar *Name) {
3896returnwrap(unwrap(B)->CreateAlloca(unwrap(Ty),unwrap(Val),Name));
3897}
3898
3899LLVMValueRefLLVMBuildFree(LLVMBuilderRefB,LLVMValueRef PointerVal) {
3900returnwrap(unwrap(B)->CreateFree(unwrap(PointerVal)));
3901}
3902
3903LLVMValueRefLLVMBuildLoad2(LLVMBuilderRefB,LLVMTypeRef Ty,
3904LLVMValueRef PointerVal,constchar *Name) {
3905returnwrap(unwrap(B)->CreateLoad(unwrap(Ty),unwrap(PointerVal),Name));
3906}
3907
3908LLVMValueRefLLVMBuildStore(LLVMBuilderRefB,LLVMValueRef Val,
3909LLVMValueRef PointerVal) {
3910returnwrap(unwrap(B)->CreateStore(unwrap(Val),unwrap(PointerVal)));
3911}
3912
3913staticAtomicOrderingmapFromLLVMOrdering(LLVMAtomicOrdering Ordering) {
3914switch (Ordering) {
3915caseLLVMAtomicOrderingNotAtomic:return AtomicOrdering::NotAtomic;
3916caseLLVMAtomicOrderingUnordered:return AtomicOrdering::Unordered;
3917caseLLVMAtomicOrderingMonotonic:return AtomicOrdering::Monotonic;
3918caseLLVMAtomicOrderingAcquire:return AtomicOrdering::Acquire;
3919caseLLVMAtomicOrderingRelease:return AtomicOrdering::Release;
3920caseLLVMAtomicOrderingAcquireRelease:
3921return AtomicOrdering::AcquireRelease;
3922caseLLVMAtomicOrderingSequentiallyConsistent:
3923return AtomicOrdering::SequentiallyConsistent;
3924 }
3925
3926llvm_unreachable("Invalid LLVMAtomicOrdering value!");
3927}
3928
3929staticLLVMAtomicOrderingmapToLLVMOrdering(AtomicOrdering Ordering) {
3930switch (Ordering) {
3931case AtomicOrdering::NotAtomic:returnLLVMAtomicOrderingNotAtomic;
3932case AtomicOrdering::Unordered:returnLLVMAtomicOrderingUnordered;
3933case AtomicOrdering::Monotonic:returnLLVMAtomicOrderingMonotonic;
3934case AtomicOrdering::Acquire:returnLLVMAtomicOrderingAcquire;
3935case AtomicOrdering::Release:returnLLVMAtomicOrderingRelease;
3936case AtomicOrdering::AcquireRelease:
3937returnLLVMAtomicOrderingAcquireRelease;
3938case AtomicOrdering::SequentiallyConsistent:
3939returnLLVMAtomicOrderingSequentiallyConsistent;
3940 }
3941
3942llvm_unreachable("Invalid AtomicOrdering value!");
3943}
3944
3945staticAtomicRMWInst::BinOpmapFromLLVMRMWBinOp(LLVMAtomicRMWBinOp BinOp) {
3946switch (BinOp) {
3947caseLLVMAtomicRMWBinOpXchg:returnAtomicRMWInst::Xchg;
3948caseLLVMAtomicRMWBinOpAdd:returnAtomicRMWInst::Add;
3949caseLLVMAtomicRMWBinOpSub:returnAtomicRMWInst::Sub;
3950caseLLVMAtomicRMWBinOpAnd:returnAtomicRMWInst::And;
3951caseLLVMAtomicRMWBinOpNand:returnAtomicRMWInst::Nand;
3952caseLLVMAtomicRMWBinOpOr:returnAtomicRMWInst::Or;
3953caseLLVMAtomicRMWBinOpXor:returnAtomicRMWInst::Xor;
3954caseLLVMAtomicRMWBinOpMax:returnAtomicRMWInst::Max;
3955caseLLVMAtomicRMWBinOpMin:returnAtomicRMWInst::Min;
3956caseLLVMAtomicRMWBinOpUMax:returnAtomicRMWInst::UMax;
3957caseLLVMAtomicRMWBinOpUMin:returnAtomicRMWInst::UMin;
3958caseLLVMAtomicRMWBinOpFAdd:returnAtomicRMWInst::FAdd;
3959caseLLVMAtomicRMWBinOpFSub:returnAtomicRMWInst::FSub;
3960caseLLVMAtomicRMWBinOpFMax:returnAtomicRMWInst::FMax;
3961caseLLVMAtomicRMWBinOpFMin:returnAtomicRMWInst::FMin;
3962caseLLVMAtomicRMWBinOpUIncWrap:
3963returnAtomicRMWInst::UIncWrap;
3964caseLLVMAtomicRMWBinOpUDecWrap:
3965returnAtomicRMWInst::UDecWrap;
3966caseLLVMAtomicRMWBinOpUSubCond:
3967returnAtomicRMWInst::USubCond;
3968caseLLVMAtomicRMWBinOpUSubSat:
3969returnAtomicRMWInst::USubSat;
3970 }
3971
3972llvm_unreachable("Invalid LLVMAtomicRMWBinOp value!");
3973}
3974
3975staticLLVMAtomicRMWBinOpmapToLLVMRMWBinOp(AtomicRMWInst::BinOp BinOp) {
3976switch (BinOp) {
3977caseAtomicRMWInst::Xchg:returnLLVMAtomicRMWBinOpXchg;
3978caseAtomicRMWInst::Add:returnLLVMAtomicRMWBinOpAdd;
3979caseAtomicRMWInst::Sub:returnLLVMAtomicRMWBinOpSub;
3980caseAtomicRMWInst::And:returnLLVMAtomicRMWBinOpAnd;
3981caseAtomicRMWInst::Nand:returnLLVMAtomicRMWBinOpNand;
3982caseAtomicRMWInst::Or:returnLLVMAtomicRMWBinOpOr;
3983caseAtomicRMWInst::Xor:returnLLVMAtomicRMWBinOpXor;
3984caseAtomicRMWInst::Max:returnLLVMAtomicRMWBinOpMax;
3985caseAtomicRMWInst::Min:returnLLVMAtomicRMWBinOpMin;
3986caseAtomicRMWInst::UMax:returnLLVMAtomicRMWBinOpUMax;
3987caseAtomicRMWInst::UMin:returnLLVMAtomicRMWBinOpUMin;
3988caseAtomicRMWInst::FAdd:returnLLVMAtomicRMWBinOpFAdd;
3989caseAtomicRMWInst::FSub:returnLLVMAtomicRMWBinOpFSub;
3990caseAtomicRMWInst::FMax:returnLLVMAtomicRMWBinOpFMax;
3991caseAtomicRMWInst::FMin:returnLLVMAtomicRMWBinOpFMin;
3992caseAtomicRMWInst::UIncWrap:
3993returnLLVMAtomicRMWBinOpUIncWrap;
3994caseAtomicRMWInst::UDecWrap:
3995returnLLVMAtomicRMWBinOpUDecWrap;
3996caseAtomicRMWInst::USubCond:
3997returnLLVMAtomicRMWBinOpUSubCond;
3998caseAtomicRMWInst::USubSat:
3999returnLLVMAtomicRMWBinOpUSubSat;
4000default:break;
4001 }
4002
4003llvm_unreachable("Invalid AtomicRMWBinOp value!");
4004}
4005
4006LLVMValueRefLLVMBuildFence(LLVMBuilderRefB,LLVMAtomicOrdering Ordering,
4007LLVMBool isSingleThread,constchar *Name) {
4008returnwrap(
4009unwrap(B)->CreateFence(mapFromLLVMOrdering(Ordering),
4010 isSingleThread ?SyncScope::SingleThread
4011 :SyncScope::System,
4012Name));
4013}
4014
4015LLVMValueRefLLVMBuildFenceSyncScope(LLVMBuilderRefB,
4016LLVMAtomicOrdering Ordering,unsigned SSID,
4017constchar *Name) {
4018returnwrap(
4019unwrap(B)->CreateFence(mapFromLLVMOrdering(Ordering), SSID,Name));
4020}
4021
4022LLVMValueRefLLVMBuildGEP2(LLVMBuilderRefB,LLVMTypeRef Ty,
4023LLVMValueRef Pointer,LLVMValueRef *Indices,
4024unsigned NumIndices,constchar *Name) {
4025ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4026returnwrap(unwrap(B)->CreateGEP(unwrap(Ty),unwrap(Pointer), IdxList,Name));
4027}
4028
4029LLVMValueRefLLVMBuildInBoundsGEP2(LLVMBuilderRefB,LLVMTypeRef Ty,
4030LLVMValueRef Pointer,LLVMValueRef *Indices,
4031unsigned NumIndices,constchar *Name) {
4032ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4033returnwrap(
4034unwrap(B)->CreateInBoundsGEP(unwrap(Ty),unwrap(Pointer), IdxList,Name));
4035}
4036
4037LLVMValueRefLLVMBuildGEPWithNoWrapFlags(LLVMBuilderRefB,LLVMTypeRef Ty,
4038LLVMValueRef Pointer,
4039LLVMValueRef *Indices,
4040unsigned NumIndices,constchar *Name,
4041LLVMGEPNoWrapFlags NoWrapFlags) {
4042ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4043returnwrap(unwrap(B)->CreateGEP(unwrap(Ty),unwrap(Pointer), IdxList,Name,
4044mapFromLLVMGEPNoWrapFlags(NoWrapFlags)));
4045}
4046
4047LLVMValueRefLLVMBuildStructGEP2(LLVMBuilderRefB,LLVMTypeRef Ty,
4048LLVMValueRef Pointer,unsignedIdx,
4049constchar *Name) {
4050returnwrap(
4051unwrap(B)->CreateStructGEP(unwrap(Ty),unwrap(Pointer),Idx,Name));
4052}
4053
4054LLVMValueRefLLVMBuildGlobalString(LLVMBuilderRefB,constchar *Str,
4055constchar *Name) {
4056returnwrap(unwrap(B)->CreateGlobalString(Str,Name));
4057}
4058
4059LLVMValueRefLLVMBuildGlobalStringPtr(LLVMBuilderRefB,constchar *Str,
4060constchar *Name) {
4061returnwrap(unwrap(B)->CreateGlobalString(Str,Name));
4062}
4063
4064LLVMBoolLLVMGetVolatile(LLVMValueRef MemAccessInst) {
4065Value *P =unwrap(MemAccessInst);
4066if (LoadInst *LI = dyn_cast<LoadInst>(P))
4067return LI->isVolatile();
4068if (StoreInst *SI = dyn_cast<StoreInst>(P))
4069return SI->isVolatile();
4070if (AtomicRMWInst *AI = dyn_cast<AtomicRMWInst>(P))
4071return AI->isVolatile();
4072return cast<AtomicCmpXchgInst>(P)->isVolatile();
4073}
4074
4075voidLLVMSetVolatile(LLVMValueRef MemAccessInst,LLVMBool isVolatile) {
4076Value *P =unwrap(MemAccessInst);
4077if (LoadInst *LI = dyn_cast<LoadInst>(P))
4078return LI->setVolatile(isVolatile);
4079if (StoreInst *SI = dyn_cast<StoreInst>(P))
4080return SI->setVolatile(isVolatile);
4081if (AtomicRMWInst *AI = dyn_cast<AtomicRMWInst>(P))
4082return AI->setVolatile(isVolatile);
4083return cast<AtomicCmpXchgInst>(P)->setVolatile(isVolatile);
4084}
4085
4086LLVMBoolLLVMGetWeak(LLVMValueRef CmpXchgInst) {
4087return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->isWeak();
4088}
4089
4090voidLLVMSetWeak(LLVMValueRef CmpXchgInst,LLVMBool isWeak) {
4091return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->setWeak(isWeak);
4092}
4093
4094LLVMAtomicOrderingLLVMGetOrdering(LLVMValueRef MemAccessInst) {
4095Value *P =unwrap(MemAccessInst);
4096AtomicOrdering O;
4097if (LoadInst *LI = dyn_cast<LoadInst>(P))
4098 O = LI->getOrdering();
4099elseif (StoreInst *SI = dyn_cast<StoreInst>(P))
4100 O = SI->getOrdering();
4101elseif (FenceInst *FI = dyn_cast<FenceInst>(P))
4102 O = FI->getOrdering();
4103else
4104 O = cast<AtomicRMWInst>(P)->getOrdering();
4105returnmapToLLVMOrdering(O);
4106}
4107
4108voidLLVMSetOrdering(LLVMValueRef MemAccessInst,LLVMAtomicOrdering Ordering) {
4109Value *P =unwrap(MemAccessInst);
4110AtomicOrdering O =mapFromLLVMOrdering(Ordering);
4111
4112if (LoadInst *LI = dyn_cast<LoadInst>(P))
4113return LI->setOrdering(O);
4114elseif (FenceInst *FI = dyn_cast<FenceInst>(P))
4115return FI->setOrdering(O);
4116elseif (AtomicRMWInst *ARWI = dyn_cast<AtomicRMWInst>(P))
4117return ARWI->setOrdering(O);
4118return cast<StoreInst>(P)->setOrdering(O);
4119}
4120
4121LLVMAtomicRMWBinOpLLVMGetAtomicRMWBinOp(LLVMValueRef Inst) {
4122returnmapToLLVMRMWBinOp(unwrap<AtomicRMWInst>(Inst)->getOperation());
4123}
4124
4125voidLLVMSetAtomicRMWBinOp(LLVMValueRef Inst,LLVMAtomicRMWBinOp BinOp) {
4126 unwrap<AtomicRMWInst>(Inst)->setOperation(mapFromLLVMRMWBinOp(BinOp));
4127}
4128
4129/*--.. Casts ...............................................................--*/
4130
4131LLVMValueRefLLVMBuildTrunc(LLVMBuilderRefB,LLVMValueRef Val,
4132LLVMTypeRef DestTy,constchar *Name) {
4133returnwrap(unwrap(B)->CreateTrunc(unwrap(Val),unwrap(DestTy),Name));
4134}
4135
4136LLVMValueRefLLVMBuildZExt(LLVMBuilderRefB,LLVMValueRef Val,
4137LLVMTypeRef DestTy,constchar *Name) {
4138returnwrap(unwrap(B)->CreateZExt(unwrap(Val),unwrap(DestTy),Name));
4139}
4140
4141LLVMValueRefLLVMBuildSExt(LLVMBuilderRefB,LLVMValueRef Val,
4142LLVMTypeRef DestTy,constchar *Name) {
4143returnwrap(unwrap(B)->CreateSExt(unwrap(Val),unwrap(DestTy),Name));
4144}
4145
4146LLVMValueRefLLVMBuildFPToUI(LLVMBuilderRefB,LLVMValueRef Val,
4147LLVMTypeRef DestTy,constchar *Name) {
4148returnwrap(unwrap(B)->CreateFPToUI(unwrap(Val),unwrap(DestTy),Name));
4149}
4150
4151LLVMValueRefLLVMBuildFPToSI(LLVMBuilderRefB,LLVMValueRef Val,
4152LLVMTypeRef DestTy,constchar *Name) {
4153returnwrap(unwrap(B)->CreateFPToSI(unwrap(Val),unwrap(DestTy),Name));
4154}
4155
4156LLVMValueRefLLVMBuildUIToFP(LLVMBuilderRefB,LLVMValueRef Val,
4157LLVMTypeRef DestTy,constchar *Name) {
4158returnwrap(unwrap(B)->CreateUIToFP(unwrap(Val),unwrap(DestTy),Name));
4159}
4160
4161LLVMValueRefLLVMBuildSIToFP(LLVMBuilderRefB,LLVMValueRef Val,
4162LLVMTypeRef DestTy,constchar *Name) {
4163returnwrap(unwrap(B)->CreateSIToFP(unwrap(Val),unwrap(DestTy),Name));
4164}
4165
4166LLVMValueRefLLVMBuildFPTrunc(LLVMBuilderRefB,LLVMValueRef Val,
4167LLVMTypeRef DestTy,constchar *Name) {
4168returnwrap(unwrap(B)->CreateFPTrunc(unwrap(Val),unwrap(DestTy),Name));
4169}
4170
4171LLVMValueRefLLVMBuildFPExt(LLVMBuilderRefB,LLVMValueRef Val,
4172LLVMTypeRef DestTy,constchar *Name) {
4173returnwrap(unwrap(B)->CreateFPExt(unwrap(Val),unwrap(DestTy),Name));
4174}
4175
4176LLVMValueRefLLVMBuildPtrToInt(LLVMBuilderRefB,LLVMValueRef Val,
4177LLVMTypeRef DestTy,constchar *Name) {
4178returnwrap(unwrap(B)->CreatePtrToInt(unwrap(Val),unwrap(DestTy),Name));
4179}
4180
4181LLVMValueRefLLVMBuildIntToPtr(LLVMBuilderRefB,LLVMValueRef Val,
4182LLVMTypeRef DestTy,constchar *Name) {
4183returnwrap(unwrap(B)->CreateIntToPtr(unwrap(Val),unwrap(DestTy),Name));
4184}
4185
4186LLVMValueRefLLVMBuildBitCast(LLVMBuilderRefB,LLVMValueRef Val,
4187LLVMTypeRef DestTy,constchar *Name) {
4188returnwrap(unwrap(B)->CreateBitCast(unwrap(Val),unwrap(DestTy),Name));
4189}
4190
4191LLVMValueRefLLVMBuildAddrSpaceCast(LLVMBuilderRefB,LLVMValueRef Val,
4192LLVMTypeRef DestTy,constchar *Name) {
4193returnwrap(unwrap(B)->CreateAddrSpaceCast(unwrap(Val),unwrap(DestTy),Name));
4194}
4195
4196LLVMValueRefLLVMBuildZExtOrBitCast(LLVMBuilderRefB,LLVMValueRef Val,
4197LLVMTypeRef DestTy,constchar *Name) {
4198returnwrap(unwrap(B)->CreateZExtOrBitCast(unwrap(Val),unwrap(DestTy),
4199Name));
4200}
4201
4202LLVMValueRefLLVMBuildSExtOrBitCast(LLVMBuilderRefB,LLVMValueRef Val,
4203LLVMTypeRef DestTy,constchar *Name) {
4204returnwrap(unwrap(B)->CreateSExtOrBitCast(unwrap(Val),unwrap(DestTy),
4205Name));
4206}
4207
4208LLVMValueRefLLVMBuildTruncOrBitCast(LLVMBuilderRefB,LLVMValueRef Val,
4209LLVMTypeRef DestTy,constchar *Name) {
4210returnwrap(unwrap(B)->CreateTruncOrBitCast(unwrap(Val),unwrap(DestTy),
4211Name));
4212}
4213
4214LLVMValueRefLLVMBuildCast(LLVMBuilderRefB,LLVMOpcodeOp,LLVMValueRef Val,
4215LLVMTypeRef DestTy,constchar *Name) {
4216returnwrap(unwrap(B)->CreateCast(Instruction::CastOps(map_from_llvmopcode(Op)),unwrap(Val),
4217unwrap(DestTy),Name));
4218}
4219
4220LLVMValueRefLLVMBuildPointerCast(LLVMBuilderRefB,LLVMValueRef Val,
4221LLVMTypeRef DestTy,constchar *Name) {
4222returnwrap(unwrap(B)->CreatePointerCast(unwrap(Val),unwrap(DestTy),Name));
4223}
4224
4225LLVMValueRefLLVMBuildIntCast2(LLVMBuilderRefB,LLVMValueRef Val,
4226LLVMTypeRef DestTy,LLVMBool IsSigned,
4227constchar *Name) {
4228returnwrap(
4229unwrap(B)->CreateIntCast(unwrap(Val),unwrap(DestTy), IsSigned,Name));
4230}
4231
4232LLVMValueRefLLVMBuildIntCast(LLVMBuilderRefB,LLVMValueRef Val,
4233LLVMTypeRef DestTy,constchar *Name) {
4234returnwrap(unwrap(B)->CreateIntCast(unwrap(Val),unwrap(DestTy),
4235/*isSigned*/true,Name));
4236}
4237
4238LLVMValueRefLLVMBuildFPCast(LLVMBuilderRefB,LLVMValueRef Val,
4239LLVMTypeRef DestTy,constchar *Name) {
4240returnwrap(unwrap(B)->CreateFPCast(unwrap(Val),unwrap(DestTy),Name));
4241}
4242
4243LLVMOpcodeLLVMGetCastOpcode(LLVMValueRef Src,LLVMBool SrcIsSigned,
4244LLVMTypeRef DestTy,LLVMBool DestIsSigned) {
4245returnmap_to_llvmopcode(CastInst::getCastOpcode(
4246unwrap(Src), SrcIsSigned,unwrap(DestTy), DestIsSigned));
4247}
4248
4249/*--.. Comparisons .........................................................--*/
4250
4251LLVMValueRefLLVMBuildICmp(LLVMBuilderRefB,LLVMIntPredicateOp,
4252LLVMValueRef LHS,LLVMValueRef RHS,
4253constchar *Name) {
4254returnwrap(unwrap(B)->CreateICmp(static_cast<ICmpInst::Predicate>(Op),
4255unwrap(LHS),unwrap(RHS),Name));
4256}
4257
4258LLVMValueRefLLVMBuildFCmp(LLVMBuilderRefB,LLVMRealPredicateOp,
4259LLVMValueRef LHS,LLVMValueRef RHS,
4260constchar *Name) {
4261returnwrap(unwrap(B)->CreateFCmp(static_cast<FCmpInst::Predicate>(Op),
4262unwrap(LHS),unwrap(RHS),Name));
4263}
4264
4265/*--.. Miscellaneous instructions ..........................................--*/
4266
4267LLVMValueRefLLVMBuildPhi(LLVMBuilderRefB,LLVMTypeRef Ty,constchar *Name) {
4268returnwrap(unwrap(B)->CreatePHI(unwrap(Ty), 0,Name));
4269}
4270
4271LLVMValueRefLLVMBuildCall2(LLVMBuilderRefB,LLVMTypeRef Ty,LLVMValueRef Fn,
4272LLVMValueRef *Args,unsigned NumArgs,
4273constchar *Name) {
4274FunctionType *FTy = unwrap<FunctionType>(Ty);
4275returnwrap(unwrap(B)->CreateCall(FTy,unwrap(Fn),
4276ArrayRef(unwrap(Args), NumArgs),Name));
4277}
4278
4279LLVMValueRef
4280LLVMBuildCallWithOperandBundles(LLVMBuilderRefB,LLVMTypeRef Ty,
4281LLVMValueRef Fn,LLVMValueRef *Args,
4282unsigned NumArgs,LLVMOperandBundleRef *Bundles,
4283unsigned NumBundles,constchar *Name) {
4284FunctionType *FTy = unwrap<FunctionType>(Ty);
4285SmallVector<OperandBundleDef, 8> OBs;
4286for (auto *Bundle :ArrayRef(Bundles, NumBundles)) {
4287OperandBundleDef *OB =unwrap(Bundle);
4288 OBs.push_back(*OB);
4289 }
4290returnwrap(unwrap(B)->CreateCall(
4291 FTy,unwrap(Fn),ArrayRef(unwrap(Args), NumArgs), OBs,Name));
4292}
4293
4294LLVMValueRefLLVMBuildSelect(LLVMBuilderRefB,LLVMValueRef If,
4295LLVMValueRef Then,LLVMValueRef Else,
4296constchar *Name) {
4297returnwrap(unwrap(B)->CreateSelect(unwrap(If),unwrap(Then),unwrap(Else),
4298Name));
4299}
4300
4301LLVMValueRefLLVMBuildVAArg(LLVMBuilderRefB,LLVMValueRef List,
4302LLVMTypeRef Ty,constchar *Name) {
4303returnwrap(unwrap(B)->CreateVAArg(unwrap(List),unwrap(Ty),Name));
4304}
4305
4306LLVMValueRefLLVMBuildExtractElement(LLVMBuilderRefB,LLVMValueRef VecVal,
4307LLVMValueRef Index,constchar *Name) {
4308returnwrap(unwrap(B)->CreateExtractElement(unwrap(VecVal),unwrap(Index),
4309Name));
4310}
4311
4312LLVMValueRefLLVMBuildInsertElement(LLVMBuilderRefB,LLVMValueRef VecVal,
4313LLVMValueRef EltVal,LLVMValueRef Index,
4314constchar *Name) {
4315returnwrap(unwrap(B)->CreateInsertElement(unwrap(VecVal),unwrap(EltVal),
4316unwrap(Index),Name));
4317}
4318
4319LLVMValueRefLLVMBuildShuffleVector(LLVMBuilderRefB,LLVMValueRef V1,
4320LLVMValueRef V2,LLVMValueRef Mask,
4321constchar *Name) {
4322returnwrap(unwrap(B)->CreateShuffleVector(unwrap(V1),unwrap(V2),
4323unwrap(Mask),Name));
4324}
4325
4326LLVMValueRefLLVMBuildExtractValue(LLVMBuilderRefB,LLVMValueRef AggVal,
4327unsigned Index,constchar *Name) {
4328returnwrap(unwrap(B)->CreateExtractValue(unwrap(AggVal), Index,Name));
4329}
4330
4331LLVMValueRefLLVMBuildInsertValue(LLVMBuilderRefB,LLVMValueRef AggVal,
4332LLVMValueRef EltVal,unsigned Index,
4333constchar *Name) {
4334returnwrap(unwrap(B)->CreateInsertValue(unwrap(AggVal),unwrap(EltVal),
4335 Index,Name));
4336}
4337
4338LLVMValueRefLLVMBuildFreeze(LLVMBuilderRefB,LLVMValueRef Val,
4339constchar *Name) {
4340returnwrap(unwrap(B)->CreateFreeze(unwrap(Val),Name));
4341}
4342
4343LLVMValueRefLLVMBuildIsNull(LLVMBuilderRefB,LLVMValueRef Val,
4344constchar *Name) {
4345returnwrap(unwrap(B)->CreateIsNull(unwrap(Val),Name));
4346}
4347
4348LLVMValueRefLLVMBuildIsNotNull(LLVMBuilderRefB,LLVMValueRef Val,
4349constchar *Name) {
4350returnwrap(unwrap(B)->CreateIsNotNull(unwrap(Val),Name));
4351}
4352
4353LLVMValueRefLLVMBuildPtrDiff2(LLVMBuilderRefB,LLVMTypeRef ElemTy,
4354LLVMValueRef LHS,LLVMValueRef RHS,
4355constchar *Name) {
4356returnwrap(unwrap(B)->CreatePtrDiff(unwrap(ElemTy),unwrap(LHS),
4357unwrap(RHS),Name));
4358}
4359
4360LLVMValueRefLLVMBuildAtomicRMW(LLVMBuilderRefB,LLVMAtomicRMWBinOpop,
4361LLVMValueRef PTR,LLVMValueRef Val,
4362LLVMAtomicOrdering ordering,
4363LLVMBool singleThread) {
4364AtomicRMWInst::BinOp intop =mapFromLLVMRMWBinOp(op);
4365returnwrap(unwrap(B)->CreateAtomicRMW(
4366 intop,unwrap(PTR),unwrap(Val),MaybeAlign(),
4367mapFromLLVMOrdering(ordering),
4368 singleThread ?SyncScope::SingleThread :SyncScope::System));
4369}
4370
4371LLVMValueRefLLVMBuildAtomicRMWSyncScope(LLVMBuilderRefB,
4372LLVMAtomicRMWBinOpop,
4373LLVMValueRef PTR,LLVMValueRef Val,
4374LLVMAtomicOrdering ordering,
4375unsigned SSID) {
4376AtomicRMWInst::BinOp intop =mapFromLLVMRMWBinOp(op);
4377returnwrap(unwrap(B)->CreateAtomicRMW(intop,unwrap(PTR),unwrap(Val),
4378MaybeAlign(),
4379mapFromLLVMOrdering(ordering), SSID));
4380}
4381
4382LLVMValueRefLLVMBuildAtomicCmpXchg(LLVMBuilderRefB,LLVMValueRefPtr,
4383LLVMValueRef Cmp,LLVMValueRef New,
4384LLVMAtomicOrdering SuccessOrdering,
4385LLVMAtomicOrdering FailureOrdering,
4386LLVMBool singleThread) {
4387
4388returnwrap(unwrap(B)->CreateAtomicCmpXchg(
4389unwrap(Ptr),unwrap(Cmp),unwrap(New),MaybeAlign(),
4390mapFromLLVMOrdering(SuccessOrdering),
4391mapFromLLVMOrdering(FailureOrdering),
4392 singleThread ?SyncScope::SingleThread :SyncScope::System));
4393}
4394
4395LLVMValueRefLLVMBuildAtomicCmpXchgSyncScope(LLVMBuilderRefB,LLVMValueRefPtr,
4396LLVMValueRef Cmp,LLVMValueRef New,
4397LLVMAtomicOrdering SuccessOrdering,
4398LLVMAtomicOrdering FailureOrdering,
4399unsigned SSID) {
4400returnwrap(unwrap(B)->CreateAtomicCmpXchg(
4401unwrap(Ptr),unwrap(Cmp),unwrap(New),MaybeAlign(),
4402mapFromLLVMOrdering(SuccessOrdering),
4403mapFromLLVMOrdering(FailureOrdering), SSID));
4404}
4405
4406unsignedLLVMGetNumMaskElements(LLVMValueRef SVInst) {
4407Value *P =unwrap(SVInst);
4408ShuffleVectorInst *I = cast<ShuffleVectorInst>(P);
4409returnI->getShuffleMask().size();
4410}
4411
4412intLLVMGetMaskValue(LLVMValueRef SVInst,unsigned Elt) {
4413Value *P =unwrap(SVInst);
4414ShuffleVectorInst *I = cast<ShuffleVectorInst>(P);
4415returnI->getMaskValue(Elt);
4416}
4417
4418intLLVMGetUndefMaskElem(void) {returnPoisonMaskElem; }
4419
4420LLVMBoolLLVMIsAtomic(LLVMValueRef Inst) {
4421return unwrap<Instruction>(Inst)->isAtomic();
4422}
4423
4424LLVMBoolLLVMIsAtomicSingleThread(LLVMValueRef AtomicInst) {
4425// Backwards compatibility: return false for non-atomic instructions
4426Instruction *I = unwrap<Instruction>(AtomicInst);
4427if (!I->isAtomic())
4428return 0;
4429
4430return *getAtomicSyncScopeID(I) ==SyncScope::SingleThread;
4431}
4432
4433voidLLVMSetAtomicSingleThread(LLVMValueRef AtomicInst,LLVMBool NewValue) {
4434// Backwards compatibility: ignore non-atomic instructions
4435Instruction *I = unwrap<Instruction>(AtomicInst);
4436if (!I->isAtomic())
4437return;
4438
4439SyncScope::ID SSID = NewValue ?SyncScope::SingleThread :SyncScope::System;
4440setAtomicSyncScopeID(I, SSID);
4441}
4442
4443unsignedLLVMGetAtomicSyncScopeID(LLVMValueRef AtomicInst) {
4444Instruction *I = unwrap<Instruction>(AtomicInst);
4445assert(I->isAtomic() &&"Expected an atomic instruction");
4446return *getAtomicSyncScopeID(I);
4447}
4448
4449voidLLVMSetAtomicSyncScopeID(LLVMValueRef AtomicInst,unsigned SSID) {
4450Instruction *I = unwrap<Instruction>(AtomicInst);
4451assert(I->isAtomic() &&"Expected an atomic instruction");
4452setAtomicSyncScopeID(I, SSID);
4453}
4454
4455LLVMAtomicOrderingLLVMGetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst) {
4456Value *P =unwrap(CmpXchgInst);
4457returnmapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getSuccessOrdering());
4458}
4459
4460voidLLVMSetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst,
4461LLVMAtomicOrdering Ordering) {
4462Value *P =unwrap(CmpXchgInst);
4463AtomicOrdering O =mapFromLLVMOrdering(Ordering);
4464
4465return cast<AtomicCmpXchgInst>(P)->setSuccessOrdering(O);
4466}
4467
4468LLVMAtomicOrderingLLVMGetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst) {
4469Value *P =unwrap(CmpXchgInst);
4470returnmapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getFailureOrdering());
4471}
4472
4473voidLLVMSetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst,
4474LLVMAtomicOrdering Ordering) {
4475Value *P =unwrap(CmpXchgInst);
4476AtomicOrdering O =mapFromLLVMOrdering(Ordering);
4477
4478return cast<AtomicCmpXchgInst>(P)->setFailureOrdering(O);
4479}
4480
4481/*===-- Module providers --------------------------------------------------===*/
4482
4483LLVMModuleProviderRef
4484LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M) {
4485returnreinterpret_cast<LLVMModuleProviderRef>(M);
4486}
4487
4488voidLLVMDisposeModuleProvider(LLVMModuleProviderRef MP) {
4489deleteunwrap(MP);
4490}
4491
4492
4493/*===-- Memory buffers ----------------------------------------------------===*/
4494
4495LLVMBoolLLVMCreateMemoryBufferWithContentsOfFile(
4496constchar *Path,
4497LLVMMemoryBufferRef *OutMemBuf,
4498char **OutMessage) {
4499
4500ErrorOr<std::unique_ptr<MemoryBuffer>> MBOrErr =MemoryBuffer::getFile(Path);
4501if (std::error_code EC = MBOrErr.getError()) {
4502 *OutMessage = strdup(EC.message().c_str());
4503return 1;
4504 }
4505 *OutMemBuf =wrap(MBOrErr.get().release());
4506return 0;
4507}
4508
4509LLVMBoolLLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf,
4510char **OutMessage) {
4511ErrorOr<std::unique_ptr<MemoryBuffer>> MBOrErr =MemoryBuffer::getSTDIN();
4512if (std::error_code EC = MBOrErr.getError()) {
4513 *OutMessage = strdup(EC.message().c_str());
4514return 1;
4515 }
4516 *OutMemBuf =wrap(MBOrErr.get().release());
4517return 0;
4518}
4519
4520LLVMMemoryBufferRefLLVMCreateMemoryBufferWithMemoryRange(
4521constchar *InputData,
4522size_t InputDataLength,
4523constchar *BufferName,
4524LLVMBool RequiresNullTerminator) {
4525
4526returnwrap(MemoryBuffer::getMemBuffer(StringRef(InputData, InputDataLength),
4527StringRef(BufferName),
4528 RequiresNullTerminator).release());
4529}
4530
4531LLVMMemoryBufferRefLLVMCreateMemoryBufferWithMemoryRangeCopy(
4532constchar *InputData,
4533size_t InputDataLength,
4534constchar *BufferName) {
4535
4536returnwrap(
4537MemoryBuffer::getMemBufferCopy(StringRef(InputData, InputDataLength),
4538StringRef(BufferName)).release());
4539}
4540
4541constchar *LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf) {
4542returnunwrap(MemBuf)->getBufferStart();
4543}
4544
4545size_tLLVMGetBufferSize(LLVMMemoryBufferRef MemBuf) {
4546returnunwrap(MemBuf)->getBufferSize();
4547}
4548
4549voidLLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf) {
4550deleteunwrap(MemBuf);
4551}
4552
4553/*===-- Pass Manager ------------------------------------------------------===*/
4554
4555LLVMPassManagerRefLLVMCreatePassManager() {
4556returnwrap(newlegacy::PassManager());
4557}
4558
4559LLVMPassManagerRefLLVMCreateFunctionPassManagerForModule(LLVMModuleRef M) {
4560returnwrap(newlegacy::FunctionPassManager(unwrap(M)));
4561}
4562
4563LLVMPassManagerRefLLVMCreateFunctionPassManager(LLVMModuleProviderRefP) {
4564returnLLVMCreateFunctionPassManagerForModule(
4565reinterpret_cast<LLVMModuleRef>(P));
4566}
4567
4568LLVMBoolLLVMRunPassManager(LLVMPassManagerRef PM,LLVMModuleRef M) {
4569return unwrap<legacy::PassManager>(PM)->run(*unwrap(M));
4570}
4571
4572LLVMBoolLLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM) {
4573return unwrap<legacy::FunctionPassManager>(FPM)->doInitialization();
4574}
4575
4576LLVMBoolLLVMRunFunctionPassManager(LLVMPassManagerRef FPM,LLVMValueRefF) {
4577return unwrap<legacy::FunctionPassManager>(FPM)->run(*unwrap<Function>(F));
4578}
4579
4580LLVMBoolLLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM) {
4581return unwrap<legacy::FunctionPassManager>(FPM)->doFinalization();
4582}
4583
4584voidLLVMDisposePassManager(LLVMPassManagerRef PM) {
4585deleteunwrap(PM);
4586}
4587
4588/*===-- Threading ------------------------------------------------------===*/
4589
4590LLVMBoolLLVMStartMultithreaded() {
4591returnLLVMIsMultithreaded();
4592}
4593
4594voidLLVMStopMultithreaded() {
4595}
4596
4597LLVMBoolLLVMIsMultithreaded() {
4598returnllvm_is_multithreaded();
4599}
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition:ARMSLSHardening.cpp:73
inline
always inline
Definition:AlwaysInliner.cpp:161
Attributes.h
This file contains the simple types necessary to represent the attributes associated with functions a...
getParent
static const Function * getParent(const Value *V)
Definition:BasicAliasAnalysis.cpp:863
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
A
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
DEFINE_SIMPLE_CONVERSION_FUNCTIONS
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
Definition:CBindingWrapping.h:19
LLVM_EXTENSION
#define LLVM_EXTENSION
LLVM_EXTENSION - Support compilers where we have a keyword to suppress pedantic diagnostics.
Definition:Compiler.h:433
ConstantRange.h
Constants.h
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Idx
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
Definition:DeadArgumentElimination.cpp:353
value
Given that RA is a live value
Definition:DeadArgumentElimination.cpp:716
DebugInfoMetadata.h
DebugProgramInstruction.h
Debug.h
LLVM_DEBUG
#define LLVM_DEBUG(...)
Definition:Debug.h:106
DerivedTypes.h
DiagnosticInfo.h
DiagnosticPrinter.h
Addr
uint64_t Addr
Definition:ELFObjHandler.cpp:79
Name
std::string Name
Definition:ELFObjHandler.cpp:77
Size
uint64_t Size
Definition:ELFObjHandler.cpp:81
getFunction
static Function * getFunction(Constant *C)
Definition:Evaluator.cpp:235
getTypeID
static char getTypeID(Type *Ty)
Definition:ExternalFunctions.cpp:82
FileSystem.h
GlobalAlias.h
GlobalVariable.h
op
#define op(i)
GEP
Hexagon Common GEP
Definition:HexagonCommonGEP.cpp:170
IRBuilder.h
BasicBlock.h
LLVMGetElementAsConstant
LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef C, unsigned idx)
Definition:Core.cpp:1632
map_to_llvmModFlagBehavior
static Module::ModFlagBehavior map_to_llvmModFlagBehavior(LLVMModuleFlagBehavior Behavior)
Definition:Core.cpp:340
LLVM_DEFINE_VALUE_CAST
#define LLVM_DEFINE_VALUE_CAST(name)
Definition:Core.cpp:1144
llvm_getMetadata
static LLVMValueMetadataEntry * llvm_getMetadata(size_t *NumEntries, llvm::function_ref< void(MetadataEntries &)> AccessMD)
Definition:Core.cpp:1116
mapFromLLVMGEPNoWrapFlags
static GEPNoWrapFlags mapFromLLVMGEPNoWrapFlags(LLVMGEPNoWrapFlags GEPFlags)
Definition:Core.cpp:1717
extractMDNode
static MDNode * extractMDNode(MetadataAsValue *MAV)
Definition:Core.cpp:1092
LLVMPositionBuilderImpl
static void LLVMPositionBuilderImpl(IRBuilder<> *Builder, BasicBlock *Block, Instruction *Instr, bool BeforeDbgRecords)
Definition:Core.cpp:3276
map_to_llvmopcode
static LLVMOpcode map_to_llvmopcode(int opcode)
Definition:Core.cpp:1695
mapToLLVMFastMathFlags
static LLVMFastMathFlags mapToLLVMFastMathFlags(FastMathFlags FMF)
Definition:Core.cpp:3596
mapFromLLVMFastMathFlags
static FastMathFlags mapFromLLVMFastMathFlags(LLVMFastMathFlags FMF)
Definition:Core.cpp:3583
LLVMConstIntOfString
LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char Str[], uint8_t Radix)
Definition:Core.cpp:1552
mapFromLLVMOrdering
static AtomicOrdering mapFromLLVMOrdering(LLVMAtomicOrdering Ordering)
Definition:Core.cpp:3913
llvm_map_to_intrinsic_id
static Intrinsic::ID llvm_map_to_intrinsic_id(unsigned ID)
Definition:Core.cpp:2461
map_from_llvmModFlagBehavior
static LLVMModuleFlagBehavior map_from_llvmModFlagBehavior(Module::ModFlagBehavior Behavior)
Definition:Core.cpp:359
mapToLLVMOrdering
static LLVMAtomicOrdering mapToLLVMOrdering(AtomicOrdering Ordering)
Definition:Core.cpp:3929
LLVMBuildNUWNeg
LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition:Core.cpp:3762
getMDNodeOperandImpl
static LLVMValueRef getMDNodeOperandImpl(LLVMContext &Context, const MDNode *N, unsigned Index)
Definition:Core.cpp:1199
LLVMConstRealOfStringAndSize
LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const char Str[], unsigned SLen)
Definition:Core.cpp:1572
map_from_llvmopcode
static int map_from_llvmopcode(LLVMOpcode code)
Definition:Core.cpp:1705
mapToLLVMRMWBinOp
static LLVMAtomicRMWBinOp mapToLLVMRMWBinOp(AtomicRMWInst::BinOp BinOp)
Definition:Core.cpp:3975
mapFromLLVMRMWBinOp
static AtomicRMWInst::BinOp mapFromLLVMRMWBinOp(LLVMAtomicRMWBinOp BinOp)
Definition:Core.cpp:3945
LLVMConstNUWNeg
LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal)
Definition:Core.cpp:1763
LLVMConstIntOfStringAndSize
LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const char Str[], unsigned SLen, uint8_t Radix)
Definition:Core.cpp:1558
getGlobalContext
static LLVMContext & getGlobalContext()
Definition:Core.cpp:95
mapToLLVMGEPNoWrapFlags
static LLVMGEPNoWrapFlags mapToLLVMGEPNoWrapFlags(GEPNoWrapFlags GEPFlags)
Definition:Core.cpp:1729
unwrap
BasicBlock ** unwrap(LLVMBasicBlockRef *BBs)
Definition:Core.cpp:53
IntrinsicInst.h
Module.h
Module.h This file contains the declarations for the Module class.
InitializePasses.h
InlineAsm.h
Instructions.h
LLVMContext.h
LegacyPassManager.h
F
#define F(x, y, z)
Definition:MD5.cpp:55
I
#define I(x, y, z)
Definition:MD5.cpp:58
H
#define H(x, y, z)
Definition:MD5.cpp:57
ManagedStatic.h
MathExtras.h
MemoryBuffer.h
P
#define P(N)
Mod
if(auto Err=PB.parsePassPipeline(MPM, Passes)) return wrap(std MPM run * Mod
Definition:PassBuilderBindings.cpp:95
PassRegistry.h
List
const NodeList & List
Definition:RDFGraph.cpp:200
Cond
const SmallVectorImpl< MachineOperand > & Cond
Definition:RISCVRedundantCopyElimination.cpp:75
CC
auto CC
Definition:RISCVRedundantCopyElimination.cpp:79
CreateMul
static BinaryOperator * CreateMul(Value *S1, Value *S2, const Twine &Name, BasicBlock::iterator InsertBefore, Value *FlagsOp)
Definition:Reassociate.cpp:261
CreateAdd
static BinaryOperator * CreateAdd(Value *S1, Value *S2, const Twine &Name, BasicBlock::iterator InsertBefore, Value *FlagsOp)
Definition:Reassociate.cpp:248
CreateNeg
static Instruction * CreateNeg(Value *S1, const Twine &Name, BasicBlock::iterator InsertBefore, Value *FlagsOp)
Definition:Reassociate.cpp:274
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
getValueType
static Type * getValueType(Value *V)
Returns the type of the given value/instruction V.
Definition:SLPVectorizer.cpp:243
getType
static SymbolRef::Type getType(const Symbol *Sym)
Definition:TapiFile.cpp:39
Ptr
@ Ptr
Definition:TargetLibraryInfo.cpp:77
Threading.h
Types.h
block
unify loop Fixup each natural loop to have a single exit block
Definition:UnifyLoopExits.cpp:70
getOpcode
static std::optional< unsigned > getOpcode(ArrayRef< VPValue * > Values)
Returns the opcode of Values or ~0 if they do not all agree.
Definition:VPlanSLP.cpp:191
RHS
Value * RHS
Definition:X86PartialReduction.cpp:74
LHS
Value * LHS
Definition:X86PartialReduction.cpp:73
IV
static const uint32_t IV[8]
Definition:blake3_impl.h:78
FunctionType
Definition:ItaniumDemangle.h:823
T
llvm::APFloat
Definition:APFloat.h:904
llvm::APFloat::convert
opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
Definition:APFloat.cpp:5463
llvm::APFloat::convertToDouble
double convertToDouble() const
Converts this APFloat to host double value.
Definition:APFloat.cpp:5525
llvm::APInt
Class for arbitrary precision integers.
Definition:APInt.h:78
llvm::AllocaInst
an instruction to allocate memory on the stack
Definition:Instructions.h:63
llvm::Argument
This class represents an incoming formal argument to a Function.
Definition:Argument.h:31
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition:ArrayRef.h:41
llvm::AtomicCmpXchgInst
An instruction that atomically checks whether a specified value is in a memory location,...
Definition:Instructions.h:501
llvm::AtomicRMWInst
an instruction that atomically reads a memory location, combines it with another value,...
Definition:Instructions.h:704
llvm::AtomicRMWInst::BinOp
BinOp
This enumeration lists the possible modifications atomicrmw can make.
Definition:Instructions.h:716
llvm::AtomicRMWInst::Add
@ Add
*p = old + v
Definition:Instructions.h:720
llvm::AtomicRMWInst::FAdd
@ FAdd
*p = old + v
Definition:Instructions.h:741
llvm::AtomicRMWInst::USubCond
@ USubCond
Subtract only if no unsigned overflow.
Definition:Instructions.h:764
llvm::AtomicRMWInst::Min
@ Min
*p = old <signed v ? old : v
Definition:Instructions.h:734
llvm::AtomicRMWInst::Or
@ Or
*p = old | v
Definition:Instructions.h:728
llvm::AtomicRMWInst::Sub
@ Sub
*p = old - v
Definition:Instructions.h:722
llvm::AtomicRMWInst::And
@ And
*p = old & v
Definition:Instructions.h:724
llvm::AtomicRMWInst::Xor
@ Xor
*p = old ^ v
Definition:Instructions.h:730
llvm::AtomicRMWInst::USubSat
@ USubSat
*p = usub.sat(old, v) usub.sat matches the behavior of llvm.usub.sat.
Definition:Instructions.h:768
llvm::AtomicRMWInst::FSub
@ FSub
*p = old - v
Definition:Instructions.h:744
llvm::AtomicRMWInst::UIncWrap
@ UIncWrap
Increment one up to a maximum value.
Definition:Instructions.h:756
llvm::AtomicRMWInst::Max
@ Max
*p = old >signed v ? old : v
Definition:Instructions.h:732
llvm::AtomicRMWInst::UMin
@ UMin
*p = old <unsigned v ? old : v
Definition:Instructions.h:738
llvm::AtomicRMWInst::FMin
@ FMin
*p = minnum(old, v) minnum matches the behavior of llvm.minnum.
Definition:Instructions.h:752
llvm::AtomicRMWInst::UMax
@ UMax
*p = old >unsigned v ? old : v
Definition:Instructions.h:736
llvm::AtomicRMWInst::FMax
@ FMax
*p = maxnum(old, v) maxnum matches the behavior of llvm.maxnum.
Definition:Instructions.h:748
llvm::AtomicRMWInst::UDecWrap
@ UDecWrap
Decrement one until a minimum value or zero.
Definition:Instructions.h:760
llvm::AtomicRMWInst::Xchg
@ Xchg
*p = v
Definition:Instructions.h:718
llvm::AtomicRMWInst::Nand
@ Nand
*p = ~(old & v)
Definition:Instructions.h:726
llvm::Attribute
Definition:Attributes.h:67
llvm::Attribute::getAttrKindFromName
static Attribute::AttrKind getAttrKindFromName(StringRef AttrName)
Definition:Attributes.cpp:305
llvm::Attribute::get
static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
Definition:Attributes.cpp:95
llvm::Attribute::AttrKind
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
Definition:Attributes.h:86
llvm::Attribute::getWithAlignment
static Attribute getWithAlignment(LLVMContext &Context, Align Alignment)
Return a uniquified Attribute object that has the specific alignment set.
Definition:Attributes.cpp:234
llvm::BasicBlock
LLVM Basic Block Representation.
Definition:BasicBlock.h:61
llvm::BasicBlock::print
void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW=nullptr, bool ShouldPreserveUseListOrder=false, bool IsForDebug=false) const
Print the basic block to an output stream with an optional AssemblyAnnotationWriter.
Definition:AsmWriter.cpp:4901
llvm::BasicBlock::setIsNewDbgInfoFormat
void setIsNewDbgInfoFormat(bool NewFlag)
Ensure the block is in "old" dbg.value format (NewFlag == false) or in the new format (NewFlag == tru...
Definition:BasicBlock.cpp:152
llvm::BasicBlock::Create
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
Definition:BasicBlock.h:213
llvm::BasicBlock::moveAfter
void moveAfter(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it right after MovePos in the function M...
Definition:BasicBlock.cpp:287
llvm::BasicBlock::removeFromParent
void removeFromParent()
Unlink 'this' from the containing function, but do not delete it.
Definition:BasicBlock.cpp:275
llvm::BasicBlock::getParent
const Function * getParent() const
Return the enclosing method, or null if none.
Definition:BasicBlock.h:220
llvm::BasicBlock::eraseFromParent
SymbolTableList< BasicBlock >::iterator eraseFromParent()
Unlink 'this' from the containing function and delete it.
Definition:BasicBlock.cpp:279
llvm::BasicBlock::iterator
InstListType::iterator iterator
Instruction iterators...
Definition:BasicBlock.h:177
llvm::BasicBlock::getContext
LLVMContext & getContext() const
Get the context in which this basic block lives.
Definition:BasicBlock.cpp:168
llvm::BasicBlock::IsNewDbgInfoFormat
bool IsNewDbgInfoFormat
Flag recording whether or not this block stores debug-info in the form of intrinsic instructions (fal...
Definition:BasicBlock.h:67
llvm::BasicBlock::size
size_t size() const
Definition:BasicBlock.h:472
llvm::BasicBlock::moveBefore
void moveBefore(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it into the function that MovePos lives ...
Definition:BasicBlock.h:379
llvm::BlockAddress::get
static BlockAddress * get(Function *F, BasicBlock *BB)
Return a BlockAddress for the specified function and basic block.
Definition:Constants.cpp:1897
llvm::CallInst::TailCallKind
TailCallKind
Definition:Instructions.h:1572
llvm::CastInst::getCastOpcode
static Instruction::CastOps getCastOpcode(const Value *Val, bool SrcIsSigned, Type *Ty, bool DstIsSigned)
Returns the opcode necessary to cast Val into Ty using usual casting rules.
Definition:Instructions.cpp:3144
llvm::CatchSwitchInst
Definition:Instructions.h:4056
llvm::CatchSwitchInst::handlers
handler_range handlers()
iteration adapter for range-for loops.
Definition:Instructions.h:4175
llvm::ClauseVal
Definition:DirectiveEmitter.h:250
llvm::CleanupReturnInst
Definition:Instructions.h:4364
llvm::CmpInst::Predicate
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition:InstrTypes.h:673
llvm::ConstantArray::get
static Constant * get(ArrayType *T, ArrayRef< Constant * > V)
Definition:Constants.cpp:1312
llvm::ConstantAsMetadata::get
static ConstantAsMetadata * get(Constant *C)
Definition:Metadata.h:532
llvm::ConstantDataArray::getString
static Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true)
This method constructs a CDS and initializes it with a text string.
Definition:Constants.cpp:2991
llvm::ConstantExpr::getIntToPtr
static Constant * getIntToPtr(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Definition:Constants.cpp:2307
llvm::ConstantExpr::getExtractElement
static Constant * getExtractElement(Constant *Vec, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
Definition:Constants.cpp:2555
llvm::ConstantExpr::getAlignOf
static Constant * getAlignOf(Type *Ty)
getAlignOf constant expr - computes the alignment of a type in a target independent way (Note: the re...
Definition:Constants.cpp:2491
llvm::ConstantExpr::getNUWSub
static Constant * getNUWSub(Constant *C1, Constant *C2)
Definition:Constants.h:1173
llvm::ConstantExpr::getInBoundsGetElementPtr
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList)
Create an "inbounds" getelementptr.
Definition:Constants.h:1294
llvm::ConstantExpr::getPointerCast
static Constant * getPointerCast(Constant *C, Type *Ty)
Create a BitCast, AddrSpaceCast, or a PtrToInt cast constant expression.
Definition:Constants.cpp:2253
llvm::ConstantExpr::getTruncOrBitCast
static Constant * getTruncOrBitCast(Constant *C, Type *Ty)
Definition:Constants.cpp:2247
llvm::ConstantExpr::getNSWAdd
static Constant * getNSWAdd(Constant *C1, Constant *C2)
Definition:Constants.h:1161
llvm::ConstantExpr::getSub
static Constant * getSub(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Definition:Constants.cpp:2645
llvm::ConstantExpr::getNot
static Constant * getNot(Constant *C)
Definition:Constants.cpp:2632
llvm::ConstantExpr::getInsertElement
static Constant * getInsertElement(Constant *Vec, Constant *Elt, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
Definition:Constants.cpp:2577
llvm::ConstantExpr::getPtrToInt
static Constant * getPtrToInt(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Definition:Constants.cpp:2293
llvm::ConstantExpr::getShuffleVector
static Constant * getShuffleVector(Constant *V1, Constant *V2, ArrayRef< int > Mask, Type *OnlyIfReducedTy=nullptr)
Definition:Constants.cpp:2600
llvm::ConstantExpr::getSizeOf
static Constant * getSizeOf(Type *Ty)
getSizeOf constant expr - computes the (alloc) size of a type (in address-units, not bits) in a targe...
Definition:Constants.cpp:2480
llvm::ConstantExpr::getXor
static Constant * getXor(Constant *C1, Constant *C2)
Definition:Constants.cpp:2659
llvm::ConstantExpr::getMul
static Constant * getMul(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Definition:Constants.cpp:2652
llvm::ConstantExpr::getNSWNeg
static Constant * getNSWNeg(Constant *C)
Definition:Constants.h:1159
llvm::ConstantExpr::getNSWSub
static Constant * getNSWSub(Constant *C1, Constant *C2)
Definition:Constants.h:1169
llvm::ConstantExpr::getNUWAdd
static Constant * getNUWAdd(Constant *C1, Constant *C2)
Definition:Constants.h:1165
llvm::ConstantExpr::getAddrSpaceCast
static Constant * getAddrSpaceCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Definition:Constants.cpp:2333
llvm::ConstantExpr::getGetElementPtr
static Constant * getGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList, GEPNoWrapFlags NW=GEPNoWrapFlags::none(), std::optional< ConstantRange > InRange=std::nullopt, Type *OnlyIfReducedTy=nullptr)
Getelementptr form.
Definition:Constants.h:1267
llvm::ConstantExpr::getAdd
static Constant * getAdd(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Definition:Constants.cpp:2638
llvm::ConstantExpr::getBitCast
static Constant * getBitCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Definition:Constants.cpp:2321
llvm::ConstantExpr::getNSWMul
static Constant * getNSWMul(Constant *C1, Constant *C2)
Definition:Constants.h:1177
llvm::ConstantExpr::getNeg
static Constant * getNeg(Constant *C, bool HasNSW=false)
Definition:Constants.cpp:2626
llvm::ConstantExpr::getTrunc
static Constant * getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Definition:Constants.cpp:2279
llvm::ConstantExpr::getNUWMul
static Constant * getNUWMul(Constant *C1, Constant *C2)
Definition:Constants.h:1181
llvm::ConstantFP
ConstantFP - Floating Point Values [float, double].
Definition:Constants.h:271
llvm::ConstantFP::getValueAPF
const APFloat & getValueAPF() const
Definition:Constants.h:314
llvm::ConstantPointerNull::get
static ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
Definition:Constants.cpp:1826
llvm::ConstantPtrAuth::get
static ConstantPtrAuth * get(Constant *Ptr, ConstantInt *Key, ConstantInt *Disc, Constant *AddrDisc)
Return a pointer signed with the specified parameters.
Definition:Constants.cpp:2072
llvm::ConstantRange
This class represents a range of values.
Definition:ConstantRange.h:47
llvm::ConstantStruct::get
static Constant * get(StructType *T, ArrayRef< Constant * > V)
Definition:Constants.cpp:1378
llvm::ConstantStruct::getAnon
static Constant * getAnon(ArrayRef< Constant * > V, bool Packed=false)
Return an anonymous struct that has the specified elements.
Definition:Constants.h:480
llvm::ConstantVector::get
static Constant * get(ArrayRef< Constant * > V)
Definition:Constants.cpp:1421
llvm::Constant
This is an important base class in LLVM.
Definition:Constant.h:42
llvm::Constant::getAllOnesValue
static Constant * getAllOnesValue(Type *Ty)
Definition:Constants.cpp:420
llvm::Constant::getNullValue
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
Definition:Constants.cpp:373
llvm::DIGlobalVariable
Global variables.
Definition:DebugInfoMetadata.h:3315
llvm::DISubprogram
Subprogram description.
Definition:DebugInfoMetadata.h:1710
llvm::DWARFExpression::Operation
This class represents an Operation in the Expression.
Definition:DWARFExpression.h:32
llvm::DbgRecord
Base class for non-instruction debug metadata records that have positions within IR.
Definition:DebugProgramInstruction.h:134
llvm::DebugLoc
A debug info location.
Definition:DebugLoc.h:33
llvm::DiagnosticPrinterRawOStream
Basic diagnostic printer that uses an underlying raw_ostream.
Definition:DiagnosticPrinter.h:61
llvm::ElementCount
Definition:TypeSize.h:300
llvm::ErrorOr
Represents either an error or a value T.
Definition:ErrorOr.h:56
llvm::ErrorOr::get
reference get()
Definition:ErrorOr.h:149
llvm::ErrorOr::getError
std::error_code getError() const
Definition:ErrorOr.h:152
llvm::FCmpInst
This instruction compares its operands according to the predicate given to the constructor.
Definition:Instructions.h:1379
llvm::FastMathFlags
Convenience struct for specifying and reasoning about fast-math flags.
Definition:FMF.h:20
llvm::FastMathFlags::setAllowContract
void setAllowContract(bool B=true)
Definition:FMF.h:91
llvm::FastMathFlags::noSignedZeros
bool noSignedZeros() const
Definition:FMF.h:68
llvm::FastMathFlags::noInfs
bool noInfs() const
Definition:FMF.h:67
llvm::FastMathFlags::setAllowReciprocal
void setAllowReciprocal(bool B=true)
Definition:FMF.h:88
llvm::FastMathFlags::allowReciprocal
bool allowReciprocal() const
Definition:FMF.h:69
llvm::FastMathFlags::setNoSignedZeros
void setNoSignedZeros(bool B=true)
Definition:FMF.h:85
llvm::FastMathFlags::allowReassoc
bool allowReassoc() const
Flag queries.
Definition:FMF.h:65
llvm::FastMathFlags::approxFunc
bool approxFunc() const
Definition:FMF.h:71
llvm::FastMathFlags::setNoNaNs
void setNoNaNs(bool B=true)
Definition:FMF.h:79
llvm::FastMathFlags::setAllowReassoc
void setAllowReassoc(bool B=true)
Flag setters.
Definition:FMF.h:76
llvm::FastMathFlags::noNaNs
bool noNaNs() const
Definition:FMF.h:66
llvm::FastMathFlags::setApproxFunc
void setApproxFunc(bool B=true)
Definition:FMF.h:94
llvm::FastMathFlags::setNoInfs
void setNoInfs(bool B=true)
Definition:FMF.h:82
llvm::FastMathFlags::allowContract
bool allowContract() const
Definition:FMF.h:70
llvm::FenceInst
An instruction for ordering other memory operations.
Definition:Instructions.h:424
llvm::FixedVectorType::get
static FixedVectorType * get(Type *ElementType, unsigned NumElts)
Definition:Type.cpp:791
llvm::FuncletPadInst
Definition:InstrTypes.h:2327
llvm::Function
Definition:Function.h:63
llvm::Function::Create
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
Definition:Function.h:173
llvm::Function::iterator
BasicBlockListType::iterator iterator
Definition:Function.h:68
llvm::Function::args
iterator_range< arg_iterator > args()
Definition:Function.h:892
llvm::Function::setPersonalityFn
void setPersonalityFn(Constant *Fn)
Definition:Function.cpp:1053
llvm::Function::arg_begin
arg_iterator arg_begin()
Definition:Function.h:868
llvm::Function::insert
Function::iterator insert(Function::iterator Position, BasicBlock *BB)
Insert BB in the basic block list at Position.
Definition:Function.h:754
llvm::Function::arg_size
size_t arg_size() const
Definition:Function.h:901
llvm::GEPNoWrapFlags
Represents flags for the getelementptr instruction/expression.
Definition:GEPNoWrapFlags.h:26
llvm::GEPNoWrapFlags::inBounds
static GEPNoWrapFlags inBounds()
Definition:GEPNoWrapFlags.h:50
llvm::GEPNoWrapFlags::noUnsignedWrap
static GEPNoWrapFlags noUnsignedWrap()
Definition:GEPNoWrapFlags.h:56
llvm::GEPNoWrapFlags::noUnsignedSignedWrap
static GEPNoWrapFlags noUnsignedSignedWrap()
Definition:GEPNoWrapFlags.h:53
llvm::GEPNoWrapFlags::hasNoUnsignedSignedWrap
bool hasNoUnsignedSignedWrap() const
Definition:GEPNoWrapFlags.h:64
llvm::GEPNoWrapFlags::hasNoUnsignedWrap
bool hasNoUnsignedWrap() const
Definition:GEPNoWrapFlags.h:65
llvm::GEPNoWrapFlags::isInBounds
bool isInBounds() const
Definition:GEPNoWrapFlags.h:63
llvm::GEPOperator
Definition:Operator.h:425
llvm::GEPOperator::getNoWrapFlags
GEPNoWrapFlags getNoWrapFlags() const
Definition:Operator.h:430
llvm::GetElementPtrInst
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
Definition:Instructions.h:933
llvm::GetElementPtrInst::setNoWrapFlags
void setNoWrapFlags(GEPNoWrapFlags NW)
Set nowrap flags for GEP instruction.
Definition:Instructions.cpp:1552
llvm::GlobalAlias
Definition:GlobalAlias.h:28
llvm::GlobalAlias::create
static GlobalAlias * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Aliasee, Module *Parent)
If a parent module is specified, the alias is automatically inserted into the end of the specified mo...
Definition:Globals.cpp:557
llvm::GlobalIFunc
Definition:GlobalIFunc.h:34
llvm::GlobalIFunc::create
static GlobalIFunc * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Resolver, Module *Parent)
If a parent module is specified, the ifunc is automatically inserted into the end of the specified mo...
Definition:Globals.cpp:614
llvm::GlobalObject
Definition:GlobalObject.h:27
llvm::GlobalValue
Definition:GlobalValue.h:48
llvm::GlobalValue::setUnnamedAddr
void setUnnamedAddr(UnnamedAddr Val)
Definition:GlobalValue.h:232
llvm::GlobalValue::setThreadLocalMode
void setThreadLocalMode(ThreadLocalMode Val)
Definition:GlobalValue.h:268
llvm::GlobalValue::setLinkage
void setLinkage(LinkageTypes LT)
Definition:GlobalValue.h:538
llvm::GlobalValue::DLLStorageClassTypes
DLLStorageClassTypes
Storage classes of global values for PE targets.
Definition:GlobalValue.h:73
llvm::GlobalValue::getParent
Module * getParent()
Get the module that this global value is contained inside of...
Definition:GlobalValue.h:657
llvm::GlobalValue::VisibilityTypes
VisibilityTypes
An enumeration for the kinds of visibility of global values.
Definition:GlobalValue.h:66
llvm::GlobalValue::PrivateLinkage
@ PrivateLinkage
Like Internal, but omit from symbol table.
Definition:GlobalValue.h:60
llvm::GlobalValue::CommonLinkage
@ CommonLinkage
Tentative definitions.
Definition:GlobalValue.h:62
llvm::GlobalValue::InternalLinkage
@ InternalLinkage
Rename collisions when linking (static functions).
Definition:GlobalValue.h:59
llvm::GlobalValue::LinkOnceAnyLinkage
@ LinkOnceAnyLinkage
Keep one copy of function when linking (inline)
Definition:GlobalValue.h:54
llvm::GlobalValue::WeakODRLinkage
@ WeakODRLinkage
Same, but only replaced by something equivalent.
Definition:GlobalValue.h:57
llvm::GlobalValue::ExternalLinkage
@ ExternalLinkage
Externally visible function.
Definition:GlobalValue.h:52
llvm::GlobalValue::WeakAnyLinkage
@ WeakAnyLinkage
Keep one copy of named function when linking (weak)
Definition:GlobalValue.h:56
llvm::GlobalValue::AppendingLinkage
@ AppendingLinkage
Special purpose, only applies to global arrays.
Definition:GlobalValue.h:58
llvm::GlobalValue::AvailableExternallyLinkage
@ AvailableExternallyLinkage
Available for inspection, not emission.
Definition:GlobalValue.h:53
llvm::GlobalValue::ExternalWeakLinkage
@ ExternalWeakLinkage
ExternalWeak linkage description.
Definition:GlobalValue.h:61
llvm::GlobalValue::LinkOnceODRLinkage
@ LinkOnceODRLinkage
Same, but only replaced by something equivalent.
Definition:GlobalValue.h:55
llvm::GlobalVariable
Definition:GlobalVariable.h:39
llvm::GlobalVariable::getInitializer
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
Definition:GlobalVariable.h:150
llvm::GlobalVariable::hasInitializer
bool hasInitializer() const
Definitions have initializers, declarations don't.
Definition:GlobalVariable.h:106
llvm::ICmpInst
This instruction compares its operands according to the predicate given to the constructor.
Definition:Instructions.h:1158
llvm::IRBuilderBase::SetInsertPoint
void SetInsertPoint(BasicBlock *TheBB)
This specifies that created instructions should be appended to the end of the specified block.
Definition:IRBuilder.h:199
llvm::IRBuilder
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition:IRBuilder.h:2705
llvm::InlineAsm::AsmDialect
AsmDialect
Definition:InlineAsm.h:36
llvm::InlineAsm::AD_Intel
@ AD_Intel
Definition:InlineAsm.h:38
llvm::InlineAsm::AD_ATT
@ AD_ATT
Definition:InlineAsm.h:37
llvm::InlineAsm::get
static InlineAsm * get(FunctionType *Ty, StringRef AsmString, StringRef Constraints, bool hasSideEffects, bool isAlignStack=false, AsmDialect asmDialect=AD_ATT, bool canThrow=false)
InlineAsm::get - Return the specified uniqued inline asm string.
Definition:InlineAsm.cpp:43
llvm::Instruction
Definition:Instruction.h:68
llvm::Instruction::BinaryOps
BinaryOps
Definition:Instruction.h:989
llvm::Instruction::CastOps
CastOps
Definition:Instruction.h:1003
llvm::IntegerType
Class to represent integer types.
Definition:DerivedTypes.h:42
llvm::IntegerType::get
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition:Type.cpp:311
llvm::IntegerType::getBitWidth
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
Definition:DerivedTypes.h:74
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition:LLVMContext.h:67
llvm::LLVMContext::YieldCallbackTy
void(*)(LLVMContext *Context, void *OpaqueHandle) YieldCallbackTy
Defines the type of a yield callback.
Definition:LLVMContext.h:168
llvm::LoadInst
An instruction for reading from memory.
Definition:Instructions.h:176
llvm::LocalAsMetadata::get
static LocalAsMetadata * get(Value *Local)
Definition:Metadata.h:558
llvm::MDNode
Metadata node.
Definition:Metadata.h:1073
llvm::MDNode::get
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition:Metadata.h:1549
llvm::MDString
A single uniqued string.
Definition:Metadata.h:724
llvm::MDString::get
static MDString * get(LLVMContext &Context, StringRef Str)
Definition:Metadata.cpp:606
llvm::MemoryBuffer::getMemBuffer
static std::unique_ptr< MemoryBuffer > getMemBuffer(StringRef InputData, StringRef BufferName="", bool RequiresNullTerminator=true)
Open the specified memory range as a MemoryBuffer.
Definition:MemoryBuffer.cpp:129
llvm::MemoryBuffer::getMemBufferCopy
static std::unique_ptr< MemoryBuffer > getMemBufferCopy(StringRef InputData, const Twine &BufferName="")
Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it.
Definition:MemoryBuffer.cpp:155
llvm::MemoryBuffer::getFile
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, bool IsVolatile=false, std::optional< Align > Alignment=std::nullopt)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...
Definition:MemoryBuffer.cpp:260
llvm::MemoryBuffer::getSTDIN
static ErrorOr< std::unique_ptr< MemoryBuffer > > getSTDIN()
Read all of stdin into a file buffer, and return it.
Definition:MemoryBuffer.cpp:566
llvm::MetadataAsValue
Metadata wrapper in the Value hierarchy.
Definition:Metadata.h:180
llvm::MetadataAsValue::get
static MetadataAsValue * get(LLVMContext &Context, Metadata *MD)
Definition:Metadata.cpp:103
llvm::MetadataAsValue::getMetadata
Metadata * getMetadata() const
Definition:Metadata.h:197
llvm::Metadata
Root of the metadata hierarchy.
Definition:Metadata.h:62
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition:Module.h:65
llvm::Module::global_begin
global_iterator global_begin()
Definition:Module.h:695
llvm::Module::ifunc_begin
ifunc_iterator ifunc_begin()
Definition:Module.h:753
llvm::Module::ModFlagBehavior
ModFlagBehavior
This enumeration defines the supported behaviors of module flags.
Definition:Module.h:115
llvm::Module::global_end
global_iterator global_end()
Definition:Module.h:697
llvm::Module::named_metadata_iterator
NamedMDListType::iterator named_metadata_iterator
The named metadata iterators.
Definition:Module.h:110
llvm::Module::ifunc_iterator
IFuncListType::iterator ifunc_iterator
The Global IFunc iterators.
Definition:Module.h:105
llvm::Module::named_metadata_begin
named_metadata_iterator named_metadata_begin()
Definition:Module.h:794
llvm::Module::ifunc_end
ifunc_iterator ifunc_end()
Definition:Module.h:755
llvm::Module::alias_end
alias_iterator alias_end()
Definition:Module.h:737
llvm::Module::alias_begin
alias_iterator alias_begin()
Definition:Module.h:735
llvm::Module::iterator
FunctionListType::iterator iterator
The Function iterators.
Definition:Module.h:90
llvm::Module::global_iterator
GlobalListType::iterator global_iterator
The Global Variable iterator.
Definition:Module.h:85
llvm::Module::alias_iterator
AliasListType::iterator alias_iterator
The Global Alias iterators.
Definition:Module.h:100
llvm::Module::named_metadata_end
named_metadata_iterator named_metadata_end()
Definition:Module.h:799
llvm::NamedMDNode
A tuple of MDNodes.
Definition:Metadata.h:1737
llvm::NamedMDNode::getName
StringRef getName() const
Definition:Metadata.cpp:1442
llvm::NamedMDNode::getParent
Module * getParent()
Get the module that holds this named metadata collection.
Definition:Metadata.h:1807
llvm::OperandBundleDefT
A container for an operand bundle being viewed as a set of values rather than a set of uses.
Definition:InstrTypes.h:1065
llvm::PHINode
Definition:Instructions.h:2600
llvm::PHINode::addIncoming
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
Definition:Instructions.h:2735
llvm::PassRegistry
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
Definition:PassRegistry.h:37
llvm::PoisonValue::get
static PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
Definition:Constants.cpp:1878
llvm::Record
Definition:Record.h:1596
llvm::Registry
A global registry used in conjunction with static constructors to make pluggable components (like tar...
Definition:Registry.h:44
llvm::Resolver
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
Definition:Record.h:2148
llvm::ScalableVectorType::get
static ScalableVectorType * get(Type *ElementType, unsigned MinNumElts)
Definition:Type.cpp:812
llvm::ShuffleVectorInst
This instruction constructs a fixed permutation of two input vectors.
Definition:Instructions.h:1901
llvm::ShuffleVectorInst::getShuffleMask
ArrayRef< int > getShuffleMask() const
Definition:Instructions.h:1974
llvm::SmallVectorBase::size
size_t size() const
Definition:SmallVector.h:78
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition:SmallVector.h:573
llvm::SmallVectorTemplateBase::push_back
void push_back(const T &Elt)
Definition:SmallVector.h:413
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition:SmallVector.h:1196
llvm::StoreInst
An instruction for storing to memory.
Definition:Instructions.h:292
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:StringRef.h:51
llvm::StringRef::size
constexpr size_t size() const
size - Get the string size.
Definition:StringRef.h:150
llvm::StringRef::data
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition:StringRef.h:144
llvm::StructType
Class to represent struct types.
Definition:DerivedTypes.h:218
llvm::StructType::get
static StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
Definition:Type.cpp:406
llvm::StructType::elements
ArrayRef< Type * > elements() const
Definition:DerivedTypes.h:357
llvm::StructType::getTypeByName
static StructType * getTypeByName(LLVMContext &C, StringRef Name)
Return the type with the specified name, or null if there is none by that name.
Definition:Type.cpp:731
llvm::StructType::create
static StructType * create(LLVMContext &Context, StringRef Name)
This creates an identified struct.
Definition:Type.cpp:612
llvm::StructType::getTypeAtIndex
Type * getTypeAtIndex(const Value *V) const
Given an index value into the type, return the type of the element.
Definition:Type.cpp:711
llvm::TargetExtType
Class to represent target extensions types, which are generally unintrospectable from target-independ...
Definition:DerivedTypes.h:744
llvm::TargetExtType::get
static TargetExtType * get(LLVMContext &Context, StringRef Name, ArrayRef< Type * > Types={}, ArrayRef< unsigned > Ints={})
Return a target extension type having the specified name and optional type and integer parameters.
Definition:Type.cpp:895
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition:Triple.h:44
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition:Type.h:45
llvm::Type::getHalfTy
static Type * getHalfTy(LLVMContext &C)
llvm::Type::getDoubleTy
static Type * getDoubleTy(LLVMContext &C)
llvm::Type::getX86_FP80Ty
static Type * getX86_FP80Ty(LLVMContext &C)
llvm::Type::getBFloatTy
static Type * getBFloatTy(LLVMContext &C)
llvm::Type::getInt1Ty
static IntegerType * getInt1Ty(LLVMContext &C)
llvm::Type::isFloatTy
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
Definition:Type.h:153
llvm::Type::getX86_AMXTy
static Type * getX86_AMXTy(LLVMContext &C)
llvm::Type::isBFloatTy
bool isBFloatTy() const
Return true if this is 'bfloat', a 16-bit bfloat type.
Definition:Type.h:145
llvm::Type::getMetadataTy
static Type * getMetadataTy(LLVMContext &C)
llvm::Type::X86_AMXTyID
@ X86_AMXTyID
AMX vectors (8192 bits, X86 specific)
Definition:Type.h:66
llvm::Type::FunctionTyID
@ FunctionTyID
Functions.
Definition:Type.h:71
llvm::Type::ArrayTyID
@ ArrayTyID
Arrays.
Definition:Type.h:74
llvm::Type::TypedPointerTyID
@ TypedPointerTyID
Typed pointer used by some GPU targets.
Definition:Type.h:77
llvm::Type::HalfTyID
@ HalfTyID
16-bit floating point type
Definition:Type.h:56
llvm::Type::TargetExtTyID
@ TargetExtTyID
Target extension type.
Definition:Type.h:78
llvm::Type::VoidTyID
@ VoidTyID
type with no size
Definition:Type.h:63
llvm::Type::ScalableVectorTyID
@ ScalableVectorTyID
Scalable SIMD vector type.
Definition:Type.h:76
llvm::Type::LabelTyID
@ LabelTyID
Labels.
Definition:Type.h:64
llvm::Type::FloatTyID
@ FloatTyID
32-bit floating point type
Definition:Type.h:58
llvm::Type::StructTyID
@ StructTyID
Structures.
Definition:Type.h:73
llvm::Type::IntegerTyID
@ IntegerTyID
Arbitrary bit width integers.
Definition:Type.h:70
llvm::Type::FixedVectorTyID
@ FixedVectorTyID
Fixed width SIMD vector type.
Definition:Type.h:75
llvm::Type::BFloatTyID
@ BFloatTyID
16-bit floating point type (7-bit significand)
Definition:Type.h:57
llvm::Type::DoubleTyID
@ DoubleTyID
64-bit floating point type
Definition:Type.h:59
llvm::Type::X86_FP80TyID
@ X86_FP80TyID
80-bit floating point type (X87)
Definition:Type.h:60
llvm::Type::PPC_FP128TyID
@ PPC_FP128TyID
128-bit floating point type (two 64-bits, PowerPC)
Definition:Type.h:62
llvm::Type::MetadataTyID
@ MetadataTyID
Metadata.
Definition:Type.h:65
llvm::Type::TokenTyID
@ TokenTyID
Tokens.
Definition:Type.h:67
llvm::Type::PointerTyID
@ PointerTyID
Pointers.
Definition:Type.h:72
llvm::Type::FP128TyID
@ FP128TyID
128-bit floating point type (112-bit significand)
Definition:Type.h:61
llvm::Type::getVoidTy
static Type * getVoidTy(LLVMContext &C)
llvm::Type::getLabelTy
static Type * getLabelTy(LLVMContext &C)
llvm::Type::getFP128Ty
static Type * getFP128Ty(LLVMContext &C)
llvm::Type::getInt16Ty
static IntegerType * getInt16Ty(LLVMContext &C)
llvm::Type::isHalfTy
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
Definition:Type.h:142
llvm::Type::getContext
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition:Type.h:128
llvm::Type::getInt8Ty
static IntegerType * getInt8Ty(LLVMContext &C)
llvm::Type::getInt128Ty
static IntegerType * getInt128Ty(LLVMContext &C)
llvm::Type::isDoubleTy
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
Definition:Type.h:156
llvm::Type::getTokenTy
static Type * getTokenTy(LLVMContext &C)
llvm::Type::getInt32Ty
static IntegerType * getInt32Ty(LLVMContext &C)
llvm::Type::getInt64Ty
static IntegerType * getInt64Ty(LLVMContext &C)
llvm::Type::getFloatTy
static Type * getFloatTy(LLVMContext &C)
llvm::Type::getPPC_FP128Ty
static Type * getPPC_FP128Ty(LLVMContext &C)
llvm::UndefValue::get
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
Definition:Constants.cpp:1859
llvm::Use
A Use represents the edge between a Value definition and its users.
Definition:Use.h:43
llvm::ValueAsMetadata::get
static ValueAsMetadata * get(Value *V)
Definition:Metadata.cpp:501
llvm::Value
LLVM Value Representation.
Definition:Value.h:74
llvm::Value::getType
Type * getType() const
All values are typed, get the type of this value.
Definition:Value.h:255
llvm::Value::setName
void setName(const Twine &Name)
Change the name of the value.
Definition:Value.cpp:377
llvm::Value::replaceAllUsesWith
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
Definition:Value.cpp:534
llvm::Value::use_iterator
use_iterator_impl< Use > use_iterator
Definition:Value.h:353
llvm::Value::getContext
LLVMContext & getContext() const
All values hold a context through their type.
Definition:Value.cpp:1075
llvm::Value::getName
StringRef getName() const
Return a constant reference to the value's name.
Definition:Value.cpp:309
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition:STLFunctionalExtras.h:37
llvm::ilist_node_impl::getIterator
self_iterator getIterator()
Definition:ilist_node.h:132
llvm::legacy::FunctionPassManager
FunctionPassManager manages FunctionPasses.
Definition:LegacyPassManager.h:71
llvm::legacy::PassManager
PassManager manages ModulePassManagers.
Definition:LegacyPassManager.h:52
llvm::raw_fd_ostream
A raw_ostream that writes to a file descriptor.
Definition:raw_ostream.h:460
llvm::raw_fd_ostream::has_error
bool has_error() const
Return the value of the flag in this raw_fd_ostream indicating whether an output error has been encou...
Definition:raw_ostream.h:562
llvm::raw_fd_ostream::error
std::error_code error() const
Definition:raw_ostream.h:556
llvm::raw_fd_ostream::close
void close()
Manually flush the stream and close the file.
Definition:raw_ostream.cpp:804
llvm::raw_ostream::flush
void flush()
Definition:raw_ostream.h:198
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition:raw_ostream.h:661
llvm::simple_ilist::iterator
typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, false, false >::type iterator
Definition:simple_ilist.h:97
uint64_t
uint8_t
unsigned
LLVMGetGlobalContext
LLVMContextRef LLVMGetGlobalContext()
Obtain the global context instance.
Definition:Core.cpp:104
LLVMGetEnumAttributeKind
unsigned LLVMGetEnumAttributeKind(LLVMAttributeRef A)
Get the unique id corresponding to the enum attribute passed as argument.
Definition:Core.cpp:171
LLVMContextSetDiscardValueNames
void LLVMContextSetDiscardValueNames(LLVMContextRef C, LLVMBool Discard)
Set whether the given context discards all value names.
Definition:Core.cpp:135
LLVMGetEnumAttributeValue
uint64_t LLVMGetEnumAttributeValue(LLVMAttributeRef A)
Get the enum attribute's value.
Definition:Core.cpp:175
LLVMGetTypeAttributeValue
LLVMTypeRef LLVMGetTypeAttributeValue(LLVMAttributeRef A)
Get the type attribute's value.
Definition:Core.cpp:189
LLVMGetMDKindIDInContext
unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char *Name, unsigned SLen)
Definition:Core.cpp:143
LLVMGetDiagInfoSeverity
LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI)
Return an enum LLVMDiagnosticSeverity.
Definition:Core.cpp:253
LLVMGetDiagInfoDescription
char * LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI)
Return a string representation of the DiagnosticInfo.
Definition:Core.cpp:242
LLVMGetEnumAttributeKindForName
unsigned LLVMGetEnumAttributeKindForName(const char *Name, size_t SLen)
Return an unique id given the name of a enum attribute, or 0 if no attribute by that name exists.
Definition:Core.cpp:156
LLVMGetSyncScopeID
unsigned LLVMGetSyncScopeID(LLVMContextRef C, const char *Name, size_t SLen)
Maps a synchronization scope name to a ID unique within this context.
Definition:Core.cpp:152
LLVMContextGetDiagnosticHandler
LLVMDiagnosticHandler LLVMContextGetDiagnosticHandler(LLVMContextRef C)
Get the diagnostic handler of this context.
Definition:Core.cpp:115
LLVMContextShouldDiscardValueNames
LLVMBool LLVMContextShouldDiscardValueNames(LLVMContextRef C)
Retrieve whether the given context is set to discard all value names.
Definition:Core.cpp:131
LLVMCreateTypeAttribute
LLVMAttributeRef LLVMCreateTypeAttribute(LLVMContextRef C, unsigned KindID, LLVMTypeRef type_ref)
Create a type attribute.
Definition:Core.cpp:182
LLVMCreateStringAttribute
LLVMAttributeRef LLVMCreateStringAttribute(LLVMContextRef C, const char *K, unsigned KLength, const char *V, unsigned VLength)
Create a string attribute.
Definition:Core.cpp:208
LLVMCreateConstantRangeAttribute
LLVMAttributeRef LLVMCreateConstantRangeAttribute(LLVMContextRef C, unsigned KindID, unsigned NumBits, const uint64_t LowerWords[], const uint64_t UpperWords[])
Create a ConstantRange attribute.
Definition:Core.cpp:194
LLVMContextDispose
void LLVMContextDispose(LLVMContextRef C)
Destroy a context instance.
Definition:Core.cpp:139
LLVMCreateEnumAttribute
LLVMAttributeRef LLVMCreateEnumAttribute(LLVMContextRef C, unsigned KindID, uint64_t Val)
Create an enum attribute.
Definition:Core.cpp:164
LLVMGetStringAttributeKind
const char * LLVMGetStringAttributeKind(LLVMAttributeRef A, unsigned *Length)
Get the string attribute's kind.
Definition:Core.cpp:215
LLVMGetTypeByName2
LLVMTypeRef LLVMGetTypeByName2(LLVMContextRef C, const char *Name)
Obtain a Type from a context by its registered name.
Definition:Core.cpp:853
LLVMContextCreate
LLVMContextRef LLVMContextCreate()
Create a new context.
Definition:Core.cpp:100
LLVMYieldCallback
void(* LLVMYieldCallback)(LLVMContextRef, void *)
Definition:Core.h:568
LLVMGetLastEnumAttributeKind
unsigned LLVMGetLastEnumAttributeKind(void)
Definition:Core.cpp:160
LLVMIsStringAttribute
LLVMBool LLVMIsStringAttribute(LLVMAttributeRef A)
Definition:Core.cpp:234
LLVMIsTypeAttribute
LLVMBool LLVMIsTypeAttribute(LLVMAttributeRef A)
Definition:Core.cpp:238
LLVMGetStringAttributeValue
const char * LLVMGetStringAttributeValue(LLVMAttributeRef A, unsigned *Length)
Get the string attribute's value.
Definition:Core.cpp:222
LLVMContextSetYieldCallback
void LLVMContextSetYieldCallback(LLVMContextRef C, LLVMYieldCallback Callback, void *OpaqueHandle)
Set the yield callback function for this context.
Definition:Core.cpp:124
LLVMGetMDKindID
unsigned LLVMGetMDKindID(const char *Name, unsigned SLen)
Definition:Core.cpp:148
LLVMContextSetDiagnosticHandler
void LLVMContextSetDiagnosticHandler(LLVMContextRef C, LLVMDiagnosticHandler Handler, void *DiagnosticContext)
Set the diagnostic handler for this context.
Definition:Core.cpp:106
LLVMDiagnosticHandler
void(* LLVMDiagnosticHandler)(LLVMDiagnosticInfoRef, void *)
Definition:Core.h:567
LLVMContextGetDiagnosticContext
void * LLVMContextGetDiagnosticContext(LLVMContextRef C)
Get the diagnostic context of this context.
Definition:Core.cpp:120
LLVMIsEnumAttribute
LLVMBool LLVMIsEnumAttribute(LLVMAttributeRef A)
Check for the different types of attributes.
Definition:Core.cpp:229
LLVMBuildLoad2
LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name)
Definition:Core.cpp:3903
LLVMBuildGlobalStringPtr
LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str, const char *Name)
Deprecated: Use LLVMBuildGlobalString instead, which has identical behavior.
Definition:Core.cpp:4059
LLVMBuildFence
LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, LLVMBool isSingleThread, const char *Name)
Definition:Core.cpp:4006
LLVMBuildAtomicRMW
LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, LLVMBool singleThread)
Definition:Core.cpp:4360
LLVMGetIsDisjoint
LLVMBool LLVMGetIsDisjoint(LLVMValueRef Inst)
Gets whether the instruction has the disjoint flag set.
Definition:Core.cpp:3834
LLVMBuildNot
LLVMValueRef LLVMBuildNot(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition:Core.cpp:3774
LLVMSetAtomicSyncScopeID
void LLVMSetAtomicSyncScopeID(LLVMValueRef AtomicInst, unsigned SSID)
Sets the synchronization scope ID of an atomic instruction.
Definition:Core.cpp:4449
LLVMBuildInvokeWithOperandBundles
LLVMValueRef LLVMBuildInvokeWithOperandBundles(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name)
Definition:Core.cpp:3444
LLVMBuildNSWSub
LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3641
LLVMBuildAnd
LLVMValueRef LLVMBuildAnd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3731
LLVMBuildFPExt
LLVMValueRef LLVMBuildFPExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4171
LLVMClearInsertionPosition
void LLVMClearInsertionPosition(LLVMBuilderRef Builder)
Definition:Core.cpp:3316
LLVMBuildFDiv
LLVMValueRef LLVMBuildFDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3696
LLVMSetWeak
void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak)
Definition:Core.cpp:4090
LLVMSetNSW
void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW)
Definition:Core.cpp:3793
LLVMBuildFreeze
LLVMValueRef LLVMBuildFreeze(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition:Core.cpp:4338
LLVMBuildFAdd
LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3631
LLVMBuildFMul
LLVMValueRef LLVMBuildFMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3671
LLVMBuildZExt
LLVMValueRef LLVMBuildZExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4136
LLVMBuildSExt
LLVMValueRef LLVMBuildSExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4141
LLVMBuildTruncOrBitCast
LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4208
LLVMBuildSExtOrBitCast
LLVMValueRef LLVMBuildSExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4202
LLVMBuildBitCast
LLVMValueRef LLVMBuildBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4186
LLVMBuilderSetDefaultFPMathTag
void LLVMBuilderSetDefaultFPMathTag(LLVMBuilderRef Builder, LLVMMetadataRef FPMathTag)
Set the default floating-point math metadata for the given builder.
Definition:Core.cpp:3366
LLVMBuildExtractValue
LLVMValueRef LLVMBuildExtractValue(LLVMBuilderRef B, LLVMValueRef AggVal, unsigned Index, const char *Name)
Definition:Core.cpp:4326
LLVMBuildFCmp
LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef B, LLVMRealPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:4258
LLVMSetCmpXchgFailureOrdering
void LLVMSetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition:Core.cpp:4473
LLVMBuildAtomicCmpXchgSyncScope
LLVMValueRef LLVMBuildAtomicCmpXchgSyncScope(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, unsigned SSID)
Definition:Core.cpp:4395
LLVMBuildFPTrunc
LLVMValueRef LLVMBuildFPTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4166
LLVMGetCmpXchgFailureOrdering
LLVMAtomicOrdering LLVMGetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst)
Definition:Core.cpp:4468
LLVMGetCastOpcode
LLVMOpcode LLVMGetCastOpcode(LLVMValueRef Src, LLVMBool SrcIsSigned, LLVMTypeRef DestTy, LLVMBool DestIsSigned)
Definition:Core.cpp:4243
LLVMGetAtomicRMWBinOp
LLVMAtomicRMWBinOp LLVMGetAtomicRMWBinOp(LLVMValueRef Inst)
Definition:Core.cpp:4121
LLVMSetNUW
void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW)
Definition:Core.cpp:3783
LLVMBuildSIToFP
LLVMValueRef LLVMBuildSIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4161
LLVMBuildShl
LLVMValueRef LLVMBuildShl(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3716
LLVMSetCurrentDebugLocation2
void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Builder, LLVMMetadataRef Loc)
Set location information used by debugging information.
Definition:Core.cpp:3339
LLVMGetUndefMaskElem
int LLVMGetUndefMaskElem(void)
Definition:Core.cpp:4418
LLVMGetWeak
LLVMBool LLVMGetWeak(LLVMValueRef CmpXchgInst)
Definition:Core.cpp:4086
LLVMBuildFRem
LLVMValueRef LLVMBuildFRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3711
LLVMBuildAlloca
LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition:Core.cpp:3889
LLVMBuildSelect
LLVMValueRef LLVMBuildSelect(LLVMBuilderRef B, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, const char *Name)
Definition:Core.cpp:4294
LLVMBuildCatchPad
LLVMValueRef LLVMBuildCatchPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition:Core.cpp:3470
LLVMSetIsDisjoint
void LLVMSetIsDisjoint(LLVMValueRef Inst, LLVMBool IsDisjoint)
Sets the disjoint flag for the instruction.
Definition:Core.cpp:3839
LLVMBuildMul
LLVMValueRef LLVMBuildMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3656
LLVMPositionBuilderBeforeDbgRecords
void LLVMPositionBuilderBeforeDbgRecords(LLVMBuilderRef Builder, LLVMBasicBlockRef Block, LLVMValueRef Instr)
Set the builder position before Instr and any attached debug records, or if Instr is null set the pos...
Definition:Core.cpp:3289
LLVMBuildExactSDiv
LLVMValueRef LLVMBuildExactSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3691
LLVMBuildNUWSub
LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3646
LLVMBuildMalloc
LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition:Core.cpp:3846
LLVMBuildIsNull
LLVMValueRef LLVMBuildIsNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition:Core.cpp:4343
LLVMBuildLandingPad
LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PersFn, unsigned NumClauses, const char *Name)
Definition:Core.cpp:3458
LLVMBuildAggregateRet
LLVMValueRef LLVMBuildAggregateRet(LLVMBuilderRef B, LLVMValueRef *RetVals, unsigned N)
Definition:Core.cpp:3392
LLVMBuildAShr
LLVMValueRef LLVMBuildAShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3726
LLVMBuildInvoke2
LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, const char *Name)
Definition:Core.cpp:3435
LLVMBuildCallWithOperandBundles
LLVMValueRef LLVMBuildCallWithOperandBundles(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name)
Definition:Core.cpp:4280
LLVMBuildExactUDiv
LLVMValueRef LLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3681
LLVMSetOrdering
void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering)
Definition:Core.cpp:4108
LLVMSetCleanup
void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val)
Definition:Core.cpp:3544
LLVMGetArgOperand
LLVMValueRef LLVMGetArgOperand(LLVMValueRef Funclet, unsigned i)
Definition:Core.cpp:3573
LLVMGetAtomicSyncScopeID
unsigned LLVMGetAtomicSyncScopeID(LLVMValueRef AtomicInst)
Returns the synchronization scope ID of an atomic instruction.
Definition:Core.cpp:4443
LLVMBuildInsertValue
LLVMValueRef LLVMBuildInsertValue(LLVMBuilderRef B, LLVMValueRef AggVal, LLVMValueRef EltVal, unsigned Index, const char *Name)
Definition:Core.cpp:4331
LLVMBuildAdd
LLVMValueRef LLVMBuildAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3616
LLVMBuildMemSet
LLVMValueRef LLVMBuildMemSet(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Val, LLVMValueRef Len, unsigned Align)
Creates and inserts a memset to the specified pointer and the specified value.
Definition:Core.cpp:3864
LLVMBuildBr
LLVMValueRef LLVMBuildBr(LLVMBuilderRef B, LLVMBasicBlockRef Dest)
Definition:Core.cpp:3397
LLVMBuildNSWMul
LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3661
LLVMBuildBinOp
LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3746
LLVMBuildSRem
LLVMValueRef LLVMBuildSRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3706
LLVMDisposeBuilder
void LLVMDisposeBuilder(LLVMBuilderRef Builder)
Definition:Core.cpp:3329
LLVMGetMaskValue
int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt)
Get the mask value at position Elt in the mask of a ShuffleVector instruction.
Definition:Core.cpp:4412
LLVMBuildFSub
LLVMValueRef LLVMBuildFSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3651
LLVMGetClause
LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx)
Definition:Core.cpp:3532
LLVMGetCurrentDebugLocation2
LLVMMetadataRef LLVMGetCurrentDebugLocation2(LLVMBuilderRef Builder)
Get location information used by debugging information.
Definition:Core.cpp:3335
LLVMBuildArrayAlloca
LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
Definition:Core.cpp:3894
LLVMBuildVAArg
LLVMValueRef LLVMBuildVAArg(LLVMBuilderRef B, LLVMValueRef List, LLVMTypeRef Ty, const char *Name)
Definition:Core.cpp:4301
LLVMCreateBuilderInContext
LLVMBuilderRef LLVMCreateBuilderInContext(LLVMContextRef C)
Definition:Core.cpp:3268
LLVMBuildAtomicCmpXchg
LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, LLVMBool singleThread)
Definition:Core.cpp:4382
LLVMBuildICmp
LLVMValueRef LLVMBuildICmp(LLVMBuilderRef B, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:4251
LLVMBuildPointerCast
LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4220
LLVMGetParentCatchSwitch
LLVMValueRef LLVMGetParentCatchSwitch(LLVMValueRef CatchPad)
Get the parent catchswitch instruction of a catchpad instruction.
Definition:Core.cpp:3562
LLVMSetAtomicSingleThread
void LLVMSetAtomicSingleThread(LLVMValueRef AtomicInst, LLVMBool NewValue)
Definition:Core.cpp:4433
LLVMBuildCast
LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4214
LLVMBuildTrunc
LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4131
LLVMBuildURem
LLVMValueRef LLVMBuildURem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3701
LLVMSetAtomicRMWBinOp
void LLVMSetAtomicRMWBinOp(LLVMValueRef Inst, LLVMAtomicRMWBinOp BinOp)
Definition:Core.cpp:4125
LLVMBuildCall2
LLVMValueRef LLVMBuildCall2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition:Core.cpp:4271
LLVMAddClause
void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal)
Definition:Core.cpp:3536
LLVMBuildOr
LLVMValueRef LLVMBuildOr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3736
LLVMGetNUW
LLVMBool LLVMGetNUW(LLVMValueRef ArithInst)
Definition:Core.cpp:3778
LLVMBuildAddrSpaceCast
LLVMValueRef LLVMBuildAddrSpaceCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4191
LLVMBuildCallBr
LLVMValueRef LLVMBuildCallBr(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMBasicBlockRef DefaultDest, LLVMBasicBlockRef *IndirectDests, unsigned NumIndirectDests, LLVMValueRef *Args, unsigned NumArgs, LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name)
Definition:Core.cpp:3416
LLVMBuildFPToUI
LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4146
LLVMSetCurrentDebugLocation
void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L)
Deprecated: Passing the NULL location will crash.
Definition:Core.cpp:3346
LLVMBuildFPToSI
LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4151
LLVMIsAtomic
LLVMBool LLVMIsAtomic(LLVMValueRef Inst)
Returns whether an instruction is an atomic instruction, e.g., atomicrmw, cmpxchg,...
Definition:Core.cpp:4420
LLVMBuildIntCast2
LLVMValueRef LLVMBuildIntCast2(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, LLVMBool IsSigned, const char *Name)
Definition:Core.cpp:4225
LLVMBuildNSWAdd
LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3621
LLVMBuildFNeg
LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition:Core.cpp:3770
LLVMBuilderGetDefaultFPMathTag
LLVMMetadataRef LLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder)
Get the dafult floating-point math metadata for a given builder.
Definition:Core.cpp:3378
LLVMBuildAtomicRMWSyncScope
LLVMValueRef LLVMBuildAtomicRMWSyncScope(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, unsigned SSID)
Definition:Core.cpp:4371
LLVMBuildUDiv
LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3676
LLVMSetParentCatchSwitch
void LLVMSetParentCatchSwitch(LLVMValueRef CatchPad, LLVMValueRef CatchSwitch)
Set the parent catchswitch instruction of a catchpad instruction.
Definition:Core.cpp:3566
LLVMBuildCatchRet
LLVMValueRef LLVMBuildCatchRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition:Core.cpp:3503
LLVMBuildStructGEP2
LLVMValueRef LLVMBuildStructGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, unsigned Idx, const char *Name)
Definition:Core.cpp:4047
LLVMGetNumClauses
unsigned LLVMGetNumClauses(LLVMValueRef LandingPad)
Definition:Core.cpp:3528
LLVMGetNNeg
LLVMBool LLVMGetNNeg(LLVMValueRef NonNegInst)
Gets if the instruction has the non-negative flag set.
Definition:Core.cpp:3808
LLVMBuildSDiv
LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3686
LLVMBuildStore
LLVMValueRef LLVMBuildStore(LLVMBuilderRef B, LLVMValueRef Val, LLVMValueRef PointerVal)
Definition:Core.cpp:3908
LLVMBuildCatchSwitch
LLVMValueRef LLVMBuildCatchSwitch(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMBasicBlockRef UnwindBB, unsigned NumHandlers, const char *Name)
Definition:Core.cpp:3492
LLVMBuildFenceSyncScope
LLVMValueRef LLVMBuildFenceSyncScope(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, unsigned SSID, const char *Name)
Definition:Core.cpp:4015
LLVMBuildIntCast
LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Deprecated: This cast is always signed.
Definition:Core.cpp:4232
LLVMBuildArrayMalloc
LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
Definition:Core.cpp:3855
LLVMBuildZExtOrBitCast
LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4196
LLVMBuildInBoundsGEP2
LLVMValueRef LLVMBuildInBoundsGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition:Core.cpp:4029
LLVMGetHandlers
void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers)
Obtain the basic blocks acting as handlers for a catchswitch instruction.
Definition:Core.cpp:3556
LLVMGetOrdering
LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemAccessInst)
Definition:Core.cpp:4094
LLVMBuildUIToFP
LLVMValueRef LLVMBuildUIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4156
LLVMBuildIntToPtr
LLVMValueRef LLVMBuildIntToPtr(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4181
LLVMBuildCondBr
LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef B, LLVMValueRef If, LLVMBasicBlockRef Then, LLVMBasicBlockRef Else)
Definition:Core.cpp:3401
LLVMBuildIndirectBr
LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr, unsigned NumDests)
Definition:Core.cpp:3411
LLVMAddDestination
void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest)
Definition:Core.cpp:3524
LLVMBuildNSWNeg
LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition:Core.cpp:3757
LLVMBuildXor
LLVMValueRef LLVMBuildXor(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3741
LLVMBuildGlobalString
LLVMValueRef LLVMBuildGlobalString(LLVMBuilderRef B, const char *Str, const char *Name)
Definition:Core.cpp:4054
LLVMGetExact
LLVMBool LLVMGetExact(LLVMValueRef DivOrShrInst)
Definition:Core.cpp:3798
LLVMBuildIsNotNull
LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition:Core.cpp:4348
LLVMSetArgOperand
void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value)
Definition:Core.cpp:3577
LLVMBuildMemCpy
LLVMValueRef LLVMBuildMemCpy(LLVMBuilderRef B, LLVMValueRef Dst, unsigned DstAlign, LLVMValueRef Src, unsigned SrcAlign, LLVMValueRef Size)
Creates and inserts a memcpy between the specified pointers.
Definition:Core.cpp:3871
LLVMBuildPtrDiff2
LLVMValueRef LLVMBuildPtrDiff2(LLVMBuilderRef B, LLVMTypeRef ElemTy, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:4353
LLVMSetInstDebugLocation
void LLVMSetInstDebugLocation(LLVMBuilderRef Builder, LLVMValueRef Inst)
Attempts to set the debug location for the given instruction using the current debug location for the...
Definition:Core.cpp:3358
LLVMAddMetadataToInst
void LLVMAddMetadataToInst(LLVMBuilderRef Builder, LLVMValueRef Inst)
Adds the metadata registered with the given builder to the given instruction.
Definition:Core.cpp:3362
LLVMBuildSub
LLVMValueRef LLVMBuildSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3636
LLVMBuildNUWAdd
LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3626
LLVMBuildUnreachable
LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef B)
Definition:Core.cpp:3515
LLVMBuildShuffleVector
LLVMValueRef LLVMBuildShuffleVector(LLVMBuilderRef B, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, const char *Name)
Definition:Core.cpp:4319
LLVMSetVolatile
void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile)
Definition:Core.cpp:4075
LLVMBuildFree
LLVMValueRef LLVMBuildFree(LLVMBuilderRef B, LLVMValueRef PointerVal)
Definition:Core.cpp:3899
LLVMBuildGEP2
LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition:Core.cpp:4022
LLVMGetNumHandlers
unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch)
Definition:Core.cpp:3552
LLVMBuildFPCast
LLVMValueRef LLVMBuildFPCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4238
LLVMCreateBuilder
LLVMBuilderRef LLVMCreateBuilder(void)
Definition:Core.cpp:3272
LLVMSetCmpXchgSuccessOrdering
void LLVMSetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition:Core.cpp:4460
LLVMBuildPhi
LLVMValueRef LLVMBuildPhi(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition:Core.cpp:4267
LLVMCanValueUseFastMathFlags
LLVMBool LLVMCanValueUseFastMathFlags(LLVMValueRef V)
Check if a given value can potentially have fast math flags.
Definition:Core.cpp:3829
LLVMAddCase
void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal, LLVMBasicBlockRef Dest)
Definition:Core.cpp:3519
LLVMIsAtomicSingleThread
LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst)
Definition:Core.cpp:4424
LLVMBuildResume
LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn)
Definition:Core.cpp:3488
LLVMBuildSwitch
LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef B, LLVMValueRef V, LLVMBasicBlockRef Else, unsigned NumCases)
Definition:Core.cpp:3406
LLVMInsertIntoBuilder
void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr)
Definition:Core.cpp:3320
LLVMBuildPtrToInt
LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition:Core.cpp:4176
LLVMIsCleanup
LLVMBool LLVMIsCleanup(LLVMValueRef LandingPad)
Definition:Core.cpp:3540
LLVMGetNSW
LLVMBool LLVMGetNSW(LLVMValueRef ArithInst)
Definition:Core.cpp:3788
LLVMBuildMemMove
LLVMValueRef LLVMBuildMemMove(LLVMBuilderRef B, LLVMValueRef Dst, unsigned DstAlign, LLVMValueRef Src, unsigned SrcAlign, LLVMValueRef Size)
Creates and inserts a memmove between the specified pointers.
Definition:Core.cpp:3880
LLVMBuildLShr
LLVMValueRef LLVMBuildLShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3721
LLVMGetNumMaskElements
unsigned LLVMGetNumMaskElements(LLVMValueRef SVInst)
Get the number of elements in the mask of a ShuffleVector instruction.
Definition:Core.cpp:4406
LLVMBuildRetVoid
LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef B)
Definition:Core.cpp:3384
LLVMBuildRet
LLVMValueRef LLVMBuildRet(LLVMBuilderRef B, LLVMValueRef V)
Definition:Core.cpp:3388
LLVMAddHandler
void LLVMAddHandler(LLVMValueRef CatchSwitch, LLVMBasicBlockRef Dest)
Definition:Core.cpp:3548
LLVMPositionBuilderBeforeInstrAndDbgRecords
void LLVMPositionBuilderBeforeInstrAndDbgRecords(LLVMBuilderRef Builder, LLVMValueRef Instr)
Set the builder position before Instr and any attached debug records.
Definition:Core.cpp:3301
LLVMBuildExtractElement
LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef Index, const char *Name)
Definition:Core.cpp:4306
LLVMPositionBuilderBefore
void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr)
Set the builder position before Instr but after any attached debug records.
Definition:Core.cpp:3296
LLVMGetCurrentDebugLocation
LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder)
Deprecated: Returning the NULL location will crash.
Definition:Core.cpp:3352
LLVMGetCmpXchgSuccessOrdering
LLVMAtomicOrdering LLVMGetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst)
Definition:Core.cpp:4455
LLVMSetNNeg
void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg)
Sets the non-negative flag for the instruction.
Definition:Core.cpp:3813
LLVMGetBuilderContext
LLVMContextRef LLVMGetBuilderContext(LLVMBuilderRef Builder)
Obtain the context to which this builder is associated.
Definition:Core.cpp:3374
LLVMSetExact
void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact)
Definition:Core.cpp:3803
LLVMGetInsertBlock
LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder)
Definition:Core.cpp:3312
LLVMBuildCleanupPad
LLVMValueRef LLVMBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition:Core.cpp:3477
LLVMInsertIntoBuilderWithName
void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr, const char *Name)
Definition:Core.cpp:3324
LLVMSetFastMathFlags
void LLVMSetFastMathFlags(LLVMValueRef FPMathInst, LLVMFastMathFlags FMF)
Sets the flags for which fast-math-style optimizations are allowed for this value.
Definition:Core.cpp:3824
LLVMBuildGEPWithNoWrapFlags
LLVMValueRef LLVMBuildGEPWithNoWrapFlags(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name, LLVMGEPNoWrapFlags NoWrapFlags)
Creates a GetElementPtr instruction.
Definition:Core.cpp:4037
LLVMGetFastMathFlags
LLVMFastMathFlags LLVMGetFastMathFlags(LLVMValueRef FPMathInst)
Get the flags for which fast-math-style optimizations are allowed for this value.
Definition:Core.cpp:3818
LLVMBuildNeg
LLVMValueRef LLVMBuildNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition:Core.cpp:3753
LLVMGetVolatile
LLVMBool LLVMGetVolatile(LLVMValueRef MemAccessInst)
Definition:Core.cpp:4064
LLVMBuildNUWMul
LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition:Core.cpp:3666
LLVMPositionBuilder
void LLVMPositionBuilder(LLVMBuilderRef Builder, LLVMBasicBlockRef Block, LLVMValueRef Instr)
Set the builder position before Instr but after any attached debug records, or if Instr is null set t...
Definition:Core.cpp:3283
LLVMPositionBuilderAtEnd
void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block)
Definition:Core.cpp:3307
LLVMBuildInsertElement
LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, const char *Name)
Definition:Core.cpp:4312
LLVMBuildCleanupRet
LLVMValueRef LLVMBuildCleanupRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition:Core.cpp:3509
LLVMDisposeMemoryBuffer
void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf)
Definition:Core.cpp:4549
LLVMGetBufferSize
size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf)
Definition:Core.cpp:4545
LLVMCreateMemoryBufferWithSTDIN
LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
Definition:Core.cpp:4509
LLVMCreateMemoryBufferWithMemoryRange
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange(const char *InputData, size_t InputDataLength, const char *BufferName, LLVMBool RequiresNullTerminator)
Definition:Core.cpp:4520
LLVMCreateMemoryBufferWithContentsOfFile
LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const char *Path, LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
Definition:Core.cpp:4495
LLVMGetBufferStart
const char * LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf)
Definition:Core.cpp:4541
LLVMCreateMemoryBufferWithMemoryRangeCopy
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData, size_t InputDataLength, const char *BufferName)
Definition:Core.cpp:4531
LLVMCreateModuleProviderForExistingModule
LLVMModuleProviderRef LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M)
Changes the type of M so it can be passed to FunctionPassManagers and the JIT.
Definition:Core.cpp:4484
LLVMDisposeModuleProvider
void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP)
Destroys the module M.
Definition:Core.cpp:4488
LLVMGetModuleIdentifier
const char * LLVMGetModuleIdentifier(LLVMModuleRef M, size_t *Len)
Obtain the identifier of a module.
Definition:Core.cpp:289
LLVMSetDataLayout
void LLVMSetDataLayout(LLVMModuleRef M, const char *DataLayoutStr)
Set the data layout for a module.
Definition:Core.cpp:318
LLVMAddFunction
LLVMValueRef LLVMAddFunction(LLVMModuleRef M, const char *Name, LLVMTypeRef FunctionTy)
Add a function to a module under a specified name.
Definition:Core.cpp:2391
LLVMIsNewDbgInfoFormat
LLVMBool LLVMIsNewDbgInfoFormat(LLVMModuleRef M)
Soon to be deprecated.
Definition:Core.cpp:434
LLVMGetPreviousNamedMetadata
LLVMNamedMDNodeRef LLVMGetPreviousNamedMetadata(LLVMNamedMDNodeRef NMD)
Decrement a NamedMDNode iterator to the previous NamedMDNode.
Definition:Core.cpp:1388
LLVMGetNamedFunctionWithLength
LLVMValueRef LLVMGetNamedFunctionWithLength(LLVMModuleRef M, const char *Name, size_t Length)
Obtain a Function value from a Module by its name.
Definition:Core.cpp:2401
LLVMGetTypeByName
LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name)
Deprecated: Use LLVMGetTypeByName2 instead.
Definition:Core.cpp:849
LLVMSetSourceFileName
void LLVMSetSourceFileName(LLVMModuleRef M, const char *Name, size_t Len)
Set the original source file name of a module to a string Name with length Len.
Definition:Core.cpp:305
LLVMDumpModule
void LLVMDumpModule(LLVMModuleRef M)
Dump a representation of a module to stderr.
Definition:Core.cpp:444
LLVMAppendModuleInlineAsm
void LLVMAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm, size_t Len)
Append inline assembly to a module.
Definition:Core.cpp:490
LLVMGetFirstFunction
LLVMValueRef LLVMGetFirstFunction(LLVMModuleRef M)
Obtain an iterator to the first Function in a Module.
Definition:Core.cpp:2406
LLVMGetDebugLocFilename
const char * LLVMGetDebugLocFilename(LLVMValueRef Val, unsigned *Length)
Return the filename of the debug location for this value, which must be an llvm::Instruction,...
Definition:Core.cpp:1483
LLVMPrintModuleToFile
LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename, char **ErrorMessage)
Print a representation of a module to a file.
Definition:Core.cpp:449
LLVMDisposeModule
void LLVMDisposeModule(LLVMModuleRef M)
Destroy a module instance.
Definition:Core.cpp:285
LLVMGetInlineAsm
LLVMValueRef LLVMGetInlineAsm(LLVMTypeRef Ty, const char *AsmString, size_t AsmStringSize, const char *Constraints, size_t ConstraintsSize, LLVMBool HasSideEffects, LLVMBool IsAlignStack, LLVMInlineAsmDialect Dialect, LLVMBool CanThrow)
Create the specified uniqued inline asm string.
Definition:Core.cpp:500
LLVMGetDebugLocDirectory
const char * LLVMGetDebugLocDirectory(LLVMValueRef Val, unsigned *Length)
Return the directory of the debug location for this value, which must be an llvm::Instruction,...
Definition:Core.cpp:1459
LLVMGetModuleInlineAsm
const char * LLVMGetModuleInlineAsm(LLVMModuleRef M, size_t *Len)
Get inline assembly for a module.
Definition:Core.cpp:494
LLVMGetSourceFileName
const char * LLVMGetSourceFileName(LLVMModuleRef M, size_t *Len)
Obtain the module's original source file name.
Definition:Core.cpp:299
LLVMGetNamedMetadataName
const char * LLVMGetNamedMetadataName(LLVMNamedMDNodeRef NMD, size_t *NameLen)
Retrieve the name of a NamedMDNode.
Definition:Core.cpp:1406
LLVMGetModuleContext
LLVMContextRef LLVMGetModuleContext(LLVMModuleRef M)
Obtain the context to which this module is associated.
Definition:Core.cpp:576
LLVMGetInlineAsmConstraintString
const char * LLVMGetInlineAsmConstraintString(LLVMValueRef InlineAsmVal, size_t *Len)
Get the raw constraint string for an inline assembly snippet.
Definition:Core.cpp:529
LLVMModuleCreateWithNameInContext
LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID, LLVMContextRef C)
Create a new, empty module in a specific context.
Definition:Core.cpp:280
LLVMModuleFlagEntriesGetMetadata
LLVMMetadataRef LLVMModuleFlagEntriesGetMetadata(LLVMModuleFlagEntry *Entries, unsigned Index)
Returns the metadata for a module flag entry at a specific index.
Definition:Core.cpp:415
LLVMModuleFlagEntriesGetKey
const char * LLVMModuleFlagEntriesGetKey(LLVMModuleFlagEntry *Entries, unsigned Index, size_t *Len)
Returns the key for a module flag entry at a specific index.
Definition:Core.cpp:407
LLVMGetLastFunction
LLVMValueRef LLVMGetLastFunction(LLVMModuleRef M)
Obtain an iterator to the last Function in a Module.
Definition:Core.cpp:2414
LLVMSetTarget
void LLVMSetTarget(LLVMModuleRef M, const char *Triple)
Set the target triple for a module.
Definition:Core.cpp:327
LLVMGetDataLayoutStr
const char * LLVMGetDataLayoutStr(LLVMModuleRef M)
Obtain the data layout for a module.
Definition:Core.cpp:310
LLVMGetInlineAsmAsmString
const char * LLVMGetInlineAsmAsmString(LLVMValueRef InlineAsmVal, size_t *Len)
Get the template string used for an inline assembly snippet.
Definition:Core.cpp:520
LLVMModuleFlagEntriesGetFlagBehavior
LLVMModuleFlagBehavior LLVMModuleFlagEntriesGetFlagBehavior(LLVMModuleFlagEntry *Entries, unsigned Index)
Returns the flag behavior for a module flag entry at a specific index.
Definition:Core.cpp:400
LLVMGetDebugLocColumn
unsigned LLVMGetDebugLocColumn(LLVMValueRef Val)
Return the column number of the debug location for this value, which must be an llvm::Instruction.
Definition:Core.cpp:1529
LLVMGetDebugLocLine
unsigned LLVMGetDebugLocLine(LLVMValueRef Val)
Return the line number of the debug location for this value, which must be an llvm::Instruction,...
Definition:Core.cpp:1507
LLVMGetInlineAsmNeedsAlignedStack
LLVMBool LLVMGetInlineAsmNeedsAlignedStack(LLVMValueRef InlineAsmVal)
Get if the inline asm snippet needs an aligned stack.
Definition:Core.cpp:565
LLVMModuleCreateWithName
LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID)
Create a new, empty module in the global context.
Definition:Core.cpp:276
LLVMCopyModuleFlagsMetadata
LLVMModuleFlagEntry * LLVMCopyModuleFlagsMetadata(LLVMModuleRef M, size_t *Len)
Returns the module flags as an array of flag-key-value triples.
Definition:Core.cpp:378
LLVMAddModuleFlag
void LLVMAddModuleFlag(LLVMModuleRef M, LLVMModuleFlagBehavior Behavior, const char *Key, size_t KeyLen, LLVMMetadataRef Val)
Add a module-level flag to the module-level flags metadata if it doesn't already exist.
Definition:Core.cpp:427
LLVMSetModuleInlineAsm
void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm)
Deprecated: Use LLVMSetModuleInlineAsm2 instead.
Definition:Core.cpp:486
LLVMGetInlineAsmHasSideEffects
LLVMBool LLVMGetInlineAsmHasSideEffects(LLVMValueRef InlineAsmVal)
Get if the inline asm snippet has side effects.
Definition:Core.cpp:560
LLVMDisposeModuleFlagsMetadata
void LLVMDisposeModuleFlagsMetadata(LLVMModuleFlagEntry *Entries)
Destroys module flags metadata entries.
Definition:Core.cpp:395
LLVMGetInlineAsmDialect
LLVMInlineAsmDialect LLVMGetInlineAsmDialect(LLVMValueRef InlineAsmVal)
Get the dialect used by the inline asm snippet.
Definition:Core.cpp:539
LLVMGetNamedMetadataNumOperands
unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char *Name)
Obtain the number of operands for named metadata in a module.
Definition:Core.cpp:1432
LLVMGetTarget
const char * LLVMGetTarget(LLVMModuleRef M)
Obtain the target triple for a module.
Definition:Core.cpp:323
LLVMGetNextNamedMetadata
LLVMNamedMDNodeRef LLVMGetNextNamedMetadata(LLVMNamedMDNodeRef NMD)
Advance a NamedMDNode iterator to the next NamedMDNode.
Definition:Core.cpp:1380
LLVMSetModuleInlineAsm2
void LLVMSetModuleInlineAsm2(LLVMModuleRef M, const char *Asm, size_t Len)
Set inline assembly for a module.
Definition:Core.cpp:482
LLVMGetLastNamedMetadata
LLVMNamedMDNodeRef LLVMGetLastNamedMetadata(LLVMModuleRef M)
Obtain an iterator to the last NamedMDNode in a Module.
Definition:Core.cpp:1372
LLVMGetInlineAsmCanUnwind
LLVMBool LLVMGetInlineAsmCanUnwind(LLVMValueRef InlineAsmVal)
Get if the inline asm snippet may unwind the stack.
Definition:Core.cpp:570
LLVMGetModuleFlag
LLVMMetadataRef LLVMGetModuleFlag(LLVMModuleRef M, const char *Key, size_t KeyLen)
Add a module-level flag to the module-level flags metadata if it doesn't already exist.
Definition:Core.cpp:422
LLVMGetDataLayout
const char * LLVMGetDataLayout(LLVMModuleRef M)
Definition:Core.cpp:314
LLVMGetNamedFunction
LLVMValueRef LLVMGetNamedFunction(LLVMModuleRef M, const char *Name)
Obtain a Function value from a Module by its name.
Definition:Core.cpp:2397
LLVMSetIsNewDbgInfoFormat
void LLVMSetIsNewDbgInfoFormat(LLVMModuleRef M, LLVMBool UseNewFormat)
Soon to be deprecated.
Definition:Core.cpp:438
LLVMGetNamedMetadata
LLVMNamedMDNodeRef LLVMGetNamedMetadata(LLVMModuleRef M, const char *Name, size_t NameLen)
Retrieve a NamedMDNode with the given name, returning NULL if no such node exists.
Definition:Core.cpp:1396
LLVMGetOrInsertNamedMetadata
LLVMNamedMDNodeRef LLVMGetOrInsertNamedMetadata(LLVMModuleRef M, const char *Name, size_t NameLen)
Retrieve a NamedMDNode with the given name, creating a new node if no such node exists.
Definition:Core.cpp:1401
LLVMGetPreviousFunction
LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn)
Decrement a Function iterator to the previous Function.
Definition:Core.cpp:2430
LLVMPrintModuleToString
char * LLVMPrintModuleToString(LLVMModuleRef M)
Return a string representation of the module.
Definition:Core.cpp:471
LLVMGetNamedMetadataOperands
void LLVMGetNamedMetadataOperands(LLVMModuleRef M, const char *Name, LLVMValueRef *Dest)
Obtain the named metadata operands for a module.
Definition:Core.cpp:1439
LLVMGetNextFunction
LLVMValueRef LLVMGetNextFunction(LLVMValueRef Fn)
Advance a Function iterator to the next Function.
Definition:Core.cpp:2422
LLVMGetInlineAsmFunctionType
LLVMTypeRef LLVMGetInlineAsmFunctionType(LLVMValueRef InlineAsmVal)
Get the function type of the inline assembly snippet.
Definition:Core.cpp:555
LLVMSetModuleIdentifier
void LLVMSetModuleIdentifier(LLVMModuleRef M, const char *Ident, size_t Len)
Set the identifier of a module to a string Ident with length Len.
Definition:Core.cpp:295
LLVMAddNamedMetadataOperand
void LLVMAddNamedMetadataOperand(LLVMModuleRef M, const char *Name, LLVMValueRef Val)
Add an operand to named metadata.
Definition:Core.cpp:1449
LLVMGetFirstNamedMetadata
LLVMNamedMDNodeRef LLVMGetFirstNamedMetadata(LLVMModuleRef M)
Obtain an iterator to the first NamedMDNode in a Module.
Definition:Core.cpp:1364
LLVMGetOperandBundleArgAtIndex
LLVMValueRef LLVMGetOperandBundleArgAtIndex(LLVMOperandBundleRef Bundle, unsigned Index)
Obtain the operand for an operand bundle at the given index.
Definition:Core.cpp:2766
LLVMGetNumOperandBundleArgs
unsigned LLVMGetNumOperandBundleArgs(LLVMOperandBundleRef Bundle)
Obtain the number of operands for an operand bundle.
Definition:Core.cpp:2762
LLVMCreateOperandBundle
LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, size_t TagLen, LLVMValueRef *Args, unsigned NumArgs)
Create a new operand bundle.
Definition:Core.cpp:2745
LLVMDisposeOperandBundle
void LLVMDisposeOperandBundle(LLVMOperandBundleRef Bundle)
Destroy an operand bundle.
Definition:Core.cpp:2752
LLVMGetOperandBundleTag
const char * LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len)
Obtain the tag of an operand bundle as a string.
Definition:Core.cpp:2756
LLVMRunPassManager
LLVMBool LLVMRunPassManager(LLVMPassManagerRef PM, LLVMModuleRef M)
Initializes, executes on the provided module, and finalizes all of the passes scheduled in the pass m...
Definition:Core.cpp:4568
LLVMCreateFunctionPassManager
LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef P)
Deprecated: Use LLVMCreateFunctionPassManagerForModule instead.
Definition:Core.cpp:4563
LLVMCreatePassManager
LLVMPassManagerRef LLVMCreatePassManager()
Constructs a new whole-module pass pipeline.
Definition:Core.cpp:4555
LLVMDisposePassManager
void LLVMDisposePassManager(LLVMPassManagerRef PM)
Frees the memory of a pass pipeline.
Definition:Core.cpp:4584
LLVMFinalizeFunctionPassManager
LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM)
Finalizes all of the function passes scheduled in the function pass manager.
Definition:Core.cpp:4580
LLVMRunFunctionPassManager
LLVMBool LLVMRunFunctionPassManager(LLVMPassManagerRef FPM, LLVMValueRef F)
Executes all of the function passes scheduled in the function pass manager on the provided function.
Definition:Core.cpp:4576
LLVMInitializeFunctionPassManager
LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM)
Initializes all of the function passes scheduled in the function pass manager.
Definition:Core.cpp:4572
LLVMCreateFunctionPassManagerForModule
LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M)
Constructs a new function-by-function pass pipeline over the module provider.
Definition:Core.cpp:4559
LLVMIsMultithreaded
LLVMBool LLVMIsMultithreaded()
Check whether LLVM is executing in thread-safe mode or not.
Definition:Core.cpp:4597
LLVMStartMultithreaded
LLVMBool LLVMStartMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
Definition:Core.cpp:4590
LLVMStopMultithreaded
void LLVMStopMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
Definition:Core.cpp:4594
LLVMFP128Type
LLVMTypeRef LLVMFP128Type(void)
Definition:Core.cpp:752
LLVMFP128TypeInContext
LLVMTypeRef LLVMFP128TypeInContext(LLVMContextRef C)
Obtain a 128-bit floating point type (112-bit mantissa) from a context.
Definition:Core.cpp:727
LLVMDoubleTypeInContext
LLVMTypeRef LLVMDoubleTypeInContext(LLVMContextRef C)
Obtain a 64-bit floating point type from a context.
Definition:Core.cpp:721
LLVMX86FP80TypeInContext
LLVMTypeRef LLVMX86FP80TypeInContext(LLVMContextRef C)
Obtain a 80-bit floating point type (X87) from a context.
Definition:Core.cpp:724
LLVMHalfTypeInContext
LLVMTypeRef LLVMHalfTypeInContext(LLVMContextRef C)
Obtain a 16-bit floating point type from a context.
Definition:Core.cpp:712
LLVMBFloatTypeInContext
LLVMTypeRef LLVMBFloatTypeInContext(LLVMContextRef C)
Obtain a 16-bit brain floating point type from a context.
Definition:Core.cpp:715
LLVMBFloatType
LLVMTypeRef LLVMBFloatType(void)
Definition:Core.cpp:740
LLVMFloatTypeInContext
LLVMTypeRef LLVMFloatTypeInContext(LLVMContextRef C)
Obtain a 32-bit floating point type from a context.
Definition:Core.cpp:718
LLVMHalfType
LLVMTypeRef LLVMHalfType(void)
Obtain a floating point type from the global context.
Definition:Core.cpp:737
LLVMX86FP80Type
LLVMTypeRef LLVMX86FP80Type(void)
Definition:Core.cpp:749
LLVMPPCFP128Type
LLVMTypeRef LLVMPPCFP128Type(void)
Definition:Core.cpp:755
LLVMFloatType
LLVMTypeRef LLVMFloatType(void)
Definition:Core.cpp:743
LLVMDoubleType
LLVMTypeRef LLVMDoubleType(void)
Definition:Core.cpp:746
LLVMPPCFP128TypeInContext
LLVMTypeRef LLVMPPCFP128TypeInContext(LLVMContextRef C)
Obtain a 128-bit floating point type (two 64-bits) from a context.
Definition:Core.cpp:730
LLVMIsFunctionVarArg
LLVMBool LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy)
Returns whether a function type is variadic.
Definition:Core.cpp:771
LLVMCountParamTypes
unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy)
Obtain the number of parameters this function accepts.
Definition:Core.cpp:779
LLVMGetParamTypes
void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest)
Obtain the types of a function's parameters.
Definition:Core.cpp:783
LLVMFunctionType
LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType, LLVMTypeRef *ParamTypes, unsigned ParamCount, LLVMBool IsVarArg)
Obtain a function type consisting of a specified signature.
Definition:Core.cpp:764
LLVMGetReturnType
LLVMTypeRef LLVMGetReturnType(LLVMTypeRef FunctionTy)
Obtain the Type this function Type returns.
Definition:Core.cpp:775
LLVMInt64Type
LLVMTypeRef LLVMInt64Type(void)
Definition:Core.cpp:696
LLVMInt64TypeInContext
LLVMTypeRef LLVMInt64TypeInContext(LLVMContextRef C)
Definition:Core.cpp:674
LLVMInt16TypeInContext
LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C)
Definition:Core.cpp:668
LLVMIntTypeInContext
LLVMTypeRef LLVMIntTypeInContext(LLVMContextRef C, unsigned NumBits)
Definition:Core.cpp:680
LLVMInt1TypeInContext
LLVMTypeRef LLVMInt1TypeInContext(LLVMContextRef C)
Obtain an integer type from a context with specified bit width.
Definition:Core.cpp:662
LLVMInt32Type
LLVMTypeRef LLVMInt32Type(void)
Definition:Core.cpp:693
LLVMInt32TypeInContext
LLVMTypeRef LLVMInt32TypeInContext(LLVMContextRef C)
Definition:Core.cpp:671
LLVMInt128TypeInContext
LLVMTypeRef LLVMInt128TypeInContext(LLVMContextRef C)
Definition:Core.cpp:677
LLVMIntType
LLVMTypeRef LLVMIntType(unsigned NumBits)
Definition:Core.cpp:702
LLVMInt8TypeInContext
LLVMTypeRef LLVMInt8TypeInContext(LLVMContextRef C)
Definition:Core.cpp:665
LLVMInt8Type
LLVMTypeRef LLVMInt8Type(void)
Definition:Core.cpp:687
LLVMInt1Type
LLVMTypeRef LLVMInt1Type(void)
Obtain an integer type from the global context with a specified bit width.
Definition:Core.cpp:684
LLVMInt128Type
LLVMTypeRef LLVMInt128Type(void)
Definition:Core.cpp:699
LLVMGetIntTypeWidth
unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy)
Definition:Core.cpp:706
LLVMInt16Type
LLVMTypeRef LLVMInt16Type(void)
Definition:Core.cpp:690
LLVMVoidType
LLVMTypeRef LLVMVoidType(void)
These are similar to the above functions except they operate on the global context.
Definition:Core.cpp:955
LLVMGetTargetExtTypeName
const char * LLVMGetTargetExtTypeName(LLVMTypeRef TargetExtTy)
Obtain the name for this target extension type.
Definition:Core.cpp:973
LLVMGetTargetExtTypeTypeParam
LLVMTypeRef LLVMGetTargetExtTypeTypeParam(LLVMTypeRef TargetExtTy, unsigned Idx)
Get the type parameter at the given index for the target extension type.
Definition:Core.cpp:983
LLVMGetTargetExtTypeNumTypeParams
unsigned LLVMGetTargetExtTypeNumTypeParams(LLVMTypeRef TargetExtTy)
Obtain the number of type parameters for this target extension type.
Definition:Core.cpp:978
LLVMX86AMXTypeInContext
LLVMTypeRef LLVMX86AMXTypeInContext(LLVMContextRef C)
Create a X86 AMX type in a context.
Definition:Core.cpp:733
LLVMMetadataTypeInContext
LLVMTypeRef LLVMMetadataTypeInContext(LLVMContextRef C)
Create a metadata type in a context.
Definition:Core.cpp:951
LLVMTokenTypeInContext
LLVMTypeRef LLVMTokenTypeInContext(LLVMContextRef C)
Create a token type in a context.
Definition:Core.cpp:948
LLVMX86AMXType
LLVMTypeRef LLVMX86AMXType(void)
Definition:Core.cpp:758
LLVMLabelTypeInContext
LLVMTypeRef LLVMLabelTypeInContext(LLVMContextRef C)
Create a label type in a context.
Definition:Core.cpp:945
LLVMTargetExtTypeInContext
LLVMTypeRef LLVMTargetExtTypeInContext(LLVMContextRef C, const char *Name, LLVMTypeRef *TypeParams, unsigned TypeParamCount, unsigned *IntParams, unsigned IntParamCount)
Create a target extension type in LLVM context.
Definition:Core.cpp:962
LLVMGetTargetExtTypeNumIntParams
unsigned LLVMGetTargetExtTypeNumIntParams(LLVMTypeRef TargetExtTy)
Obtain the number of int parameters for this target extension type.
Definition:Core.cpp:989
LLVMGetTargetExtTypeIntParam
unsigned LLVMGetTargetExtTypeIntParam(LLVMTypeRef TargetExtTy, unsigned Idx)
Get the int parameter at the given index for the target extension type.
Definition:Core.cpp:994
LLVMLabelType
LLVMTypeRef LLVMLabelType(void)
Definition:Core.cpp:958
LLVMVoidTypeInContext
LLVMTypeRef LLVMVoidTypeInContext(LLVMContextRef C)
Create a void type in a context.
Definition:Core.cpp:942
LLVMGetArrayLength
unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy)
Obtain the length of an array type.
Definition:Core.cpp:904
LLVMGetElementType
LLVMTypeRef LLVMGetElementType(LLVMTypeRef WrappedTy)
Obtain the element type of an array or vector type.
Definition:Core.cpp:893
LLVMGetPointerAddressSpace
unsigned LLVMGetPointerAddressSpace(LLVMTypeRef PointerTy)
Obtain the address space of a pointer type.
Definition:Core.cpp:912
LLVMGetArrayLength2
uint64_t LLVMGetArrayLength2(LLVMTypeRef ArrayTy)
Obtain the length of an array type.
Definition:Core.cpp:908
LLVMGetConstantPtrAuthPointer
LLVMValueRef LLVMGetConstantPtrAuthPointer(LLVMValueRef PtrAuth)
Get the pointer value for the associated ConstantPtrAuth constant.
Definition:Core.cpp:920
LLVMPointerType
LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace)
Create a pointer type that points to a defined type.
Definition:Core.cpp:875
LLVMGetNumContainedTypes
unsigned LLVMGetNumContainedTypes(LLVMTypeRef Tp)
Return the number of types in the derived type.
Definition:Core.cpp:900
LLVMGetConstantPtrAuthDiscriminator
LLVMValueRef LLVMGetConstantPtrAuthDiscriminator(LLVMValueRef PtrAuth)
Get the discriminator value for the associated ConstantPtrAuth constant.
Definition:Core.cpp:928
LLVMVectorType
LLVMTypeRef LLVMVectorType(LLVMTypeRef ElementType, unsigned ElementCount)
Create a vector type that contains a defined type and has a specific number of elements.
Definition:Core.cpp:884
LLVMPointerTypeIsOpaque
LLVMBool LLVMPointerTypeIsOpaque(LLVMTypeRef Ty)
Determine whether a pointer is opaque.
Definition:Core.cpp:880
LLVMPointerTypeInContext
LLVMTypeRef LLVMPointerTypeInContext(LLVMContextRef C, unsigned AddressSpace)
Create an opaque pointer type in a context.
Definition:Core.cpp:938
LLVMGetConstantPtrAuthKey
LLVMValueRef LLVMGetConstantPtrAuthKey(LLVMValueRef PtrAuth)
Get the key value for the associated ConstantPtrAuth constant.
Definition:Core.cpp:924
LLVMArrayType
LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount)
Create a fixed size array type that refers to a specific type.
Definition:Core.cpp:867
LLVMScalableVectorType
LLVMTypeRef LLVMScalableVectorType(LLVMTypeRef ElementType, unsigned ElementCount)
Create a vector type that contains a defined type and has a scalable number of elements.
Definition:Core.cpp:888
LLVMArrayType2
LLVMTypeRef LLVMArrayType2(LLVMTypeRef ElementType, uint64_t ElementCount)
Create a fixed size array type that refers to a specific type.
Definition:Core.cpp:871
LLVMGetSubtypes
void LLVMGetSubtypes(LLVMTypeRef Tp, LLVMTypeRef *Arr)
Returns type's subtypes.
Definition:Core.cpp:859
LLVMGetConstantPtrAuthAddrDiscriminator
LLVMValueRef LLVMGetConstantPtrAuthAddrDiscriminator(LLVMValueRef PtrAuth)
Get the address discriminator value for the associated ConstantPtrAuth constant.
Definition:Core.cpp:932
LLVMGetVectorSize
unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy)
Obtain the (possibly scalable) number of elements in a vector type.
Definition:Core.cpp:916
LLVMStructSetBody
void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Set the contents of a structure type.
Definition:Core.cpp:816
LLVMIsPackedStruct
LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy)
Determine whether a structure is packed.
Definition:Core.cpp:837
LLVMStructGetTypeAtIndex
LLVMTypeRef LLVMStructGetTypeAtIndex(LLVMTypeRef StructTy, unsigned i)
Get the type of the element at a given index in the structure.
Definition:Core.cpp:832
LLVMStructType
LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Create a new structure type in the global context.
Definition:Core.cpp:797
LLVMGetStructName
const char * LLVMGetStructName(LLVMTypeRef Ty)
Obtain the name of a structure.
Definition:Core.cpp:808
LLVMGetStructElementTypes
void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest)
Get the elements within a structure.
Definition:Core.cpp:826
LLVMIsOpaqueStruct
LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy)
Determine whether a structure is opaque.
Definition:Core.cpp:841
LLVMCountStructElementTypes
unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy)
Get the number of elements defined inside the structure.
Definition:Core.cpp:822
LLVMStructCreateNamed
LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name)
Create an empty structure in a context having a specified name.
Definition:Core.cpp:803
LLVMIsLiteralStruct
LLVMBool LLVMIsLiteralStruct(LLVMTypeRef StructTy)
Determine whether a structure is literal.
Definition:Core.cpp:845
LLVMStructTypeInContext
LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Create a new structure type in a context.
Definition:Core.cpp:791
LLVMTypeIsSized
LLVMBool LLVMTypeIsSized(LLVMTypeRef Ty)
Whether the type has a known size.
Definition:Core.cpp:633
LLVMGetTypeKind
LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty)
Obtain the enumerated type of a Type instance.
Definition:Core.cpp:585
LLVMPrintTypeToString
char * LLVMPrintTypeToString(LLVMTypeRef Ty)
Return a string representation of the type.
Definition:Core.cpp:646
LLVMDumpType
void LLVMDumpType(LLVMTypeRef Ty)
Dump a representation of a type to stderr.
Definition:Core.cpp:642
LLVMGetTypeContext
LLVMContextRef LLVMGetTypeContext(LLVMTypeRef Ty)
Obtain the context to which this type instance is associated.
Definition:Core.cpp:638
LLVMTailCallKind
LLVMTailCallKind
Tail call kind for LLVMSetTailCallKind and LLVMGetTailCallKind.
Definition:Core.h:487
LLVMLinkage
LLVMLinkage
Definition:Core.h:172
LLVMOpcode
LLVMOpcode
External users depend on the following values being stable.
Definition:Core.h:60
LLVMRealPredicate
LLVMRealPredicate
Definition:Core.h:305
LLVMTypeKind
LLVMTypeKind
Definition:Core.h:148
LLVMDLLStorageClass
LLVMDLLStorageClass
Definition:Core.h:207
LLVMValueKind
LLVMValueKind
Definition:Core.h:257
LLVMAttributeIndex
unsigned LLVMAttributeIndex
Definition:Core.h:478
LLVMIntPredicate
LLVMIntPredicate
Definition:Core.h:292
LLVMFastMathFlags
unsigned LLVMFastMathFlags
Flags to indicate what fast-math-style optimizations are allowed on operations.
Definition:Core.h:515
LLVMUnnamedAddr
LLVMUnnamedAddr
Definition:Core.h:201
LLVMModuleFlagBehavior
LLVMModuleFlagBehavior
Definition:Core.h:415
LLVMDiagnosticSeverity
LLVMDiagnosticSeverity
Definition:Core.h:403
LLVMVisibility
LLVMVisibility
Definition:Core.h:195
LLVMAtomicRMWBinOp
LLVMAtomicRMWBinOp
Definition:Core.h:364
LLVMThreadLocalMode
LLVMThreadLocalMode
Definition:Core.h:329
LLVMGEPNoWrapFlags
unsigned LLVMGEPNoWrapFlags
Flags that constrain the allowed wrap semantics of a getelementptr instruction.
Definition:Core.h:529
LLVMAtomicOrdering
LLVMAtomicOrdering
Definition:Core.h:337
LLVMInlineAsmDialect
LLVMInlineAsmDialect
Definition:Core.h:410
LLVMDLLImportLinkage
@ LLVMDLLImportLinkage
Obsolete.
Definition:Core.h:186
LLVMInternalLinkage
@ LLVMInternalLinkage
Rename collisions when linking (static functions)
Definition:Core.h:183
LLVMLinkOnceAnyLinkage
@ LLVMLinkOnceAnyLinkage
Keep one copy of function when linking (inline)
Definition:Core.h:175
LLVMExternalLinkage
@ LLVMExternalLinkage
Externally visible function.
Definition:Core.h:173
LLVMExternalWeakLinkage
@ LLVMExternalWeakLinkage
ExternalWeak linkage description.
Definition:Core.h:188
LLVMLinkOnceODRLinkage
@ LLVMLinkOnceODRLinkage
Same, but only replaced by something equivalent.
Definition:Core.h:176
LLVMPrivateLinkage
@ LLVMPrivateLinkage
Like Internal, but omit from symbol table.
Definition:Core.h:185
LLVMDLLExportLinkage
@ LLVMDLLExportLinkage
Obsolete.
Definition:Core.h:187
LLVMLinkerPrivateLinkage
@ LLVMLinkerPrivateLinkage
Like Private, but linker removes.
Definition:Core.h:191
LLVMWeakODRLinkage
@ LLVMWeakODRLinkage
Same, but only replaced by something equivalent.
Definition:Core.h:180
LLVMGhostLinkage
@ LLVMGhostLinkage
Obsolete.
Definition:Core.h:189
LLVMWeakAnyLinkage
@ LLVMWeakAnyLinkage
Keep one copy of function when linking (weak)
Definition:Core.h:179
LLVMAppendingLinkage
@ LLVMAppendingLinkage
Special purpose, only applies to global arrays.
Definition:Core.h:182
LLVMCommonLinkage
@ LLVMCommonLinkage
Tentative definitions.
Definition:Core.h:190
LLVMLinkOnceODRAutoHideLinkage
@ LLVMLinkOnceODRAutoHideLinkage
Obsolete.
Definition:Core.h:178
LLVMLinkerPrivateWeakLinkage
@ LLVMLinkerPrivateWeakLinkage
Like LinkerPrivate, but is weak.
Definition:Core.h:192
LLVMAvailableExternallyLinkage
@ LLVMAvailableExternallyLinkage
Definition:Core.h:174
LLVMHalfTypeKind
@ LLVMHalfTypeKind
16 bit floating point type
Definition:Core.h:150
LLVMFP128TypeKind
@ LLVMFP128TypeKind
128 bit floating point type (112-bit mantissa)
Definition:Core.h:154
LLVMIntegerTypeKind
@ LLVMIntegerTypeKind
Arbitrary bit width integers.
Definition:Core.h:157
LLVMPointerTypeKind
@ LLVMPointerTypeKind
Pointers.
Definition:Core.h:161
LLVMX86_FP80TypeKind
@ LLVMX86_FP80TypeKind
80 bit floating point type (X87)
Definition:Core.h:153
LLVMX86_AMXTypeKind
@ LLVMX86_AMXTypeKind
X86 AMX.
Definition:Core.h:168
LLVMMetadataTypeKind
@ LLVMMetadataTypeKind
Metadata.
Definition:Core.h:163
LLVMScalableVectorTypeKind
@ LLVMScalableVectorTypeKind
Scalable SIMD vector type.
Definition:Core.h:166
LLVMArrayTypeKind
@ LLVMArrayTypeKind
Arrays.
Definition:Core.h:160
LLVMBFloatTypeKind
@ LLVMBFloatTypeKind
16 bit brain floating point type
Definition:Core.h:167
LLVMStructTypeKind
@ LLVMStructTypeKind
Structures.
Definition:Core.h:159
LLVMLabelTypeKind
@ LLVMLabelTypeKind
Labels.
Definition:Core.h:156
LLVMDoubleTypeKind
@ LLVMDoubleTypeKind
64 bit floating point type
Definition:Core.h:152
LLVMVoidTypeKind
@ LLVMVoidTypeKind
type with no size
Definition:Core.h:149
LLVMTokenTypeKind
@ LLVMTokenTypeKind
Tokens.
Definition:Core.h:165
LLVMFloatTypeKind
@ LLVMFloatTypeKind
32 bit floating point type
Definition:Core.h:151
LLVMFunctionTypeKind
@ LLVMFunctionTypeKind
Functions.
Definition:Core.h:158
LLVMVectorTypeKind
@ LLVMVectorTypeKind
Fixed width SIMD vector type.
Definition:Core.h:162
LLVMPPC_FP128TypeKind
@ LLVMPPC_FP128TypeKind
128 bit floating point type (two 64-bits)
Definition:Core.h:155
LLVMTargetExtTypeKind
@ LLVMTargetExtTypeKind
Target extension type.
Definition:Core.h:169
LLVMInstructionValueKind
@ LLVMInstructionValueKind
Definition:Core.h:286
LLVMGEPFlagInBounds
@ LLVMGEPFlagInBounds
Definition:Core.h:518
LLVMGEPFlagNUSW
@ LLVMGEPFlagNUSW
Definition:Core.h:519
LLVMGEPFlagNUW
@ LLVMGEPFlagNUW
Definition:Core.h:520
LLVMGlobalUnnamedAddr
@ LLVMGlobalUnnamedAddr
Address of the GV is globally insignificant.
Definition:Core.h:204
LLVMLocalUnnamedAddr
@ LLVMLocalUnnamedAddr
Address of the GV is locally insignificant.
Definition:Core.h:203
LLVMNoUnnamedAddr
@ LLVMNoUnnamedAddr
Address of the GV is significant.
Definition:Core.h:202
LLVMModuleFlagBehaviorRequire
@ LLVMModuleFlagBehaviorRequire
Adds a requirement that another module flag be present and have a specified value after linking is pe...
Definition:Core.h:441
LLVMModuleFlagBehaviorWarning
@ LLVMModuleFlagBehaviorWarning
Emits a warning if two values disagree.
Definition:Core.h:429
LLVMModuleFlagBehaviorOverride
@ LLVMModuleFlagBehaviorOverride
Uses the specified value, regardless of the behavior or value of the other module.
Definition:Core.h:449
LLVMModuleFlagBehaviorAppendUnique
@ LLVMModuleFlagBehaviorAppendUnique
Appends the two values, which are required to be metadata nodes.
Definition:Core.h:463
LLVMModuleFlagBehaviorAppend
@ LLVMModuleFlagBehaviorAppend
Appends the two values, which are required to be metadata nodes.
Definition:Core.h:455
LLVMModuleFlagBehaviorError
@ LLVMModuleFlagBehaviorError
Emits an error if two values disagree, otherwise the resulting value is that of the operands.
Definition:Core.h:422
LLVMDSWarning
@ LLVMDSWarning
Definition:Core.h:405
LLVMDSNote
@ LLVMDSNote
Definition:Core.h:407
LLVMDSError
@ LLVMDSError
Definition:Core.h:404
LLVMDSRemark
@ LLVMDSRemark
Definition:Core.h:406
LLVMAtomicRMWBinOpXor
@ LLVMAtomicRMWBinOpXor
Xor a value and return the old one.
Definition:Core.h:371
LLVMAtomicRMWBinOpXchg
@ LLVMAtomicRMWBinOpXchg
Set the new value and return the one old.
Definition:Core.h:365
LLVMAtomicRMWBinOpSub
@ LLVMAtomicRMWBinOpSub
Subtract a value and return the old one.
Definition:Core.h:367
LLVMAtomicRMWBinOpUMax
@ LLVMAtomicRMWBinOpUMax
Sets the value if it's greater than the original using an unsigned comparison and return the old one.
Definition:Core.h:378
LLVMAtomicRMWBinOpUSubSat
@ LLVMAtomicRMWBinOpUSubSat
Subtracts the value, clamping to zero.
Definition:Core.h:400
LLVMAtomicRMWBinOpAnd
@ LLVMAtomicRMWBinOpAnd
And a value and return the old one.
Definition:Core.h:368
LLVMAtomicRMWBinOpUDecWrap
@ LLVMAtomicRMWBinOpUDecWrap
Decrements the value, wrapping back to the input value when decremented below zero.
Definition:Core.h:396
LLVMAtomicRMWBinOpFMax
@ LLVMAtomicRMWBinOpFMax
Sets the value if it's greater than the original using an floating point comparison and return the ol...
Definition:Core.h:388
LLVMAtomicRMWBinOpMin
@ LLVMAtomicRMWBinOpMin
Sets the value if it's Smaller than the original using a signed comparison and return the old one.
Definition:Core.h:375
LLVMAtomicRMWBinOpOr
@ LLVMAtomicRMWBinOpOr
OR a value and return the old one.
Definition:Core.h:370
LLVMAtomicRMWBinOpFMin
@ LLVMAtomicRMWBinOpFMin
Sets the value if it's smaller than the original using an floating point comparison and return the ol...
Definition:Core.h:391
LLVMAtomicRMWBinOpMax
@ LLVMAtomicRMWBinOpMax
Sets the value if it's greater than the original using a signed comparison and return the old one.
Definition:Core.h:372
LLVMAtomicRMWBinOpUIncWrap
@ LLVMAtomicRMWBinOpUIncWrap
Increments the value, wrapping back to zero when incremented above input value.
Definition:Core.h:394
LLVMAtomicRMWBinOpFAdd
@ LLVMAtomicRMWBinOpFAdd
Add a floating point value and return the old one.
Definition:Core.h:384
LLVMAtomicRMWBinOpFSub
@ LLVMAtomicRMWBinOpFSub
Subtract a floating point value and return the old one.
Definition:Core.h:386
LLVMAtomicRMWBinOpAdd
@ LLVMAtomicRMWBinOpAdd
Add a value and return the old one.
Definition:Core.h:366
LLVMAtomicRMWBinOpUMin
@ LLVMAtomicRMWBinOpUMin
Sets the value if it's greater than the original using an unsigned comparison and return the old one.
Definition:Core.h:381
LLVMAtomicRMWBinOpNand
@ LLVMAtomicRMWBinOpNand
Not-And a value and return the old one.
Definition:Core.h:369
LLVMAtomicRMWBinOpUSubCond
@ LLVMAtomicRMWBinOpUSubCond
Subtracts the value only if no unsigned overflow.
Definition:Core.h:398
LLVMFastMathAllowReassoc
@ LLVMFastMathAllowReassoc
Definition:Core.h:495
LLVMFastMathNoSignedZeros
@ LLVMFastMathNoSignedZeros
Definition:Core.h:498
LLVMFastMathApproxFunc
@ LLVMFastMathApproxFunc
Definition:Core.h:501
LLVMFastMathNoInfs
@ LLVMFastMathNoInfs
Definition:Core.h:497
LLVMFastMathNoNaNs
@ LLVMFastMathNoNaNs
Definition:Core.h:496
LLVMFastMathNone
@ LLVMFastMathNone
Definition:Core.h:502
LLVMFastMathAllowContract
@ LLVMFastMathAllowContract
Definition:Core.h:500
LLVMFastMathAllowReciprocal
@ LLVMFastMathAllowReciprocal
Definition:Core.h:499
LLVMGeneralDynamicTLSModel
@ LLVMGeneralDynamicTLSModel
Definition:Core.h:331
LLVMLocalDynamicTLSModel
@ LLVMLocalDynamicTLSModel
Definition:Core.h:332
LLVMNotThreadLocal
@ LLVMNotThreadLocal
Definition:Core.h:330
LLVMInitialExecTLSModel
@ LLVMInitialExecTLSModel
Definition:Core.h:333
LLVMLocalExecTLSModel
@ LLVMLocalExecTLSModel
Definition:Core.h:334
LLVMAtomicOrderingAcquireRelease
@ LLVMAtomicOrderingAcquireRelease
provides both an Acquire and a Release barrier (for fences and operations which both read and write m...
Definition:Core.h:350
LLVMAtomicOrderingRelease
@ LLVMAtomicOrderingRelease
Release is similar to Acquire, but with a barrier of the sort necessary to release a lock.
Definition:Core.h:347
LLVMAtomicOrderingAcquire
@ LLVMAtomicOrderingAcquire
Acquire provides a barrier of the sort necessary to acquire a lock to access other memory with normal...
Definition:Core.h:344
LLVMAtomicOrderingMonotonic
@ LLVMAtomicOrderingMonotonic
guarantees that if you take all the operations affecting a specific address, a consistent ordering ex...
Definition:Core.h:341
LLVMAtomicOrderingSequentiallyConsistent
@ LLVMAtomicOrderingSequentiallyConsistent
provides Acquire semantics for loads and Release semantics for stores.
Definition:Core.h:354
LLVMAtomicOrderingNotAtomic
@ LLVMAtomicOrderingNotAtomic
A load or store which is not atomic.
Definition:Core.h:338
LLVMAtomicOrderingUnordered
@ LLVMAtomicOrderingUnordered
Lowest level of atomicity, guarantees somewhat sane results, lock free.
Definition:Core.h:339
LLVMInlineAsmDialectATT
@ LLVMInlineAsmDialectATT
Definition:Core.h:411
LLVMInlineAsmDialectIntel
@ LLVMInlineAsmDialectIntel
Definition:Core.h:412
LLVMGetNextBasicBlock
LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB)
Advance a basic block iterator.
Definition:Core.cpp:2827
LLVMAppendExistingBasicBlock
void LLVMAppendExistingBasicBlock(LLVMValueRef Fn, LLVMBasicBlockRef BB)
Append the given basic block to the basic block list of the given function.
Definition:Core.cpp:2856
LLVMDeleteBasicBlock
void LLVMDeleteBasicBlock(LLVMBasicBlockRef BBRef)
Remove a basic block from a function and delete it.
Definition:Core.cpp:2883
LLVMGetFirstBasicBlock
LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn)
Obtain the first basic block in a function.
Definition:Core.cpp:2811
LLVMValueAsBasicBlock
LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val)
Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
Definition:Core.cpp:2781
LLVMCreateBasicBlockInContext
LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C, const char *Name)
Create a new basic block without inserting it into a function.
Definition:Core.cpp:2843
LLVMRemoveBasicBlockFromParent
void LLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BBRef)
Remove a basic block from a function.
Definition:Core.cpp:2887
LLVMMoveBasicBlockBefore
void LLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to before another one.
Definition:Core.cpp:2891
LLVMBasicBlockAsValue
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB)
Convert a basic block instance to a value type.
Definition:Core.cpp:2773
LLVMInsertExistingBasicBlockAfterInsertBlock
void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder, LLVMBasicBlockRef BB)
Insert the given basic block after the insertion point of the given builder.
Definition:Core.cpp:2848
LLVMGetBasicBlocks
void LLVMGetBasicBlocks(LLVMValueRef FnRef, LLVMBasicBlockRef *BasicBlocksRefs)
Obtain all of the basic blocks in a function.
Definition:Core.cpp:2801
LLVMAppendBasicBlock
LLVMBasicBlockRef LLVMAppendBasicBlock(LLVMValueRef FnRef, const char *Name)
Append a basic block to the end of a function using the global context.
Definition:Core.cpp:2867
LLVMGetBasicBlockTerminator
LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB)
Obtain the terminator instruction for a basic block.
Definition:Core.cpp:2793
LLVMCountBasicBlocks
unsigned LLVMCountBasicBlocks(LLVMValueRef FnRef)
Obtain the number of basic blocks in a function.
Definition:Core.cpp:2797
LLVMMoveBasicBlockAfter
void LLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to after another one.
Definition:Core.cpp:2895
LLVMGetLastBasicBlock
LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn)
Obtain the last basic block in a function.
Definition:Core.cpp:2819
LLVMAppendBasicBlockInContext
LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C, LLVMValueRef FnRef, const char *Name)
Append a basic block to the end of a function.
Definition:Core.cpp:2861
LLVMGetBasicBlockParent
LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB)
Obtain the function to which a basic block belongs.
Definition:Core.cpp:2789
LLVMGetFirstInstruction
LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB)
Obtain the first instruction in a basic block.
Definition:Core.cpp:2905
LLVMGetLastInstruction
LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB)
Obtain the last instruction in a basic block.
Definition:Core.cpp:2913
LLVMInsertBasicBlockInContext
LLVMBasicBlockRef LLVMInsertBasicBlockInContext(LLVMContextRef C, LLVMBasicBlockRef BBRef, const char *Name)
Insert a basic block in a function before another basic block.
Definition:Core.cpp:2871
LLVMInsertBasicBlock
LLVMBasicBlockRef LLVMInsertBasicBlock(LLVMBasicBlockRef BBRef, const char *Name)
Insert a basic block in a function using the global context.
Definition:Core.cpp:2878
LLVMGetEntryBasicBlock
LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn)
Obtain the basic block that corresponds to the entry point of a function.
Definition:Core.cpp:2807
LLVMValueIsBasicBlock
LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val)
Determine whether an LLVMValueRef is itself a basic block.
Definition:Core.cpp:2777
LLVMGetBasicBlockName
const char * LLVMGetBasicBlockName(LLVMBasicBlockRef BB)
Obtain the string name of a basic block.
Definition:Core.cpp:2785
LLVMGetPreviousBasicBlock
LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB)
Go backwards in a basic block iterator.
Definition:Core.cpp:2835
LLVMConstStruct
LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
Create a ConstantStruct in the global Context.
Definition:Core.cpp:1666
LLVMConstArray
LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, unsigned Length)
Create a ConstantArray from values.
Definition:Core.cpp:1646
LLVMConstArray2
LLVMValueRef LLVMConstArray2(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, uint64_t Length)
Create a ConstantArray from values.
Definition:Core.cpp:1652
LLVMConstVector
LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size)
Create a ConstantVector from values.
Definition:Core.cpp:1681
LLVMConstStringInContext
LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str, unsigned Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential and initialize it with a string.
Definition:Core.cpp:1604
LLVMConstNamedStruct
LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy, LLVMValueRef *ConstantVals, unsigned Count)
Create a non-anonymous ConstantStruct from values.
Definition:Core.cpp:1672
LLVMIsConstantString
LLVMBool LLVMIsConstantString(LLVMValueRef C)
Returns true if the specified constant is an array of i8.
Definition:Core.cpp:1636
LLVMConstantPtrAuth
LLVMValueRef LLVMConstantPtrAuth(LLVMValueRef Ptr, LLVMValueRef Key, LLVMValueRef Disc, LLVMValueRef AddrDisc)
Create a ConstantPtrAuth constant with the given values.
Definition:Core.cpp:1686
LLVMGetAggregateElement
LLVMValueRef LLVMGetAggregateElement(LLVMValueRef C, unsigned Idx)
Get element of a constant aggregate (struct, array or vector) at the specified index.
Definition:Core.cpp:1628
LLVMConstString
LLVMValueRef LLVMConstString(const char *Str, unsigned Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential with string content in the global context.
Definition:Core.cpp:1622
LLVMGetAsString
const char * LLVMGetAsString(LLVMValueRef C, size_t *Length)
Get the given constant data sequential as a string.
Definition:Core.cpp:1640
LLVMConstStringInContext2
LLVMValueRef LLVMConstStringInContext2(LLVMContextRef C, const char *Str, size_t Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential and initialize it with a string.
Definition:Core.cpp:1613
LLVMConstStructInContext
LLVMValueRef LLVMConstStructInContext(LLVMContextRef C, LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
Create an anonymous ConstantStruct with the specified values.
Definition:Core.cpp:1658
LLVMConstPointerCast
LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition:Core.cpp:1889
LLVMConstMul
LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition:Core.cpp:1806
LLVMConstTruncOrBitCast
LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition:Core.cpp:1883
LLVMSizeOf
LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty)
Definition:Core.cpp:1751
LLVMConstPtrToInt
LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition:Core.cpp:1862
LLVMConstNUWSub
LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition:Core.cpp:1800
LLVMConstNUWAdd
LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition:Core.cpp:1783
LLVMConstIntToPtr
LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition:Core.cpp:1867
LLVMConstTrunc
LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition:Core.cpp:1857
LLVMConstNot
LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal)
Definition:Core.cpp:1768
LLVMGetBlockAddressFunction
LLVMValueRef LLVMGetBlockAddressFunction(LLVMValueRef BlockAddr)
Gets the function associated with a given BlockAddress constant value.
Definition:Core.cpp:1931
LLVMConstNSWMul
LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition:Core.cpp:1811
LLVMConstExtractElement
LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, LLVMValueRef IndexConstant)
Definition:Core.cpp:1895
LLVMConstInsertElement
LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant, LLVMValueRef ElementValueConstant, LLVMValueRef IndexConstant)
Definition:Core.cpp:1901
LLVMConstInBoundsGEP2
LLVMValueRef LLVMConstInBoundsGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
Definition:Core.cpp:1836
LLVMConstAddrSpaceCast
LLVMValueRef LLVMConstAddrSpaceCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition:Core.cpp:1877
LLVMGetBlockAddressBasicBlock
LLVMBasicBlockRef LLVMGetBlockAddressBasicBlock(LLVMValueRef BlockAddr)
Gets the basic block associated with a given BlockAddress constant value.
Definition:Core.cpp:1935
LLVMConstNSWAdd
LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition:Core.cpp:1777
LLVMAlignOf
LLVMValueRef LLVMAlignOf(LLVMTypeRef Ty)
Definition:Core.cpp:1747
LLVMConstInlineAsm
LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString, const char *Constraints, LLVMBool HasSideEffects, LLVMBool IsAlignStack)
Deprecated: Use LLVMGetInlineAsm instead.
Definition:Core.cpp:1919
LLVMConstXor
LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition:Core.cpp:1823
LLVMConstBitCast
LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition:Core.cpp:1872
LLVMConstNSWNeg
LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal)
Definition:Core.cpp:1759
LLVMConstNUWMul
LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition:Core.cpp:1817
LLVMConstGEPWithNoWrapFlags
LLVMValueRef LLVMConstGEPWithNoWrapFlags(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices, LLVMGEPNoWrapFlags NoWrapFlags)
Creates a constant GetElementPtr expression.
Definition:Core.cpp:1845
LLVMConstGEP2
LLVMValueRef LLVMConstGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
Definition:Core.cpp:1828
LLVMConstSub
LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition:Core.cpp:1789
LLVMConstAdd
LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition:Core.cpp:1772
LLVMConstShuffleVector
LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant, LLVMValueRef VectorBConstant, LLVMValueRef MaskConstant)
Definition:Core.cpp:1909
LLVMConstNeg
LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal)
Definition:Core.cpp:1755
LLVMBlockAddress
LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB)
Definition:Core.cpp:1927
LLVMGetConstOpcode
LLVMOpcode LLVMGetConstOpcode(LLVMValueRef ConstantVal)
Definition:Core.cpp:1743
LLVMConstNSWSub
LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition:Core.cpp:1794
LLVMGlobalSetMetadata
void LLVMGlobalSetMetadata(LLVMValueRef Global, unsigned Kind, LLVMMetadataRef MD)
Sets a metadata attachment, erasing the existing metadata attachment if it already exists for the giv...
Definition:Core.cpp:2185
LLVMValueMetadataEntriesGetKind
unsigned LLVMValueMetadataEntriesGetKind(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the kind of a value metadata entry at a specific index.
Definition:Core.cpp:2166
LLVMDisposeValueMetadataEntries
void LLVMDisposeValueMetadataEntries(LLVMValueMetadataEntry *Entries)
Destroys value metadata entries.
Definition:Core.cpp:2181
LLVMSetVisibility
void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz)
Definition:Core.cpp:2058
LLVMGetDLLStorageClass
LLVMDLLStorageClass LLVMGetDLLStorageClass(LLVMValueRef Global)
Definition:Core.cpp:2063
LLVMSetAlignment
void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes)
Set the preferred alignment of the value.
Definition:Core.cpp:2134
LLVMGetGlobalParent
LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global)
Definition:Core.cpp:1941
LLVMGetSection
const char * LLVMGetSection(LLVMValueRef Global)
Definition:Core.cpp:2043
LLVMGlobalGetValueType
LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global)
Returns the "value type" of a global value.
Definition:Core.cpp:2108
LLVMIsDeclaration
LLVMBool LLVMIsDeclaration(LLVMValueRef Global)
Definition:Core.cpp:1945
LLVMGetVisibility
LLVMVisibility LLVMGetVisibility(LLVMValueRef Global)
Definition:Core.cpp:2053
LLVMSetDLLStorageClass
void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class)
Definition:Core.cpp:2068
LLVMHasUnnamedAddr
LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global)
Deprecated: Use LLVMGetUnnamedAddress instead.
Definition:Core.cpp:2098
LLVMGetLinkage
LLVMLinkage LLVMGetLinkage(LLVMValueRef Global)
Definition:Core.cpp:1949
LLVMGetUnnamedAddress
LLVMUnnamedAddr LLVMGetUnnamedAddress(LLVMValueRef Global)
Definition:Core.cpp:2073
LLVMValueMetadataEntriesGetMetadata
LLVMMetadataRef LLVMValueMetadataEntriesGetMetadata(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the underlying metadata node of a value metadata entry at a specific index.
Definition:Core.cpp:2174
LLVMSetUnnamedAddress
void LLVMSetUnnamedAddress(LLVMValueRef Global, LLVMUnnamedAddr UnnamedAddr)
Definition:Core.cpp:2085
LLVMSetLinkage
void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage)
Definition:Core.cpp:1978
LLVMSetUnnamedAddr
void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr)
Deprecated: Use LLVMSetUnnamedAddress instead.
Definition:Core.cpp:2102
LLVMGlobalClearMetadata
void LLVMGlobalClearMetadata(LLVMValueRef Global)
Removes all metadata attachments from this value.
Definition:Core.cpp:2194
LLVMGetAlignment
unsigned LLVMGetAlignment(LLVMValueRef V)
Obtain the preferred alignment of the value.
Definition:Core.cpp:2114
LLVMSetSection
void LLVMSetSection(LLVMValueRef Global, const char *Section)
Definition:Core.cpp:2049
LLVMGlobalEraseMetadata
void LLVMGlobalEraseMetadata(LLVMValueRef Global, unsigned Kind)
Erases a metadata attachment of the given kind if it exists.
Definition:Core.cpp:2190
LLVMGlobalCopyAllMetadata
LLVMValueMetadataEntry * LLVMGlobalCopyAllMetadata(LLVMValueRef Value, size_t *NumEntries)
Retrieves an array of metadata entries representing the metadata attached to this value.
Definition:Core.cpp:2154
LLVMConstInt
LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N, LLVMBool SignExtend)
Obtain a constant value for an integer type.
Definition:Core.cpp:1539
LLVMConstIntOfArbitraryPrecision
LLVMValueRef LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy, unsigned NumWords, const uint64_t Words[])
Obtain a constant value for an integer of arbitrary precision.
Definition:Core.cpp:1544
LLVMConstRealOfString
LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text)
Obtain a constant for a floating point value parsed from a string.
Definition:Core.cpp:1568
LLVMConstRealGetDouble
double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *LosesInfo)
Obtain the double value for an floating point constant value.
Definition:Core.cpp:1585
LLVMConstIntGetSExtValue
long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal)
Obtain the sign extended value for an integer constant value.
Definition:Core.cpp:1581
LLVMConstIntGetZExtValue
unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal)
Obtain the zero extended value for an integer constant value.
Definition:Core.cpp:1577
LLVMConstReal
LLVMValueRef LLVMConstReal(LLVMTypeRef RealTy, double N)
Obtain a constant value referring to a double floating point value.
Definition:Core.cpp:1564
LLVMIsNull
LLVMBool LLVMIsNull(LLVMValueRef Val)
Determine whether a value instance is null.
Definition:Core.cpp:1262
LLVMGetUndef
LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty)
Obtain a constant value referring to an undefined value of a type.
Definition:Core.cpp:1250
LLVMGetPoison
LLVMValueRef LLVMGetPoison(LLVMTypeRef Ty)
Obtain a constant value referring to a poison value of a type.
Definition:Core.cpp:1254
LLVMConstAllOnes
LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty)
Obtain a constant value referring to the instance of a type consisting of all ones.
Definition:Core.cpp:1246
LLVMConstPointerNull
LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty)
Obtain a constant that is a constant pointer pointing to NULL for a specified type.
Definition:Core.cpp:1276
LLVMConstNull
LLVMValueRef LLVMConstNull(LLVMTypeRef Ty)
Obtain a constant value referring to the null instance of a type.
Definition:Core.cpp:1242
LLVMCountParams
unsigned LLVMCountParams(LLVMValueRef FnRef)
Obtain the number of parameters in a function.
Definition:Core.cpp:2621
LLVMGetPreviousParam
LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg)
Obtain the previous parameter to a function.
Definition:Core.cpp:2666
LLVMGetNextParam
LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg)
Obtain the next parameter to a function.
Definition:Core.cpp:2658
LLVMGetParamParent
LLVMValueRef LLVMGetParamParent(LLVMValueRef V)
Obtain the function to which this argument belongs.
Definition:Core.cpp:2638
LLVMGetFirstParam
LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn)
Obtain the first parameter to a function.
Definition:Core.cpp:2642
LLVMSetParamAlignment
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align)
Set the alignment for a function parameter.
Definition:Core.cpp:2673
LLVMGetParam
LLVMValueRef LLVMGetParam(LLVMValueRef FnRef, unsigned index)
Obtain the parameter at the specified index.
Definition:Core.cpp:2633
LLVMGetLastParam
LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn)
Obtain the last parameter to a function.
Definition:Core.cpp:2650
LLVMGetParams
void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs)
Obtain the parameters in a function.
Definition:Core.cpp:2627
LLVMSetGC
void LLVMSetGC(LLVMValueRef Fn, const char *GC)
Define the garbage collector to use during code generation.
Definition:Core.cpp:2531
LLVMGetGC
const char * LLVMGetGC(LLVMValueRef Fn)
Obtain the name of the garbage collector to use during code generation.
Definition:Core.cpp:2526
LLVMGetPrologueData
LLVMValueRef LLVMGetPrologueData(LLVMValueRef Fn)
Gets the prologue data associated with a function.
Definition:Core.cpp:2555
LLVMRemoveEnumAttributeAtIndex
void LLVMRemoveEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
Definition:Core.cpp:2602
LLVMGetAttributeCountAtIndex
unsigned LLVMGetAttributeCountAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx)
Definition:Core.cpp:2576
LLVMHasPersonalityFn
LLVMBool LLVMHasPersonalityFn(LLVMValueRef Fn)
Check whether the given function has a personality function.
Definition:Core.cpp:2442
LLVMLookupIntrinsicID
unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen)
Obtain the intrinsic ID number which matches the given function name.
Definition:Core.cpp:2508
LLVMIntrinsicGetName
const char * LLVMIntrinsicGetName(unsigned ID, size_t *NameLength)
Retrieves the name of an intrinsic.
Definition:Core.cpp:2475
LLVMGetFunctionCallConv
unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn)
Obtain the calling function of a function.
Definition:Core.cpp:2517
LLVMGetPrefixData
LLVMValueRef LLVMGetPrefixData(LLVMValueRef Fn)
Gets the prefix data associated with a function.
Definition:Core.cpp:2539
LLVMRemoveStringAttributeAtIndex
void LLVMRemoveStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition:Core.cpp:2607
LLVMSetPrefixData
void LLVMSetPrefixData(LLVMValueRef Fn, LLVMValueRef prefixData)
Sets the prefix data for the function.
Definition:Core.cpp:2549
LLVMIntrinsicCopyOverloadedName
char * LLVMIntrinsicCopyOverloadedName(unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount, size_t *NameLength)
Deprecated: Use LLVMIntrinsicCopyOverloadedName2 instead.
Definition:Core.cpp:2489
LLVMGetStringAttributeAtIndex
LLVMAttributeRef LLVMGetStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition:Core.cpp:2595
LLVMGetPersonalityFn
LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn)
Obtain the personality function attached to the function.
Definition:Core.cpp:2446
LLVMSetPersonalityFn
void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn)
Set the personality function attached to the function.
Definition:Core.cpp:2450
LLVMIntrinsicIsOverloaded
LLVMBool LLVMIntrinsicIsOverloaded(unsigned ID)
Obtain if the intrinsic identified by the given ID is overloaded.
Definition:Core.cpp:2512
LLVMAddAttributeAtIndex
void LLVMAddAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Add an attribute to a function.
Definition:Core.cpp:2571
LLVMIntrinsicCopyOverloadedName2
char * LLVMIntrinsicCopyOverloadedName2(LLVMModuleRef Mod, unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount, size_t *NameLength)
Copies the name of an overloaded intrinsic identified by a given list of parameter types.
Definition:Core.cpp:2498
LLVMDeleteFunction
void LLVMDeleteFunction(LLVMValueRef Fn)
Remove a function from its containing module and deletes it.
Definition:Core.cpp:2438
LLVMSetPrologueData
void LLVMSetPrologueData(LLVMValueRef Fn, LLVMValueRef prologueData)
Sets the prologue data for the function.
Definition:Core.cpp:2565
LLVMHasPrologueData
LLVMBool LLVMHasPrologueData(LLVMValueRef Fn)
Check if a given function has prologue data.
Definition:Core.cpp:2560
LLVMHasPrefixData
LLVMBool LLVMHasPrefixData(LLVMValueRef Fn)
Check if a given function has prefix data.
Definition:Core.cpp:2544
LLVMGetAttributesAtIndex
void LLVMGetAttributesAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
Definition:Core.cpp:2581
LLVMSetFunctionCallConv
void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC)
Set the calling convention of a function.
Definition:Core.cpp:2521
LLVMGetIntrinsicDeclaration
LLVMValueRef LLVMGetIntrinsicDeclaration(LLVMModuleRef Mod, unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount)
Get or insert the declaration of an intrinsic.
Definition:Core.cpp:2466
LLVMGetEnumAttributeAtIndex
LLVMAttributeRef LLVMGetEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
Definition:Core.cpp:2588
LLVMAddTargetDependentFunctionAttr
void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A, const char *V)
Add a target-dependent attribute to a function.
Definition:Core.cpp:2612
LLVMIntrinsicGetType
LLVMTypeRef LLVMIntrinsicGetType(LLVMContextRef Ctx, unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount)
Retrieves the type of an intrinsic.
Definition:Core.cpp:2482
LLVMGetIntrinsicID
unsigned LLVMGetIntrinsicID(LLVMValueRef Fn)
Obtain the ID number from a function instance.
Definition:Core.cpp:2455
LLVMGetValueKind
LLVMValueKind LLVMGetValueKind(LLVMValueRef Val)
Obtain the enumerated type of a Value instance.
Definition:Core.cpp:1007
LLVMGetValueName
const char * LLVMGetValueName(LLVMValueRef Val)
Deprecated: Use LLVMGetValueName2 instead.
Definition:Core.cpp:1029
LLVMTypeOf
LLVMTypeRef LLVMTypeOf(LLVMValueRef Val)
Obtain the type of a value.
Definition:Core.cpp:1003
LLVMIsConstant
LLVMBool LLVMIsConstant(LLVMValueRef Ty)
Determine whether the specified value instance is constant.
Definition:Core.cpp:1258
LLVMReplaceAllUsesWith
void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal)
Replace all uses of a value with another one.
Definition:Core.cpp:1073
LLVMGetValueName2
const char * LLVMGetValueName2(LLVMValueRef Val, size_t *Length)
Obtain the string name of a value.
Definition:Core.cpp:1019
LLVMGetValueContext
LLVMContextRef LLVMGetValueContext(LLVMValueRef Val)
Obtain the context to which this value is associated.
Definition:Core.cpp:1055
LLVMPrintDbgRecordToString
char * LLVMPrintDbgRecordToString(LLVMDbgRecordRef Record)
Return a string representation of the DbgRecord.
Definition:Core.cpp:1059
LLVMSetValueName
void LLVMSetValueName(LLVMValueRef Val, const char *Name)
Deprecated: Use LLVMSetValueName2 instead.
Definition:Core.cpp:1033
LLVMDumpValue
void LLVMDumpValue(LLVMValueRef Val)
Dump a representation of a value to stderr.
Definition:Core.cpp:1037
LLVMIsUndef
LLVMBool LLVMIsUndef(LLVMValueRef Val)
Determine whether a value instance is undefined.
Definition:Core.cpp:1268
LLVMIsAMDNode
LLVMValueRef LLVMIsAMDNode(LLVMValueRef Val)
Definition:Core.cpp:1151
LLVMIsPoison
LLVMBool LLVMIsPoison(LLVMValueRef Val)
Determine whether a value instance is poisonous.
Definition:Core.cpp:1272
LLVMIsAMDString
LLVMValueRef LLVMIsAMDString(LLVMValueRef Val)
Definition:Core.cpp:1166
LLVMSetValueName2
void LLVMSetValueName2(LLVMValueRef Val, const char *Name, size_t NameLen)
Set the string name of a value.
Definition:Core.cpp:1025
LLVMIsAValueAsMetadata
LLVMValueRef LLVMIsAValueAsMetadata(LLVMValueRef Val)
Definition:Core.cpp:1159
LLVMPrintValueToString
char * LLVMPrintValueToString(LLVMValueRef Val)
Return a string representation of the value.
Definition:Core.cpp:1041
LLVMEraseGlobalIFunc
void LLVMEraseGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module and delete it.
Definition:Core.cpp:2735
LLVMRemoveGlobalIFunc
void LLVMRemoveGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module.
Definition:Core.cpp:2739
LLVMGetNextGlobalIFunc
LLVMValueRef LLVMGetNextGlobalIFunc(LLVMValueRef IFunc)
Advance a GlobalIFunc iterator to the next GlobalIFunc.
Definition:Core.cpp:2711
LLVMGetNamedGlobalIFunc
LLVMValueRef LLVMGetNamedGlobalIFunc(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalIFunc value from a Module by its name.
Definition:Core.cpp:2690
LLVMGetLastGlobalIFunc
LLVMValueRef LLVMGetLastGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the last GlobalIFunc in a Module.
Definition:Core.cpp:2703
LLVMAddGlobalIFunc
LLVMValueRef LLVMAddGlobalIFunc(LLVMModuleRef M, const char *Name, size_t NameLen, LLVMTypeRef Ty, unsigned AddrSpace, LLVMValueRef Resolver)
Add a global indirect function to a module under a specified name.
Definition:Core.cpp:2680
LLVMSetGlobalIFuncResolver
void LLVMSetGlobalIFuncResolver(LLVMValueRef IFunc, LLVMValueRef Resolver)
Sets the resolver function associated with this indirect function.
Definition:Core.cpp:2731
LLVMGetFirstGlobalIFunc
LLVMValueRef LLVMGetFirstGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the first GlobalIFunc in a Module.
Definition:Core.cpp:2695
LLVMGetGlobalIFuncResolver
LLVMValueRef LLVMGetGlobalIFuncResolver(LLVMValueRef IFunc)
Retrieves the resolver function associated with this indirect function, or NULL if it doesn't not exi...
Definition:Core.cpp:2727
LLVMGetPreviousGlobalIFunc
LLVMValueRef LLVMGetPreviousGlobalIFunc(LLVMValueRef IFunc)
Decrement a GlobalIFunc iterator to the previous GlobalIFunc.
Definition:Core.cpp:2719
LLVMGetAllocatedType
LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca)
Obtain the type that is being allocated by the alloca instruction.
Definition:Core.cpp:3192
LLVMGetOperandBundleAtIndex
LLVMOperandBundleRef LLVMGetOperandBundleAtIndex(LLVMValueRef C, unsigned Index)
Obtain the operand bundle attached to this instruction at the given index.
Definition:Core.cpp:3092
LLVMGetCalledValue
LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr)
Obtain the pointer to the function invoked by this instruction.
Definition:Core.cpp:3080
LLVMGetCallSiteAttributes
void LLVMGetCallSiteAttributes(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
Definition:Core.cpp:3048
LLVMGetNumArgOperands
unsigned LLVMGetNumArgOperands(LLVMValueRef Instr)
Obtain the argument count for a call instruction.
Definition:Core.cpp:3010
LLVMSetNormalDest
void LLVMSetNormalDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the normal destination basic block.
Definition:Core.cpp:3131
LLVMGetInstructionCallConv
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr)
Obtain the calling convention for a call instruction.
Definition:Core.cpp:3019
LLVMGetCalledFunctionType
LLVMTypeRef LLVMGetCalledFunctionType(LLVMValueRef Instr)
Obtain the function type called by this instruction.
Definition:Core.cpp:3084
LLVMGetCallSiteAttributeCount
unsigned LLVMGetCallSiteAttributeCount(LLVMValueRef C, LLVMAttributeIndex Idx)
Definition:Core.cpp:3041
LLVMAddCallSiteAttribute
void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Definition:Core.cpp:3036
LLVMGetNumOperandBundles
unsigned LLVMGetNumOperandBundles(LLVMValueRef C)
Obtain the number of operand bundles attached to this instruction.
Definition:Core.cpp:3088
LLVMGetCallBrIndirectDest
LLVMBasicBlockRef LLVMGetCallBrIndirectDest(LLVMValueRef CallBr, unsigned Idx)
Get the indirect destination of a CallBr instruction at the given index.
Definition:Core.cpp:3152
LLVMSetInstructionCallConv
void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC)
Set the calling convention for a call instruction.
Definition:Core.cpp:3023
LLVMGetCallSiteEnumAttribute
LLVMAttributeRef LLVMGetCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
Definition:Core.cpp:3056
LLVMGetNormalDest
LLVMBasicBlockRef LLVMGetNormalDest(LLVMValueRef Invoke)
Return the normal destination basic block.
Definition:Core.cpp:3118
LLVMRemoveCallSiteEnumAttribute
void LLVMRemoveCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
Definition:Core.cpp:3070
LLVMGetCallBrNumIndirectDests
unsigned LLVMGetCallBrNumIndirectDests(LLVMValueRef CallBr)
Get the number of indirect destinations of a CallBr instruction.
Definition:Core.cpp:3148
LLVMSetUnwindDest
void LLVMSetUnwindDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the unwind destination basic block.
Definition:Core.cpp:3135
LLVMSetTailCall
void LLVMSetTailCall(LLVMValueRef Call, LLVMBool isTailCall)
Set whether a call instruction is a tail call.
Definition:Core.cpp:3104
LLVMIsTailCall
LLVMBool LLVMIsTailCall(LLVMValueRef Call)
Obtain whether a call instruction is a tail call.
Definition:Core.cpp:3100
LLVMSetInstrParamAlignment
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, LLVMAttributeIndex Idx, unsigned align)
Definition:Core.cpp:3028
LLVMGetCallBrDefaultDest
LLVMBasicBlockRef LLVMGetCallBrDefaultDest(LLVMValueRef CallBr)
Get the default destination of a CallBr instruction.
Definition:Core.cpp:3144
LLVMRemoveCallSiteStringAttribute
void LLVMRemoveCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition:Core.cpp:3075
LLVMGetTailCallKind
LLVMTailCallKind LLVMGetTailCallKind(LLVMValueRef Call)
Obtain a tail call kind of the call instruction.
Definition:Core.cpp:3108
LLVMSetTailCallKind
void LLVMSetTailCallKind(LLVMValueRef Call, LLVMTailCallKind kind)
Set the call kind of the call instruction.
Definition:Core.cpp:3112
LLVMGetCallSiteStringAttribute
LLVMAttributeRef LLVMGetCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition:Core.cpp:3063
LLVMGetUnwindDest
LLVMBasicBlockRef LLVMGetUnwindDest(LLVMValueRef Invoke)
Return the unwind destination basic block.
Definition:Core.cpp:3122
LLVMGetGEPSourceElementType
LLVMTypeRef LLVMGetGEPSourceElementType(LLVMValueRef GEP)
Get the source element type of the given GEP operator.
Definition:Core.cpp:3206
LLVMIsInBounds
LLVMBool LLVMIsInBounds(LLVMValueRef GEP)
Check whether the given GEP operator is inbounds.
Definition:Core.cpp:3198
LLVMSetIsInBounds
void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds)
Set the given GEP instruction to be inbounds or not.
Definition:Core.cpp:3202
LLVMGEPSetNoWrapFlags
void LLVMGEPSetNoWrapFlags(LLVMValueRef GEP, LLVMGEPNoWrapFlags NoWrapFlags)
Set the no-wrap related flags for the given GEP instruction.
Definition:Core.cpp:3215
LLVMGEPGetNoWrapFlags
LLVMGEPNoWrapFlags LLVMGEPGetNoWrapFlags(LLVMValueRef GEP)
Get the no-wrap related flags for the given GEP instruction.
Definition:Core.cpp:3210
LLVMGetIndices
const unsigned * LLVMGetIndices(LLVMValueRef Inst)
Obtain the indices as an array.
Definition:Core.cpp:3255
LLVMGetNumIndices
unsigned LLVMGetNumIndices(LLVMValueRef Inst)
Obtain the number of indices.
Definition:Core.cpp:3243
LLVMAddIncoming
void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues, LLVMBasicBlockRef *IncomingBlocks, unsigned Count)
Add an incoming value to the end of a PHI list.
Definition:Core.cpp:3222
LLVMGetIncomingValue
LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMValueRef.
Definition:Core.cpp:3233
LLVMCountIncoming
unsigned LLVMCountIncoming(LLVMValueRef PhiNode)
Obtain the number of incoming basic blocks to a PHI node.
Definition:Core.cpp:3229
LLVMGetIncomingBlock
LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
Definition:Core.cpp:3237
LLVMGetNumSuccessors
unsigned LLVMGetNumSuccessors(LLVMValueRef Term)
Return the number of successors that this terminator has.
Definition:Core.cpp:3158
LLVMGetSwitchDefaultDest
LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef Switch)
Obtain the default destination basic block of a switch instruction.
Definition:Core.cpp:3186
LLVMSetSuccessor
void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block)
Update the specified successor to point at the provided block.
Definition:Core.cpp:3166
LLVMSetCondition
void LLVMSetCondition(LLVMValueRef Branch, LLVMValueRef Cond)
Set the condition of a branch instruction.
Definition:Core.cpp:3180
LLVMGetCondition
LLVMValueRef LLVMGetCondition(LLVMValueRef Branch)
Return the condition of a branch instruction.
Definition:Core.cpp:3176
LLVMIsConditional
LLVMBool LLVMIsConditional(LLVMValueRef Branch)
Return if a branch is conditional.
Definition:Core.cpp:3172
LLVMGetSuccessor
LLVMBasicBlockRef LLVMGetSuccessor(LLVMValueRef Term, unsigned i)
Return the specified successor.
Definition:Core.cpp:3162
LLVMGetPreviousDbgRecord
LLVMDbgRecordRef LLVMGetPreviousDbgRecord(LLVMDbgRecordRef Rec)
Obtain the previous DbgRecord in the sequence or NULL if there are no more.
Definition:Core.cpp:3002
LLVMInstructionClone
LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst)
Create a copy of 'this' instruction that is identical in all ways except the following:
Definition:Core.cpp:2967
LLVMGetNextInstruction
LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst)
Obtain the instruction that occurs after the one specified.
Definition:Core.cpp:2921
LLVMDeleteInstruction
void LLVMDeleteInstruction(LLVMValueRef Inst)
Delete an instruction.
Definition:Core.cpp:2945
LLVMIsATerminatorInst
LLVMValueRef LLVMIsATerminatorInst(LLVMValueRef Inst)
Determine whether an instruction is a terminator.
Definition:Core.cpp:2973
LLVMGetInstructionOpcode
LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst)
Obtain the code opcode for an individual instruction.
Definition:Core.cpp:2961
LLVMInstructionGetAllMetadataOtherThanDebugLoc
LLVMValueMetadataEntry * LLVMInstructionGetAllMetadataOtherThanDebugLoc(LLVMValueRef Value, size_t *NumEntries)
Returns the metadata associated with an instruction value, but filters out all the debug locations.
Definition:Core.cpp:1134
LLVMGetFirstDbgRecord
LLVMDbgRecordRef LLVMGetFirstDbgRecord(LLVMValueRef Inst)
Obtain the first debug record attached to an instruction.
Definition:Core.cpp:2978
LLVMGetFCmpPredicate
LLVMRealPredicate LLVMGetFCmpPredicate(LLVMValueRef Inst)
Obtain the float predicate of an instruction.
Definition:Core.cpp:2955
LLVMHasMetadata
int LLVMHasMetadata(LLVMValueRef Inst)
Determine whether an instruction has any metadata attached.
Definition:Core.cpp:1077
LLVMInstructionEraseFromParent
void LLVMInstructionEraseFromParent(LLVMValueRef Inst)
Remove and delete an instruction.
Definition:Core.cpp:2941
LLVMInstructionRemoveFromParent
void LLVMInstructionRemoveFromParent(LLVMValueRef Inst)
Remove an instruction.
Definition:Core.cpp:2937
LLVMGetNextDbgRecord
LLVMDbgRecordRef LLVMGetNextDbgRecord(LLVMDbgRecordRef Rec)
Obtain the next DbgRecord in the sequence or NULL if there are no more.
Definition:Core.cpp:2994
LLVMGetMetadata
LLVMValueRef LLVMGetMetadata(LLVMValueRef Inst, unsigned KindID)
Return metadata associated with an instruction value.
Definition:Core.cpp:1081
LLVMGetLastDbgRecord
LLVMDbgRecordRef LLVMGetLastDbgRecord(LLVMValueRef Inst)
Obtain the last debug record attached to an instruction.
Definition:Core.cpp:2986
LLVMGetICmpPredicate
LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst)
Obtain the predicate of an instruction.
Definition:Core.cpp:2949
LLVMSetMetadata
void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef Val)
Set metadata associated with an instruction value.
Definition:Core.cpp:1103
LLVMGetInstructionParent
LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst)
Obtain the basic block to which an instruction belongs.
Definition:Core.cpp:2901
LLVMGetPreviousInstruction
LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst)
Obtain the instruction that occurred before this one.
Definition:Core.cpp:2929
LLVMMetadataAsValue
LLVMValueRef LLVMMetadataAsValue(LLVMContextRef C, LLVMMetadataRef MD)
Obtain a Metadata as a Value.
Definition:Core.cpp:1334
LLVMMDString
LLVMValueRef LLVMMDString(const char *Str, unsigned SLen)
Deprecated: Use LLVMMDStringInContext2 instead.
Definition:Core.cpp:1299
LLVMReplaceMDNodeOperandWith
void LLVMReplaceMDNodeOperandWith(LLVMValueRef V, unsigned Index, LLVMMetadataRef Replacement)
Replace an operand at a specific index in a llvm::MDNode value.
Definition:Core.cpp:1425
LLVMMDStringInContext2
LLVMMetadataRef LLVMMDStringInContext2(LLVMContextRef C, const char *Str, size_t SLen)
Create an MDString value from a given string value.
Definition:Core.cpp:1282
LLVMMDNodeInContext2
LLVMMetadataRef LLVMMDNodeInContext2(LLVMContextRef C, LLVMMetadataRef *MDs, size_t Count)
Create an MDNode value with the given array of operands.
Definition:Core.cpp:1287
LLVMMDStringInContext
LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str, unsigned SLen)
Deprecated: Use LLVMMDStringInContext2 instead.
Definition:Core.cpp:1292
LLVMValueAsMetadata
LLVMMetadataRef LLVMValueAsMetadata(LLVMValueRef Val)
Obtain a Value as a Metadata.
Definition:Core.cpp:1338
LLVMMDNodeInContext
LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals, unsigned Count)
Deprecated: Use LLVMMDNodeInContext2 instead.
Definition:Core.cpp:1303
LLVMGetMDString
const char * LLVMGetMDString(LLVMValueRef V, unsigned *Length)
Obtain the underlying string from a MDString value.
Definition:Core.cpp:1347
LLVMGetMDNodeNumOperands
unsigned LLVMGetMDNodeNumOperands(LLVMValueRef V)
Obtain the number of operands from an MDNode value.
Definition:Core.cpp:1357
LLVMGetMDNodeOperands
void LLVMGetMDNodeOperands(LLVMValueRef V, LLVMValueRef *Dest)
Obtain the given MDNode's operands.
Definition:Core.cpp:1412
LLVMMDNode
LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count)
Deprecated: Use LLVMMDNodeInContext2 instead.
Definition:Core.cpp:1330
LLVMGetNumOperands
int LLVMGetNumOperands(LLVMValueRef Val)
Obtain the number of operands in a llvm::User value.
Definition:Core.cpp:1232
LLVMSetOperand
void LLVMSetOperand(LLVMValueRef Val, unsigned Index, LLVMValueRef Op)
Set an operand at a specific index in a llvm::User value.
Definition:Core.cpp:1228
LLVMGetOperandUse
LLVMUseRef LLVMGetOperandUse(LLVMValueRef Val, unsigned Index)
Obtain the use of an operand at a specific index in a llvm::User value.
Definition:Core.cpp:1223
LLVMGetOperand
LLVMValueRef LLVMGetOperand(LLVMValueRef Val, unsigned Index)
Obtain an operand at a specific index in a llvm::User value.
Definition:Core.cpp:1209
LLVMGetUser
LLVMValueRef LLVMGetUser(LLVMUseRef U)
Obtain the user value for a user.
Definition:Core.cpp:1189
LLVMGetFirstUse
LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val)
Obtain the first use of a value.
Definition:Core.cpp:1174
LLVMGetNextUse
LLVMUseRef LLVMGetNextUse(LLVMUseRef U)
Obtain the next use of a value.
Definition:Core.cpp:1182
LLVMGetUsedValue
LLVMValueRef LLVMGetUsedValue(LLVMUseRef U)
Obtain the value this use corresponds to.
Definition:Core.cpp:1193
LLVM_FOR_EACH_VALUE_SUBCLASS
#define LLVM_FOR_EACH_VALUE_SUBCLASS(macro)
Definition:Core.h:1838
LLVMShutdown
void LLVMShutdown()
Deallocate and destroy all ManagedStatic variables.
Definition:Core.cpp:67
LLVMGetVersion
void LLVMGetVersion(unsigned *Major, unsigned *Minor, unsigned *Patch)
Return the major, minor, and patch version of LLVM.
Definition:Core.cpp:73
LLVMDisposeMessage
void LLVMDisposeMessage(char *Message)
Definition:Core.cpp:88
LLVMCreateMessage
char * LLVMCreateMessage(const char *Message)
Definition:Core.cpp:84
LLVMValueRef
struct LLVMOpaqueValue * LLVMValueRef
Represents an individual value in LLVM IR.
Definition:Types.h:75
LLVMAttributeRef
struct LLVMOpaqueAttributeRef * LLVMAttributeRef
Used to represent an attributes.
Definition:Types.h:145
LLVMBool
int LLVMBool
Definition:Types.h:28
LLVMNamedMDNodeRef
struct LLVMOpaqueNamedMDNode * LLVMNamedMDNodeRef
Represents an LLVM Named Metadata Node.
Definition:Types.h:96
LLVMPassManagerRef
struct LLVMOpaquePassManager * LLVMPassManagerRef
Definition:Types.h:127
LLVMDbgRecordRef
struct LLVMOpaqueDbgRecord * LLVMDbgRecordRef
Definition:Types.h:175
LLVMDiagnosticInfoRef
struct LLVMOpaqueDiagnosticInfo * LLVMDiagnosticInfoRef
Definition:Types.h:150
LLVMMemoryBufferRef
struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef
LLVM uses a polymorphic type hierarchy which C cannot represent, therefore parameters must be passed ...
Definition:Types.h:48
LLVMContextRef
struct LLVMOpaqueContext * LLVMContextRef
The top-level container for all LLVM global data.
Definition:Types.h:53
LLVMBuilderRef
struct LLVMOpaqueBuilder * LLVMBuilderRef
Represents an LLVM basic block builder.
Definition:Types.h:110
LLVMUseRef
struct LLVMOpaqueUse * LLVMUseRef
Used to get the users and usees of a Value.
Definition:Types.h:133
LLVMBasicBlockRef
struct LLVMOpaqueBasicBlock * LLVMBasicBlockRef
Represents a basic block of instructions in LLVM IR.
Definition:Types.h:82
LLVMTypeRef
struct LLVMOpaqueType * LLVMTypeRef
Each value in the LLVM IR has a type, an LLVMTypeRef.
Definition:Types.h:68
LLVMMetadataRef
struct LLVMOpaqueMetadata * LLVMMetadataRef
Represents an LLVM Metadata.
Definition:Types.h:89
LLVMModuleRef
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
Definition:Types.h:61
LLVMModuleProviderRef
struct LLVMOpaqueModuleProvider * LLVMModuleProviderRef
Interface used to provide a module to JIT or interpreter.
Definition:Types.h:124
LLVMOperandBundleRef
struct LLVMOpaqueOperandBundle * LLVMOperandBundleRef
Definition:Types.h:138
LLVMAliasSetAliasee
void LLVMAliasSetAliasee(LLVMValueRef Alias, LLVMValueRef Aliasee)
Set the target value of an alias.
Definition:Core.cpp:2385
LLVMGetLastGlobalAlias
LLVMValueRef LLVMGetLastGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the last GlobalAlias in a Module.
Definition:Core.cpp:2357
LLVMGetNextGlobalAlias
LLVMValueRef LLVMGetNextGlobalAlias(LLVMValueRef GA)
Advance a GlobalAlias iterator to the next GlobalAlias.
Definition:Core.cpp:2365
LLVMAliasGetAliasee
LLVMValueRef LLVMAliasGetAliasee(LLVMValueRef Alias)
Retrieve the target value of an alias.
Definition:Core.cpp:2381
LLVMGetPreviousGlobalAlias
LLVMValueRef LLVMGetPreviousGlobalAlias(LLVMValueRef GA)
Decrement a GlobalAlias iterator to the previous GlobalAlias.
Definition:Core.cpp:2373
LLVMAddAlias2
LLVMValueRef LLVMAddAlias2(LLVMModuleRef M, LLVMTypeRef ValueTy, unsigned AddrSpace, LLVMValueRef Aliasee, const char *Name)
Add a GlobalAlias with the given value type, address space and aliasee.
Definition:Core.cpp:2336
LLVMGetFirstGlobalAlias
LLVMValueRef LLVMGetFirstGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the first GlobalAlias in a Module.
Definition:Core.cpp:2349
LLVMGetNamedGlobalAlias
LLVMValueRef LLVMGetNamedGlobalAlias(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalAlias value from a Module by its name.
Definition:Core.cpp:2344
LLVMSetGlobalConstant
void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant)
Definition:Core.cpp:2283
LLVMSetThreadLocalMode
void LLVMSetThreadLocalMode(LLVMValueRef GlobalVar, LLVMThreadLocalMode Mode)
Definition:Core.cpp:2304
LLVMGetThreadLocalMode
LLVMThreadLocalMode LLVMGetThreadLocalMode(LLVMValueRef GlobalVar)
Definition:Core.cpp:2287
LLVMGetNamedGlobalWithLength
LLVMValueRef LLVMGetNamedGlobalWithLength(LLVMModuleRef M, const char *Name, size_t Length)
Definition:Core.cpp:2218
LLVMGetFirstGlobal
LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M)
Definition:Core.cpp:2223
LLVMGetNextGlobal
LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar)
Definition:Core.cpp:2239
LLVMIsExternallyInitialized
LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar)
Definition:Core.cpp:2326
LLVMAddGlobal
LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name)
Definition:Core.cpp:2200
LLVMGetLastGlobal
LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M)
Definition:Core.cpp:2231
LLVMSetExternallyInitialized
void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit)
Definition:Core.cpp:2330
LLVMGetPreviousGlobal
LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar)
Definition:Core.cpp:2247
LLVMSetThreadLocal
void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal)
Definition:Core.cpp:2275
LLVMGetInitializer
LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar)
Definition:Core.cpp:2259
LLVMDeleteGlobal
void LLVMDeleteGlobal(LLVMValueRef GlobalVar)
Definition:Core.cpp:2255
LLVMIsThreadLocal
LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar)
Definition:Core.cpp:2271
LLVMIsGlobalConstant
LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar)
Definition:Core.cpp:2279
LLVMAddGlobalInAddressSpace
LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name, unsigned AddressSpace)
Definition:Core.cpp:2205
LLVMSetInitializer
void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal)
Definition:Core.cpp:2266
LLVMGetNamedGlobal
LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name)
Definition:Core.cpp:2214
Core.h
ErrorHandling.h
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition:ErrorHandling.h:143
llvm::CallingConv::C
@ C
The default llvm calling convention, compatible with C.
Definition:CallingConv.h:34
llvm::Intrinsic::getOrInsertDeclaration
Function * getOrInsertDeclaration(Module *M, ID id, ArrayRef< Type * > Tys={})
Look up the Function declaration of the intrinsic id in the Module M.
Definition:Intrinsics.cpp:732
llvm::Intrinsic::getNameNoUnnamedTypes
std::string getNameNoUnnamedTypes(ID Id, ArrayRef< Type * > Tys)
Return the LLVM name for an intrinsic.
Definition:Intrinsics.cpp:185
llvm::Intrinsic::getName
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
Definition:Intrinsics.cpp:47
llvm::Intrinsic::ID
unsigned ID
Definition:GenericSSAContext.h:28
llvm::Intrinsic::lookupIntrinsicID
ID lookupIntrinsicID(StringRef Name)
This does the actual lookup of an intrinsic ID which matches the given function name.
Definition:Intrinsics.cpp:707
llvm::Intrinsic::isOverloaded
bool isOverloaded(ID id)
Returns true if the intrinsic can be overloaded.
Definition:Intrinsics.cpp:607
llvm::Intrinsic::getType
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys={})
Return the function type for an intrinsic.
Definition:Intrinsics.cpp:585
llvm::NVPTXAS::AddressSpace
AddressSpace
Definition:NVPTXAddrSpace.h:20
llvm::SyncScope::SingleThread
@ SingleThread
Synchronized with respect to signal handlers executing in the same thread.
Definition:LLVMContext.h:54
llvm::SyncScope::System
@ System
Synchronized with respect to all concurrently executing threads.
Definition:LLVMContext.h:57
llvm::sys::fs::OF_TextWithCRLF
@ OF_TextWithCRLF
The file should be opened in text mode and use a carriage linefeed '\r '.
Definition:FileSystem.h:763
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::Length
@ Length
Definition:DWP.cpp:480
llvm::llvm_is_multithreaded
constexpr bool llvm_is_multithreaded()
Returns true if LLVM is compiled with support for multi-threading, and false otherwise.
Definition:Threading.h:52
llvm::initializeSafepointIRVerifierPass
void initializeSafepointIRVerifierPass(PassRegistry &)
llvm::PseudoProbeType::Block
@ Block
llvm::PointerTy
void * PointerTy
Definition:GenericValue.h:21
llvm::initializeVerifierLegacyPassPass
void initializeVerifierLegacyPassPass(PassRegistry &)
llvm::setAtomicSyncScopeID
void setAtomicSyncScopeID(Instruction *I, SyncScope::ID SSID)
A helper function that sets an atomic operation's sync scope.
Definition:Instructions.h:5066
llvm::OperandBundleDef
OperandBundleDefT< Value * > OperandBundleDef
Definition:AutoUpgrade.h:33
llvm::AtomicOrderingCABI::release
@ release
llvm::get
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
Definition:PointerIntPair.h:270
llvm::getAtomicSyncScopeID
std::optional< SyncScope::ID > getAtomicSyncScopeID(const Instruction *I)
A helper function that returns an atomic operation's sync scope; returns std::nullopt if it is not an...
Definition:Instructions.h:5049
llvm::initializeCore
void initializeCore(PassRegistry &)
Initialize all passes linked into the Core library.
Definition:Core.cpp:59
llvm::safe_malloc
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc(size_t Sz)
Definition:MemAlloc.h:25
llvm::PoisonMaskElem
constexpr int PoisonMaskElem
Definition:Instructions.h:1889
llvm::errs
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Definition:raw_ostream.cpp:907
llvm::AsanDtorKind::Global
@ Global
Append to llvm.global_dtors.
llvm::AtomicOrdering
AtomicOrdering
Atomic ordering for LLVM's memory model.
Definition:AtomicOrdering.h:56
llvm::divideCeil
constexpr T divideCeil(U Numerator, V Denominator)
Returns the integer ceil(Numerator / Denominator).
Definition:MathExtras.h:404
llvm::ClrHandlerType::Catch
@ Catch
llvm::initializeDominatorTreeWrapperPassPass
void initializeDominatorTreeWrapperPassPass(PassRegistry &)
llvm::initializePrintModulePassWrapperPass
void initializePrintModulePassWrapperPass(PassRegistry &)
llvm::DS_Remark
@ DS_Remark
Definition:DiagnosticInfo.h:52
llvm::DS_Warning
@ DS_Warning
Definition:DiagnosticInfo.h:51
llvm::DS_Note
@ DS_Note
Definition:DiagnosticInfo.h:55
llvm::llvm_shutdown
void llvm_shutdown()
llvm_shutdown - Deallocate and destroy all ManagedStatic variables.
Definition:ManagedStatic.cpp:75
llvm::wrap
LLVMAttributeRef wrap(Attribute Attr)
Definition:Attributes.h:330
llvm::initializePrintFunctionPassWrapperPass
void initializePrintFunctionPassWrapperPass(PassRegistry &)
raw_ostream.h
N
#define N
LLVMOpaqueModuleFlagEntry
Definition:Core.cpp:332
LLVMOpaqueModuleFlagEntry::Behavior
LLVMModuleFlagBehavior Behavior
Definition:Core.cpp:333
LLVMOpaqueModuleFlagEntry::Key
const char * Key
Definition:Core.cpp:334
LLVMOpaqueModuleFlagEntry::Metadata
LLVMMetadataRef Metadata
Definition:Core.cpp:336
LLVMOpaqueModuleFlagEntry::KeyLen
size_t KeyLen
Definition:Core.cpp:335
LLVMOpaqueValueMetadataEntry
Definition:Core.cpp:1109
LLVMOpaqueValueMetadataEntry::Kind
unsigned Kind
Definition:Core.cpp:1110
LLVMOpaqueValueMetadataEntry::Metadata
LLVMMetadataRef Metadata
Definition:Core.cpp:1111
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition:Alignment.h:39
llvm::DiagnosticHandler::DiagnosticHandlerTy
void(*)(const DiagnosticInfo *DI, void *Context) DiagnosticHandlerTy
Definition:DiagnosticHandler.h:31
llvm::MaybeAlign
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition:Alignment.h:117

Generated on Thu Jul 17 2025 12:28:10 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp