LLVM 24.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"
19#include "llvm/IR/Constants.h"
25#include "llvm/IR/GlobalAlias.h"
27#include "llvm/IR/IRBuilder.h"
28#include "llvm/IR/InlineAsm.h"
31#include "llvm/IR/LLVMContext.h"
33#include "llvm/IR/Module.h"
35#include "llvm/PassRegistry.h"
36#include "llvm/Support/Debug.h"
44#include <cassert>
45#include <cstdlib>
46#include <cstring>
47#include <system_error>
48
49using namespace llvm;
50
52
54 return reinterpret_cast<BasicBlock **>(BBs);
55}
56
57#define DEBUG_TYPE "ir"
58
66
69}
70
71/*===-- Version query -----------------------------------------------------===*/
72
73void LLVMGetVersion(unsigned *Major, unsigned *Minor, unsigned *Patch) {
74 if (Major)
75 *Major = LLVM_VERSION_MAJOR;
76 if (Minor)
77 *Minor = LLVM_VERSION_MINOR;
78 if (Patch)
79 *Patch = LLVM_VERSION_PATCH;
80}
81
82/*===-- Error handling ----------------------------------------------------===*/
83
84char *LLVMCreateMessage(const char *Message) {
85 return strdup(Message);
86}
87
88void LLVMDisposeMessage(char *Message) {
89 free(Message);
90}
91
92
93/*===-- Operations on contexts --------------------------------------------===*/
94
96 static LLVMContext GlobalContext;
97 return GlobalContext;
98}
99
103
107
109
111 LLVMDiagnosticHandler Handler,
112 void *DiagnosticContext) {
113 unwrap(C)->setDiagnosticHandlerCallBack(
115 Handler),
116 DiagnosticContext);
117}
118
120 return LLVM_EXTENSION reinterpret_cast<LLVMDiagnosticHandler>(
121 unwrap(C)->getDiagnosticHandlerCallBack());
122}
123
125 return unwrap(C)->getDiagnosticContext();
126}
127
129 void *OpaqueHandle) {
130 auto YieldCallback =
131 LLVM_EXTENSION reinterpret_cast<LLVMContext::YieldCallbackTy>(Callback);
132 unwrap(C)->setYieldCallback(YieldCallback, OpaqueHandle);
133}
134
136 return unwrap(C)->shouldDiscardValueNames();
137}
138
140 unwrap(C)->setDiscardValueNames(Discard);
141}
142
144 delete unwrap(C);
145}
146
147unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char *Name,
148 unsigned SLen) {
149 return unwrap(C)->getMDKindID(StringRef(Name, SLen));
150}
151
152unsigned LLVMGetMDKindID(const char *Name, unsigned SLen) {
154}
155
156unsigned LLVMGetSyncScopeID(LLVMContextRef C, const char *Name, size_t SLen) {
157 return unwrap(C)->getOrInsertSyncScopeID(StringRef(Name, SLen));
158}
159
160unsigned LLVMGetEnumAttributeKindForName(const char *Name, size_t SLen) {
161 return Attribute::getAttrKindFromName(StringRef(Name, SLen));
162}
163
167
169 uint64_t Val) {
170 auto &Ctx = *unwrap(C);
171 auto AttrKind = (Attribute::AttrKind)KindID;
172 return wrap(Attribute::get(Ctx, AttrKind, Val));
173}
174
178
180 auto Attr = unwrap(A);
181 if (Attr.isEnumAttribute())
182 return 0;
183 return Attr.getValueAsInt();
184}
185
187 LLVMTypeRef type_ref) {
188 auto &Ctx = *unwrap(C);
189 auto AttrKind = (Attribute::AttrKind)KindID;
190 return wrap(Attribute::get(Ctx, AttrKind, unwrap(type_ref)));
191}
192
194 auto Attr = unwrap(A);
195 return wrap(Attr.getValueAsType());
196}
197
199 unsigned KindID,
200 unsigned NumBits,
201 const uint64_t LowerWords[],
202 const uint64_t UpperWords[]) {
203 auto &Ctx = *unwrap(C);
204 auto AttrKind = (Attribute::AttrKind)KindID;
205 unsigned NumWords = divideCeil(NumBits, 64);
206 return wrap(Attribute::get(
207 Ctx, AttrKind,
208 ConstantRange(APInt(NumBits, ArrayRef(LowerWords, NumWords)),
209 APInt(NumBits, ArrayRef(UpperWords, NumWords)))));
210}
211
213 LLVMContextRef C, LLVMDenormalModeKind DefaultModeOutput,
214 LLVMDenormalModeKind DefaultModeInput, LLVMDenormalModeKind FloatModeOutput,
215 LLVMDenormalModeKind FloatModeInput) {
216 auto &Ctx = *unwrap(C);
217
218 DenormalFPEnv Env(
220 static_cast<DenormalMode::DenormalModeKind>(DefaultModeOutput),
221 static_cast<DenormalMode::DenormalModeKind>(DefaultModeInput)),
223 static_cast<DenormalMode::DenormalModeKind>(FloatModeOutput),
224 static_cast<DenormalMode::DenormalModeKind>(FloatModeInput)));
225 return wrap(Attribute::get(Ctx, Attribute::DenormalFPEnv, Env.toIntValue()));
226}
227
229 const char *K, unsigned KLength,
230 const char *V, unsigned VLength) {
231 return wrap(Attribute::get(*unwrap(C), StringRef(K, KLength),
232 StringRef(V, VLength)));
233}
234
236 unsigned *Length) {
237 auto S = unwrap(A).getKindAsString();
238 *Length = S.size();
239 return S.data();
240}
241
243 unsigned *Length) {
244 auto S = unwrap(A).getValueAsString();
245 *Length = S.size();
246 return S.data();
247}
248
250 auto Attr = unwrap(A);
251 return Attr.isEnumAttribute() || Attr.isIntAttribute();
252}
253
257
261
263 std::string MsgStorage;
264 raw_string_ostream Stream(MsgStorage);
266
267 unwrap(DI)->print(DP);
268
269 return LLVMCreateMessage(MsgStorage.c_str());
270}
271
273 LLVMDiagnosticSeverity severity;
274
275 switch(unwrap(DI)->getSeverity()) {
276 default:
277 severity = LLVMDSError;
278 break;
279 case DS_Warning:
280 severity = LLVMDSWarning;
281 break;
282 case DS_Remark:
283 severity = LLVMDSRemark;
284 break;
285 case DS_Note:
286 severity = LLVMDSNote;
287 break;
288 }
289
290 return severity;
291}
292
293/*===-- Operations on modules ---------------------------------------------===*/
294
296 return wrap(new Module(ModuleID, getGlobalContext()));
297}
298
301 return wrap(new Module(ModuleID, *unwrap(C)));
302}
303
305 delete unwrap(M);
306}
307
308const char *LLVMGetModuleIdentifier(LLVMModuleRef M, size_t *Len) {
309 auto &Str = unwrap(M)->getModuleIdentifier();
310 *Len = Str.length();
311 return Str.c_str();
312}
313
314void LLVMSetModuleIdentifier(LLVMModuleRef M, const char *Ident, size_t Len) {
315 unwrap(M)->setModuleIdentifier(StringRef(Ident, Len));
316}
317
318const char *LLVMGetSourceFileName(LLVMModuleRef M, size_t *Len) {
319 auto &Str = unwrap(M)->getSourceFileName();
320 *Len = Str.length();
321 return Str.c_str();
322}
323
324void LLVMSetSourceFileName(LLVMModuleRef M, const char *Name, size_t Len) {
325 unwrap(M)->setSourceFileName(StringRef(Name, Len));
326}
327
328/*--.. Data layout .........................................................--*/
330 return unwrap(M)->getDataLayoutStr().c_str();
331}
332
334 return LLVMGetDataLayoutStr(M);
335}
336
337void LLVMSetDataLayout(LLVMModuleRef M, const char *DataLayoutStr) {
338 unwrap(M)->setDataLayout(DataLayoutStr);
339}
340
341/*--.. Target triple .......................................................--*/
343 return unwrap(M)->getTargetTriple().str().c_str();
344}
345
346void LLVMSetTarget(LLVMModuleRef M, const char *TripleStr) {
347 unwrap(M)->setTargetTriple(Triple(TripleStr));
348}
349
350/*--.. Module flags ........................................................--*/
352 LLVMModuleFlagBehavior Behavior;
353 const char *Key;
354 size_t KeyLen;
356};
357
376
396
399 unwrap(M)->getModuleFlagsMetadata(MFEs);
400
402 safe_malloc(MFEs.size() * sizeof(LLVMOpaqueModuleFlagEntry)));
403 for (unsigned i = 0; i < MFEs.size(); ++i) {
404 const auto &ModuleFlag = MFEs[i];
405 Result[i].Behavior = map_from_llvmModFlagBehavior(ModuleFlag.Behavior);
406 Result[i].Key = ModuleFlag.Key->getString().data();
407 Result[i].KeyLen = ModuleFlag.Key->getString().size();
408 Result[i].Metadata = wrap(ModuleFlag.Val);
409 }
410 *Len = MFEs.size();
411 return Result;
412}
413
415 free(Entries);
416}
417
420 unsigned Index) {
422 static_cast<LLVMOpaqueModuleFlagEntry>(Entries[Index]);
423 return MFE.Behavior;
424}
425
427 unsigned Index, size_t *Len) {
429 static_cast<LLVMOpaqueModuleFlagEntry>(Entries[Index]);
430 *Len = MFE.KeyLen;
431 return MFE.Key;
432}
433
435 unsigned Index) {
437 static_cast<LLVMOpaqueModuleFlagEntry>(Entries[Index]);
438 return MFE.Metadata;
439}
440
442 const char *Key, size_t KeyLen) {
443 return wrap(unwrap(M)->getModuleFlag({Key, KeyLen}));
444}
445
447 const char *Key, size_t KeyLen,
448 LLVMMetadataRef Val) {
449 unwrap(M)->addModuleFlag(map_to_llvmModFlagBehavior(Behavior),
450 {Key, KeyLen}, unwrap(Val));
451}
452
454
456 if (!UseNewFormat)
457 llvm_unreachable("LLVM no longer supports intrinsic based debug-info");
458 (void)M;
459}
460
461/*--.. Printing modules ....................................................--*/
462
464 unwrap(M)->print(errs(), nullptr,
465 /*ShouldPreserveUseListOrder=*/false, /*IsForDebug=*/true);
466}
467
469 char **ErrorMessage) {
470 std::error_code EC;
472 if (EC) {
473 *ErrorMessage = strdup(EC.message().c_str());
474 return true;
475 }
476
477 unwrap(M)->renumberMetadataForAssembly();
478 unwrap(M)->print(dest, nullptr);
479
480 dest.close();
481
482 if (dest.has_error()) {
483 std::string E = "Error printing to file: " + dest.error().message();
484 *ErrorMessage = strdup(E.c_str());
485 return true;
486 }
487
488 return false;
489}
490
492 std::string buf;
493 raw_string_ostream os(buf);
494
495 unwrap(M)->renumberMetadataForAssembly();
496 unwrap(M)->print(os, nullptr);
497
498 return strdup(buf.c_str());
499}
500
501/*--.. Operations on inline assembler ......................................--*/
502void LLVMSetModuleInlineAsm2(LLVMModuleRef M, const char *Asm, size_t Len) {
503 unwrap(M)->setModuleInlineAsm(StringRef(Asm, Len));
504}
505
506void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm) {
507 unwrap(M)->setModuleInlineAsm(StringRef(Asm));
508}
509
510void LLVMAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm, size_t Len) {
511 unwrap(M)->appendModuleInlineAsm(StringRef(Asm, Len));
512}
513
514const char *LLVMGetModuleInlineAsm(LLVMModuleRef M, size_t *Len) {
515 Module *Mod = unwrap(M);
516 ArrayRef<Module::GlobalAsmFragment> Frags = Mod->getModuleInlineAsm();
517 if (Frags.empty()) {
518 *Len = 0;
519 return nullptr;
520 }
521
522 if (Frags.size() != 1)
523 reportFatalUsageError("LLVMGetModuleInlineAsm is not supported if there is "
524 "more than one module inline assembly fragment");
525
526 auto &Str = Frags.begin()->Asm;
527 *Len = Str.length();
528 return Str.c_str();
529}
530
531LLVMValueRef LLVMGetInlineAsm(LLVMTypeRef Ty, const char *AsmString,
532 size_t AsmStringSize, const char *Constraints,
533 size_t ConstraintsSize, LLVMBool HasSideEffects,
534 LLVMBool IsAlignStack,
535 LLVMInlineAsmDialect Dialect, LLVMBool CanThrow) {
537 switch (Dialect) {
540 break;
543 break;
544 }
546 StringRef(AsmString, AsmStringSize),
547 StringRef(Constraints, ConstraintsSize),
548 HasSideEffects, IsAlignStack, AD, CanThrow));
549}
550
551const char *LLVMGetInlineAsmAsmString(LLVMValueRef InlineAsmVal, size_t *Len) {
552
553 Value *Val = unwrap<Value>(InlineAsmVal);
554 StringRef AsmString = cast<InlineAsm>(Val)->getAsmString();
555
556 *Len = AsmString.size();
557 return AsmString.data();
558}
559
561 size_t *Len) {
562 Value *Val = unwrap<Value>(InlineAsmVal);
563 StringRef ConstraintString = cast<InlineAsm>(Val)->getConstraintString();
564
565 *Len = ConstraintString.size();
566 return ConstraintString.data();
567}
568
570
571 Value *Val = unwrap<Value>(InlineAsmVal);
572 InlineAsm::AsmDialect Dialect = cast<InlineAsm>(Val)->getDialect();
573
574 switch (Dialect) {
579 }
580
581 llvm_unreachable("Unrecognized inline assembly dialect");
583}
584
586 Value *Val = unwrap<Value>(InlineAsmVal);
587 return (LLVMTypeRef)cast<InlineAsm>(Val)->getFunctionType();
588}
589
591 Value *Val = unwrap<Value>(InlineAsmVal);
592 return cast<InlineAsm>(Val)->hasSideEffects();
593}
594
596 Value *Val = unwrap<Value>(InlineAsmVal);
597 return cast<InlineAsm>(Val)->isAlignStack();
598}
599
601 Value *Val = unwrap<Value>(InlineAsmVal);
602 return cast<InlineAsm>(Val)->canThrow();
603}
604
605/*--.. Operations on module contexts ......................................--*/
609
610
611/*===-- Operations on types -----------------------------------------------===*/
612
613/*--.. Operations on all types (mostly) ....................................--*/
614
616 switch (unwrap(Ty)->getTypeID()) {
617 case Type::VoidTyID:
618 return LLVMVoidTypeKind;
619 case Type::HalfTyID:
620 return LLVMHalfTypeKind;
621 case Type::BFloatTyID:
622 return LLVMBFloatTypeKind;
623 case Type::FloatTyID:
624 return LLVMFloatTypeKind;
625 case Type::DoubleTyID:
626 return LLVMDoubleTypeKind;
629 case Type::FP128TyID:
630 return LLVMFP128TypeKind;
633 case Type::LabelTyID:
634 return LLVMLabelTypeKind;
637 case Type::ByteTyID:
638 return LLVMByteTypeKind;
640 return LLVMIntegerTypeKind;
643 case Type::StructTyID:
644 return LLVMStructTypeKind;
645 case Type::ArrayTyID:
646 return LLVMArrayTypeKind;
648 return LLVMPointerTypeKind;
650 return LLVMVectorTypeKind;
652 return LLVMX86_AMXTypeKind;
653 case Type::TokenTyID:
654 return LLVMTokenTypeKind;
660 llvm_unreachable("Typed pointers are unsupported via the C API");
661 }
662 llvm_unreachable("Unhandled TypeID.");
663}
664
666{
667 return unwrap(Ty)->isSized();
668}
669
673
675 return unwrap(Ty)->print(errs(), /*IsForDebug=*/true);
676}
677
679 std::string buf;
680 raw_string_ostream os(buf);
681
682 if (unwrap(Ty))
683 unwrap(Ty)->print(os);
684 else
685 os << "Printing <null> Type";
686
687 return strdup(buf.c_str());
688}
689
690/*--.. Operations on byte types ............................................--*/
691
693 return wrap(ByteType::get(*unwrap(C), NumBits));
694}
695
697 return unwrap<ByteType>(ByteTy)->getBitWidth();
698}
699
700/*--.. Operations on integer types .........................................--*/
701
721 return wrap(IntegerType::get(*unwrap(C), NumBits));
722}
723
742LLVMTypeRef LLVMIntType(unsigned NumBits) {
744}
745
746unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy) {
747 return unwrap<IntegerType>(IntegerTy)->getBitWidth();
748}
749
750/*--.. Operations on real types ............................................--*/
751
776
801
802/*--.. Operations on function types ........................................--*/
803
805 LLVMTypeRef *ParamTypes, unsigned ParamCount,
806 LLVMBool IsVarArg) {
807 ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
808 return wrap(FunctionType::get(unwrap(ReturnType), Tys, IsVarArg != 0));
809}
810
812 return unwrap<FunctionType>(FunctionTy)->isVarArg();
813}
814
816 return wrap(unwrap<FunctionType>(FunctionTy)->getReturnType());
817}
818
819unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy) {
820 return unwrap<FunctionType>(FunctionTy)->getNumParams();
821}
822
824 FunctionType *Ty = unwrap<FunctionType>(FunctionTy);
825 for (Type *T : Ty->params())
826 *Dest++ = wrap(T);
827}
828
829/*--.. Operations on struct types ..........................................--*/
830
832 unsigned ElementCount, LLVMBool Packed) {
833 ArrayRef<Type*> Tys(unwrap(ElementTypes), ElementCount);
834 return wrap(StructType::get(*unwrap(C), Tys, Packed != 0));
835}
836
838 unsigned ElementCount, LLVMBool Packed) {
840 ElementCount, Packed);
841}
842
844{
845 return wrap(StructType::create(*unwrap(C), Name));
846}
847
849{
851 if (!Type->hasName())
852 return nullptr;
853 return Type->getName().data();
854}
855
856void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes,
857 unsigned ElementCount, LLVMBool Packed) {
858 ArrayRef<Type*> Tys(unwrap(ElementTypes), ElementCount);
859 unwrap<StructType>(StructTy)->setBody(Tys, Packed != 0);
860}
861
863 return unwrap<StructType>(StructTy)->getNumElements();
864}
865
867 StructType *Ty = unwrap<StructType>(StructTy);
868 for (Type *T : Ty->elements())
869 *Dest++ = wrap(T);
870}
871
873 StructType *Ty = unwrap<StructType>(StructTy);
874 return wrap(Ty->getTypeAtIndex(i));
875}
876
878 return unwrap<StructType>(StructTy)->isPacked();
879}
880
882 return unwrap<StructType>(StructTy)->isOpaque();
883}
884
886 return unwrap<StructType>(StructTy)->isLiteral();
887}
888
890 return wrap(StructType::getTypeByName(unwrap(M)->getContext(), Name));
891}
892
894 return wrap(StructType::getTypeByName(*unwrap(C), Name));
895}
896
897/*--.. Operations on array, pointer, and vector types (sequence types) .....--*/
898
900 int i = 0;
901 for (auto *T : unwrap(Tp)->subtypes()) {
902 Arr[i] = wrap(T);
903 i++;
904 }
905}
906
908 return wrap(ArrayType::get(unwrap(ElementType), ElementCount));
909}
910
914
916 return wrap(
918}
919
921 return true;
922}
923
925 return wrap(FixedVectorType::get(unwrap(ElementType), ElementCount));
926}
927
929 unsigned ElementCount) {
930 return wrap(ScalableVectorType::get(unwrap(ElementType), ElementCount));
931}
932
934 auto *Ty = unwrap(WrappedTy);
935 if (auto *ATy = dyn_cast<ArrayType>(Ty))
936 return wrap(ATy->getElementType());
937 return wrap(cast<VectorType>(Ty)->getElementType());
938}
939
941 return unwrap(Tp)->getNumContainedTypes();
942}
943
945 return unwrap<ArrayType>(ArrayTy)->getNumElements();
946}
947
949 return unwrap<ArrayType>(ArrayTy)->getNumElements();
950}
951
953 return unwrap<PointerType>(PointerTy)->getAddressSpace();
954}
955
956unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy) {
957 return unwrap<VectorType>(VectorTy)->getElementCount().getKnownMinValue();
958}
959
963
967
969 return wrap(unwrap<ConstantPtrAuth>(PtrAuth)->getDiscriminator());
970}
971
973 return wrap(unwrap<ConstantPtrAuth>(PtrAuth)->getAddrDiscriminator());
974}
975
976/*--.. Operations on other types ...........................................--*/
977
981
994
1001
1003 LLVMTypeRef *TypeParams,
1004 unsigned TypeParamCount,
1005 unsigned *IntParams,
1006 unsigned IntParamCount) {
1007 ArrayRef<Type *> TypeParamArray(unwrap(TypeParams), TypeParamCount);
1008 ArrayRef<unsigned> IntParamArray(IntParams, IntParamCount);
1009 return wrap(
1010 TargetExtType::get(*unwrap(C), Name, TypeParamArray, IntParamArray));
1011}
1012
1013const char *LLVMGetTargetExtTypeName(LLVMTypeRef TargetExtTy) {
1015 return Type->getName().data();
1016}
1017
1020 return Type->getNumTypeParameters();
1021}
1022
1024 unsigned Idx) {
1026 return wrap(Type->getTypeParameter(Idx));
1027}
1028
1031 return Type->getNumIntParameters();
1032}
1033
1034unsigned LLVMGetTargetExtTypeIntParam(LLVMTypeRef TargetExtTy, unsigned Idx) {
1036 return Type->getIntParameter(Idx);
1037}
1038
1039/*===-- Operations on values ----------------------------------------------===*/
1040
1041/*--.. Operations on all values ............................................--*/
1042
1044 return wrap(unwrap(Val)->getType());
1045}
1046
1048 switch(unwrap(Val)->getValueID()) {
1049#define LLVM_C_API 1
1050#define HANDLE_VALUE(Name) \
1051 case Value::Name##Val: \
1052 return LLVM##Name##ValueKind;
1053#include "llvm/IR/Value.def"
1054 default:
1056 }
1057}
1058
1059const char *LLVMGetValueName2(LLVMValueRef Val, size_t *Length) {
1060 auto *V = unwrap(Val);
1061 *Length = V->getName().size();
1062 return V->getName().data();
1063}
1064
1065void LLVMSetValueName2(LLVMValueRef Val, const char *Name, size_t NameLen) {
1066 unwrap(Val)->setName(StringRef(Name, NameLen));
1067}
1068
1070 return unwrap(Val)->getName().data();
1071}
1072
1073void LLVMSetValueName(LLVMValueRef Val, const char *Name) {
1074 unwrap(Val)->setName(Name);
1075}
1076
1078 unwrap(Val)->print(errs(), /*IsForDebug=*/true);
1079}
1080
1082 std::string buf;
1083 raw_string_ostream os(buf);
1084
1085 if (unwrap(Val))
1086 unwrap(Val)->print(os);
1087 else
1088 os << "Printing <null> Value";
1089
1090 return strdup(buf.c_str());
1091}
1092
1096
1098 std::string buf;
1099 raw_string_ostream os(buf);
1100
1101 if (unwrap(Record))
1102 unwrap(Record)->print(os);
1103 else
1104 os << "Printing <null> DbgRecord";
1105
1106 return strdup(buf.c_str());
1107}
1108
1110 unwrap(OldVal)->replaceAllUsesWith(unwrap(NewVal));
1111}
1112
1114 return unwrap<Instruction>(Inst)->hasMetadata();
1115}
1116
1118 auto *I = unwrap<Instruction>(Inst);
1119 assert(I && "Expected instruction");
1120 if (auto *MD = I->getMetadata(KindID))
1121 return wrap(MetadataAsValue::get(I->getContext(), MD));
1122 return nullptr;
1123}
1124
1125// MetadataAsValue uses a canonical format which strips the actual MDNode for
1126// MDNode with just a single constant value, storing just a ConstantAsMetadata
1127// This undoes this canonicalization, reconstructing the MDNode.
1129 Metadata *MD = MAV->getMetadata();
1131 "Expected a metadata node or a canonicalized constant");
1132
1133 if (MDNode *N = dyn_cast<MDNode>(MD))
1134 return N;
1135
1136 return MDNode::get(MAV->getContext(), MD);
1137}
1138
1139void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef Val) {
1140 MDNode *N = Val ? extractMDNode(unwrap<MetadataAsValue>(Val)) : nullptr;
1141
1142 unwrap<Instruction>(Inst)->setMetadata(KindID, N);
1143}
1144
1149
1152llvm_getMetadata(size_t *NumEntries,
1153 llvm::function_ref<void(MetadataEntries &)> AccessMD) {
1155 AccessMD(MVEs);
1156
1158 static_cast<LLVMOpaqueValueMetadataEntry *>(
1160 for (unsigned i = 0; i < MVEs.size(); ++i) {
1161 const auto &ModuleFlag = MVEs[i];
1162 Result[i].Kind = ModuleFlag.first;
1163 Result[i].Metadata = wrap(ModuleFlag.second);
1164 }
1165 *NumEntries = MVEs.size();
1166 return Result;
1167}
1168
1171 size_t *NumEntries) {
1172 return llvm_getMetadata(NumEntries, [&Value](MetadataEntries &Entries) {
1173 Entries.clear();
1174 unwrap<Instruction>(Value)->getAllMetadata(Entries);
1175 });
1176}
1177
1178/*--.. Conversion functions ................................................--*/
1179
1180#define LLVM_DEFINE_VALUE_CAST(name) \
1181 LLVMValueRef LLVMIsA##name(LLVMValueRef Val) { \
1182 return wrap(static_cast<Value*>(dyn_cast_or_null<name>(unwrap(Val)))); \
1183 }
1184
1186
1188 if (Value *V = unwrap(Val))
1189 return isa<UncondBrInst, CondBrInst>(V) ? Val : nullptr;
1190 return nullptr;
1191}
1192
1194 if (auto *MD = dyn_cast_or_null<MetadataAsValue>(unwrap(Val)))
1195 if (isa<MDNode>(MD->getMetadata()) ||
1196 isa<ValueAsMetadata>(MD->getMetadata()))
1197 return Val;
1198 return nullptr;
1199}
1200
1202 if (auto *MD = dyn_cast_or_null<MetadataAsValue>(unwrap(Val)))
1203 if (isa<ValueAsMetadata>(MD->getMetadata()))
1204 return Val;
1205 return nullptr;
1206}
1207
1209 if (auto *MD = dyn_cast_or_null<MetadataAsValue>(unwrap(Val)))
1210 if (isa<MDString>(MD->getMetadata()))
1211 return Val;
1212 return nullptr;
1213}
1214
1215/*--.. Operations on Uses ..................................................--*/
1217 Value *V = unwrap(Val);
1218 Value::use_iterator I = V->use_begin();
1219 if (I == V->use_end())
1220 return nullptr;
1221 return wrap(&*I);
1222}
1223
1225 Use *Next = unwrap(U)->getNext();
1226 if (Next)
1227 return wrap(Next);
1228 return nullptr;
1229}
1230
1232 return wrap(unwrap(U)->getUser());
1233}
1234
1238
1239/*--.. Operations on Users .................................................--*/
1240
1242 unsigned Index) {
1243 Metadata *Op = N->getOperand(Index);
1244 if (!Op)
1245 return nullptr;
1246 if (auto *C = dyn_cast<ConstantAsMetadata>(Op))
1247 return wrap(C->getValue());
1248 return wrap(MetadataAsValue::get(Context, Op));
1249}
1250
1252 Value *V = unwrap(Val);
1253 if (auto *MD = dyn_cast<MetadataAsValue>(V)) {
1254 if (auto *L = dyn_cast<ValueAsMetadata>(MD->getMetadata())) {
1255 assert(Index == 0 && "Function-local metadata can only have one operand");
1256 return wrap(L->getValue());
1257 }
1258 return getMDNodeOperandImpl(V->getContext(),
1259 cast<MDNode>(MD->getMetadata()), Index);
1260 }
1261
1262 return wrap(cast<User>(V)->getOperand(Index));
1263}
1264
1266 Value *V = unwrap(Val);
1267 return wrap(&cast<User>(V)->getOperandUse(Index));
1268}
1269
1270void LLVMSetOperand(LLVMValueRef Val, unsigned Index, LLVMValueRef Op) {
1271 unwrap<User>(Val)->setOperand(Index, unwrap(Op));
1272}
1273
1275 Value *V = unwrap(Val);
1276 if (isa<MetadataAsValue>(V))
1277 return LLVMGetMDNodeNumOperands(Val);
1278
1279 return cast<User>(V)->getNumOperands();
1280}
1281
1282/*--.. Operations on constants of any type .................................--*/
1283
1287
1291
1295
1299
1303
1305 if (Constant *C = dyn_cast<Constant>(unwrap(Val)))
1306 return C->isNullValue();
1307 return false;
1308}
1309
1313
1317
1321
1322/*--.. Operations on metadata nodes ........................................--*/
1323
1325 size_t SLen) {
1326 return wrap(MDString::get(*unwrap(C), StringRef(Str, SLen)));
1327}
1328
1333
1335 unsigned SLen) {
1336 LLVMContext &Context = *unwrap(C);
1338 Context, MDString::get(Context, StringRef(Str, SLen))));
1339}
1340
1341LLVMValueRef LLVMMDString(const char *Str, unsigned SLen) {
1343}
1344
1346 unsigned Count) {
1347 LLVMContext &Context = *unwrap(C);
1349 for (auto *OV : ArrayRef(Vals, Count)) {
1350 Value *V = unwrap(OV);
1351 Metadata *MD;
1352 if (!V)
1353 MD = nullptr;
1354 else if (auto *C = dyn_cast<Constant>(V))
1356 else if (auto *MDV = dyn_cast<MetadataAsValue>(V)) {
1357 MD = MDV->getMetadata();
1358 assert(!isa<LocalAsMetadata>(MD) && "Unexpected function-local metadata "
1359 "outside of direct argument to call");
1360 } else {
1361 // This is function-local metadata. Pretend to make an MDNode.
1362 assert(Count == 1 &&
1363 "Expected only one operand to function-local metadata");
1364 return wrap(MetadataAsValue::get(Context, LocalAsMetadata::get(V)));
1365 }
1366
1367 MDs.push_back(MD);
1368 }
1369 return wrap(MetadataAsValue::get(Context, MDNode::get(Context, MDs)));
1370}
1371
1375
1379
1381 auto *V = unwrap(Val);
1382 if (auto *C = dyn_cast<Constant>(V))
1384 if (auto *MAV = dyn_cast<MetadataAsValue>(V))
1385 return wrap(MAV->getMetadata());
1386 return wrap(ValueAsMetadata::get(V));
1387}
1388
1389const char *LLVMGetMDString(LLVMValueRef V, unsigned *Length) {
1390 if (const auto *MD = dyn_cast<MetadataAsValue>(unwrap(V)))
1391 if (const MDString *S = dyn_cast<MDString>(MD->getMetadata())) {
1392 *Length = S->getString().size();
1393 return S->getString().data();
1394 }
1395 *Length = 0;
1396 return nullptr;
1397}
1398
1400 auto *MD = unwrap<MetadataAsValue>(V);
1401 if (isa<ValueAsMetadata>(MD->getMetadata()))
1402 return 1;
1403 return cast<MDNode>(MD->getMetadata())->getNumOperands();
1404}
1405
1407 Module *Mod = unwrap(M);
1408 Module::named_metadata_iterator I = Mod->named_metadata_begin();
1409 if (I == Mod->named_metadata_end())
1410 return nullptr;
1411 return wrap(&*I);
1412}
1413
1415 Module *Mod = unwrap(M);
1416 Module::named_metadata_iterator I = Mod->named_metadata_end();
1417 if (I == Mod->named_metadata_begin())
1418 return nullptr;
1419 return wrap(&*--I);
1420}
1421
1423 NamedMDNode *NamedNode = unwrap(NMD);
1425 if (++I == NamedNode->getParent()->named_metadata_end())
1426 return nullptr;
1427 return wrap(&*I);
1428}
1429
1431 NamedMDNode *NamedNode = unwrap(NMD);
1433 if (I == NamedNode->getParent()->named_metadata_begin())
1434 return nullptr;
1435 return wrap(&*--I);
1436}
1437
1439 const char *Name, size_t NameLen) {
1440 return wrap(unwrap(M)->getNamedMetadata(StringRef(Name, NameLen)));
1441}
1442
1444 const char *Name, size_t NameLen) {
1445 return wrap(unwrap(M)->getOrInsertNamedMetadata({Name, NameLen}));
1446}
1447
1448const char *LLVMGetNamedMetadataName(LLVMNamedMDNodeRef NMD, size_t *NameLen) {
1449 NamedMDNode *NamedNode = unwrap(NMD);
1450 *NameLen = NamedNode->getName().size();
1451 return NamedNode->getName().data();
1452}
1453
1455 auto *MD = unwrap<MetadataAsValue>(V);
1456 if (auto *MDV = dyn_cast<ValueAsMetadata>(MD->getMetadata())) {
1457 *Dest = wrap(MDV->getValue());
1458 return;
1459 }
1460 const auto *N = cast<MDNode>(MD->getMetadata());
1461 const unsigned numOperands = N->getNumOperands();
1462 LLVMContext &Context = unwrap(V)->getContext();
1463 for (unsigned i = 0; i < numOperands; i++)
1464 Dest[i] = getMDNodeOperandImpl(Context, N, i);
1465}
1466
1468 LLVMMetadataRef Replacement) {
1469 auto *MD = cast<MetadataAsValue>(unwrap(V));
1470 auto *N = cast<MDNode>(MD->getMetadata());
1471 N->replaceOperandWith(Index, unwrap<Metadata>(Replacement));
1472}
1473
1474unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char *Name) {
1475 if (NamedMDNode *N = unwrap(M)->getNamedMetadata(Name)) {
1476 return N->getNumOperands();
1477 }
1478 return 0;
1479}
1480
1482 LLVMValueRef *Dest) {
1483 NamedMDNode *N = unwrap(M)->getNamedMetadata(Name);
1484 if (!N)
1485 return;
1486 LLVMContext &Context = unwrap(M)->getContext();
1487 for (unsigned i=0;i<N->getNumOperands();i++)
1488 Dest[i] = wrap(MetadataAsValue::get(Context, N->getOperand(i)));
1489}
1490
1492 LLVMValueRef Val) {
1493 NamedMDNode *N = unwrap(M)->getOrInsertNamedMetadata(Name);
1494 if (!N)
1495 return;
1496 if (!Val)
1497 return;
1498 N->addOperand(extractMDNode(unwrap<MetadataAsValue>(Val)));
1499}
1500
1501const char *LLVMGetDebugLocDirectory(LLVMValueRef Val, unsigned *Length) {
1502 if (!Length) return nullptr;
1503 StringRef S;
1504 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1505 if (const auto &DL = I->getDebugLoc()) {
1506 S = DL->getDirectory();
1507 }
1508 } else if (const auto *GV = dyn_cast<GlobalVariable>(unwrap(Val))) {
1510 GV->getDebugInfo(GVEs);
1511 if (GVEs.size())
1512 if (const DIGlobalVariable *DGV = GVEs[0]->getVariable())
1513 S = DGV->getDirectory();
1514 } else if (const auto *F = dyn_cast<Function>(unwrap(Val))) {
1515 if (const DISubprogram *DSP = F->getSubprogram())
1516 S = DSP->getDirectory();
1517 } else {
1518 assert(0 && "Expected Instruction, GlobalVariable or Function");
1519 return nullptr;
1520 }
1521 *Length = S.size();
1522 return S.data();
1523}
1524
1525const char *LLVMGetDebugLocFilename(LLVMValueRef Val, unsigned *Length) {
1526 if (!Length) return nullptr;
1527 StringRef S;
1528 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1529 if (const auto &DL = I->getDebugLoc()) {
1530 S = DL->getFilename();
1531 }
1532 } else if (const auto *GV = dyn_cast<GlobalVariable>(unwrap(Val))) {
1534 GV->getDebugInfo(GVEs);
1535 if (GVEs.size())
1536 if (const DIGlobalVariable *DGV = GVEs[0]->getVariable())
1537 S = DGV->getFilename();
1538 } else if (const auto *F = dyn_cast<Function>(unwrap(Val))) {
1539 if (const DISubprogram *DSP = F->getSubprogram())
1540 S = DSP->getFilename();
1541 } else {
1542 assert(0 && "Expected Instruction, GlobalVariable or Function");
1543 return nullptr;
1544 }
1545 *Length = S.size();
1546 return S.data();
1547}
1548
1550 unsigned L = 0;
1551 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1552 if (const auto &DL = I->getDebugLoc()) {
1553 L = DL->getLine();
1554 }
1555 } else if (const auto *GV = dyn_cast<GlobalVariable>(unwrap(Val))) {
1557 GV->getDebugInfo(GVEs);
1558 if (GVEs.size())
1559 if (const DIGlobalVariable *DGV = GVEs[0]->getVariable())
1560 L = DGV->getLine();
1561 } else if (const auto *F = dyn_cast<Function>(unwrap(Val))) {
1562 if (const DISubprogram *DSP = F->getSubprogram())
1563 L = DSP->getLine();
1564 } else {
1565 assert(0 && "Expected Instruction, GlobalVariable or Function");
1566 return -1;
1567 }
1568 return L;
1569}
1570
1572 unsigned C = 0;
1573 if (const auto *I = dyn_cast<Instruction>(unwrap(Val)))
1574 if (const auto &DL = I->getDebugLoc())
1575 C = DL->getColumn();
1576 return C;
1577}
1578
1579/*--.. Operations on scalar constants ......................................--*/
1580
1581LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N,
1582 LLVMBool SignExtend) {
1583 return wrap(ConstantInt::get(unwrap<IntegerType>(IntTy), N, SignExtend != 0));
1584}
1585
1587 unsigned NumWords,
1588 const uint64_t Words[]) {
1589 IntegerType *Ty = unwrap<IntegerType>(IntTy);
1590 return wrap(ConstantInt::get(
1591 Ty->getContext(), APInt(Ty->getBitWidth(), ArrayRef(Words, NumWords))));
1592}
1593
1595 uint8_t Radix) {
1596 return wrap(ConstantInt::get(unwrap<IntegerType>(IntTy), StringRef(Str),
1597 Radix));
1598}
1599
1601 unsigned SLen, uint8_t Radix) {
1602 return wrap(ConstantInt::get(unwrap<IntegerType>(IntTy), StringRef(Str, SLen),
1603 Radix));
1604}
1605
1606LLVMValueRef LLVMConstByte(LLVMTypeRef ByteTy, unsigned long long N) {
1607 return wrap(ConstantByte::get(unwrap<ByteType>(ByteTy), N));
1608}
1609
1611 unsigned NumWords,
1612 const uint64_t Words[]) {
1613 ByteType *Ty = unwrap<ByteType>(ByteTy);
1614 return wrap(ConstantByte::get(
1615 Ty->getContext(), APInt(Ty->getBitWidth(), ArrayRef(Words, NumWords))));
1616}
1617
1619 uint8_t Radix) {
1620 return wrap(
1621 ConstantByte::get(unwrap<ByteType>(ByteTy), StringRef(Str), Radix));
1622}
1623
1625 size_t SLen, uint8_t Radix) {
1626 return wrap(
1627 ConstantByte::get(unwrap<ByteType>(ByteTy), StringRef(Str, SLen), Radix));
1628}
1629
1631 return wrap(ConstantFP::get(unwrap(RealTy), N));
1632}
1633
1635 return wrap(ConstantFP::get(unwrap(RealTy), StringRef(Text)));
1636}
1637
1639 unsigned SLen) {
1640 return wrap(ConstantFP::get(unwrap(RealTy), StringRef(Str, SLen)));
1641}
1642
1644 Type *T = unwrap(Ty);
1645 unsigned SB = T->getScalarSizeInBits();
1646 APInt AI(SB, ArrayRef<uint64_t>(N, divideCeil(SB, 64)));
1647 APFloat Quad(T->getFltSemantics(), AI);
1648 return wrap(ConstantFP::get(T, Quad));
1649}
1650
1651unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal) {
1652 return unwrap<ConstantInt>(ConstantVal)->getZExtValue();
1653}
1654
1656 return unwrap<ConstantInt>(ConstantVal)->getSExtValue();
1657}
1658
1659unsigned long long LLVMConstByteGetZExtValue(LLVMValueRef ConstantVal) {
1660 return unwrap<ConstantByte>(ConstantVal)->getZExtValue();
1661}
1662
1664 return unwrap<ConstantByte>(ConstantVal)->getSExtValue();
1665}
1666
1667double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *LosesInfo) {
1668 ConstantFP *cFP = unwrap<ConstantFP>(ConstantVal) ;
1669 Type *Ty = cFP->getType();
1670
1671 if (Ty->isHalfTy() || Ty->isBFloatTy() || Ty->isFloatTy() ||
1672 Ty->isDoubleTy()) {
1673 *LosesInfo = false;
1674 return cFP->getValueAPF().convertToDouble();
1675 }
1676
1677 bool APFLosesInfo;
1678 APFloat APF = cFP->getValueAPF();
1680 *LosesInfo = APFLosesInfo;
1681 return APF.convertToDouble();
1682}
1683
1684/*--.. Operations on composite constants ...................................--*/
1685
1687 unsigned Length,
1688 LLVMBool DontNullTerminate) {
1689 /* Inverted the sense of AddNull because ', 0)' is a
1690 better mnemonic for null termination than ', 1)'. */
1692 DontNullTerminate == 0));
1693}
1694
1696 size_t Length,
1697 LLVMBool DontNullTerminate) {
1698 /* Inverted the sense of AddNull because ', 0)' is a
1699 better mnemonic for null termination than ', 1)'. */
1701 DontNullTerminate == 0));
1702}
1703
1704LLVMValueRef LLVMConstString(const char *Str, unsigned Length,
1705 LLVMBool DontNullTerminate) {
1707 DontNullTerminate);
1708}
1709
1711 return wrap(unwrap<Constant>(C)->getAggregateElement(Idx));
1712}
1713
1715 return wrap(unwrap<ConstantDataSequential>(C)->getElementAsConstant(idx));
1716}
1717
1721
1722const char *LLVMGetAsString(LLVMValueRef C, size_t *Length) {
1724 *Length = Str.size();
1725 return Str.data();
1726}
1727
1728const char *LLVMGetRawDataValues(LLVMValueRef C, size_t *SizeInBytes) {
1729 StringRef Str = unwrap<ConstantDataSequential>(C)->getRawDataValues();
1730 *SizeInBytes = Str.size();
1731 return Str.data();
1732}
1733
1735 LLVMValueRef *ConstantVals, unsigned Length) {
1737 return wrap(ConstantArray::get(ArrayType::get(unwrap(ElementTy), Length), V));
1738}
1739
1741 uint64_t Length) {
1743 return wrap(ConstantArray::get(ArrayType::get(unwrap(ElementTy), Length), V));
1744}
1745
1747 size_t SizeInBytes) {
1748 Type *Ty = unwrap(ElementTy);
1749 size_t Len = SizeInBytes / (Ty->getPrimitiveSizeInBits() / 8);
1750 return wrap(ConstantDataArray::getRaw(StringRef(Data, SizeInBytes), Len, Ty));
1751}
1752
1754 LLVMValueRef *ConstantVals,
1755 unsigned Count, LLVMBool Packed) {
1756 Constant **Elements = unwrap<Constant>(ConstantVals, Count);
1757 return wrap(ConstantStruct::getAnon(*unwrap(C), ArrayRef(Elements, Count),
1758 Packed != 0));
1759}
1760
1762 LLVMBool Packed) {
1764 Count, Packed);
1765}
1766
1768 LLVMValueRef *ConstantVals,
1769 unsigned Count) {
1770 Constant **Elements = unwrap<Constant>(ConstantVals, Count);
1771 StructType *Ty = unwrap<StructType>(StructTy);
1772
1773 return wrap(ConstantStruct::get(Ty, ArrayRef(Elements, Count)));
1774}
1775
1776LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size) {
1778 ArrayRef(unwrap<Constant>(ScalarConstantVals, Size), Size)));
1779}
1780
1789
1790/*-- Opcode mapping */
1791
1793{
1794 switch (opcode) {
1795 default: llvm_unreachable("Unhandled Opcode.");
1796#define HANDLE_INST(num, opc, clas) case num: return LLVM##opc;
1797#include "llvm/IR/Instruction.def"
1798#undef HANDLE_INST
1799 }
1800}
1801
1803{
1804 switch (code) {
1805#define HANDLE_INST(num, opc, clas) case LLVM##opc: return num;
1806#include "llvm/IR/Instruction.def"
1807#undef HANDLE_INST
1808 }
1809 llvm_unreachable("Unhandled Opcode.");
1810}
1811
1812/*-- GEP wrap flag conversions */
1813
1815 GEPNoWrapFlags NewGEPFlags;
1816 if ((GEPFlags & LLVMGEPFlagInBounds) != 0)
1817 NewGEPFlags |= GEPNoWrapFlags::inBounds();
1818 if ((GEPFlags & LLVMGEPFlagNUSW) != 0)
1819 NewGEPFlags |= GEPNoWrapFlags::noUnsignedSignedWrap();
1820 if ((GEPFlags & LLVMGEPFlagNUW) != 0)
1821 NewGEPFlags |= GEPNoWrapFlags::noUnsignedWrap();
1822
1823 return NewGEPFlags;
1824}
1825
1827 LLVMGEPNoWrapFlags NewGEPFlags = 0;
1828 if (GEPFlags.isInBounds())
1829 NewGEPFlags |= LLVMGEPFlagInBounds;
1830 if (GEPFlags.hasNoUnsignedSignedWrap())
1831 NewGEPFlags |= LLVMGEPFlagNUSW;
1832 if (GEPFlags.hasNoUnsignedWrap())
1833 NewGEPFlags |= LLVMGEPFlagNUW;
1834
1835 return NewGEPFlags;
1836}
1837
1838/*--.. Constant expressions ................................................--*/
1839
1841 return map_to_llvmopcode(unwrap<ConstantExpr>(ConstantVal)->getOpcode());
1842}
1843
1849
1855
1857 return wrap(ConstantExpr::getNeg(unwrap<Constant>(ConstantVal)));
1858}
1859
1863
1867
1868
1870 return wrap(ConstantExpr::getNot(unwrap<Constant>(ConstantVal)));
1871}
1872
1874 return wrap(ConstantExpr::getAdd(unwrap<Constant>(LHSConstant),
1875 unwrap<Constant>(RHSConstant)));
1876}
1877
1879 LLVMValueRef RHSConstant) {
1880 return wrap(ConstantExpr::getNSWAdd(unwrap<Constant>(LHSConstant),
1881 unwrap<Constant>(RHSConstant)));
1882}
1883
1885 LLVMValueRef RHSConstant) {
1886 return wrap(ConstantExpr::getNUWAdd(unwrap<Constant>(LHSConstant),
1887 unwrap<Constant>(RHSConstant)));
1888}
1889
1891 return wrap(ConstantExpr::getSub(unwrap<Constant>(LHSConstant),
1892 unwrap<Constant>(RHSConstant)));
1893}
1894
1896 LLVMValueRef RHSConstant) {
1897 return wrap(ConstantExpr::getNSWSub(unwrap<Constant>(LHSConstant),
1898 unwrap<Constant>(RHSConstant)));
1899}
1900
1902 LLVMValueRef RHSConstant) {
1903 return wrap(ConstantExpr::getNUWSub(unwrap<Constant>(LHSConstant),
1904 unwrap<Constant>(RHSConstant)));
1905}
1906
1908 return wrap(ConstantExpr::getXor(unwrap<Constant>(LHSConstant),
1909 unwrap<Constant>(RHSConstant)));
1910}
1911
1913 LLVMValueRef *ConstantIndices, unsigned NumIndices) {
1915 ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1916 NumIndices);
1917 Constant *Val = unwrap<Constant>(ConstantVal);
1918 return wrap(ConstantExpr::getGetElementPtr(unwrap(Ty), Val, IdxList));
1920}
1921
1923 LLVMValueRef *ConstantIndices,
1924 unsigned NumIndices) {
1926 ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1927 NumIndices);
1928 Constant *Val = unwrap<Constant>(ConstantVal);
1929 return wrap(ConstantExpr::getInBoundsGetElementPtr(unwrap(Ty), Val, IdxList));
1931}
1932
1934 LLVMValueRef ConstantVal,
1935 LLVMValueRef *ConstantIndices,
1936 unsigned NumIndices,
1937 LLVMGEPNoWrapFlags NoWrapFlags) {
1939 ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1940 NumIndices);
1941 Constant *Val = unwrap<Constant>(ConstantVal);
1943 unwrap(Ty), Val, IdxList, mapFromLLVMGEPNoWrapFlags(NoWrapFlags)));
1945}
1946
1948 LLVMValueRef ConstantOffset,
1949 LLVMGEPNoWrapFlags NoWrapFlags) {
1950 return wrap(ConstantExpr::getPtrAdd(unwrap<Constant>(ConstantVal),
1951 unwrap<Constant>(ConstantOffset),
1952 mapFromLLVMGEPNoWrapFlags(NoWrapFlags)));
1953}
1954
1956 LLVMTypeRef Ty,
1957 LLVMValueRef ConstantVal,
1958 LLVMValueRef *ConstantIndices,
1959 unsigned NumIndices,
1960 LLVMGEPNoWrapFlags NoWrapFlags) {
1961 ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1962 NumIndices);
1964 *unwrap(DataLayout), unwrap(Ty), unwrap<Constant>(ConstantVal), IdxList,
1965 mapFromLLVMGEPNoWrapFlags(NoWrapFlags)));
1966}
1967
1969 return wrap(ConstantExpr::getTrunc(unwrap<Constant>(ConstantVal),
1970 unwrap(ToType)));
1971}
1972
1975 unwrap(ToType)));
1976}
1977
1980 unwrap(ToType)));
1981}
1982
1985 unwrap(ToType)));
1986}
1987
1989 LLVMTypeRef ToType) {
1991 unwrap(ToType)));
1992}
1993
1995 LLVMTypeRef ToType) {
1997 unwrap(ToType)));
1998}
1999
2001 LLVMTypeRef ToType) {
2003 unwrap(ToType)));
2004}
2005
2007 LLVMValueRef IndexConstant) {
2009 unwrap<Constant>(IndexConstant)));
2010}
2011
2013 LLVMValueRef ElementValueConstant,
2014 LLVMValueRef IndexConstant) {
2016 unwrap<Constant>(ElementValueConstant),
2017 unwrap<Constant>(IndexConstant)));
2018}
2019
2021 LLVMValueRef VectorBConstant,
2022 LLVMValueRef MaskConstant) {
2023 SmallVector<int, 16> IntMask;
2026 unwrap<Constant>(VectorBConstant),
2027 IntMask));
2028}
2029
2031 const char *Constraints,
2032 LLVMBool HasSideEffects,
2033 LLVMBool IsAlignStack) {
2034 return wrap(InlineAsm::get(dyn_cast<FunctionType>(unwrap(Ty)), AsmString,
2035 Constraints, HasSideEffects, IsAlignStack));
2036}
2037
2041
2045
2047 return wrap(unwrap<BlockAddress>(BlockAddr)->getBasicBlock());
2048}
2049
2050/*--.. Operations on global variables, functions, and aliases (globals) ....--*/
2051
2055
2059
2088
2091
2092 switch (Linkage) {
2095 break;
2098 break;
2101 break;
2104 break;
2106 LLVM_DEBUG(
2107 errs() << "LLVMSetLinkage(): LLVMLinkOnceODRAutoHideLinkage is no "
2108 "longer supported.");
2109 break;
2110 case LLVMWeakAnyLinkage:
2112 break;
2113 case LLVMWeakODRLinkage:
2115 break;
2118 break;
2121 break;
2122 case LLVMPrivateLinkage:
2124 break;
2127 break;
2130 break;
2132 LLVM_DEBUG(
2133 errs()
2134 << "LLVMSetLinkage(): LLVMDLLImportLinkage is no longer supported.");
2135 break;
2137 LLVM_DEBUG(
2138 errs()
2139 << "LLVMSetLinkage(): LLVMDLLExportLinkage is no longer supported.");
2140 break;
2143 break;
2144 case LLVMGhostLinkage:
2145 LLVM_DEBUG(
2146 errs() << "LLVMSetLinkage(): LLVMGhostLinkage is no longer supported.");
2147 break;
2148 case LLVMCommonLinkage:
2150 break;
2151 }
2152}
2153
2155 // Using .data() is safe because of how GlobalObject::setSection is
2156 // implemented.
2157 return unwrap<GlobalValue>(Global)->getSection().data();
2158}
2159
2160void LLVMSetSection(LLVMValueRef Global, const char *Section) {
2161 unwrap<GlobalObject>(Global)->setSection(Section);
2162}
2163
2165 return static_cast<LLVMVisibility>(
2166 unwrap<GlobalValue>(Global)->getVisibility());
2167}
2168
2171 ->setVisibility(static_cast<GlobalValue::VisibilityTypes>(Viz));
2172}
2173
2175 return static_cast<LLVMDLLStorageClass>(
2176 unwrap<GlobalValue>(Global)->getDLLStorageClass());
2177}
2178
2180 unwrap<GlobalValue>(Global)->setDLLStorageClass(
2181 static_cast<GlobalValue::DLLStorageClassTypes>(Class));
2182}
2183
2195
2208
2212
2214 unwrap<GlobalValue>(Global)->setDSOLocal(IsDSOLocal);
2215}
2216
2218 return unwrap<GlobalValue>(Global)->hasGlobalUnnamedAddr();
2219}
2220
2222 unwrap<GlobalValue>(Global)->setUnnamedAddr(
2223 HasUnnamedAddr ? GlobalValue::UnnamedAddr::Global
2225}
2226
2230
2231/*--.. Operations on global variables, load and store instructions .........--*/
2232
2234 Value *P = unwrap(V);
2236 return GV->getAlign() ? GV->getAlign()->value() : 0;
2238 return F->getAlign() ? F->getAlign()->value() : 0;
2240 return AI->getAlign().value();
2241 if (LoadInst *LI = dyn_cast<LoadInst>(P))
2242 return LI->getAlign().value();
2244 return SI->getAlign().value();
2246 return RMWI->getAlign().value();
2248 return CXI->getAlign().value();
2249
2251 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, "
2252 "and AtomicCmpXchgInst have alignment");
2253}
2254
2255void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes) {
2256 Value *P = unwrap(V);
2258 GV->setAlignment(MaybeAlign(Bytes));
2259 else if (Function *F = dyn_cast<Function>(P))
2260 F->setAlignment(MaybeAlign(Bytes));
2261 else if (AllocaInst *AI = dyn_cast<AllocaInst>(P))
2262 AI->setAlignment(Align(Bytes));
2263 else if (LoadInst *LI = dyn_cast<LoadInst>(P))
2264 LI->setAlignment(Align(Bytes));
2265 else if (StoreInst *SI = dyn_cast<StoreInst>(P))
2266 SI->setAlignment(Align(Bytes));
2267 else if (AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(P))
2268 RMWI->setAlignment(Align(Bytes));
2270 CXI->setAlignment(Align(Bytes));
2271 else
2273 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, and "
2274 "and AtomicCmpXchgInst have alignment");
2275}
2276
2278 size_t *NumEntries) {
2279 return llvm_getMetadata(NumEntries, [&Value](MetadataEntries &Entries) {
2280 Entries.clear();
2282 Instr->getAllMetadata(Entries);
2283 } else {
2284 unwrap<GlobalObject>(Value)->getAllMetadata(Entries);
2285 }
2286 });
2287}
2288
2290 unsigned Index) {
2292 static_cast<LLVMOpaqueValueMetadataEntry>(Entries[Index]);
2293 return MVE.Kind;
2294}
2295
2298 unsigned Index) {
2300 static_cast<LLVMOpaqueValueMetadataEntry>(Entries[Index]);
2301 return MVE.Metadata;
2302}
2303
2305 free(Entries);
2306}
2307
2309 LLVMMetadataRef MD) {
2310 unwrap<GlobalObject>(Global)->setMetadata(Kind, unwrap<MDNode>(MD));
2311}
2312
2314 LLVMMetadataRef MD) {
2315 unwrap<GlobalObject>(Global)->addMetadata(Kind, *unwrap<MDNode>(MD));
2316}
2317
2319 unwrap<GlobalObject>(Global)->eraseMetadata(Kind);
2320}
2321
2325
2330
2331/*--.. Operations on global variables ......................................--*/
2332
2334 return wrap(new GlobalVariable(*unwrap(M), unwrap(Ty), false,
2335 GlobalValue::ExternalLinkage, nullptr, Name));
2336}
2337
2339 const char *Name,
2340 unsigned AddressSpace) {
2341 return wrap(new GlobalVariable(*unwrap(M), unwrap(Ty), false,
2342 GlobalValue::ExternalLinkage, nullptr, Name,
2344 AddressSpace));
2345}
2346
2348 return wrap(unwrap(M)->getNamedGlobal(Name));
2349}
2350
2352 size_t Length) {
2353 return wrap(unwrap(M)->getNamedGlobal(StringRef(Name, Length)));
2354}
2355
2357 Module *Mod = unwrap(M);
2358 Module::global_iterator I = Mod->global_begin();
2359 if (I == Mod->global_end())
2360 return nullptr;
2361 return wrap(&*I);
2362}
2363
2365 Module *Mod = unwrap(M);
2366 Module::global_iterator I = Mod->global_end();
2367 if (I == Mod->global_begin())
2368 return nullptr;
2369 return wrap(&*--I);
2370}
2371
2373 GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2375 if (++I == GV->getParent()->global_end())
2376 return nullptr;
2377 return wrap(&*I);
2378}
2379
2381 GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2383 if (I == GV->getParent()->global_begin())
2384 return nullptr;
2385 return wrap(&*--I);
2386}
2387
2389 unwrap<GlobalVariable>(GlobalVar)->eraseFromParent();
2390}
2391
2393 GlobalVariable* GV = unwrap<GlobalVariable>(GlobalVar);
2394 if ( !GV->hasInitializer() )
2395 return nullptr;
2396 return wrap(GV->getInitializer());
2397}
2398
2399void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal) {
2400 unwrap<GlobalVariable>(GlobalVar)->setInitializer(
2401 ConstantVal ? unwrap<Constant>(ConstantVal) : nullptr);
2402}
2403
2405 return unwrap<GlobalVariable>(GlobalVar)->isThreadLocal();
2406}
2407
2408void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal) {
2409 unwrap<GlobalVariable>(GlobalVar)->setThreadLocal(IsThreadLocal != 0);
2410}
2411
2413 return unwrap<GlobalVariable>(GlobalVar)->isConstant();
2414}
2415
2416void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant) {
2417 unwrap<GlobalVariable>(GlobalVar)->setConstant(IsConstant != 0);
2418}
2419
2421 switch (unwrap<GlobalVariable>(GlobalVar)->getThreadLocalMode()) {
2423 return LLVMNotThreadLocal;
2431 return LLVMLocalExecTLSModel;
2432 }
2433
2434 llvm_unreachable("Invalid GlobalVariable thread local mode");
2435}
2436
2458
2460 return unwrap<GlobalVariable>(GlobalVar)->isExternallyInitialized();
2461}
2462
2464 unwrap<GlobalVariable>(GlobalVar)->setExternallyInitialized(IsExtInit);
2465}
2466
2467/*--.. Operations on aliases ......................................--*/
2468
2470 unsigned AddrSpace, LLVMValueRef Aliasee,
2471 const char *Name) {
2472 return wrap(GlobalAlias::create(unwrap(ValueTy), AddrSpace,
2474 unwrap<Constant>(Aliasee), unwrap(M)));
2475}
2476
2478 const char *Name, size_t NameLen) {
2479 return wrap(unwrap(M)->getNamedAlias(StringRef(Name, NameLen)));
2480}
2481
2483 Module *Mod = unwrap(M);
2484 Module::alias_iterator I = Mod->alias_begin();
2485 if (I == Mod->alias_end())
2486 return nullptr;
2487 return wrap(&*I);
2488}
2489
2491 Module *Mod = unwrap(M);
2492 Module::alias_iterator I = Mod->alias_end();
2493 if (I == Mod->alias_begin())
2494 return nullptr;
2495 return wrap(&*--I);
2496}
2497
2499 GlobalAlias *Alias = unwrap<GlobalAlias>(GA);
2501 if (++I == Alias->getParent()->alias_end())
2502 return nullptr;
2503 return wrap(&*I);
2504}
2505
2507 GlobalAlias *Alias = unwrap<GlobalAlias>(GA);
2509 if (I == Alias->getParent()->alias_begin())
2510 return nullptr;
2511 return wrap(&*--I);
2512}
2513
2515 return wrap(unwrap<GlobalAlias>(Alias)->getAliasee());
2516}
2517
2519 unwrap<GlobalAlias>(Alias)->setAliasee(unwrap<Constant>(Aliasee));
2520}
2521
2522/*--.. Operations on functions .............................................--*/
2523
2525 LLVMTypeRef FunctionTy) {
2526 return wrap(Function::Create(unwrap<FunctionType>(FunctionTy),
2528}
2529
2531 size_t NameLen, LLVMTypeRef FunctionTy) {
2532 return wrap(unwrap(M)
2533 ->getOrInsertFunction(StringRef(Name, NameLen),
2534 unwrap<FunctionType>(FunctionTy))
2535 .getCallee());
2536}
2537
2539 return wrap(unwrap(M)->getFunction(Name));
2540}
2541
2543 size_t Length) {
2544 return wrap(unwrap(M)->getFunction(StringRef(Name, Length)));
2545}
2546
2548 Module *Mod = unwrap(M);
2549 Module::iterator I = Mod->begin();
2550 if (I == Mod->end())
2551 return nullptr;
2552 return wrap(&*I);
2553}
2554
2556 Module *Mod = unwrap(M);
2557 Module::iterator I = Mod->end();
2558 if (I == Mod->begin())
2559 return nullptr;
2560 return wrap(&*--I);
2561}
2562
2564 Function *Func = unwrap<Function>(Fn);
2565 Module::iterator I(Func);
2566 if (++I == Func->getParent()->end())
2567 return nullptr;
2568 return wrap(&*I);
2569}
2570
2572 Function *Func = unwrap<Function>(Fn);
2573 Module::iterator I(Func);
2574 if (I == Func->getParent()->begin())
2575 return nullptr;
2576 return wrap(&*--I);
2577}
2578
2580 unwrap<Function>(Fn)->eraseFromParent();
2581}
2582
2584 return unwrap<Function>(Fn)->hasPersonalityFn();
2585}
2586
2588 return wrap(unwrap<Function>(Fn)->getPersonalityFn());
2589}
2590
2592 unwrap<Function>(Fn)->setPersonalityFn(
2593 PersonalityFn ? unwrap<Constant>(PersonalityFn) : nullptr);
2594}
2595
2597 if (Function *F = dyn_cast<Function>(unwrap(Fn)))
2598 return F->getIntrinsicID();
2599 return 0;
2600}
2601
2603 assert(ID < llvm::Intrinsic::num_intrinsics && "Intrinsic ID out of range");
2604 return llvm::Intrinsic::ID(ID);
2605}
2606
2608 LLVMTypeRef *OverloadTypes,
2609 size_t OverloadCount) {
2610 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2611 auto IID = llvm_map_to_intrinsic_id(ID);
2612 return wrap(
2614}
2615
2616const char *LLVMIntrinsicGetName(unsigned ID, size_t *NameLength) {
2617 auto IID = llvm_map_to_intrinsic_id(ID);
2618 auto Str = llvm::Intrinsic::getName(IID);
2619 *NameLength = Str.size();
2620 return Str.data();
2621}
2622
2624 LLVMTypeRef *OverloadTypes,
2625 size_t OverloadCount) {
2626 auto IID = llvm_map_to_intrinsic_id(ID);
2627 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2628 return wrap(llvm::Intrinsic::getType(*unwrap(Ctx), IID, OverloadTys));
2629}
2630
2631char *LLVMIntrinsicCopyOverloadedName(unsigned ID, LLVMTypeRef *OverloadTypes,
2632 size_t OverloadCount,
2633 size_t *NameLength) {
2634 auto IID = llvm_map_to_intrinsic_id(ID);
2635 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2636 auto Str = llvm::Intrinsic::getNameNoUnnamedTypes(IID, OverloadTys);
2637 *NameLength = Str.length();
2638 return strdup(Str.c_str());
2639}
2640
2642 LLVMTypeRef *OverloadTypes,
2643 size_t OverloadCount,
2644 size_t *NameLength) {
2645 auto IID = llvm_map_to_intrinsic_id(ID);
2646 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2647 auto Str = llvm::Intrinsic::getName(IID, OverloadTys, unwrap(Mod));
2648 *NameLength = Str.length();
2649 return strdup(Str.c_str());
2650}
2651
2652unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen) {
2653 return Intrinsic::lookupIntrinsicID({Name, NameLen});
2654}
2655
2657 auto IID = llvm_map_to_intrinsic_id(ID);
2659}
2660
2662 return unwrap<Function>(Fn)->getCallingConv();
2663}
2664
2666 return unwrap<Function>(Fn)->setCallingConv(
2667 static_cast<CallingConv::ID>(CC));
2668}
2669
2670const char *LLVMGetGC(LLVMValueRef Fn) {
2672 return F->hasGC()? F->getGC().c_str() : nullptr;
2673}
2674
2675void LLVMSetGC(LLVMValueRef Fn, const char *GC) {
2677 if (GC)
2678 F->setGC(GC);
2679 else
2680 F->clearGC();
2681}
2682
2685 return wrap(F->getPrefixData());
2686}
2687
2690 return F->hasPrefixData();
2691}
2692
2695 Constant *prefix = unwrap<Constant>(prefixData);
2696 F->setPrefixData(prefix);
2697}
2698
2701 return wrap(F->getPrologueData());
2702}
2703
2706 return F->hasPrologueData();
2707}
2708
2711 Constant *prologue = unwrap<Constant>(prologueData);
2712 F->setPrologueData(prologue);
2713}
2714
2717 unwrap<Function>(F)->addAttributeAtIndex(Idx, unwrap(A));
2718}
2719
2721 auto AS = unwrap<Function>(F)->getAttributes().getAttributes(Idx);
2722 return AS.getNumAttributes();
2723}
2724
2726 LLVMAttributeRef *Attrs) {
2727 auto AS = unwrap<Function>(F)->getAttributes().getAttributes(Idx);
2728 for (auto A : AS)
2729 *Attrs++ = wrap(A);
2730}
2731
2734 unsigned KindID) {
2735 return wrap(unwrap<Function>(F)->getAttributeAtIndex(
2736 Idx, (Attribute::AttrKind)KindID));
2737}
2738
2741 const char *K, unsigned KLen) {
2742 return wrap(
2743 unwrap<Function>(F)->getAttributeAtIndex(Idx, StringRef(K, KLen)));
2744}
2745
2747 unsigned KindID) {
2748 unwrap<Function>(F)->removeAttributeAtIndex(Idx, (Attribute::AttrKind)KindID);
2749}
2750
2752 const char *K, unsigned KLen) {
2753 unwrap<Function>(F)->removeAttributeAtIndex(Idx, StringRef(K, KLen));
2754}
2755
2757 const char *V) {
2758 Function *Func = unwrap<Function>(Fn);
2759 Attribute Attr = Attribute::get(Func->getContext(), A, V);
2760 Func->addFnAttr(Attr);
2761}
2762
2763/*--.. Operations on parameters ............................................--*/
2764
2766 // This function is strictly redundant to
2767 // LLVMCountParamTypes(LLVMGlobalGetValueType(FnRef))
2768 return unwrap<Function>(FnRef)->arg_size();
2769}
2770
2771void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs) {
2772 Function *Fn = unwrap<Function>(FnRef);
2773 for (Argument &A : Fn->args())
2774 *ParamRefs++ = wrap(&A);
2775}
2776
2778 Function *Fn = unwrap<Function>(FnRef);
2779 return wrap(&Fn->arg_begin()[index]);
2780}
2781
2785
2787 Function *Func = unwrap<Function>(Fn);
2788 Function::arg_iterator I = Func->arg_begin();
2789 if (I == Func->arg_end())
2790 return nullptr;
2791 return wrap(&*I);
2792}
2793
2795 Function *Func = unwrap<Function>(Fn);
2796 Function::arg_iterator I = Func->arg_end();
2797 if (I == Func->arg_begin())
2798 return nullptr;
2799 return wrap(&*--I);
2800}
2801
2803 Argument *A = unwrap<Argument>(Arg);
2804 Function *Fn = A->getParent();
2805 if (A->getArgNo() + 1 >= Fn->arg_size())
2806 return nullptr;
2807 return wrap(&Fn->arg_begin()[A->getArgNo() + 1]);
2808}
2809
2811 Argument *A = unwrap<Argument>(Arg);
2812 if (A->getArgNo() == 0)
2813 return nullptr;
2814 return wrap(&A->getParent()->arg_begin()[A->getArgNo() - 1]);
2815}
2816
2818 Argument *A = unwrap<Argument>(Arg);
2819 A->addAttr(Attribute::getWithAlignment(A->getContext(), Align(align)));
2820}
2821
2822/*--.. Operations on ifuncs ................................................--*/
2823
2825 const char *Name, size_t NameLen,
2826 LLVMTypeRef Ty, unsigned AddrSpace,
2828 return wrap(GlobalIFunc::create(unwrap(Ty), AddrSpace,
2830 StringRef(Name, NameLen),
2832}
2833
2835 const char *Name, size_t NameLen) {
2836 return wrap(unwrap(M)->getNamedIFunc(StringRef(Name, NameLen)));
2837}
2838
2840 Module *Mod = unwrap(M);
2841 Module::ifunc_iterator I = Mod->ifunc_begin();
2842 if (I == Mod->ifunc_end())
2843 return nullptr;
2844 return wrap(&*I);
2845}
2846
2848 Module *Mod = unwrap(M);
2849 Module::ifunc_iterator I = Mod->ifunc_end();
2850 if (I == Mod->ifunc_begin())
2851 return nullptr;
2852 return wrap(&*--I);
2853}
2854
2856 GlobalIFunc *GIF = unwrap<GlobalIFunc>(IFunc);
2858 if (++I == GIF->getParent()->ifunc_end())
2859 return nullptr;
2860 return wrap(&*I);
2861}
2862
2864 GlobalIFunc *GIF = unwrap<GlobalIFunc>(IFunc);
2866 if (I == GIF->getParent()->ifunc_begin())
2867 return nullptr;
2868 return wrap(&*--I);
2869}
2870
2872 return wrap(unwrap<GlobalIFunc>(IFunc)->getResolver());
2873}
2874
2878
2880 unwrap<GlobalIFunc>(IFunc)->eraseFromParent();
2881}
2882
2884 unwrap<GlobalIFunc>(IFunc)->removeFromParent();
2885}
2886
2887/*--.. Operations on operand bundles........................................--*/
2888
2889LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, size_t TagLen,
2890 LLVMValueRef *Args,
2891 unsigned NumArgs) {
2892 return wrap(new OperandBundleDef(std::string(Tag, TagLen),
2893 ArrayRef(unwrap(Args), NumArgs)));
2894}
2895
2897 delete unwrap(Bundle);
2898}
2899
2900const char *LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len) {
2901 StringRef Str = unwrap(Bundle)->getTag();
2902 *Len = Str.size();
2903 return Str.data();
2904}
2905
2907 return unwrap(Bundle)->inputs().size();
2908}
2909
2911 unsigned Index) {
2912 return wrap(unwrap(Bundle)->inputs()[Index]);
2913}
2914
2915/*--.. Operations on basic blocks ..........................................--*/
2916
2918 return wrap(static_cast<Value*>(unwrap(BB)));
2919}
2920
2924
2928
2930 return unwrap(BB)->getName().data();
2931}
2932
2936
2938 return wrap(unwrap(BB)->getTerminatorOrNull());
2939}
2940
2942 return unwrap<Function>(FnRef)->size();
2943}
2944
2946 Function *Fn = unwrap<Function>(FnRef);
2947 for (BasicBlock &BB : *Fn)
2948 *BasicBlocksRefs++ = wrap(&BB);
2949}
2950
2952 return wrap(&unwrap<Function>(Fn)->getEntryBlock());
2953}
2954
2956 Function *Func = unwrap<Function>(Fn);
2957 Function::iterator I = Func->begin();
2958 if (I == Func->end())
2959 return nullptr;
2960 return wrap(&*I);
2961}
2962
2964 Function *Func = unwrap<Function>(Fn);
2965 Function::iterator I = Func->end();
2966 if (I == Func->begin())
2967 return nullptr;
2968 return wrap(&*--I);
2969}
2970
2972 BasicBlock *Block = unwrap(BB);
2974 if (++I == Block->getParent()->end())
2975 return nullptr;
2976 return wrap(&*I);
2977}
2978
2980 BasicBlock *Block = unwrap(BB);
2982 if (I == Block->getParent()->begin())
2983 return nullptr;
2984 return wrap(&*--I);
2985}
2986
2991
2993 LLVMBasicBlockRef BB) {
2994 BasicBlock *ToInsert = unwrap(BB);
2995 BasicBlock *CurBB = unwrap(Builder)->GetInsertBlock();
2996 assert(CurBB && "current insertion point is invalid!");
2997 CurBB->getParent()->insert(std::next(CurBB->getIterator()), ToInsert);
2998}
2999
3001 LLVMBasicBlockRef BB) {
3002 unwrap<Function>(Fn)->insert(unwrap<Function>(Fn)->end(), unwrap(BB));
3003}
3004
3006 LLVMValueRef FnRef,
3007 const char *Name) {
3008 return wrap(BasicBlock::Create(*unwrap(C), Name, unwrap<Function>(FnRef)));
3009}
3010
3014
3016 LLVMBasicBlockRef BBRef,
3017 const char *Name) {
3018 BasicBlock *BB = unwrap(BBRef);
3019 return wrap(BasicBlock::Create(*unwrap(C), Name, BB->getParent(), BB));
3020}
3021
3026
3028 unwrap(BBRef)->eraseFromParent();
3029}
3030
3032 unwrap(BBRef)->removeFromParent();
3033}
3034
3036 unwrap(BB)->moveBefore(unwrap(MovePos));
3037}
3038
3040 unwrap(BB)->moveAfter(unwrap(MovePos));
3041}
3042
3043/*--.. Operations on instructions ..........................................--*/
3044
3048
3050 BasicBlock *Block = unwrap(BB);
3051 BasicBlock::iterator I = Block->begin();
3052 if (I == Block->end())
3053 return nullptr;
3054 return wrap(&*I);
3055}
3056
3058 BasicBlock *Block = unwrap(BB);
3059 BasicBlock::iterator I = Block->end();
3060 if (I == Block->begin())
3061 return nullptr;
3062 return wrap(&*--I);
3063}
3064
3066 Instruction *Instr = unwrap<Instruction>(Inst);
3067 BasicBlock::iterator I(Instr);
3068 if (++I == Instr->getParent()->end())
3069 return nullptr;
3070 return wrap(&*I);
3071}
3072
3074 Instruction *Instr = unwrap<Instruction>(Inst);
3075 BasicBlock::iterator I(Instr);
3076 if (I == Instr->getParent()->begin())
3077 return nullptr;
3078 return wrap(&*--I);
3079}
3080
3082 unwrap<Instruction>(Inst)->removeFromParent();
3083}
3084
3086 unwrap<Instruction>(Inst)->eraseFromParent();
3087}
3088
3090 unwrap<Instruction>(Inst)->deleteValue();
3091}
3092
3094 if (ICmpInst *I = dyn_cast<ICmpInst>(unwrap(Inst)))
3095 return (LLVMIntPredicate)I->getPredicate();
3096 return (LLVMIntPredicate)0;
3097}
3098
3100 return unwrap<ICmpInst>(Inst)->hasSameSign();
3101}
3102
3104 unwrap<ICmpInst>(Inst)->setSameSign(SameSign);
3105}
3106
3108 if (FCmpInst *I = dyn_cast<FCmpInst>(unwrap(Inst)))
3109 return (LLVMRealPredicate)I->getPredicate();
3110 return (LLVMRealPredicate)0;
3111}
3112
3115 return map_to_llvmopcode(C->getOpcode());
3116 return (LLVMOpcode)0;
3117}
3118
3121 return wrap(C->clone());
3122 return nullptr;
3123}
3124
3127 return (I && I->isTerminator()) ? wrap(I) : nullptr;
3128}
3129
3131 Instruction *Instr = unwrap<Instruction>(Inst);
3132 if (!Instr->getDbgMarker())
3133 return nullptr;
3134 auto I = Instr->getDbgMarker()->StoredDbgRecords.begin();
3135 if (I == Instr->getDbgMarker()->StoredDbgRecords.end())
3136 return nullptr;
3137 return wrap(&*I);
3138}
3139
3141 Instruction *Instr = unwrap<Instruction>(Inst);
3142 if (!Instr->getDbgMarker())
3143 return nullptr;
3144 auto I = Instr->getDbgMarker()->StoredDbgRecords.rbegin();
3145 if (I == Instr->getDbgMarker()->StoredDbgRecords.rend())
3146 return nullptr;
3147 return wrap(&*I);
3148}
3149
3153 if (++I == Record->getInstruction()->getDbgMarker()->StoredDbgRecords.end())
3154 return nullptr;
3155 return wrap(&*I);
3156}
3157
3161 if (I == Record->getInstruction()->getDbgMarker()->StoredDbgRecords.begin())
3162 return nullptr;
3163 return wrap(&*--I);
3164}
3165
3169
3173 return LLVMDbgRecordLabel;
3175 assert(VariableRecord && "unexpected record");
3176 if (VariableRecord->isDbgDeclare())
3177 return LLVMDbgRecordDeclare;
3178 if (VariableRecord->isDbgValue())
3179 return LLVMDbgRecordValue;
3180 assert(VariableRecord->isDbgAssign() && "unexpected record");
3181 return LLVMDbgRecordAssign;
3182}
3183
3185 unsigned OpIdx) {
3186 return wrap(unwrap<DbgVariableRecord>(Rec)->getValue(OpIdx));
3187}
3188
3192
3196
3198 if (FuncletPadInst *FPI = dyn_cast<FuncletPadInst>(unwrap(Instr))) {
3199 return FPI->arg_size();
3200 }
3201 return unwrap<CallBase>(Instr)->arg_size();
3202}
3203
3204/*--.. Call and invoke instructions ........................................--*/
3205
3207 return unwrap<CallBase>(Instr)->getCallingConv();
3208}
3209
3211 return unwrap<CallBase>(Instr)->setCallingConv(
3212 static_cast<CallingConv::ID>(CC));
3213}
3214
3216 unsigned align) {
3217 auto *Call = unwrap<CallBase>(Instr);
3218 Attribute AlignAttr =
3220 Call->addAttributeAtIndex(Idx, AlignAttr);
3221}
3222
3225 unwrap<CallBase>(C)->addAttributeAtIndex(Idx, unwrap(A));
3226}
3227
3229 LLVMAttributeIndex Idx) {
3230 auto *Call = unwrap<CallBase>(C);
3231 auto AS = Call->getAttributes().getAttributes(Idx);
3232 return AS.getNumAttributes();
3233}
3234
3236 LLVMAttributeRef *Attrs) {
3237 auto *Call = unwrap<CallBase>(C);
3238 auto AS = Call->getAttributes().getAttributes(Idx);
3239 for (auto A : AS)
3240 *Attrs++ = wrap(A);
3241}
3242
3245 unsigned KindID) {
3246 return wrap(unwrap<CallBase>(C)->getAttributeAtIndex(
3247 Idx, (Attribute::AttrKind)KindID));
3248}
3249
3252 const char *K, unsigned KLen) {
3253 return wrap(
3254 unwrap<CallBase>(C)->getAttributeAtIndex(Idx, StringRef(K, KLen)));
3255}
3256
3258 unsigned KindID) {
3259 unwrap<CallBase>(C)->removeAttributeAtIndex(Idx, (Attribute::AttrKind)KindID);
3260}
3261
3263 const char *K, unsigned KLen) {
3264 unwrap<CallBase>(C)->removeAttributeAtIndex(Idx, StringRef(K, KLen));
3265}
3266
3268 return wrap(unwrap<CallBase>(Instr)->getCalledOperand());
3269}
3270
3272 return wrap(unwrap<CallBase>(Instr)->getFunctionType());
3273}
3274
3276 return unwrap<CallBase>(C)->getNumOperandBundles();
3277}
3278
3280 unsigned Index) {
3281 return wrap(
3282 new OperandBundleDef(unwrap<CallBase>(C)->getOperandBundleAt(Index)));
3283}
3284
3285/*--.. Operations on call instructions (only) ..............................--*/
3286
3288 return unwrap<CallInst>(Call)->isTailCall();
3289}
3290
3292 unwrap<CallInst>(Call)->setTailCall(isTailCall);
3293}
3294
3298
3302
3303/*--.. Operations on invoke instructions (only) ............................--*/
3304
3306 return wrap(unwrap<InvokeInst>(Invoke)->getNormalDest());
3307}
3308
3311 return wrap(CRI->getUnwindDest());
3312 } else if (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {
3313 return wrap(CSI->getUnwindDest());
3314 }
3315 return wrap(unwrap<InvokeInst>(Invoke)->getUnwindDest());
3316}
3317
3319 unwrap<InvokeInst>(Invoke)->setNormalDest(unwrap(B));
3320}
3321
3324 return CRI->setUnwindDest(unwrap(B));
3325 } else if (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {
3326 return CSI->setUnwindDest(unwrap(B));
3327 }
3328 unwrap<InvokeInst>(Invoke)->setUnwindDest(unwrap(B));
3329}
3330
3332 return wrap(unwrap<CallBrInst>(CallBr)->getDefaultDest());
3333}
3334
3336 return unwrap<CallBrInst>(CallBr)->getNumIndirectDests();
3337}
3338
3340 return wrap(unwrap<CallBrInst>(CallBr)->getIndirectDest(Idx));
3341}
3342
3343/*--.. Operations on terminators ...........................................--*/
3344
3346 return unwrap<Instruction>(Term)->getNumSuccessors();
3347}
3348
3350 return wrap(unwrap<Instruction>(Term)->getSuccessor(i));
3351}
3352
3354 return unwrap<Instruction>(Term)->setSuccessor(i, unwrap(block));
3355}
3356
3357/*--.. Operations on branch instructions (only) ............................--*/
3358
3362
3366
3368 return unwrap<CondBrInst>(Branch)->setCondition(unwrap(Cond));
3369}
3370
3371/*--.. Operations on switch instructions (only) ............................--*/
3372
3374 return wrap(unwrap<SwitchInst>(Switch)->getDefaultDest());
3375}
3376
3378 assert(i > 0 && i <= unwrap<SwitchInst>(Switch)->getNumCases());
3379 auto It = unwrap<SwitchInst>(Switch)->case_begin() + (i - 1);
3380 return wrap(It->getCaseValue());
3381}
3382
3383void LLVMSetSwitchCaseValue(LLVMValueRef Switch, unsigned i,
3384 LLVMValueRef CaseValue) {
3385 assert(i > 0 && i <= unwrap<SwitchInst>(Switch)->getNumCases());
3386 auto It = unwrap<SwitchInst>(Switch)->case_begin() + (i - 1);
3387 It->setValue(unwrap<ConstantInt>(CaseValue));
3388}
3389
3390/*--.. Operations on alloca instructions (only) ............................--*/
3391
3393 return wrap(unwrap<AllocaInst>(Alloca)->getAllocatedType());
3394}
3395
3396/*--.. Operations on gep instructions (only) ...............................--*/
3397
3399 return unwrap<GEPOperator>(GEP)->isInBounds();
3400}
3401
3403 return unwrap<GetElementPtrInst>(GEP)->setIsInBounds(InBounds);
3404}
3405
3409
3414
3419
3420/*--.. Operations on phi nodes .............................................--*/
3421
3422void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
3423 LLVMBasicBlockRef *IncomingBlocks, unsigned Count) {
3424 PHINode *PhiVal = unwrap<PHINode>(PhiNode);
3425 for (unsigned I = 0; I != Count; ++I)
3426 PhiVal->addIncoming(unwrap(IncomingValues[I]), unwrap(IncomingBlocks[I]));
3427}
3428
3430 return unwrap<PHINode>(PhiNode)->getNumIncomingValues();
3431}
3432
3434 return wrap(unwrap<PHINode>(PhiNode)->getIncomingValue(Index));
3435}
3436
3438 return wrap(unwrap<PHINode>(PhiNode)->getIncomingBlock(Index));
3439}
3440
3441/*--.. Operations on extractvalue and insertvalue nodes ....................--*/
3442
3444 auto *I = unwrap(Inst);
3445 if (auto *GEP = dyn_cast<GEPOperator>(I))
3446 return GEP->getNumIndices();
3447 if (auto *EV = dyn_cast<ExtractValueInst>(I))
3448 return EV->getNumIndices();
3449 if (auto *IV = dyn_cast<InsertValueInst>(I))
3450 return IV->getNumIndices();
3452 "LLVMGetNumIndices applies only to extractvalue and insertvalue!");
3453}
3454
3455const unsigned *LLVMGetIndices(LLVMValueRef Inst) {
3456 auto *I = unwrap(Inst);
3457 if (auto *EV = dyn_cast<ExtractValueInst>(I))
3458 return EV->getIndices().data();
3459 if (auto *IV = dyn_cast<InsertValueInst>(I))
3460 return IV->getIndices().data();
3462 "LLVMGetIndices applies only to extractvalue and insertvalue!");
3463}
3464
3465
3466/*===-- Instruction builders ----------------------------------------------===*/
3467
3473
3477
3481
3483 Instruction *Instr, bool BeforeDbgRecords) {
3484 BasicBlock::iterator I = Instr ? Instr->getIterator() : Block->end();
3485 I.setHeadBit(BeforeDbgRecords);
3486 Builder->SetInsertPoint(I);
3487}
3488
3490 LLVMValueRef Instr) {
3491 return LLVMPositionBuilderImpl(unwrap(Builder), unwrap(Block),
3492 unwrap<Instruction>(Instr), false);
3493}
3494
3501
3504 return LLVMPositionBuilderImpl(unwrap(Builder), I->getParent(), I, false);
3505}
3506
3508 LLVMValueRef Instr) {
3510 return LLVMPositionBuilderImpl(unwrap(Builder), I->getParent(), I, true);
3511}
3512
3514 BasicBlock *BB = unwrap(Block);
3515 unwrap(Builder)->SetInsertPoint(BB);
3516}
3517
3519 return wrap(unwrap(Builder)->GetInsertBlock());
3520}
3521
3523 unwrap(Builder)->ClearInsertionPoint();
3524}
3525
3527 unwrap(Builder)->Insert(unwrap<Instruction>(Instr));
3528}
3529
3531 const char *Name) {
3532 unwrap(Builder)->Insert(unwrap<Instruction>(Instr), Name);
3533}
3534
3536 delete unwrap(Builder);
3537}
3538
3539/*--.. Metadata builders ...................................................--*/
3540
3542 return wrap(unwrap(Builder)->getCurrentDebugLocation().getAsMDNode());
3543}
3544
3546 if (Loc)
3547 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(unwrap<DILocation>(Loc)));
3548 else
3549 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc());
3550}
3551
3553 DILocation *Loc =
3554 L ? cast<DILocation>(unwrap<MetadataAsValue>(L)->getMetadata()) : nullptr;
3555 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(Loc));
3556}
3557
3559 LLVMContext &Context = unwrap(Builder)->getContext();
3561 Context, unwrap(Builder)->getCurrentDebugLocation().getAsMDNode()));
3562}
3563
3565 unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
3566}
3567
3569 unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
3570}
3571
3573 LLVMMetadataRef FPMathTag) {
3574
3575 unwrap(Builder)->setDefaultFPMathTag(FPMathTag
3576 ? unwrap<MDNode>(FPMathTag)
3577 : nullptr);
3578}
3579
3581 return wrap(&unwrap(Builder)->getContext());
3582}
3583
3585 return wrap(unwrap(Builder)->getDefaultFPMathTag());
3586}
3587
3588/*--.. Instruction builders ................................................--*/
3589
3591 return wrap(unwrap(B)->CreateRetVoid());
3592}
3593
3595 return wrap(unwrap(B)->CreateRet(unwrap(V)));
3596}
3597
3599 unsigned N) {
3600 return wrap(unwrap(B)->CreateAggregateRet({unwrap(RetVals), N}));
3601}
3602
3604 return wrap(unwrap(B)->CreateBr(unwrap(Dest)));
3605}
3606
3609 return wrap(unwrap(B)->CreateCondBr(unwrap(If), unwrap(Then), unwrap(Else)));
3610}
3611
3613 LLVMBasicBlockRef Else, unsigned NumCases) {
3614 return wrap(unwrap(B)->CreateSwitch(unwrap(V), unwrap(Else), NumCases));
3615}
3616
3618 unsigned NumDests) {
3619 return wrap(unwrap(B)->CreateIndirectBr(unwrap(Addr), NumDests));
3620}
3621
3623 LLVMBasicBlockRef DefaultDest,
3624 LLVMBasicBlockRef *IndirectDests,
3625 unsigned NumIndirectDests, LLVMValueRef *Args,
3626 unsigned NumArgs, LLVMOperandBundleRef *Bundles,
3627 unsigned NumBundles, const char *Name) {
3628
3630 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
3631 OperandBundleDef *OB = unwrap(Bundle);
3632 OBs.push_back(*OB);
3633 }
3634
3635 return wrap(unwrap(B)->CreateCallBr(
3636 unwrap<FunctionType>(Ty), unwrap(Fn), unwrap(DefaultDest),
3637 ArrayRef(unwrap(IndirectDests), NumIndirectDests),
3638 ArrayRef<Value *>(unwrap(Args), NumArgs), OBs, Name));
3639}
3640
3642 LLVMValueRef *Args, unsigned NumArgs,
3644 const char *Name) {
3645 return wrap(unwrap(B)->CreateInvoke(unwrap<FunctionType>(Ty), unwrap(Fn),
3646 unwrap(Then), unwrap(Catch),
3647 ArrayRef(unwrap(Args), NumArgs), Name));
3648}
3649
3652 unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
3653 LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name) {
3655 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
3656 OperandBundleDef *OB = unwrap(Bundle);
3657 OBs.push_back(*OB);
3658 }
3659 return wrap(unwrap(B)->CreateInvoke(
3660 unwrap<FunctionType>(Ty), unwrap(Fn), unwrap(Then), unwrap(Catch),
3661 ArrayRef(unwrap(Args), NumArgs), OBs, Name));
3662}
3663
3665 LLVMValueRef PersFn, unsigned NumClauses,
3666 const char *Name) {
3667 // The personality used to live on the landingpad instruction, but now it
3668 // lives on the parent function. For compatibility, take the provided
3669 // personality and put it on the parent function.
3670 if (PersFn)
3671 unwrap(B)->GetInsertBlock()->getParent()->setPersonalityFn(
3672 unwrap<Function>(PersFn));
3673 return wrap(unwrap(B)->CreateLandingPad(unwrap(Ty), NumClauses, Name));
3674}
3675
3677 LLVMValueRef *Args, unsigned NumArgs,
3678 const char *Name) {
3679 return wrap(unwrap(B)->CreateCatchPad(unwrap(ParentPad),
3680 ArrayRef(unwrap(Args), NumArgs), Name));
3681}
3682
3684 LLVMValueRef *Args, unsigned NumArgs,
3685 const char *Name) {
3686 if (ParentPad == nullptr) {
3688 ParentPad = wrap(Constant::getNullValue(Ty));
3689 }
3690 return wrap(unwrap(B)->CreateCleanupPad(
3691 unwrap(ParentPad), ArrayRef(unwrap(Args), NumArgs), Name));
3692}
3693
3695 return wrap(unwrap(B)->CreateResume(unwrap(Exn)));
3696}
3697
3699 LLVMBasicBlockRef UnwindBB,
3700 unsigned NumHandlers, const char *Name) {
3701 if (ParentPad == nullptr) {
3703 ParentPad = wrap(Constant::getNullValue(Ty));
3704 }
3705 return wrap(unwrap(B)->CreateCatchSwitch(unwrap(ParentPad), unwrap(UnwindBB),
3706 NumHandlers, Name));
3707}
3708
3710 LLVMBasicBlockRef BB) {
3711 return wrap(unwrap(B)->CreateCatchRet(unwrap<CatchPadInst>(CatchPad),
3712 unwrap(BB)));
3713}
3714
3716 LLVMBasicBlockRef BB) {
3717 return wrap(unwrap(B)->CreateCleanupRet(unwrap<CleanupPadInst>(CatchPad),
3718 unwrap(BB)));
3719}
3720
3722 return wrap(unwrap(B)->CreateUnreachable());
3723}
3724
3726 LLVMBasicBlockRef Dest) {
3727 unwrap<SwitchInst>(Switch)->addCase(unwrap<ConstantInt>(OnVal), unwrap(Dest));
3728}
3729
3731 unwrap<IndirectBrInst>(IndirectBr)->addDestination(unwrap(Dest));
3732}
3733
3734unsigned LLVMGetNumClauses(LLVMValueRef LandingPad) {
3735 return unwrap<LandingPadInst>(LandingPad)->getNumClauses();
3736}
3737
3738LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx) {
3739 return wrap(unwrap<LandingPadInst>(LandingPad)->getClause(Idx));
3740}
3741
3742void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal) {
3743 unwrap<LandingPadInst>(LandingPad)->addClause(unwrap<Constant>(ClauseVal));
3744}
3745
3747 return unwrap<LandingPadInst>(LandingPad)->isCleanup();
3748}
3749
3750void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val) {
3751 unwrap<LandingPadInst>(LandingPad)->setCleanup(Val);
3752}
3753
3755 unwrap<CatchSwitchInst>(CatchSwitch)->addHandler(unwrap(Dest));
3756}
3757
3758unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch) {
3759 return unwrap<CatchSwitchInst>(CatchSwitch)->getNumHandlers();
3760}
3761
3762void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers) {
3763 CatchSwitchInst *CSI = unwrap<CatchSwitchInst>(CatchSwitch);
3764 for (const BasicBlock *H : CSI->handlers())
3765 *Handlers++ = wrap(H);
3766}
3767
3769 return wrap(unwrap<CatchPadInst>(CatchPad)->getCatchSwitch());
3770}
3771
3773 unwrap<CatchPadInst>(CatchPad)
3774 ->setCatchSwitch(unwrap<CatchSwitchInst>(CatchSwitch));
3775}
3776
3777/*--.. Funclets ...........................................................--*/
3778
3780 return wrap(unwrap<FuncletPadInst>(Funclet)->getArgOperand(i));
3781}
3782
3783void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value) {
3784 unwrap<FuncletPadInst>(Funclet)->setArgOperand(i, unwrap(value));
3785}
3786
3787/*--.. Arithmetic ..........................................................--*/
3788
3790 FastMathFlags NewFMF;
3791 NewFMF.setAllowReassoc((FMF & LLVMFastMathAllowReassoc) != 0);
3792 NewFMF.setNoNaNs((FMF & LLVMFastMathNoNaNs) != 0);
3793 NewFMF.setNoInfs((FMF & LLVMFastMathNoInfs) != 0);
3794 NewFMF.setNoSignedZeros((FMF & LLVMFastMathNoSignedZeros) != 0);
3796 NewFMF.setAllowContract((FMF & LLVMFastMathAllowContract) != 0);
3797 NewFMF.setApproxFunc((FMF & LLVMFastMathApproxFunc) != 0);
3798
3799 return NewFMF;
3800}
3801
3804 if (FMF.allowReassoc())
3805 NewFMF |= LLVMFastMathAllowReassoc;
3806 if (FMF.noNaNs())
3807 NewFMF |= LLVMFastMathNoNaNs;
3808 if (FMF.noInfs())
3809 NewFMF |= LLVMFastMathNoInfs;
3810 if (FMF.noSignedZeros())
3811 NewFMF |= LLVMFastMathNoSignedZeros;
3812 if (FMF.allowReciprocal())
3814 if (FMF.allowContract())
3815 NewFMF |= LLVMFastMathAllowContract;
3816 if (FMF.approxFunc())
3817 NewFMF |= LLVMFastMathApproxFunc;
3818
3819 return NewFMF;
3820}
3821
3823 const char *Name) {
3824 return wrap(unwrap(B)->CreateAdd(unwrap(LHS), unwrap(RHS), Name));
3825}
3826
3828 const char *Name) {
3829 return wrap(unwrap(B)->CreateNSWAdd(unwrap(LHS), unwrap(RHS), Name));
3830}
3831
3833 const char *Name) {
3834 return wrap(unwrap(B)->CreateNUWAdd(unwrap(LHS), unwrap(RHS), Name));
3835}
3836
3838 const char *Name) {
3839 return wrap(unwrap(B)->CreateFAdd(unwrap(LHS), unwrap(RHS), Name));
3840}
3841
3843 const char *Name) {
3844 return wrap(unwrap(B)->CreateSub(unwrap(LHS), unwrap(RHS), Name));
3845}
3846
3848 const char *Name) {
3849 return wrap(unwrap(B)->CreateNSWSub(unwrap(LHS), unwrap(RHS), Name));
3850}
3851
3853 const char *Name) {
3854 return wrap(unwrap(B)->CreateNUWSub(unwrap(LHS), unwrap(RHS), Name));
3855}
3856
3858 const char *Name) {
3859 return wrap(unwrap(B)->CreateFSub(unwrap(LHS), unwrap(RHS), Name));
3860}
3861
3863 const char *Name) {
3864 return wrap(unwrap(B)->CreateMul(unwrap(LHS), unwrap(RHS), Name));
3865}
3866
3868 const char *Name) {
3869 return wrap(unwrap(B)->CreateNSWMul(unwrap(LHS), unwrap(RHS), Name));
3870}
3871
3873 const char *Name) {
3874 return wrap(unwrap(B)->CreateNUWMul(unwrap(LHS), unwrap(RHS), Name));
3875}
3876
3878 const char *Name) {
3879 return wrap(unwrap(B)->CreateFMul(unwrap(LHS), unwrap(RHS), Name));
3880}
3881
3883 const char *Name) {
3884 return wrap(unwrap(B)->CreateUDiv(unwrap(LHS), unwrap(RHS), Name));
3885}
3886
3888 LLVMValueRef RHS, const char *Name) {
3889 return wrap(unwrap(B)->CreateExactUDiv(unwrap(LHS), unwrap(RHS), Name));
3890}
3891
3893 const char *Name) {
3894 return wrap(unwrap(B)->CreateSDiv(unwrap(LHS), unwrap(RHS), Name));
3895}
3896
3898 LLVMValueRef RHS, const char *Name) {
3899 return wrap(unwrap(B)->CreateExactSDiv(unwrap(LHS), unwrap(RHS), Name));
3900}
3901
3903 const char *Name) {
3904 return wrap(unwrap(B)->CreateFDiv(unwrap(LHS), unwrap(RHS), Name));
3905}
3906
3908 const char *Name) {
3909 return wrap(unwrap(B)->CreateURem(unwrap(LHS), unwrap(RHS), Name));
3910}
3911
3913 const char *Name) {
3914 return wrap(unwrap(B)->CreateSRem(unwrap(LHS), unwrap(RHS), Name));
3915}
3916
3918 const char *Name) {
3919 return wrap(unwrap(B)->CreateFRem(unwrap(LHS), unwrap(RHS), Name));
3920}
3921
3923 const char *Name) {
3924 return wrap(unwrap(B)->CreateShl(unwrap(LHS), unwrap(RHS), Name));
3925}
3926
3928 const char *Name) {
3929 return wrap(unwrap(B)->CreateLShr(unwrap(LHS), unwrap(RHS), Name));
3930}
3931
3933 const char *Name) {
3934 return wrap(unwrap(B)->CreateAShr(unwrap(LHS), unwrap(RHS), Name));
3935}
3936
3938 const char *Name) {
3939 return wrap(unwrap(B)->CreateAnd(unwrap(LHS), unwrap(RHS), Name));
3940}
3941
3943 const char *Name) {
3944 return wrap(unwrap(B)->CreateOr(unwrap(LHS), unwrap(RHS), Name));
3945}
3946
3948 const char *Name) {
3949 return wrap(unwrap(B)->CreateXor(unwrap(LHS), unwrap(RHS), Name));
3950}
3951
3958
3960 return wrap(unwrap(B)->CreateNeg(unwrap(V), Name));
3961}
3962
3964 const char *Name) {
3965 return wrap(unwrap(B)->CreateNSWNeg(unwrap(V), Name));
3966}
3967
3969 const char *Name) {
3970 Value *Neg = unwrap(B)->CreateNeg(unwrap(V), Name);
3971 if (auto *I = dyn_cast<BinaryOperator>(Neg))
3972 I->setHasNoUnsignedWrap();
3973 return wrap(Neg);
3974}
3975
3977 return wrap(unwrap(B)->CreateFNeg(unwrap(V), Name));
3978}
3979
3981 return wrap(unwrap(B)->CreateNot(unwrap(V), Name));
3982}
3983
3985 Value *P = unwrap<Value>(ArithInst);
3986 return cast<Instruction>(P)->hasNoUnsignedWrap();
3987}
3988
3989void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW) {
3990 Value *P = unwrap<Value>(ArithInst);
3991 cast<Instruction>(P)->setHasNoUnsignedWrap(HasNUW);
3992}
3993
3995 Value *P = unwrap<Value>(ArithInst);
3996 return cast<Instruction>(P)->hasNoSignedWrap();
3997}
3998
3999void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW) {
4000 Value *P = unwrap<Value>(ArithInst);
4001 cast<Instruction>(P)->setHasNoSignedWrap(HasNSW);
4002}
4003
4005 Value *P = unwrap<Value>(DivOrShrInst);
4006 return cast<Instruction>(P)->isExact();
4007}
4008
4009void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact) {
4010 Value *P = unwrap<Value>(DivOrShrInst);
4011 cast<Instruction>(P)->setIsExact(IsExact);
4012}
4013
4015 Value *P = unwrap<Value>(NonNegInst);
4016 return cast<Instruction>(P)->hasNonNeg();
4017}
4018
4019void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg) {
4020 Value *P = unwrap<Value>(NonNegInst);
4021 cast<Instruction>(P)->setNonNeg(IsNonNeg);
4022}
4023
4025 Value *P = unwrap<Value>(FPMathInst);
4026 FastMathFlags FMF = cast<Instruction>(P)->getFastMathFlags();
4027 return mapToLLVMFastMathFlags(FMF);
4028}
4029
4031 Value *P = unwrap<Value>(FPMathInst);
4032 cast<Instruction>(P)->setFastMathFlags(mapFromLLVMFastMathFlags(FMF));
4033}
4034
4039
4041 Value *P = unwrap<Value>(Inst);
4042 return cast<PossiblyDisjointInst>(P)->isDisjoint();
4043}
4044
4046 Value *P = unwrap<Value>(Inst);
4047 cast<PossiblyDisjointInst>(P)->setIsDisjoint(IsDisjoint);
4048}
4049
4050/*--.. Memory ..............................................................--*/
4051
4053 const char *Name) {
4054 BasicBlock *BB = unwrap(B)->GetInsertBlock();
4055 const DataLayout &DL = BB->getDataLayout();
4056 Type *ITy = Type::getInt32Ty(BB->getContext());
4057 Value *AllocSize =
4058 unwrap(B)->CreateTypeSize(ITy, DL.getTypeAllocSize(unwrap(Ty)));
4059 return wrap(unwrap(B)->CreateMalloc(ITy, AllocSize, nullptr, nullptr, Name));
4060}
4061
4063 LLVMValueRef Val, const char *Name) {
4064 BasicBlock *BB = unwrap(B)->GetInsertBlock();
4065 const DataLayout &DL = BB->getDataLayout();
4066 Type *ITy = Type::getInt32Ty(BB->getContext());
4067 Value *AllocSize =
4068 unwrap(B)->CreateTypeSize(ITy, DL.getTypeAllocSize(unwrap(Ty)));
4069 return wrap(
4070 unwrap(B)->CreateMalloc(ITy, AllocSize, unwrap(Val), nullptr, Name));
4071}
4072
4074 LLVMValueRef Val, LLVMValueRef Len,
4075 unsigned Align) {
4076 return wrap(unwrap(B)->CreateMemSet(unwrap(Ptr), unwrap(Val), unwrap(Len),
4077 MaybeAlign(Align)));
4078}
4079
4081 LLVMValueRef Dst, unsigned DstAlign,
4082 LLVMValueRef Src, unsigned SrcAlign,
4084 return wrap(unwrap(B)->CreateMemCpy(unwrap(Dst), MaybeAlign(DstAlign),
4085 unwrap(Src), MaybeAlign(SrcAlign),
4086 unwrap(Size)));
4087}
4088
4090 LLVMValueRef Dst, unsigned DstAlign,
4091 LLVMValueRef Src, unsigned SrcAlign,
4093 return wrap(unwrap(B)->CreateMemMove(unwrap(Dst), MaybeAlign(DstAlign),
4094 unwrap(Src), MaybeAlign(SrcAlign),
4095 unwrap(Size)));
4096}
4097
4099 const char *Name) {
4100 return wrap(unwrap(B)->CreateAlloca(unwrap(Ty), nullptr, Name));
4101}
4102
4104 LLVMValueRef Val, const char *Name) {
4105 return wrap(unwrap(B)->CreateAlloca(unwrap(Ty), unwrap(Val), Name));
4106}
4107
4109 return wrap(unwrap(B)->CreateFree(unwrap(PointerVal)));
4110}
4111
4113 LLVMValueRef PointerVal, const char *Name) {
4114 return wrap(unwrap(B)->CreateLoad(unwrap(Ty), unwrap(PointerVal), Name));
4115}
4116
4118 LLVMValueRef PointerVal) {
4119 return wrap(unwrap(B)->CreateStore(unwrap(Val), unwrap(PointerVal)));
4120}
4121
4137
4153
4155 switch (BinOp) {
4187 }
4188
4189 llvm_unreachable("Invalid LLVMAtomicRMWBinOp value!");
4190}
4191
4193 switch (BinOp) {
4225 default: break;
4226 }
4227
4228 llvm_unreachable("Invalid AtomicRMWBinOp value!");
4229}
4230
4232 LLVMBool isSingleThread, const char *Name) {
4233 return wrap(
4234 unwrap(B)->CreateFence(mapFromLLVMOrdering(Ordering),
4235 isSingleThread ? SyncScope::SingleThread
4237 Name));
4238}
4239
4241 LLVMAtomicOrdering Ordering, unsigned SSID,
4242 const char *Name) {
4243 return wrap(
4244 unwrap(B)->CreateFence(mapFromLLVMOrdering(Ordering), SSID, Name));
4245}
4246
4248 LLVMValueRef Pointer, LLVMValueRef *Indices,
4249 unsigned NumIndices, const char *Name) {
4250 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4251 return wrap(unwrap(B)->CreateGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name));
4252}
4253
4255 LLVMValueRef Pointer, LLVMValueRef *Indices,
4256 unsigned NumIndices, const char *Name) {
4257 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4258 return wrap(
4259 unwrap(B)->CreateInBoundsGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name));
4260}
4261
4263 LLVMValueRef Pointer,
4264 LLVMValueRef *Indices,
4265 unsigned NumIndices, const char *Name,
4266 LLVMGEPNoWrapFlags NoWrapFlags) {
4267 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4268 return wrap(unwrap(B)->CreateGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name,
4269 mapFromLLVMGEPNoWrapFlags(NoWrapFlags)));
4270}
4271
4273 LLVMValueRef Pointer, unsigned Idx,
4274 const char *Name) {
4275 return wrap(
4276 unwrap(B)->CreateStructGEP(unwrap(Ty), unwrap(Pointer), Idx, Name));
4277}
4278
4280 const char *Name) {
4281 return wrap(unwrap(B)->CreateGlobalString(Str, Name));
4282}
4283
4285 const char *Name) {
4286 return wrap(unwrap(B)->CreateGlobalString(Str, Name));
4287}
4288
4290 return cast<Instruction>(unwrap(Inst))->isVolatile();
4291}
4292
4293void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile) {
4294 Value *P = unwrap(MemAccessInst);
4295 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4296 return LI->setVolatile(isVolatile);
4298 return SI->setVolatile(isVolatile);
4300 return AI->setVolatile(isVolatile);
4301 return cast<AtomicCmpXchgInst>(P)->setVolatile(isVolatile);
4302}
4303
4305 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->isWeak();
4306}
4307
4308void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak) {
4309 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->setWeak(isWeak);
4310}
4311
4313 Value *P = unwrap(MemAccessInst);
4315 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4316 O = LI->getOrdering();
4317 else if (StoreInst *SI = dyn_cast<StoreInst>(P))
4318 O = SI->getOrdering();
4319 else if (FenceInst *FI = dyn_cast<FenceInst>(P))
4320 O = FI->getOrdering();
4321 else
4322 O = cast<AtomicRMWInst>(P)->getOrdering();
4323 return mapToLLVMOrdering(O);
4324}
4325
4326void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering) {
4327 Value *P = unwrap(MemAccessInst);
4328 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4329
4330 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4331 return LI->setOrdering(O);
4332 else if (FenceInst *FI = dyn_cast<FenceInst>(P))
4333 return FI->setOrdering(O);
4334 else if (AtomicRMWInst *ARWI = dyn_cast<AtomicRMWInst>(P))
4335 return ARWI->setOrdering(O);
4336 return cast<StoreInst>(P)->setOrdering(O);
4337}
4338
4342
4344 unwrap<AtomicRMWInst>(Inst)->setOperation(mapFromLLVMRMWBinOp(BinOp));
4345}
4346
4347/*--.. Casts ...............................................................--*/
4348
4350 LLVMTypeRef DestTy, const char *Name) {
4351 return wrap(unwrap(B)->CreateTrunc(unwrap(Val), unwrap(DestTy), Name));
4352}
4353
4355 LLVMTypeRef DestTy, const char *Name) {
4356 return wrap(unwrap(B)->CreateZExt(unwrap(Val), unwrap(DestTy), Name));
4357}
4358
4360 LLVMTypeRef DestTy, const char *Name) {
4361 return wrap(unwrap(B)->CreateSExt(unwrap(Val), unwrap(DestTy), Name));
4362}
4363
4365 LLVMTypeRef DestTy, const char *Name) {
4366 return wrap(unwrap(B)->CreateFPToUI(unwrap(Val), unwrap(DestTy), Name));
4367}
4368
4370 LLVMTypeRef DestTy, const char *Name) {
4371 return wrap(unwrap(B)->CreateFPToSI(unwrap(Val), unwrap(DestTy), Name));
4372}
4373
4375 LLVMTypeRef DestTy, const char *Name) {
4376 return wrap(unwrap(B)->CreateUIToFP(unwrap(Val), unwrap(DestTy), Name));
4377}
4378
4380 LLVMTypeRef DestTy, const char *Name) {
4381 return wrap(unwrap(B)->CreateSIToFP(unwrap(Val), unwrap(DestTy), Name));
4382}
4383
4385 LLVMTypeRef DestTy, const char *Name) {
4386 return wrap(unwrap(B)->CreateFPTrunc(unwrap(Val), unwrap(DestTy), Name));
4387}
4388
4390 LLVMTypeRef DestTy, const char *Name) {
4391 return wrap(unwrap(B)->CreateFPExt(unwrap(Val), unwrap(DestTy), Name));
4392}
4393
4395 LLVMTypeRef DestTy, const char *Name) {
4396 return wrap(unwrap(B)->CreatePtrToInt(unwrap(Val), unwrap(DestTy), Name));
4397}
4398
4400 LLVMTypeRef DestTy, const char *Name) {
4401 return wrap(unwrap(B)->CreateIntToPtr(unwrap(Val), unwrap(DestTy), Name));
4402}
4403
4405 LLVMTypeRef DestTy, const char *Name) {
4406 return wrap(unwrap(B)->CreateBitCast(unwrap(Val), unwrap(DestTy), Name));
4407}
4408
4410 LLVMTypeRef DestTy, const char *Name) {
4411 return wrap(unwrap(B)->CreateAddrSpaceCast(unwrap(Val), unwrap(DestTy), Name));
4412}
4413
4415 LLVMTypeRef DestTy, const char *Name) {
4416 return wrap(unwrap(B)->CreateZExtOrBitCast(unwrap(Val), unwrap(DestTy),
4417 Name));
4418}
4419
4421 LLVMTypeRef DestTy, const char *Name) {
4422 return wrap(unwrap(B)->CreateSExtOrBitCast(unwrap(Val), unwrap(DestTy),
4423 Name));
4424}
4425
4427 LLVMTypeRef DestTy, const char *Name) {
4428 return wrap(unwrap(B)->CreateTruncOrBitCast(unwrap(Val), unwrap(DestTy),
4429 Name));
4430}
4431
4433 LLVMTypeRef DestTy, const char *Name) {
4434 return wrap(unwrap(B)->CreateCast(Instruction::CastOps(map_from_llvmopcode(Op)), unwrap(Val),
4435 unwrap(DestTy), Name));
4436}
4437
4439 LLVMTypeRef DestTy, const char *Name) {
4440 return wrap(unwrap(B)->CreatePointerCast(unwrap(Val), unwrap(DestTy), Name));
4441}
4442
4444 LLVMTypeRef DestTy, LLVMBool IsSigned,
4445 const char *Name) {
4446 return wrap(
4447 unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy), IsSigned, Name));
4448}
4449
4451 LLVMTypeRef DestTy, const char *Name) {
4452 return wrap(unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy),
4453 /*isSigned*/true, Name));
4454}
4455
4457 LLVMTypeRef DestTy, const char *Name) {
4458 return wrap(unwrap(B)->CreateFPCast(unwrap(Val), unwrap(DestTy), Name));
4459}
4460
4462 LLVMTypeRef DestTy, LLVMBool DestIsSigned) {
4464 unwrap(Src), SrcIsSigned, unwrap(DestTy), DestIsSigned));
4465}
4466
4467/*--.. Comparisons .........................................................--*/
4468
4471 const char *Name) {
4472 return wrap(unwrap(B)->CreateICmp(static_cast<ICmpInst::Predicate>(Op),
4473 unwrap(LHS), unwrap(RHS), Name));
4474}
4475
4478 const char *Name) {
4479 return wrap(unwrap(B)->CreateFCmp(static_cast<FCmpInst::Predicate>(Op),
4480 unwrap(LHS), unwrap(RHS), Name));
4481}
4482
4483/*--.. Miscellaneous instructions ..........................................--*/
4484
4486 return wrap(unwrap(B)->CreatePHI(unwrap(Ty), 0, Name));
4487}
4488
4490 LLVMValueRef *Args, unsigned NumArgs,
4491 const char *Name) {
4493 return wrap(unwrap(B)->CreateCall(FTy, unwrap(Fn),
4494 ArrayRef(unwrap(Args), NumArgs), Name));
4495}
4496
4499 LLVMValueRef Fn, LLVMValueRef *Args,
4500 unsigned NumArgs, LLVMOperandBundleRef *Bundles,
4501 unsigned NumBundles, const char *Name) {
4504 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
4505 OperandBundleDef *OB = unwrap(Bundle);
4506 OBs.push_back(*OB);
4507 }
4508 return wrap(unwrap(B)->CreateCall(
4509 FTy, unwrap(Fn), ArrayRef(unwrap(Args), NumArgs), OBs, Name));
4510}
4511
4513 LLVMValueRef Then, LLVMValueRef Else,
4514 const char *Name) {
4515 return wrap(unwrap(B)->CreateSelect(unwrap(If), unwrap(Then), unwrap(Else),
4516 Name));
4517}
4518
4520 LLVMTypeRef Ty, const char *Name) {
4521 return wrap(unwrap(B)->CreateVAArg(unwrap(List), unwrap(Ty), Name));
4522}
4523
4525 LLVMValueRef Index, const char *Name) {
4526 return wrap(unwrap(B)->CreateExtractElement(unwrap(VecVal), unwrap(Index),
4527 Name));
4528}
4529
4531 LLVMValueRef EltVal, LLVMValueRef Index,
4532 const char *Name) {
4533 return wrap(unwrap(B)->CreateInsertElement(unwrap(VecVal), unwrap(EltVal),
4534 unwrap(Index), Name));
4535}
4536
4538 LLVMValueRef V2, LLVMValueRef Mask,
4539 const char *Name) {
4540 return wrap(unwrap(B)->CreateShuffleVector(unwrap(V1), unwrap(V2),
4541 unwrap(Mask), Name));
4542}
4543
4545 unsigned Index, const char *Name) {
4546 return wrap(unwrap(B)->CreateExtractValue(unwrap(AggVal), Index, Name));
4547}
4548
4550 LLVMValueRef EltVal, unsigned Index,
4551 const char *Name) {
4552 return wrap(unwrap(B)->CreateInsertValue(unwrap(AggVal), unwrap(EltVal),
4553 Index, Name));
4554}
4555
4557 const char *Name) {
4558 return wrap(unwrap(B)->CreateFreeze(unwrap(Val), Name));
4559}
4560
4563 const char *Name) {
4564 return wrap(unwrap(B)->CreateBitInsert(unwrap(Base), unwrap(Val),
4565 unwrap(Offset), Name));
4566}
4567
4570 const char *Name) {
4571 return wrap(unwrap(B)->CreateBitExtract(unwrap(Ty), unwrap(Src),
4572 unwrap(Offset), Name));
4573}
4574
4576 const char *Name) {
4577 return wrap(unwrap(B)->CreateIsNull(unwrap(Val), Name));
4578}
4579
4581 const char *Name) {
4582 return wrap(unwrap(B)->CreateIsNotNull(unwrap(Val), Name));
4583}
4584
4587 const char *Name) {
4588 IRBuilderBase *Builder = unwrap(B);
4589 Value *Diff =
4590 Builder->CreatePtrDiff(unwrap(ElemTy), unwrap(LHS), unwrap(RHS), Name);
4591 return wrap(Builder->CreateSExtOrTrunc(Diff, Builder->getInt64Ty()));
4592}
4593
4595 LLVMValueRef PTR, LLVMValueRef Val,
4596 LLVMAtomicOrdering ordering,
4597 LLVMBool singleThread) {
4599 return wrap(unwrap(B)->CreateAtomicRMW(
4600 intop, unwrap(PTR), unwrap(Val), MaybeAlign(),
4601 mapFromLLVMOrdering(ordering),
4602 singleThread ? SyncScope::SingleThread : SyncScope::System));
4603}
4604
4607 LLVMValueRef PTR, LLVMValueRef Val,
4608 LLVMAtomicOrdering ordering,
4609 unsigned SSID) {
4611 return wrap(unwrap(B)->CreateAtomicRMW(intop, unwrap(PTR), unwrap(Val),
4612 MaybeAlign(),
4613 mapFromLLVMOrdering(ordering), SSID));
4614}
4615
4617 LLVMValueRef Cmp, LLVMValueRef New,
4618 LLVMAtomicOrdering SuccessOrdering,
4619 LLVMAtomicOrdering FailureOrdering,
4620 LLVMBool singleThread) {
4621
4622 return wrap(unwrap(B)->CreateAtomicCmpXchg(
4623 unwrap(Ptr), unwrap(Cmp), unwrap(New), MaybeAlign(),
4624 mapFromLLVMOrdering(SuccessOrdering),
4625 mapFromLLVMOrdering(FailureOrdering),
4626 singleThread ? SyncScope::SingleThread : SyncScope::System));
4627}
4628
4630 LLVMValueRef Cmp, LLVMValueRef New,
4631 LLVMAtomicOrdering SuccessOrdering,
4632 LLVMAtomicOrdering FailureOrdering,
4633 unsigned SSID) {
4634 return wrap(unwrap(B)->CreateAtomicCmpXchg(
4635 unwrap(Ptr), unwrap(Cmp), unwrap(New), MaybeAlign(),
4636 mapFromLLVMOrdering(SuccessOrdering),
4637 mapFromLLVMOrdering(FailureOrdering), SSID));
4638}
4639
4641 Value *P = unwrap(SVInst);
4643 return I->getShuffleMask().size();
4644}
4645
4646int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt) {
4647 Value *P = unwrap(SVInst);
4649 return I->getMaskValue(Elt);
4650}
4651
4653
4655 return unwrap<Instruction>(Inst)->isAtomic();
4656}
4657
4659 // Backwards compatibility: return false for non-atomic instructions
4660 Instruction *I = unwrap<Instruction>(AtomicInst);
4661 if (!I->isAtomic())
4662 return 0;
4663
4665}
4666
4668 // Backwards compatibility: ignore non-atomic instructions
4669 Instruction *I = unwrap<Instruction>(AtomicInst);
4670 if (!I->isAtomic())
4671 return;
4672
4674 setAtomicSyncScopeID(I, SSID);
4675}
4676
4678 Instruction *I = unwrap<Instruction>(AtomicInst);
4679 assert(I->isAtomic() && "Expected an atomic instruction");
4680 return *getAtomicSyncScopeID(I);
4681}
4682
4683void LLVMSetAtomicSyncScopeID(LLVMValueRef AtomicInst, unsigned SSID) {
4684 Instruction *I = unwrap<Instruction>(AtomicInst);
4685 assert(I->isAtomic() && "Expected an atomic instruction");
4686 setAtomicSyncScopeID(I, SSID);
4687}
4688
4690 Value *P = unwrap(CmpXchgInst);
4691 return mapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getSuccessOrdering());
4692}
4693
4695 LLVMAtomicOrdering Ordering) {
4696 Value *P = unwrap(CmpXchgInst);
4697 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4698
4699 return cast<AtomicCmpXchgInst>(P)->setSuccessOrdering(O);
4700}
4701
4703 Value *P = unwrap(CmpXchgInst);
4704 return mapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getFailureOrdering());
4705}
4706
4708 LLVMAtomicOrdering Ordering) {
4709 Value *P = unwrap(CmpXchgInst);
4710 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4711
4712 return cast<AtomicCmpXchgInst>(P)->setFailureOrdering(O);
4713}
4714
4715/*===-- Module providers --------------------------------------------------===*/
4716
4721
4725
4726
4727/*===-- Memory buffers ----------------------------------------------------===*/
4728
4730 const char *Path,
4731 LLVMMemoryBufferRef *OutMemBuf,
4732 char **OutMessage) {
4733
4735 if (std::error_code EC = MBOrErr.getError()) {
4736 *OutMessage = strdup(EC.message().c_str());
4737 return 1;
4738 }
4739 *OutMemBuf = wrap(MBOrErr.get().release());
4740 return 0;
4741}
4742
4744 char **OutMessage) {
4746 if (std::error_code EC = MBOrErr.getError()) {
4747 *OutMessage = strdup(EC.message().c_str());
4748 return 1;
4749 }
4750 *OutMemBuf = wrap(MBOrErr.get().release());
4751 return 0;
4752}
4753
4755 const char *InputData,
4756 size_t InputDataLength,
4757 const char *BufferName,
4758 LLVMBool RequiresNullTerminator) {
4759
4760 return wrap(MemoryBuffer::getMemBuffer(StringRef(InputData, InputDataLength),
4761 StringRef(BufferName),
4762 RequiresNullTerminator).release());
4763}
4764
4766 const char *InputData,
4767 size_t InputDataLength,
4768 const char *BufferName) {
4769
4770 return wrap(
4771 MemoryBuffer::getMemBufferCopy(StringRef(InputData, InputDataLength),
4772 StringRef(BufferName)).release());
4773}
4774
4776 return unwrap(MemBuf)->getBufferStart();
4777}
4778
4780 return unwrap(MemBuf)->getBufferSize();
4781}
4782
4784 delete unwrap(MemBuf);
4785}
4786
4787/*===-- Pass Manager ------------------------------------------------------===*/
4788
4792
4796
4801
4805
4809
4813
4817
4819 delete unwrap(PM);
4820}
4821
4822/*===-- Threading ------------------------------------------------------===*/
4823
4827
4830
4834
4835/*===-- Data Layout ----------------------------------------------------===*/
4836
4838 return wrap(&unwrap(M)->getDataLayout());
4839}
4840
4842 unwrap(M)->setDataLayout(*unwrap(DL));
4843}
4844
4846 return wrap(new DataLayout(StringRep));
4847}
4848
4850
4852 std::string StringRep = unwrap(TD)->getStringRepresentation();
4853 return strdup(StringRep.c_str());
4854}
4855
4859
4861 return unwrap(TD)->getPointerSize(0);
4862}
4863
4864unsigned LLVMPointerSizeForAS(LLVMTargetDataRef TD, unsigned AS) {
4865 return unwrap(TD)->getPointerSize(AS);
4866}
4867
4871
4873 return wrap(
4874 unwrap(TD)->getIntPtrType(*unwrap(getGlobalContextForCAPI()), AS));
4875}
4876
4880
4882 unsigned AS) {
4883 return wrap(unwrap(TD)->getIntPtrType(*unwrap(C), AS));
4884}
4885
4887 return unwrap(TD)->getTypeSizeInBits(unwrap(Ty));
4888}
4889
4891 return unwrap(TD)->getTypeStoreSize(unwrap(Ty));
4892}
4893
4895 return unwrap(TD)->getTypeAllocSize(unwrap(Ty));
4896}
4897
4899 return unwrap(TD)->getABITypeAlign(unwrap(Ty)).value();
4900}
4901
4903 return unwrap(TD)->getABITypeAlign(unwrap(Ty)).value();
4904}
4905
4907 return unwrap(TD)->getPrefTypeAlign(unwrap(Ty)).value();
4908}
4909
4911 LLVMValueRef GlobalVar) {
4912 return unwrap(TD)
4913 ->getPreferredAlign(unwrap<GlobalVariable>(GlobalVar))
4914 .value();
4915}
4916
4918 unsigned long long Offset) {
4919 StructType *STy = unwrap<StructType>(StructTy);
4920 return unwrap(TD)->getStructLayout(STy)->getElementContainingOffset(Offset);
4921}
4922
4924 LLVMTypeRef StructTy, unsigned Element) {
4925 StructType *STy = unwrap<StructType>(StructTy);
4926 return unwrap(TD)->getStructLayout(STy)->getElementOffset(Element);
4927}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
uint64_t uint64_t
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
always inline
This file contains the simple types necessary to represent the attributes associated with functions a...
static const Function * getParent(const Value *V)
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
#define LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_PUSH
Definition Compiler.h:276
#define LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_POP
Definition Compiler.h:277
#define LLVM_EXTENSION
LLVM_EXTENSION - Support compilers where we have a keyword to suppress pedantic diagnostics.
Definition Compiler.h:493
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static uint64_t align(uint64_t Size)
DXIL Finalize Linkage
static char getTypeID(Type *Ty)
static Value * getCondition(Instruction *I)
#define op(i)
Hexagon Common GEP
Value * getPointer(Value *Ptr)
LLVMTypeRef LLVMFP128Type(void)
Definition Core.cpp:792
LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef C, unsigned idx)
Definition Core.cpp:1714
LLVMTypeRef LLVMInt64Type(void)
Definition Core.cpp:736
static Module::ModFlagBehavior map_to_llvmModFlagBehavior(LLVMModuleFlagBehavior Behavior)
Definition Core.cpp:359
LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
Definition Core.cpp:1761
#define LLVM_DEFINE_VALUE_CAST(name)
Definition Core.cpp:1180
LLVMBasicBlockRef LLVMAppendBasicBlock(LLVMValueRef FnRef, const char *Name)
Definition Core.cpp:3011
LLVMTypeRef LLVMVoidType(void)
Definition Core.cpp:995
static LLVMValueMetadataEntry * llvm_getMetadata(size_t *NumEntries, llvm::function_ref< void(MetadataEntries &)> AccessMD)
Definition Core.cpp:1152
static GEPNoWrapFlags mapFromLLVMGEPNoWrapFlags(LLVMGEPNoWrapFlags GEPFlags)
Definition Core.cpp:1814
LLVMValueRef LLVMMDString(const char *Str, unsigned SLen)
Definition Core.cpp:1341
LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty)
Definition Core.cpp:1850
static MDNode * extractMDNode(MetadataAsValue *MAV)
Definition Core.cpp:1128
SmallVectorImpl< std::pair< unsigned, MDNode * > > MetadataEntries
Definition Core.cpp:1150
static void LLVMPositionBuilderImpl(IRBuilder<> *Builder, BasicBlock *Block, Instruction *Instr, bool BeforeDbgRecords)
Definition Core.cpp:3482
static LLVMOpcode map_to_llvmopcode(int opcode)
Definition Core.cpp:1792
LLVMTypeRef LLVMBFloatType(void)
Definition Core.cpp:780
LLVMValueRef LLVMConstByteOfString(LLVMTypeRef ByteTy, const char Str[], uint8_t Radix)
Definition Core.cpp:1618
LLVMTypeRef LLVMInt32Type(void)
Definition Core.cpp:733
static LLVMFastMathFlags mapToLLVMFastMathFlags(FastMathFlags FMF)
Definition Core.cpp:3802
static FastMathFlags mapFromLLVMFastMathFlags(LLVMFastMathFlags FMF)
Definition Core.cpp:3789
LLVMTypeRef LLVMHalfType(void)
Definition Core.cpp:777
LLVMTypeRef LLVMIntType(unsigned NumBits)
Definition Core.cpp:742
LLVMTypeRef LLVMX86AMXType(void)
Definition Core.cpp:798
LLVMTypeRef LLVMIntPtrType(LLVMTargetDataRef TD)
Definition Core.cpp:4868
LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char Str[], uint8_t Radix)
Definition Core.cpp:1594
LLVMBuilderRef LLVMCreateBuilderInContext(LLVMContextRef C)
Definition Core.cpp:3468
LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Definition Core.cpp:837
LLVMValueRef LLVMConstInBoundsGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
Definition Core.cpp:1922
static AtomicOrdering mapFromLLVMOrdering(LLVMAtomicOrdering Ordering)
Definition Core.cpp:4122
static Intrinsic::ID llvm_map_to_intrinsic_id(unsigned ID)
Definition Core.cpp:2602
static LLVMModuleFlagBehavior map_from_llvmModFlagBehavior(Module::ModFlagBehavior Behavior)
Definition Core.cpp:378
LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID)
Definition Core.cpp:295
static LLVMAtomicOrdering mapToLLVMOrdering(AtomicOrdering Ordering)
Definition Core.cpp:4138
LLVMValueRef LLVMAlignOf(LLVMTypeRef Ty)
Definition Core.cpp:1844
LLVMTypeRef LLVMX86FP80Type(void)
Definition Core.cpp:789
LLVMBasicBlockRef LLVMInsertBasicBlock(LLVMBasicBlockRef BBRef, const char *Name)
Definition Core.cpp:3022
LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3968
static LLVMValueRef getMDNodeOperandImpl(LLVMContext &Context, const MDNode *N, unsigned Index)
Definition Core.cpp:1241
LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const char Str[], unsigned SLen)
Definition Core.cpp:1638
LLVMTypeRef LLVMPPCFP128Type(void)
Definition Core.cpp:795
LLVMTypeRef LLVMFloatType(void)
Definition Core.cpp:783
static int map_from_llvmopcode(LLVMOpcode code)
Definition Core.cpp:1802
static LLVMAtomicRMWBinOp mapToLLVMRMWBinOp(AtomicRMWInst::BinOp BinOp)
Definition Core.cpp:4192
LLVMTypeRef LLVMLabelType(void)
Definition Core.cpp:998
LLVMValueRef LLVMConstString(const char *Str, unsigned Length, LLVMBool DontNullTerminate)
Definition Core.cpp:1704
unsigned LLVMGetMDKindID(const char *Name, unsigned SLen)
Definition Core.cpp:152
LLVMTypeRef LLVMIntPtrTypeForAS(LLVMTargetDataRef TD, unsigned AS)
Definition Core.cpp:4872
LLVMTypeRef LLVMInt8Type(void)
Definition Core.cpp:727
LLVMTypeRef LLVMDoubleType(void)
Definition Core.cpp:786
LLVMValueRef LLVMConstByteOfStringAndSize(LLVMTypeRef ByteTy, const char Str[], size_t SLen, uint8_t Radix)
Definition Core.cpp:1624
LLVMTypeRef LLVMInt1Type(void)
Definition Core.cpp:724
LLVMBuilderRef LLVMCreateBuilder(void)
Definition Core.cpp:3474
LLVMTypeRef LLVMInt128Type(void)
Definition Core.cpp:739
LLVMValueRef LLVMConstGEPWithNoWrapFlags(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices, LLVMGEPNoWrapFlags NoWrapFlags)
Definition Core.cpp:1933
static AtomicRMWInst::BinOp mapFromLLVMRMWBinOp(LLVMAtomicRMWBinOp BinOp)
Definition Core.cpp:4154
LLVMValueRef LLVMIsABranchInst(LLVMValueRef Val)
Definition Core.cpp:1187
LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal)
Definition Core.cpp:1864
LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const char Str[], unsigned SLen, uint8_t Radix)
Definition Core.cpp:1600
LLVMValueRef LLVMConstGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
Definition Core.cpp:1912
LLVMTypeRef LLVMInt16Type(void)
Definition Core.cpp:730
LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count)
Definition Core.cpp:1372
static LLVMContext & getGlobalContext()
Definition Core.cpp:95
static LLVMGEPNoWrapFlags mapToLLVMGEPNoWrapFlags(GEPNoWrapFlags GEPFlags)
Definition Core.cpp:1826
LLVMContextRef LLVMGetGlobalContext()
Definition Core.cpp:108
Module.h This file contains the declarations for the Module class.
static constexpr Value * getValue(Ty &ValueOrUse)
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
#define H(x, y, z)
Definition MD5.cpp:56
#define T
static constexpr StringLiteral Filename
#define P(N)
if(auto Err=PB.parsePassPipeline(MPM, Passes)) return wrap(std MPM run * Mod
const SmallVectorImpl< MachineOperand > & Cond
static BinaryOperator * CreateMul(Value *S1, Value *S2, const Twine &Name, BasicBlock::iterator InsertBefore, Value *FlagsOp)
static BinaryOperator * CreateAdd(Value *S1, Value *S2, const Twine &Name, BasicBlock::iterator InsertBefore, Value *FlagsOp)
static Instruction * CreateNeg(Value *S1, const Twine &Name, BasicBlock::iterator InsertBefore, Value *FlagsOp)
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
Func MI getDebugLoc()))
Func getContext().diagnose(DiagnosticInfoUnsupported(Func
#define LLVM_DEBUG(...)
Definition Debug.h:119
static SymbolRef::Type getType(const Symbol *Sym)
Definition TapiFile.cpp:39
unify loop Fixup each natural loop to have a single exit block
static Function * getFunction(FunctionType *Ty, const Twine &Name, Module *M)
Value * RHS
Value * LHS
static const uint32_t IV[8]
Definition blake3_impl.h:83
static const fltSemantics & IEEEdouble()
Definition APFloat.h:305
static constexpr roundingMode rmNearestTiesToEven
Definition APFloat.h:361
LLVM_ABI opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
Definition APFloat.cpp:6045
LLVM_ABI double convertToDouble() const
Converts this APFloat to host double value.
Definition APFloat.cpp:6104
Class for arbitrary precision integers.
Definition APInt.h:78
an instruction to allocate memory on the stack
This class represents an incoming formal argument to a Function.
Definition Argument.h:32
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
size_t size() const
Get the array size.
Definition ArrayRef.h:141
iterator begin() const
Definition ArrayRef.h:129
bool empty() const
Check if the array is empty.
Definition ArrayRef.h:136
static LLVM_ABI ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
An instruction that atomically checks whether a specified value is in a memory location,...
an instruction that atomically reads a memory location, combines it with another value,...
BinOp
This enumeration lists the possible modifications atomicrmw can make.
@ Add
*p = old + v
@ FAdd
*p = old + v
@ USubCond
Subtract only if no unsigned overflow.
@ FMinimum
*p = minimum(old, v) minimum matches the behavior of llvm.minimum.
@ Min
*p = old <signed v ? old : v
@ Sub
*p = old - v
@ And
*p = old & v
@ Xor
*p = old ^ v
@ USubSat
*p = usub.sat(old, v) usub.sat matches the behavior of llvm.usub.sat.
@ FMaximum
*p = maximum(old, v) maximum matches the behavior of llvm.maximum.
@ FSub
*p = old - v
@ UIncWrap
Increment one up to a maximum value.
@ Max
*p = old >signed v ? old : v
@ UMin
*p = old <unsigned v ? old : v
@ FMin
*p = minnum(old, v) minnum matches the behavior of llvm.minnum.
@ UMax
*p = old >unsigned v ? old : v
@ FMaximumNum
*p = maximumnum(old, v) maximumnum matches the behavior of llvm.maximumnum.
@ FMax
*p = maxnum(old, v) maxnum matches the behavior of llvm.maxnum.
@ UDecWrap
Decrement one until a minimum value or zero.
@ FMinimumNum
*p = minimumnum(old, v) minimumnum matches the behavior of llvm.minimumnum.
@ Nand
*p = ~(old & v)
Functions, function parameters, and return types can have attributes to indicate how they should be t...
Definition Attributes.h:106
LLVM_ABI bool isStringAttribute() const
Return true if the attribute is a string (target-dependent) attribute.
static LLVM_ABI Attribute::AttrKind getAttrKindFromName(StringRef AttrName)
LLVM_ABI StringRef getKindAsString() const
Return the attribute's kind as a string.
static LLVM_ABI Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
LLVM_ABI std::string getAsString(bool InAttrGrp=false) const
The Attribute is converted to a string of equivalent mnemonic.
LLVM_ABI Attribute::AttrKind getKindAsEnum() const
Return the attribute's kind as an enum (Attribute::AttrKind).
LLVM_ABI StringRef getValueAsString() const
Return the attribute's value as a string.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
Definition Attributes.h:125
@ EndAttrKinds
Sentinel value useful for loops.
Definition Attributes.h:130
LLVM_ABI bool isTypeAttribute() const
Return true if the attribute is a type attribute.
static LLVM_ABI Attribute getWithAlignment(LLVMContext &Context, Align Alignment)
Return a uniquified Attribute object that has the specific alignment set.
LLVM Basic Block Representation.
Definition BasicBlock.h:62
const Function * getParent() const
Return the enclosing method, or null if none.
Definition BasicBlock.h:213
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
Definition BasicBlock.h:206
LLVM_ABI const DataLayout & getDataLayout() const
Get the data layout of the module this basic block belongs to.
InstListType::iterator iterator
Instruction iterators...
Definition BasicBlock.h:170
LLVM_ABI LLVMContext & getContext() const
Get the context in which this basic block lives.
static LLVM_ABI BlockAddress * get(Function *F, BasicBlock *BB)
Return a BlockAddress for the specified function and basic block.
Class to represent byte types.
static LLVM_ABI ByteType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing a ByteType.
Definition Type.cpp:368
static LLVM_ABI 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.
handler_range handlers()
iteration adapter for range-for loops.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition InstrTypes.h:740
static LLVM_ABI Constant * get(ArrayType *T, ArrayRef< Constant * > V)
static ConstantAsMetadata * get(Constant *C)
Definition Metadata.h:548
static LLVM_ABI Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true, bool ByteString=false)
This method constructs a CDS and initializes it with a text string.
static Constant * getRaw(StringRef Data, uint64_t NumElements, Type *ElementTy)
getRaw() constructor - Return a constant with array type with an element count and element type match...
Definition Constants.h:897
static LLVM_ABI Constant * getIntToPtr(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static LLVM_ABI Constant * getExtractElement(Constant *Vec, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
static LLVM_ABI Constant * getAlignOf(Type *Ty)
getAlignOf constant expr - computes the alignment of a type in a target independent way (Note: the re...
static Constant * getNUWSub(Constant *C1, Constant *C2)
Definition Constants.h:1386
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList)
Create an "inbounds" getelementptr.
Definition Constants.h:1529
static LLVM_ABI Constant * getPointerCast(Constant *C, Type *Ty)
Create a BitCast, AddrSpaceCast, or a PtrToInt cast constant expression.
static LLVM_ABI Constant * getTruncOrBitCast(Constant *C, Type *Ty)
static Constant * getNSWAdd(Constant *C1, Constant *C2)
Definition Constants.h:1374
static LLVM_ABI Constant * getSub(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
static LLVM_ABI Constant * getNot(Constant *C)
static Constant * getPtrAdd(Constant *Ptr, Constant *Offset, GEPNoWrapFlags NW=GEPNoWrapFlags::none(), std::optional< ConstantRange > InRange=std::nullopt, Type *OnlyIfReduced=nullptr)
Create a getelementptr i8, ptr, offset constant expression.
Definition Constants.h:1518
static LLVM_ABI Constant * getInsertElement(Constant *Vec, Constant *Elt, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
static LLVM_ABI Constant * getPtrToInt(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_PUSH 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:1477
static LLVM_ABI Constant * getShuffleVector(Constant *V1, Constant *V2, ArrayRef< int > Mask, Type *OnlyIfReducedTy=nullptr)
static LLVM_ABI Constant * getSizeOf(Type *Ty)
getSizeOf constant expr - computes the (alloc) size of a type (in address-units, not bits) in a targe...
static LLVM_ABI Constant * getXor(Constant *C1, Constant *C2)
static Constant * getNSWNeg(Constant *C)
Definition Constants.h:1372
static Constant * getNSWSub(Constant *C1, Constant *C2)
Definition Constants.h:1382
static Constant * getNUWAdd(Constant *C1, Constant *C2)
Definition Constants.h:1378
static LLVM_ABI Constant * getAddrSpaceCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static LLVM_ABI Constant * getAdd(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
static LLVM_ABI Constant * getBitCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static LLVM_ABI Constant * getNeg(Constant *C, bool HasNSW=false)
static LLVM_ABI Constant * getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced=false)
ConstantFP - Floating Point Values [float, double].
Definition Constants.h:420
const APFloat & getValueAPF() const
Definition Constants.h:463
static LLVM_ABI ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
static LLVM_ABI ConstantPtrAuth * get(Constant *Ptr, ConstantInt *Key, ConstantInt *Disc, Constant *AddrDisc, Constant *DeactivationSymbol)
Return a pointer signed with the specified parameters.
This class represents a range of values.
static LLVM_ABI Constant * get(StructType *T, ArrayRef< Constant * > V)
static Constant * getAnon(ArrayRef< Constant * > V, bool Packed=false)
Return an anonymous struct that has the specified elements.
Definition Constants.h:643
static LLVM_ABI Constant * get(ArrayRef< Constant * > V)
This is an important base class in LLVM.
Definition Constant.h:43
static LLVM_ABI Constant * getAllOnesValue(Type *Ty)
static LLVM_ABI Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
Subprogram description. Uses SubclassData1.
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:64
Base class for non-instruction debug metadata records that have positions within IR.
Record of a variable value-assignment, aka a non instruction representation of the dbg....
Basic diagnostic printer that uses an underlying raw_ostream.
Represents either an error or a value T.
Definition ErrorOr.h:56
reference get()
Definition ErrorOr.h:149
std::error_code getError() const
Definition ErrorOr.h:152
This instruction compares its operands according to the predicate given to the constructor.
Convenience struct for specifying and reasoning about fast-math flags.
Definition FMF.h:23
void setAllowContract(bool B=true)
Definition FMF.h:90
bool noSignedZeros() const
Definition FMF.h:67
bool noInfs() const
Definition FMF.h:66
void setAllowReciprocal(bool B=true)
Definition FMF.h:87
bool allowReciprocal() const
Definition FMF.h:68
void setNoSignedZeros(bool B=true)
Definition FMF.h:84
bool allowReassoc() const
Flag queries.
Definition FMF.h:64
bool approxFunc() const
Definition FMF.h:70
void setNoNaNs(bool B=true)
Definition FMF.h:78
void setAllowReassoc(bool B=true)
Flag setters.
Definition FMF.h:75
bool noNaNs() const
Definition FMF.h:65
void setApproxFunc(bool B=true)
Definition FMF.h:93
void setNoInfs(bool B=true)
Definition FMF.h:81
bool allowContract() const
Definition FMF.h:69
An instruction for ordering other memory operations.
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
Definition Type.cpp:843
static LLVM_ABI FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
Definition Function.h:169
BasicBlockListType::iterator iterator
Definition Function.h:70
Argument * arg_iterator
Definition Function.h:73
iterator_range< arg_iterator > args()
Definition Function.h:877
arg_iterator arg_begin()
Definition Function.h:853
Function::iterator insert(Function::iterator Position, BasicBlock *BB)
Insert BB in the basic block list at Position.
Definition Function.h:740
size_t arg_size() const
Definition Function.h:886
Represents flags for the getelementptr instruction/expression.
static GEPNoWrapFlags inBounds()
static GEPNoWrapFlags noUnsignedWrap()
static GEPNoWrapFlags noUnsignedSignedWrap()
bool hasNoUnsignedSignedWrap() const
bool hasNoUnsignedWrap() const
bool isInBounds() const
GEPNoWrapFlags getNoWrapFlags() const
Definition Operator.h:385
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
LLVM_ABI void setNoWrapFlags(GEPNoWrapFlags NW)
Set nowrap flags for GEP instruction.
static LLVM_ABI 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:692
static LLVM_ABI 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:749
void setUnnamedAddr(UnnamedAddr Val)
void setThreadLocalMode(ThreadLocalMode Val)
void setLinkage(LinkageTypes LT)
DLLStorageClassTypes
Storage classes of global values for PE targets.
Definition GlobalValue.h:74
Module * getParent()
Get the module that this global value is contained inside of...
VisibilityTypes
An enumeration for the kinds of visibility of global values.
Definition GlobalValue.h:67
@ PrivateLinkage
Like Internal, but omit from symbol table.
Definition GlobalValue.h:61
@ CommonLinkage
Tentative definitions.
Definition GlobalValue.h:63
@ InternalLinkage
Rename collisions when linking (static functions).
Definition GlobalValue.h:60
@ LinkOnceAnyLinkage
Keep one copy of function when linking (inline)
Definition GlobalValue.h:55
@ WeakODRLinkage
Same, but only replaced by something equivalent.
Definition GlobalValue.h:58
@ ExternalLinkage
Externally visible function.
Definition GlobalValue.h:53
@ WeakAnyLinkage
Keep one copy of named function when linking (weak)
Definition GlobalValue.h:57
@ AppendingLinkage
Special purpose, only applies to global arrays.
Definition GlobalValue.h:59
@ AvailableExternallyLinkage
Available for inspection, not emission.
Definition GlobalValue.h:54
@ ExternalWeakLinkage
ExternalWeak linkage description.
Definition GlobalValue.h:62
@ LinkOnceODRLinkage
Same, but only replaced by something equivalent.
Definition GlobalValue.h:56
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
bool hasInitializer() const
Definitions have initializers, declarations don't.
This instruction compares its operands according to the predicate given to the constructor.
Common base class shared among various IRBuilders.
Definition IRBuilder.h:111
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition IRBuilder.h:2909
static LLVM_ABI 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
Class to represent integer types.
static LLVM_ABI IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition Type.cpp:338
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:76
void(*)(LLVMContext *Context, void *OpaqueHandle) YieldCallbackTy
Defines the type of a yield callback.
An instruction for reading from memory.
static LocalAsMetadata * get(Value *Local)
Definition Metadata.h:574
Metadata node.
Definition Metadata.h:1081
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition Metadata.h:1579
A single uniqued string.
Definition Metadata.h:733
static LLVM_ABI MDString * get(LLVMContext &Context, StringRef Str)
Definition Metadata.cpp:597
static std::unique_ptr< MemoryBuffer > getMemBuffer(StringRef InputData, StringRef BufferName="", bool RequiresNullTerminator=true)
Open the specified memory range as a MemoryBuffer.
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.
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,...
static ErrorOr< std::unique_ptr< MemoryBuffer > > getSTDIN()
Read all of stdin into a file buffer, and return it.
Metadata wrapper in the Value hierarchy.
Definition Metadata.h:184
static LLVM_ABI MetadataAsValue * get(LLVMContext &Context, Metadata *MD)
Definition Metadata.cpp:107
Metadata * getMetadata() const
Definition Metadata.h:202
Root of the metadata hierarchy.
Definition Metadata.h:64
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
global_iterator global_begin()
Definition Module.h:795
ifunc_iterator ifunc_begin()
Definition Module.h:864
ModFlagBehavior
This enumeration defines the supported behaviors of module flags.
Definition Module.h:118
@ AppendUnique
Appends the two values, which are required to be metadata nodes.
Definition Module.h:147
@ Override
Uses the specified value, regardless of the behavior or value of the other module.
Definition Module.h:139
@ Warning
Emits a warning if two values disagree.
Definition Module.h:125
@ Error
Emits an error if two values disagree, otherwise the resulting value is that of the operands.
Definition Module.h:121
@ Append
Appends the two values, which are required to be metadata nodes.
Definition Module.h:142
@ Require
Adds a requirement that another module flag be present and have a specified value after linking is pe...
Definition Module.h:134
global_iterator global_end()
Definition Module.h:797
NamedMDListType::iterator named_metadata_iterator
The named metadata iterators.
Definition Module.h:113
IFuncListType::iterator ifunc_iterator
The Global IFunc iterators.
Definition Module.h:108
named_metadata_iterator named_metadata_begin()
Definition Module.h:905
ifunc_iterator ifunc_end()
Definition Module.h:866
alias_iterator alias_end()
Definition Module.h:848
alias_iterator alias_begin()
Definition Module.h:846
FunctionListType::iterator iterator
The Function iterators.
Definition Module.h:93
GlobalListType::iterator global_iterator
The Global Variable iterator.
Definition Module.h:88
AliasListType::iterator alias_iterator
The Global Alias iterators.
Definition Module.h:103
named_metadata_iterator named_metadata_end()
Definition Module.h:910
A tuple of MDNodes.
Definition Metadata.h:1797
LLVM_ABI StringRef getName() const
Module * getParent()
Get the module that holds this named metadata collection.
Definition Metadata.h:1867
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
static LLVM_ABI PointerType * get(LLVMContext &C, unsigned AddressSpace)
This constructs an opaque pointer to an object in a numbered address space.
Definition Type.cpp:887
static LLVM_ABI PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
A global registry used in conjunction with static constructors to make pluggable components (like tar...
Definition Registry.h:116
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
Definition Record.h:2266
static LLVM_ABI ScalableVectorType * get(Type *ElementType, unsigned MinNumElts)
Definition Type.cpp:865
This instruction constructs a fixed permutation of two input vectors.
ArrayRef< int > getShuffleMask() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An instruction for storing to memory.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
constexpr size_t size() const
Get the string size.
Definition StringRef.h:144
constexpr const char * data() const
Get a pointer to the start of the string (which may not be null terminated).
Definition StringRef.h:138
Class to represent struct types.
static LLVM_ABI 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:467
static LLVM_ABI 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:778
static LLVM_ABI StructType * create(LLVMContext &Context, StringRef Name)
This creates an identified struct.
Definition Type.cpp:662
Class to represent target extensions types, which are generally unintrospectable from target-independ...
static LLVM_ABI 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:936
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
static LLVM_ABI IntegerType * getInt64Ty(LLVMContext &C)
Definition Type.cpp:300
static LLVM_ABI Type * getX86_AMXTy(LLVMContext &C)
Definition Type.cpp:283
static LLVM_ABI Type * getMetadataTy(LLVMContext &C)
Definition Type.cpp:278
static LLVM_ABI Type * getTokenTy(LLVMContext &C)
Definition Type.cpp:279
static LLVM_ABI IntegerType * getInt128Ty(LLVMContext &C)
Definition Type.cpp:301
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
Definition Type.cpp:299
static LLVM_ABI Type * getPPC_FP128Ty(LLVMContext &C)
Definition Type.cpp:282
static LLVM_ABI Type * getFP128Ty(LLVMContext &C)
Definition Type.cpp:281
static LLVM_ABI Type * getLabelTy(LLVMContext &C)
Definition Type.cpp:273
@ X86_AMXTyID
AMX vectors (8192 bits, X86 specific)
Definition Type.h:67
@ FunctionTyID
Functions.
Definition Type.h:73
@ ArrayTyID
Arrays.
Definition Type.h:76
@ TypedPointerTyID
Typed pointer used by some GPU targets.
Definition Type.h:79
@ HalfTyID
16-bit floating point type
Definition Type.h:57
@ TargetExtTyID
Target extension type.
Definition Type.h:80
@ VoidTyID
type with no size
Definition Type.h:64
@ ScalableVectorTyID
Scalable SIMD vector type.
Definition Type.h:78
@ LabelTyID
Labels.
Definition Type.h:65
@ FloatTyID
32-bit floating point type
Definition Type.h:59
@ StructTyID
Structures.
Definition Type.h:75
@ IntegerTyID
Arbitrary bit width integers.
Definition Type.h:71
@ FixedVectorTyID
Fixed width SIMD vector type.
Definition Type.h:77
@ BFloatTyID
16-bit floating point type (7-bit significand)
Definition Type.h:58
@ DoubleTyID
64-bit floating point type
Definition Type.h:60
@ X86_FP80TyID
80-bit floating point type (X87)
Definition Type.h:61
@ PPC_FP128TyID
128-bit floating point type (two 64-bits, PowerPC)
Definition Type.h:63
@ MetadataTyID
Metadata.
Definition Type.h:66
@ TokenTyID
Tokens.
Definition Type.h:68
@ ByteTyID
Arbitrary bit width bytes.
Definition Type.h:72
@ PointerTyID
Pointers.
Definition Type.h:74
@ FP128TyID
128-bit floating point type (112-bit significand)
Definition Type.h:62
static LLVM_ABI Type * getVoidTy(LLVMContext &C)
Definition Type.cpp:272
static LLVM_ABI IntegerType * getInt8Ty(LLVMContext &C)
Definition Type.cpp:297
static LLVM_ABI IntegerType * getInt16Ty(LLVMContext &C)
Definition Type.cpp:298
static LLVM_ABI IntegerType * getInt1Ty(LLVMContext &C)
Definition Type.cpp:296
static LLVM_ABI Type * getDoubleTy(LLVMContext &C)
Definition Type.cpp:277
static LLVM_ABI Type * getX86_FP80Ty(LLVMContext &C)
Definition Type.cpp:280
static LLVM_ABI Type * getFloatTy(LLVMContext &C)
Definition Type.cpp:276
static LLVM_ABI Type * getBFloatTy(LLVMContext &C)
Definition Type.cpp:275
static LLVM_ABI Type * getHalfTy(LLVMContext &C)
Definition Type.cpp:274
static LLVM_ABI UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
A Use represents the edge between a Value definition and its users.
Definition Use.h:35
static LLVM_ABI ValueAsMetadata * get(Value *V)
Definition Metadata.cpp:514
LLVM Value Representation.
Definition Value.h:75
Type * getType() const
All values are typed, get the type of this value.
Definition Value.h:257
LLVMContext & getContext() const
All values hold a context through their type.
Definition Value.h:260
use_iterator_impl< Use > use_iterator
Definition Value.h:355
An efficient, type-erasing, non-owning reference to a callable.
self_iterator getIterator()
Definition ilist_node.h:123
FunctionPassManager manages FunctionPasses.
PassManager manages ModulePassManagers.
A raw_ostream that writes to a file descriptor.
bool has_error() const
Return the value of the flag in this raw_fd_ostream indicating whether an output error has been encou...
std::error_code error() const
void close()
Manually flush the stream and close the file.
A raw_ostream that writes to an std::string.
ilist_select_iterator_type< OptionsT, false, false > iterator
CallInst * Call
LLVMTypeRef LLVMGetTypeByName2(LLVMContextRef C, const char *Name)
Obtain a Type from a context by its registered name.
Definition Core.cpp:893
LLVMBool LLVMIsEnumAttribute(LLVMAttributeRef A)
Check for the different types of attributes.
Definition Core.cpp:249
LLVMTypeRef LLVMGetTypeAttributeValue(LLVMAttributeRef A)
Get the type attribute's value.
Definition Core.cpp:193
void LLVMContextSetDiagnosticHandler(LLVMContextRef C, LLVMDiagnosticHandler Handler, void *DiagnosticContext)
Set the diagnostic handler for this context.
Definition Core.cpp:110
LLVMAttributeRef LLVMCreateDenormalFPEnvAttribute(LLVMContextRef C, LLVMDenormalModeKind DefaultModeOutput, LLVMDenormalModeKind DefaultModeInput, LLVMDenormalModeKind FloatModeOutput, LLVMDenormalModeKind FloatModeInput)
Create a DenormalFPEnv attribute.
Definition Core.cpp:212
const char * LLVMGetStringAttributeValue(LLVMAttributeRef A, unsigned *Length)
Get the string attribute's value.
Definition Core.cpp:242
uint64_t LLVMGetEnumAttributeValue(LLVMAttributeRef A)
Get the enum attribute's value.
Definition Core.cpp:179
LLVMDenormalModeKind
Represent different denormal handling kinds for use with LLVMCreateDenormalFPEnvAttribute.
Definition Core.h:753
LLVMBool LLVMIsStringAttribute(LLVMAttributeRef A)
Definition Core.cpp:254
LLVMAttributeRef LLVMCreateConstantRangeAttribute(LLVMContextRef C, unsigned KindID, unsigned NumBits, const uint64_t LowerWords[], const uint64_t UpperWords[])
Create a ConstantRange attribute.
Definition Core.cpp:198
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:160
LLVMDiagnosticHandler LLVMContextGetDiagnosticHandler(LLVMContextRef C)
Get the diagnostic handler of this context.
Definition Core.cpp:119
void LLVMContextSetYieldCallback(LLVMContextRef C, LLVMYieldCallback Callback, void *OpaqueHandle)
Set the yield callback function for this context.
Definition Core.cpp:128
char * LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI)
Return a string representation of the DiagnosticInfo.
Definition Core.cpp:262
LLVMAttributeRef LLVMCreateStringAttribute(LLVMContextRef C, const char *K, unsigned KLength, const char *V, unsigned VLength)
Create a string attribute.
Definition Core.cpp:228
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:156
void LLVMContextSetDiscardValueNames(LLVMContextRef C, LLVMBool Discard)
Set whether the given context discards all value names.
Definition Core.cpp:139
unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char *Name, unsigned SLen)
Definition Core.cpp:147
unsigned LLVMGetEnumAttributeKind(LLVMAttributeRef A)
Get the unique id corresponding to the enum attribute passed as argument.
Definition Core.cpp:175
void * LLVMContextGetDiagnosticContext(LLVMContextRef C)
Get the diagnostic context of this context.
Definition Core.cpp:124
LLVMAttributeRef LLVMCreateTypeAttribute(LLVMContextRef C, unsigned KindID, LLVMTypeRef type_ref)
Create a type attribute.
Definition Core.cpp:186
unsigned LLVMGetLastEnumAttributeKind(void)
Definition Core.cpp:164
LLVMBool LLVMContextShouldDiscardValueNames(LLVMContextRef C)
Retrieve whether the given context is set to discard all value names.
Definition Core.cpp:135
LLVMBool LLVMIsTypeAttribute(LLVMAttributeRef A)
Definition Core.cpp:258
void LLVMContextDispose(LLVMContextRef C)
Destroy a context instance.
Definition Core.cpp:143
void(* LLVMYieldCallback)(LLVMContextRef, void *)
Definition Core.h:594
LLVMAttributeRef LLVMCreateEnumAttribute(LLVMContextRef C, unsigned KindID, uint64_t Val)
Create an enum attribute.
Definition Core.cpp:168
const char * LLVMGetStringAttributeKind(LLVMAttributeRef A, unsigned *Length)
Get the string attribute's kind.
Definition Core.cpp:235
LLVMContextRef LLVMContextCreate()
Create a new context.
Definition Core.cpp:104
void(* LLVMDiagnosticHandler)(LLVMDiagnosticInfoRef, void *)
Definition Core.h:593
LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI)
Return an enum LLVMDiagnosticSeverity.
Definition Core.cpp:272
LLVMTargetDataRef LLVMGetModuleDataLayout(LLVMModuleRef M)
Obtain the data layout for a module.
Definition Core.cpp:4837
LLVMTargetDataRef LLVMCreateTargetData(const char *StringRep)
Creates target data from a target layout string.
Definition Core.cpp:4845
unsigned LLVMPreferredAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the preferred alignment of a type in bytes for a target.
Definition Core.cpp:4906
unsigned LLVMCallFrameAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the call frame alignment of a type in bytes for a target.
Definition Core.cpp:4902
unsigned long long LLVMOffsetOfElement(LLVMTargetDataRef TD, LLVMTypeRef StructTy, unsigned Element)
Computes the byte offset of the indexed struct element for a target.
Definition Core.cpp:4923
void LLVMDisposeTargetData(LLVMTargetDataRef TD)
Deallocates a TargetData.
Definition Core.cpp:4849
LLVMByteOrdering LLVMByteOrder(LLVMTargetDataRef TD)
Returns the byte order of a target, either LLVMBigEndian or LLVMLittleEndian.
Definition Core.cpp:4856
unsigned LLVMPreferredAlignmentOfGlobal(LLVMTargetDataRef TD, LLVMValueRef GlobalVar)
Computes the preferred alignment of a global variable in bytes for a target.
Definition Core.cpp:4910
unsigned long long LLVMStoreSizeOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the storage size of a type in bytes for a target.
Definition Core.cpp:4890
LLVMByteOrdering
Definition Core.h:5425
unsigned long long LLVMABISizeOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the ABI size of a type in bytes for a target.
Definition Core.cpp:4894
unsigned LLVMPointerSizeForAS(LLVMTargetDataRef TD, unsigned AS)
Returns the pointer size in bytes for a target for a specified address space.
Definition Core.cpp:4864
unsigned LLVMABIAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the ABI alignment of a type in bytes for a target.
Definition Core.cpp:4898
unsigned LLVMElementAtOffset(LLVMTargetDataRef TD, LLVMTypeRef StructTy, unsigned long long Offset)
Computes the structure element that contains the byte offset for a target.
Definition Core.cpp:4917
LLVMTypeRef LLVMIntPtrTypeInContext(LLVMContextRef C, LLVMTargetDataRef TD)
Returns the integer type that is the same size as a pointer on a target.
Definition Core.cpp:4877
char * LLVMCopyStringRepOfTargetData(LLVMTargetDataRef TD)
Converts target data to a target layout string.
Definition Core.cpp:4851
unsigned LLVMPointerSize(LLVMTargetDataRef TD)
Returns the pointer size in bytes for a target.
Definition Core.cpp:4860
LLVMTypeRef LLVMIntPtrTypeForASInContext(LLVMContextRef C, LLVMTargetDataRef TD, unsigned AS)
Returns the integer type that is the same size as a pointer on a target.
Definition Core.cpp:4881
void LLVMSetModuleDataLayout(LLVMModuleRef M, LLVMTargetDataRef DL)
Set the data layout for a module.
Definition Core.cpp:4841
unsigned long long LLVMSizeOfTypeInBits(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the size of a type in bits for a target.
Definition Core.cpp:4886
@ LLVMBigEndian
Definition Core.h:5425
@ LLVMLittleEndian
Definition Core.h:5425
LLVMValueRef LLVMBuildAggregateRet(LLVMBuilderRef B, LLVMValueRef *RetVals, unsigned N)
Definition Core.cpp:3598
LLVMValueRef LLVMBuildMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3862
LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef B)
Definition Core.cpp:3590
LLVMValueRef LLVMBuildSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3842
LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3872
LLVMBool LLVMGetWeak(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4304
LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4432
LLVMValueRef LLVMBuildIsNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4575
LLVMValueRef LLVMBuildGEPWithNoWrapFlags(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name, LLVMGEPNoWrapFlags NoWrapFlags)
Creates a GetElementPtr instruction.
Definition Core.cpp:4262
LLVMValueRef LLVMBuildAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3822
void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak)
Definition Core.cpp:4308
LLVMValueRef LLVMBuildOr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3942
LLVMValueRef LLVMBuildBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4404
LLVMValueRef LLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3887
LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition Core.cpp:4247
LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3847
void LLVMPositionBuilderBeforeInstrAndDbgRecords(LLVMBuilderRef Builder, LLVMValueRef Instr)
Set the builder position before Instr and any attached debug records.
Definition Core.cpp:3507
LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4580
void LLVMDisposeBuilder(LLVMBuilderRef Builder)
Definition Core.cpp:3535
void LLVMClearInsertionPosition(LLVMBuilderRef Builder)
Definition Core.cpp:3522
LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PersFn, unsigned NumClauses, const char *Name)
Definition Core.cpp:3664
void LLVMSetIsDisjoint(LLVMValueRef Inst, LLVMBool IsDisjoint)
Sets the disjoint flag for the instruction.
Definition Core.cpp:4045
LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst)
Definition Core.cpp:4658
LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn)
Definition Core.cpp:3694
void LLVMSetAtomicRMWBinOp(LLVMValueRef Inst, LLVMAtomicRMWBinOp BinOp)
Definition Core.cpp:4343
LLVMValueRef LLVMBuildFDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3902
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:3650
LLVMValueRef LLVMBuildXor(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3947
LLVMValueRef LLVMBuildBitExtract(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Src, LLVMValueRef Offset, const char *Name)
Definition Core.cpp:4568
LLVMBool LLVMGetExact(LLVMValueRef DivOrShrInst)
Definition Core.cpp:4004
LLVMValueRef LLVMBuildAddrSpaceCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4409
unsigned LLVMGetNumMaskElements(LLVMValueRef SVInst)
Get the number of elements in the mask of a ShuffleVector instruction.
Definition Core.cpp:4640
void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr)
Definition Core.cpp:3526
LLVMValueRef LLVMBuildCleanupRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition Core.cpp:3715
LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4369
void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers)
Obtain the basic blocks acting as handlers for a catchswitch instruction.
Definition Core.cpp:3762
LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4349
LLVMValueRef LLVMGetArgOperand(LLVMValueRef Funclet, unsigned i)
Definition Core.cpp:3779
LLVMValueRef LLVMBuildAnd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3937
unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch)
Definition Core.cpp:3758
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:3622
LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder)
Definition Core.cpp:3518
LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3892
LLVMValueRef LLVMBuildSExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4420
LLVMValueRef LLVMBuildCall2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:4489
void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW)
Definition Core.cpp:3999
LLVMMetadataRef LLVMGetCurrentDebugLocation2(LLVMBuilderRef Builder)
Get location information used by debugging information.
Definition Core.cpp:3541
LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3882
LLVMValueRef LLVMBuildSelect(LLVMBuilderRef B, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, const char *Name)
Definition Core.cpp:4512
void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr)
Set the builder position before Instr but after any attached debug records.
Definition Core.cpp:3502
LLVMBool LLVMCanValueUseFastMathFlags(LLVMValueRef V)
Check if a given value can potentially have fast math flags.
Definition Core.cpp:4035
void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value)
Definition Core.cpp:3783
LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef B, LLVMValueRef If, LLVMBasicBlockRef Then, LLVMBasicBlockRef Else)
Definition Core.cpp:3607
LLVMBool LLVMGetNUW(LLVMValueRef ArithInst)
Definition Core.cpp:3984
LLVMOpcode LLVMGetCastOpcode(LLVMValueRef Src, LLVMBool SrcIsSigned, LLVMTypeRef DestTy, LLVMBool DestIsSigned)
Definition Core.cpp:4461
void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr, const char *Name)
Definition Core.cpp:3530
LLVMValueRef LLVMBuildSRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3912
LLVMValueRef LLVMBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:3683
LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Deprecated: This cast is always signed.
Definition Core.cpp:4450
LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder)
Deprecated: Returning the NULL location will crash.
Definition Core.cpp:3558
LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef Index, const char *Name)
Definition Core.cpp:4524
LLVMValueRef LLVMBuildShl(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3922
LLVMValueRef LLVMBuildCatchRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition Core.cpp:3709
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:4089
LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemAccessInst)
Definition Core.cpp:4312
LLVMValueRef LLVMBuildStructGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, unsigned Idx, const char *Name)
Definition Core.cpp:4272
int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt)
Get the mask value at position Elt in the mask of a ShuffleVector instruction.
Definition Core.cpp:4646
void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal, LLVMBasicBlockRef Dest)
Definition Core.cpp:3725
LLVMValueRef LLVMBuildBr(LLVMBuilderRef B, LLVMBasicBlockRef Dest)
Definition Core.cpp:3603
LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, const char *Name)
Definition Core.cpp:4530
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:3495
void LLVMSetFastMathFlags(LLVMValueRef FPMathInst, LLVMFastMathFlags FMF)
Sets the flags for which fast-math-style optimizations are allowed for this value.
Definition Core.cpp:4030
LLVMValueRef LLVMBuildIntCast2(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, LLVMBool IsSigned, const char *Name)
Definition Core.cpp:4443
LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3852
LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3837
LLVMValueRef LLVMBuildCatchPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:3676
LLVMValueRef LLVMBuildCallWithOperandBundles(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name)
Definition Core.cpp:4498
LLVMBool LLVMIsCleanup(LLVMValueRef LandingPad)
Definition Core.cpp:3746
LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4414
LLVMBool LLVMGetVolatile(LLVMValueRef Inst)
Definition Core.cpp:4289
LLVMValueRef LLVMBuildFPCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4456
LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4394
LLVMValueRef LLVMBuildPtrDiff2(LLVMBuilderRef B, LLVMTypeRef ElemTy, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4585
LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4426
LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4103
LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx)
Definition Core.cpp:3738
unsigned LLVMGetAtomicSyncScopeID(LLVMValueRef AtomicInst)
Returns the synchronization scope ID of an atomic instruction.
Definition Core.cpp:4677
LLVMValueRef LLVMBuildVAArg(LLVMBuilderRef B, LLVMValueRef List, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4519
LLVMValueRef LLVMBuildAtomicCmpXchgSyncScope(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, unsigned SSID)
Definition Core.cpp:4629
LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3952
LLVMBool LLVMIsAtomic(LLVMValueRef Inst)
Returns whether an instruction is an atomic instruction, e.g., atomicrmw, cmpxchg,...
Definition Core.cpp:4654
void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile)
Definition Core.cpp:4293
void LLVMSetAtomicSingleThread(LLVMValueRef AtomicInst, LLVMBool NewValue)
Definition Core.cpp:4667
LLVMValueRef LLVMBuildFRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3917
LLVMValueRef LLVMBuildURem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3907
LLVMValueRef LLVMBuildIntToPtr(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4399
LLVMBool LLVMGetNSW(LLVMValueRef ArithInst)
Definition Core.cpp:3994
LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3867
LLVMValueRef LLVMBuildFree(LLVMBuilderRef B, LLVMValueRef PointerVal)
Definition Core.cpp:4108
LLVMValueRef LLVMBuildNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3959
LLVMValueRef LLVMBuildFSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3857
LLVMValueRef LLVMBuildCatchSwitch(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMBasicBlockRef UnwindBB, unsigned NumHandlers, const char *Name)
Definition Core.cpp:3698
LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name)
Definition Core.cpp:4112
LLVMValueRef LLVMBuildInBoundsGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition Core.cpp:4254
LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4062
LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, LLVMBool singleThread)
Definition Core.cpp:4616
LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr, unsigned NumDests)
Definition Core.cpp:3617
LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef B)
Definition Core.cpp:3721
LLVMValueRef LLVMBuildSIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4379
LLVMValueRef LLVMBuildSExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4359
LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4364
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:3564
void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Builder, LLVMMetadataRef Loc)
Set location information used by debugging information.
Definition Core.cpp:3545
LLVMBuilderRef LLVMCreateBuilderForModule(LLVMModuleRef M)
Definition Core.cpp:3478
LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4098
void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L)
Deprecated: Passing the NULL location will crash.
Definition Core.cpp:3552
LLVMValueRef LLVMBuildPhi(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4485
void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest)
Definition Core.cpp:3730
LLVMBool LLVMGetNNeg(LLVMValueRef NonNegInst)
Gets if the instruction has the non-negative flag set.
Definition Core.cpp:4014
LLVMValueRef LLVMBuildAtomicRMWSyncScope(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, unsigned SSID)
Definition Core.cpp:4605
LLVMValueRef LLVMBuildRet(LLVMBuilderRef B, LLVMValueRef V)
Definition Core.cpp:3594
LLVMMetadataRef LLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder)
Get the dafult floating-point math metadata for a given builder.
Definition Core.cpp:3584
LLVMValueRef LLVMBuildExtractValue(LLVMBuilderRef B, LLVMValueRef AggVal, unsigned Index, const char *Name)
Definition Core.cpp:4544
LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str, const char *Name)
Deprecated: Use LLVMBuildGlobalString instead, which has identical behavior.
Definition Core.cpp:4284
LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3827
void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block)
Definition Core.cpp:3513
LLVMValueRef LLVMBuildFMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3877
LLVMValueRef LLVMBuildLShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3927
LLVMAtomicRMWBinOp LLVMGetAtomicRMWBinOp(LLVMValueRef Inst)
Definition Core.cpp:4339
LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3976
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:4073
void LLVMSetAtomicSyncScopeID(LLVMValueRef AtomicInst, unsigned SSID)
Sets the synchronization scope ID of an atomic instruction.
Definition Core.cpp:4683
LLVMContextRef LLVMGetBuilderContext(LLVMBuilderRef Builder)
Obtain the context to which this builder is associated.
Definition Core.cpp:3580
LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4052
LLVMValueRef LLVMBuildFreeze(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4556
LLVMValueRef LLVMBuildGlobalString(LLVMBuilderRef B, const char *Str, const char *Name)
Definition Core.cpp:4279
void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW)
Definition Core.cpp:3989
LLVMAtomicOrdering LLVMGetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4689
LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef B, LLVMRealPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4476
LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4438
LLVMValueRef LLVMBuildExactSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3897
LLVMValueRef LLVMBuildShuffleVector(LLVMBuilderRef B, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, const char *Name)
Definition Core.cpp:4537
LLVMValueRef LLVMBuildFPExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4389
void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val)
Definition Core.cpp:3750
LLVMValueRef LLVMBuildICmp(LLVMBuilderRef B, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4469
void LLVMSetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4707
void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal)
Definition Core.cpp:3742
LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, LLVMBool isSingleThread, const char *Name)
Definition Core.cpp:4231
void LLVMSetParentCatchSwitch(LLVMValueRef CatchPad, LLVMValueRef CatchSwitch)
Set the parent catchswitch instruction of a catchpad instruction.
Definition Core.cpp:3772
LLVMValueRef LLVMBuildFenceSyncScope(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, unsigned SSID, const char *Name)
Definition Core.cpp:4240
LLVMValueRef LLVMBuildUIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4374
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:3489
unsigned LLVMGetNumClauses(LLVMValueRef LandingPad)
Definition Core.cpp:3734
int LLVMGetUndefMaskElem(void)
Definition Core.cpp:4652
void LLVMSetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4694
LLVMValueRef LLVMGetParentCatchSwitch(LLVMValueRef CatchPad)
Get the parent catchswitch instruction of a catchpad instruction.
Definition Core.cpp:3768
LLVMFastMathFlags LLVMGetFastMathFlags(LLVMValueRef FPMathInst)
Get the flags for which fast-math-style optimizations are allowed for this value.
Definition Core.cpp:4024
LLVMBool LLVMGetIsDisjoint(LLVMValueRef Inst)
Gets whether the instruction has the disjoint flag set.
Definition Core.cpp:4040
LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef B, LLVMValueRef V, LLVMBasicBlockRef Else, unsigned NumCases)
Definition Core.cpp:3612
void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg)
Sets the non-negative flag for the instruction.
Definition Core.cpp:4019
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:4080
void LLVMAddHandler(LLVMValueRef CatchSwitch, LLVMBasicBlockRef Dest)
Definition Core.cpp:3754
void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact)
Definition Core.cpp:4009
LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3963
LLVMValueRef LLVMBuildAShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3932
LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, const char *Name)
Definition Core.cpp:3641
LLVMValueRef LLVMBuildBitInsert(LLVMBuilderRef B, LLVMValueRef Base, LLVMValueRef Val, LLVMValueRef Offset, const char *Name)
Definition Core.cpp:4561
void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4326
LLVMValueRef LLVMBuildFPTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4384
LLVMValueRef LLVMBuildStore(LLVMBuilderRef B, LLVMValueRef Val, LLVMValueRef PointerVal)
Definition Core.cpp:4117
void LLVMAddMetadataToInst(LLVMBuilderRef Builder, LLVMValueRef Inst)
Same as LLVMSetInstDebugLocation.
Definition Core.cpp:3568
LLVMAtomicOrdering LLVMGetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4702
LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3832
LLVMValueRef LLVMBuildInsertValue(LLVMBuilderRef B, LLVMValueRef AggVal, LLVMValueRef EltVal, unsigned Index, const char *Name)
Definition Core.cpp:4549
void LLVMBuilderSetDefaultFPMathTag(LLVMBuilderRef Builder, LLVMMetadataRef FPMathTag)
Set the default floating-point math metadata for the given builder.
Definition Core.cpp:3572
LLVMValueRef LLVMBuildZExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4354
LLVMValueRef LLVMBuildNot(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3980
LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, LLVMBool singleThread)
Definition Core.cpp:4594
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange(const char *InputData, size_t InputDataLength, const char *BufferName, LLVMBool RequiresNullTerminator)
Definition Core.cpp:4754
size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4779
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData, size_t InputDataLength, const char *BufferName)
Definition Core.cpp:4765
const char * LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4775
LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const char *Path, LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
Definition Core.cpp:4729
LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
Definition Core.cpp:4743
void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4783
LLVMModuleProviderRef LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M)
Changes the type of M so it can be passed to FunctionPassManagers and the JIT.
Definition Core.cpp:4718
void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP)
Destroys the module M.
Definition Core.cpp:4722
char * LLVMPrintModuleToString(LLVMModuleRef M)
Return a string representation of the module.
Definition Core.cpp:491
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:1443
LLVMValueRef LLVMGetNamedFunctionWithLength(LLVMModuleRef M, const char *Name, size_t Length)
Obtain a Function value from a Module by its name.
Definition Core.cpp:2542
unsigned LLVMGetDebugLocColumn(LLVMValueRef Val)
Return the column number of the debug location for this value, which must be an llvm::Instruction.
Definition Core.cpp:1571
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:1438
LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID, LLVMContextRef C)
Create a new, empty module in a specific context.
Definition Core.cpp:299
const char * LLVMGetTarget(LLVMModuleRef M)
Obtain the target triple for a module.
Definition Core.cpp:342
LLVMBool LLVMGetInlineAsmCanUnwind(LLVMValueRef InlineAsmVal)
Get if the inline asm snippet may unwind the stack.
Definition Core.cpp:600
const char * LLVMGetModuleInlineAsm(LLVMModuleRef M, size_t *Len)
Get inline assembly for a module.
Definition Core.cpp:514
LLVMBool LLVMGetInlineAsmNeedsAlignedStack(LLVMValueRef InlineAsmVal)
Get if the inline asm snippet needs an aligned stack.
Definition Core.cpp:595
LLVMBool LLVMGetInlineAsmHasSideEffects(LLVMValueRef InlineAsmVal)
Get if the inline asm snippet has side effects.
Definition Core.cpp:590
unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char *Name)
Obtain the number of operands for named metadata in a module.
Definition Core.cpp:1474
void LLVMDumpModule(LLVMModuleRef M)
Dump a representation of a module to stderr.
Definition Core.cpp:463
void LLVMSetTarget(LLVMModuleRef M, const char *TripleStr)
Set the target triple for a module.
Definition Core.cpp:346
LLVMTypeRef LLVMGetInlineAsmFunctionType(LLVMValueRef InlineAsmVal)
Get the function type of the inline assembly snippet.
Definition Core.cpp:585
LLVMBool LLVMIsNewDbgInfoFormat(LLVMModuleRef M)
Soon to be deprecated.
Definition Core.cpp:453
LLVMContextRef LLVMGetModuleContext(LLVMModuleRef M)
Obtain the context to which this module is associated.
Definition Core.cpp:606
LLVMInlineAsmDialect LLVMGetInlineAsmDialect(LLVMValueRef InlineAsmVal)
Get the dialect used by the inline asm snippet.
Definition Core.cpp:569
void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm)
Deprecated: Use LLVMSetModuleInlineAsm2 instead.
Definition Core.cpp:506
LLVMValueRef LLVMGetNextFunction(LLVMValueRef Fn)
Advance a Function iterator to the next Function.
Definition Core.cpp:2563
const char * LLVMGetModuleIdentifier(LLVMModuleRef M, size_t *Len)
Obtain the identifier of a module.
Definition Core.cpp:308
const char * LLVMGetSourceFileName(LLVMModuleRef M, size_t *Len)
Obtain the module's original source file name.
Definition Core.cpp:318
const char * LLVMGetDataLayoutStr(LLVMModuleRef M)
Obtain the data layout for a module.
Definition Core.cpp:329
LLVMModuleFlagBehavior LLVMModuleFlagEntriesGetFlagBehavior(LLVMModuleFlagEntry *Entries, unsigned Index)
Returns the flag behavior for a module flag entry at a specific index.
Definition Core.cpp:419
void LLVMSetIsNewDbgInfoFormat(LLVMModuleRef M, LLVMBool UseNewFormat)
Soon to be deprecated.
Definition Core.cpp:455
LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name)
Deprecated: Use LLVMGetTypeByName2 instead.
Definition Core.cpp:889
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:314
const char * LLVMGetInlineAsmAsmString(LLVMValueRef InlineAsmVal, size_t *Len)
Get the template string used for an inline assembly snippet.
Definition Core.cpp:551
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:531
LLVMValueRef LLVMGetOrInsertFunction(LLVMModuleRef M, const char *Name, size_t NameLen, LLVMTypeRef FunctionTy)
Obtain or insert a function into a module.
Definition Core.cpp:2530
const char * LLVMGetInlineAsmConstraintString(LLVMValueRef InlineAsmVal, size_t *Len)
Get the raw constraint string for an inline assembly snippet.
Definition Core.cpp:560
LLVMNamedMDNodeRef LLVMGetNextNamedMetadata(LLVMNamedMDNodeRef NMD)
Advance a NamedMDNode iterator to the next NamedMDNode.
Definition Core.cpp:1422
void LLVMGetNamedMetadataOperands(LLVMModuleRef M, const char *Name, LLVMValueRef *Dest)
Obtain the named metadata operands for a module.
Definition Core.cpp:1481
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:441
LLVMValueRef LLVMAddFunction(LLVMModuleRef M, const char *Name, LLVMTypeRef FunctionTy)
Add a function to a module under a specified name.
Definition Core.cpp:2524
LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn)
Decrement a Function iterator to the previous Function.
Definition Core.cpp:2571
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:1501
void LLVMAddNamedMetadataOperand(LLVMModuleRef M, const char *Name, LLVMValueRef Val)
Add an operand to named metadata.
Definition Core.cpp:1491
unsigned LLVMGetDebugLocLine(LLVMValueRef Val)
Return the line number of the debug location for this value, which must be an llvm::Instruction,...
Definition Core.cpp:1549
LLVMMetadataRef LLVMModuleFlagEntriesGetMetadata(LLVMModuleFlagEntry *Entries, unsigned Index)
Returns the metadata for a module flag entry at a specific index.
Definition Core.cpp:434
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:446
LLVMValueRef LLVMGetLastFunction(LLVMModuleRef M)
Obtain an iterator to the last Function in a Module.
Definition Core.cpp:2555
LLVMNamedMDNodeRef LLVMGetPreviousNamedMetadata(LLVMNamedMDNodeRef NMD)
Decrement a NamedMDNode iterator to the previous NamedMDNode.
Definition Core.cpp:1430
const char * LLVMGetNamedMetadataName(LLVMNamedMDNodeRef NMD, size_t *NameLen)
Retrieve the name of a NamedMDNode.
Definition Core.cpp:1448
LLVMValueRef LLVMGetNamedFunction(LLVMModuleRef M, const char *Name)
Obtain a Function value from a Module by its name.
Definition Core.cpp:2538
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:1525
void LLVMAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm, size_t Len)
Append inline assembly to a module.
Definition Core.cpp:510
void LLVMSetDataLayout(LLVMModuleRef M, const char *DataLayoutStr)
Set the data layout for a module.
Definition Core.cpp:337
void LLVMDisposeModuleFlagsMetadata(LLVMModuleFlagEntry *Entries)
Destroys module flags metadata entries.
Definition Core.cpp:414
void LLVMDisposeModule(LLVMModuleRef M)
Destroy a module instance.
Definition Core.cpp:304
LLVMNamedMDNodeRef LLVMGetLastNamedMetadata(LLVMModuleRef M)
Obtain an iterator to the last NamedMDNode in a Module.
Definition Core.cpp:1414
void LLVMSetModuleInlineAsm2(LLVMModuleRef M, const char *Asm, size_t Len)
Set inline assembly for a module.
Definition Core.cpp:502
LLVMValueRef LLVMGetFirstFunction(LLVMModuleRef M)
Obtain an iterator to the first Function in a Module.
Definition Core.cpp:2547
LLVMNamedMDNodeRef LLVMGetFirstNamedMetadata(LLVMModuleRef M)
Obtain an iterator to the first NamedMDNode in a Module.
Definition Core.cpp:1406
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:426
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:324
LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename, char **ErrorMessage)
Print a representation of a module to a file.
Definition Core.cpp:468
const char * LLVMGetDataLayout(LLVMModuleRef M)
Definition Core.cpp:333
LLVMModuleFlagEntry * LLVMCopyModuleFlagsMetadata(LLVMModuleRef M, size_t *Len)
Returns the module flags as an array of flag-key-value triples.
Definition Core.cpp:397
LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, size_t TagLen, LLVMValueRef *Args, unsigned NumArgs)
Create a new operand bundle.
Definition Core.cpp:2889
unsigned LLVMGetNumOperandBundleArgs(LLVMOperandBundleRef Bundle)
Obtain the number of operands for an operand bundle.
Definition Core.cpp:2906
const char * LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len)
Obtain the tag of an operand bundle as a string.
Definition Core.cpp:2900
void LLVMDisposeOperandBundle(LLVMOperandBundleRef Bundle)
Destroy an operand bundle.
Definition Core.cpp:2896
LLVMValueRef LLVMGetOperandBundleArgAtIndex(LLVMOperandBundleRef Bundle, unsigned Index)
Obtain the operand for an operand bundle at the given index.
Definition Core.cpp:2910
LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef P)
Deprecated: Use LLVMCreateFunctionPassManagerForModule instead.
Definition Core.cpp:4797
LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M)
Constructs a new function-by-function pass pipeline over the module provider.
Definition Core.cpp:4793
LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM)
Finalizes all of the function passes scheduled in the function pass manager.
Definition Core.cpp:4814
void LLVMDisposePassManager(LLVMPassManagerRef PM)
Frees the memory of a pass pipeline.
Definition Core.cpp:4818
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:4810
LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM)
Initializes all of the function passes scheduled in the function pass manager.
Definition Core.cpp:4806
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:4802
LLVMPassManagerRef LLVMCreatePassManager()
Constructs a new whole-module pass pipeline.
Definition Core.cpp:4789
void LLVMStopMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
Definition Core.cpp:4828
LLVMBool LLVMStartMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
Definition Core.cpp:4824
LLVMBool LLVMIsMultithreaded()
Check whether LLVM is executing in thread-safe mode or not.
Definition Core.cpp:4831
LLVMTypeRef LLVMByteTypeInContext(LLVMContextRef C, unsigned NumBits)
Obtain a byte type from a context with specified bit width.
Definition Core.cpp:692
unsigned LLVMGetByteTypeWidth(LLVMTypeRef ByteTy)
Definition Core.cpp:696
LLVMTypeRef LLVMHalfTypeInContext(LLVMContextRef C)
Obtain a 16-bit floating point type from a context.
Definition Core.cpp:752
LLVMTypeRef LLVMBFloatTypeInContext(LLVMContextRef C)
Obtain a 16-bit brain floating point type from a context.
Definition Core.cpp:755
LLVMTypeRef LLVMPPCFP128TypeInContext(LLVMContextRef C)
Obtain a 128-bit floating point type (two 64-bits) from a context.
Definition Core.cpp:770
LLVMTypeRef LLVMDoubleTypeInContext(LLVMContextRef C)
Obtain a 64-bit floating point type from a context.
Definition Core.cpp:761
LLVMTypeRef LLVMFloatTypeInContext(LLVMContextRef C)
Obtain a 32-bit floating point type from a context.
Definition Core.cpp:758
LLVMTypeRef LLVMFP128TypeInContext(LLVMContextRef C)
Obtain a 128-bit floating point type (112-bit mantissa) from a context.
Definition Core.cpp:767
LLVMTypeRef LLVMX86FP80TypeInContext(LLVMContextRef C)
Obtain a 80-bit floating point type (X87) from a context.
Definition Core.cpp:764
LLVMTypeRef LLVMGetReturnType(LLVMTypeRef FunctionTy)
Obtain the Type this function Type returns.
Definition Core.cpp:815
LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType, LLVMTypeRef *ParamTypes, unsigned ParamCount, LLVMBool IsVarArg)
Obtain a function type consisting of a specified signature.
Definition Core.cpp:804
LLVMBool LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy)
Returns whether a function type is variadic.
Definition Core.cpp:811
unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy)
Obtain the number of parameters this function accepts.
Definition Core.cpp:819
void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest)
Obtain the types of a function's parameters.
Definition Core.cpp:823
LLVMTypeRef LLVMInt1TypeInContext(LLVMContextRef C)
Obtain an integer type from a context with specified bit width.
Definition Core.cpp:702
LLVMTypeRef LLVMInt8TypeInContext(LLVMContextRef C)
Definition Core.cpp:705
LLVMTypeRef LLVMInt32TypeInContext(LLVMContextRef C)
Definition Core.cpp:711
LLVMTypeRef LLVMIntTypeInContext(LLVMContextRef C, unsigned NumBits)
Definition Core.cpp:720
LLVMTypeRef LLVMInt64TypeInContext(LLVMContextRef C)
Definition Core.cpp:714
LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C)
Definition Core.cpp:708
unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy)
Definition Core.cpp:746
LLVMTypeRef LLVMInt128TypeInContext(LLVMContextRef C)
Definition Core.cpp:717
unsigned LLVMGetTargetExtTypeNumTypeParams(LLVMTypeRef TargetExtTy)
Obtain the number of type parameters for this target extension type.
Definition Core.cpp:1018
LLVMTypeRef LLVMX86AMXTypeInContext(LLVMContextRef C)
Create a X86 AMX type in a context.
Definition Core.cpp:773
const char * LLVMGetTargetExtTypeName(LLVMTypeRef TargetExtTy)
Obtain the name for this target extension type.
Definition Core.cpp:1013
LLVMTypeRef LLVMVoidTypeInContext(LLVMContextRef C)
Create a void type in a context.
Definition Core.cpp:982
LLVMTypeRef LLVMTokenTypeInContext(LLVMContextRef C)
Create a token type in a context.
Definition Core.cpp:988
unsigned LLVMGetTargetExtTypeNumIntParams(LLVMTypeRef TargetExtTy)
Obtain the number of int parameters for this target extension type.
Definition Core.cpp:1029
LLVMTypeRef LLVMLabelTypeInContext(LLVMContextRef C)
Create a label type in a context.
Definition Core.cpp:985
LLVMTypeRef LLVMMetadataTypeInContext(LLVMContextRef C)
Create a metadata type in a context.
Definition Core.cpp:991
LLVMTypeRef LLVMGetTargetExtTypeTypeParam(LLVMTypeRef TargetExtTy, unsigned Idx)
Get the type parameter at the given index for the target extension type.
Definition Core.cpp:1023
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:1002
unsigned LLVMGetTargetExtTypeIntParam(LLVMTypeRef TargetExtTy, unsigned Idx)
Get the int parameter at the given index for the target extension type.
Definition Core.cpp:1034
LLVMValueRef LLVMGetConstantPtrAuthAddrDiscriminator(LLVMValueRef PtrAuth)
Get the address discriminator value for the associated ConstantPtrAuth constant.
Definition Core.cpp:972
LLVMBool LLVMPointerTypeIsOpaque(LLVMTypeRef Ty)
Determine whether a pointer is opaque.
Definition Core.cpp:920
LLVMTypeRef LLVMPointerTypeInContext(LLVMContextRef C, unsigned AddressSpace)
Create an opaque pointer type in a context.
Definition Core.cpp:978
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:924
LLVMTypeRef LLVMGetElementType(LLVMTypeRef WrappedTy)
Obtain the element type of an array or vector type.
Definition Core.cpp:933
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:928
LLVMValueRef LLVMGetConstantPtrAuthDiscriminator(LLVMValueRef PtrAuth)
Get the discriminator value for the associated ConstantPtrAuth constant.
Definition Core.cpp:968
uint64_t LLVMGetArrayLength2(LLVMTypeRef ArrayTy)
Obtain the length of an array type.
Definition Core.cpp:948
LLVMValueRef LLVMGetConstantPtrAuthKey(LLVMValueRef PtrAuth)
Get the key value for the associated ConstantPtrAuth constant.
Definition Core.cpp:964
unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy)
Obtain the length of an array type.
Definition Core.cpp:944
LLVMValueRef LLVMGetConstantPtrAuthPointer(LLVMValueRef PtrAuth)
Get the pointer value for the associated ConstantPtrAuth constant.
Definition Core.cpp:960
unsigned LLVMGetPointerAddressSpace(LLVMTypeRef PointerTy)
Obtain the address space of a pointer type.
Definition Core.cpp:952
LLVMTypeRef LLVMArrayType2(LLVMTypeRef ElementType, uint64_t ElementCount)
Create a fixed size array type that refers to a specific type.
Definition Core.cpp:911
unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy)
Obtain the (possibly scalable) number of elements in a vector type.
Definition Core.cpp:956
LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount)
Create a fixed size array type that refers to a specific type.
Definition Core.cpp:907
void LLVMGetSubtypes(LLVMTypeRef Tp, LLVMTypeRef *Arr)
Returns type's subtypes.
Definition Core.cpp:899
LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace)
Create a pointer type that points to a defined type.
Definition Core.cpp:915
unsigned LLVMGetNumContainedTypes(LLVMTypeRef Tp)
Return the number of types in the derived type.
Definition Core.cpp:940
LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Create a new structure type in a context.
Definition Core.cpp:831
void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest)
Get the elements within a structure.
Definition Core.cpp:866
LLVMTypeRef LLVMStructGetTypeAtIndex(LLVMTypeRef StructTy, unsigned i)
Get the type of the element at a given index in the structure.
Definition Core.cpp:872
LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy)
Determine whether a structure is packed.
Definition Core.cpp:877
LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name)
Create an empty structure in a context having a specified name.
Definition Core.cpp:843
void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Set the contents of a structure type.
Definition Core.cpp:856
LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy)
Determine whether a structure is opaque.
Definition Core.cpp:881
unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy)
Get the number of elements defined inside the structure.
Definition Core.cpp:862
const char * LLVMGetStructName(LLVMTypeRef Ty)
Obtain the name of a structure.
Definition Core.cpp:848
LLVMBool LLVMIsLiteralStruct(LLVMTypeRef StructTy)
Determine whether a structure is literal.
Definition Core.cpp:885
void LLVMDumpType(LLVMTypeRef Ty)
Dump a representation of a type to stderr.
Definition Core.cpp:674
LLVMBool LLVMTypeIsSized(LLVMTypeRef Ty)
Whether the type has a known size.
Definition Core.cpp:665
LLVMContextRef LLVMGetTypeContext(LLVMTypeRef Ty)
Obtain the context to which this type instance is associated.
Definition Core.cpp:670
char * LLVMPrintTypeToString(LLVMTypeRef Ty)
Return a string representation of the type.
Definition Core.cpp:678
LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty)
Obtain the enumerated type of a Type instance.
Definition Core.cpp:615
LLVMTailCallKind
Tail call kind for LLVMSetTailCallKind and LLVMGetTailCallKind.
Definition Core.h:505
LLVMLinkage
Definition Core.h:182
LLVMOpcode
External users depend on the following values being stable.
Definition Core.h:63
LLVMRealPredicate
Definition Core.h:316
LLVMTypeKind
Definition Core.h:157
LLVMDLLStorageClass
Definition Core.h:217
LLVMValueKind
Definition Core.h:267
unsigned LLVMAttributeIndex
Definition Core.h:496
LLVMDbgRecordKind
Definition Core.h:549
LLVMIntPredicate
Definition Core.h:303
unsigned LLVMFastMathFlags
Flags to indicate what fast-math-style optimizations are allowed on operations.
Definition Core.h:533
LLVMUnnamedAddr
Definition Core.h:211
LLVMModuleFlagBehavior
Definition Core.h:433
LLVMDiagnosticSeverity
Definition Core.h:421
LLVMVisibility
Definition Core.h:205
LLVMAtomicRMWBinOp
Definition Core.h:370
LLVMThreadLocalMode
Definition Core.h:335
unsigned LLVMGEPNoWrapFlags
Flags that constrain the allowed wrap semantics of a getelementptr instruction.
Definition Core.h:547
LLVMAtomicOrdering
Definition Core.h:343
LLVMInlineAsmDialect
Definition Core.h:428
@ LLVMDLLImportLinkage
Obsolete.
Definition Core.h:196
@ LLVMInternalLinkage
Rename collisions when linking (static functions)
Definition Core.h:193
@ LLVMLinkOnceAnyLinkage
Keep one copy of function when linking (inline)
Definition Core.h:185
@ LLVMExternalLinkage
Externally visible function.
Definition Core.h:183
@ LLVMExternalWeakLinkage
ExternalWeak linkage description.
Definition Core.h:198
@ LLVMLinkOnceODRLinkage
Same, but only replaced by something equivalent.
Definition Core.h:186
@ LLVMPrivateLinkage
Like Internal, but omit from symbol table.
Definition Core.h:195
@ LLVMDLLExportLinkage
Obsolete.
Definition Core.h:197
@ LLVMLinkerPrivateLinkage
Like Private, but linker removes.
Definition Core.h:201
@ LLVMWeakODRLinkage
Same, but only replaced by something equivalent.
Definition Core.h:190
@ LLVMGhostLinkage
Obsolete.
Definition Core.h:199
@ LLVMWeakAnyLinkage
Keep one copy of function when linking (weak)
Definition Core.h:189
@ LLVMAppendingLinkage
Special purpose, only applies to global arrays.
Definition Core.h:192
@ LLVMCommonLinkage
Tentative definitions.
Definition Core.h:200
@ LLVMLinkOnceODRAutoHideLinkage
Obsolete.
Definition Core.h:188
@ LLVMLinkerPrivateWeakLinkage
Like LinkerPrivate, but is weak.
Definition Core.h:202
@ LLVMAvailableExternallyLinkage
Definition Core.h:184
@ LLVMFastMathAllowReassoc
Definition Core.h:513
@ LLVMFastMathNoSignedZeros
Definition Core.h:516
@ LLVMFastMathApproxFunc
Definition Core.h:519
@ LLVMFastMathNoInfs
Definition Core.h:515
@ LLVMFastMathNoNaNs
Definition Core.h:514
@ LLVMFastMathNone
Definition Core.h:520
@ LLVMFastMathAllowContract
Definition Core.h:518
@ LLVMFastMathAllowReciprocal
Definition Core.h:517
@ LLVMGEPFlagInBounds
Definition Core.h:536
@ LLVMGEPFlagNUSW
Definition Core.h:537
@ LLVMGEPFlagNUW
Definition Core.h:538
@ LLVMHalfTypeKind
16 bit floating point type
Definition Core.h:159
@ LLVMFP128TypeKind
128 bit floating point type (112-bit mantissa)
Definition Core.h:163
@ LLVMIntegerTypeKind
Arbitrary bit width integers.
Definition Core.h:166
@ LLVMPointerTypeKind
Pointers.
Definition Core.h:170
@ LLVMX86_FP80TypeKind
80 bit floating point type (X87)
Definition Core.h:162
@ LLVMX86_AMXTypeKind
X86 AMX.
Definition Core.h:177
@ LLVMMetadataTypeKind
Metadata.
Definition Core.h:172
@ LLVMByteTypeKind
Arbitrary bit width bytes.
Definition Core.h:179
@ LLVMScalableVectorTypeKind
Scalable SIMD vector type.
Definition Core.h:175
@ LLVMArrayTypeKind
Arrays.
Definition Core.h:169
@ LLVMBFloatTypeKind
16 bit brain floating point type
Definition Core.h:176
@ LLVMStructTypeKind
Structures.
Definition Core.h:168
@ LLVMLabelTypeKind
Labels.
Definition Core.h:165
@ LLVMDoubleTypeKind
64 bit floating point type
Definition Core.h:161
@ LLVMVoidTypeKind
type with no size
Definition Core.h:158
@ LLVMTokenTypeKind
Tokens.
Definition Core.h:174
@ LLVMFloatTypeKind
32 bit floating point type
Definition Core.h:160
@ LLVMFunctionTypeKind
Functions.
Definition Core.h:167
@ LLVMVectorTypeKind
Fixed width SIMD vector type.
Definition Core.h:171
@ LLVMPPC_FP128TypeKind
128 bit floating point type (two 64-bits)
Definition Core.h:164
@ LLVMTargetExtTypeKind
Target extension type.
Definition Core.h:178
@ LLVMInstructionValueKind
Definition Core.h:297
@ LLVMDbgRecordValue
Definition Core.h:552
@ LLVMDbgRecordDeclare
Definition Core.h:551
@ LLVMDbgRecordLabel
Definition Core.h:550
@ LLVMDbgRecordAssign
Definition Core.h:553
@ LLVMGlobalUnnamedAddr
Address of the GV is globally insignificant.
Definition Core.h:214
@ LLVMLocalUnnamedAddr
Address of the GV is locally insignificant.
Definition Core.h:213
@ LLVMNoUnnamedAddr
Address of the GV is significant.
Definition Core.h:212
@ LLVMModuleFlagBehaviorRequire
Adds a requirement that another module flag be present and have a specified value after linking is pe...
Definition Core.h:459
@ LLVMModuleFlagBehaviorWarning
Emits a warning if two values disagree.
Definition Core.h:447
@ LLVMModuleFlagBehaviorOverride
Uses the specified value, regardless of the behavior or value of the other module.
Definition Core.h:467
@ LLVMModuleFlagBehaviorAppendUnique
Appends the two values, which are required to be metadata nodes.
Definition Core.h:481
@ LLVMModuleFlagBehaviorAppend
Appends the two values, which are required to be metadata nodes.
Definition Core.h:473
@ LLVMModuleFlagBehaviorError
Emits an error if two values disagree, otherwise the resulting value is that of the operands.
Definition Core.h:440
@ LLVMDSWarning
Definition Core.h:423
@ LLVMDSNote
Definition Core.h:425
@ LLVMDSError
Definition Core.h:422
@ LLVMDSRemark
Definition Core.h:424
@ LLVMAtomicRMWBinOpXor
Xor a value and return the old one.
Definition Core.h:377
@ LLVMAtomicRMWBinOpXchg
Set the new value and return the one old.
Definition Core.h:371
@ LLVMAtomicRMWBinOpSub
Subtract a value and return the old one.
Definition Core.h:373
@ LLVMAtomicRMWBinOpUMax
Sets the value if it's greater than the original using an unsigned comparison and return the old one.
Definition Core.h:384
@ LLVMAtomicRMWBinOpUSubSat
Subtracts the value, clamping to zero.
Definition Core.h:406
@ LLVMAtomicRMWBinOpAnd
And a value and return the old one.
Definition Core.h:374
@ LLVMAtomicRMWBinOpUDecWrap
Decrements the value, wrapping back to the input value when decremented below zero.
Definition Core.h:402
@ LLVMAtomicRMWBinOpFMax
Sets the value if it's greater than the original using an floating point comparison and return the ol...
Definition Core.h:394
@ LLVMAtomicRMWBinOpMin
Sets the value if it's Smaller than the original using a signed comparison and return the old one.
Definition Core.h:381
@ LLVMAtomicRMWBinOpOr
OR a value and return the old one.
Definition Core.h:376
@ LLVMAtomicRMWBinOpFMin
Sets the value if it's smaller than the original using an floating point comparison and return the ol...
Definition Core.h:397
@ LLVMAtomicRMWBinOpMax
Sets the value if it's greater than the original using a signed comparison and return the old one.
Definition Core.h:378
@ LLVMAtomicRMWBinOpFMaximum
Sets the value if it's greater than the original using an floating point comparison and return the ol...
Definition Core.h:407
@ LLVMAtomicRMWBinOpFMinimum
Sets the value if it's smaller than the original using an floating point comparison and return the ol...
Definition Core.h:410
@ LLVMAtomicRMWBinOpFMinimumNum
Sets the value if it's smaller than the original using an floating point comparison and return the ol...
Definition Core.h:416
@ LLVMAtomicRMWBinOpUIncWrap
Increments the value, wrapping back to zero when incremented above input value.
Definition Core.h:400
@ LLVMAtomicRMWBinOpFMaximumNum
Sets the value if it's greater than the original using an floating point comparison and return the ol...
Definition Core.h:413
@ LLVMAtomicRMWBinOpFAdd
Add a floating point value and return the old one.
Definition Core.h:390
@ LLVMAtomicRMWBinOpFSub
Subtract a floating point value and return the old one.
Definition Core.h:392
@ LLVMAtomicRMWBinOpAdd
Add a value and return the old one.
Definition Core.h:372
@ LLVMAtomicRMWBinOpUMin
Sets the value if it's greater than the original using an unsigned comparison and return the old one.
Definition Core.h:387
@ LLVMAtomicRMWBinOpNand
Not-And a value and return the old one.
Definition Core.h:375
@ LLVMAtomicRMWBinOpUSubCond
Subtracts the value only if no unsigned overflow.
Definition Core.h:404
@ LLVMGeneralDynamicTLSModel
Definition Core.h:337
@ LLVMLocalDynamicTLSModel
Definition Core.h:338
@ LLVMNotThreadLocal
Definition Core.h:336
@ LLVMInitialExecTLSModel
Definition Core.h:339
@ LLVMLocalExecTLSModel
Definition Core.h:340
@ LLVMAtomicOrderingAcquireRelease
provides both an Acquire and a Release barrier (for fences and operations which both read and write m...
Definition Core.h:356
@ LLVMAtomicOrderingRelease
Release is similar to Acquire, but with a barrier of the sort necessary to release a lock.
Definition Core.h:353
@ LLVMAtomicOrderingAcquire
Acquire provides a barrier of the sort necessary to acquire a lock to access other memory with normal...
Definition Core.h:350
@ LLVMAtomicOrderingMonotonic
guarantees that if you take all the operations affecting a specific address, a consistent ordering ex...
Definition Core.h:347
@ LLVMAtomicOrderingSequentiallyConsistent
provides Acquire semantics for loads and Release semantics for stores.
Definition Core.h:360
@ LLVMAtomicOrderingNotAtomic
A load or store which is not atomic.
Definition Core.h:344
@ LLVMAtomicOrderingUnordered
Lowest level of atomicity, guarantees somewhat sane results, lock free.
Definition Core.h:345
@ LLVMInlineAsmDialectATT
Definition Core.h:429
@ LLVMInlineAsmDialectIntel
Definition Core.h:430
LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB)
Obtain the last instruction in a basic block.
Definition Core.cpp:3057
void LLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to after another one.
Definition Core.cpp:3039
LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn)
Obtain the first basic block in a function.
Definition Core.cpp:2955
LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C, const char *Name)
Create a new basic block without inserting it into a function.
Definition Core.cpp:2987
LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB)
Go backwards in a basic block iterator.
Definition Core.cpp:2979
LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn)
Obtain the last basic block in a function.
Definition Core.cpp:2963
LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB)
Obtain the terminator instruction for a basic block.
Definition Core.cpp:2937
const char * LLVMGetBasicBlockName(LLVMBasicBlockRef BB)
Obtain the string name of a basic block.
Definition Core.cpp:2929
void LLVMAppendExistingBasicBlock(LLVMValueRef Fn, LLVMBasicBlockRef BB)
Append the given basic block to the basic block list of the given function.
Definition Core.cpp:3000
void LLVMDeleteBasicBlock(LLVMBasicBlockRef BBRef)
Remove a basic block from a function and delete it.
Definition Core.cpp:3027
LLVMBasicBlockRef LLVMInsertBasicBlockInContext(LLVMContextRef C, LLVMBasicBlockRef BBRef, const char *Name)
Insert a basic block in a function before another basic block.
Definition Core.cpp:3015
void LLVMGetBasicBlocks(LLVMValueRef FnRef, LLVMBasicBlockRef *BasicBlocksRefs)
Obtain all of the basic blocks in a function.
Definition Core.cpp:2945
void LLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to before another one.
Definition Core.cpp:3035
LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB)
Obtain the function to which a basic block belongs.
Definition Core.cpp:2933
LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn)
Obtain the basic block that corresponds to the entry point of a function.
Definition Core.cpp:2951
LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB)
Obtain the first instruction in a basic block.
Definition Core.cpp:3049
void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder, LLVMBasicBlockRef BB)
Insert the given basic block after the insertion point of the given builder.
Definition Core.cpp:2992
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB)
Convert a basic block instance to a value type.
Definition Core.cpp:2917
LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val)
Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
Definition Core.cpp:2925
void LLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BBRef)
Remove a basic block from a function.
Definition Core.cpp:3031
LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB)
Advance a basic block iterator.
Definition Core.cpp:2971
unsigned LLVMCountBasicBlocks(LLVMValueRef FnRef)
Obtain the number of basic blocks in a function.
Definition Core.cpp:2941
LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C, LLVMValueRef FnRef, const char *Name)
Append a basic block to the end of a function.
Definition Core.cpp:3005
LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val)
Determine whether an LLVMValueRef is itself a basic block.
Definition Core.cpp:2921
LLVMValueRef LLVMConstantPtrAuth(LLVMValueRef Ptr, LLVMValueRef Key, LLVMValueRef Disc, LLVMValueRef AddrDisc)
Create a ConstantPtrAuth constant with the given values.
Definition Core.cpp:1781
LLVMValueRef LLVMGetAggregateElement(LLVMValueRef C, unsigned Idx)
Get element of a constant aggregate (struct, array or vector) at the specified index.
Definition Core.cpp:1710
LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size)
Create a ConstantVector from values.
Definition Core.cpp:1776
LLVMValueRef LLVMConstStringInContext2(LLVMContextRef C, const char *Str, size_t Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential and initialize it with a string.
Definition Core.cpp:1695
LLVMValueRef LLVMConstDataArray(LLVMTypeRef ElementTy, const char *Data, size_t SizeInBytes)
Create a ConstantDataArray from raw values.
Definition Core.cpp:1746
LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, unsigned Length)
Create a ConstantArray from values.
Definition Core.cpp:1734
LLVMBool LLVMIsConstantString(LLVMValueRef C)
Returns true if the specified constant is an array of i8.
Definition Core.cpp:1718
LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str, unsigned Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential and initialize it with a string.
Definition Core.cpp:1686
LLVMValueRef LLVMConstArray2(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, uint64_t Length)
Create a ConstantArray from values.
Definition Core.cpp:1740
const char * LLVMGetAsString(LLVMValueRef C, size_t *Length)
Get the given constant data sequential as a string.
Definition Core.cpp:1722
LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy, LLVMValueRef *ConstantVals, unsigned Count)
Create a non-anonymous ConstantStruct from values.
Definition Core.cpp:1767
const char * LLVMGetRawDataValues(LLVMValueRef C, size_t *SizeInBytes)
Get the raw, underlying bytes of the given constant data sequential.
Definition Core.cpp:1728
LLVMValueRef LLVMConstStructInContext(LLVMContextRef C, LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
Create an anonymous ConstantStruct with the specified values.
Definition Core.cpp:1753
LLVMValueRef LLVMConstAddrSpaceCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1988
LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1873
LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1890
LLVMValueRef LLVMConstPtrAdd(LLVMValueRef ConstantVal, LLVMValueRef ConstantOffset, LLVMGEPNoWrapFlags NoWrapFlags)
Creates a constant ptradd expression (getelementptr i8).
Definition Core.cpp:1947
LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1994
LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1983
LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1901
LLVMOpcode LLVMGetConstOpcode(LLVMValueRef ConstantVal)
Definition Core.cpp:1840
LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, LLVMValueRef IndexConstant)
Definition Core.cpp:2006
LLVMValueRef LLVMConstPtrAddFromIndices(LLVMTargetDataRef DataLayout, LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices, LLVMGEPNoWrapFlags NoWrapFlags)
Creates a constant ptradd expression (getelementptr i8) by converting the provided GEP indices for th...
Definition Core.cpp:1955
LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1878
LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal)
Definition Core.cpp:1856
LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:2000
LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant, LLVMValueRef ElementValueConstant, LLVMValueRef IndexConstant)
Definition Core.cpp:2012
LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1907
LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1895
LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant, LLVMValueRef VectorBConstant, LLVMValueRef MaskConstant)
Definition Core.cpp:2020
LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1968
LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB)
Definition Core.cpp:2038
LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal)
Definition Core.cpp:1869
LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1884
LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1973
LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1978
LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString, const char *Constraints, LLVMBool HasSideEffects, LLVMBool IsAlignStack)
Deprecated: Use LLVMGetInlineAsm instead.
Definition Core.cpp:2030
LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal)
Definition Core.cpp:1860
LLVMValueRef LLVMGetBlockAddressFunction(LLVMValueRef BlockAddr)
Gets the function associated with a given BlockAddress constant value.
Definition Core.cpp:2042
LLVMBasicBlockRef LLVMGetBlockAddressBasicBlock(LLVMValueRef BlockAddr)
Gets the basic block associated with a given BlockAddress constant value.
Definition Core.cpp:2046
void LLVMSetDSOLocal(LLVMValueRef Global, LLVMBool IsDSOLocal)
Sets whether the global value is marked as dso_local.
Definition Core.cpp:2213
LLVMUnnamedAddr LLVMGetUnnamedAddress(LLVMValueRef Global)
Definition Core.cpp:2184
LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global)
Returns the "value type" of a global value.
Definition Core.cpp:2227
unsigned LLVMGetAlignment(LLVMValueRef V)
Obtain the preferred alignment of the value.
Definition Core.cpp:2233
void LLVMSetSection(LLVMValueRef Global, const char *Section)
Definition Core.cpp:2160
void LLVMSetUnnamedAddress(LLVMValueRef Global, LLVMUnnamedAddr UnnamedAddr)
Definition Core.cpp:2196
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:2308
void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage)
Definition Core.cpp:2089
void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr)
Deprecated: Use LLVMSetUnnamedAddress instead.
Definition Core.cpp:2221
LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global)
Definition Core.cpp:2052
LLVMBool LLVMIsDSOLocal(LLVMValueRef Global)
Returns whether the global value is marked as dso_local, i.e.
Definition Core.cpp:2209
unsigned LLVMValueMetadataEntriesGetKind(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the kind of a value metadata entry at a specific index.
Definition Core.cpp:2289
void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class)
Definition Core.cpp:2179
LLVMVisibility LLVMGetVisibility(LLVMValueRef Global)
Definition Core.cpp:2164
LLVMValueMetadataEntry * LLVMGlobalCopyAllMetadata(LLVMValueRef Value, size_t *NumEntries)
Retrieves an array of metadata entries representing the metadata attached to this value.
Definition Core.cpp:2277
void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes)
Set the preferred alignment of the value.
Definition Core.cpp:2255
const char * LLVMGetSection(LLVMValueRef Global)
Definition Core.cpp:2154
void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz)
Definition Core.cpp:2169
LLVMLinkage LLVMGetLinkage(LLVMValueRef Global)
Definition Core.cpp:2060
void LLVMGlobalEraseMetadata(LLVMValueRef Global, unsigned Kind)
Erases a metadata attachment of the given kind if it exists.
Definition Core.cpp:2318
LLVMDLLStorageClass LLVMGetDLLStorageClass(LLVMValueRef Global)
Definition Core.cpp:2174
LLVMBool LLVMIsDeclaration(LLVMValueRef Global)
Definition Core.cpp:2056
void LLVMGlobalClearMetadata(LLVMValueRef Global)
Removes all metadata attachments from this value.
Definition Core.cpp:2322
void LLVMGlobalAddMetadata(LLVMValueRef Global, unsigned Kind, LLVMMetadataRef MD)
Adds a metadata attachment.
Definition Core.cpp:2313
LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global)
Deprecated: Use LLVMGetUnnamedAddress instead.
Definition Core.cpp:2217
LLVMMetadataRef LLVMValueMetadataEntriesGetMetadata(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the underlying metadata node of a value metadata entry at a specific index.
Definition Core.cpp:2297
void LLVMDisposeValueMetadataEntries(LLVMValueMetadataEntry *Entries)
Destroys value metadata entries.
Definition Core.cpp:2304
void LLVMGlobalAddDebugInfo(LLVMValueRef Global, LLVMMetadataRef GVE)
Add debuginfo metadata to this global.
Definition Core.cpp:2326
LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N, LLVMBool SignExtend)
Obtain a constant value for an integer type.
Definition Core.cpp:1581
LLVMValueRef LLVMConstFPFromBits(LLVMTypeRef Ty, const uint64_t N[])
Obtain a constant for a floating point value from array of 64 bit values.
Definition Core.cpp:1643
LLVMValueRef LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy, unsigned NumWords, const uint64_t Words[])
Obtain a constant value for an integer of arbitrary precision.
Definition Core.cpp:1586
long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal)
Obtain the sign extended value for an integer constant value.
Definition Core.cpp:1655
unsigned long long LLVMConstByteGetZExtValue(LLVMValueRef ConstantVal)
Obtain the zero extended value for a byte constant value.
Definition Core.cpp:1659
LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text)
Obtain a constant for a floating point value parsed from a string.
Definition Core.cpp:1634
LLVMValueRef LLVMConstByteOfArbitraryPrecision(LLVMTypeRef ByteTy, unsigned NumWords, const uint64_t Words[])
Obtain a constant value for a byte of arbitrary precision.
Definition Core.cpp:1610
double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *LosesInfo)
Obtain the double value for an floating point constant value.
Definition Core.cpp:1667
LLVMValueRef LLVMConstByte(LLVMTypeRef ByteTy, unsigned long long N)
Obtain a constant value for a byte type.
Definition Core.cpp:1606
LLVMValueRef LLVMConstReal(LLVMTypeRef RealTy, double N)
Obtain a constant value referring to a double floating point value.
Definition Core.cpp:1630
long long LLVMConstByteGetSExtValue(LLVMValueRef ConstantVal)
Obtain the sign extended value for a byte constant value.
Definition Core.cpp:1663
unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal)
Obtain the zero extended value for an integer constant value.
Definition Core.cpp:1651
LLVMValueRef LLVMGetPoison(LLVMTypeRef Ty)
Obtain a constant value referring to a poison value of a type.
Definition Core.cpp:1296
LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty)
Obtain a constant that is a constant pointer pointing to NULL for a specified type.
Definition Core.cpp:1318
LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty)
Obtain a constant value referring to an undefined value of a type.
Definition Core.cpp:1292
LLVMBool LLVMIsNull(LLVMValueRef Val)
Determine whether a value instance is null.
Definition Core.cpp:1304
LLVMValueRef LLVMConstNull(LLVMTypeRef Ty)
Obtain a constant value referring to the null instance of a type.
Definition Core.cpp:1284
LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty)
Obtain a constant value referring to the instance of a type consisting of all ones.
Definition Core.cpp:1288
LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg)
Obtain the previous parameter to a function.
Definition Core.cpp:2810
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align)
Set the alignment for a function parameter.
Definition Core.cpp:2817
unsigned LLVMCountParams(LLVMValueRef FnRef)
Obtain the number of parameters in a function.
Definition Core.cpp:2765
void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs)
Obtain the parameters in a function.
Definition Core.cpp:2771
LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn)
Obtain the first parameter to a function.
Definition Core.cpp:2786
LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn)
Obtain the last parameter to a function.
Definition Core.cpp:2794
LLVMValueRef LLVMGetParam(LLVMValueRef FnRef, unsigned index)
Obtain the parameter at the specified index.
Definition Core.cpp:2777
LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg)
Obtain the next parameter to a function.
Definition Core.cpp:2802
LLVMValueRef LLVMGetParamParent(LLVMValueRef V)
Obtain the function to which this argument belongs.
Definition Core.cpp:2782
char * LLVMIntrinsicCopyOverloadedName2(LLVMModuleRef Mod, unsigned ID, LLVMTypeRef *OverloadTypes, size_t OverloadCount, size_t *NameLength)
Copies the name of an overloaded intrinsic identified by a given list of overload types.
Definition Core.cpp:2641
void LLVMAddAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Add an attribute to a function.
Definition Core.cpp:2715
LLVMValueRef LLVMGetPrefixData(LLVMValueRef Fn)
Gets the prefix data associated with a function.
Definition Core.cpp:2683
LLVMValueRef LLVMGetPrologueData(LLVMValueRef Fn)
Gets the prologue data associated with a function.
Definition Core.cpp:2699
unsigned LLVMGetIntrinsicID(LLVMValueRef Fn)
Obtain the ID number from a function instance.
Definition Core.cpp:2596
LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn)
Obtain the personality function attached to the function.
Definition Core.cpp:2587
unsigned LLVMGetAttributeCountAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx)
Definition Core.cpp:2720
LLVMBool LLVMHasPersonalityFn(LLVMValueRef Fn)
Check whether the given function has a personality function.
Definition Core.cpp:2583
void LLVMRemoveStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:2751
void LLVMSetPrefixData(LLVMValueRef Fn, LLVMValueRef prefixData)
Sets the prefix data for the function.
Definition Core.cpp:2693
const char * LLVMGetGC(LLVMValueRef Fn)
Obtain the name of the garbage collector to use during code generation.
Definition Core.cpp:2670
char * LLVMIntrinsicCopyOverloadedName(unsigned ID, LLVMTypeRef *OverloadTypes, size_t OverloadCount, size_t *NameLength)
Deprecated: Use LLVMIntrinsicCopyOverloadedName2 instead.
Definition Core.cpp:2631
void LLVMSetGC(LLVMValueRef Fn, const char *GC)
Define the garbage collector to use during code generation.
Definition Core.cpp:2675
void LLVMSetPrologueData(LLVMValueRef Fn, LLVMValueRef prologueData)
Sets the prologue data for the function.
Definition Core.cpp:2709
void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn)
Set the personality function attached to the function.
Definition Core.cpp:2591
void LLVMGetAttributesAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
Definition Core.cpp:2725
unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn)
Obtain the calling function of a function.
Definition Core.cpp:2661
LLVMBool LLVMIntrinsicIsOverloaded(unsigned ID)
Obtain if the intrinsic identified by the given ID is overloaded.
Definition Core.cpp:2656
void LLVMDeleteFunction(LLVMValueRef Fn)
Remove a function from its containing module and deletes it.
Definition Core.cpp:2579
void LLVMRemoveEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:2746
LLVMAttributeRef LLVMGetEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:2732
unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen)
Obtain the intrinsic ID number which matches the given function name.
Definition Core.cpp:2652
const char * LLVMIntrinsicGetName(unsigned ID, size_t *NameLength)
Retrieves the name of an intrinsic.
Definition Core.cpp:2616
LLVMValueRef LLVMGetIntrinsicDeclaration(LLVMModuleRef Mod, unsigned ID, LLVMTypeRef *OverloadTypes, size_t OverloadCount)
Get or insert the declaration of an intrinsic.
Definition Core.cpp:2607
LLVMBool LLVMHasPrologueData(LLVMValueRef Fn)
Check if a given function has prologue data.
Definition Core.cpp:2704
LLVMBool LLVMHasPrefixData(LLVMValueRef Fn)
Check if a given function has prefix data.
Definition Core.cpp:2688
void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC)
Set the calling convention of a function.
Definition Core.cpp:2665
LLVMTypeRef LLVMIntrinsicGetType(LLVMContextRef Ctx, unsigned ID, LLVMTypeRef *OverloadTypes, size_t OverloadCount)
Retrieves the type of an intrinsic.
Definition Core.cpp:2623
void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A, const char *V)
Add a target-dependent attribute to a function.
Definition Core.cpp:2756
LLVMAttributeRef LLVMGetStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:2739
LLVMValueRef LLVMIsAMDString(LLVMValueRef Val)
Definition Core.cpp:1208
LLVMBool LLVMIsPoison(LLVMValueRef Val)
Determine whether a value instance is poisonous.
Definition Core.cpp:1314
LLVMValueKind LLVMGetValueKind(LLVMValueRef Val)
Obtain the enumerated type of a Value instance.
Definition Core.cpp:1047
void LLVMDumpValue(LLVMValueRef Val)
Dump a representation of a value to stderr.
Definition Core.cpp:1077
const char * LLVMGetValueName(LLVMValueRef Val)
Deprecated: Use LLVMGetValueName2 instead.
Definition Core.cpp:1069
LLVMContextRef LLVMGetValueContext(LLVMValueRef Val)
Obtain the context to which this value is associated.
Definition Core.cpp:1093
void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal)
Replace all uses of a value with another one.
Definition Core.cpp:1109
const char * LLVMGetValueName2(LLVMValueRef Val, size_t *Length)
Obtain the string name of a value.
Definition Core.cpp:1059
void LLVMSetValueName(LLVMValueRef Val, const char *Name)
Deprecated: Use LLVMSetValueName2 instead.
Definition Core.cpp:1073
LLVMValueRef LLVMIsAMDNode(LLVMValueRef Val)
Definition Core.cpp:1193
char * LLVMPrintDbgRecordToString(LLVMDbgRecordRef Record)
Return a string representation of the DbgRecord.
Definition Core.cpp:1097
LLVMBool LLVMIsUndef(LLVMValueRef Val)
Determine whether a value instance is undefined.
Definition Core.cpp:1310
LLVMTypeRef LLVMTypeOf(LLVMValueRef Val)
Obtain the type of a value.
Definition Core.cpp:1043
char * LLVMPrintValueToString(LLVMValueRef Val)
Return a string representation of the value.
Definition Core.cpp:1081
LLVMValueRef LLVMIsAValueAsMetadata(LLVMValueRef Val)
Definition Core.cpp:1201
LLVMBool LLVMIsConstant(LLVMValueRef Ty)
Determine whether the specified value instance is constant.
Definition Core.cpp:1300
void LLVMSetValueName2(LLVMValueRef Val, const char *Name, size_t NameLen)
Set the string name of a value.
Definition Core.cpp:1065
LLVMValueRef LLVMGetFirstGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the first GlobalIFunc in a Module.
Definition Core.cpp:2839
LLVMValueRef LLVMGetNamedGlobalIFunc(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalIFunc value from a Module by its name.
Definition Core.cpp:2834
void LLVMRemoveGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module.
Definition Core.cpp:2883
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:2824
LLVMValueRef LLVMGetNextGlobalIFunc(LLVMValueRef IFunc)
Advance a GlobalIFunc iterator to the next GlobalIFunc.
Definition Core.cpp:2855
LLVMValueRef LLVMGetPreviousGlobalIFunc(LLVMValueRef IFunc)
Decrement a GlobalIFunc iterator to the previous GlobalIFunc.
Definition Core.cpp:2863
LLVMValueRef LLVMGetGlobalIFuncResolver(LLVMValueRef IFunc)
Retrieves the resolver function associated with this indirect function, or NULL if it doesn't not exi...
Definition Core.cpp:2871
void LLVMSetGlobalIFuncResolver(LLVMValueRef IFunc, LLVMValueRef Resolver)
Sets the resolver function associated with this indirect function.
Definition Core.cpp:2875
LLVMValueRef LLVMGetLastGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the last GlobalIFunc in a Module.
Definition Core.cpp:2847
void LLVMEraseGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module and delete it.
Definition Core.cpp:2879
LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca)
Obtain the type that is being allocated by the alloca instruction.
Definition Core.cpp:3392
void LLVMSetTailCall(LLVMValueRef Call, LLVMBool isTailCall)
Set whether a call instruction is a tail call.
Definition Core.cpp:3291
void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Definition Core.cpp:3223
unsigned LLVMGetNumOperandBundles(LLVMValueRef C)
Obtain the number of operand bundles attached to this instruction.
Definition Core.cpp:3275
void LLVMRemoveCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:3257
void LLVMRemoveCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:3262
LLVMAttributeRef LLVMGetCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:3243
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr)
Obtain the calling convention for a call instruction.
Definition Core.cpp:3206
LLVMBasicBlockRef LLVMGetCallBrDefaultDest(LLVMValueRef CallBr)
Get the default destination of a CallBr instruction.
Definition Core.cpp:3331
LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr)
Obtain the pointer to the function invoked by this instruction.
Definition Core.cpp:3267
void LLVMSetNormalDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the normal destination basic block.
Definition Core.cpp:3318
LLVMBool LLVMIsTailCall(LLVMValueRef Call)
Obtain whether a call instruction is a tail call.
Definition Core.cpp:3287
LLVMAttributeRef LLVMGetCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:3250
unsigned LLVMGetCallBrNumIndirectDests(LLVMValueRef CallBr)
Get the number of indirect destinations of a CallBr instruction.
Definition Core.cpp:3335
void LLVMGetCallSiteAttributes(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
Definition Core.cpp:3235
LLVMBasicBlockRef LLVMGetNormalDest(LLVMValueRef Invoke)
Return the normal destination basic block.
Definition Core.cpp:3305
unsigned LLVMGetNumArgOperands(LLVMValueRef Instr)
Obtain the argument count for a call instruction.
Definition Core.cpp:3197
void LLVMSetTailCallKind(LLVMValueRef Call, LLVMTailCallKind kind)
Set the call kind of the call instruction.
Definition Core.cpp:3299
LLVMOperandBundleRef LLVMGetOperandBundleAtIndex(LLVMValueRef C, unsigned Index)
Obtain the operand bundle attached to this instruction at the given index.
Definition Core.cpp:3279
LLVMBasicBlockRef LLVMGetCallBrIndirectDest(LLVMValueRef CallBr, unsigned Idx)
Get the indirect destination of a CallBr instruction at the given index.
Definition Core.cpp:3339
LLVMTailCallKind LLVMGetTailCallKind(LLVMValueRef Call)
Obtain a tail call kind of the call instruction.
Definition Core.cpp:3295
void LLVMSetUnwindDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the unwind destination basic block.
Definition Core.cpp:3322
LLVMTypeRef LLVMGetCalledFunctionType(LLVMValueRef Instr)
Obtain the function type called by this instruction.
Definition Core.cpp:3271
LLVMBasicBlockRef LLVMGetUnwindDest(LLVMValueRef Invoke)
Return the unwind destination basic block.
Definition Core.cpp:3309
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, LLVMAttributeIndex Idx, unsigned align)
Definition Core.cpp:3215
unsigned LLVMGetCallSiteAttributeCount(LLVMValueRef C, LLVMAttributeIndex Idx)
Definition Core.cpp:3228
void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC)
Set the calling convention for a call instruction.
Definition Core.cpp:3210
LLVMGEPNoWrapFlags LLVMGEPGetNoWrapFlags(LLVMValueRef GEP)
Get the no-wrap related flags for the given GEP instruction.
Definition Core.cpp:3410
LLVMBool LLVMIsInBounds(LLVMValueRef GEP)
Check whether the given GEP operator is inbounds.
Definition Core.cpp:3398
void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds)
Set the given GEP instruction to be inbounds or not.
Definition Core.cpp:3402
LLVMTypeRef LLVMGetGEPSourceElementType(LLVMValueRef GEP)
Get the source element type of the given GEP operator.
Definition Core.cpp:3406
void LLVMGEPSetNoWrapFlags(LLVMValueRef GEP, LLVMGEPNoWrapFlags NoWrapFlags)
Set the no-wrap related flags for the given GEP instruction.
Definition Core.cpp:3415
unsigned LLVMGetNumIndices(LLVMValueRef Inst)
Obtain the number of indices.
Definition Core.cpp:3443
const unsigned * LLVMGetIndices(LLVMValueRef Inst)
Obtain the indices as an array.
Definition Core.cpp:3455
LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
Definition Core.cpp:3437
LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMValueRef.
Definition Core.cpp:3433
void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues, LLVMBasicBlockRef *IncomingBlocks, unsigned Count)
Add an incoming value to the end of a PHI list.
Definition Core.cpp:3422
unsigned LLVMCountIncoming(LLVMValueRef PhiNode)
Obtain the number of incoming basic blocks to a PHI node.
Definition Core.cpp:3429
LLVMValueRef LLVMGetCondition(LLVMValueRef Branch)
Return the condition of a branch instruction.
Definition Core.cpp:3363
LLVMBasicBlockRef LLVMGetSuccessor(LLVMValueRef Term, unsigned i)
Return the specified successor.
Definition Core.cpp:3349
void LLVMSetCondition(LLVMValueRef Branch, LLVMValueRef Cond)
Set the condition of a branch instruction.
Definition Core.cpp:3367
void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block)
Update the specified successor to point at the provided block.
Definition Core.cpp:3353
LLVMValueRef LLVMGetSwitchCaseValue(LLVMValueRef Switch, unsigned i)
Obtain the case value for a successor of a switch instruction.
Definition Core.cpp:3377
LLVMBool LLVMIsConditional(LLVMValueRef Branch)
Return if an instruction is a conditional branch.
Definition Core.cpp:3359
LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef Switch)
Obtain the default destination basic block of a switch instruction.
Definition Core.cpp:3373
void LLVMSetSwitchCaseValue(LLVMValueRef Switch, unsigned i, LLVMValueRef CaseValue)
Set the case value for a successor of a switch instruction.
Definition Core.cpp:3383
unsigned LLVMGetNumSuccessors(LLVMValueRef Term)
Return the number of successors that this terminator has.
Definition Core.cpp:3345
LLVMRealPredicate LLVMGetFCmpPredicate(LLVMValueRef Inst)
Obtain the float predicate of an instruction.
Definition Core.cpp:3107
int LLVMHasMetadata(LLVMValueRef Inst)
Determine whether an instruction has any metadata attached.
Definition Core.cpp:1113
void LLVMInstructionRemoveFromParent(LLVMValueRef Inst)
Remove an instruction.
Definition Core.cpp:3081
LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst)
Obtain the instruction that occurred before this one.
Definition Core.cpp:3073
LLVMDbgRecordRef LLVMGetPreviousDbgRecord(LLVMDbgRecordRef Rec)
Obtain the previous DbgRecord in the sequence or NULL if there are no more.
Definition Core.cpp:3158
LLVMMetadataRef LLVMDbgVariableRecordGetExpression(LLVMDbgRecordRef Rec)
Get the debug info expression of the DbgVariableRecord.
Definition Core.cpp:3193
LLVMDbgRecordRef LLVMGetFirstDbgRecord(LLVMValueRef Inst)
Obtain the first debug record attached to an instruction.
Definition Core.cpp:3130
LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst)
Obtain the code opcode for an individual instruction.
Definition Core.cpp:3113
LLVMDbgRecordRef LLVMGetNextDbgRecord(LLVMDbgRecordRef Rec)
Obtain the next DbgRecord in the sequence or NULL if there are no more.
Definition Core.cpp:3150
LLVMDbgRecordRef LLVMGetLastDbgRecord(LLVMValueRef Inst)
Obtain the last debug record attached to an instruction.
Definition Core.cpp:3140
LLVMMetadataRef LLVMDbgVariableRecordGetVariable(LLVMDbgRecordRef Rec)
Get the debug info variable of the DbgVariableRecord.
Definition Core.cpp:3189
LLVMValueRef LLVMIsATerminatorInst(LLVMValueRef Inst)
Determine whether an instruction is a terminator.
Definition Core.cpp:3125
LLVMValueRef LLVMDbgVariableRecordGetValue(LLVMDbgRecordRef Rec, unsigned OpIdx)
Get the value of the DbgVariableRecord.
Definition Core.cpp:3184
LLVMDbgRecordKind LLVMDbgRecordGetKind(LLVMDbgRecordRef Rec)
Definition Core.cpp:3170
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:1170
void LLVMDeleteInstruction(LLVMValueRef Inst)
Delete an instruction.
Definition Core.cpp:3089
LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst)
Obtain the basic block to which an instruction belongs.
Definition Core.cpp:3045
LLVMMetadataRef LLVMDbgRecordGetDebugLoc(LLVMDbgRecordRef Rec)
Get the debug location attached to the debug record.
Definition Core.cpp:3166
LLVMBool LLVMGetICmpSameSign(LLVMValueRef Inst)
Get whether or not an icmp instruction has the samesign flag.
Definition Core.cpp:3099
LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst)
Create a copy of 'this' instruction that is identical in all ways except the following:
Definition Core.cpp:3119
void LLVMInstructionEraseFromParent(LLVMValueRef Inst)
Remove and delete an instruction.
Definition Core.cpp:3085
void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef Val)
Set metadata associated with an instruction value.
Definition Core.cpp:1139
LLVMValueRef LLVMGetMetadata(LLVMValueRef Inst, unsigned KindID)
Return metadata associated with an instruction value.
Definition Core.cpp:1117
LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst)
Obtain the predicate of an instruction.
Definition Core.cpp:3093
LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst)
Obtain the instruction that occurs after the one specified.
Definition Core.cpp:3065
void LLVMSetICmpSameSign(LLVMValueRef Inst, LLVMBool SameSign)
Set the samesign flag on an icmp instruction.
Definition Core.cpp:3103
LLVMMetadataRef LLVMMDNodeInContext2(LLVMContextRef C, LLVMMetadataRef *MDs, size_t Count)
Create an MDNode value with the given array of operands.
Definition Core.cpp:1329
const char * LLVMGetMDString(LLVMValueRef V, unsigned *Length)
Obtain the underlying string from a MDString value.
Definition Core.cpp:1389
LLVMValueRef LLVMMetadataAsValue(LLVMContextRef C, LLVMMetadataRef MD)
Obtain a Metadata as a Value.
Definition Core.cpp:1376
unsigned LLVMGetMDNodeNumOperands(LLVMValueRef V)
Obtain the number of operands from an MDNode value.
Definition Core.cpp:1399
LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str, unsigned SLen)
Deprecated: Use LLVMMDStringInContext2 instead.
Definition Core.cpp:1334
LLVMMetadataRef LLVMMDStringInContext2(LLVMContextRef C, const char *Str, size_t SLen)
Create an MDString value from a given string value.
Definition Core.cpp:1324
LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals, unsigned Count)
Deprecated: Use LLVMMDNodeInContext2 instead.
Definition Core.cpp:1345
void LLVMReplaceMDNodeOperandWith(LLVMValueRef V, unsigned Index, LLVMMetadataRef Replacement)
Replace an operand at a specific index in a llvm::MDNode value.
Definition Core.cpp:1467
LLVMMetadataRef LLVMValueAsMetadata(LLVMValueRef Val)
Obtain a Value as a Metadata.
Definition Core.cpp:1380
void LLVMGetMDNodeOperands(LLVMValueRef V, LLVMValueRef *Dest)
Obtain the given MDNode's operands.
Definition Core.cpp:1454
LLVMUseRef LLVMGetOperandUse(LLVMValueRef Val, unsigned Index)
Obtain the use of an operand at a specific index in a llvm::User value.
Definition Core.cpp:1265
int LLVMGetNumOperands(LLVMValueRef Val)
Obtain the number of operands in a llvm::User value.
Definition Core.cpp:1274
void LLVMSetOperand(LLVMValueRef Val, unsigned Index, LLVMValueRef Op)
Set an operand at a specific index in a llvm::User value.
Definition Core.cpp:1270
LLVMValueRef LLVMGetOperand(LLVMValueRef Val, unsigned Index)
Obtain an operand at a specific index in a llvm::User value.
Definition Core.cpp:1251
LLVMValueRef LLVMGetUser(LLVMUseRef U)
Obtain the user value for a user.
Definition Core.cpp:1231
LLVMValueRef LLVMGetUsedValue(LLVMUseRef U)
Obtain the value this use corresponds to.
Definition Core.cpp:1235
LLVMUseRef LLVMGetNextUse(LLVMUseRef U)
Obtain the next use of a value.
Definition Core.cpp:1224
LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val)
Obtain the first use of a value.
Definition Core.cpp:1216
#define LLVM_FOR_EACH_VALUE_SUBCLASS(macro)
Definition Core.h:2035
void LLVMDisposeMessage(char *Message)
Definition Core.cpp:88
char * LLVMCreateMessage(const char *Message)
Definition Core.cpp:84
void LLVMGetVersion(unsigned *Major, unsigned *Minor, unsigned *Patch)
Return the major, minor, and patch version of LLVM.
Definition Core.cpp:73
void LLVMShutdown()
Deallocate and destroy all ManagedStatic variables.
Definition Core.cpp:67
struct LLVMOpaqueValue * LLVMValueRef
Represents an individual value in LLVM IR.
Definition Types.h:75
struct LLVMOpaqueAttributeRef * LLVMAttributeRef
Used to represent an attributes.
Definition Types.h:145
int LLVMBool
Definition Types.h:28
struct LLVMOpaqueModuleFlagEntry LLVMModuleFlagEntry
Definition Types.h:160
struct LLVMOpaqueNamedMDNode * LLVMNamedMDNodeRef
Represents an LLVM Named Metadata Node.
Definition Types.h:96
struct LLVMOpaquePassManager * LLVMPassManagerRef
Definition Types.h:127
struct LLVMOpaqueDbgRecord * LLVMDbgRecordRef
Definition Types.h:175
struct LLVMOpaqueDiagnosticInfo * LLVMDiagnosticInfoRef
Definition Types.h:150
struct LLVMOpaqueValueMetadataEntry LLVMValueMetadataEntry
Represents an entry in a Global Object's metadata attachments.
Definition Types.h:103
struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef
LLVM uses a polymorphic type hierarchy which C cannot represent, therefore parameters must be passed ...
Definition Types.h:48
struct LLVMOpaqueContext * LLVMContextRef
The top-level container for all LLVM global data.
Definition Types.h:53
struct LLVMOpaqueBuilder * LLVMBuilderRef
Represents an LLVM basic block builder.
Definition Types.h:110
struct LLVMOpaqueUse * LLVMUseRef
Used to get the users and usees of a Value.
Definition Types.h:133
struct LLVMOpaqueBasicBlock * LLVMBasicBlockRef
Represents a basic block of instructions in LLVM IR.
Definition Types.h:82
struct LLVMOpaqueType * LLVMTypeRef
Each value in the LLVM IR has a type, an LLVMTypeRef.
Definition Types.h:68
struct LLVMOpaqueMetadata * LLVMMetadataRef
Represents an LLVM Metadata.
Definition Types.h:89
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
Definition Types.h:61
struct LLVMOpaqueModuleProvider * LLVMModuleProviderRef
Interface used to provide a module to JIT or interpreter.
Definition Types.h:124
struct LLVMOpaqueOperandBundle * LLVMOperandBundleRef
Definition Types.h:138
struct LLVMOpaqueTargetData * LLVMTargetDataRef
Definition Core.h:34
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:2469
LLVMValueRef LLVMGetLastGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the last GlobalAlias in a Module.
Definition Core.cpp:2490
LLVMValueRef LLVMGetPreviousGlobalAlias(LLVMValueRef GA)
Decrement a GlobalAlias iterator to the previous GlobalAlias.
Definition Core.cpp:2506
void LLVMAliasSetAliasee(LLVMValueRef Alias, LLVMValueRef Aliasee)
Set the target value of an alias.
Definition Core.cpp:2518
LLVMValueRef LLVMGetFirstGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the first GlobalAlias in a Module.
Definition Core.cpp:2482
LLVMValueRef LLVMAliasGetAliasee(LLVMValueRef Alias)
Retrieve the target value of an alias.
Definition Core.cpp:2514
LLVMValueRef LLVMGetNamedGlobalAlias(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalAlias value from a Module by its name.
Definition Core.cpp:2477
LLVMValueRef LLVMGetNextGlobalAlias(LLVMValueRef GA)
Advance a GlobalAlias iterator to the next GlobalAlias.
Definition Core.cpp:2498
LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar)
Definition Core.cpp:2404
LLVMThreadLocalMode LLVMGetThreadLocalMode(LLVMValueRef GlobalVar)
Definition Core.cpp:2420
LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar)
Definition Core.cpp:2412
LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2380
void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal)
Definition Core.cpp:2408
LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar)
Definition Core.cpp:2459
LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M)
Definition Core.cpp:2364
LLVMValueRef LLVMGetNamedGlobalWithLength(LLVMModuleRef M, const char *Name, size_t Length)
Definition Core.cpp:2351
LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M)
Definition Core.cpp:2356
void LLVMSetThreadLocalMode(LLVMValueRef GlobalVar, LLVMThreadLocalMode Mode)
Definition Core.cpp:2437
LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2372
void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit)
Definition Core.cpp:2463
LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name)
Definition Core.cpp:2347
LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name, unsigned AddressSpace)
Definition Core.cpp:2338
void LLVMDeleteGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2388
void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant)
Definition Core.cpp:2416
LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:2333
LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar)
Definition Core.cpp:2392
void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal)
Definition Core.cpp:2399
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
LLVM_ABI StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
LLVM_ABI Function * getOrInsertDeclaration(Module *M, ID id, ArrayRef< Type * > OverloadTys={})
Look up the Function declaration of the intrinsic id in the Module M.
LLVM_ABI ID lookupIntrinsicID(StringRef Name)
This does the actual lookup of an intrinsic ID which matches the given function name.
LLVM_ABI bool isOverloaded(ID id)
Returns true if the intrinsic can be overloaded.
LLVM_ABI FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > OverloadTys={})
Return the function type for an intrinsic.
LLVM_ABI std::string getNameNoUnnamedTypes(ID Id, ArrayRef< Type * > OverloadTys)
Return the LLVM name for an intrinsic.
@ SingleThread
Synchronized with respect to signal handlers executing in the same thread.
Definition LLVMContext.h:63
@ System
Synchronized with respect to all concurrently executing threads.
Definition LLVMContext.h:66
@ OF_TextWithCRLF
The file should be opened in text mode and use a carriage linefeed '\r '.
Definition FileSystem.h:802
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
@ Length
Definition DWP.cpp:577
constexpr bool llvm_is_multithreaded()
Returns true if LLVM is compiled with support for multi-threading, and false otherwise.
Definition Threading.h:52
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
LLVM_ABI void initializePrintModulePassWrapperPass(PassRegistry &)
void * PointerTy
void setAtomicSyncScopeID(Instruction *I, SyncScope::ID SSID)
A helper function that sets an atomic operation's sync scope.
auto dyn_cast_or_null(const Y &Val)
Definition Casting.h:753
LLVM_ABI LLVMContextRef getGlobalContextForCAPI()
Get the deprecated global context for use by the C API.
Definition Core.cpp:100
LLVM_ABI void initializeVerifierLegacyPassPass(PassRegistry &)
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
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...
LLVM_ABI void initializeCore(PassRegistry &)
Initialize all passes linked into the Core library.
Definition Core.cpp:59
LLVM_ABI void initializeDominatorTreeWrapperPassPass(PassRegistry &)
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc(size_t Sz)
Definition MemAlloc.h:25
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
LLVM_ABI void initializePrintFunctionPassWrapperPass(PassRegistry &)
constexpr int PoisonMaskElem
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
@ Global
Append to llvm.global_dtors.
AtomicOrdering
Atomic ordering for LLVM's memory model.
constexpr T divideCeil(U Numerator, V Denominator)
Returns the integer ceil(Numerator / Denominator).
Definition MathExtras.h:389
Attribute unwrap(LLVMAttributeRef Attr)
Definition Attributes.h:396
OperandBundleDefT< Value * > OperandBundleDef
Definition AutoUpgrade.h:34
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
Definition InstrProf.h:145
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
LLVM_ABI void llvm_shutdown()
llvm_shutdown - Deallocate and destroy all ManagedStatic variables.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
LLVMAttributeRef wrap(Attribute Attr)
Definition Attributes.h:391
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Next
Definition InstrProf.h:147
LLVM_ABI void initializeSafepointIRVerifierPass(PassRegistry &)
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
Definition Error.cpp:177
#define N
LLVMModuleFlagBehavior Behavior
Definition Core.cpp:352
LLVMMetadataRef Metadata
Definition Core.cpp:355
LLVMMetadataRef Metadata
Definition Core.cpp:1147
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
Represents the full denormal controls for a function, including the default mode and the f32 specific...
constexpr uint32_t toIntValue() const
Represent subnormal handling kind for floating point instruction inputs and outputs.
DenormalModeKind
Represent handled modes for denormal (aka subnormal) modes in the floating point environment.
void(*)(const DiagnosticInfo *DI, void *Context) DiagnosticHandlerTy
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition Alignment.h:111