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 return wrap(ConstantExpr::getTrunc(unwrap<Constant>(ConstantVal),
1949 unwrap(ToType)));
1950}
1951
1954 unwrap(ToType)));
1955}
1956
1959 unwrap(ToType)));
1960}
1961
1964 unwrap(ToType)));
1965}
1966
1968 LLVMTypeRef ToType) {
1970 unwrap(ToType)));
1971}
1972
1974 LLVMTypeRef ToType) {
1976 unwrap(ToType)));
1977}
1978
1980 LLVMTypeRef ToType) {
1982 unwrap(ToType)));
1983}
1984
1986 LLVMValueRef IndexConstant) {
1988 unwrap<Constant>(IndexConstant)));
1989}
1990
1992 LLVMValueRef ElementValueConstant,
1993 LLVMValueRef IndexConstant) {
1995 unwrap<Constant>(ElementValueConstant),
1996 unwrap<Constant>(IndexConstant)));
1997}
1998
2000 LLVMValueRef VectorBConstant,
2001 LLVMValueRef MaskConstant) {
2002 SmallVector<int, 16> IntMask;
2005 unwrap<Constant>(VectorBConstant),
2006 IntMask));
2007}
2008
2010 const char *Constraints,
2011 LLVMBool HasSideEffects,
2012 LLVMBool IsAlignStack) {
2013 return wrap(InlineAsm::get(dyn_cast<FunctionType>(unwrap(Ty)), AsmString,
2014 Constraints, HasSideEffects, IsAlignStack));
2015}
2016
2020
2024
2026 return wrap(unwrap<BlockAddress>(BlockAddr)->getBasicBlock());
2027}
2028
2029/*--.. Operations on global variables, functions, and aliases (globals) ....--*/
2030
2034
2038
2067
2070
2071 switch (Linkage) {
2074 break;
2077 break;
2080 break;
2083 break;
2085 LLVM_DEBUG(
2086 errs() << "LLVMSetLinkage(): LLVMLinkOnceODRAutoHideLinkage is no "
2087 "longer supported.");
2088 break;
2089 case LLVMWeakAnyLinkage:
2091 break;
2092 case LLVMWeakODRLinkage:
2094 break;
2097 break;
2100 break;
2101 case LLVMPrivateLinkage:
2103 break;
2106 break;
2109 break;
2111 LLVM_DEBUG(
2112 errs()
2113 << "LLVMSetLinkage(): LLVMDLLImportLinkage is no longer supported.");
2114 break;
2116 LLVM_DEBUG(
2117 errs()
2118 << "LLVMSetLinkage(): LLVMDLLExportLinkage is no longer supported.");
2119 break;
2122 break;
2123 case LLVMGhostLinkage:
2124 LLVM_DEBUG(
2125 errs() << "LLVMSetLinkage(): LLVMGhostLinkage is no longer supported.");
2126 break;
2127 case LLVMCommonLinkage:
2129 break;
2130 }
2131}
2132
2134 // Using .data() is safe because of how GlobalObject::setSection is
2135 // implemented.
2136 return unwrap<GlobalValue>(Global)->getSection().data();
2137}
2138
2139void LLVMSetSection(LLVMValueRef Global, const char *Section) {
2140 unwrap<GlobalObject>(Global)->setSection(Section);
2141}
2142
2144 return static_cast<LLVMVisibility>(
2145 unwrap<GlobalValue>(Global)->getVisibility());
2146}
2147
2150 ->setVisibility(static_cast<GlobalValue::VisibilityTypes>(Viz));
2151}
2152
2154 return static_cast<LLVMDLLStorageClass>(
2155 unwrap<GlobalValue>(Global)->getDLLStorageClass());
2156}
2157
2159 unwrap<GlobalValue>(Global)->setDLLStorageClass(
2160 static_cast<GlobalValue::DLLStorageClassTypes>(Class));
2161}
2162
2174
2187
2189 return unwrap<GlobalValue>(Global)->hasGlobalUnnamedAddr();
2190}
2191
2193 unwrap<GlobalValue>(Global)->setUnnamedAddr(
2194 HasUnnamedAddr ? GlobalValue::UnnamedAddr::Global
2196}
2197
2201
2202/*--.. Operations on global variables, load and store instructions .........--*/
2203
2205 Value *P = unwrap(V);
2207 return GV->getAlign() ? GV->getAlign()->value() : 0;
2209 return F->getAlign() ? F->getAlign()->value() : 0;
2211 return AI->getAlign().value();
2212 if (LoadInst *LI = dyn_cast<LoadInst>(P))
2213 return LI->getAlign().value();
2215 return SI->getAlign().value();
2217 return RMWI->getAlign().value();
2219 return CXI->getAlign().value();
2220
2222 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, "
2223 "and AtomicCmpXchgInst have alignment");
2224}
2225
2226void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes) {
2227 Value *P = unwrap(V);
2229 GV->setAlignment(MaybeAlign(Bytes));
2230 else if (Function *F = dyn_cast<Function>(P))
2231 F->setAlignment(MaybeAlign(Bytes));
2232 else if (AllocaInst *AI = dyn_cast<AllocaInst>(P))
2233 AI->setAlignment(Align(Bytes));
2234 else if (LoadInst *LI = dyn_cast<LoadInst>(P))
2235 LI->setAlignment(Align(Bytes));
2236 else if (StoreInst *SI = dyn_cast<StoreInst>(P))
2237 SI->setAlignment(Align(Bytes));
2238 else if (AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(P))
2239 RMWI->setAlignment(Align(Bytes));
2241 CXI->setAlignment(Align(Bytes));
2242 else
2244 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, and "
2245 "and AtomicCmpXchgInst have alignment");
2246}
2247
2249 size_t *NumEntries) {
2250 return llvm_getMetadata(NumEntries, [&Value](MetadataEntries &Entries) {
2251 Entries.clear();
2253 Instr->getAllMetadata(Entries);
2254 } else {
2255 unwrap<GlobalObject>(Value)->getAllMetadata(Entries);
2256 }
2257 });
2258}
2259
2261 unsigned Index) {
2263 static_cast<LLVMOpaqueValueMetadataEntry>(Entries[Index]);
2264 return MVE.Kind;
2265}
2266
2269 unsigned Index) {
2271 static_cast<LLVMOpaqueValueMetadataEntry>(Entries[Index]);
2272 return MVE.Metadata;
2273}
2274
2276 free(Entries);
2277}
2278
2280 LLVMMetadataRef MD) {
2281 unwrap<GlobalObject>(Global)->setMetadata(Kind, unwrap<MDNode>(MD));
2282}
2283
2285 LLVMMetadataRef MD) {
2286 unwrap<GlobalObject>(Global)->addMetadata(Kind, *unwrap<MDNode>(MD));
2287}
2288
2290 unwrap<GlobalObject>(Global)->eraseMetadata(Kind);
2291}
2292
2296
2301
2302/*--.. Operations on global variables ......................................--*/
2303
2305 return wrap(new GlobalVariable(*unwrap(M), unwrap(Ty), false,
2306 GlobalValue::ExternalLinkage, nullptr, Name));
2307}
2308
2310 const char *Name,
2311 unsigned AddressSpace) {
2312 return wrap(new GlobalVariable(*unwrap(M), unwrap(Ty), false,
2313 GlobalValue::ExternalLinkage, nullptr, Name,
2315 AddressSpace));
2316}
2317
2319 return wrap(unwrap(M)->getNamedGlobal(Name));
2320}
2321
2323 size_t Length) {
2324 return wrap(unwrap(M)->getNamedGlobal(StringRef(Name, Length)));
2325}
2326
2328 Module *Mod = unwrap(M);
2329 Module::global_iterator I = Mod->global_begin();
2330 if (I == Mod->global_end())
2331 return nullptr;
2332 return wrap(&*I);
2333}
2334
2336 Module *Mod = unwrap(M);
2337 Module::global_iterator I = Mod->global_end();
2338 if (I == Mod->global_begin())
2339 return nullptr;
2340 return wrap(&*--I);
2341}
2342
2344 GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2346 if (++I == GV->getParent()->global_end())
2347 return nullptr;
2348 return wrap(&*I);
2349}
2350
2352 GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2354 if (I == GV->getParent()->global_begin())
2355 return nullptr;
2356 return wrap(&*--I);
2357}
2358
2360 unwrap<GlobalVariable>(GlobalVar)->eraseFromParent();
2361}
2362
2364 GlobalVariable* GV = unwrap<GlobalVariable>(GlobalVar);
2365 if ( !GV->hasInitializer() )
2366 return nullptr;
2367 return wrap(GV->getInitializer());
2368}
2369
2370void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal) {
2371 unwrap<GlobalVariable>(GlobalVar)->setInitializer(
2372 ConstantVal ? unwrap<Constant>(ConstantVal) : nullptr);
2373}
2374
2376 return unwrap<GlobalVariable>(GlobalVar)->isThreadLocal();
2377}
2378
2379void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal) {
2380 unwrap<GlobalVariable>(GlobalVar)->setThreadLocal(IsThreadLocal != 0);
2381}
2382
2384 return unwrap<GlobalVariable>(GlobalVar)->isConstant();
2385}
2386
2387void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant) {
2388 unwrap<GlobalVariable>(GlobalVar)->setConstant(IsConstant != 0);
2389}
2390
2392 switch (unwrap<GlobalVariable>(GlobalVar)->getThreadLocalMode()) {
2394 return LLVMNotThreadLocal;
2402 return LLVMLocalExecTLSModel;
2403 }
2404
2405 llvm_unreachable("Invalid GlobalVariable thread local mode");
2406}
2407
2429
2431 return unwrap<GlobalVariable>(GlobalVar)->isExternallyInitialized();
2432}
2433
2435 unwrap<GlobalVariable>(GlobalVar)->setExternallyInitialized(IsExtInit);
2436}
2437
2438/*--.. Operations on aliases ......................................--*/
2439
2441 unsigned AddrSpace, LLVMValueRef Aliasee,
2442 const char *Name) {
2443 return wrap(GlobalAlias::create(unwrap(ValueTy), AddrSpace,
2445 unwrap<Constant>(Aliasee), unwrap(M)));
2446}
2447
2449 const char *Name, size_t NameLen) {
2450 return wrap(unwrap(M)->getNamedAlias(StringRef(Name, NameLen)));
2451}
2452
2454 Module *Mod = unwrap(M);
2455 Module::alias_iterator I = Mod->alias_begin();
2456 if (I == Mod->alias_end())
2457 return nullptr;
2458 return wrap(&*I);
2459}
2460
2462 Module *Mod = unwrap(M);
2463 Module::alias_iterator I = Mod->alias_end();
2464 if (I == Mod->alias_begin())
2465 return nullptr;
2466 return wrap(&*--I);
2467}
2468
2470 GlobalAlias *Alias = unwrap<GlobalAlias>(GA);
2472 if (++I == Alias->getParent()->alias_end())
2473 return nullptr;
2474 return wrap(&*I);
2475}
2476
2478 GlobalAlias *Alias = unwrap<GlobalAlias>(GA);
2480 if (I == Alias->getParent()->alias_begin())
2481 return nullptr;
2482 return wrap(&*--I);
2483}
2484
2486 return wrap(unwrap<GlobalAlias>(Alias)->getAliasee());
2487}
2488
2490 unwrap<GlobalAlias>(Alias)->setAliasee(unwrap<Constant>(Aliasee));
2491}
2492
2493/*--.. Operations on functions .............................................--*/
2494
2496 LLVMTypeRef FunctionTy) {
2497 return wrap(Function::Create(unwrap<FunctionType>(FunctionTy),
2499}
2500
2502 size_t NameLen, LLVMTypeRef FunctionTy) {
2503 return wrap(unwrap(M)
2504 ->getOrInsertFunction(StringRef(Name, NameLen),
2505 unwrap<FunctionType>(FunctionTy))
2506 .getCallee());
2507}
2508
2510 return wrap(unwrap(M)->getFunction(Name));
2511}
2512
2514 size_t Length) {
2515 return wrap(unwrap(M)->getFunction(StringRef(Name, Length)));
2516}
2517
2519 Module *Mod = unwrap(M);
2520 Module::iterator I = Mod->begin();
2521 if (I == Mod->end())
2522 return nullptr;
2523 return wrap(&*I);
2524}
2525
2527 Module *Mod = unwrap(M);
2528 Module::iterator I = Mod->end();
2529 if (I == Mod->begin())
2530 return nullptr;
2531 return wrap(&*--I);
2532}
2533
2535 Function *Func = unwrap<Function>(Fn);
2536 Module::iterator I(Func);
2537 if (++I == Func->getParent()->end())
2538 return nullptr;
2539 return wrap(&*I);
2540}
2541
2543 Function *Func = unwrap<Function>(Fn);
2544 Module::iterator I(Func);
2545 if (I == Func->getParent()->begin())
2546 return nullptr;
2547 return wrap(&*--I);
2548}
2549
2551 unwrap<Function>(Fn)->eraseFromParent();
2552}
2553
2555 return unwrap<Function>(Fn)->hasPersonalityFn();
2556}
2557
2559 return wrap(unwrap<Function>(Fn)->getPersonalityFn());
2560}
2561
2563 unwrap<Function>(Fn)->setPersonalityFn(
2564 PersonalityFn ? unwrap<Constant>(PersonalityFn) : nullptr);
2565}
2566
2568 if (Function *F = dyn_cast<Function>(unwrap(Fn)))
2569 return F->getIntrinsicID();
2570 return 0;
2571}
2572
2574 assert(ID < llvm::Intrinsic::num_intrinsics && "Intrinsic ID out of range");
2575 return llvm::Intrinsic::ID(ID);
2576}
2577
2579 LLVMTypeRef *OverloadTypes,
2580 size_t OverloadCount) {
2581 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2582 auto IID = llvm_map_to_intrinsic_id(ID);
2583 return wrap(
2585}
2586
2587const char *LLVMIntrinsicGetName(unsigned ID, size_t *NameLength) {
2588 auto IID = llvm_map_to_intrinsic_id(ID);
2589 auto Str = llvm::Intrinsic::getName(IID);
2590 *NameLength = Str.size();
2591 return Str.data();
2592}
2593
2595 LLVMTypeRef *OverloadTypes,
2596 size_t OverloadCount) {
2597 auto IID = llvm_map_to_intrinsic_id(ID);
2598 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2599 return wrap(llvm::Intrinsic::getType(*unwrap(Ctx), IID, OverloadTys));
2600}
2601
2602char *LLVMIntrinsicCopyOverloadedName(unsigned ID, LLVMTypeRef *OverloadTypes,
2603 size_t OverloadCount,
2604 size_t *NameLength) {
2605 auto IID = llvm_map_to_intrinsic_id(ID);
2606 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2607 auto Str = llvm::Intrinsic::getNameNoUnnamedTypes(IID, OverloadTys);
2608 *NameLength = Str.length();
2609 return strdup(Str.c_str());
2610}
2611
2613 LLVMTypeRef *OverloadTypes,
2614 size_t OverloadCount,
2615 size_t *NameLength) {
2616 auto IID = llvm_map_to_intrinsic_id(ID);
2617 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2618 auto Str = llvm::Intrinsic::getName(IID, OverloadTys, unwrap(Mod));
2619 *NameLength = Str.length();
2620 return strdup(Str.c_str());
2621}
2622
2623unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen) {
2624 return Intrinsic::lookupIntrinsicID({Name, NameLen});
2625}
2626
2628 auto IID = llvm_map_to_intrinsic_id(ID);
2630}
2631
2633 return unwrap<Function>(Fn)->getCallingConv();
2634}
2635
2637 return unwrap<Function>(Fn)->setCallingConv(
2638 static_cast<CallingConv::ID>(CC));
2639}
2640
2641const char *LLVMGetGC(LLVMValueRef Fn) {
2643 return F->hasGC()? F->getGC().c_str() : nullptr;
2644}
2645
2646void LLVMSetGC(LLVMValueRef Fn, const char *GC) {
2648 if (GC)
2649 F->setGC(GC);
2650 else
2651 F->clearGC();
2652}
2653
2656 return wrap(F->getPrefixData());
2657}
2658
2661 return F->hasPrefixData();
2662}
2663
2666 Constant *prefix = unwrap<Constant>(prefixData);
2667 F->setPrefixData(prefix);
2668}
2669
2672 return wrap(F->getPrologueData());
2673}
2674
2677 return F->hasPrologueData();
2678}
2679
2682 Constant *prologue = unwrap<Constant>(prologueData);
2683 F->setPrologueData(prologue);
2684}
2685
2688 unwrap<Function>(F)->addAttributeAtIndex(Idx, unwrap(A));
2689}
2690
2692 auto AS = unwrap<Function>(F)->getAttributes().getAttributes(Idx);
2693 return AS.getNumAttributes();
2694}
2695
2697 LLVMAttributeRef *Attrs) {
2698 auto AS = unwrap<Function>(F)->getAttributes().getAttributes(Idx);
2699 for (auto A : AS)
2700 *Attrs++ = wrap(A);
2701}
2702
2705 unsigned KindID) {
2706 return wrap(unwrap<Function>(F)->getAttributeAtIndex(
2707 Idx, (Attribute::AttrKind)KindID));
2708}
2709
2712 const char *K, unsigned KLen) {
2713 return wrap(
2714 unwrap<Function>(F)->getAttributeAtIndex(Idx, StringRef(K, KLen)));
2715}
2716
2718 unsigned KindID) {
2719 unwrap<Function>(F)->removeAttributeAtIndex(Idx, (Attribute::AttrKind)KindID);
2720}
2721
2723 const char *K, unsigned KLen) {
2724 unwrap<Function>(F)->removeAttributeAtIndex(Idx, StringRef(K, KLen));
2725}
2726
2728 const char *V) {
2729 Function *Func = unwrap<Function>(Fn);
2730 Attribute Attr = Attribute::get(Func->getContext(), A, V);
2731 Func->addFnAttr(Attr);
2732}
2733
2734/*--.. Operations on parameters ............................................--*/
2735
2737 // This function is strictly redundant to
2738 // LLVMCountParamTypes(LLVMGlobalGetValueType(FnRef))
2739 return unwrap<Function>(FnRef)->arg_size();
2740}
2741
2742void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs) {
2743 Function *Fn = unwrap<Function>(FnRef);
2744 for (Argument &A : Fn->args())
2745 *ParamRefs++ = wrap(&A);
2746}
2747
2749 Function *Fn = unwrap<Function>(FnRef);
2750 return wrap(&Fn->arg_begin()[index]);
2751}
2752
2756
2758 Function *Func = unwrap<Function>(Fn);
2759 Function::arg_iterator I = Func->arg_begin();
2760 if (I == Func->arg_end())
2761 return nullptr;
2762 return wrap(&*I);
2763}
2764
2766 Function *Func = unwrap<Function>(Fn);
2767 Function::arg_iterator I = Func->arg_end();
2768 if (I == Func->arg_begin())
2769 return nullptr;
2770 return wrap(&*--I);
2771}
2772
2774 Argument *A = unwrap<Argument>(Arg);
2775 Function *Fn = A->getParent();
2776 if (A->getArgNo() + 1 >= Fn->arg_size())
2777 return nullptr;
2778 return wrap(&Fn->arg_begin()[A->getArgNo() + 1]);
2779}
2780
2782 Argument *A = unwrap<Argument>(Arg);
2783 if (A->getArgNo() == 0)
2784 return nullptr;
2785 return wrap(&A->getParent()->arg_begin()[A->getArgNo() - 1]);
2786}
2787
2789 Argument *A = unwrap<Argument>(Arg);
2790 A->addAttr(Attribute::getWithAlignment(A->getContext(), Align(align)));
2791}
2792
2793/*--.. Operations on ifuncs ................................................--*/
2794
2796 const char *Name, size_t NameLen,
2797 LLVMTypeRef Ty, unsigned AddrSpace,
2799 return wrap(GlobalIFunc::create(unwrap(Ty), AddrSpace,
2801 StringRef(Name, NameLen),
2803}
2804
2806 const char *Name, size_t NameLen) {
2807 return wrap(unwrap(M)->getNamedIFunc(StringRef(Name, NameLen)));
2808}
2809
2811 Module *Mod = unwrap(M);
2812 Module::ifunc_iterator I = Mod->ifunc_begin();
2813 if (I == Mod->ifunc_end())
2814 return nullptr;
2815 return wrap(&*I);
2816}
2817
2819 Module *Mod = unwrap(M);
2820 Module::ifunc_iterator I = Mod->ifunc_end();
2821 if (I == Mod->ifunc_begin())
2822 return nullptr;
2823 return wrap(&*--I);
2824}
2825
2827 GlobalIFunc *GIF = unwrap<GlobalIFunc>(IFunc);
2829 if (++I == GIF->getParent()->ifunc_end())
2830 return nullptr;
2831 return wrap(&*I);
2832}
2833
2835 GlobalIFunc *GIF = unwrap<GlobalIFunc>(IFunc);
2837 if (I == GIF->getParent()->ifunc_begin())
2838 return nullptr;
2839 return wrap(&*--I);
2840}
2841
2843 return wrap(unwrap<GlobalIFunc>(IFunc)->getResolver());
2844}
2845
2849
2851 unwrap<GlobalIFunc>(IFunc)->eraseFromParent();
2852}
2853
2855 unwrap<GlobalIFunc>(IFunc)->removeFromParent();
2856}
2857
2858/*--.. Operations on operand bundles........................................--*/
2859
2860LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, size_t TagLen,
2861 LLVMValueRef *Args,
2862 unsigned NumArgs) {
2863 return wrap(new OperandBundleDef(std::string(Tag, TagLen),
2864 ArrayRef(unwrap(Args), NumArgs)));
2865}
2866
2868 delete unwrap(Bundle);
2869}
2870
2871const char *LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len) {
2872 StringRef Str = unwrap(Bundle)->getTag();
2873 *Len = Str.size();
2874 return Str.data();
2875}
2876
2878 return unwrap(Bundle)->inputs().size();
2879}
2880
2882 unsigned Index) {
2883 return wrap(unwrap(Bundle)->inputs()[Index]);
2884}
2885
2886/*--.. Operations on basic blocks ..........................................--*/
2887
2889 return wrap(static_cast<Value*>(unwrap(BB)));
2890}
2891
2895
2899
2901 return unwrap(BB)->getName().data();
2902}
2903
2907
2909 return wrap(unwrap(BB)->getTerminatorOrNull());
2910}
2911
2913 return unwrap<Function>(FnRef)->size();
2914}
2915
2917 Function *Fn = unwrap<Function>(FnRef);
2918 for (BasicBlock &BB : *Fn)
2919 *BasicBlocksRefs++ = wrap(&BB);
2920}
2921
2923 return wrap(&unwrap<Function>(Fn)->getEntryBlock());
2924}
2925
2927 Function *Func = unwrap<Function>(Fn);
2928 Function::iterator I = Func->begin();
2929 if (I == Func->end())
2930 return nullptr;
2931 return wrap(&*I);
2932}
2933
2935 Function *Func = unwrap<Function>(Fn);
2936 Function::iterator I = Func->end();
2937 if (I == Func->begin())
2938 return nullptr;
2939 return wrap(&*--I);
2940}
2941
2943 BasicBlock *Block = unwrap(BB);
2945 if (++I == Block->getParent()->end())
2946 return nullptr;
2947 return wrap(&*I);
2948}
2949
2951 BasicBlock *Block = unwrap(BB);
2953 if (I == Block->getParent()->begin())
2954 return nullptr;
2955 return wrap(&*--I);
2956}
2957
2962
2964 LLVMBasicBlockRef BB) {
2965 BasicBlock *ToInsert = unwrap(BB);
2966 BasicBlock *CurBB = unwrap(Builder)->GetInsertBlock();
2967 assert(CurBB && "current insertion point is invalid!");
2968 CurBB->getParent()->insert(std::next(CurBB->getIterator()), ToInsert);
2969}
2970
2972 LLVMBasicBlockRef BB) {
2973 unwrap<Function>(Fn)->insert(unwrap<Function>(Fn)->end(), unwrap(BB));
2974}
2975
2977 LLVMValueRef FnRef,
2978 const char *Name) {
2979 return wrap(BasicBlock::Create(*unwrap(C), Name, unwrap<Function>(FnRef)));
2980}
2981
2985
2987 LLVMBasicBlockRef BBRef,
2988 const char *Name) {
2989 BasicBlock *BB = unwrap(BBRef);
2990 return wrap(BasicBlock::Create(*unwrap(C), Name, BB->getParent(), BB));
2991}
2992
2997
2999 unwrap(BBRef)->eraseFromParent();
3000}
3001
3003 unwrap(BBRef)->removeFromParent();
3004}
3005
3007 unwrap(BB)->moveBefore(unwrap(MovePos));
3008}
3009
3011 unwrap(BB)->moveAfter(unwrap(MovePos));
3012}
3013
3014/*--.. Operations on instructions ..........................................--*/
3015
3019
3021 BasicBlock *Block = unwrap(BB);
3022 BasicBlock::iterator I = Block->begin();
3023 if (I == Block->end())
3024 return nullptr;
3025 return wrap(&*I);
3026}
3027
3029 BasicBlock *Block = unwrap(BB);
3030 BasicBlock::iterator I = Block->end();
3031 if (I == Block->begin())
3032 return nullptr;
3033 return wrap(&*--I);
3034}
3035
3037 Instruction *Instr = unwrap<Instruction>(Inst);
3038 BasicBlock::iterator I(Instr);
3039 if (++I == Instr->getParent()->end())
3040 return nullptr;
3041 return wrap(&*I);
3042}
3043
3045 Instruction *Instr = unwrap<Instruction>(Inst);
3046 BasicBlock::iterator I(Instr);
3047 if (I == Instr->getParent()->begin())
3048 return nullptr;
3049 return wrap(&*--I);
3050}
3051
3053 unwrap<Instruction>(Inst)->removeFromParent();
3054}
3055
3057 unwrap<Instruction>(Inst)->eraseFromParent();
3058}
3059
3061 unwrap<Instruction>(Inst)->deleteValue();
3062}
3063
3065 if (ICmpInst *I = dyn_cast<ICmpInst>(unwrap(Inst)))
3066 return (LLVMIntPredicate)I->getPredicate();
3067 return (LLVMIntPredicate)0;
3068}
3069
3071 return unwrap<ICmpInst>(Inst)->hasSameSign();
3072}
3073
3075 unwrap<ICmpInst>(Inst)->setSameSign(SameSign);
3076}
3077
3079 if (FCmpInst *I = dyn_cast<FCmpInst>(unwrap(Inst)))
3080 return (LLVMRealPredicate)I->getPredicate();
3081 return (LLVMRealPredicate)0;
3082}
3083
3086 return map_to_llvmopcode(C->getOpcode());
3087 return (LLVMOpcode)0;
3088}
3089
3092 return wrap(C->clone());
3093 return nullptr;
3094}
3095
3098 return (I && I->isTerminator()) ? wrap(I) : nullptr;
3099}
3100
3102 Instruction *Instr = unwrap<Instruction>(Inst);
3103 if (!Instr->getDbgMarker())
3104 return nullptr;
3105 auto I = Instr->getDbgMarker()->StoredDbgRecords.begin();
3106 if (I == Instr->getDbgMarker()->StoredDbgRecords.end())
3107 return nullptr;
3108 return wrap(&*I);
3109}
3110
3112 Instruction *Instr = unwrap<Instruction>(Inst);
3113 if (!Instr->getDbgMarker())
3114 return nullptr;
3115 auto I = Instr->getDbgMarker()->StoredDbgRecords.rbegin();
3116 if (I == Instr->getDbgMarker()->StoredDbgRecords.rend())
3117 return nullptr;
3118 return wrap(&*I);
3119}
3120
3124 if (++I == Record->getInstruction()->getDbgMarker()->StoredDbgRecords.end())
3125 return nullptr;
3126 return wrap(&*I);
3127}
3128
3132 if (I == Record->getInstruction()->getDbgMarker()->StoredDbgRecords.begin())
3133 return nullptr;
3134 return wrap(&*--I);
3135}
3136
3140
3144 return LLVMDbgRecordLabel;
3146 assert(VariableRecord && "unexpected record");
3147 if (VariableRecord->isDbgDeclare())
3148 return LLVMDbgRecordDeclare;
3149 if (VariableRecord->isDbgValue())
3150 return LLVMDbgRecordValue;
3151 assert(VariableRecord->isDbgAssign() && "unexpected record");
3152 return LLVMDbgRecordAssign;
3153}
3154
3156 unsigned OpIdx) {
3157 return wrap(unwrap<DbgVariableRecord>(Rec)->getValue(OpIdx));
3158}
3159
3163
3167
3169 if (FuncletPadInst *FPI = dyn_cast<FuncletPadInst>(unwrap(Instr))) {
3170 return FPI->arg_size();
3171 }
3172 return unwrap<CallBase>(Instr)->arg_size();
3173}
3174
3175/*--.. Call and invoke instructions ........................................--*/
3176
3178 return unwrap<CallBase>(Instr)->getCallingConv();
3179}
3180
3182 return unwrap<CallBase>(Instr)->setCallingConv(
3183 static_cast<CallingConv::ID>(CC));
3184}
3185
3187 unsigned align) {
3188 auto *Call = unwrap<CallBase>(Instr);
3189 Attribute AlignAttr =
3191 Call->addAttributeAtIndex(Idx, AlignAttr);
3192}
3193
3196 unwrap<CallBase>(C)->addAttributeAtIndex(Idx, unwrap(A));
3197}
3198
3200 LLVMAttributeIndex Idx) {
3201 auto *Call = unwrap<CallBase>(C);
3202 auto AS = Call->getAttributes().getAttributes(Idx);
3203 return AS.getNumAttributes();
3204}
3205
3207 LLVMAttributeRef *Attrs) {
3208 auto *Call = unwrap<CallBase>(C);
3209 auto AS = Call->getAttributes().getAttributes(Idx);
3210 for (auto A : AS)
3211 *Attrs++ = wrap(A);
3212}
3213
3216 unsigned KindID) {
3217 return wrap(unwrap<CallBase>(C)->getAttributeAtIndex(
3218 Idx, (Attribute::AttrKind)KindID));
3219}
3220
3223 const char *K, unsigned KLen) {
3224 return wrap(
3225 unwrap<CallBase>(C)->getAttributeAtIndex(Idx, StringRef(K, KLen)));
3226}
3227
3229 unsigned KindID) {
3230 unwrap<CallBase>(C)->removeAttributeAtIndex(Idx, (Attribute::AttrKind)KindID);
3231}
3232
3234 const char *K, unsigned KLen) {
3235 unwrap<CallBase>(C)->removeAttributeAtIndex(Idx, StringRef(K, KLen));
3236}
3237
3239 return wrap(unwrap<CallBase>(Instr)->getCalledOperand());
3240}
3241
3243 return wrap(unwrap<CallBase>(Instr)->getFunctionType());
3244}
3245
3247 return unwrap<CallBase>(C)->getNumOperandBundles();
3248}
3249
3251 unsigned Index) {
3252 return wrap(
3253 new OperandBundleDef(unwrap<CallBase>(C)->getOperandBundleAt(Index)));
3254}
3255
3256/*--.. Operations on call instructions (only) ..............................--*/
3257
3259 return unwrap<CallInst>(Call)->isTailCall();
3260}
3261
3263 unwrap<CallInst>(Call)->setTailCall(isTailCall);
3264}
3265
3269
3273
3274/*--.. Operations on invoke instructions (only) ............................--*/
3275
3277 return wrap(unwrap<InvokeInst>(Invoke)->getNormalDest());
3278}
3279
3282 return wrap(CRI->getUnwindDest());
3283 } else if (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {
3284 return wrap(CSI->getUnwindDest());
3285 }
3286 return wrap(unwrap<InvokeInst>(Invoke)->getUnwindDest());
3287}
3288
3290 unwrap<InvokeInst>(Invoke)->setNormalDest(unwrap(B));
3291}
3292
3295 return CRI->setUnwindDest(unwrap(B));
3296 } else if (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {
3297 return CSI->setUnwindDest(unwrap(B));
3298 }
3299 unwrap<InvokeInst>(Invoke)->setUnwindDest(unwrap(B));
3300}
3301
3303 return wrap(unwrap<CallBrInst>(CallBr)->getDefaultDest());
3304}
3305
3307 return unwrap<CallBrInst>(CallBr)->getNumIndirectDests();
3308}
3309
3311 return wrap(unwrap<CallBrInst>(CallBr)->getIndirectDest(Idx));
3312}
3313
3314/*--.. Operations on terminators ...........................................--*/
3315
3317 return unwrap<Instruction>(Term)->getNumSuccessors();
3318}
3319
3321 return wrap(unwrap<Instruction>(Term)->getSuccessor(i));
3322}
3323
3325 return unwrap<Instruction>(Term)->setSuccessor(i, unwrap(block));
3326}
3327
3328/*--.. Operations on branch instructions (only) ............................--*/
3329
3333
3337
3339 return unwrap<CondBrInst>(Branch)->setCondition(unwrap(Cond));
3340}
3341
3342/*--.. Operations on switch instructions (only) ............................--*/
3343
3345 return wrap(unwrap<SwitchInst>(Switch)->getDefaultDest());
3346}
3347
3349 assert(i > 0 && i <= unwrap<SwitchInst>(Switch)->getNumCases());
3350 auto It = unwrap<SwitchInst>(Switch)->case_begin() + (i - 1);
3351 return wrap(It->getCaseValue());
3352}
3353
3354void LLVMSetSwitchCaseValue(LLVMValueRef Switch, unsigned i,
3355 LLVMValueRef CaseValue) {
3356 assert(i > 0 && i <= unwrap<SwitchInst>(Switch)->getNumCases());
3357 auto It = unwrap<SwitchInst>(Switch)->case_begin() + (i - 1);
3358 It->setValue(unwrap<ConstantInt>(CaseValue));
3359}
3360
3361/*--.. Operations on alloca instructions (only) ............................--*/
3362
3364 return wrap(unwrap<AllocaInst>(Alloca)->getAllocatedType());
3365}
3366
3367/*--.. Operations on gep instructions (only) ...............................--*/
3368
3370 return unwrap<GEPOperator>(GEP)->isInBounds();
3371}
3372
3374 return unwrap<GetElementPtrInst>(GEP)->setIsInBounds(InBounds);
3375}
3376
3380
3385
3390
3391/*--.. Operations on phi nodes .............................................--*/
3392
3393void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
3394 LLVMBasicBlockRef *IncomingBlocks, unsigned Count) {
3395 PHINode *PhiVal = unwrap<PHINode>(PhiNode);
3396 for (unsigned I = 0; I != Count; ++I)
3397 PhiVal->addIncoming(unwrap(IncomingValues[I]), unwrap(IncomingBlocks[I]));
3398}
3399
3401 return unwrap<PHINode>(PhiNode)->getNumIncomingValues();
3402}
3403
3405 return wrap(unwrap<PHINode>(PhiNode)->getIncomingValue(Index));
3406}
3407
3409 return wrap(unwrap<PHINode>(PhiNode)->getIncomingBlock(Index));
3410}
3411
3412/*--.. Operations on extractvalue and insertvalue nodes ....................--*/
3413
3415 auto *I = unwrap(Inst);
3416 if (auto *GEP = dyn_cast<GEPOperator>(I))
3417 return GEP->getNumIndices();
3418 if (auto *EV = dyn_cast<ExtractValueInst>(I))
3419 return EV->getNumIndices();
3420 if (auto *IV = dyn_cast<InsertValueInst>(I))
3421 return IV->getNumIndices();
3423 "LLVMGetNumIndices applies only to extractvalue and insertvalue!");
3424}
3425
3426const unsigned *LLVMGetIndices(LLVMValueRef Inst) {
3427 auto *I = unwrap(Inst);
3428 if (auto *EV = dyn_cast<ExtractValueInst>(I))
3429 return EV->getIndices().data();
3430 if (auto *IV = dyn_cast<InsertValueInst>(I))
3431 return IV->getIndices().data();
3433 "LLVMGetIndices applies only to extractvalue and insertvalue!");
3434}
3435
3436
3437/*===-- Instruction builders ----------------------------------------------===*/
3438
3442
3446
3448 Instruction *Instr, bool BeforeDbgRecords) {
3449 BasicBlock::iterator I = Instr ? Instr->getIterator() : Block->end();
3450 I.setHeadBit(BeforeDbgRecords);
3451 Builder->SetInsertPoint(Block, I);
3452}
3453
3455 LLVMValueRef Instr) {
3456 return LLVMPositionBuilderImpl(unwrap(Builder), unwrap(Block),
3457 unwrap<Instruction>(Instr), false);
3458}
3459
3466
3469 return LLVMPositionBuilderImpl(unwrap(Builder), I->getParent(), I, false);
3470}
3471
3473 LLVMValueRef Instr) {
3475 return LLVMPositionBuilderImpl(unwrap(Builder), I->getParent(), I, true);
3476}
3477
3479 BasicBlock *BB = unwrap(Block);
3480 unwrap(Builder)->SetInsertPoint(BB);
3481}
3482
3484 return wrap(unwrap(Builder)->GetInsertBlock());
3485}
3486
3488 unwrap(Builder)->ClearInsertionPoint();
3489}
3490
3492 unwrap(Builder)->Insert(unwrap<Instruction>(Instr));
3493}
3494
3496 const char *Name) {
3497 unwrap(Builder)->Insert(unwrap<Instruction>(Instr), Name);
3498}
3499
3501 delete unwrap(Builder);
3502}
3503
3504/*--.. Metadata builders ...................................................--*/
3505
3507 return wrap(unwrap(Builder)->getCurrentDebugLocation().getAsMDNode());
3508}
3509
3511 if (Loc)
3512 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(unwrap<DILocation>(Loc)));
3513 else
3514 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc());
3515}
3516
3518 DILocation *Loc =
3519 L ? cast<DILocation>(unwrap<MetadataAsValue>(L)->getMetadata()) : nullptr;
3520 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(Loc));
3521}
3522
3524 LLVMContext &Context = unwrap(Builder)->getContext();
3526 Context, unwrap(Builder)->getCurrentDebugLocation().getAsMDNode()));
3527}
3528
3530 unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
3531}
3532
3534 unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
3535}
3536
3538 LLVMMetadataRef FPMathTag) {
3539
3540 unwrap(Builder)->setDefaultFPMathTag(FPMathTag
3541 ? unwrap<MDNode>(FPMathTag)
3542 : nullptr);
3543}
3544
3546 return wrap(&unwrap(Builder)->getContext());
3547}
3548
3550 return wrap(unwrap(Builder)->getDefaultFPMathTag());
3551}
3552
3553/*--.. Instruction builders ................................................--*/
3554
3556 return wrap(unwrap(B)->CreateRetVoid());
3557}
3558
3560 return wrap(unwrap(B)->CreateRet(unwrap(V)));
3561}
3562
3564 unsigned N) {
3565 return wrap(unwrap(B)->CreateAggregateRet({unwrap(RetVals), N}));
3566}
3567
3569 return wrap(unwrap(B)->CreateBr(unwrap(Dest)));
3570}
3571
3574 return wrap(unwrap(B)->CreateCondBr(unwrap(If), unwrap(Then), unwrap(Else)));
3575}
3576
3578 LLVMBasicBlockRef Else, unsigned NumCases) {
3579 return wrap(unwrap(B)->CreateSwitch(unwrap(V), unwrap(Else), NumCases));
3580}
3581
3583 unsigned NumDests) {
3584 return wrap(unwrap(B)->CreateIndirectBr(unwrap(Addr), NumDests));
3585}
3586
3588 LLVMBasicBlockRef DefaultDest,
3589 LLVMBasicBlockRef *IndirectDests,
3590 unsigned NumIndirectDests, LLVMValueRef *Args,
3591 unsigned NumArgs, LLVMOperandBundleRef *Bundles,
3592 unsigned NumBundles, const char *Name) {
3593
3595 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
3596 OperandBundleDef *OB = unwrap(Bundle);
3597 OBs.push_back(*OB);
3598 }
3599
3600 return wrap(unwrap(B)->CreateCallBr(
3601 unwrap<FunctionType>(Ty), unwrap(Fn), unwrap(DefaultDest),
3602 ArrayRef(unwrap(IndirectDests), NumIndirectDests),
3603 ArrayRef<Value *>(unwrap(Args), NumArgs), OBs, Name));
3604}
3605
3607 LLVMValueRef *Args, unsigned NumArgs,
3609 const char *Name) {
3610 return wrap(unwrap(B)->CreateInvoke(unwrap<FunctionType>(Ty), unwrap(Fn),
3611 unwrap(Then), unwrap(Catch),
3612 ArrayRef(unwrap(Args), NumArgs), Name));
3613}
3614
3617 unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
3618 LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name) {
3620 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
3621 OperandBundleDef *OB = unwrap(Bundle);
3622 OBs.push_back(*OB);
3623 }
3624 return wrap(unwrap(B)->CreateInvoke(
3625 unwrap<FunctionType>(Ty), unwrap(Fn), unwrap(Then), unwrap(Catch),
3626 ArrayRef(unwrap(Args), NumArgs), OBs, Name));
3627}
3628
3630 LLVMValueRef PersFn, unsigned NumClauses,
3631 const char *Name) {
3632 // The personality used to live on the landingpad instruction, but now it
3633 // lives on the parent function. For compatibility, take the provided
3634 // personality and put it on the parent function.
3635 if (PersFn)
3636 unwrap(B)->GetInsertBlock()->getParent()->setPersonalityFn(
3637 unwrap<Function>(PersFn));
3638 return wrap(unwrap(B)->CreateLandingPad(unwrap(Ty), NumClauses, Name));
3639}
3640
3642 LLVMValueRef *Args, unsigned NumArgs,
3643 const char *Name) {
3644 return wrap(unwrap(B)->CreateCatchPad(unwrap(ParentPad),
3645 ArrayRef(unwrap(Args), NumArgs), Name));
3646}
3647
3649 LLVMValueRef *Args, unsigned NumArgs,
3650 const char *Name) {
3651 if (ParentPad == nullptr) {
3653 ParentPad = wrap(Constant::getNullValue(Ty));
3654 }
3655 return wrap(unwrap(B)->CreateCleanupPad(
3656 unwrap(ParentPad), ArrayRef(unwrap(Args), NumArgs), Name));
3657}
3658
3660 return wrap(unwrap(B)->CreateResume(unwrap(Exn)));
3661}
3662
3664 LLVMBasicBlockRef UnwindBB,
3665 unsigned NumHandlers, const char *Name) {
3666 if (ParentPad == nullptr) {
3668 ParentPad = wrap(Constant::getNullValue(Ty));
3669 }
3670 return wrap(unwrap(B)->CreateCatchSwitch(unwrap(ParentPad), unwrap(UnwindBB),
3671 NumHandlers, Name));
3672}
3673
3675 LLVMBasicBlockRef BB) {
3676 return wrap(unwrap(B)->CreateCatchRet(unwrap<CatchPadInst>(CatchPad),
3677 unwrap(BB)));
3678}
3679
3681 LLVMBasicBlockRef BB) {
3682 return wrap(unwrap(B)->CreateCleanupRet(unwrap<CleanupPadInst>(CatchPad),
3683 unwrap(BB)));
3684}
3685
3687 return wrap(unwrap(B)->CreateUnreachable());
3688}
3689
3691 LLVMBasicBlockRef Dest) {
3692 unwrap<SwitchInst>(Switch)->addCase(unwrap<ConstantInt>(OnVal), unwrap(Dest));
3693}
3694
3696 unwrap<IndirectBrInst>(IndirectBr)->addDestination(unwrap(Dest));
3697}
3698
3699unsigned LLVMGetNumClauses(LLVMValueRef LandingPad) {
3700 return unwrap<LandingPadInst>(LandingPad)->getNumClauses();
3701}
3702
3703LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx) {
3704 return wrap(unwrap<LandingPadInst>(LandingPad)->getClause(Idx));
3705}
3706
3707void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal) {
3708 unwrap<LandingPadInst>(LandingPad)->addClause(unwrap<Constant>(ClauseVal));
3709}
3710
3712 return unwrap<LandingPadInst>(LandingPad)->isCleanup();
3713}
3714
3715void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val) {
3716 unwrap<LandingPadInst>(LandingPad)->setCleanup(Val);
3717}
3718
3720 unwrap<CatchSwitchInst>(CatchSwitch)->addHandler(unwrap(Dest));
3721}
3722
3723unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch) {
3724 return unwrap<CatchSwitchInst>(CatchSwitch)->getNumHandlers();
3725}
3726
3727void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers) {
3728 CatchSwitchInst *CSI = unwrap<CatchSwitchInst>(CatchSwitch);
3729 for (const BasicBlock *H : CSI->handlers())
3730 *Handlers++ = wrap(H);
3731}
3732
3734 return wrap(unwrap<CatchPadInst>(CatchPad)->getCatchSwitch());
3735}
3736
3738 unwrap<CatchPadInst>(CatchPad)
3739 ->setCatchSwitch(unwrap<CatchSwitchInst>(CatchSwitch));
3740}
3741
3742/*--.. Funclets ...........................................................--*/
3743
3745 return wrap(unwrap<FuncletPadInst>(Funclet)->getArgOperand(i));
3746}
3747
3748void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value) {
3749 unwrap<FuncletPadInst>(Funclet)->setArgOperand(i, unwrap(value));
3750}
3751
3752/*--.. Arithmetic ..........................................................--*/
3753
3755 FastMathFlags NewFMF;
3756 NewFMF.setAllowReassoc((FMF & LLVMFastMathAllowReassoc) != 0);
3757 NewFMF.setNoNaNs((FMF & LLVMFastMathNoNaNs) != 0);
3758 NewFMF.setNoInfs((FMF & LLVMFastMathNoInfs) != 0);
3759 NewFMF.setNoSignedZeros((FMF & LLVMFastMathNoSignedZeros) != 0);
3761 NewFMF.setAllowContract((FMF & LLVMFastMathAllowContract) != 0);
3762 NewFMF.setApproxFunc((FMF & LLVMFastMathApproxFunc) != 0);
3763
3764 return NewFMF;
3765}
3766
3769 if (FMF.allowReassoc())
3770 NewFMF |= LLVMFastMathAllowReassoc;
3771 if (FMF.noNaNs())
3772 NewFMF |= LLVMFastMathNoNaNs;
3773 if (FMF.noInfs())
3774 NewFMF |= LLVMFastMathNoInfs;
3775 if (FMF.noSignedZeros())
3776 NewFMF |= LLVMFastMathNoSignedZeros;
3777 if (FMF.allowReciprocal())
3779 if (FMF.allowContract())
3780 NewFMF |= LLVMFastMathAllowContract;
3781 if (FMF.approxFunc())
3782 NewFMF |= LLVMFastMathApproxFunc;
3783
3784 return NewFMF;
3785}
3786
3788 const char *Name) {
3789 return wrap(unwrap(B)->CreateAdd(unwrap(LHS), unwrap(RHS), Name));
3790}
3791
3793 const char *Name) {
3794 return wrap(unwrap(B)->CreateNSWAdd(unwrap(LHS), unwrap(RHS), Name));
3795}
3796
3798 const char *Name) {
3799 return wrap(unwrap(B)->CreateNUWAdd(unwrap(LHS), unwrap(RHS), Name));
3800}
3801
3803 const char *Name) {
3804 return wrap(unwrap(B)->CreateFAdd(unwrap(LHS), unwrap(RHS), Name));
3805}
3806
3808 const char *Name) {
3809 return wrap(unwrap(B)->CreateSub(unwrap(LHS), unwrap(RHS), Name));
3810}
3811
3813 const char *Name) {
3814 return wrap(unwrap(B)->CreateNSWSub(unwrap(LHS), unwrap(RHS), Name));
3815}
3816
3818 const char *Name) {
3819 return wrap(unwrap(B)->CreateNUWSub(unwrap(LHS), unwrap(RHS), Name));
3820}
3821
3823 const char *Name) {
3824 return wrap(unwrap(B)->CreateFSub(unwrap(LHS), unwrap(RHS), Name));
3825}
3826
3828 const char *Name) {
3829 return wrap(unwrap(B)->CreateMul(unwrap(LHS), unwrap(RHS), Name));
3830}
3831
3833 const char *Name) {
3834 return wrap(unwrap(B)->CreateNSWMul(unwrap(LHS), unwrap(RHS), Name));
3835}
3836
3838 const char *Name) {
3839 return wrap(unwrap(B)->CreateNUWMul(unwrap(LHS), unwrap(RHS), Name));
3840}
3841
3843 const char *Name) {
3844 return wrap(unwrap(B)->CreateFMul(unwrap(LHS), unwrap(RHS), Name));
3845}
3846
3848 const char *Name) {
3849 return wrap(unwrap(B)->CreateUDiv(unwrap(LHS), unwrap(RHS), Name));
3850}
3851
3853 LLVMValueRef RHS, const char *Name) {
3854 return wrap(unwrap(B)->CreateExactUDiv(unwrap(LHS), unwrap(RHS), Name));
3855}
3856
3858 const char *Name) {
3859 return wrap(unwrap(B)->CreateSDiv(unwrap(LHS), unwrap(RHS), Name));
3860}
3861
3863 LLVMValueRef RHS, const char *Name) {
3864 return wrap(unwrap(B)->CreateExactSDiv(unwrap(LHS), unwrap(RHS), Name));
3865}
3866
3868 const char *Name) {
3869 return wrap(unwrap(B)->CreateFDiv(unwrap(LHS), unwrap(RHS), Name));
3870}
3871
3873 const char *Name) {
3874 return wrap(unwrap(B)->CreateURem(unwrap(LHS), unwrap(RHS), Name));
3875}
3876
3878 const char *Name) {
3879 return wrap(unwrap(B)->CreateSRem(unwrap(LHS), unwrap(RHS), Name));
3880}
3881
3883 const char *Name) {
3884 return wrap(unwrap(B)->CreateFRem(unwrap(LHS), unwrap(RHS), Name));
3885}
3886
3888 const char *Name) {
3889 return wrap(unwrap(B)->CreateShl(unwrap(LHS), unwrap(RHS), Name));
3890}
3891
3893 const char *Name) {
3894 return wrap(unwrap(B)->CreateLShr(unwrap(LHS), unwrap(RHS), Name));
3895}
3896
3898 const char *Name) {
3899 return wrap(unwrap(B)->CreateAShr(unwrap(LHS), unwrap(RHS), Name));
3900}
3901
3903 const char *Name) {
3904 return wrap(unwrap(B)->CreateAnd(unwrap(LHS), unwrap(RHS), Name));
3905}
3906
3908 const char *Name) {
3909 return wrap(unwrap(B)->CreateOr(unwrap(LHS), unwrap(RHS), Name));
3910}
3911
3913 const char *Name) {
3914 return wrap(unwrap(B)->CreateXor(unwrap(LHS), unwrap(RHS), Name));
3915}
3916
3923
3925 return wrap(unwrap(B)->CreateNeg(unwrap(V), Name));
3926}
3927
3929 const char *Name) {
3930 return wrap(unwrap(B)->CreateNSWNeg(unwrap(V), Name));
3931}
3932
3934 const char *Name) {
3935 Value *Neg = unwrap(B)->CreateNeg(unwrap(V), Name);
3936 if (auto *I = dyn_cast<BinaryOperator>(Neg))
3937 I->setHasNoUnsignedWrap();
3938 return wrap(Neg);
3939}
3940
3942 return wrap(unwrap(B)->CreateFNeg(unwrap(V), Name));
3943}
3944
3946 return wrap(unwrap(B)->CreateNot(unwrap(V), Name));
3947}
3948
3950 Value *P = unwrap<Value>(ArithInst);
3951 return cast<Instruction>(P)->hasNoUnsignedWrap();
3952}
3953
3954void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW) {
3955 Value *P = unwrap<Value>(ArithInst);
3956 cast<Instruction>(P)->setHasNoUnsignedWrap(HasNUW);
3957}
3958
3960 Value *P = unwrap<Value>(ArithInst);
3961 return cast<Instruction>(P)->hasNoSignedWrap();
3962}
3963
3964void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW) {
3965 Value *P = unwrap<Value>(ArithInst);
3966 cast<Instruction>(P)->setHasNoSignedWrap(HasNSW);
3967}
3968
3970 Value *P = unwrap<Value>(DivOrShrInst);
3971 return cast<Instruction>(P)->isExact();
3972}
3973
3974void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact) {
3975 Value *P = unwrap<Value>(DivOrShrInst);
3976 cast<Instruction>(P)->setIsExact(IsExact);
3977}
3978
3980 Value *P = unwrap<Value>(NonNegInst);
3981 return cast<Instruction>(P)->hasNonNeg();
3982}
3983
3984void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg) {
3985 Value *P = unwrap<Value>(NonNegInst);
3986 cast<Instruction>(P)->setNonNeg(IsNonNeg);
3987}
3988
3990 Value *P = unwrap<Value>(FPMathInst);
3991 FastMathFlags FMF = cast<Instruction>(P)->getFastMathFlags();
3992 return mapToLLVMFastMathFlags(FMF);
3993}
3994
3996 Value *P = unwrap<Value>(FPMathInst);
3997 cast<Instruction>(P)->setFastMathFlags(mapFromLLVMFastMathFlags(FMF));
3998}
3999
4004
4006 Value *P = unwrap<Value>(Inst);
4007 return cast<PossiblyDisjointInst>(P)->isDisjoint();
4008}
4009
4011 Value *P = unwrap<Value>(Inst);
4012 cast<PossiblyDisjointInst>(P)->setIsDisjoint(IsDisjoint);
4013}
4014
4015/*--.. Memory ..............................................................--*/
4016
4018 const char *Name) {
4019 BasicBlock *BB = unwrap(B)->GetInsertBlock();
4020 const DataLayout &DL = BB->getDataLayout();
4021 Type *ITy = Type::getInt32Ty(BB->getContext());
4022 Value *AllocSize =
4023 unwrap(B)->CreateTypeSize(ITy, DL.getTypeAllocSize(unwrap(Ty)));
4024 return wrap(unwrap(B)->CreateMalloc(ITy, AllocSize, nullptr, nullptr, Name));
4025}
4026
4028 LLVMValueRef Val, const char *Name) {
4029 BasicBlock *BB = unwrap(B)->GetInsertBlock();
4030 const DataLayout &DL = BB->getDataLayout();
4031 Type *ITy = Type::getInt32Ty(BB->getContext());
4032 Value *AllocSize =
4033 unwrap(B)->CreateTypeSize(ITy, DL.getTypeAllocSize(unwrap(Ty)));
4034 return wrap(
4035 unwrap(B)->CreateMalloc(ITy, AllocSize, unwrap(Val), nullptr, Name));
4036}
4037
4039 LLVMValueRef Val, LLVMValueRef Len,
4040 unsigned Align) {
4041 return wrap(unwrap(B)->CreateMemSet(unwrap(Ptr), unwrap(Val), unwrap(Len),
4042 MaybeAlign(Align)));
4043}
4044
4046 LLVMValueRef Dst, unsigned DstAlign,
4047 LLVMValueRef Src, unsigned SrcAlign,
4049 return wrap(unwrap(B)->CreateMemCpy(unwrap(Dst), MaybeAlign(DstAlign),
4050 unwrap(Src), MaybeAlign(SrcAlign),
4051 unwrap(Size)));
4052}
4053
4055 LLVMValueRef Dst, unsigned DstAlign,
4056 LLVMValueRef Src, unsigned SrcAlign,
4058 return wrap(unwrap(B)->CreateMemMove(unwrap(Dst), MaybeAlign(DstAlign),
4059 unwrap(Src), MaybeAlign(SrcAlign),
4060 unwrap(Size)));
4061}
4062
4064 const char *Name) {
4065 return wrap(unwrap(B)->CreateAlloca(unwrap(Ty), nullptr, Name));
4066}
4067
4069 LLVMValueRef Val, const char *Name) {
4070 return wrap(unwrap(B)->CreateAlloca(unwrap(Ty), unwrap(Val), Name));
4071}
4072
4074 return wrap(unwrap(B)->CreateFree(unwrap(PointerVal)));
4075}
4076
4078 LLVMValueRef PointerVal, const char *Name) {
4079 return wrap(unwrap(B)->CreateLoad(unwrap(Ty), unwrap(PointerVal), Name));
4080}
4081
4083 LLVMValueRef PointerVal) {
4084 return wrap(unwrap(B)->CreateStore(unwrap(Val), unwrap(PointerVal)));
4085}
4086
4102
4118
4120 switch (BinOp) {
4152 }
4153
4154 llvm_unreachable("Invalid LLVMAtomicRMWBinOp value!");
4155}
4156
4158 switch (BinOp) {
4190 default: break;
4191 }
4192
4193 llvm_unreachable("Invalid AtomicRMWBinOp value!");
4194}
4195
4197 LLVMBool isSingleThread, const char *Name) {
4198 return wrap(
4199 unwrap(B)->CreateFence(mapFromLLVMOrdering(Ordering),
4200 isSingleThread ? SyncScope::SingleThread
4202 Name));
4203}
4204
4206 LLVMAtomicOrdering Ordering, unsigned SSID,
4207 const char *Name) {
4208 return wrap(
4209 unwrap(B)->CreateFence(mapFromLLVMOrdering(Ordering), SSID, Name));
4210}
4211
4213 LLVMValueRef Pointer, LLVMValueRef *Indices,
4214 unsigned NumIndices, const char *Name) {
4215 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4216 return wrap(unwrap(B)->CreateGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name));
4217}
4218
4220 LLVMValueRef Pointer, LLVMValueRef *Indices,
4221 unsigned NumIndices, const char *Name) {
4222 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4223 return wrap(
4224 unwrap(B)->CreateInBoundsGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name));
4225}
4226
4228 LLVMValueRef Pointer,
4229 LLVMValueRef *Indices,
4230 unsigned NumIndices, const char *Name,
4231 LLVMGEPNoWrapFlags NoWrapFlags) {
4232 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4233 return wrap(unwrap(B)->CreateGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name,
4234 mapFromLLVMGEPNoWrapFlags(NoWrapFlags)));
4235}
4236
4238 LLVMValueRef Pointer, unsigned Idx,
4239 const char *Name) {
4240 return wrap(
4241 unwrap(B)->CreateStructGEP(unwrap(Ty), unwrap(Pointer), Idx, Name));
4242}
4243
4245 const char *Name) {
4246 return wrap(unwrap(B)->CreateGlobalString(Str, Name));
4247}
4248
4250 const char *Name) {
4251 return wrap(unwrap(B)->CreateGlobalString(Str, Name));
4252}
4253
4255 return cast<Instruction>(unwrap(Inst))->isVolatile();
4256}
4257
4258void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile) {
4259 Value *P = unwrap(MemAccessInst);
4260 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4261 return LI->setVolatile(isVolatile);
4263 return SI->setVolatile(isVolatile);
4265 return AI->setVolatile(isVolatile);
4266 return cast<AtomicCmpXchgInst>(P)->setVolatile(isVolatile);
4267}
4268
4270 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->isWeak();
4271}
4272
4273void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak) {
4274 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->setWeak(isWeak);
4275}
4276
4278 Value *P = unwrap(MemAccessInst);
4280 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4281 O = LI->getOrdering();
4282 else if (StoreInst *SI = dyn_cast<StoreInst>(P))
4283 O = SI->getOrdering();
4284 else if (FenceInst *FI = dyn_cast<FenceInst>(P))
4285 O = FI->getOrdering();
4286 else
4287 O = cast<AtomicRMWInst>(P)->getOrdering();
4288 return mapToLLVMOrdering(O);
4289}
4290
4291void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering) {
4292 Value *P = unwrap(MemAccessInst);
4293 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4294
4295 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4296 return LI->setOrdering(O);
4297 else if (FenceInst *FI = dyn_cast<FenceInst>(P))
4298 return FI->setOrdering(O);
4299 else if (AtomicRMWInst *ARWI = dyn_cast<AtomicRMWInst>(P))
4300 return ARWI->setOrdering(O);
4301 return cast<StoreInst>(P)->setOrdering(O);
4302}
4303
4307
4309 unwrap<AtomicRMWInst>(Inst)->setOperation(mapFromLLVMRMWBinOp(BinOp));
4310}
4311
4312/*--.. Casts ...............................................................--*/
4313
4315 LLVMTypeRef DestTy, const char *Name) {
4316 return wrap(unwrap(B)->CreateTrunc(unwrap(Val), unwrap(DestTy), Name));
4317}
4318
4320 LLVMTypeRef DestTy, const char *Name) {
4321 return wrap(unwrap(B)->CreateZExt(unwrap(Val), unwrap(DestTy), Name));
4322}
4323
4325 LLVMTypeRef DestTy, const char *Name) {
4326 return wrap(unwrap(B)->CreateSExt(unwrap(Val), unwrap(DestTy), Name));
4327}
4328
4330 LLVMTypeRef DestTy, const char *Name) {
4331 return wrap(unwrap(B)->CreateFPToUI(unwrap(Val), unwrap(DestTy), Name));
4332}
4333
4335 LLVMTypeRef DestTy, const char *Name) {
4336 return wrap(unwrap(B)->CreateFPToSI(unwrap(Val), unwrap(DestTy), Name));
4337}
4338
4340 LLVMTypeRef DestTy, const char *Name) {
4341 return wrap(unwrap(B)->CreateUIToFP(unwrap(Val), unwrap(DestTy), Name));
4342}
4343
4345 LLVMTypeRef DestTy, const char *Name) {
4346 return wrap(unwrap(B)->CreateSIToFP(unwrap(Val), unwrap(DestTy), Name));
4347}
4348
4350 LLVMTypeRef DestTy, const char *Name) {
4351 return wrap(unwrap(B)->CreateFPTrunc(unwrap(Val), unwrap(DestTy), Name));
4352}
4353
4355 LLVMTypeRef DestTy, const char *Name) {
4356 return wrap(unwrap(B)->CreateFPExt(unwrap(Val), unwrap(DestTy), Name));
4357}
4358
4360 LLVMTypeRef DestTy, const char *Name) {
4361 return wrap(unwrap(B)->CreatePtrToInt(unwrap(Val), unwrap(DestTy), Name));
4362}
4363
4365 LLVMTypeRef DestTy, const char *Name) {
4366 return wrap(unwrap(B)->CreateIntToPtr(unwrap(Val), unwrap(DestTy), Name));
4367}
4368
4370 LLVMTypeRef DestTy, const char *Name) {
4371 return wrap(unwrap(B)->CreateBitCast(unwrap(Val), unwrap(DestTy), Name));
4372}
4373
4375 LLVMTypeRef DestTy, const char *Name) {
4376 return wrap(unwrap(B)->CreateAddrSpaceCast(unwrap(Val), unwrap(DestTy), Name));
4377}
4378
4380 LLVMTypeRef DestTy, const char *Name) {
4381 return wrap(unwrap(B)->CreateZExtOrBitCast(unwrap(Val), unwrap(DestTy),
4382 Name));
4383}
4384
4386 LLVMTypeRef DestTy, const char *Name) {
4387 return wrap(unwrap(B)->CreateSExtOrBitCast(unwrap(Val), unwrap(DestTy),
4388 Name));
4389}
4390
4392 LLVMTypeRef DestTy, const char *Name) {
4393 return wrap(unwrap(B)->CreateTruncOrBitCast(unwrap(Val), unwrap(DestTy),
4394 Name));
4395}
4396
4398 LLVMTypeRef DestTy, const char *Name) {
4399 return wrap(unwrap(B)->CreateCast(Instruction::CastOps(map_from_llvmopcode(Op)), unwrap(Val),
4400 unwrap(DestTy), Name));
4401}
4402
4404 LLVMTypeRef DestTy, const char *Name) {
4405 return wrap(unwrap(B)->CreatePointerCast(unwrap(Val), unwrap(DestTy), Name));
4406}
4407
4409 LLVMTypeRef DestTy, LLVMBool IsSigned,
4410 const char *Name) {
4411 return wrap(
4412 unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy), IsSigned, Name));
4413}
4414
4416 LLVMTypeRef DestTy, const char *Name) {
4417 return wrap(unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy),
4418 /*isSigned*/true, Name));
4419}
4420
4422 LLVMTypeRef DestTy, const char *Name) {
4423 return wrap(unwrap(B)->CreateFPCast(unwrap(Val), unwrap(DestTy), Name));
4424}
4425
4427 LLVMTypeRef DestTy, LLVMBool DestIsSigned) {
4429 unwrap(Src), SrcIsSigned, unwrap(DestTy), DestIsSigned));
4430}
4431
4432/*--.. Comparisons .........................................................--*/
4433
4436 const char *Name) {
4437 return wrap(unwrap(B)->CreateICmp(static_cast<ICmpInst::Predicate>(Op),
4438 unwrap(LHS), unwrap(RHS), Name));
4439}
4440
4443 const char *Name) {
4444 return wrap(unwrap(B)->CreateFCmp(static_cast<FCmpInst::Predicate>(Op),
4445 unwrap(LHS), unwrap(RHS), Name));
4446}
4447
4448/*--.. Miscellaneous instructions ..........................................--*/
4449
4451 return wrap(unwrap(B)->CreatePHI(unwrap(Ty), 0, Name));
4452}
4453
4455 LLVMValueRef *Args, unsigned NumArgs,
4456 const char *Name) {
4458 return wrap(unwrap(B)->CreateCall(FTy, unwrap(Fn),
4459 ArrayRef(unwrap(Args), NumArgs), Name));
4460}
4461
4464 LLVMValueRef Fn, LLVMValueRef *Args,
4465 unsigned NumArgs, LLVMOperandBundleRef *Bundles,
4466 unsigned NumBundles, const char *Name) {
4469 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
4470 OperandBundleDef *OB = unwrap(Bundle);
4471 OBs.push_back(*OB);
4472 }
4473 return wrap(unwrap(B)->CreateCall(
4474 FTy, unwrap(Fn), ArrayRef(unwrap(Args), NumArgs), OBs, Name));
4475}
4476
4478 LLVMValueRef Then, LLVMValueRef Else,
4479 const char *Name) {
4480 return wrap(unwrap(B)->CreateSelect(unwrap(If), unwrap(Then), unwrap(Else),
4481 Name));
4482}
4483
4485 LLVMTypeRef Ty, const char *Name) {
4486 return wrap(unwrap(B)->CreateVAArg(unwrap(List), unwrap(Ty), Name));
4487}
4488
4490 LLVMValueRef Index, const char *Name) {
4491 return wrap(unwrap(B)->CreateExtractElement(unwrap(VecVal), unwrap(Index),
4492 Name));
4493}
4494
4496 LLVMValueRef EltVal, LLVMValueRef Index,
4497 const char *Name) {
4498 return wrap(unwrap(B)->CreateInsertElement(unwrap(VecVal), unwrap(EltVal),
4499 unwrap(Index), Name));
4500}
4501
4503 LLVMValueRef V2, LLVMValueRef Mask,
4504 const char *Name) {
4505 return wrap(unwrap(B)->CreateShuffleVector(unwrap(V1), unwrap(V2),
4506 unwrap(Mask), Name));
4507}
4508
4510 unsigned Index, const char *Name) {
4511 return wrap(unwrap(B)->CreateExtractValue(unwrap(AggVal), Index, Name));
4512}
4513
4515 LLVMValueRef EltVal, unsigned Index,
4516 const char *Name) {
4517 return wrap(unwrap(B)->CreateInsertValue(unwrap(AggVal), unwrap(EltVal),
4518 Index, Name));
4519}
4520
4522 const char *Name) {
4523 return wrap(unwrap(B)->CreateFreeze(unwrap(Val), Name));
4524}
4525
4528 const char *Name) {
4529 return wrap(unwrap(B)->CreateBitInsert(unwrap(Base), unwrap(Val),
4530 unwrap(Offset), Name));
4531}
4532
4535 const char *Name) {
4536 return wrap(unwrap(B)->CreateBitExtract(unwrap(Ty), unwrap(Src),
4537 unwrap(Offset), Name));
4538}
4539
4541 const char *Name) {
4542 return wrap(unwrap(B)->CreateIsNull(unwrap(Val), Name));
4543}
4544
4546 const char *Name) {
4547 return wrap(unwrap(B)->CreateIsNotNull(unwrap(Val), Name));
4548}
4549
4552 const char *Name) {
4553 IRBuilderBase *Builder = unwrap(B);
4554 Value *Diff =
4555 Builder->CreatePtrDiff(unwrap(ElemTy), unwrap(LHS), unwrap(RHS), Name);
4556 return wrap(Builder->CreateSExtOrTrunc(Diff, Builder->getInt64Ty()));
4557}
4558
4560 LLVMValueRef PTR, LLVMValueRef Val,
4561 LLVMAtomicOrdering ordering,
4562 LLVMBool singleThread) {
4564 return wrap(unwrap(B)->CreateAtomicRMW(
4565 intop, unwrap(PTR), unwrap(Val), MaybeAlign(),
4566 mapFromLLVMOrdering(ordering),
4567 singleThread ? SyncScope::SingleThread : SyncScope::System));
4568}
4569
4572 LLVMValueRef PTR, LLVMValueRef Val,
4573 LLVMAtomicOrdering ordering,
4574 unsigned SSID) {
4576 return wrap(unwrap(B)->CreateAtomicRMW(intop, unwrap(PTR), unwrap(Val),
4577 MaybeAlign(),
4578 mapFromLLVMOrdering(ordering), SSID));
4579}
4580
4582 LLVMValueRef Cmp, LLVMValueRef New,
4583 LLVMAtomicOrdering SuccessOrdering,
4584 LLVMAtomicOrdering FailureOrdering,
4585 LLVMBool singleThread) {
4586
4587 return wrap(unwrap(B)->CreateAtomicCmpXchg(
4588 unwrap(Ptr), unwrap(Cmp), unwrap(New), MaybeAlign(),
4589 mapFromLLVMOrdering(SuccessOrdering),
4590 mapFromLLVMOrdering(FailureOrdering),
4591 singleThread ? SyncScope::SingleThread : SyncScope::System));
4592}
4593
4595 LLVMValueRef Cmp, LLVMValueRef New,
4596 LLVMAtomicOrdering SuccessOrdering,
4597 LLVMAtomicOrdering FailureOrdering,
4598 unsigned SSID) {
4599 return wrap(unwrap(B)->CreateAtomicCmpXchg(
4600 unwrap(Ptr), unwrap(Cmp), unwrap(New), MaybeAlign(),
4601 mapFromLLVMOrdering(SuccessOrdering),
4602 mapFromLLVMOrdering(FailureOrdering), SSID));
4603}
4604
4606 Value *P = unwrap(SVInst);
4608 return I->getShuffleMask().size();
4609}
4610
4611int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt) {
4612 Value *P = unwrap(SVInst);
4614 return I->getMaskValue(Elt);
4615}
4616
4618
4620 return unwrap<Instruction>(Inst)->isAtomic();
4621}
4622
4624 // Backwards compatibility: return false for non-atomic instructions
4625 Instruction *I = unwrap<Instruction>(AtomicInst);
4626 if (!I->isAtomic())
4627 return 0;
4628
4630}
4631
4633 // Backwards compatibility: ignore non-atomic instructions
4634 Instruction *I = unwrap<Instruction>(AtomicInst);
4635 if (!I->isAtomic())
4636 return;
4637
4639 setAtomicSyncScopeID(I, SSID);
4640}
4641
4643 Instruction *I = unwrap<Instruction>(AtomicInst);
4644 assert(I->isAtomic() && "Expected an atomic instruction");
4645 return *getAtomicSyncScopeID(I);
4646}
4647
4648void LLVMSetAtomicSyncScopeID(LLVMValueRef AtomicInst, unsigned SSID) {
4649 Instruction *I = unwrap<Instruction>(AtomicInst);
4650 assert(I->isAtomic() && "Expected an atomic instruction");
4651 setAtomicSyncScopeID(I, SSID);
4652}
4653
4655 Value *P = unwrap(CmpXchgInst);
4656 return mapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getSuccessOrdering());
4657}
4658
4660 LLVMAtomicOrdering Ordering) {
4661 Value *P = unwrap(CmpXchgInst);
4662 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4663
4664 return cast<AtomicCmpXchgInst>(P)->setSuccessOrdering(O);
4665}
4666
4668 Value *P = unwrap(CmpXchgInst);
4669 return mapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getFailureOrdering());
4670}
4671
4673 LLVMAtomicOrdering Ordering) {
4674 Value *P = unwrap(CmpXchgInst);
4675 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4676
4677 return cast<AtomicCmpXchgInst>(P)->setFailureOrdering(O);
4678}
4679
4680/*===-- Module providers --------------------------------------------------===*/
4681
4686
4690
4691
4692/*===-- Memory buffers ----------------------------------------------------===*/
4693
4695 const char *Path,
4696 LLVMMemoryBufferRef *OutMemBuf,
4697 char **OutMessage) {
4698
4700 if (std::error_code EC = MBOrErr.getError()) {
4701 *OutMessage = strdup(EC.message().c_str());
4702 return 1;
4703 }
4704 *OutMemBuf = wrap(MBOrErr.get().release());
4705 return 0;
4706}
4707
4709 char **OutMessage) {
4711 if (std::error_code EC = MBOrErr.getError()) {
4712 *OutMessage = strdup(EC.message().c_str());
4713 return 1;
4714 }
4715 *OutMemBuf = wrap(MBOrErr.get().release());
4716 return 0;
4717}
4718
4720 const char *InputData,
4721 size_t InputDataLength,
4722 const char *BufferName,
4723 LLVMBool RequiresNullTerminator) {
4724
4725 return wrap(MemoryBuffer::getMemBuffer(StringRef(InputData, InputDataLength),
4726 StringRef(BufferName),
4727 RequiresNullTerminator).release());
4728}
4729
4731 const char *InputData,
4732 size_t InputDataLength,
4733 const char *BufferName) {
4734
4735 return wrap(
4736 MemoryBuffer::getMemBufferCopy(StringRef(InputData, InputDataLength),
4737 StringRef(BufferName)).release());
4738}
4739
4741 return unwrap(MemBuf)->getBufferStart();
4742}
4743
4745 return unwrap(MemBuf)->getBufferSize();
4746}
4747
4749 delete unwrap(MemBuf);
4750}
4751
4752/*===-- Pass Manager ------------------------------------------------------===*/
4753
4757
4761
4766
4770
4774
4778
4782
4784 delete unwrap(PM);
4785}
4786
4787/*===-- Threading ------------------------------------------------------===*/
4788
4792
4795
4799
4800/*===-- Data Layout ----------------------------------------------------===*/
4801
4803 return wrap(&unwrap(M)->getDataLayout());
4804}
4805
4807 unwrap(M)->setDataLayout(*unwrap(DL));
4808}
4809
4811 return wrap(new DataLayout(StringRep));
4812}
4813
4815
4817 std::string StringRep = unwrap(TD)->getStringRepresentation();
4818 return strdup(StringRep.c_str());
4819}
4820
4824
4826 return unwrap(TD)->getPointerSize(0);
4827}
4828
4829unsigned LLVMPointerSizeForAS(LLVMTargetDataRef TD, unsigned AS) {
4830 return unwrap(TD)->getPointerSize(AS);
4831}
4832
4836
4838 return wrap(
4839 unwrap(TD)->getIntPtrType(*unwrap(getGlobalContextForCAPI()), AS));
4840}
4841
4845
4847 unsigned AS) {
4848 return wrap(unwrap(TD)->getIntPtrType(*unwrap(C), AS));
4849}
4850
4852 return unwrap(TD)->getTypeSizeInBits(unwrap(Ty));
4853}
4854
4856 return unwrap(TD)->getTypeStoreSize(unwrap(Ty));
4857}
4858
4860 return unwrap(TD)->getTypeAllocSize(unwrap(Ty));
4861}
4862
4864 return unwrap(TD)->getABITypeAlign(unwrap(Ty)).value();
4865}
4866
4868 return unwrap(TD)->getABITypeAlign(unwrap(Ty)).value();
4869}
4870
4872 return unwrap(TD)->getPrefTypeAlign(unwrap(Ty)).value();
4873}
4874
4876 LLVMValueRef GlobalVar) {
4877 return unwrap(TD)
4878 ->getPreferredAlign(unwrap<GlobalVariable>(GlobalVar))
4879 .value();
4880}
4881
4883 unsigned long long Offset) {
4884 StructType *STy = unwrap<StructType>(StructTy);
4885 return unwrap(TD)->getStructLayout(STy)->getElementContainingOffset(Offset);
4886}
4887
4889 LLVMTypeRef StructTy, unsigned Element) {
4890 StructType *STy = unwrap<StructType>(StructTy);
4891 return unwrap(TD)->getStructLayout(STy)->getElementOffset(Element);
4892}
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:277
#define LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_POP
Definition Compiler.h:278
#define LLVM_EXTENSION
LLVM_EXTENSION - Support compilers where we have a keyword to suppress pedantic diagnostics.
Definition Compiler.h:494
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:2982
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:3447
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:3767
static FastMathFlags mapFromLLVMFastMathFlags(LLVMFastMathFlags FMF)
Definition Core.cpp:3754
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:4833
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
static AtomicOrdering mapFromLLVMOrdering(LLVMAtomicOrdering Ordering)
Definition Core.cpp:4087
static Intrinsic::ID llvm_map_to_intrinsic_id(unsigned ID)
Definition Core.cpp:2573
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:4103
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:2993
LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3933
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:4157
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:4837
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:3443
LLVMTypeRef LLVMInt128Type(void)
Definition Core.cpp:739
static AtomicRMWInst::BinOp mapFromLLVMRMWBinOp(LLVMAtomicRMWBinOp BinOp)
Definition Core.cpp:4119
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
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 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:114
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition IRBuilder.h:2901
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:752
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:593
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:592
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:4802
LLVMTargetDataRef LLVMCreateTargetData(const char *StringRep)
Creates target data from a target layout string.
Definition Core.cpp:4810
unsigned LLVMPreferredAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the preferred alignment of a type in bytes for a target.
Definition Core.cpp:4871
unsigned LLVMCallFrameAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the call frame alignment of a type in bytes for a target.
Definition Core.cpp:4867
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:4888
void LLVMDisposeTargetData(LLVMTargetDataRef TD)
Deallocates a TargetData.
Definition Core.cpp:4814
LLVMByteOrdering LLVMByteOrder(LLVMTargetDataRef TD)
Returns the byte order of a target, either LLVMBigEndian or LLVMLittleEndian.
Definition Core.cpp:4821
unsigned LLVMPreferredAlignmentOfGlobal(LLVMTargetDataRef TD, LLVMValueRef GlobalVar)
Computes the preferred alignment of a global variable in bytes for a target.
Definition Core.cpp:4875
unsigned long long LLVMStoreSizeOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the storage size of a type in bytes for a target.
Definition Core.cpp:4855
LLVMByteOrdering
Definition Core.h:5377
unsigned long long LLVMABISizeOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the ABI size of a type in bytes for a target.
Definition Core.cpp:4859
unsigned LLVMPointerSizeForAS(LLVMTargetDataRef TD, unsigned AS)
Returns the pointer size in bytes for a target for a specified address space.
Definition Core.cpp:4829
unsigned LLVMABIAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the ABI alignment of a type in bytes for a target.
Definition Core.cpp:4863
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:4882
LLVMTypeRef LLVMIntPtrTypeInContext(LLVMContextRef C, LLVMTargetDataRef TD)
Returns the integer type that is the same size as a pointer on a target.
Definition Core.cpp:4842
char * LLVMCopyStringRepOfTargetData(LLVMTargetDataRef TD)
Converts target data to a target layout string.
Definition Core.cpp:4816
unsigned LLVMPointerSize(LLVMTargetDataRef TD)
Returns the pointer size in bytes for a target.
Definition Core.cpp:4825
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:4846
void LLVMSetModuleDataLayout(LLVMModuleRef M, LLVMTargetDataRef DL)
Set the data layout for a module.
Definition Core.cpp:4806
unsigned long long LLVMSizeOfTypeInBits(LLVMTargetDataRef TD, LLVMTypeRef Ty)
Computes the size of a type in bits for a target.
Definition Core.cpp:4851
struct LLVMOpaqueTargetData * LLVMTargetDataRef
Definition Core.h:5379
@ LLVMBigEndian
Definition Core.h:5377
@ LLVMLittleEndian
Definition Core.h:5377
LLVMValueRef LLVMBuildAggregateRet(LLVMBuilderRef B, LLVMValueRef *RetVals, unsigned N)
Definition Core.cpp:3563
LLVMValueRef LLVMBuildMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3827
LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef B)
Definition Core.cpp:3555
LLVMValueRef LLVMBuildSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3807
LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3837
LLVMBool LLVMGetWeak(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4269
LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4397
LLVMValueRef LLVMBuildIsNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4540
LLVMValueRef LLVMBuildGEPWithNoWrapFlags(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name, LLVMGEPNoWrapFlags NoWrapFlags)
Creates a GetElementPtr instruction.
Definition Core.cpp:4227
LLVMValueRef LLVMBuildAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3787
void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak)
Definition Core.cpp:4273
LLVMValueRef LLVMBuildOr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3907
LLVMValueRef LLVMBuildBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4369
LLVMValueRef LLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3852
LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition Core.cpp:4212
LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3812
void LLVMPositionBuilderBeforeInstrAndDbgRecords(LLVMBuilderRef Builder, LLVMValueRef Instr)
Set the builder position before Instr and any attached debug records.
Definition Core.cpp:3472
LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4545
void LLVMDisposeBuilder(LLVMBuilderRef Builder)
Definition Core.cpp:3500
void LLVMClearInsertionPosition(LLVMBuilderRef Builder)
Definition Core.cpp:3487
LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PersFn, unsigned NumClauses, const char *Name)
Definition Core.cpp:3629
void LLVMSetIsDisjoint(LLVMValueRef Inst, LLVMBool IsDisjoint)
Sets the disjoint flag for the instruction.
Definition Core.cpp:4010
LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst)
Definition Core.cpp:4623
LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn)
Definition Core.cpp:3659
void LLVMSetAtomicRMWBinOp(LLVMValueRef Inst, LLVMAtomicRMWBinOp BinOp)
Definition Core.cpp:4308
LLVMValueRef LLVMBuildFDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3867
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:3615
LLVMValueRef LLVMBuildXor(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3912
LLVMValueRef LLVMBuildBitExtract(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Src, LLVMValueRef Offset, const char *Name)
Definition Core.cpp:4533
LLVMBool LLVMGetExact(LLVMValueRef DivOrShrInst)
Definition Core.cpp:3969
LLVMValueRef LLVMBuildAddrSpaceCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4374
unsigned LLVMGetNumMaskElements(LLVMValueRef SVInst)
Get the number of elements in the mask of a ShuffleVector instruction.
Definition Core.cpp:4605
void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr)
Definition Core.cpp:3491
LLVMValueRef LLVMBuildCleanupRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition Core.cpp:3680
LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4334
void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers)
Obtain the basic blocks acting as handlers for a catchswitch instruction.
Definition Core.cpp:3727
LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4314
LLVMValueRef LLVMGetArgOperand(LLVMValueRef Funclet, unsigned i)
Definition Core.cpp:3744
LLVMValueRef LLVMBuildAnd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3902
unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch)
Definition Core.cpp:3723
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:3587
LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder)
Definition Core.cpp:3483
LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3857
LLVMValueRef LLVMBuildSExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4385
LLVMValueRef LLVMBuildCall2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:4454
void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW)
Definition Core.cpp:3964
LLVMMetadataRef LLVMGetCurrentDebugLocation2(LLVMBuilderRef Builder)
Get location information used by debugging information.
Definition Core.cpp:3506
LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3847
LLVMValueRef LLVMBuildSelect(LLVMBuilderRef B, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, const char *Name)
Definition Core.cpp:4477
void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr)
Set the builder position before Instr but after any attached debug records.
Definition Core.cpp:3467
LLVMBool LLVMCanValueUseFastMathFlags(LLVMValueRef V)
Check if a given value can potentially have fast math flags.
Definition Core.cpp:4000
void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value)
Definition Core.cpp:3748
LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef B, LLVMValueRef If, LLVMBasicBlockRef Then, LLVMBasicBlockRef Else)
Definition Core.cpp:3572
LLVMBool LLVMGetNUW(LLVMValueRef ArithInst)
Definition Core.cpp:3949
LLVMOpcode LLVMGetCastOpcode(LLVMValueRef Src, LLVMBool SrcIsSigned, LLVMTypeRef DestTy, LLVMBool DestIsSigned)
Definition Core.cpp:4426
void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr, const char *Name)
Definition Core.cpp:3495
LLVMValueRef LLVMBuildSRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3877
LLVMValueRef LLVMBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:3648
LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Deprecated: This cast is always signed.
Definition Core.cpp:4415
LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder)
Deprecated: Returning the NULL location will crash.
Definition Core.cpp:3523
LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef Index, const char *Name)
Definition Core.cpp:4489
LLVMValueRef LLVMBuildShl(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3887
LLVMBuilderRef LLVMCreateBuilderInContext(LLVMContextRef C)
Definition Core.cpp:3439
LLVMValueRef LLVMBuildCatchRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition Core.cpp:3674
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:4054
LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemAccessInst)
Definition Core.cpp:4277
LLVMValueRef LLVMBuildStructGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, unsigned Idx, const char *Name)
Definition Core.cpp:4237
int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt)
Get the mask value at position Elt in the mask of a ShuffleVector instruction.
Definition Core.cpp:4611
void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal, LLVMBasicBlockRef Dest)
Definition Core.cpp:3690
LLVMValueRef LLVMBuildBr(LLVMBuilderRef B, LLVMBasicBlockRef Dest)
Definition Core.cpp:3568
LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, const char *Name)
Definition Core.cpp:4495
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:3460
void LLVMSetFastMathFlags(LLVMValueRef FPMathInst, LLVMFastMathFlags FMF)
Sets the flags for which fast-math-style optimizations are allowed for this value.
Definition Core.cpp:3995
LLVMValueRef LLVMBuildIntCast2(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, LLVMBool IsSigned, const char *Name)
Definition Core.cpp:4408
LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3817
LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3802
LLVMValueRef LLVMBuildCatchPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:3641
LLVMValueRef LLVMBuildCallWithOperandBundles(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name)
Definition Core.cpp:4463
LLVMBool LLVMIsCleanup(LLVMValueRef LandingPad)
Definition Core.cpp:3711
LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4379
LLVMBool LLVMGetVolatile(LLVMValueRef Inst)
Definition Core.cpp:4254
LLVMValueRef LLVMBuildFPCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4421
LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4359
LLVMValueRef LLVMBuildPtrDiff2(LLVMBuilderRef B, LLVMTypeRef ElemTy, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4550
LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4391
LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4068
LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx)
Definition Core.cpp:3703
unsigned LLVMGetAtomicSyncScopeID(LLVMValueRef AtomicInst)
Returns the synchronization scope ID of an atomic instruction.
Definition Core.cpp:4642
LLVMValueRef LLVMBuildVAArg(LLVMBuilderRef B, LLVMValueRef List, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4484
LLVMValueRef LLVMBuildAtomicCmpXchgSyncScope(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, unsigned SSID)
Definition Core.cpp:4594
LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3917
LLVMBool LLVMIsAtomic(LLVMValueRef Inst)
Returns whether an instruction is an atomic instruction, e.g., atomicrmw, cmpxchg,...
Definition Core.cpp:4619
void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile)
Definition Core.cpp:4258
void LLVMSetAtomicSingleThread(LLVMValueRef AtomicInst, LLVMBool NewValue)
Definition Core.cpp:4632
LLVMValueRef LLVMBuildFRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3882
LLVMValueRef LLVMBuildURem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3872
LLVMValueRef LLVMBuildIntToPtr(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4364
LLVMBool LLVMGetNSW(LLVMValueRef ArithInst)
Definition Core.cpp:3959
LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3832
LLVMValueRef LLVMBuildFree(LLVMBuilderRef B, LLVMValueRef PointerVal)
Definition Core.cpp:4073
LLVMValueRef LLVMBuildNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3924
LLVMValueRef LLVMBuildFSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3822
LLVMValueRef LLVMBuildCatchSwitch(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMBasicBlockRef UnwindBB, unsigned NumHandlers, const char *Name)
Definition Core.cpp:3663
LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name)
Definition Core.cpp:4077
LLVMValueRef LLVMBuildInBoundsGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition Core.cpp:4219
LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4027
LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, LLVMBool singleThread)
Definition Core.cpp:4581
LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr, unsigned NumDests)
Definition Core.cpp:3582
LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef B)
Definition Core.cpp:3686
LLVMValueRef LLVMBuildSIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4344
LLVMValueRef LLVMBuildSExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4324
LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4329
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:3529
void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Builder, LLVMMetadataRef Loc)
Set location information used by debugging information.
Definition Core.cpp:3510
LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4063
void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L)
Deprecated: Passing the NULL location will crash.
Definition Core.cpp:3517
LLVMValueRef LLVMBuildPhi(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4450
void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest)
Definition Core.cpp:3695
LLVMBool LLVMGetNNeg(LLVMValueRef NonNegInst)
Gets if the instruction has the non-negative flag set.
Definition Core.cpp:3979
LLVMValueRef LLVMBuildAtomicRMWSyncScope(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, unsigned SSID)
Definition Core.cpp:4570
LLVMValueRef LLVMBuildRet(LLVMBuilderRef B, LLVMValueRef V)
Definition Core.cpp:3559
LLVMMetadataRef LLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder)
Get the dafult floating-point math metadata for a given builder.
Definition Core.cpp:3549
LLVMValueRef LLVMBuildExtractValue(LLVMBuilderRef B, LLVMValueRef AggVal, unsigned Index, const char *Name)
Definition Core.cpp:4509
LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str, const char *Name)
Deprecated: Use LLVMBuildGlobalString instead, which has identical behavior.
Definition Core.cpp:4249
LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3792
void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block)
Definition Core.cpp:3478
LLVMValueRef LLVMBuildFMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3842
LLVMValueRef LLVMBuildLShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3892
LLVMAtomicRMWBinOp LLVMGetAtomicRMWBinOp(LLVMValueRef Inst)
Definition Core.cpp:4304
LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3941
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:4038
void LLVMSetAtomicSyncScopeID(LLVMValueRef AtomicInst, unsigned SSID)
Sets the synchronization scope ID of an atomic instruction.
Definition Core.cpp:4648
LLVMContextRef LLVMGetBuilderContext(LLVMBuilderRef Builder)
Obtain the context to which this builder is associated.
Definition Core.cpp:3545
LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4017
LLVMValueRef LLVMBuildFreeze(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4521
LLVMValueRef LLVMBuildGlobalString(LLVMBuilderRef B, const char *Str, const char *Name)
Definition Core.cpp:4244
void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW)
Definition Core.cpp:3954
LLVMAtomicOrdering LLVMGetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4654
LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef B, LLVMRealPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4441
LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4403
LLVMValueRef LLVMBuildExactSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3862
LLVMValueRef LLVMBuildShuffleVector(LLVMBuilderRef B, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, const char *Name)
Definition Core.cpp:4502
LLVMValueRef LLVMBuildFPExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4354
void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val)
Definition Core.cpp:3715
LLVMValueRef LLVMBuildICmp(LLVMBuilderRef B, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4434
void LLVMSetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4672
void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal)
Definition Core.cpp:3707
LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, LLVMBool isSingleThread, const char *Name)
Definition Core.cpp:4196
void LLVMSetParentCatchSwitch(LLVMValueRef CatchPad, LLVMValueRef CatchSwitch)
Set the parent catchswitch instruction of a catchpad instruction.
Definition Core.cpp:3737
LLVMValueRef LLVMBuildFenceSyncScope(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, unsigned SSID, const char *Name)
Definition Core.cpp:4205
LLVMValueRef LLVMBuildUIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4339
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:3454
unsigned LLVMGetNumClauses(LLVMValueRef LandingPad)
Definition Core.cpp:3699
int LLVMGetUndefMaskElem(void)
Definition Core.cpp:4617
void LLVMSetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4659
LLVMValueRef LLVMGetParentCatchSwitch(LLVMValueRef CatchPad)
Get the parent catchswitch instruction of a catchpad instruction.
Definition Core.cpp:3733
LLVMFastMathFlags LLVMGetFastMathFlags(LLVMValueRef FPMathInst)
Get the flags for which fast-math-style optimizations are allowed for this value.
Definition Core.cpp:3989
LLVMBool LLVMGetIsDisjoint(LLVMValueRef Inst)
Gets whether the instruction has the disjoint flag set.
Definition Core.cpp:4005
LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef B, LLVMValueRef V, LLVMBasicBlockRef Else, unsigned NumCases)
Definition Core.cpp:3577
void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg)
Sets the non-negative flag for the instruction.
Definition Core.cpp:3984
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:4045
void LLVMAddHandler(LLVMValueRef CatchSwitch, LLVMBasicBlockRef Dest)
Definition Core.cpp:3719
void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact)
Definition Core.cpp:3974
LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3928
LLVMValueRef LLVMBuildAShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3897
LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, const char *Name)
Definition Core.cpp:3606
LLVMValueRef LLVMBuildBitInsert(LLVMBuilderRef B, LLVMValueRef Base, LLVMValueRef Val, LLVMValueRef Offset, const char *Name)
Definition Core.cpp:4526
void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4291
LLVMValueRef LLVMBuildFPTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4349
LLVMValueRef LLVMBuildStore(LLVMBuilderRef B, LLVMValueRef Val, LLVMValueRef PointerVal)
Definition Core.cpp:4082
void LLVMAddMetadataToInst(LLVMBuilderRef Builder, LLVMValueRef Inst)
Same as LLVMSetInstDebugLocation.
Definition Core.cpp:3533
LLVMAtomicOrdering LLVMGetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4667
LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3797
LLVMValueRef LLVMBuildInsertValue(LLVMBuilderRef B, LLVMValueRef AggVal, LLVMValueRef EltVal, unsigned Index, const char *Name)
Definition Core.cpp:4514
void LLVMBuilderSetDefaultFPMathTag(LLVMBuilderRef Builder, LLVMMetadataRef FPMathTag)
Set the default floating-point math metadata for the given builder.
Definition Core.cpp:3537
LLVMValueRef LLVMBuildZExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4319
LLVMValueRef LLVMBuildNot(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3945
LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, LLVMBool singleThread)
Definition Core.cpp:4559
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange(const char *InputData, size_t InputDataLength, const char *BufferName, LLVMBool RequiresNullTerminator)
Definition Core.cpp:4719
size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4744
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData, size_t InputDataLength, const char *BufferName)
Definition Core.cpp:4730
const char * LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4740
LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const char *Path, LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
Definition Core.cpp:4694
LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
Definition Core.cpp:4708
void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4748
LLVMModuleProviderRef LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M)
Changes the type of M so it can be passed to FunctionPassManagers and the JIT.
Definition Core.cpp:4683
void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP)
Destroys the module M.
Definition Core.cpp:4687
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:2513
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:2534
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:2501
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:2495
LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn)
Decrement a Function iterator to the previous Function.
Definition Core.cpp:2542
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:2526
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:2509
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:2518
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:2860
unsigned LLVMGetNumOperandBundleArgs(LLVMOperandBundleRef Bundle)
Obtain the number of operands for an operand bundle.
Definition Core.cpp:2877
const char * LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len)
Obtain the tag of an operand bundle as a string.
Definition Core.cpp:2871
void LLVMDisposeOperandBundle(LLVMOperandBundleRef Bundle)
Destroy an operand bundle.
Definition Core.cpp:2867
LLVMValueRef LLVMGetOperandBundleArgAtIndex(LLVMOperandBundleRef Bundle, unsigned Index)
Obtain the operand for an operand bundle at the given index.
Definition Core.cpp:2881
LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef P)
Deprecated: Use LLVMCreateFunctionPassManagerForModule instead.
Definition Core.cpp:4762
LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M)
Constructs a new function-by-function pass pipeline over the module provider.
Definition Core.cpp:4758
LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM)
Finalizes all of the function passes scheduled in the function pass manager.
Definition Core.cpp:4779
void LLVMDisposePassManager(LLVMPassManagerRef PM)
Frees the memory of a pass pipeline.
Definition Core.cpp:4783
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:4775
LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM)
Initializes all of the function passes scheduled in the function pass manager.
Definition Core.cpp:4771
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:4767
LLVMPassManagerRef LLVMCreatePassManager()
Constructs a new whole-module pass pipeline.
Definition Core.cpp:4754
void LLVMStopMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
Definition Core.cpp:4793
LLVMBool LLVMStartMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
Definition Core.cpp:4789
LLVMBool LLVMIsMultithreaded()
Check whether LLVM is executing in thread-safe mode or not.
Definition Core.cpp:4796
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:504
LLVMLinkage
Definition Core.h:181
LLVMOpcode
External users depend on the following values being stable.
Definition Core.h:62
LLVMRealPredicate
Definition Core.h:315
LLVMTypeKind
Definition Core.h:156
LLVMDLLStorageClass
Definition Core.h:216
LLVMValueKind
Definition Core.h:266
unsigned LLVMAttributeIndex
Definition Core.h:495
LLVMDbgRecordKind
Definition Core.h:548
LLVMIntPredicate
Definition Core.h:302
unsigned LLVMFastMathFlags
Flags to indicate what fast-math-style optimizations are allowed on operations.
Definition Core.h:532
LLVMUnnamedAddr
Definition Core.h:210
LLVMModuleFlagBehavior
Definition Core.h:432
LLVMDiagnosticSeverity
Definition Core.h:420
LLVMVisibility
Definition Core.h:204
LLVMAtomicRMWBinOp
Definition Core.h:369
LLVMThreadLocalMode
Definition Core.h:334
unsigned LLVMGEPNoWrapFlags
Flags that constrain the allowed wrap semantics of a getelementptr instruction.
Definition Core.h:546
LLVMAtomicOrdering
Definition Core.h:342
LLVMInlineAsmDialect
Definition Core.h:427
@ LLVMDLLImportLinkage
Obsolete.
Definition Core.h:195
@ LLVMInternalLinkage
Rename collisions when linking (static functions)
Definition Core.h:192
@ LLVMLinkOnceAnyLinkage
Keep one copy of function when linking (inline)
Definition Core.h:184
@ LLVMExternalLinkage
Externally visible function.
Definition Core.h:182
@ LLVMExternalWeakLinkage
ExternalWeak linkage description.
Definition Core.h:197
@ LLVMLinkOnceODRLinkage
Same, but only replaced by something equivalent.
Definition Core.h:185
@ LLVMPrivateLinkage
Like Internal, but omit from symbol table.
Definition Core.h:194
@ LLVMDLLExportLinkage
Obsolete.
Definition Core.h:196
@ LLVMLinkerPrivateLinkage
Like Private, but linker removes.
Definition Core.h:200
@ LLVMWeakODRLinkage
Same, but only replaced by something equivalent.
Definition Core.h:189
@ LLVMGhostLinkage
Obsolete.
Definition Core.h:198
@ LLVMWeakAnyLinkage
Keep one copy of function when linking (weak)
Definition Core.h:188
@ LLVMAppendingLinkage
Special purpose, only applies to global arrays.
Definition Core.h:191
@ LLVMCommonLinkage
Tentative definitions.
Definition Core.h:199
@ LLVMLinkOnceODRAutoHideLinkage
Obsolete.
Definition Core.h:187
@ LLVMLinkerPrivateWeakLinkage
Like LinkerPrivate, but is weak.
Definition Core.h:201
@ LLVMAvailableExternallyLinkage
Definition Core.h:183
@ LLVMFastMathAllowReassoc
Definition Core.h:512
@ LLVMFastMathNoSignedZeros
Definition Core.h:515
@ LLVMFastMathApproxFunc
Definition Core.h:518
@ LLVMFastMathNoInfs
Definition Core.h:514
@ LLVMFastMathNoNaNs
Definition Core.h:513
@ LLVMFastMathNone
Definition Core.h:519
@ LLVMFastMathAllowContract
Definition Core.h:517
@ LLVMFastMathAllowReciprocal
Definition Core.h:516
@ LLVMGEPFlagInBounds
Definition Core.h:535
@ LLVMGEPFlagNUSW
Definition Core.h:536
@ LLVMGEPFlagNUW
Definition Core.h:537
@ LLVMHalfTypeKind
16 bit floating point type
Definition Core.h:158
@ LLVMFP128TypeKind
128 bit floating point type (112-bit mantissa)
Definition Core.h:162
@ LLVMIntegerTypeKind
Arbitrary bit width integers.
Definition Core.h:165
@ LLVMPointerTypeKind
Pointers.
Definition Core.h:169
@ LLVMX86_FP80TypeKind
80 bit floating point type (X87)
Definition Core.h:161
@ LLVMX86_AMXTypeKind
X86 AMX.
Definition Core.h:176
@ LLVMMetadataTypeKind
Metadata.
Definition Core.h:171
@ LLVMByteTypeKind
Arbitrary bit width bytes.
Definition Core.h:178
@ LLVMScalableVectorTypeKind
Scalable SIMD vector type.
Definition Core.h:174
@ LLVMArrayTypeKind
Arrays.
Definition Core.h:168
@ LLVMBFloatTypeKind
16 bit brain floating point type
Definition Core.h:175
@ LLVMStructTypeKind
Structures.
Definition Core.h:167
@ LLVMLabelTypeKind
Labels.
Definition Core.h:164
@ LLVMDoubleTypeKind
64 bit floating point type
Definition Core.h:160
@ LLVMVoidTypeKind
type with no size
Definition Core.h:157
@ LLVMTokenTypeKind
Tokens.
Definition Core.h:173
@ LLVMFloatTypeKind
32 bit floating point type
Definition Core.h:159
@ LLVMFunctionTypeKind
Functions.
Definition Core.h:166
@ LLVMVectorTypeKind
Fixed width SIMD vector type.
Definition Core.h:170
@ LLVMPPC_FP128TypeKind
128 bit floating point type (two 64-bits)
Definition Core.h:163
@ LLVMTargetExtTypeKind
Target extension type.
Definition Core.h:177
@ LLVMInstructionValueKind
Definition Core.h:296
@ LLVMDbgRecordValue
Definition Core.h:551
@ LLVMDbgRecordDeclare
Definition Core.h:550
@ LLVMDbgRecordLabel
Definition Core.h:549
@ LLVMDbgRecordAssign
Definition Core.h:552
@ LLVMGlobalUnnamedAddr
Address of the GV is globally insignificant.
Definition Core.h:213
@ LLVMLocalUnnamedAddr
Address of the GV is locally insignificant.
Definition Core.h:212
@ LLVMNoUnnamedAddr
Address of the GV is significant.
Definition Core.h:211
@ LLVMModuleFlagBehaviorRequire
Adds a requirement that another module flag be present and have a specified value after linking is pe...
Definition Core.h:458
@ LLVMModuleFlagBehaviorWarning
Emits a warning if two values disagree.
Definition Core.h:446
@ LLVMModuleFlagBehaviorOverride
Uses the specified value, regardless of the behavior or value of the other module.
Definition Core.h:466
@ LLVMModuleFlagBehaviorAppendUnique
Appends the two values, which are required to be metadata nodes.
Definition Core.h:480
@ LLVMModuleFlagBehaviorAppend
Appends the two values, which are required to be metadata nodes.
Definition Core.h:472
@ LLVMModuleFlagBehaviorError
Emits an error if two values disagree, otherwise the resulting value is that of the operands.
Definition Core.h:439
@ LLVMDSWarning
Definition Core.h:422
@ LLVMDSNote
Definition Core.h:424
@ LLVMDSError
Definition Core.h:421
@ LLVMDSRemark
Definition Core.h:423
@ LLVMAtomicRMWBinOpXor
Xor a value and return the old one.
Definition Core.h:376
@ LLVMAtomicRMWBinOpXchg
Set the new value and return the one old.
Definition Core.h:370
@ LLVMAtomicRMWBinOpSub
Subtract a value and return the old one.
Definition Core.h:372
@ LLVMAtomicRMWBinOpUMax
Sets the value if it's greater than the original using an unsigned comparison and return the old one.
Definition Core.h:383
@ LLVMAtomicRMWBinOpUSubSat
Subtracts the value, clamping to zero.
Definition Core.h:405
@ LLVMAtomicRMWBinOpAnd
And a value and return the old one.
Definition Core.h:373
@ LLVMAtomicRMWBinOpUDecWrap
Decrements the value, wrapping back to the input value when decremented below zero.
Definition Core.h:401
@ LLVMAtomicRMWBinOpFMax
Sets the value if it's greater than the original using an floating point comparison and return the ol...
Definition Core.h:393
@ LLVMAtomicRMWBinOpMin
Sets the value if it's Smaller than the original using a signed comparison and return the old one.
Definition Core.h:380
@ LLVMAtomicRMWBinOpOr
OR a value and return the old one.
Definition Core.h:375
@ LLVMAtomicRMWBinOpFMin
Sets the value if it's smaller than the original using an floating point comparison and return the ol...
Definition Core.h:396
@ LLVMAtomicRMWBinOpMax
Sets the value if it's greater than the original using a signed comparison and return the old one.
Definition Core.h:377
@ LLVMAtomicRMWBinOpFMaximum
Sets the value if it's greater than the original using an floating point comparison and return the ol...
Definition Core.h:406
@ LLVMAtomicRMWBinOpFMinimum
Sets the value if it's smaller than the original using an floating point comparison and return the ol...
Definition Core.h:409
@ LLVMAtomicRMWBinOpFMinimumNum
Sets the value if it's smaller than the original using an floating point comparison and return the ol...
Definition Core.h:415
@ LLVMAtomicRMWBinOpUIncWrap
Increments the value, wrapping back to zero when incremented above input value.
Definition Core.h:399
@ LLVMAtomicRMWBinOpFMaximumNum
Sets the value if it's greater than the original using an floating point comparison and return the ol...
Definition Core.h:412
@ LLVMAtomicRMWBinOpFAdd
Add a floating point value and return the old one.
Definition Core.h:389
@ LLVMAtomicRMWBinOpFSub
Subtract a floating point value and return the old one.
Definition Core.h:391
@ LLVMAtomicRMWBinOpAdd
Add a value and return the old one.
Definition Core.h:371
@ LLVMAtomicRMWBinOpUMin
Sets the value if it's greater than the original using an unsigned comparison and return the old one.
Definition Core.h:386
@ LLVMAtomicRMWBinOpNand
Not-And a value and return the old one.
Definition Core.h:374
@ LLVMAtomicRMWBinOpUSubCond
Subtracts the value only if no unsigned overflow.
Definition Core.h:403
@ LLVMGeneralDynamicTLSModel
Definition Core.h:336
@ LLVMLocalDynamicTLSModel
Definition Core.h:337
@ LLVMNotThreadLocal
Definition Core.h:335
@ LLVMInitialExecTLSModel
Definition Core.h:338
@ LLVMLocalExecTLSModel
Definition Core.h:339
@ LLVMAtomicOrderingAcquireRelease
provides both an Acquire and a Release barrier (for fences and operations which both read and write m...
Definition Core.h:355
@ LLVMAtomicOrderingRelease
Release is similar to Acquire, but with a barrier of the sort necessary to release a lock.
Definition Core.h:352
@ LLVMAtomicOrderingAcquire
Acquire provides a barrier of the sort necessary to acquire a lock to access other memory with normal...
Definition Core.h:349
@ LLVMAtomicOrderingMonotonic
guarantees that if you take all the operations affecting a specific address, a consistent ordering ex...
Definition Core.h:346
@ LLVMAtomicOrderingSequentiallyConsistent
provides Acquire semantics for loads and Release semantics for stores.
Definition Core.h:359
@ LLVMAtomicOrderingNotAtomic
A load or store which is not atomic.
Definition Core.h:343
@ LLVMAtomicOrderingUnordered
Lowest level of atomicity, guarantees somewhat sane results, lock free.
Definition Core.h:344
@ LLVMInlineAsmDialectATT
Definition Core.h:428
@ LLVMInlineAsmDialectIntel
Definition Core.h:429
LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB)
Obtain the last instruction in a basic block.
Definition Core.cpp:3028
void LLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to after another one.
Definition Core.cpp:3010
LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn)
Obtain the first basic block in a function.
Definition Core.cpp:2926
LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C, const char *Name)
Create a new basic block without inserting it into a function.
Definition Core.cpp:2958
LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB)
Go backwards in a basic block iterator.
Definition Core.cpp:2950
LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn)
Obtain the last basic block in a function.
Definition Core.cpp:2934
LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB)
Obtain the terminator instruction for a basic block.
Definition Core.cpp:2908
const char * LLVMGetBasicBlockName(LLVMBasicBlockRef BB)
Obtain the string name of a basic block.
Definition Core.cpp:2900
void LLVMAppendExistingBasicBlock(LLVMValueRef Fn, LLVMBasicBlockRef BB)
Append the given basic block to the basic block list of the given function.
Definition Core.cpp:2971
void LLVMDeleteBasicBlock(LLVMBasicBlockRef BBRef)
Remove a basic block from a function and delete it.
Definition Core.cpp:2998
LLVMBasicBlockRef LLVMInsertBasicBlockInContext(LLVMContextRef C, LLVMBasicBlockRef BBRef, const char *Name)
Insert a basic block in a function before another basic block.
Definition Core.cpp:2986
void LLVMGetBasicBlocks(LLVMValueRef FnRef, LLVMBasicBlockRef *BasicBlocksRefs)
Obtain all of the basic blocks in a function.
Definition Core.cpp:2916
void LLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to before another one.
Definition Core.cpp:3006
LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB)
Obtain the function to which a basic block belongs.
Definition Core.cpp:2904
LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn)
Obtain the basic block that corresponds to the entry point of a function.
Definition Core.cpp:2922
LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB)
Obtain the first instruction in a basic block.
Definition Core.cpp:3020
void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder, LLVMBasicBlockRef BB)
Insert the given basic block after the insertion point of the given builder.
Definition Core.cpp:2963
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB)
Convert a basic block instance to a value type.
Definition Core.cpp:2888
LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val)
Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
Definition Core.cpp:2896
void LLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BBRef)
Remove a basic block from a function.
Definition Core.cpp:3002
LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB)
Advance a basic block iterator.
Definition Core.cpp:2942
unsigned LLVMCountBasicBlocks(LLVMValueRef FnRef)
Obtain the number of basic blocks in a function.
Definition Core.cpp:2912
LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C, LLVMValueRef FnRef, const char *Name)
Append a basic block to the end of a function.
Definition Core.cpp:2976
LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val)
Determine whether an LLVMValueRef is itself a basic block.
Definition Core.cpp:2892
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:1967
LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1873
LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1890
LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1973
LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1962
LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1901
LLVMValueRef LLVMConstGEPWithNoWrapFlags(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices, LLVMGEPNoWrapFlags NoWrapFlags)
Creates a constant GetElementPtr expression.
Definition Core.cpp:1933
LLVMOpcode LLVMGetConstOpcode(LLVMValueRef ConstantVal)
Definition Core.cpp:1840
LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, LLVMValueRef IndexConstant)
Definition Core.cpp:1985
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:1979
LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant, LLVMValueRef ElementValueConstant, LLVMValueRef IndexConstant)
Definition Core.cpp:1991
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:1999
LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1947
LLVMValueRef LLVMConstGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
Definition Core.cpp:1912
LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB)
Definition Core.cpp:2017
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:1952
LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1957
LLVMValueRef LLVMConstInBoundsGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
Definition Core.cpp:1922
LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString, const char *Constraints, LLVMBool HasSideEffects, LLVMBool IsAlignStack)
Deprecated: Use LLVMGetInlineAsm instead.
Definition Core.cpp:2009
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:2021
LLVMBasicBlockRef LLVMGetBlockAddressBasicBlock(LLVMValueRef BlockAddr)
Gets the basic block associated with a given BlockAddress constant value.
Definition Core.cpp:2025
LLVMUnnamedAddr LLVMGetUnnamedAddress(LLVMValueRef Global)
Definition Core.cpp:2163
LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global)
Returns the "value type" of a global value.
Definition Core.cpp:2198
unsigned LLVMGetAlignment(LLVMValueRef V)
Obtain the preferred alignment of the value.
Definition Core.cpp:2204
void LLVMSetSection(LLVMValueRef Global, const char *Section)
Definition Core.cpp:2139
void LLVMSetUnnamedAddress(LLVMValueRef Global, LLVMUnnamedAddr UnnamedAddr)
Definition Core.cpp:2175
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:2279
void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage)
Definition Core.cpp:2068
void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr)
Deprecated: Use LLVMSetUnnamedAddress instead.
Definition Core.cpp:2192
LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global)
Definition Core.cpp:2031
unsigned LLVMValueMetadataEntriesGetKind(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the kind of a value metadata entry at a specific index.
Definition Core.cpp:2260
void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class)
Definition Core.cpp:2158
LLVMVisibility LLVMGetVisibility(LLVMValueRef Global)
Definition Core.cpp:2143
LLVMValueMetadataEntry * LLVMGlobalCopyAllMetadata(LLVMValueRef Value, size_t *NumEntries)
Retrieves an array of metadata entries representing the metadata attached to this value.
Definition Core.cpp:2248
void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes)
Set the preferred alignment of the value.
Definition Core.cpp:2226
const char * LLVMGetSection(LLVMValueRef Global)
Definition Core.cpp:2133
void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz)
Definition Core.cpp:2148
LLVMLinkage LLVMGetLinkage(LLVMValueRef Global)
Definition Core.cpp:2039
void LLVMGlobalEraseMetadata(LLVMValueRef Global, unsigned Kind)
Erases a metadata attachment of the given kind if it exists.
Definition Core.cpp:2289
LLVMDLLStorageClass LLVMGetDLLStorageClass(LLVMValueRef Global)
Definition Core.cpp:2153
LLVMBool LLVMIsDeclaration(LLVMValueRef Global)
Definition Core.cpp:2035
void LLVMGlobalClearMetadata(LLVMValueRef Global)
Removes all metadata attachments from this value.
Definition Core.cpp:2293
void LLVMGlobalAddMetadata(LLVMValueRef Global, unsigned Kind, LLVMMetadataRef MD)
Adds a metadata attachment.
Definition Core.cpp:2284
LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global)
Deprecated: Use LLVMGetUnnamedAddress instead.
Definition Core.cpp:2188
LLVMMetadataRef LLVMValueMetadataEntriesGetMetadata(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the underlying metadata node of a value metadata entry at a specific index.
Definition Core.cpp:2268
void LLVMDisposeValueMetadataEntries(LLVMValueMetadataEntry *Entries)
Destroys value metadata entries.
Definition Core.cpp:2275
void LLVMGlobalAddDebugInfo(LLVMValueRef Global, LLVMMetadataRef GVE)
Add debuginfo metadata to this global.
Definition Core.cpp:2297
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:2781
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align)
Set the alignment for a function parameter.
Definition Core.cpp:2788
unsigned LLVMCountParams(LLVMValueRef FnRef)
Obtain the number of parameters in a function.
Definition Core.cpp:2736
void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs)
Obtain the parameters in a function.
Definition Core.cpp:2742
LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn)
Obtain the first parameter to a function.
Definition Core.cpp:2757
LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn)
Obtain the last parameter to a function.
Definition Core.cpp:2765
LLVMValueRef LLVMGetParam(LLVMValueRef FnRef, unsigned index)
Obtain the parameter at the specified index.
Definition Core.cpp:2748
LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg)
Obtain the next parameter to a function.
Definition Core.cpp:2773
LLVMValueRef LLVMGetParamParent(LLVMValueRef V)
Obtain the function to which this argument belongs.
Definition Core.cpp:2753
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:2612
void LLVMAddAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Add an attribute to a function.
Definition Core.cpp:2686
LLVMValueRef LLVMGetPrefixData(LLVMValueRef Fn)
Gets the prefix data associated with a function.
Definition Core.cpp:2654
LLVMValueRef LLVMGetPrologueData(LLVMValueRef Fn)
Gets the prologue data associated with a function.
Definition Core.cpp:2670
unsigned LLVMGetIntrinsicID(LLVMValueRef Fn)
Obtain the ID number from a function instance.
Definition Core.cpp:2567
LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn)
Obtain the personality function attached to the function.
Definition Core.cpp:2558
unsigned LLVMGetAttributeCountAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx)
Definition Core.cpp:2691
LLVMBool LLVMHasPersonalityFn(LLVMValueRef Fn)
Check whether the given function has a personality function.
Definition Core.cpp:2554
void LLVMRemoveStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:2722
void LLVMSetPrefixData(LLVMValueRef Fn, LLVMValueRef prefixData)
Sets the prefix data for the function.
Definition Core.cpp:2664
const char * LLVMGetGC(LLVMValueRef Fn)
Obtain the name of the garbage collector to use during code generation.
Definition Core.cpp:2641
char * LLVMIntrinsicCopyOverloadedName(unsigned ID, LLVMTypeRef *OverloadTypes, size_t OverloadCount, size_t *NameLength)
Deprecated: Use LLVMIntrinsicCopyOverloadedName2 instead.
Definition Core.cpp:2602
void LLVMSetGC(LLVMValueRef Fn, const char *GC)
Define the garbage collector to use during code generation.
Definition Core.cpp:2646
void LLVMSetPrologueData(LLVMValueRef Fn, LLVMValueRef prologueData)
Sets the prologue data for the function.
Definition Core.cpp:2680
void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn)
Set the personality function attached to the function.
Definition Core.cpp:2562
void LLVMGetAttributesAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
Definition Core.cpp:2696
unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn)
Obtain the calling function of a function.
Definition Core.cpp:2632
LLVMBool LLVMIntrinsicIsOverloaded(unsigned ID)
Obtain if the intrinsic identified by the given ID is overloaded.
Definition Core.cpp:2627
void LLVMDeleteFunction(LLVMValueRef Fn)
Remove a function from its containing module and deletes it.
Definition Core.cpp:2550
void LLVMRemoveEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:2717
LLVMAttributeRef LLVMGetEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:2703
unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen)
Obtain the intrinsic ID number which matches the given function name.
Definition Core.cpp:2623
const char * LLVMIntrinsicGetName(unsigned ID, size_t *NameLength)
Retrieves the name of an intrinsic.
Definition Core.cpp:2587
LLVMValueRef LLVMGetIntrinsicDeclaration(LLVMModuleRef Mod, unsigned ID, LLVMTypeRef *OverloadTypes, size_t OverloadCount)
Get or insert the declaration of an intrinsic.
Definition Core.cpp:2578
LLVMBool LLVMHasPrologueData(LLVMValueRef Fn)
Check if a given function has prologue data.
Definition Core.cpp:2675
LLVMBool LLVMHasPrefixData(LLVMValueRef Fn)
Check if a given function has prefix data.
Definition Core.cpp:2659
void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC)
Set the calling convention of a function.
Definition Core.cpp:2636
LLVMTypeRef LLVMIntrinsicGetType(LLVMContextRef Ctx, unsigned ID, LLVMTypeRef *OverloadTypes, size_t OverloadCount)
Retrieves the type of an intrinsic.
Definition Core.cpp:2594
void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A, const char *V)
Add a target-dependent attribute to a function.
Definition Core.cpp:2727
LLVMAttributeRef LLVMGetStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:2710
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:2810
LLVMValueRef LLVMGetNamedGlobalIFunc(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalIFunc value from a Module by its name.
Definition Core.cpp:2805
void LLVMRemoveGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module.
Definition Core.cpp:2854
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:2795
LLVMValueRef LLVMGetNextGlobalIFunc(LLVMValueRef IFunc)
Advance a GlobalIFunc iterator to the next GlobalIFunc.
Definition Core.cpp:2826
LLVMValueRef LLVMGetPreviousGlobalIFunc(LLVMValueRef IFunc)
Decrement a GlobalIFunc iterator to the previous GlobalIFunc.
Definition Core.cpp:2834
LLVMValueRef LLVMGetGlobalIFuncResolver(LLVMValueRef IFunc)
Retrieves the resolver function associated with this indirect function, or NULL if it doesn't not exi...
Definition Core.cpp:2842
void LLVMSetGlobalIFuncResolver(LLVMValueRef IFunc, LLVMValueRef Resolver)
Sets the resolver function associated with this indirect function.
Definition Core.cpp:2846
LLVMValueRef LLVMGetLastGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the last GlobalIFunc in a Module.
Definition Core.cpp:2818
void LLVMEraseGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module and delete it.
Definition Core.cpp:2850
LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca)
Obtain the type that is being allocated by the alloca instruction.
Definition Core.cpp:3363
void LLVMSetTailCall(LLVMValueRef Call, LLVMBool isTailCall)
Set whether a call instruction is a tail call.
Definition Core.cpp:3262
void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Definition Core.cpp:3194
unsigned LLVMGetNumOperandBundles(LLVMValueRef C)
Obtain the number of operand bundles attached to this instruction.
Definition Core.cpp:3246
void LLVMRemoveCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:3228
void LLVMRemoveCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:3233
LLVMAttributeRef LLVMGetCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:3214
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr)
Obtain the calling convention for a call instruction.
Definition Core.cpp:3177
LLVMBasicBlockRef LLVMGetCallBrDefaultDest(LLVMValueRef CallBr)
Get the default destination of a CallBr instruction.
Definition Core.cpp:3302
LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr)
Obtain the pointer to the function invoked by this instruction.
Definition Core.cpp:3238
void LLVMSetNormalDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the normal destination basic block.
Definition Core.cpp:3289
LLVMBool LLVMIsTailCall(LLVMValueRef Call)
Obtain whether a call instruction is a tail call.
Definition Core.cpp:3258
LLVMAttributeRef LLVMGetCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:3221
unsigned LLVMGetCallBrNumIndirectDests(LLVMValueRef CallBr)
Get the number of indirect destinations of a CallBr instruction.
Definition Core.cpp:3306
void LLVMGetCallSiteAttributes(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
Definition Core.cpp:3206
LLVMBasicBlockRef LLVMGetNormalDest(LLVMValueRef Invoke)
Return the normal destination basic block.
Definition Core.cpp:3276
unsigned LLVMGetNumArgOperands(LLVMValueRef Instr)
Obtain the argument count for a call instruction.
Definition Core.cpp:3168
void LLVMSetTailCallKind(LLVMValueRef Call, LLVMTailCallKind kind)
Set the call kind of the call instruction.
Definition Core.cpp:3270
LLVMOperandBundleRef LLVMGetOperandBundleAtIndex(LLVMValueRef C, unsigned Index)
Obtain the operand bundle attached to this instruction at the given index.
Definition Core.cpp:3250
LLVMBasicBlockRef LLVMGetCallBrIndirectDest(LLVMValueRef CallBr, unsigned Idx)
Get the indirect destination of a CallBr instruction at the given index.
Definition Core.cpp:3310
LLVMTailCallKind LLVMGetTailCallKind(LLVMValueRef Call)
Obtain a tail call kind of the call instruction.
Definition Core.cpp:3266
void LLVMSetUnwindDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the unwind destination basic block.
Definition Core.cpp:3293
LLVMTypeRef LLVMGetCalledFunctionType(LLVMValueRef Instr)
Obtain the function type called by this instruction.
Definition Core.cpp:3242
LLVMBasicBlockRef LLVMGetUnwindDest(LLVMValueRef Invoke)
Return the unwind destination basic block.
Definition Core.cpp:3280
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, LLVMAttributeIndex Idx, unsigned align)
Definition Core.cpp:3186
unsigned LLVMGetCallSiteAttributeCount(LLVMValueRef C, LLVMAttributeIndex Idx)
Definition Core.cpp:3199
void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC)
Set the calling convention for a call instruction.
Definition Core.cpp:3181
LLVMGEPNoWrapFlags LLVMGEPGetNoWrapFlags(LLVMValueRef GEP)
Get the no-wrap related flags for the given GEP instruction.
Definition Core.cpp:3381
LLVMBool LLVMIsInBounds(LLVMValueRef GEP)
Check whether the given GEP operator is inbounds.
Definition Core.cpp:3369
void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds)
Set the given GEP instruction to be inbounds or not.
Definition Core.cpp:3373
LLVMTypeRef LLVMGetGEPSourceElementType(LLVMValueRef GEP)
Get the source element type of the given GEP operator.
Definition Core.cpp:3377
void LLVMGEPSetNoWrapFlags(LLVMValueRef GEP, LLVMGEPNoWrapFlags NoWrapFlags)
Set the no-wrap related flags for the given GEP instruction.
Definition Core.cpp:3386
unsigned LLVMGetNumIndices(LLVMValueRef Inst)
Obtain the number of indices.
Definition Core.cpp:3414
const unsigned * LLVMGetIndices(LLVMValueRef Inst)
Obtain the indices as an array.
Definition Core.cpp:3426
LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
Definition Core.cpp:3408
LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMValueRef.
Definition Core.cpp:3404
void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues, LLVMBasicBlockRef *IncomingBlocks, unsigned Count)
Add an incoming value to the end of a PHI list.
Definition Core.cpp:3393
unsigned LLVMCountIncoming(LLVMValueRef PhiNode)
Obtain the number of incoming basic blocks to a PHI node.
Definition Core.cpp:3400
LLVMValueRef LLVMGetCondition(LLVMValueRef Branch)
Return the condition of a branch instruction.
Definition Core.cpp:3334
LLVMBasicBlockRef LLVMGetSuccessor(LLVMValueRef Term, unsigned i)
Return the specified successor.
Definition Core.cpp:3320
void LLVMSetCondition(LLVMValueRef Branch, LLVMValueRef Cond)
Set the condition of a branch instruction.
Definition Core.cpp:3338
void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block)
Update the specified successor to point at the provided block.
Definition Core.cpp:3324
LLVMValueRef LLVMGetSwitchCaseValue(LLVMValueRef Switch, unsigned i)
Obtain the case value for a successor of a switch instruction.
Definition Core.cpp:3348
LLVMBool LLVMIsConditional(LLVMValueRef Branch)
Return if an instruction is a conditional branch.
Definition Core.cpp:3330
LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef Switch)
Obtain the default destination basic block of a switch instruction.
Definition Core.cpp:3344
void LLVMSetSwitchCaseValue(LLVMValueRef Switch, unsigned i, LLVMValueRef CaseValue)
Set the case value for a successor of a switch instruction.
Definition Core.cpp:3354
unsigned LLVMGetNumSuccessors(LLVMValueRef Term)
Return the number of successors that this terminator has.
Definition Core.cpp:3316
LLVMRealPredicate LLVMGetFCmpPredicate(LLVMValueRef Inst)
Obtain the float predicate of an instruction.
Definition Core.cpp:3078
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:3052
LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst)
Obtain the instruction that occurred before this one.
Definition Core.cpp:3044
LLVMDbgRecordRef LLVMGetPreviousDbgRecord(LLVMDbgRecordRef Rec)
Obtain the previous DbgRecord in the sequence or NULL if there are no more.
Definition Core.cpp:3129
LLVMMetadataRef LLVMDbgVariableRecordGetExpression(LLVMDbgRecordRef Rec)
Get the debug info expression of the DbgVariableRecord.
Definition Core.cpp:3164
LLVMDbgRecordRef LLVMGetFirstDbgRecord(LLVMValueRef Inst)
Obtain the first debug record attached to an instruction.
Definition Core.cpp:3101
LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst)
Obtain the code opcode for an individual instruction.
Definition Core.cpp:3084
LLVMDbgRecordRef LLVMGetNextDbgRecord(LLVMDbgRecordRef Rec)
Obtain the next DbgRecord in the sequence or NULL if there are no more.
Definition Core.cpp:3121
LLVMDbgRecordRef LLVMGetLastDbgRecord(LLVMValueRef Inst)
Obtain the last debug record attached to an instruction.
Definition Core.cpp:3111
LLVMMetadataRef LLVMDbgVariableRecordGetVariable(LLVMDbgRecordRef Rec)
Get the debug info variable of the DbgVariableRecord.
Definition Core.cpp:3160
LLVMValueRef LLVMIsATerminatorInst(LLVMValueRef Inst)
Determine whether an instruction is a terminator.
Definition Core.cpp:3096
LLVMValueRef LLVMDbgVariableRecordGetValue(LLVMDbgRecordRef Rec, unsigned OpIdx)
Get the value of the DbgVariableRecord.
Definition Core.cpp:3155
LLVMDbgRecordKind LLVMDbgRecordGetKind(LLVMDbgRecordRef Rec)
Definition Core.cpp:3141
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:3060
LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst)
Obtain the basic block to which an instruction belongs.
Definition Core.cpp:3016
LLVMMetadataRef LLVMDbgRecordGetDebugLoc(LLVMDbgRecordRef Rec)
Get the debug location attached to the debug record.
Definition Core.cpp:3137
LLVMBool LLVMGetICmpSameSign(LLVMValueRef Inst)
Get whether or not an icmp instruction has the samesign flag.
Definition Core.cpp:3070
LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst)
Create a copy of 'this' instruction that is identical in all ways except the following:
Definition Core.cpp:3090
void LLVMInstructionEraseFromParent(LLVMValueRef Inst)
Remove and delete an instruction.
Definition Core.cpp:3056
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:3064
LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst)
Obtain the instruction that occurs after the one specified.
Definition Core.cpp:3036
void LLVMSetICmpSameSign(LLVMValueRef Inst, LLVMBool SameSign)
Set the samesign flag on an icmp instruction.
Definition Core.cpp:3074
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:2034
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
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:2440
LLVMValueRef LLVMGetLastGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the last GlobalAlias in a Module.
Definition Core.cpp:2461
LLVMValueRef LLVMGetPreviousGlobalAlias(LLVMValueRef GA)
Decrement a GlobalAlias iterator to the previous GlobalAlias.
Definition Core.cpp:2477
void LLVMAliasSetAliasee(LLVMValueRef Alias, LLVMValueRef Aliasee)
Set the target value of an alias.
Definition Core.cpp:2489
LLVMValueRef LLVMGetFirstGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the first GlobalAlias in a Module.
Definition Core.cpp:2453
LLVMValueRef LLVMAliasGetAliasee(LLVMValueRef Alias)
Retrieve the target value of an alias.
Definition Core.cpp:2485
LLVMValueRef LLVMGetNamedGlobalAlias(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalAlias value from a Module by its name.
Definition Core.cpp:2448
LLVMValueRef LLVMGetNextGlobalAlias(LLVMValueRef GA)
Advance a GlobalAlias iterator to the next GlobalAlias.
Definition Core.cpp:2469
LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar)
Definition Core.cpp:2375
LLVMThreadLocalMode LLVMGetThreadLocalMode(LLVMValueRef GlobalVar)
Definition Core.cpp:2391
LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar)
Definition Core.cpp:2383
LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2351
void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal)
Definition Core.cpp:2379
LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar)
Definition Core.cpp:2430
LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M)
Definition Core.cpp:2335
LLVMValueRef LLVMGetNamedGlobalWithLength(LLVMModuleRef M, const char *Name, size_t Length)
Definition Core.cpp:2322
LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M)
Definition Core.cpp:2327
void LLVMSetThreadLocalMode(LLVMValueRef GlobalVar, LLVMThreadLocalMode Mode)
Definition Core.cpp:2408
LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2343
void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit)
Definition Core.cpp:2434
LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name)
Definition Core.cpp:2318
LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name, unsigned AddressSpace)
Definition Core.cpp:2309
void LLVMDeleteGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2359
void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant)
Definition Core.cpp:2387
LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:2304
LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar)
Definition Core.cpp:2363
void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal)
Definition Core.cpp:2370
#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