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