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
2210 return unwrap<GlobalValue>(Global)->hasGlobalUnnamedAddr();
2211}
2212
2214 unwrap<GlobalValue>(Global)->setUnnamedAddr(
2215 HasUnnamedAddr ? GlobalValue::UnnamedAddr::Global
2217}
2218
2222
2223/*--.. Operations on global variables, load and store instructions .........--*/
2224
2226 Value *P = unwrap(V);
2228 return GV->getAlign() ? GV->getAlign()->value() : 0;
2230 return F->getAlign() ? F->getAlign()->value() : 0;
2232 return AI->getAlign().value();
2233 if (LoadInst *LI = dyn_cast<LoadInst>(P))
2234 return LI->getAlign().value();
2236 return SI->getAlign().value();
2238 return RMWI->getAlign().value();
2240 return CXI->getAlign().value();
2241
2243 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, "
2244 "and AtomicCmpXchgInst have alignment");
2245}
2246
2247void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes) {
2248 Value *P = unwrap(V);
2250 GV->setAlignment(MaybeAlign(Bytes));
2251 else if (Function *F = dyn_cast<Function>(P))
2252 F->setAlignment(MaybeAlign(Bytes));
2253 else if (AllocaInst *AI = dyn_cast<AllocaInst>(P))
2254 AI->setAlignment(Align(Bytes));
2255 else if (LoadInst *LI = dyn_cast<LoadInst>(P))
2256 LI->setAlignment(Align(Bytes));
2257 else if (StoreInst *SI = dyn_cast<StoreInst>(P))
2258 SI->setAlignment(Align(Bytes));
2259 else if (AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(P))
2260 RMWI->setAlignment(Align(Bytes));
2262 CXI->setAlignment(Align(Bytes));
2263 else
2265 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, and "
2266 "and AtomicCmpXchgInst have alignment");
2267}
2268
2270 size_t *NumEntries) {
2271 return llvm_getMetadata(NumEntries, [&Value](MetadataEntries &Entries) {
2272 Entries.clear();
2274 Instr->getAllMetadata(Entries);
2275 } else {
2276 unwrap<GlobalObject>(Value)->getAllMetadata(Entries);
2277 }
2278 });
2279}
2280
2282 unsigned Index) {
2284 static_cast<LLVMOpaqueValueMetadataEntry>(Entries[Index]);
2285 return MVE.Kind;
2286}
2287
2290 unsigned Index) {
2292 static_cast<LLVMOpaqueValueMetadataEntry>(Entries[Index]);
2293 return MVE.Metadata;
2294}
2295
2297 free(Entries);
2298}
2299
2301 LLVMMetadataRef MD) {
2302 unwrap<GlobalObject>(Global)->setMetadata(Kind, unwrap<MDNode>(MD));
2303}
2304
2306 LLVMMetadataRef MD) {
2307 unwrap<GlobalObject>(Global)->addMetadata(Kind, *unwrap<MDNode>(MD));
2308}
2309
2311 unwrap<GlobalObject>(Global)->eraseMetadata(Kind);
2312}
2313
2317
2322
2323/*--.. Operations on global variables ......................................--*/
2324
2326 return wrap(new GlobalVariable(*unwrap(M), unwrap(Ty), false,
2327 GlobalValue::ExternalLinkage, nullptr, Name));
2328}
2329
2331 const char *Name,
2332 unsigned AddressSpace) {
2333 return wrap(new GlobalVariable(*unwrap(M), unwrap(Ty), false,
2334 GlobalValue::ExternalLinkage, nullptr, Name,
2336 AddressSpace));
2337}
2338
2340 return wrap(unwrap(M)->getNamedGlobal(Name));
2341}
2342
2344 size_t Length) {
2345 return wrap(unwrap(M)->getNamedGlobal(StringRef(Name, Length)));
2346}
2347
2349 Module *Mod = unwrap(M);
2350 Module::global_iterator I = Mod->global_begin();
2351 if (I == Mod->global_end())
2352 return nullptr;
2353 return wrap(&*I);
2354}
2355
2357 Module *Mod = unwrap(M);
2358 Module::global_iterator I = Mod->global_end();
2359 if (I == Mod->global_begin())
2360 return nullptr;
2361 return wrap(&*--I);
2362}
2363
2365 GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2367 if (++I == GV->getParent()->global_end())
2368 return nullptr;
2369 return wrap(&*I);
2370}
2371
2373 GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2375 if (I == GV->getParent()->global_begin())
2376 return nullptr;
2377 return wrap(&*--I);
2378}
2379
2381 unwrap<GlobalVariable>(GlobalVar)->eraseFromParent();
2382}
2383
2385 GlobalVariable* GV = unwrap<GlobalVariable>(GlobalVar);
2386 if ( !GV->hasInitializer() )
2387 return nullptr;
2388 return wrap(GV->getInitializer());
2389}
2390
2391void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal) {
2392 unwrap<GlobalVariable>(GlobalVar)->setInitializer(
2393 ConstantVal ? unwrap<Constant>(ConstantVal) : nullptr);
2394}
2395
2397 return unwrap<GlobalVariable>(GlobalVar)->isThreadLocal();
2398}
2399
2400void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal) {
2401 unwrap<GlobalVariable>(GlobalVar)->setThreadLocal(IsThreadLocal != 0);
2402}
2403
2405 return unwrap<GlobalVariable>(GlobalVar)->isConstant();
2406}
2407
2408void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant) {
2409 unwrap<GlobalVariable>(GlobalVar)->setConstant(IsConstant != 0);
2410}
2411
2413 switch (unwrap<GlobalVariable>(GlobalVar)->getThreadLocalMode()) {
2415 return LLVMNotThreadLocal;
2423 return LLVMLocalExecTLSModel;
2424 }
2425
2426 llvm_unreachable("Invalid GlobalVariable thread local mode");
2427}
2428
2450
2452 return unwrap<GlobalVariable>(GlobalVar)->isExternallyInitialized();
2453}
2454
2456 unwrap<GlobalVariable>(GlobalVar)->setExternallyInitialized(IsExtInit);
2457}
2458
2459/*--.. Operations on aliases ......................................--*/
2460
2462 unsigned AddrSpace, LLVMValueRef Aliasee,
2463 const char *Name) {
2464 return wrap(GlobalAlias::create(unwrap(ValueTy), AddrSpace,
2466 unwrap<Constant>(Aliasee), unwrap(M)));
2467}
2468
2470 const char *Name, size_t NameLen) {
2471 return wrap(unwrap(M)->getNamedAlias(StringRef(Name, NameLen)));
2472}
2473
2475 Module *Mod = unwrap(M);
2476 Module::alias_iterator I = Mod->alias_begin();
2477 if (I == Mod->alias_end())
2478 return nullptr;
2479 return wrap(&*I);
2480}
2481
2483 Module *Mod = unwrap(M);
2484 Module::alias_iterator I = Mod->alias_end();
2485 if (I == Mod->alias_begin())
2486 return nullptr;
2487 return wrap(&*--I);
2488}
2489
2491 GlobalAlias *Alias = unwrap<GlobalAlias>(GA);
2493 if (++I == Alias->getParent()->alias_end())
2494 return nullptr;
2495 return wrap(&*I);
2496}
2497
2499 GlobalAlias *Alias = unwrap<GlobalAlias>(GA);
2501 if (I == Alias->getParent()->alias_begin())
2502 return nullptr;
2503 return wrap(&*--I);
2504}
2505
2507 return wrap(unwrap<GlobalAlias>(Alias)->getAliasee());
2508}
2509
2511 unwrap<GlobalAlias>(Alias)->setAliasee(unwrap<Constant>(Aliasee));
2512}
2513
2514/*--.. Operations on functions .............................................--*/
2515
2517 LLVMTypeRef FunctionTy) {
2518 return wrap(Function::Create(unwrap<FunctionType>(FunctionTy),
2520}
2521
2523 size_t NameLen, LLVMTypeRef FunctionTy) {
2524 return wrap(unwrap(M)
2525 ->getOrInsertFunction(StringRef(Name, NameLen),
2526 unwrap<FunctionType>(FunctionTy))
2527 .getCallee());
2528}
2529
2531 return wrap(unwrap(M)->getFunction(Name));
2532}
2533
2535 size_t Length) {
2536 return wrap(unwrap(M)->getFunction(StringRef(Name, Length)));
2537}
2538
2540 Module *Mod = unwrap(M);
2541 Module::iterator I = Mod->begin();
2542 if (I == Mod->end())
2543 return nullptr;
2544 return wrap(&*I);
2545}
2546
2548 Module *Mod = unwrap(M);
2549 Module::iterator I = Mod->end();
2550 if (I == Mod->begin())
2551 return nullptr;
2552 return wrap(&*--I);
2553}
2554
2556 Function *Func = unwrap<Function>(Fn);
2557 Module::iterator I(Func);
2558 if (++I == Func->getParent()->end())
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()->begin())
2567 return nullptr;
2568 return wrap(&*--I);
2569}
2570
2572 unwrap<Function>(Fn)->eraseFromParent();
2573}
2574
2576 return unwrap<Function>(Fn)->hasPersonalityFn();
2577}
2578
2580 return wrap(unwrap<Function>(Fn)->getPersonalityFn());
2581}
2582
2584 unwrap<Function>(Fn)->setPersonalityFn(
2585 PersonalityFn ? unwrap<Constant>(PersonalityFn) : nullptr);
2586}
2587
2589 if (Function *F = dyn_cast<Function>(unwrap(Fn)))
2590 return F->getIntrinsicID();
2591 return 0;
2592}
2593
2595 assert(ID < llvm::Intrinsic::num_intrinsics && "Intrinsic ID out of range");
2596 return llvm::Intrinsic::ID(ID);
2597}
2598
2600 LLVMTypeRef *OverloadTypes,
2601 size_t OverloadCount) {
2602 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2603 auto IID = llvm_map_to_intrinsic_id(ID);
2604 return wrap(
2606}
2607
2608const char *LLVMIntrinsicGetName(unsigned ID, size_t *NameLength) {
2609 auto IID = llvm_map_to_intrinsic_id(ID);
2610 auto Str = llvm::Intrinsic::getName(IID);
2611 *NameLength = Str.size();
2612 return Str.data();
2613}
2614
2616 LLVMTypeRef *OverloadTypes,
2617 size_t OverloadCount) {
2618 auto IID = llvm_map_to_intrinsic_id(ID);
2619 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2620 return wrap(llvm::Intrinsic::getType(*unwrap(Ctx), IID, OverloadTys));
2621}
2622
2623char *LLVMIntrinsicCopyOverloadedName(unsigned ID, LLVMTypeRef *OverloadTypes,
2624 size_t OverloadCount,
2625 size_t *NameLength) {
2626 auto IID = llvm_map_to_intrinsic_id(ID);
2627 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2628 auto Str = llvm::Intrinsic::getNameNoUnnamedTypes(IID, OverloadTys);
2629 *NameLength = Str.length();
2630 return strdup(Str.c_str());
2631}
2632
2634 LLVMTypeRef *OverloadTypes,
2635 size_t OverloadCount,
2636 size_t *NameLength) {
2637 auto IID = llvm_map_to_intrinsic_id(ID);
2638 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2639 auto Str = llvm::Intrinsic::getName(IID, OverloadTys, unwrap(Mod));
2640 *NameLength = Str.length();
2641 return strdup(Str.c_str());
2642}
2643
2644unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen) {
2645 return Intrinsic::lookupIntrinsicID({Name, NameLen});
2646}
2647
2649 auto IID = llvm_map_to_intrinsic_id(ID);
2651}
2652
2654 return unwrap<Function>(Fn)->getCallingConv();
2655}
2656
2658 return unwrap<Function>(Fn)->setCallingConv(
2659 static_cast<CallingConv::ID>(CC));
2660}
2661
2662const char *LLVMGetGC(LLVMValueRef Fn) {
2664 return F->hasGC()? F->getGC().c_str() : nullptr;
2665}
2666
2667void LLVMSetGC(LLVMValueRef Fn, const char *GC) {
2669 if (GC)
2670 F->setGC(GC);
2671 else
2672 F->clearGC();
2673}
2674
2677 return wrap(F->getPrefixData());
2678}
2679
2682 return F->hasPrefixData();
2683}
2684
2687 Constant *prefix = unwrap<Constant>(prefixData);
2688 F->setPrefixData(prefix);
2689}
2690
2693 return wrap(F->getPrologueData());
2694}
2695
2698 return F->hasPrologueData();
2699}
2700
2703 Constant *prologue = unwrap<Constant>(prologueData);
2704 F->setPrologueData(prologue);
2705}
2706
2709 unwrap<Function>(F)->addAttributeAtIndex(Idx, unwrap(A));
2710}
2711
2713 auto AS = unwrap<Function>(F)->getAttributes().getAttributes(Idx);
2714 return AS.getNumAttributes();
2715}
2716
2718 LLVMAttributeRef *Attrs) {
2719 auto AS = unwrap<Function>(F)->getAttributes().getAttributes(Idx);
2720 for (auto A : AS)
2721 *Attrs++ = wrap(A);
2722}
2723
2726 unsigned KindID) {
2727 return wrap(unwrap<Function>(F)->getAttributeAtIndex(
2728 Idx, (Attribute::AttrKind)KindID));
2729}
2730
2733 const char *K, unsigned KLen) {
2734 return wrap(
2735 unwrap<Function>(F)->getAttributeAtIndex(Idx, StringRef(K, KLen)));
2736}
2737
2739 unsigned KindID) {
2740 unwrap<Function>(F)->removeAttributeAtIndex(Idx, (Attribute::AttrKind)KindID);
2741}
2742
2744 const char *K, unsigned KLen) {
2745 unwrap<Function>(F)->removeAttributeAtIndex(Idx, StringRef(K, KLen));
2746}
2747
2749 const char *V) {
2750 Function *Func = unwrap<Function>(Fn);
2751 Attribute Attr = Attribute::get(Func->getContext(), A, V);
2752 Func->addFnAttr(Attr);
2753}
2754
2755/*--.. Operations on parameters ............................................--*/
2756
2758 // This function is strictly redundant to
2759 // LLVMCountParamTypes(LLVMGlobalGetValueType(FnRef))
2760 return unwrap<Function>(FnRef)->arg_size();
2761}
2762
2763void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs) {
2764 Function *Fn = unwrap<Function>(FnRef);
2765 for (Argument &A : Fn->args())
2766 *ParamRefs++ = wrap(&A);
2767}
2768
2770 Function *Fn = unwrap<Function>(FnRef);
2771 return wrap(&Fn->arg_begin()[index]);
2772}
2773
2777
2779 Function *Func = unwrap<Function>(Fn);
2780 Function::arg_iterator I = Func->arg_begin();
2781 if (I == Func->arg_end())
2782 return nullptr;
2783 return wrap(&*I);
2784}
2785
2787 Function *Func = unwrap<Function>(Fn);
2788 Function::arg_iterator I = Func->arg_end();
2789 if (I == Func->arg_begin())
2790 return nullptr;
2791 return wrap(&*--I);
2792}
2793
2795 Argument *A = unwrap<Argument>(Arg);
2796 Function *Fn = A->getParent();
2797 if (A->getArgNo() + 1 >= Fn->arg_size())
2798 return nullptr;
2799 return wrap(&Fn->arg_begin()[A->getArgNo() + 1]);
2800}
2801
2803 Argument *A = unwrap<Argument>(Arg);
2804 if (A->getArgNo() == 0)
2805 return nullptr;
2806 return wrap(&A->getParent()->arg_begin()[A->getArgNo() - 1]);
2807}
2808
2810 Argument *A = unwrap<Argument>(Arg);
2811 A->addAttr(Attribute::getWithAlignment(A->getContext(), Align(align)));
2812}
2813
2814/*--.. Operations on ifuncs ................................................--*/
2815
2817 const char *Name, size_t NameLen,
2818 LLVMTypeRef Ty, unsigned AddrSpace,
2820 return wrap(GlobalIFunc::create(unwrap(Ty), AddrSpace,
2822 StringRef(Name, NameLen),
2824}
2825
2827 const char *Name, size_t NameLen) {
2828 return wrap(unwrap(M)->getNamedIFunc(StringRef(Name, NameLen)));
2829}
2830
2832 Module *Mod = unwrap(M);
2833 Module::ifunc_iterator I = Mod->ifunc_begin();
2834 if (I == Mod->ifunc_end())
2835 return nullptr;
2836 return wrap(&*I);
2837}
2838
2840 Module *Mod = unwrap(M);
2841 Module::ifunc_iterator I = Mod->ifunc_end();
2842 if (I == Mod->ifunc_begin())
2843 return nullptr;
2844 return wrap(&*--I);
2845}
2846
2848 GlobalIFunc *GIF = unwrap<GlobalIFunc>(IFunc);
2850 if (++I == GIF->getParent()->ifunc_end())
2851 return nullptr;
2852 return wrap(&*I);
2853}
2854
2856 GlobalIFunc *GIF = unwrap<GlobalIFunc>(IFunc);
2858 if (I == GIF->getParent()->ifunc_begin())
2859 return nullptr;
2860 return wrap(&*--I);
2861}
2862
2864 return wrap(unwrap<GlobalIFunc>(IFunc)->getResolver());
2865}
2866
2870
2872 unwrap<GlobalIFunc>(IFunc)->eraseFromParent();
2873}
2874
2876 unwrap<GlobalIFunc>(IFunc)->removeFromParent();
2877}
2878
2879/*--.. Operations on operand bundles........................................--*/
2880
2881LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, size_t TagLen,
2882 LLVMValueRef *Args,
2883 unsigned NumArgs) {
2884 return wrap(new OperandBundleDef(std::string(Tag, TagLen),
2885 ArrayRef(unwrap(Args), NumArgs)));
2886}
2887
2889 delete unwrap(Bundle);
2890}
2891
2892const char *LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len) {
2893 StringRef Str = unwrap(Bundle)->getTag();
2894 *Len = Str.size();
2895 return Str.data();
2896}
2897
2899 return unwrap(Bundle)->inputs().size();
2900}
2901
2903 unsigned Index) {
2904 return wrap(unwrap(Bundle)->inputs()[Index]);
2905}
2906
2907/*--.. Operations on basic blocks ..........................................--*/
2908
2910 return wrap(static_cast<Value*>(unwrap(BB)));
2911}
2912
2916
2920
2922 return unwrap(BB)->getName().data();
2923}
2924
2928
2930 return wrap(unwrap(BB)->getTerminatorOrNull());
2931}
2932
2934 return unwrap<Function>(FnRef)->size();
2935}
2936
2938 Function *Fn = unwrap<Function>(FnRef);
2939 for (BasicBlock &BB : *Fn)
2940 *BasicBlocksRefs++ = wrap(&BB);
2941}
2942
2944 return wrap(&unwrap<Function>(Fn)->getEntryBlock());
2945}
2946
2948 Function *Func = unwrap<Function>(Fn);
2949 Function::iterator I = Func->begin();
2950 if (I == Func->end())
2951 return nullptr;
2952 return wrap(&*I);
2953}
2954
2956 Function *Func = unwrap<Function>(Fn);
2957 Function::iterator I = Func->end();
2958 if (I == Func->begin())
2959 return nullptr;
2960 return wrap(&*--I);
2961}
2962
2964 BasicBlock *Block = unwrap(BB);
2966 if (++I == Block->getParent()->end())
2967 return nullptr;
2968 return wrap(&*I);
2969}
2970
2972 BasicBlock *Block = unwrap(BB);
2974 if (I == Block->getParent()->begin())
2975 return nullptr;
2976 return wrap(&*--I);
2977}
2978
2983
2985 LLVMBasicBlockRef BB) {
2986 BasicBlock *ToInsert = unwrap(BB);
2987 BasicBlock *CurBB = unwrap(Builder)->GetInsertBlock();
2988 assert(CurBB && "current insertion point is invalid!");
2989 CurBB->getParent()->insert(std::next(CurBB->getIterator()), ToInsert);
2990}
2991
2993 LLVMBasicBlockRef BB) {
2994 unwrap<Function>(Fn)->insert(unwrap<Function>(Fn)->end(), unwrap(BB));
2995}
2996
2998 LLVMValueRef FnRef,
2999 const char *Name) {
3000 return wrap(BasicBlock::Create(*unwrap(C), Name, unwrap<Function>(FnRef)));
3001}
3002
3006
3008 LLVMBasicBlockRef BBRef,
3009 const char *Name) {
3010 BasicBlock *BB = unwrap(BBRef);
3011 return wrap(BasicBlock::Create(*unwrap(C), Name, BB->getParent(), BB));
3012}
3013
3018
3020 unwrap(BBRef)->eraseFromParent();
3021}
3022
3024 unwrap(BBRef)->removeFromParent();
3025}
3026
3028 unwrap(BB)->moveBefore(unwrap(MovePos));
3029}
3030
3032 unwrap(BB)->moveAfter(unwrap(MovePos));
3033}
3034
3035/*--.. Operations on instructions ..........................................--*/
3036
3040
3042 BasicBlock *Block = unwrap(BB);
3043 BasicBlock::iterator I = Block->begin();
3044 if (I == Block->end())
3045 return nullptr;
3046 return wrap(&*I);
3047}
3048
3050 BasicBlock *Block = unwrap(BB);
3051 BasicBlock::iterator I = Block->end();
3052 if (I == Block->begin())
3053 return nullptr;
3054 return wrap(&*--I);
3055}
3056
3058 Instruction *Instr = unwrap<Instruction>(Inst);
3059 BasicBlock::iterator I(Instr);
3060 if (++I == Instr->getParent()->end())
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()->begin())
3069 return nullptr;
3070 return wrap(&*--I);
3071}
3072
3074 unwrap<Instruction>(Inst)->removeFromParent();
3075}
3076
3078 unwrap<Instruction>(Inst)->eraseFromParent();
3079}
3080
3082 unwrap<Instruction>(Inst)->deleteValue();
3083}
3084
3086 if (ICmpInst *I = dyn_cast<ICmpInst>(unwrap(Inst)))
3087 return (LLVMIntPredicate)I->getPredicate();
3088 return (LLVMIntPredicate)0;
3089}
3090
3092 return unwrap<ICmpInst>(Inst)->hasSameSign();
3093}
3094
3096 unwrap<ICmpInst>(Inst)->setSameSign(SameSign);
3097}
3098
3100 if (FCmpInst *I = dyn_cast<FCmpInst>(unwrap(Inst)))
3101 return (LLVMRealPredicate)I->getPredicate();
3102 return (LLVMRealPredicate)0;
3103}
3104
3107 return map_to_llvmopcode(C->getOpcode());
3108 return (LLVMOpcode)0;
3109}
3110
3113 return wrap(C->clone());
3114 return nullptr;
3115}
3116
3119 return (I && I->isTerminator()) ? wrap(I) : nullptr;
3120}
3121
3123 Instruction *Instr = unwrap<Instruction>(Inst);
3124 if (!Instr->getDbgMarker())
3125 return nullptr;
3126 auto I = Instr->getDbgMarker()->StoredDbgRecords.begin();
3127 if (I == Instr->getDbgMarker()->StoredDbgRecords.end())
3128 return nullptr;
3129 return wrap(&*I);
3130}
3131
3133 Instruction *Instr = unwrap<Instruction>(Inst);
3134 if (!Instr->getDbgMarker())
3135 return nullptr;
3136 auto I = Instr->getDbgMarker()->StoredDbgRecords.rbegin();
3137 if (I == Instr->getDbgMarker()->StoredDbgRecords.rend())
3138 return nullptr;
3139 return wrap(&*I);
3140}
3141
3145 if (++I == Record->getInstruction()->getDbgMarker()->StoredDbgRecords.end())
3146 return nullptr;
3147 return wrap(&*I);
3148}
3149
3153 if (I == Record->getInstruction()->getDbgMarker()->StoredDbgRecords.begin())
3154 return nullptr;
3155 return wrap(&*--I);
3156}
3157
3161
3165 return LLVMDbgRecordLabel;
3167 assert(VariableRecord && "unexpected record");
3168 if (VariableRecord->isDbgDeclare())
3169 return LLVMDbgRecordDeclare;
3170 if (VariableRecord->isDbgValue())
3171 return LLVMDbgRecordValue;
3172 assert(VariableRecord->isDbgAssign() && "unexpected record");
3173 return LLVMDbgRecordAssign;
3174}
3175
3177 unsigned OpIdx) {
3178 return wrap(unwrap<DbgVariableRecord>(Rec)->getValue(OpIdx));
3179}
3180
3184
3188
3190 if (FuncletPadInst *FPI = dyn_cast<FuncletPadInst>(unwrap(Instr))) {
3191 return FPI->arg_size();
3192 }
3193 return unwrap<CallBase>(Instr)->arg_size();
3194}
3195
3196/*--.. Call and invoke instructions ........................................--*/
3197
3199 return unwrap<CallBase>(Instr)->getCallingConv();
3200}
3201
3203 return unwrap<CallBase>(Instr)->setCallingConv(
3204 static_cast<CallingConv::ID>(CC));
3205}
3206
3208 unsigned align) {
3209 auto *Call = unwrap<CallBase>(Instr);
3210 Attribute AlignAttr =
3212 Call->addAttributeAtIndex(Idx, AlignAttr);
3213}
3214
3217 unwrap<CallBase>(C)->addAttributeAtIndex(Idx, unwrap(A));
3218}
3219
3221 LLVMAttributeIndex Idx) {
3222 auto *Call = unwrap<CallBase>(C);
3223 auto AS = Call->getAttributes().getAttributes(Idx);
3224 return AS.getNumAttributes();
3225}
3226
3228 LLVMAttributeRef *Attrs) {
3229 auto *Call = unwrap<CallBase>(C);
3230 auto AS = Call->getAttributes().getAttributes(Idx);
3231 for (auto A : AS)
3232 *Attrs++ = wrap(A);
3233}
3234
3237 unsigned KindID) {
3238 return wrap(unwrap<CallBase>(C)->getAttributeAtIndex(
3239 Idx, (Attribute::AttrKind)KindID));
3240}
3241
3244 const char *K, unsigned KLen) {
3245 return wrap(
3246 unwrap<CallBase>(C)->getAttributeAtIndex(Idx, StringRef(K, KLen)));
3247}
3248
3250 unsigned KindID) {
3251 unwrap<CallBase>(C)->removeAttributeAtIndex(Idx, (Attribute::AttrKind)KindID);
3252}
3253
3255 const char *K, unsigned KLen) {
3256 unwrap<CallBase>(C)->removeAttributeAtIndex(Idx, StringRef(K, KLen));
3257}
3258
3260 return wrap(unwrap<CallBase>(Instr)->getCalledOperand());
3261}
3262
3264 return wrap(unwrap<CallBase>(Instr)->getFunctionType());
3265}
3266
3268 return unwrap<CallBase>(C)->getNumOperandBundles();
3269}
3270
3272 unsigned Index) {
3273 return wrap(
3274 new OperandBundleDef(unwrap<CallBase>(C)->getOperandBundleAt(Index)));
3275}
3276
3277/*--.. Operations on call instructions (only) ..............................--*/
3278
3280 return unwrap<CallInst>(Call)->isTailCall();
3281}
3282
3284 unwrap<CallInst>(Call)->setTailCall(isTailCall);
3285}
3286
3290
3294
3295/*--.. Operations on invoke instructions (only) ............................--*/
3296
3298 return wrap(unwrap<InvokeInst>(Invoke)->getNormalDest());
3299}
3300
3303 return wrap(CRI->getUnwindDest());
3304 } else if (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {
3305 return wrap(CSI->getUnwindDest());
3306 }
3307 return wrap(unwrap<InvokeInst>(Invoke)->getUnwindDest());
3308}
3309
3311 unwrap<InvokeInst>(Invoke)->setNormalDest(unwrap(B));
3312}
3313
3316 return CRI->setUnwindDest(unwrap(B));
3317 } else if (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {
3318 return CSI->setUnwindDest(unwrap(B));
3319 }
3320 unwrap<InvokeInst>(Invoke)->setUnwindDest(unwrap(B));
3321}
3322
3324 return wrap(unwrap<CallBrInst>(CallBr)->getDefaultDest());
3325}
3326
3328 return unwrap<CallBrInst>(CallBr)->getNumIndirectDests();
3329}
3330
3332 return wrap(unwrap<CallBrInst>(CallBr)->getIndirectDest(Idx));
3333}
3334
3335/*--.. Operations on terminators ...........................................--*/
3336
3338 return unwrap<Instruction>(Term)->getNumSuccessors();
3339}
3340
3342 return wrap(unwrap<Instruction>(Term)->getSuccessor(i));
3343}
3344
3346 return unwrap<Instruction>(Term)->setSuccessor(i, unwrap(block));
3347}
3348
3349/*--.. Operations on branch instructions (only) ............................--*/
3350
3354
3358
3360 return unwrap<CondBrInst>(Branch)->setCondition(unwrap(Cond));
3361}
3362
3363/*--.. Operations on switch instructions (only) ............................--*/
3364
3366 return wrap(unwrap<SwitchInst>(Switch)->getDefaultDest());
3367}
3368
3370 assert(i > 0 && i <= unwrap<SwitchInst>(Switch)->getNumCases());
3371 auto It = unwrap<SwitchInst>(Switch)->case_begin() + (i - 1);
3372 return wrap(It->getCaseValue());
3373}
3374
3375void LLVMSetSwitchCaseValue(LLVMValueRef Switch, unsigned i,
3376 LLVMValueRef CaseValue) {
3377 assert(i > 0 && i <= unwrap<SwitchInst>(Switch)->getNumCases());
3378 auto It = unwrap<SwitchInst>(Switch)->case_begin() + (i - 1);
3379 It->setValue(unwrap<ConstantInt>(CaseValue));
3380}
3381
3382/*--.. Operations on alloca instructions (only) ............................--*/
3383
3385 return wrap(unwrap<AllocaInst>(Alloca)->getAllocatedType());
3386}
3387
3388/*--.. Operations on gep instructions (only) ...............................--*/
3389
3391 return unwrap<GEPOperator>(GEP)->isInBounds();
3392}
3393
3395 return unwrap<GetElementPtrInst>(GEP)->setIsInBounds(InBounds);
3396}
3397
3401
3406
3411
3412/*--.. Operations on phi nodes .............................................--*/
3413
3414void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
3415 LLVMBasicBlockRef *IncomingBlocks, unsigned Count) {
3416 PHINode *PhiVal = unwrap<PHINode>(PhiNode);
3417 for (unsigned I = 0; I != Count; ++I)
3418 PhiVal->addIncoming(unwrap(IncomingValues[I]), unwrap(IncomingBlocks[I]));
3419}
3420
3422 return unwrap<PHINode>(PhiNode)->getNumIncomingValues();
3423}
3424
3426 return wrap(unwrap<PHINode>(PhiNode)->getIncomingValue(Index));
3427}
3428
3430 return wrap(unwrap<PHINode>(PhiNode)->getIncomingBlock(Index));
3431}
3432
3433/*--.. Operations on extractvalue and insertvalue nodes ....................--*/
3434
3436 auto *I = unwrap(Inst);
3437 if (auto *GEP = dyn_cast<GEPOperator>(I))
3438 return GEP->getNumIndices();
3439 if (auto *EV = dyn_cast<ExtractValueInst>(I))
3440 return EV->getNumIndices();
3441 if (auto *IV = dyn_cast<InsertValueInst>(I))
3442 return IV->getNumIndices();
3444 "LLVMGetNumIndices applies only to extractvalue and insertvalue!");
3445}
3446
3447const unsigned *LLVMGetIndices(LLVMValueRef Inst) {
3448 auto *I = unwrap(Inst);
3449 if (auto *EV = dyn_cast<ExtractValueInst>(I))
3450 return EV->getIndices().data();
3451 if (auto *IV = dyn_cast<InsertValueInst>(I))
3452 return IV->getIndices().data();
3454 "LLVMGetIndices applies only to extractvalue and insertvalue!");
3455}
3456
3457
3458/*===-- Instruction builders ----------------------------------------------===*/
3459
3463
3467
3469 Instruction *Instr, bool BeforeDbgRecords) {
3470 BasicBlock::iterator I = Instr ? Instr->getIterator() : Block->end();
3471 I.setHeadBit(BeforeDbgRecords);
3472 Builder->SetInsertPoint(I);
3473}
3474
3476 LLVMValueRef Instr) {
3477 return LLVMPositionBuilderImpl(unwrap(Builder), unwrap(Block),
3478 unwrap<Instruction>(Instr), false);
3479}
3480
3487
3490 return LLVMPositionBuilderImpl(unwrap(Builder), I->getParent(), I, false);
3491}
3492
3494 LLVMValueRef Instr) {
3496 return LLVMPositionBuilderImpl(unwrap(Builder), I->getParent(), I, true);
3497}
3498
3500 BasicBlock *BB = unwrap(Block);
3501 unwrap(Builder)->SetInsertPoint(BB);
3502}
3503
3505 return wrap(unwrap(Builder)->GetInsertBlock());
3506}
3507
3509 unwrap(Builder)->ClearInsertionPoint();
3510}
3511
3513 unwrap(Builder)->Insert(unwrap<Instruction>(Instr));
3514}
3515
3517 const char *Name) {
3518 unwrap(Builder)->Insert(unwrap<Instruction>(Instr), Name);
3519}
3520
3522 delete unwrap(Builder);
3523}
3524
3525/*--.. Metadata builders ...................................................--*/
3526
3528 return wrap(unwrap(Builder)->getCurrentDebugLocation().getAsMDNode());
3529}
3530
3532 if (Loc)
3533 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(unwrap<DILocation>(Loc)));
3534 else
3535 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc());
3536}
3537
3539 DILocation *Loc =
3540 L ? cast<DILocation>(unwrap<MetadataAsValue>(L)->getMetadata()) : nullptr;
3541 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(Loc));
3542}
3543
3545 LLVMContext &Context = unwrap(Builder)->getContext();
3547 Context, unwrap(Builder)->getCurrentDebugLocation().getAsMDNode()));
3548}
3549
3551 unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
3552}
3553
3555 unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
3556}
3557
3559 LLVMMetadataRef FPMathTag) {
3560
3561 unwrap(Builder)->setDefaultFPMathTag(FPMathTag
3562 ? unwrap<MDNode>(FPMathTag)
3563 : nullptr);
3564}
3565
3567 return wrap(&unwrap(Builder)->getContext());
3568}
3569
3571 return wrap(unwrap(Builder)->getDefaultFPMathTag());
3572}
3573
3574/*--.. Instruction builders ................................................--*/
3575
3577 return wrap(unwrap(B)->CreateRetVoid());
3578}
3579
3581 return wrap(unwrap(B)->CreateRet(unwrap(V)));
3582}
3583
3585 unsigned N) {
3586 return wrap(unwrap(B)->CreateAggregateRet({unwrap(RetVals), N}));
3587}
3588
3590 return wrap(unwrap(B)->CreateBr(unwrap(Dest)));
3591}
3592
3595 return wrap(unwrap(B)->CreateCondBr(unwrap(If), unwrap(Then), unwrap(Else)));
3596}
3597
3599 LLVMBasicBlockRef Else, unsigned NumCases) {
3600 return wrap(unwrap(B)->CreateSwitch(unwrap(V), unwrap(Else), NumCases));
3601}
3602
3604 unsigned NumDests) {
3605 return wrap(unwrap(B)->CreateIndirectBr(unwrap(Addr), NumDests));
3606}
3607
3609 LLVMBasicBlockRef DefaultDest,
3610 LLVMBasicBlockRef *IndirectDests,
3611 unsigned NumIndirectDests, LLVMValueRef *Args,
3612 unsigned NumArgs, LLVMOperandBundleRef *Bundles,
3613 unsigned NumBundles, const char *Name) {
3614
3616 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
3617 OperandBundleDef *OB = unwrap(Bundle);
3618 OBs.push_back(*OB);
3619 }
3620
3621 return wrap(unwrap(B)->CreateCallBr(
3622 unwrap<FunctionType>(Ty), unwrap(Fn), unwrap(DefaultDest),
3623 ArrayRef(unwrap(IndirectDests), NumIndirectDests),
3624 ArrayRef<Value *>(unwrap(Args), NumArgs), OBs, Name));
3625}
3626
3628 LLVMValueRef *Args, unsigned NumArgs,
3630 const char *Name) {
3631 return wrap(unwrap(B)->CreateInvoke(unwrap<FunctionType>(Ty), unwrap(Fn),
3632 unwrap(Then), unwrap(Catch),
3633 ArrayRef(unwrap(Args), NumArgs), Name));
3634}
3635
3638 unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
3639 LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name) {
3641 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
3642 OperandBundleDef *OB = unwrap(Bundle);
3643 OBs.push_back(*OB);
3644 }
3645 return wrap(unwrap(B)->CreateInvoke(
3646 unwrap<FunctionType>(Ty), unwrap(Fn), unwrap(Then), unwrap(Catch),
3647 ArrayRef(unwrap(Args), NumArgs), OBs, Name));
3648}
3649
3651 LLVMValueRef PersFn, unsigned NumClauses,
3652 const char *Name) {
3653 // The personality used to live on the landingpad instruction, but now it
3654 // lives on the parent function. For compatibility, take the provided
3655 // personality and put it on the parent function.
3656 if (PersFn)
3657 unwrap(B)->GetInsertBlock()->getParent()->setPersonalityFn(
3658 unwrap<Function>(PersFn));
3659 return wrap(unwrap(B)->CreateLandingPad(unwrap(Ty), NumClauses, Name));
3660}
3661
3663 LLVMValueRef *Args, unsigned NumArgs,
3664 const char *Name) {
3665 return wrap(unwrap(B)->CreateCatchPad(unwrap(ParentPad),
3666 ArrayRef(unwrap(Args), NumArgs), Name));
3667}
3668
3670 LLVMValueRef *Args, unsigned NumArgs,
3671 const char *Name) {
3672 if (ParentPad == nullptr) {
3674 ParentPad = wrap(Constant::getNullValue(Ty));
3675 }
3676 return wrap(unwrap(B)->CreateCleanupPad(
3677 unwrap(ParentPad), ArrayRef(unwrap(Args), NumArgs), Name));
3678}
3679
3681 return wrap(unwrap(B)->CreateResume(unwrap(Exn)));
3682}
3683
3685 LLVMBasicBlockRef UnwindBB,
3686 unsigned NumHandlers, const char *Name) {
3687 if (ParentPad == nullptr) {
3689 ParentPad = wrap(Constant::getNullValue(Ty));
3690 }
3691 return wrap(unwrap(B)->CreateCatchSwitch(unwrap(ParentPad), unwrap(UnwindBB),
3692 NumHandlers, Name));
3693}
3694
3696 LLVMBasicBlockRef BB) {
3697 return wrap(unwrap(B)->CreateCatchRet(unwrap<CatchPadInst>(CatchPad),
3698 unwrap(BB)));
3699}
3700
3702 LLVMBasicBlockRef BB) {
3703 return wrap(unwrap(B)->CreateCleanupRet(unwrap<CleanupPadInst>(CatchPad),
3704 unwrap(BB)));
3705}
3706
3708 return wrap(unwrap(B)->CreateUnreachable());
3709}
3710
3712 LLVMBasicBlockRef Dest) {
3713 unwrap<SwitchInst>(Switch)->addCase(unwrap<ConstantInt>(OnVal), unwrap(Dest));
3714}
3715
3717 unwrap<IndirectBrInst>(IndirectBr)->addDestination(unwrap(Dest));
3718}
3719
3720unsigned LLVMGetNumClauses(LLVMValueRef LandingPad) {
3721 return unwrap<LandingPadInst>(LandingPad)->getNumClauses();
3722}
3723
3724LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx) {
3725 return wrap(unwrap<LandingPadInst>(LandingPad)->getClause(Idx));
3726}
3727
3728void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal) {
3729 unwrap<LandingPadInst>(LandingPad)->addClause(unwrap<Constant>(ClauseVal));
3730}
3731
3733 return unwrap<LandingPadInst>(LandingPad)->isCleanup();
3734}
3735
3736void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val) {
3737 unwrap<LandingPadInst>(LandingPad)->setCleanup(Val);
3738}
3739
3741 unwrap<CatchSwitchInst>(CatchSwitch)->addHandler(unwrap(Dest));
3742}
3743
3744unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch) {
3745 return unwrap<CatchSwitchInst>(CatchSwitch)->getNumHandlers();
3746}
3747
3748void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers) {
3749 CatchSwitchInst *CSI = unwrap<CatchSwitchInst>(CatchSwitch);
3750 for (const BasicBlock *H : CSI->handlers())
3751 *Handlers++ = wrap(H);
3752}
3753
3755 return wrap(unwrap<CatchPadInst>(CatchPad)->getCatchSwitch());
3756}
3757
3759 unwrap<CatchPadInst>(CatchPad)
3760 ->setCatchSwitch(unwrap<CatchSwitchInst>(CatchSwitch));
3761}
3762
3763/*--.. Funclets ...........................................................--*/
3764
3766 return wrap(unwrap<FuncletPadInst>(Funclet)->getArgOperand(i));
3767}
3768
3769void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value) {
3770 unwrap<FuncletPadInst>(Funclet)->setArgOperand(i, unwrap(value));
3771}
3772
3773/*--.. Arithmetic ..........................................................--*/
3774
3776 FastMathFlags NewFMF;
3777 NewFMF.setAllowReassoc((FMF & LLVMFastMathAllowReassoc) != 0);
3778 NewFMF.setNoNaNs((FMF & LLVMFastMathNoNaNs) != 0);
3779 NewFMF.setNoInfs((FMF & LLVMFastMathNoInfs) != 0);
3780 NewFMF.setNoSignedZeros((FMF & LLVMFastMathNoSignedZeros) != 0);
3782 NewFMF.setAllowContract((FMF & LLVMFastMathAllowContract) != 0);
3783 NewFMF.setApproxFunc((FMF & LLVMFastMathApproxFunc) != 0);
3784
3785 return NewFMF;
3786}
3787
3790 if (FMF.allowReassoc())
3791 NewFMF |= LLVMFastMathAllowReassoc;
3792 if (FMF.noNaNs())
3793 NewFMF |= LLVMFastMathNoNaNs;
3794 if (FMF.noInfs())
3795 NewFMF |= LLVMFastMathNoInfs;
3796 if (FMF.noSignedZeros())
3797 NewFMF |= LLVMFastMathNoSignedZeros;
3798 if (FMF.allowReciprocal())
3800 if (FMF.allowContract())
3801 NewFMF |= LLVMFastMathAllowContract;
3802 if (FMF.approxFunc())
3803 NewFMF |= LLVMFastMathApproxFunc;
3804
3805 return NewFMF;
3806}
3807
3809 const char *Name) {
3810 return wrap(unwrap(B)->CreateAdd(unwrap(LHS), unwrap(RHS), Name));
3811}
3812
3814 const char *Name) {
3815 return wrap(unwrap(B)->CreateNSWAdd(unwrap(LHS), unwrap(RHS), Name));
3816}
3817
3819 const char *Name) {
3820 return wrap(unwrap(B)->CreateNUWAdd(unwrap(LHS), unwrap(RHS), Name));
3821}
3822
3824 const char *Name) {
3825 return wrap(unwrap(B)->CreateFAdd(unwrap(LHS), unwrap(RHS), Name));
3826}
3827
3829 const char *Name) {
3830 return wrap(unwrap(B)->CreateSub(unwrap(LHS), unwrap(RHS), Name));
3831}
3832
3834 const char *Name) {
3835 return wrap(unwrap(B)->CreateNSWSub(unwrap(LHS), unwrap(RHS), Name));
3836}
3837
3839 const char *Name) {
3840 return wrap(unwrap(B)->CreateNUWSub(unwrap(LHS), unwrap(RHS), Name));
3841}
3842
3844 const char *Name) {
3845 return wrap(unwrap(B)->CreateFSub(unwrap(LHS), unwrap(RHS), Name));
3846}
3847
3849 const char *Name) {
3850 return wrap(unwrap(B)->CreateMul(unwrap(LHS), unwrap(RHS), Name));
3851}
3852
3854 const char *Name) {
3855 return wrap(unwrap(B)->CreateNSWMul(unwrap(LHS), unwrap(RHS), Name));
3856}
3857
3859 const char *Name) {
3860 return wrap(unwrap(B)->CreateNUWMul(unwrap(LHS), unwrap(RHS), Name));
3861}
3862
3864 const char *Name) {
3865 return wrap(unwrap(B)->CreateFMul(unwrap(LHS), unwrap(RHS), Name));
3866}
3867
3869 const char *Name) {
3870 return wrap(unwrap(B)->CreateUDiv(unwrap(LHS), unwrap(RHS), Name));
3871}
3872
3874 LLVMValueRef RHS, const char *Name) {
3875 return wrap(unwrap(B)->CreateExactUDiv(unwrap(LHS), unwrap(RHS), Name));
3876}
3877
3879 const char *Name) {
3880 return wrap(unwrap(B)->CreateSDiv(unwrap(LHS), unwrap(RHS), Name));
3881}
3882
3884 LLVMValueRef RHS, const char *Name) {
3885 return wrap(unwrap(B)->CreateExactSDiv(unwrap(LHS), unwrap(RHS), Name));
3886}
3887
3889 const char *Name) {
3890 return wrap(unwrap(B)->CreateFDiv(unwrap(LHS), unwrap(RHS), Name));
3891}
3892
3894 const char *Name) {
3895 return wrap(unwrap(B)->CreateURem(unwrap(LHS), unwrap(RHS), Name));
3896}
3897
3899 const char *Name) {
3900 return wrap(unwrap(B)->CreateSRem(unwrap(LHS), unwrap(RHS), Name));
3901}
3902
3904 const char *Name) {
3905 return wrap(unwrap(B)->CreateFRem(unwrap(LHS), unwrap(RHS), Name));
3906}
3907
3909 const char *Name) {
3910 return wrap(unwrap(B)->CreateShl(unwrap(LHS), unwrap(RHS), Name));
3911}
3912
3914 const char *Name) {
3915 return wrap(unwrap(B)->CreateLShr(unwrap(LHS), unwrap(RHS), Name));
3916}
3917
3919 const char *Name) {
3920 return wrap(unwrap(B)->CreateAShr(unwrap(LHS), unwrap(RHS), Name));
3921}
3922
3924 const char *Name) {
3925 return wrap(unwrap(B)->CreateAnd(unwrap(LHS), unwrap(RHS), Name));
3926}
3927
3929 const char *Name) {
3930 return wrap(unwrap(B)->CreateOr(unwrap(LHS), unwrap(RHS), Name));
3931}
3932
3934 const char *Name) {
3935 return wrap(unwrap(B)->CreateXor(unwrap(LHS), unwrap(RHS), Name));
3936}
3937
3944
3946 return wrap(unwrap(B)->CreateNeg(unwrap(V), Name));
3947}
3948
3950 const char *Name) {
3951 return wrap(unwrap(B)->CreateNSWNeg(unwrap(V), Name));
3952}
3953
3955 const char *Name) {
3956 Value *Neg = unwrap(B)->CreateNeg(unwrap(V), Name);
3957 if (auto *I = dyn_cast<BinaryOperator>(Neg))
3958 I->setHasNoUnsignedWrap();
3959 return wrap(Neg);
3960}
3961
3963 return wrap(unwrap(B)->CreateFNeg(unwrap(V), Name));
3964}
3965
3967 return wrap(unwrap(B)->CreateNot(unwrap(V), Name));
3968}
3969
3971 Value *P = unwrap<Value>(ArithInst);
3972 return cast<Instruction>(P)->hasNoUnsignedWrap();
3973}
3974
3975void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW) {
3976 Value *P = unwrap<Value>(ArithInst);
3977 cast<Instruction>(P)->setHasNoUnsignedWrap(HasNUW);
3978}
3979
3981 Value *P = unwrap<Value>(ArithInst);
3982 return cast<Instruction>(P)->hasNoSignedWrap();
3983}
3984
3985void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW) {
3986 Value *P = unwrap<Value>(ArithInst);
3987 cast<Instruction>(P)->setHasNoSignedWrap(HasNSW);
3988}
3989
3991 Value *P = unwrap<Value>(DivOrShrInst);
3992 return cast<Instruction>(P)->isExact();
3993}
3994
3995void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact) {
3996 Value *P = unwrap<Value>(DivOrShrInst);
3997 cast<Instruction>(P)->setIsExact(IsExact);
3998}
3999
4001 Value *P = unwrap<Value>(NonNegInst);
4002 return cast<Instruction>(P)->hasNonNeg();
4003}
4004
4005void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg) {
4006 Value *P = unwrap<Value>(NonNegInst);
4007 cast<Instruction>(P)->setNonNeg(IsNonNeg);
4008}
4009
4011 Value *P = unwrap<Value>(FPMathInst);
4012 FastMathFlags FMF = cast<Instruction>(P)->getFastMathFlags();
4013 return mapToLLVMFastMathFlags(FMF);
4014}
4015
4017 Value *P = unwrap<Value>(FPMathInst);
4018 cast<Instruction>(P)->setFastMathFlags(mapFromLLVMFastMathFlags(FMF));
4019}
4020
4025
4027 Value *P = unwrap<Value>(Inst);
4028 return cast<PossiblyDisjointInst>(P)->isDisjoint();
4029}
4030
4032 Value *P = unwrap<Value>(Inst);
4033 cast<PossiblyDisjointInst>(P)->setIsDisjoint(IsDisjoint);
4034}
4035
4036/*--.. Memory ..............................................................--*/
4037
4039 const char *Name) {
4040 BasicBlock *BB = unwrap(B)->GetInsertBlock();
4041 const DataLayout &DL = BB->getDataLayout();
4042 Type *ITy = Type::getInt32Ty(BB->getContext());
4043 Value *AllocSize =
4044 unwrap(B)->CreateTypeSize(ITy, DL.getTypeAllocSize(unwrap(Ty)));
4045 return wrap(unwrap(B)->CreateMalloc(ITy, AllocSize, nullptr, nullptr, Name));
4046}
4047
4049 LLVMValueRef Val, const char *Name) {
4050 BasicBlock *BB = unwrap(B)->GetInsertBlock();
4051 const DataLayout &DL = BB->getDataLayout();
4052 Type *ITy = Type::getInt32Ty(BB->getContext());
4053 Value *AllocSize =
4054 unwrap(B)->CreateTypeSize(ITy, DL.getTypeAllocSize(unwrap(Ty)));
4055 return wrap(
4056 unwrap(B)->CreateMalloc(ITy, AllocSize, unwrap(Val), nullptr, Name));
4057}
4058
4060 LLVMValueRef Val, LLVMValueRef Len,
4061 unsigned Align) {
4062 return wrap(unwrap(B)->CreateMemSet(unwrap(Ptr), unwrap(Val), unwrap(Len),
4063 MaybeAlign(Align)));
4064}
4065
4067 LLVMValueRef Dst, unsigned DstAlign,
4068 LLVMValueRef Src, unsigned SrcAlign,
4070 return wrap(unwrap(B)->CreateMemCpy(unwrap(Dst), MaybeAlign(DstAlign),
4071 unwrap(Src), MaybeAlign(SrcAlign),
4072 unwrap(Size)));
4073}
4074
4076 LLVMValueRef Dst, unsigned DstAlign,
4077 LLVMValueRef Src, unsigned SrcAlign,
4079 return wrap(unwrap(B)->CreateMemMove(unwrap(Dst), MaybeAlign(DstAlign),
4080 unwrap(Src), MaybeAlign(SrcAlign),
4081 unwrap(Size)));
4082}
4083
4085 const char *Name) {
4086 return wrap(unwrap(B)->CreateAlloca(unwrap(Ty), nullptr, Name));
4087}
4088
4090 LLVMValueRef Val, const char *Name) {
4091 return wrap(unwrap(B)->CreateAlloca(unwrap(Ty), unwrap(Val), Name));
4092}
4093
4095 return wrap(unwrap(B)->CreateFree(unwrap(PointerVal)));
4096}
4097
4099 LLVMValueRef PointerVal, const char *Name) {
4100 return wrap(unwrap(B)->CreateLoad(unwrap(Ty), unwrap(PointerVal), Name));
4101}
4102
4104 LLVMValueRef PointerVal) {
4105 return wrap(unwrap(B)->CreateStore(unwrap(Val), unwrap(PointerVal)));
4106}
4107
4123
4139
4141 switch (BinOp) {
4173 }
4174
4175 llvm_unreachable("Invalid LLVMAtomicRMWBinOp value!");
4176}
4177
4179 switch (BinOp) {
4211 default: break;
4212 }
4213
4214 llvm_unreachable("Invalid AtomicRMWBinOp value!");
4215}
4216
4218 LLVMBool isSingleThread, const char *Name) {
4219 return wrap(
4220 unwrap(B)->CreateFence(mapFromLLVMOrdering(Ordering),
4221 isSingleThread ? SyncScope::SingleThread
4223 Name));
4224}
4225
4227 LLVMAtomicOrdering Ordering, unsigned SSID,
4228 const char *Name) {
4229 return wrap(
4230 unwrap(B)->CreateFence(mapFromLLVMOrdering(Ordering), SSID, Name));
4231}
4232
4234 LLVMValueRef Pointer, LLVMValueRef *Indices,
4235 unsigned NumIndices, const char *Name) {
4236 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4237 return wrap(unwrap(B)->CreateGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name));
4238}
4239
4241 LLVMValueRef Pointer, LLVMValueRef *Indices,
4242 unsigned NumIndices, const char *Name) {
4243 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4244 return wrap(
4245 unwrap(B)->CreateInBoundsGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name));
4246}
4247
4249 LLVMValueRef Pointer,
4250 LLVMValueRef *Indices,
4251 unsigned NumIndices, const char *Name,
4252 LLVMGEPNoWrapFlags NoWrapFlags) {
4253 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4254 return wrap(unwrap(B)->CreateGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name,
4255 mapFromLLVMGEPNoWrapFlags(NoWrapFlags)));
4256}
4257
4259 LLVMValueRef Pointer, unsigned Idx,
4260 const char *Name) {
4261 return wrap(
4262 unwrap(B)->CreateStructGEP(unwrap(Ty), unwrap(Pointer), Idx, Name));
4263}
4264
4266 const char *Name) {
4267 return wrap(unwrap(B)->CreateGlobalString(Str, Name));
4268}
4269
4271 const char *Name) {
4272 return wrap(unwrap(B)->CreateGlobalString(Str, Name));
4273}
4274
4276 return cast<Instruction>(unwrap(Inst))->isVolatile();
4277}
4278
4279void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile) {
4280 Value *P = unwrap(MemAccessInst);
4281 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4282 return LI->setVolatile(isVolatile);
4284 return SI->setVolatile(isVolatile);
4286 return AI->setVolatile(isVolatile);
4287 return cast<AtomicCmpXchgInst>(P)->setVolatile(isVolatile);
4288}
4289
4291 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->isWeak();
4292}
4293
4294void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak) {
4295 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->setWeak(isWeak);
4296}
4297
4299 Value *P = unwrap(MemAccessInst);
4301 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4302 O = LI->getOrdering();
4303 else if (StoreInst *SI = dyn_cast<StoreInst>(P))
4304 O = SI->getOrdering();
4305 else if (FenceInst *FI = dyn_cast<FenceInst>(P))
4306 O = FI->getOrdering();
4307 else
4308 O = cast<AtomicRMWInst>(P)->getOrdering();
4309 return mapToLLVMOrdering(O);
4310}
4311
4312void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering) {
4313 Value *P = unwrap(MemAccessInst);
4314 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4315
4316 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4317 return LI->setOrdering(O);
4318 else if (FenceInst *FI = dyn_cast<FenceInst>(P))
4319 return FI->setOrdering(O);
4320 else if (AtomicRMWInst *ARWI = dyn_cast<AtomicRMWInst>(P))
4321 return ARWI->setOrdering(O);
4322 return cast<StoreInst>(P)->setOrdering(O);
4323}
4324
4328
4330 unwrap<AtomicRMWInst>(Inst)->setOperation(mapFromLLVMRMWBinOp(BinOp));
4331}
4332
4333/*--.. Casts ...............................................................--*/
4334
4336 LLVMTypeRef DestTy, const char *Name) {
4337 return wrap(unwrap(B)->CreateTrunc(unwrap(Val), unwrap(DestTy), Name));
4338}
4339
4341 LLVMTypeRef DestTy, const char *Name) {
4342 return wrap(unwrap(B)->CreateZExt(unwrap(Val), unwrap(DestTy), Name));
4343}
4344
4346 LLVMTypeRef DestTy, const char *Name) {
4347 return wrap(unwrap(B)->CreateSExt(unwrap(Val), unwrap(DestTy), Name));
4348}
4349
4351 LLVMTypeRef DestTy, const char *Name) {
4352 return wrap(unwrap(B)->CreateFPToUI(unwrap(Val), unwrap(DestTy), Name));
4353}
4354
4356 LLVMTypeRef DestTy, const char *Name) {
4357 return wrap(unwrap(B)->CreateFPToSI(unwrap(Val), unwrap(DestTy), Name));
4358}
4359
4361 LLVMTypeRef DestTy, const char *Name) {
4362 return wrap(unwrap(B)->CreateUIToFP(unwrap(Val), unwrap(DestTy), Name));
4363}
4364
4366 LLVMTypeRef DestTy, const char *Name) {
4367 return wrap(unwrap(B)->CreateSIToFP(unwrap(Val), unwrap(DestTy), Name));
4368}
4369
4371 LLVMTypeRef DestTy, const char *Name) {
4372 return wrap(unwrap(B)->CreateFPTrunc(unwrap(Val), unwrap(DestTy), Name));
4373}
4374
4376 LLVMTypeRef DestTy, const char *Name) {
4377 return wrap(unwrap(B)->CreateFPExt(unwrap(Val), unwrap(DestTy), Name));
4378}
4379
4381 LLVMTypeRef DestTy, const char *Name) {
4382 return wrap(unwrap(B)->CreatePtrToInt(unwrap(Val), unwrap(DestTy), Name));
4383}
4384
4386 LLVMTypeRef DestTy, const char *Name) {
4387 return wrap(unwrap(B)->CreateIntToPtr(unwrap(Val), unwrap(DestTy), Name));
4388}
4389
4391 LLVMTypeRef DestTy, const char *Name) {
4392 return wrap(unwrap(B)->CreateBitCast(unwrap(Val), unwrap(DestTy), Name));
4393}
4394
4396 LLVMTypeRef DestTy, const char *Name) {
4397 return wrap(unwrap(B)->CreateAddrSpaceCast(unwrap(Val), unwrap(DestTy), Name));
4398}
4399
4401 LLVMTypeRef DestTy, const char *Name) {
4402 return wrap(unwrap(B)->CreateZExtOrBitCast(unwrap(Val), unwrap(DestTy),
4403 Name));
4404}
4405
4407 LLVMTypeRef DestTy, const char *Name) {
4408 return wrap(unwrap(B)->CreateSExtOrBitCast(unwrap(Val), unwrap(DestTy),
4409 Name));
4410}
4411
4413 LLVMTypeRef DestTy, const char *Name) {
4414 return wrap(unwrap(B)->CreateTruncOrBitCast(unwrap(Val), unwrap(DestTy),
4415 Name));
4416}
4417
4419 LLVMTypeRef DestTy, const char *Name) {
4420 return wrap(unwrap(B)->CreateCast(Instruction::CastOps(map_from_llvmopcode(Op)), unwrap(Val),
4421 unwrap(DestTy), Name));
4422}
4423
4425 LLVMTypeRef DestTy, const char *Name) {
4426 return wrap(unwrap(B)->CreatePointerCast(unwrap(Val), unwrap(DestTy), Name));
4427}
4428
4430 LLVMTypeRef DestTy, LLVMBool IsSigned,
4431 const char *Name) {
4432 return wrap(
4433 unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy), IsSigned, Name));
4434}
4435
4437 LLVMTypeRef DestTy, const char *Name) {
4438 return wrap(unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy),
4439 /*isSigned*/true, Name));
4440}
4441
4443 LLVMTypeRef DestTy, const char *Name) {
4444 return wrap(unwrap(B)->CreateFPCast(unwrap(Val), unwrap(DestTy), Name));
4445}
4446
4448 LLVMTypeRef DestTy, LLVMBool DestIsSigned) {
4450 unwrap(Src), SrcIsSigned, unwrap(DestTy), DestIsSigned));
4451}
4452
4453/*--.. Comparisons .........................................................--*/
4454
4457 const char *Name) {
4458 return wrap(unwrap(B)->CreateICmp(static_cast<ICmpInst::Predicate>(Op),
4459 unwrap(LHS), unwrap(RHS), Name));
4460}
4461
4464 const char *Name) {
4465 return wrap(unwrap(B)->CreateFCmp(static_cast<FCmpInst::Predicate>(Op),
4466 unwrap(LHS), unwrap(RHS), Name));
4467}
4468
4469/*--.. Miscellaneous instructions ..........................................--*/
4470
4472 return wrap(unwrap(B)->CreatePHI(unwrap(Ty), 0, Name));
4473}
4474
4476 LLVMValueRef *Args, unsigned NumArgs,
4477 const char *Name) {
4479 return wrap(unwrap(B)->CreateCall(FTy, unwrap(Fn),
4480 ArrayRef(unwrap(Args), NumArgs), Name));
4481}
4482
4485 LLVMValueRef Fn, LLVMValueRef *Args,
4486 unsigned NumArgs, LLVMOperandBundleRef *Bundles,
4487 unsigned NumBundles, const char *Name) {
4490 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
4491 OperandBundleDef *OB = unwrap(Bundle);
4492 OBs.push_back(*OB);
4493 }
4494 return wrap(unwrap(B)->CreateCall(
4495 FTy, unwrap(Fn), ArrayRef(unwrap(Args), NumArgs), OBs, Name));
4496}
4497
4499 LLVMValueRef Then, LLVMValueRef Else,
4500 const char *Name) {
4501 return wrap(unwrap(B)->CreateSelect(unwrap(If), unwrap(Then), unwrap(Else),
4502 Name));
4503}
4504
4506 LLVMTypeRef Ty, const char *Name) {
4507 return wrap(unwrap(B)->CreateVAArg(unwrap(List), unwrap(Ty), Name));
4508}
4509
4511 LLVMValueRef Index, const char *Name) {
4512 return wrap(unwrap(B)->CreateExtractElement(unwrap(VecVal), unwrap(Index),
4513 Name));
4514}
4515
4517 LLVMValueRef EltVal, LLVMValueRef Index,
4518 const char *Name) {
4519 return wrap(unwrap(B)->CreateInsertElement(unwrap(VecVal), unwrap(EltVal),
4520 unwrap(Index), Name));
4521}
4522
4524 LLVMValueRef V2, LLVMValueRef Mask,
4525 const char *Name) {
4526 return wrap(unwrap(B)->CreateShuffleVector(unwrap(V1), unwrap(V2),
4527 unwrap(Mask), Name));
4528}
4529
4531 unsigned Index, const char *Name) {
4532 return wrap(unwrap(B)->CreateExtractValue(unwrap(AggVal), Index, Name));
4533}
4534
4536 LLVMValueRef EltVal, unsigned Index,
4537 const char *Name) {
4538 return wrap(unwrap(B)->CreateInsertValue(unwrap(AggVal), unwrap(EltVal),
4539 Index, Name));
4540}
4541
4543 const char *Name) {
4544 return wrap(unwrap(B)->CreateFreeze(unwrap(Val), Name));
4545}
4546
4549 const char *Name) {
4550 return wrap(unwrap(B)->CreateBitInsert(unwrap(Base), unwrap(Val),
4551 unwrap(Offset), Name));
4552}
4553
4556 const char *Name) {
4557 return wrap(unwrap(B)->CreateBitExtract(unwrap(Ty), unwrap(Src),
4558 unwrap(Offset), Name));
4559}
4560
4562 const char *Name) {
4563 return wrap(unwrap(B)->CreateIsNull(unwrap(Val), Name));
4564}
4565
4567 const char *Name) {
4568 return wrap(unwrap(B)->CreateIsNotNull(unwrap(Val), Name));
4569}
4570
4573 const char *Name) {
4574 IRBuilderBase *Builder = unwrap(B);
4575 Value *Diff =
4576 Builder->CreatePtrDiff(unwrap(ElemTy), unwrap(LHS), unwrap(RHS), Name);
4577 return wrap(Builder->CreateSExtOrTrunc(Diff, Builder->getInt64Ty()));
4578}
4579
4581 LLVMValueRef PTR, LLVMValueRef Val,
4582 LLVMAtomicOrdering ordering,
4583 LLVMBool singleThread) {
4585 return wrap(unwrap(B)->CreateAtomicRMW(
4586 intop, unwrap(PTR), unwrap(Val), MaybeAlign(),
4587 mapFromLLVMOrdering(ordering),
4588 singleThread ? SyncScope::SingleThread : SyncScope::System));
4589}
4590
4593 LLVMValueRef PTR, LLVMValueRef Val,
4594 LLVMAtomicOrdering ordering,
4595 unsigned SSID) {
4597 return wrap(unwrap(B)->CreateAtomicRMW(intop, unwrap(PTR), unwrap(Val),
4598 MaybeAlign(),
4599 mapFromLLVMOrdering(ordering), SSID));
4600}
4601
4603 LLVMValueRef Cmp, LLVMValueRef New,
4604 LLVMAtomicOrdering SuccessOrdering,
4605 LLVMAtomicOrdering FailureOrdering,
4606 LLVMBool singleThread) {
4607
4608 return wrap(unwrap(B)->CreateAtomicCmpXchg(
4609 unwrap(Ptr), unwrap(Cmp), unwrap(New), MaybeAlign(),
4610 mapFromLLVMOrdering(SuccessOrdering),
4611 mapFromLLVMOrdering(FailureOrdering),
4612 singleThread ? SyncScope::SingleThread : SyncScope::System));
4613}
4614
4616 LLVMValueRef Cmp, LLVMValueRef New,
4617 LLVMAtomicOrdering SuccessOrdering,
4618 LLVMAtomicOrdering FailureOrdering,
4619 unsigned SSID) {
4620 return wrap(unwrap(B)->CreateAtomicCmpXchg(
4621 unwrap(Ptr), unwrap(Cmp), unwrap(New), MaybeAlign(),
4622 mapFromLLVMOrdering(SuccessOrdering),
4623 mapFromLLVMOrdering(FailureOrdering), SSID));
4624}
4625
4627 Value *P = unwrap(SVInst);
4629 return I->getShuffleMask().size();
4630}
4631
4632int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt) {
4633 Value *P = unwrap(SVInst);
4635 return I->getMaskValue(Elt);
4636}
4637
4639
4641 return unwrap<Instruction>(Inst)->isAtomic();
4642}
4643
4645 // Backwards compatibility: return false for non-atomic instructions
4646 Instruction *I = unwrap<Instruction>(AtomicInst);
4647 if (!I->isAtomic())
4648 return 0;
4649
4651}
4652
4654 // Backwards compatibility: ignore non-atomic instructions
4655 Instruction *I = unwrap<Instruction>(AtomicInst);
4656 if (!I->isAtomic())
4657 return;
4658
4660 setAtomicSyncScopeID(I, SSID);
4661}
4662
4664 Instruction *I = unwrap<Instruction>(AtomicInst);
4665 assert(I->isAtomic() && "Expected an atomic instruction");
4666 return *getAtomicSyncScopeID(I);
4667}
4668
4669void LLVMSetAtomicSyncScopeID(LLVMValueRef AtomicInst, unsigned SSID) {
4670 Instruction *I = unwrap<Instruction>(AtomicInst);
4671 assert(I->isAtomic() && "Expected an atomic instruction");
4672 setAtomicSyncScopeID(I, SSID);
4673}
4674
4676 Value *P = unwrap(CmpXchgInst);
4677 return mapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getSuccessOrdering());
4678}
4679
4681 LLVMAtomicOrdering Ordering) {
4682 Value *P = unwrap(CmpXchgInst);
4683 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4684
4685 return cast<AtomicCmpXchgInst>(P)->setSuccessOrdering(O);
4686}
4687
4689 Value *P = unwrap(CmpXchgInst);
4690 return mapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getFailureOrdering());
4691}
4692
4694 LLVMAtomicOrdering Ordering) {
4695 Value *P = unwrap(CmpXchgInst);
4696 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4697
4698 return cast<AtomicCmpXchgInst>(P)->setFailureOrdering(O);
4699}
4700
4701/*===-- Module providers --------------------------------------------------===*/
4702
4707
4711
4712
4713/*===-- Memory buffers ----------------------------------------------------===*/
4714
4716 const char *Path,
4717 LLVMMemoryBufferRef *OutMemBuf,
4718 char **OutMessage) {
4719
4721 if (std::error_code EC = MBOrErr.getError()) {
4722 *OutMessage = strdup(EC.message().c_str());
4723 return 1;
4724 }
4725 *OutMemBuf = wrap(MBOrErr.get().release());
4726 return 0;
4727}
4728
4730 char **OutMessage) {
4732 if (std::error_code EC = MBOrErr.getError()) {
4733 *OutMessage = strdup(EC.message().c_str());
4734 return 1;
4735 }
4736 *OutMemBuf = wrap(MBOrErr.get().release());
4737 return 0;
4738}
4739
4741 const char *InputData,
4742 size_t InputDataLength,
4743 const char *BufferName,
4744 LLVMBool RequiresNullTerminator) {
4745
4746 return wrap(MemoryBuffer::getMemBuffer(StringRef(InputData, InputDataLength),
4747 StringRef(BufferName),
4748 RequiresNullTerminator).release());
4749}
4750
4752 const char *InputData,
4753 size_t InputDataLength,
4754 const char *BufferName) {
4755
4756 return wrap(
4757 MemoryBuffer::getMemBufferCopy(StringRef(InputData, InputDataLength),
4758 StringRef(BufferName)).release());
4759}
4760
4762 return unwrap(MemBuf)->getBufferStart();
4763}
4764
4766 return unwrap(MemBuf)->getBufferSize();
4767}
4768
4770 delete unwrap(MemBuf);
4771}
4772
4773/*===-- Pass Manager ------------------------------------------------------===*/
4774
4778
4782
4787
4791
4795
4799
4803
4805 delete unwrap(PM);
4806}
4807
4808/*===-- Threading ------------------------------------------------------===*/
4809
4813
4816
4820
4821/*===-- Data Layout ----------------------------------------------------===*/
4822
4824 return wrap(&unwrap(M)->getDataLayout());
4825}
4826
4828 unwrap(M)->setDataLayout(*unwrap(DL));
4829}
4830
4832 return wrap(new DataLayout(StringRep));
4833}
4834
4836
4838 std::string StringRep = unwrap(TD)->getStringRepresentation();
4839 return strdup(StringRep.c_str());
4840}
4841
4845
4847 return unwrap(TD)->getPointerSize(0);
4848}
4849
4850unsigned LLVMPointerSizeForAS(LLVMTargetDataRef TD, unsigned AS) {
4851 return unwrap(TD)->getPointerSize(AS);
4852}
4853
4857
4859 return wrap(
4860 unwrap(TD)->getIntPtrType(*unwrap(getGlobalContextForCAPI()), AS));
4861}
4862
4866
4868 unsigned AS) {
4869 return wrap(unwrap(TD)->getIntPtrType(*unwrap(C), AS));
4870}
4871
4873 return unwrap(TD)->getTypeSizeInBits(unwrap(Ty));
4874}
4875
4877 return unwrap(TD)->getTypeStoreSize(unwrap(Ty));
4878}
4879
4881 return unwrap(TD)->getTypeAllocSize(unwrap(Ty));
4882}
4883
4885 return unwrap(TD)->getABITypeAlign(unwrap(Ty)).value();
4886}
4887
4889 return unwrap(TD)->getABITypeAlign(unwrap(Ty)).value();
4890}
4891
4893 return unwrap(TD)->getPrefTypeAlign(unwrap(Ty)).value();
4894}
4895
4897 LLVMValueRef GlobalVar) {
4898 return unwrap(TD)
4899 ->getPreferredAlign(unwrap<GlobalVariable>(GlobalVar))
4900 .value();
4901}
4902
4904 unsigned long long Offset) {
4905 StructType *STy = unwrap<StructType>(StructTy);
4906 return unwrap(TD)->getStructLayout(STy)->getElementContainingOffset(Offset);
4907}
4908
4910 LLVMTypeRef StructTy, unsigned Element) {
4911 StructType *STy = unwrap<StructType>(StructTy);
4912 return unwrap(TD)->getStructLayout(STy)->getElementOffset(Element);
4913}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
unsigned 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:280
#define LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_POP
Definition Compiler.h:281
#define LLVM_EXTENSION
LLVM_EXTENSION - Support compilers where we have a keyword to suppress pedantic diagnostics.
Definition Compiler.h:497
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:3003
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:3468
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:3788
static FastMathFlags mapFromLLVMFastMathFlags(LLVMFastMathFlags FMF)
Definition Core.cpp:3775
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:4854
LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char Str[], uint8_t Radix)
Definition Core.cpp:1594
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:4108
static Intrinsic::ID llvm_map_to_intrinsic_id(unsigned ID)
Definition Core.cpp:2594
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:4124
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:3014
LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3954
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:4178
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:4858
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:3464
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:4140
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:6034
LLVM_ABI double convertToDouble() const
Converts this APFloat to host double value.
Definition APFloat.cpp:6093
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:2918
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:68
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:2233
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:4823
LLVMTargetDataRef LLVMCreateTargetData(const char *StringRep)
Creates target data from a target layout string.
Definition Core.cpp:4831
unsigned LLVMPreferredAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the preferred alignment of a type in bytes for a target.
Definition Core.cpp:4892
unsigned LLVMCallFrameAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the call frame alignment of a type in bytes for a target.
Definition Core.cpp:4888
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:4909
void LLVMDisposeTargetData(LLVMTargetDataRef TD)
Deallocates a TargetData.
Definition Core.cpp:4835
LLVMByteOrdering LLVMByteOrder(LLVMTargetDataRef TD)
Returns the byte order of a target, either LLVMBigEndian or LLVMLittleEndian.
Definition Core.cpp:4842
unsigned LLVMPreferredAlignmentOfGlobal(LLVMTargetDataRef TD, LLVMValueRef GlobalVar)
Computes the preferred alignment of a global variable in bytes for a target.
Definition Core.cpp:4896
unsigned long long LLVMStoreSizeOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the storage size of a type in bytes for a target.
Definition Core.cpp:4876
LLVMByteOrdering
Definition Core.h:5402
unsigned long long LLVMABISizeOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the ABI size of a type in bytes for a target.
Definition Core.cpp:4880
unsigned LLVMPointerSizeForAS(LLVMTargetDataRef TD, unsigned AS)
Returns the pointer size in bytes for a target for a specified address space.
Definition Core.cpp:4850
unsigned LLVMABIAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the ABI alignment of a type in bytes for a target.
Definition Core.cpp:4884
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:4903
LLVMTypeRef LLVMIntPtrTypeInContext(LLVMContextRef C, LLVMTargetDataRef TD)
Returns the integer type that is the same size as a pointer on a target.
Definition Core.cpp:4863
char * LLVMCopyStringRepOfTargetData(LLVMTargetDataRef TD)
Converts target data to a target layout string.
Definition Core.cpp:4837
unsigned LLVMPointerSize(LLVMTargetDataRef TD)
Returns the pointer size in bytes for a target.
Definition Core.cpp:4846
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:4867
void LLVMSetModuleDataLayout(LLVMModuleRef M, LLVMTargetDataRef DL)
Set the data layout for a module.
Definition Core.cpp:4827
unsigned long long LLVMSizeOfTypeInBits(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the size of a type in bits for a target.
Definition Core.cpp:4872
@ LLVMBigEndian
Definition Core.h:5402
@ LLVMLittleEndian
Definition Core.h:5402
LLVMValueRef LLVMBuildAggregateRet(LLVMBuilderRef B, LLVMValueRef *RetVals, unsigned N)
Definition Core.cpp:3584
LLVMValueRef LLVMBuildMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3848
LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef B)
Definition Core.cpp:3576
LLVMValueRef LLVMBuildSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3828
LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3858
LLVMBool LLVMGetWeak(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4290
LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4418
LLVMValueRef LLVMBuildIsNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4561
LLVMValueRef LLVMBuildGEPWithNoWrapFlags(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name, LLVMGEPNoWrapFlags NoWrapFlags)
Creates a GetElementPtr instruction.
Definition Core.cpp:4248
LLVMValueRef LLVMBuildAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3808
void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak)
Definition Core.cpp:4294
LLVMValueRef LLVMBuildOr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3928
LLVMValueRef LLVMBuildBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4390
LLVMValueRef LLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3873
LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition Core.cpp:4233
LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3833
void LLVMPositionBuilderBeforeInstrAndDbgRecords(LLVMBuilderRef Builder, LLVMValueRef Instr)
Set the builder position before Instr and any attached debug records.
Definition Core.cpp:3493
LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4566
void LLVMDisposeBuilder(LLVMBuilderRef Builder)
Definition Core.cpp:3521
void LLVMClearInsertionPosition(LLVMBuilderRef Builder)
Definition Core.cpp:3508
LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PersFn, unsigned NumClauses, const char *Name)
Definition Core.cpp:3650
void LLVMSetIsDisjoint(LLVMValueRef Inst, LLVMBool IsDisjoint)
Sets the disjoint flag for the instruction.
Definition Core.cpp:4031
LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst)
Definition Core.cpp:4644
LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn)
Definition Core.cpp:3680
void LLVMSetAtomicRMWBinOp(LLVMValueRef Inst, LLVMAtomicRMWBinOp BinOp)
Definition Core.cpp:4329
LLVMValueRef LLVMBuildFDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3888
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:3636
LLVMValueRef LLVMBuildXor(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3933
LLVMValueRef LLVMBuildBitExtract(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Src, LLVMValueRef Offset, const char *Name)
Definition Core.cpp:4554
LLVMBool LLVMGetExact(LLVMValueRef DivOrShrInst)
Definition Core.cpp:3990
LLVMValueRef LLVMBuildAddrSpaceCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4395
unsigned LLVMGetNumMaskElements(LLVMValueRef SVInst)
Get the number of elements in the mask of a ShuffleVector instruction.
Definition Core.cpp:4626
void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr)
Definition Core.cpp:3512
LLVMValueRef LLVMBuildCleanupRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition Core.cpp:3701
LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4355
void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers)
Obtain the basic blocks acting as handlers for a catchswitch instruction.
Definition Core.cpp:3748
LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4335
LLVMValueRef LLVMGetArgOperand(LLVMValueRef Funclet, unsigned i)
Definition Core.cpp:3765
LLVMValueRef LLVMBuildAnd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3923
unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch)
Definition Core.cpp:3744
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:3608
LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder)
Definition Core.cpp:3504
LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3878
LLVMValueRef LLVMBuildSExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4406
LLVMValueRef LLVMBuildCall2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:4475
void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW)
Definition Core.cpp:3985
LLVMMetadataRef LLVMGetCurrentDebugLocation2(LLVMBuilderRef Builder)
Get location information used by debugging information.
Definition Core.cpp:3527
LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3868
LLVMValueRef LLVMBuildSelect(LLVMBuilderRef B, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, const char *Name)
Definition Core.cpp:4498
void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr)
Set the builder position before Instr but after any attached debug records.
Definition Core.cpp:3488
LLVMBool LLVMCanValueUseFastMathFlags(LLVMValueRef V)
Check if a given value can potentially have fast math flags.
Definition Core.cpp:4021
void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value)
Definition Core.cpp:3769
LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef B, LLVMValueRef If, LLVMBasicBlockRef Then, LLVMBasicBlockRef Else)
Definition Core.cpp:3593
LLVMBool LLVMGetNUW(LLVMValueRef ArithInst)
Definition Core.cpp:3970
LLVMOpcode LLVMGetCastOpcode(LLVMValueRef Src, LLVMBool SrcIsSigned, LLVMTypeRef DestTy, LLVMBool DestIsSigned)
Definition Core.cpp:4447
void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr, const char *Name)
Definition Core.cpp:3516
LLVMValueRef LLVMBuildSRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3898
LLVMValueRef LLVMBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:3669
LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Deprecated: This cast is always signed.
Definition Core.cpp:4436
LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder)
Deprecated: Returning the NULL location will crash.
Definition Core.cpp:3544
LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef Index, const char *Name)
Definition Core.cpp:4510
LLVMValueRef LLVMBuildShl(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3908
LLVMBuilderRef LLVMCreateBuilderInContext(LLVMContextRef C)
Definition Core.cpp:3460
LLVMValueRef LLVMBuildCatchRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition Core.cpp:3695
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:4075
LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemAccessInst)
Definition Core.cpp:4298
LLVMValueRef LLVMBuildStructGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, unsigned Idx, const char *Name)
Definition Core.cpp:4258
int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt)
Get the mask value at position Elt in the mask of a ShuffleVector instruction.
Definition Core.cpp:4632
void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal, LLVMBasicBlockRef Dest)
Definition Core.cpp:3711
LLVMValueRef LLVMBuildBr(LLVMBuilderRef B, LLVMBasicBlockRef Dest)
Definition Core.cpp:3589
LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, const char *Name)
Definition Core.cpp:4516
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:3481
void LLVMSetFastMathFlags(LLVMValueRef FPMathInst, LLVMFastMathFlags FMF)
Sets the flags for which fast-math-style optimizations are allowed for this value.
Definition Core.cpp:4016
LLVMValueRef LLVMBuildIntCast2(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, LLVMBool IsSigned, const char *Name)
Definition Core.cpp:4429
LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3838
LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3823
LLVMValueRef LLVMBuildCatchPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:3662
LLVMValueRef LLVMBuildCallWithOperandBundles(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name)
Definition Core.cpp:4484
LLVMBool LLVMIsCleanup(LLVMValueRef LandingPad)
Definition Core.cpp:3732
LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4400
LLVMBool LLVMGetVolatile(LLVMValueRef Inst)
Definition Core.cpp:4275
LLVMValueRef LLVMBuildFPCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4442
LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4380
LLVMValueRef LLVMBuildPtrDiff2(LLVMBuilderRef B, LLVMTypeRef ElemTy, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4571
LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4412
LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4089
LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx)
Definition Core.cpp:3724
unsigned LLVMGetAtomicSyncScopeID(LLVMValueRef AtomicInst)
Returns the synchronization scope ID of an atomic instruction.
Definition Core.cpp:4663
LLVMValueRef LLVMBuildVAArg(LLVMBuilderRef B, LLVMValueRef List, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4505
LLVMValueRef LLVMBuildAtomicCmpXchgSyncScope(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, unsigned SSID)
Definition Core.cpp:4615
LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3938
LLVMBool LLVMIsAtomic(LLVMValueRef Inst)
Returns whether an instruction is an atomic instruction, e.g., atomicrmw, cmpxchg,...
Definition Core.cpp:4640
void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile)
Definition Core.cpp:4279
void LLVMSetAtomicSingleThread(LLVMValueRef AtomicInst, LLVMBool NewValue)
Definition Core.cpp:4653
LLVMValueRef LLVMBuildFRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3903
LLVMValueRef LLVMBuildURem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3893
LLVMValueRef LLVMBuildIntToPtr(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4385
LLVMBool LLVMGetNSW(LLVMValueRef ArithInst)
Definition Core.cpp:3980
LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3853
LLVMValueRef LLVMBuildFree(LLVMBuilderRef B, LLVMValueRef PointerVal)
Definition Core.cpp:4094
LLVMValueRef LLVMBuildNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3945
LLVMValueRef LLVMBuildFSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3843
LLVMValueRef LLVMBuildCatchSwitch(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMBasicBlockRef UnwindBB, unsigned NumHandlers, const char *Name)
Definition Core.cpp:3684
LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name)
Definition Core.cpp:4098
LLVMValueRef LLVMBuildInBoundsGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition Core.cpp:4240
LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4048
LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, LLVMBool singleThread)
Definition Core.cpp:4602
LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr, unsigned NumDests)
Definition Core.cpp:3603
LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef B)
Definition Core.cpp:3707
LLVMValueRef LLVMBuildSIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4365
LLVMValueRef LLVMBuildSExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4345
LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4350
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:3550
void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Builder, LLVMMetadataRef Loc)
Set location information used by debugging information.
Definition Core.cpp:3531
LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4084
void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L)
Deprecated: Passing the NULL location will crash.
Definition Core.cpp:3538
LLVMValueRef LLVMBuildPhi(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4471
void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest)
Definition Core.cpp:3716
LLVMBool LLVMGetNNeg(LLVMValueRef NonNegInst)
Gets if the instruction has the non-negative flag set.
Definition Core.cpp:4000
LLVMValueRef LLVMBuildAtomicRMWSyncScope(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, unsigned SSID)
Definition Core.cpp:4591
LLVMValueRef LLVMBuildRet(LLVMBuilderRef B, LLVMValueRef V)
Definition Core.cpp:3580
LLVMMetadataRef LLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder)
Get the dafult floating-point math metadata for a given builder.
Definition Core.cpp:3570
LLVMValueRef LLVMBuildExtractValue(LLVMBuilderRef B, LLVMValueRef AggVal, unsigned Index, const char *Name)
Definition Core.cpp:4530
LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str, const char *Name)
Deprecated: Use LLVMBuildGlobalString instead, which has identical behavior.
Definition Core.cpp:4270
LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3813
void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block)
Definition Core.cpp:3499
LLVMValueRef LLVMBuildFMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3863
LLVMValueRef LLVMBuildLShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3913
LLVMAtomicRMWBinOp LLVMGetAtomicRMWBinOp(LLVMValueRef Inst)
Definition Core.cpp:4325
LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3962
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:4059
void LLVMSetAtomicSyncScopeID(LLVMValueRef AtomicInst, unsigned SSID)
Sets the synchronization scope ID of an atomic instruction.
Definition Core.cpp:4669
LLVMContextRef LLVMGetBuilderContext(LLVMBuilderRef Builder)
Obtain the context to which this builder is associated.
Definition Core.cpp:3566
LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4038
LLVMValueRef LLVMBuildFreeze(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4542
LLVMValueRef LLVMBuildGlobalString(LLVMBuilderRef B, const char *Str, const char *Name)
Definition Core.cpp:4265
void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW)
Definition Core.cpp:3975
LLVMAtomicOrdering LLVMGetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4675
LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef B, LLVMRealPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4462
LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4424
LLVMValueRef LLVMBuildExactSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3883
LLVMValueRef LLVMBuildShuffleVector(LLVMBuilderRef B, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, const char *Name)
Definition Core.cpp:4523
LLVMValueRef LLVMBuildFPExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4375
void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val)
Definition Core.cpp:3736
LLVMValueRef LLVMBuildICmp(LLVMBuilderRef B, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4455
void LLVMSetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4693
void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal)
Definition Core.cpp:3728
LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, LLVMBool isSingleThread, const char *Name)
Definition Core.cpp:4217
void LLVMSetParentCatchSwitch(LLVMValueRef CatchPad, LLVMValueRef CatchSwitch)
Set the parent catchswitch instruction of a catchpad instruction.
Definition Core.cpp:3758
LLVMValueRef LLVMBuildFenceSyncScope(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, unsigned SSID, const char *Name)
Definition Core.cpp:4226
LLVMValueRef LLVMBuildUIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4360
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:3475
unsigned LLVMGetNumClauses(LLVMValueRef LandingPad)
Definition Core.cpp:3720
int LLVMGetUndefMaskElem(void)
Definition Core.cpp:4638
void LLVMSetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4680
LLVMValueRef LLVMGetParentCatchSwitch(LLVMValueRef CatchPad)
Get the parent catchswitch instruction of a catchpad instruction.
Definition Core.cpp:3754
LLVMFastMathFlags LLVMGetFastMathFlags(LLVMValueRef FPMathInst)
Get the flags for which fast-math-style optimizations are allowed for this value.
Definition Core.cpp:4010
LLVMBool LLVMGetIsDisjoint(LLVMValueRef Inst)
Gets whether the instruction has the disjoint flag set.
Definition Core.cpp:4026
LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef B, LLVMValueRef V, LLVMBasicBlockRef Else, unsigned NumCases)
Definition Core.cpp:3598
void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg)
Sets the non-negative flag for the instruction.
Definition Core.cpp:4005
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:4066
void LLVMAddHandler(LLVMValueRef CatchSwitch, LLVMBasicBlockRef Dest)
Definition Core.cpp:3740
void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact)
Definition Core.cpp:3995
LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3949
LLVMValueRef LLVMBuildAShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3918
LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, const char *Name)
Definition Core.cpp:3627
LLVMValueRef LLVMBuildBitInsert(LLVMBuilderRef B, LLVMValueRef Base, LLVMValueRef Val, LLVMValueRef Offset, const char *Name)
Definition Core.cpp:4547
void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4312
LLVMValueRef LLVMBuildFPTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4370
LLVMValueRef LLVMBuildStore(LLVMBuilderRef B, LLVMValueRef Val, LLVMValueRef PointerVal)
Definition Core.cpp:4103
void LLVMAddMetadataToInst(LLVMBuilderRef Builder, LLVMValueRef Inst)
Same as LLVMSetInstDebugLocation.
Definition Core.cpp:3554
LLVMAtomicOrdering LLVMGetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4688
LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3818
LLVMValueRef LLVMBuildInsertValue(LLVMBuilderRef B, LLVMValueRef AggVal, LLVMValueRef EltVal, unsigned Index, const char *Name)
Definition Core.cpp:4535
void LLVMBuilderSetDefaultFPMathTag(LLVMBuilderRef Builder, LLVMMetadataRef FPMathTag)
Set the default floating-point math metadata for the given builder.
Definition Core.cpp:3558
LLVMValueRef LLVMBuildZExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4340
LLVMValueRef LLVMBuildNot(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3966
LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, LLVMBool singleThread)
Definition Core.cpp:4580
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange(const char *InputData, size_t InputDataLength, const char *BufferName, LLVMBool RequiresNullTerminator)
Definition Core.cpp:4740
size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4765
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData, size_t InputDataLength, const char *BufferName)
Definition Core.cpp:4751
const char * LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4761
LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const char *Path, LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
Definition Core.cpp:4715
LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
Definition Core.cpp:4729
void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4769
LLVMModuleProviderRef LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M)
Changes the type of M so it can be passed to FunctionPassManagers and the JIT.
Definition Core.cpp:4704
void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP)
Destroys the module M.
Definition Core.cpp:4708
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:2534
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:2555
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:2522
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:2516
LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn)
Decrement a Function iterator to the previous Function.
Definition Core.cpp:2563
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:2547
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:2530
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:2539
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:2881
unsigned LLVMGetNumOperandBundleArgs(LLVMOperandBundleRef Bundle)
Obtain the number of operands for an operand bundle.
Definition Core.cpp:2898
const char * LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len)
Obtain the tag of an operand bundle as a string.
Definition Core.cpp:2892
void LLVMDisposeOperandBundle(LLVMOperandBundleRef Bundle)
Destroy an operand bundle.
Definition Core.cpp:2888
LLVMValueRef LLVMGetOperandBundleArgAtIndex(LLVMOperandBundleRef Bundle, unsigned Index)
Obtain the operand for an operand bundle at the given index.
Definition Core.cpp:2902
LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef P)
Deprecated: Use LLVMCreateFunctionPassManagerForModule instead.
Definition Core.cpp:4783
LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M)
Constructs a new function-by-function pass pipeline over the module provider.
Definition Core.cpp:4779
LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM)
Finalizes all of the function passes scheduled in the function pass manager.
Definition Core.cpp:4800
void LLVMDisposePassManager(LLVMPassManagerRef PM)
Frees the memory of a pass pipeline.
Definition Core.cpp:4804
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:4796
LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM)
Initializes all of the function passes scheduled in the function pass manager.
Definition Core.cpp:4792
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:4788
LLVMPassManagerRef LLVMCreatePassManager()
Constructs a new whole-module pass pipeline.
Definition Core.cpp:4775
void LLVMStopMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
Definition Core.cpp:4814
LLVMBool LLVMStartMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
Definition Core.cpp:4810
LLVMBool LLVMIsMultithreaded()
Check whether LLVM is executing in thread-safe mode or not.
Definition Core.cpp:4817
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:3049
void LLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to after another one.
Definition Core.cpp:3031
LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn)
Obtain the first basic block in a function.
Definition Core.cpp:2947
LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C, const char *Name)
Create a new basic block without inserting it into a function.
Definition Core.cpp:2979
LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB)
Go backwards in a basic block iterator.
Definition Core.cpp:2971
LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn)
Obtain the last basic block in a function.
Definition Core.cpp:2955
LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB)
Obtain the terminator instruction for a basic block.
Definition Core.cpp:2929
const char * LLVMGetBasicBlockName(LLVMBasicBlockRef BB)
Obtain the string name of a basic block.
Definition Core.cpp:2921
void LLVMAppendExistingBasicBlock(LLVMValueRef Fn, LLVMBasicBlockRef BB)
Append the given basic block to the basic block list of the given function.
Definition Core.cpp:2992
void LLVMDeleteBasicBlock(LLVMBasicBlockRef BBRef)
Remove a basic block from a function and delete it.
Definition Core.cpp:3019
LLVMBasicBlockRef LLVMInsertBasicBlockInContext(LLVMContextRef C, LLVMBasicBlockRef BBRef, const char *Name)
Insert a basic block in a function before another basic block.
Definition Core.cpp:3007
void LLVMGetBasicBlocks(LLVMValueRef FnRef, LLVMBasicBlockRef *BasicBlocksRefs)
Obtain all of the basic blocks in a function.
Definition Core.cpp:2937
void LLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to before another one.
Definition Core.cpp:3027
LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB)
Obtain the function to which a basic block belongs.
Definition Core.cpp:2925
LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn)
Obtain the basic block that corresponds to the entry point of a function.
Definition Core.cpp:2943
LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB)
Obtain the first instruction in a basic block.
Definition Core.cpp:3041
void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder, LLVMBasicBlockRef BB)
Insert the given basic block after the insertion point of the given builder.
Definition Core.cpp:2984
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB)
Convert a basic block instance to a value type.
Definition Core.cpp:2909
LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val)
Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
Definition Core.cpp:2917
void LLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BBRef)
Remove a basic block from a function.
Definition Core.cpp:3023
LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB)
Advance a basic block iterator.
Definition Core.cpp:2963
unsigned LLVMCountBasicBlocks(LLVMValueRef FnRef)
Obtain the number of basic blocks in a function.
Definition Core.cpp:2933
LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C, LLVMValueRef FnRef, const char *Name)
Append a basic block to the end of a function.
Definition Core.cpp:2997
LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val)
Determine whether an LLVMValueRef is itself a basic block.
Definition Core.cpp:2913
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
LLVMUnnamedAddr LLVMGetUnnamedAddress(LLVMValueRef Global)
Definition Core.cpp:2184
LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global)
Returns the "value type" of a global value.
Definition Core.cpp:2219
unsigned LLVMGetAlignment(LLVMValueRef V)
Obtain the preferred alignment of the value.
Definition Core.cpp:2225
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:2300
void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage)
Definition Core.cpp:2089
void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr)
Deprecated: Use LLVMSetUnnamedAddress instead.
Definition Core.cpp:2213
LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global)
Definition Core.cpp:2052
unsigned LLVMValueMetadataEntriesGetKind(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the kind of a value metadata entry at a specific index.
Definition Core.cpp:2281
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:2269
void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes)
Set the preferred alignment of the value.
Definition Core.cpp:2247
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:2310
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:2314
void LLVMGlobalAddMetadata(LLVMValueRef Global, unsigned Kind, LLVMMetadataRef MD)
Adds a metadata attachment.
Definition Core.cpp:2305
LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global)
Deprecated: Use LLVMGetUnnamedAddress instead.
Definition Core.cpp:2209
LLVMMetadataRef LLVMValueMetadataEntriesGetMetadata(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the underlying metadata node of a value metadata entry at a specific index.
Definition Core.cpp:2289
void LLVMDisposeValueMetadataEntries(LLVMValueMetadataEntry *Entries)
Destroys value metadata entries.
Definition Core.cpp:2296
void LLVMGlobalAddDebugInfo(LLVMValueRef Global, LLVMMetadataRef GVE)
Add debuginfo metadata to this global.
Definition Core.cpp:2318
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:2802
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align)
Set the alignment for a function parameter.
Definition Core.cpp:2809
unsigned LLVMCountParams(LLVMValueRef FnRef)
Obtain the number of parameters in a function.
Definition Core.cpp:2757
void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs)
Obtain the parameters in a function.
Definition Core.cpp:2763
LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn)
Obtain the first parameter to a function.
Definition Core.cpp:2778
LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn)
Obtain the last parameter to a function.
Definition Core.cpp:2786
LLVMValueRef LLVMGetParam(LLVMValueRef FnRef, unsigned index)
Obtain the parameter at the specified index.
Definition Core.cpp:2769
LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg)
Obtain the next parameter to a function.
Definition Core.cpp:2794
LLVMValueRef LLVMGetParamParent(LLVMValueRef V)
Obtain the function to which this argument belongs.
Definition Core.cpp:2774
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:2633
void LLVMAddAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Add an attribute to a function.
Definition Core.cpp:2707
LLVMValueRef LLVMGetPrefixData(LLVMValueRef Fn)
Gets the prefix data associated with a function.
Definition Core.cpp:2675
LLVMValueRef LLVMGetPrologueData(LLVMValueRef Fn)
Gets the prologue data associated with a function.
Definition Core.cpp:2691
unsigned LLVMGetIntrinsicID(LLVMValueRef Fn)
Obtain the ID number from a function instance.
Definition Core.cpp:2588
LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn)
Obtain the personality function attached to the function.
Definition Core.cpp:2579
unsigned LLVMGetAttributeCountAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx)
Definition Core.cpp:2712
LLVMBool LLVMHasPersonalityFn(LLVMValueRef Fn)
Check whether the given function has a personality function.
Definition Core.cpp:2575
void LLVMRemoveStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:2743
void LLVMSetPrefixData(LLVMValueRef Fn, LLVMValueRef prefixData)
Sets the prefix data for the function.
Definition Core.cpp:2685
const char * LLVMGetGC(LLVMValueRef Fn)
Obtain the name of the garbage collector to use during code generation.
Definition Core.cpp:2662
char * LLVMIntrinsicCopyOverloadedName(unsigned ID, LLVMTypeRef *OverloadTypes, size_t OverloadCount, size_t *NameLength)
Deprecated: Use LLVMIntrinsicCopyOverloadedName2 instead.
Definition Core.cpp:2623
void LLVMSetGC(LLVMValueRef Fn, const char *GC)
Define the garbage collector to use during code generation.
Definition Core.cpp:2667
void LLVMSetPrologueData(LLVMValueRef Fn, LLVMValueRef prologueData)
Sets the prologue data for the function.
Definition Core.cpp:2701
void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn)
Set the personality function attached to the function.
Definition Core.cpp:2583
void LLVMGetAttributesAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
Definition Core.cpp:2717
unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn)
Obtain the calling function of a function.
Definition Core.cpp:2653
LLVMBool LLVMIntrinsicIsOverloaded(unsigned ID)
Obtain if the intrinsic identified by the given ID is overloaded.
Definition Core.cpp:2648
void LLVMDeleteFunction(LLVMValueRef Fn)
Remove a function from its containing module and deletes it.
Definition Core.cpp:2571
void LLVMRemoveEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:2738
LLVMAttributeRef LLVMGetEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:2724
unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen)
Obtain the intrinsic ID number which matches the given function name.
Definition Core.cpp:2644
const char * LLVMIntrinsicGetName(unsigned ID, size_t *NameLength)
Retrieves the name of an intrinsic.
Definition Core.cpp:2608
LLVMValueRef LLVMGetIntrinsicDeclaration(LLVMModuleRef Mod, unsigned ID, LLVMTypeRef *OverloadTypes, size_t OverloadCount)
Get or insert the declaration of an intrinsic.
Definition Core.cpp:2599
LLVMBool LLVMHasPrologueData(LLVMValueRef Fn)
Check if a given function has prologue data.
Definition Core.cpp:2696
LLVMBool LLVMHasPrefixData(LLVMValueRef Fn)
Check if a given function has prefix data.
Definition Core.cpp:2680
void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC)
Set the calling convention of a function.
Definition Core.cpp:2657
LLVMTypeRef LLVMIntrinsicGetType(LLVMContextRef Ctx, unsigned ID, LLVMTypeRef *OverloadTypes, size_t OverloadCount)
Retrieves the type of an intrinsic.
Definition Core.cpp:2615
void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A, const char *V)
Add a target-dependent attribute to a function.
Definition Core.cpp:2748
LLVMAttributeRef LLVMGetStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:2731
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:2831
LLVMValueRef LLVMGetNamedGlobalIFunc(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalIFunc value from a Module by its name.
Definition Core.cpp:2826
void LLVMRemoveGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module.
Definition Core.cpp:2875
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:2816
LLVMValueRef LLVMGetNextGlobalIFunc(LLVMValueRef IFunc)
Advance a GlobalIFunc iterator to the next GlobalIFunc.
Definition Core.cpp:2847
LLVMValueRef LLVMGetPreviousGlobalIFunc(LLVMValueRef IFunc)
Decrement a GlobalIFunc iterator to the previous GlobalIFunc.
Definition Core.cpp:2855
LLVMValueRef LLVMGetGlobalIFuncResolver(LLVMValueRef IFunc)
Retrieves the resolver function associated with this indirect function, or NULL if it doesn't not exi...
Definition Core.cpp:2863
void LLVMSetGlobalIFuncResolver(LLVMValueRef IFunc, LLVMValueRef Resolver)
Sets the resolver function associated with this indirect function.
Definition Core.cpp:2867
LLVMValueRef LLVMGetLastGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the last GlobalIFunc in a Module.
Definition Core.cpp:2839
void LLVMEraseGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module and delete it.
Definition Core.cpp:2871
LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca)
Obtain the type that is being allocated by the alloca instruction.
Definition Core.cpp:3384
void LLVMSetTailCall(LLVMValueRef Call, LLVMBool isTailCall)
Set whether a call instruction is a tail call.
Definition Core.cpp:3283
void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Definition Core.cpp:3215
unsigned LLVMGetNumOperandBundles(LLVMValueRef C)
Obtain the number of operand bundles attached to this instruction.
Definition Core.cpp:3267
void LLVMRemoveCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:3249
void LLVMRemoveCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:3254
LLVMAttributeRef LLVMGetCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:3235
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr)
Obtain the calling convention for a call instruction.
Definition Core.cpp:3198
LLVMBasicBlockRef LLVMGetCallBrDefaultDest(LLVMValueRef CallBr)
Get the default destination of a CallBr instruction.
Definition Core.cpp:3323
LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr)
Obtain the pointer to the function invoked by this instruction.
Definition Core.cpp:3259
void LLVMSetNormalDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the normal destination basic block.
Definition Core.cpp:3310
LLVMBool LLVMIsTailCall(LLVMValueRef Call)
Obtain whether a call instruction is a tail call.
Definition Core.cpp:3279
LLVMAttributeRef LLVMGetCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:3242
unsigned LLVMGetCallBrNumIndirectDests(LLVMValueRef CallBr)
Get the number of indirect destinations of a CallBr instruction.
Definition Core.cpp:3327
void LLVMGetCallSiteAttributes(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
Definition Core.cpp:3227
LLVMBasicBlockRef LLVMGetNormalDest(LLVMValueRef Invoke)
Return the normal destination basic block.
Definition Core.cpp:3297
unsigned LLVMGetNumArgOperands(LLVMValueRef Instr)
Obtain the argument count for a call instruction.
Definition Core.cpp:3189
void LLVMSetTailCallKind(LLVMValueRef Call, LLVMTailCallKind kind)
Set the call kind of the call instruction.
Definition Core.cpp:3291
LLVMOperandBundleRef LLVMGetOperandBundleAtIndex(LLVMValueRef C, unsigned Index)
Obtain the operand bundle attached to this instruction at the given index.
Definition Core.cpp:3271
LLVMBasicBlockRef LLVMGetCallBrIndirectDest(LLVMValueRef CallBr, unsigned Idx)
Get the indirect destination of a CallBr instruction at the given index.
Definition Core.cpp:3331
LLVMTailCallKind LLVMGetTailCallKind(LLVMValueRef Call)
Obtain a tail call kind of the call instruction.
Definition Core.cpp:3287
void LLVMSetUnwindDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the unwind destination basic block.
Definition Core.cpp:3314
LLVMTypeRef LLVMGetCalledFunctionType(LLVMValueRef Instr)
Obtain the function type called by this instruction.
Definition Core.cpp:3263
LLVMBasicBlockRef LLVMGetUnwindDest(LLVMValueRef Invoke)
Return the unwind destination basic block.
Definition Core.cpp:3301
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, LLVMAttributeIndex Idx, unsigned align)
Definition Core.cpp:3207
unsigned LLVMGetCallSiteAttributeCount(LLVMValueRef C, LLVMAttributeIndex Idx)
Definition Core.cpp:3220
void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC)
Set the calling convention for a call instruction.
Definition Core.cpp:3202
LLVMGEPNoWrapFlags LLVMGEPGetNoWrapFlags(LLVMValueRef GEP)
Get the no-wrap related flags for the given GEP instruction.
Definition Core.cpp:3402
LLVMBool LLVMIsInBounds(LLVMValueRef GEP)
Check whether the given GEP operator is inbounds.
Definition Core.cpp:3390
void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds)
Set the given GEP instruction to be inbounds or not.
Definition Core.cpp:3394
LLVMTypeRef LLVMGetGEPSourceElementType(LLVMValueRef GEP)
Get the source element type of the given GEP operator.
Definition Core.cpp:3398
void LLVMGEPSetNoWrapFlags(LLVMValueRef GEP, LLVMGEPNoWrapFlags NoWrapFlags)
Set the no-wrap related flags for the given GEP instruction.
Definition Core.cpp:3407
unsigned LLVMGetNumIndices(LLVMValueRef Inst)
Obtain the number of indices.
Definition Core.cpp:3435
const unsigned * LLVMGetIndices(LLVMValueRef Inst)
Obtain the indices as an array.
Definition Core.cpp:3447
LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
Definition Core.cpp:3429
LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMValueRef.
Definition Core.cpp:3425
void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues, LLVMBasicBlockRef *IncomingBlocks, unsigned Count)
Add an incoming value to the end of a PHI list.
Definition Core.cpp:3414
unsigned LLVMCountIncoming(LLVMValueRef PhiNode)
Obtain the number of incoming basic blocks to a PHI node.
Definition Core.cpp:3421
LLVMValueRef LLVMGetCondition(LLVMValueRef Branch)
Return the condition of a branch instruction.
Definition Core.cpp:3355
LLVMBasicBlockRef LLVMGetSuccessor(LLVMValueRef Term, unsigned i)
Return the specified successor.
Definition Core.cpp:3341
void LLVMSetCondition(LLVMValueRef Branch, LLVMValueRef Cond)
Set the condition of a branch instruction.
Definition Core.cpp:3359
void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block)
Update the specified successor to point at the provided block.
Definition Core.cpp:3345
LLVMValueRef LLVMGetSwitchCaseValue(LLVMValueRef Switch, unsigned i)
Obtain the case value for a successor of a switch instruction.
Definition Core.cpp:3369
LLVMBool LLVMIsConditional(LLVMValueRef Branch)
Return if an instruction is a conditional branch.
Definition Core.cpp:3351
LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef Switch)
Obtain the default destination basic block of a switch instruction.
Definition Core.cpp:3365
void LLVMSetSwitchCaseValue(LLVMValueRef Switch, unsigned i, LLVMValueRef CaseValue)
Set the case value for a successor of a switch instruction.
Definition Core.cpp:3375
unsigned LLVMGetNumSuccessors(LLVMValueRef Term)
Return the number of successors that this terminator has.
Definition Core.cpp:3337
LLVMRealPredicate LLVMGetFCmpPredicate(LLVMValueRef Inst)
Obtain the float predicate of an instruction.
Definition Core.cpp:3099
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:3073
LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst)
Obtain the instruction that occurred before this one.
Definition Core.cpp:3065
LLVMDbgRecordRef LLVMGetPreviousDbgRecord(LLVMDbgRecordRef Rec)
Obtain the previous DbgRecord in the sequence or NULL if there are no more.
Definition Core.cpp:3150
LLVMMetadataRef LLVMDbgVariableRecordGetExpression(LLVMDbgRecordRef Rec)
Get the debug info expression of the DbgVariableRecord.
Definition Core.cpp:3185
LLVMDbgRecordRef LLVMGetFirstDbgRecord(LLVMValueRef Inst)
Obtain the first debug record attached to an instruction.
Definition Core.cpp:3122
LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst)
Obtain the code opcode for an individual instruction.
Definition Core.cpp:3105
LLVMDbgRecordRef LLVMGetNextDbgRecord(LLVMDbgRecordRef Rec)
Obtain the next DbgRecord in the sequence or NULL if there are no more.
Definition Core.cpp:3142
LLVMDbgRecordRef LLVMGetLastDbgRecord(LLVMValueRef Inst)
Obtain the last debug record attached to an instruction.
Definition Core.cpp:3132
LLVMMetadataRef LLVMDbgVariableRecordGetVariable(LLVMDbgRecordRef Rec)
Get the debug info variable of the DbgVariableRecord.
Definition Core.cpp:3181
LLVMValueRef LLVMIsATerminatorInst(LLVMValueRef Inst)
Determine whether an instruction is a terminator.
Definition Core.cpp:3117
LLVMValueRef LLVMDbgVariableRecordGetValue(LLVMDbgRecordRef Rec, unsigned OpIdx)
Get the value of the DbgVariableRecord.
Definition Core.cpp:3176
LLVMDbgRecordKind LLVMDbgRecordGetKind(LLVMDbgRecordRef Rec)
Definition Core.cpp:3162
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:3081
LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst)
Obtain the basic block to which an instruction belongs.
Definition Core.cpp:3037
LLVMMetadataRef LLVMDbgRecordGetDebugLoc(LLVMDbgRecordRef Rec)
Get the debug location attached to the debug record.
Definition Core.cpp:3158
LLVMBool LLVMGetICmpSameSign(LLVMValueRef Inst)
Get whether or not an icmp instruction has the samesign flag.
Definition Core.cpp:3091
LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst)
Create a copy of 'this' instruction that is identical in all ways except the following:
Definition Core.cpp:3111
void LLVMInstructionEraseFromParent(LLVMValueRef Inst)
Remove and delete an instruction.
Definition Core.cpp:3077
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:3085
LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst)
Obtain the instruction that occurs after the one specified.
Definition Core.cpp:3057
void LLVMSetICmpSameSign(LLVMValueRef Inst, LLVMBool SameSign)
Set the samesign flag on an icmp instruction.
Definition Core.cpp:3095
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:2461
LLVMValueRef LLVMGetLastGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the last GlobalAlias in a Module.
Definition Core.cpp:2482
LLVMValueRef LLVMGetPreviousGlobalAlias(LLVMValueRef GA)
Decrement a GlobalAlias iterator to the previous GlobalAlias.
Definition Core.cpp:2498
void LLVMAliasSetAliasee(LLVMValueRef Alias, LLVMValueRef Aliasee)
Set the target value of an alias.
Definition Core.cpp:2510
LLVMValueRef LLVMGetFirstGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the first GlobalAlias in a Module.
Definition Core.cpp:2474
LLVMValueRef LLVMAliasGetAliasee(LLVMValueRef Alias)
Retrieve the target value of an alias.
Definition Core.cpp:2506
LLVMValueRef LLVMGetNamedGlobalAlias(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalAlias value from a Module by its name.
Definition Core.cpp:2469
LLVMValueRef LLVMGetNextGlobalAlias(LLVMValueRef GA)
Advance a GlobalAlias iterator to the next GlobalAlias.
Definition Core.cpp:2490
LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar)
Definition Core.cpp:2396
LLVMThreadLocalMode LLVMGetThreadLocalMode(LLVMValueRef GlobalVar)
Definition Core.cpp:2412
LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar)
Definition Core.cpp:2404
LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2372
void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal)
Definition Core.cpp:2400
LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar)
Definition Core.cpp:2451
LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M)
Definition Core.cpp:2356
LLVMValueRef LLVMGetNamedGlobalWithLength(LLVMModuleRef M, const char *Name, size_t Length)
Definition Core.cpp:2343
LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M)
Definition Core.cpp:2348
void LLVMSetThreadLocalMode(LLVMValueRef GlobalVar, LLVMThreadLocalMode Mode)
Definition Core.cpp:2429
LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2364
void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit)
Definition Core.cpp:2455
LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name)
Definition Core.cpp:2339
LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name, unsigned AddressSpace)
Definition Core.cpp:2330
void LLVMDeleteGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2380
void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant)
Definition Core.cpp:2408
LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:2325
LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar)
Definition Core.cpp:2384
void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal)
Definition Core.cpp:2391
#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:55
@ System
Synchronized with respect to all concurrently executing threads.
Definition LLVMContext.h:58
@ OF_TextWithCRLF
The file should be opened in text mode and use a carriage linefeed '\r '.
Definition FileSystem.h:786
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:400
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:395
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:106