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
1847
1851
1853 return wrap(ConstantExpr::getNeg(unwrap<Constant>(ConstantVal)));
1854}
1855
1859
1863
1864
1866 return wrap(ConstantExpr::getNot(unwrap<Constant>(ConstantVal)));
1867}
1868
1870 return wrap(ConstantExpr::getAdd(unwrap<Constant>(LHSConstant),
1871 unwrap<Constant>(RHSConstant)));
1872}
1873
1875 LLVMValueRef RHSConstant) {
1876 return wrap(ConstantExpr::getNSWAdd(unwrap<Constant>(LHSConstant),
1877 unwrap<Constant>(RHSConstant)));
1878}
1879
1881 LLVMValueRef RHSConstant) {
1882 return wrap(ConstantExpr::getNUWAdd(unwrap<Constant>(LHSConstant),
1883 unwrap<Constant>(RHSConstant)));
1884}
1885
1887 return wrap(ConstantExpr::getSub(unwrap<Constant>(LHSConstant),
1888 unwrap<Constant>(RHSConstant)));
1889}
1890
1892 LLVMValueRef RHSConstant) {
1893 return wrap(ConstantExpr::getNSWSub(unwrap<Constant>(LHSConstant),
1894 unwrap<Constant>(RHSConstant)));
1895}
1896
1898 LLVMValueRef RHSConstant) {
1899 return wrap(ConstantExpr::getNUWSub(unwrap<Constant>(LHSConstant),
1900 unwrap<Constant>(RHSConstant)));
1901}
1902
1904 return wrap(ConstantExpr::getXor(unwrap<Constant>(LHSConstant),
1905 unwrap<Constant>(RHSConstant)));
1906}
1907
1909 LLVMValueRef *ConstantIndices, unsigned NumIndices) {
1910 ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1911 NumIndices);
1912 Constant *Val = unwrap<Constant>(ConstantVal);
1913 return wrap(ConstantExpr::getGetElementPtr(unwrap(Ty), Val, IdxList));
1914}
1915
1917 LLVMValueRef *ConstantIndices,
1918 unsigned NumIndices) {
1919 ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1920 NumIndices);
1921 Constant *Val = unwrap<Constant>(ConstantVal);
1922 return wrap(ConstantExpr::getInBoundsGetElementPtr(unwrap(Ty), Val, IdxList));
1923}
1924
1926 LLVMValueRef ConstantVal,
1927 LLVMValueRef *ConstantIndices,
1928 unsigned NumIndices,
1929 LLVMGEPNoWrapFlags NoWrapFlags) {
1930 ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1931 NumIndices);
1932 Constant *Val = unwrap<Constant>(ConstantVal);
1934 unwrap(Ty), Val, IdxList, mapFromLLVMGEPNoWrapFlags(NoWrapFlags)));
1935}
1936
1938 return wrap(ConstantExpr::getTrunc(unwrap<Constant>(ConstantVal),
1939 unwrap(ToType)));
1940}
1941
1944 unwrap(ToType)));
1945}
1946
1949 unwrap(ToType)));
1950}
1951
1954 unwrap(ToType)));
1955}
1956
1958 LLVMTypeRef ToType) {
1960 unwrap(ToType)));
1961}
1962
1964 LLVMTypeRef ToType) {
1966 unwrap(ToType)));
1967}
1968
1970 LLVMTypeRef ToType) {
1972 unwrap(ToType)));
1973}
1974
1976 LLVMValueRef IndexConstant) {
1978 unwrap<Constant>(IndexConstant)));
1979}
1980
1982 LLVMValueRef ElementValueConstant,
1983 LLVMValueRef IndexConstant) {
1985 unwrap<Constant>(ElementValueConstant),
1986 unwrap<Constant>(IndexConstant)));
1987}
1988
1990 LLVMValueRef VectorBConstant,
1991 LLVMValueRef MaskConstant) {
1992 SmallVector<int, 16> IntMask;
1995 unwrap<Constant>(VectorBConstant),
1996 IntMask));
1997}
1998
2000 const char *Constraints,
2001 LLVMBool HasSideEffects,
2002 LLVMBool IsAlignStack) {
2003 return wrap(InlineAsm::get(dyn_cast<FunctionType>(unwrap(Ty)), AsmString,
2004 Constraints, HasSideEffects, IsAlignStack));
2005}
2006
2010
2014
2016 return wrap(unwrap<BlockAddress>(BlockAddr)->getBasicBlock());
2017}
2018
2019/*--.. Operations on global variables, functions, and aliases (globals) ....--*/
2020
2024
2028
2057
2060
2061 switch (Linkage) {
2064 break;
2067 break;
2070 break;
2073 break;
2075 LLVM_DEBUG(
2076 errs() << "LLVMSetLinkage(): LLVMLinkOnceODRAutoHideLinkage is no "
2077 "longer supported.");
2078 break;
2079 case LLVMWeakAnyLinkage:
2081 break;
2082 case LLVMWeakODRLinkage:
2084 break;
2087 break;
2090 break;
2091 case LLVMPrivateLinkage:
2093 break;
2096 break;
2099 break;
2101 LLVM_DEBUG(
2102 errs()
2103 << "LLVMSetLinkage(): LLVMDLLImportLinkage is no longer supported.");
2104 break;
2106 LLVM_DEBUG(
2107 errs()
2108 << "LLVMSetLinkage(): LLVMDLLExportLinkage is no longer supported.");
2109 break;
2112 break;
2113 case LLVMGhostLinkage:
2114 LLVM_DEBUG(
2115 errs() << "LLVMSetLinkage(): LLVMGhostLinkage is no longer supported.");
2116 break;
2117 case LLVMCommonLinkage:
2119 break;
2120 }
2121}
2122
2124 // Using .data() is safe because of how GlobalObject::setSection is
2125 // implemented.
2126 return unwrap<GlobalValue>(Global)->getSection().data();
2127}
2128
2129void LLVMSetSection(LLVMValueRef Global, const char *Section) {
2130 unwrap<GlobalObject>(Global)->setSection(Section);
2131}
2132
2134 return static_cast<LLVMVisibility>(
2135 unwrap<GlobalValue>(Global)->getVisibility());
2136}
2137
2140 ->setVisibility(static_cast<GlobalValue::VisibilityTypes>(Viz));
2141}
2142
2144 return static_cast<LLVMDLLStorageClass>(
2145 unwrap<GlobalValue>(Global)->getDLLStorageClass());
2146}
2147
2149 unwrap<GlobalValue>(Global)->setDLLStorageClass(
2150 static_cast<GlobalValue::DLLStorageClassTypes>(Class));
2151}
2152
2164
2177
2179 return unwrap<GlobalValue>(Global)->hasGlobalUnnamedAddr();
2180}
2181
2183 unwrap<GlobalValue>(Global)->setUnnamedAddr(
2184 HasUnnamedAddr ? GlobalValue::UnnamedAddr::Global
2186}
2187
2191
2192/*--.. Operations on global variables, load and store instructions .........--*/
2193
2195 Value *P = unwrap(V);
2197 return GV->getAlign() ? GV->getAlign()->value() : 0;
2199 return F->getAlign() ? F->getAlign()->value() : 0;
2201 return AI->getAlign().value();
2202 if (LoadInst *LI = dyn_cast<LoadInst>(P))
2203 return LI->getAlign().value();
2205 return SI->getAlign().value();
2207 return RMWI->getAlign().value();
2209 return CXI->getAlign().value();
2210
2212 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, "
2213 "and AtomicCmpXchgInst have alignment");
2214}
2215
2216void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes) {
2217 Value *P = unwrap(V);
2219 GV->setAlignment(MaybeAlign(Bytes));
2220 else if (Function *F = dyn_cast<Function>(P))
2221 F->setAlignment(MaybeAlign(Bytes));
2222 else if (AllocaInst *AI = dyn_cast<AllocaInst>(P))
2223 AI->setAlignment(Align(Bytes));
2224 else if (LoadInst *LI = dyn_cast<LoadInst>(P))
2225 LI->setAlignment(Align(Bytes));
2226 else if (StoreInst *SI = dyn_cast<StoreInst>(P))
2227 SI->setAlignment(Align(Bytes));
2228 else if (AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(P))
2229 RMWI->setAlignment(Align(Bytes));
2231 CXI->setAlignment(Align(Bytes));
2232 else
2234 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, and "
2235 "and AtomicCmpXchgInst have alignment");
2236}
2237
2239 size_t *NumEntries) {
2240 return llvm_getMetadata(NumEntries, [&Value](MetadataEntries &Entries) {
2241 Entries.clear();
2243 Instr->getAllMetadata(Entries);
2244 } else {
2245 unwrap<GlobalObject>(Value)->getAllMetadata(Entries);
2246 }
2247 });
2248}
2249
2251 unsigned Index) {
2253 static_cast<LLVMOpaqueValueMetadataEntry>(Entries[Index]);
2254 return MVE.Kind;
2255}
2256
2259 unsigned Index) {
2261 static_cast<LLVMOpaqueValueMetadataEntry>(Entries[Index]);
2262 return MVE.Metadata;
2263}
2264
2266 free(Entries);
2267}
2268
2270 LLVMMetadataRef MD) {
2271 unwrap<GlobalObject>(Global)->setMetadata(Kind, unwrap<MDNode>(MD));
2272}
2273
2275 LLVMMetadataRef MD) {
2276 unwrap<GlobalObject>(Global)->addMetadata(Kind, *unwrap<MDNode>(MD));
2277}
2278
2280 unwrap<GlobalObject>(Global)->eraseMetadata(Kind);
2281}
2282
2286
2291
2292/*--.. Operations on global variables ......................................--*/
2293
2295 return wrap(new GlobalVariable(*unwrap(M), unwrap(Ty), false,
2296 GlobalValue::ExternalLinkage, nullptr, Name));
2297}
2298
2300 const char *Name,
2301 unsigned AddressSpace) {
2302 return wrap(new GlobalVariable(*unwrap(M), unwrap(Ty), false,
2303 GlobalValue::ExternalLinkage, nullptr, Name,
2305 AddressSpace));
2306}
2307
2309 return wrap(unwrap(M)->getNamedGlobal(Name));
2310}
2311
2313 size_t Length) {
2314 return wrap(unwrap(M)->getNamedGlobal(StringRef(Name, Length)));
2315}
2316
2318 Module *Mod = unwrap(M);
2319 Module::global_iterator I = Mod->global_begin();
2320 if (I == Mod->global_end())
2321 return nullptr;
2322 return wrap(&*I);
2323}
2324
2326 Module *Mod = unwrap(M);
2327 Module::global_iterator I = Mod->global_end();
2328 if (I == Mod->global_begin())
2329 return nullptr;
2330 return wrap(&*--I);
2331}
2332
2334 GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2336 if (++I == GV->getParent()->global_end())
2337 return nullptr;
2338 return wrap(&*I);
2339}
2340
2342 GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2344 if (I == GV->getParent()->global_begin())
2345 return nullptr;
2346 return wrap(&*--I);
2347}
2348
2350 unwrap<GlobalVariable>(GlobalVar)->eraseFromParent();
2351}
2352
2354 GlobalVariable* GV = unwrap<GlobalVariable>(GlobalVar);
2355 if ( !GV->hasInitializer() )
2356 return nullptr;
2357 return wrap(GV->getInitializer());
2358}
2359
2360void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal) {
2361 unwrap<GlobalVariable>(GlobalVar)->setInitializer(
2362 ConstantVal ? unwrap<Constant>(ConstantVal) : nullptr);
2363}
2364
2366 return unwrap<GlobalVariable>(GlobalVar)->isThreadLocal();
2367}
2368
2369void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal) {
2370 unwrap<GlobalVariable>(GlobalVar)->setThreadLocal(IsThreadLocal != 0);
2371}
2372
2374 return unwrap<GlobalVariable>(GlobalVar)->isConstant();
2375}
2376
2377void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant) {
2378 unwrap<GlobalVariable>(GlobalVar)->setConstant(IsConstant != 0);
2379}
2380
2382 switch (unwrap<GlobalVariable>(GlobalVar)->getThreadLocalMode()) {
2384 return LLVMNotThreadLocal;
2392 return LLVMLocalExecTLSModel;
2393 }
2394
2395 llvm_unreachable("Invalid GlobalVariable thread local mode");
2396}
2397
2419
2421 return unwrap<GlobalVariable>(GlobalVar)->isExternallyInitialized();
2422}
2423
2425 unwrap<GlobalVariable>(GlobalVar)->setExternallyInitialized(IsExtInit);
2426}
2427
2428/*--.. Operations on aliases ......................................--*/
2429
2431 unsigned AddrSpace, LLVMValueRef Aliasee,
2432 const char *Name) {
2433 return wrap(GlobalAlias::create(unwrap(ValueTy), AddrSpace,
2435 unwrap<Constant>(Aliasee), unwrap(M)));
2436}
2437
2439 const char *Name, size_t NameLen) {
2440 return wrap(unwrap(M)->getNamedAlias(StringRef(Name, NameLen)));
2441}
2442
2444 Module *Mod = unwrap(M);
2445 Module::alias_iterator I = Mod->alias_begin();
2446 if (I == Mod->alias_end())
2447 return nullptr;
2448 return wrap(&*I);
2449}
2450
2452 Module *Mod = unwrap(M);
2453 Module::alias_iterator I = Mod->alias_end();
2454 if (I == Mod->alias_begin())
2455 return nullptr;
2456 return wrap(&*--I);
2457}
2458
2460 GlobalAlias *Alias = unwrap<GlobalAlias>(GA);
2462 if (++I == Alias->getParent()->alias_end())
2463 return nullptr;
2464 return wrap(&*I);
2465}
2466
2468 GlobalAlias *Alias = unwrap<GlobalAlias>(GA);
2470 if (I == Alias->getParent()->alias_begin())
2471 return nullptr;
2472 return wrap(&*--I);
2473}
2474
2476 return wrap(unwrap<GlobalAlias>(Alias)->getAliasee());
2477}
2478
2480 unwrap<GlobalAlias>(Alias)->setAliasee(unwrap<Constant>(Aliasee));
2481}
2482
2483/*--.. Operations on functions .............................................--*/
2484
2486 LLVMTypeRef FunctionTy) {
2487 return wrap(Function::Create(unwrap<FunctionType>(FunctionTy),
2489}
2490
2492 size_t NameLen, LLVMTypeRef FunctionTy) {
2493 return wrap(unwrap(M)
2494 ->getOrInsertFunction(StringRef(Name, NameLen),
2495 unwrap<FunctionType>(FunctionTy))
2496 .getCallee());
2497}
2498
2500 return wrap(unwrap(M)->getFunction(Name));
2501}
2502
2504 size_t Length) {
2505 return wrap(unwrap(M)->getFunction(StringRef(Name, Length)));
2506}
2507
2509 Module *Mod = unwrap(M);
2510 Module::iterator I = Mod->begin();
2511 if (I == Mod->end())
2512 return nullptr;
2513 return wrap(&*I);
2514}
2515
2517 Module *Mod = unwrap(M);
2518 Module::iterator I = Mod->end();
2519 if (I == Mod->begin())
2520 return nullptr;
2521 return wrap(&*--I);
2522}
2523
2525 Function *Func = unwrap<Function>(Fn);
2526 Module::iterator I(Func);
2527 if (++I == Func->getParent()->end())
2528 return nullptr;
2529 return wrap(&*I);
2530}
2531
2533 Function *Func = unwrap<Function>(Fn);
2534 Module::iterator I(Func);
2535 if (I == Func->getParent()->begin())
2536 return nullptr;
2537 return wrap(&*--I);
2538}
2539
2541 unwrap<Function>(Fn)->eraseFromParent();
2542}
2543
2545 return unwrap<Function>(Fn)->hasPersonalityFn();
2546}
2547
2549 return wrap(unwrap<Function>(Fn)->getPersonalityFn());
2550}
2551
2553 unwrap<Function>(Fn)->setPersonalityFn(
2554 PersonalityFn ? unwrap<Constant>(PersonalityFn) : nullptr);
2555}
2556
2558 if (Function *F = dyn_cast<Function>(unwrap(Fn)))
2559 return F->getIntrinsicID();
2560 return 0;
2561}
2562
2564 assert(ID < llvm::Intrinsic::num_intrinsics && "Intrinsic ID out of range");
2565 return llvm::Intrinsic::ID(ID);
2566}
2567
2569 LLVMTypeRef *OverloadTypes,
2570 size_t OverloadCount) {
2571 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2572 auto IID = llvm_map_to_intrinsic_id(ID);
2573 return wrap(
2575}
2576
2577const char *LLVMIntrinsicGetName(unsigned ID, size_t *NameLength) {
2578 auto IID = llvm_map_to_intrinsic_id(ID);
2579 auto Str = llvm::Intrinsic::getName(IID);
2580 *NameLength = Str.size();
2581 return Str.data();
2582}
2583
2585 LLVMTypeRef *OverloadTypes,
2586 size_t OverloadCount) {
2587 auto IID = llvm_map_to_intrinsic_id(ID);
2588 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2589 return wrap(llvm::Intrinsic::getType(*unwrap(Ctx), IID, OverloadTys));
2590}
2591
2592char *LLVMIntrinsicCopyOverloadedName(unsigned ID, LLVMTypeRef *OverloadTypes,
2593 size_t OverloadCount,
2594 size_t *NameLength) {
2595 auto IID = llvm_map_to_intrinsic_id(ID);
2596 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2597 auto Str = llvm::Intrinsic::getNameNoUnnamedTypes(IID, OverloadTys);
2598 *NameLength = Str.length();
2599 return strdup(Str.c_str());
2600}
2601
2603 LLVMTypeRef *OverloadTypes,
2604 size_t OverloadCount,
2605 size_t *NameLength) {
2606 auto IID = llvm_map_to_intrinsic_id(ID);
2607 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2608 auto Str = llvm::Intrinsic::getName(IID, OverloadTys, unwrap(Mod));
2609 *NameLength = Str.length();
2610 return strdup(Str.c_str());
2611}
2612
2613unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen) {
2614 return Intrinsic::lookupIntrinsicID({Name, NameLen});
2615}
2616
2618 auto IID = llvm_map_to_intrinsic_id(ID);
2620}
2621
2623 return unwrap<Function>(Fn)->getCallingConv();
2624}
2625
2627 return unwrap<Function>(Fn)->setCallingConv(
2628 static_cast<CallingConv::ID>(CC));
2629}
2630
2631const char *LLVMGetGC(LLVMValueRef Fn) {
2633 return F->hasGC()? F->getGC().c_str() : nullptr;
2634}
2635
2636void LLVMSetGC(LLVMValueRef Fn, const char *GC) {
2638 if (GC)
2639 F->setGC(GC);
2640 else
2641 F->clearGC();
2642}
2643
2646 return wrap(F->getPrefixData());
2647}
2648
2651 return F->hasPrefixData();
2652}
2653
2656 Constant *prefix = unwrap<Constant>(prefixData);
2657 F->setPrefixData(prefix);
2658}
2659
2662 return wrap(F->getPrologueData());
2663}
2664
2667 return F->hasPrologueData();
2668}
2669
2672 Constant *prologue = unwrap<Constant>(prologueData);
2673 F->setPrologueData(prologue);
2674}
2675
2678 unwrap<Function>(F)->addAttributeAtIndex(Idx, unwrap(A));
2679}
2680
2682 auto AS = unwrap<Function>(F)->getAttributes().getAttributes(Idx);
2683 return AS.getNumAttributes();
2684}
2685
2687 LLVMAttributeRef *Attrs) {
2688 auto AS = unwrap<Function>(F)->getAttributes().getAttributes(Idx);
2689 for (auto A : AS)
2690 *Attrs++ = wrap(A);
2691}
2692
2695 unsigned KindID) {
2696 return wrap(unwrap<Function>(F)->getAttributeAtIndex(
2697 Idx, (Attribute::AttrKind)KindID));
2698}
2699
2702 const char *K, unsigned KLen) {
2703 return wrap(
2704 unwrap<Function>(F)->getAttributeAtIndex(Idx, StringRef(K, KLen)));
2705}
2706
2708 unsigned KindID) {
2709 unwrap<Function>(F)->removeAttributeAtIndex(Idx, (Attribute::AttrKind)KindID);
2710}
2711
2713 const char *K, unsigned KLen) {
2714 unwrap<Function>(F)->removeAttributeAtIndex(Idx, StringRef(K, KLen));
2715}
2716
2718 const char *V) {
2719 Function *Func = unwrap<Function>(Fn);
2720 Attribute Attr = Attribute::get(Func->getContext(), A, V);
2721 Func->addFnAttr(Attr);
2722}
2723
2724/*--.. Operations on parameters ............................................--*/
2725
2727 // This function is strictly redundant to
2728 // LLVMCountParamTypes(LLVMGlobalGetValueType(FnRef))
2729 return unwrap<Function>(FnRef)->arg_size();
2730}
2731
2732void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs) {
2733 Function *Fn = unwrap<Function>(FnRef);
2734 for (Argument &A : Fn->args())
2735 *ParamRefs++ = wrap(&A);
2736}
2737
2739 Function *Fn = unwrap<Function>(FnRef);
2740 return wrap(&Fn->arg_begin()[index]);
2741}
2742
2746
2748 Function *Func = unwrap<Function>(Fn);
2749 Function::arg_iterator I = Func->arg_begin();
2750 if (I == Func->arg_end())
2751 return nullptr;
2752 return wrap(&*I);
2753}
2754
2756 Function *Func = unwrap<Function>(Fn);
2757 Function::arg_iterator I = Func->arg_end();
2758 if (I == Func->arg_begin())
2759 return nullptr;
2760 return wrap(&*--I);
2761}
2762
2764 Argument *A = unwrap<Argument>(Arg);
2765 Function *Fn = A->getParent();
2766 if (A->getArgNo() + 1 >= Fn->arg_size())
2767 return nullptr;
2768 return wrap(&Fn->arg_begin()[A->getArgNo() + 1]);
2769}
2770
2772 Argument *A = unwrap<Argument>(Arg);
2773 if (A->getArgNo() == 0)
2774 return nullptr;
2775 return wrap(&A->getParent()->arg_begin()[A->getArgNo() - 1]);
2776}
2777
2779 Argument *A = unwrap<Argument>(Arg);
2780 A->addAttr(Attribute::getWithAlignment(A->getContext(), Align(align)));
2781}
2782
2783/*--.. Operations on ifuncs ................................................--*/
2784
2786 const char *Name, size_t NameLen,
2787 LLVMTypeRef Ty, unsigned AddrSpace,
2789 return wrap(GlobalIFunc::create(unwrap(Ty), AddrSpace,
2791 StringRef(Name, NameLen),
2793}
2794
2796 const char *Name, size_t NameLen) {
2797 return wrap(unwrap(M)->getNamedIFunc(StringRef(Name, NameLen)));
2798}
2799
2801 Module *Mod = unwrap(M);
2802 Module::ifunc_iterator I = Mod->ifunc_begin();
2803 if (I == Mod->ifunc_end())
2804 return nullptr;
2805 return wrap(&*I);
2806}
2807
2809 Module *Mod = unwrap(M);
2810 Module::ifunc_iterator I = Mod->ifunc_end();
2811 if (I == Mod->ifunc_begin())
2812 return nullptr;
2813 return wrap(&*--I);
2814}
2815
2817 GlobalIFunc *GIF = unwrap<GlobalIFunc>(IFunc);
2819 if (++I == GIF->getParent()->ifunc_end())
2820 return nullptr;
2821 return wrap(&*I);
2822}
2823
2825 GlobalIFunc *GIF = unwrap<GlobalIFunc>(IFunc);
2827 if (I == GIF->getParent()->ifunc_begin())
2828 return nullptr;
2829 return wrap(&*--I);
2830}
2831
2833 return wrap(unwrap<GlobalIFunc>(IFunc)->getResolver());
2834}
2835
2839
2841 unwrap<GlobalIFunc>(IFunc)->eraseFromParent();
2842}
2843
2845 unwrap<GlobalIFunc>(IFunc)->removeFromParent();
2846}
2847
2848/*--.. Operations on operand bundles........................................--*/
2849
2850LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, size_t TagLen,
2851 LLVMValueRef *Args,
2852 unsigned NumArgs) {
2853 return wrap(new OperandBundleDef(std::string(Tag, TagLen),
2854 ArrayRef(unwrap(Args), NumArgs)));
2855}
2856
2858 delete unwrap(Bundle);
2859}
2860
2861const char *LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len) {
2862 StringRef Str = unwrap(Bundle)->getTag();
2863 *Len = Str.size();
2864 return Str.data();
2865}
2866
2868 return unwrap(Bundle)->inputs().size();
2869}
2870
2872 unsigned Index) {
2873 return wrap(unwrap(Bundle)->inputs()[Index]);
2874}
2875
2876/*--.. Operations on basic blocks ..........................................--*/
2877
2879 return wrap(static_cast<Value*>(unwrap(BB)));
2880}
2881
2885
2889
2891 return unwrap(BB)->getName().data();
2892}
2893
2897
2899 return wrap(unwrap(BB)->getTerminatorOrNull());
2900}
2901
2903 return unwrap<Function>(FnRef)->size();
2904}
2905
2907 Function *Fn = unwrap<Function>(FnRef);
2908 for (BasicBlock &BB : *Fn)
2909 *BasicBlocksRefs++ = wrap(&BB);
2910}
2911
2913 return wrap(&unwrap<Function>(Fn)->getEntryBlock());
2914}
2915
2917 Function *Func = unwrap<Function>(Fn);
2918 Function::iterator I = Func->begin();
2919 if (I == Func->end())
2920 return nullptr;
2921 return wrap(&*I);
2922}
2923
2925 Function *Func = unwrap<Function>(Fn);
2926 Function::iterator I = Func->end();
2927 if (I == Func->begin())
2928 return nullptr;
2929 return wrap(&*--I);
2930}
2931
2933 BasicBlock *Block = unwrap(BB);
2935 if (++I == Block->getParent()->end())
2936 return nullptr;
2937 return wrap(&*I);
2938}
2939
2941 BasicBlock *Block = unwrap(BB);
2943 if (I == Block->getParent()->begin())
2944 return nullptr;
2945 return wrap(&*--I);
2946}
2947
2952
2954 LLVMBasicBlockRef BB) {
2955 BasicBlock *ToInsert = unwrap(BB);
2956 BasicBlock *CurBB = unwrap(Builder)->GetInsertBlock();
2957 assert(CurBB && "current insertion point is invalid!");
2958 CurBB->getParent()->insert(std::next(CurBB->getIterator()), ToInsert);
2959}
2960
2962 LLVMBasicBlockRef BB) {
2963 unwrap<Function>(Fn)->insert(unwrap<Function>(Fn)->end(), unwrap(BB));
2964}
2965
2967 LLVMValueRef FnRef,
2968 const char *Name) {
2969 return wrap(BasicBlock::Create(*unwrap(C), Name, unwrap<Function>(FnRef)));
2970}
2971
2975
2977 LLVMBasicBlockRef BBRef,
2978 const char *Name) {
2979 BasicBlock *BB = unwrap(BBRef);
2980 return wrap(BasicBlock::Create(*unwrap(C), Name, BB->getParent(), BB));
2981}
2982
2987
2989 unwrap(BBRef)->eraseFromParent();
2990}
2991
2993 unwrap(BBRef)->removeFromParent();
2994}
2995
2997 unwrap(BB)->moveBefore(unwrap(MovePos));
2998}
2999
3001 unwrap(BB)->moveAfter(unwrap(MovePos));
3002}
3003
3004/*--.. Operations on instructions ..........................................--*/
3005
3009
3011 BasicBlock *Block = unwrap(BB);
3012 BasicBlock::iterator I = Block->begin();
3013 if (I == Block->end())
3014 return nullptr;
3015 return wrap(&*I);
3016}
3017
3019 BasicBlock *Block = unwrap(BB);
3020 BasicBlock::iterator I = Block->end();
3021 if (I == Block->begin())
3022 return nullptr;
3023 return wrap(&*--I);
3024}
3025
3027 Instruction *Instr = unwrap<Instruction>(Inst);
3028 BasicBlock::iterator I(Instr);
3029 if (++I == Instr->getParent()->end())
3030 return nullptr;
3031 return wrap(&*I);
3032}
3033
3035 Instruction *Instr = unwrap<Instruction>(Inst);
3036 BasicBlock::iterator I(Instr);
3037 if (I == Instr->getParent()->begin())
3038 return nullptr;
3039 return wrap(&*--I);
3040}
3041
3043 unwrap<Instruction>(Inst)->removeFromParent();
3044}
3045
3047 unwrap<Instruction>(Inst)->eraseFromParent();
3048}
3049
3051 unwrap<Instruction>(Inst)->deleteValue();
3052}
3053
3055 if (ICmpInst *I = dyn_cast<ICmpInst>(unwrap(Inst)))
3056 return (LLVMIntPredicate)I->getPredicate();
3057 return (LLVMIntPredicate)0;
3058}
3059
3061 return unwrap<ICmpInst>(Inst)->hasSameSign();
3062}
3063
3065 unwrap<ICmpInst>(Inst)->setSameSign(SameSign);
3066}
3067
3069 if (FCmpInst *I = dyn_cast<FCmpInst>(unwrap(Inst)))
3070 return (LLVMRealPredicate)I->getPredicate();
3071 return (LLVMRealPredicate)0;
3072}
3073
3076 return map_to_llvmopcode(C->getOpcode());
3077 return (LLVMOpcode)0;
3078}
3079
3082 return wrap(C->clone());
3083 return nullptr;
3084}
3085
3088 return (I && I->isTerminator()) ? wrap(I) : nullptr;
3089}
3090
3092 Instruction *Instr = unwrap<Instruction>(Inst);
3093 if (!Instr->DebugMarker)
3094 return nullptr;
3095 auto I = Instr->DebugMarker->StoredDbgRecords.begin();
3096 if (I == Instr->DebugMarker->StoredDbgRecords.end())
3097 return nullptr;
3098 return wrap(&*I);
3099}
3100
3102 Instruction *Instr = unwrap<Instruction>(Inst);
3103 if (!Instr->DebugMarker)
3104 return nullptr;
3105 auto I = Instr->DebugMarker->StoredDbgRecords.rbegin();
3106 if (I == Instr->DebugMarker->StoredDbgRecords.rend())
3107 return nullptr;
3108 return wrap(&*I);
3109}
3110
3114 if (++I == Record->getInstruction()->DebugMarker->StoredDbgRecords.end())
3115 return nullptr;
3116 return wrap(&*I);
3117}
3118
3122 if (I == Record->getInstruction()->DebugMarker->StoredDbgRecords.begin())
3123 return nullptr;
3124 return wrap(&*--I);
3125}
3126
3130
3134 return LLVMDbgRecordLabel;
3136 assert(VariableRecord && "unexpected record");
3137 if (VariableRecord->isDbgDeclare())
3138 return LLVMDbgRecordDeclare;
3139 if (VariableRecord->isDbgValue())
3140 return LLVMDbgRecordValue;
3141 assert(VariableRecord->isDbgAssign() && "unexpected record");
3142 return LLVMDbgRecordAssign;
3143}
3144
3146 unsigned OpIdx) {
3147 return wrap(unwrap<DbgVariableRecord>(Rec)->getValue(OpIdx));
3148}
3149
3153
3157
3159 if (FuncletPadInst *FPI = dyn_cast<FuncletPadInst>(unwrap(Instr))) {
3160 return FPI->arg_size();
3161 }
3162 return unwrap<CallBase>(Instr)->arg_size();
3163}
3164
3165/*--.. Call and invoke instructions ........................................--*/
3166
3168 return unwrap<CallBase>(Instr)->getCallingConv();
3169}
3170
3172 return unwrap<CallBase>(Instr)->setCallingConv(
3173 static_cast<CallingConv::ID>(CC));
3174}
3175
3177 unsigned align) {
3178 auto *Call = unwrap<CallBase>(Instr);
3179 Attribute AlignAttr =
3181 Call->addAttributeAtIndex(Idx, AlignAttr);
3182}
3183
3186 unwrap<CallBase>(C)->addAttributeAtIndex(Idx, unwrap(A));
3187}
3188
3190 LLVMAttributeIndex Idx) {
3191 auto *Call = unwrap<CallBase>(C);
3192 auto AS = Call->getAttributes().getAttributes(Idx);
3193 return AS.getNumAttributes();
3194}
3195
3197 LLVMAttributeRef *Attrs) {
3198 auto *Call = unwrap<CallBase>(C);
3199 auto AS = Call->getAttributes().getAttributes(Idx);
3200 for (auto A : AS)
3201 *Attrs++ = wrap(A);
3202}
3203
3206 unsigned KindID) {
3207 return wrap(unwrap<CallBase>(C)->getAttributeAtIndex(
3208 Idx, (Attribute::AttrKind)KindID));
3209}
3210
3213 const char *K, unsigned KLen) {
3214 return wrap(
3215 unwrap<CallBase>(C)->getAttributeAtIndex(Idx, StringRef(K, KLen)));
3216}
3217
3219 unsigned KindID) {
3220 unwrap<CallBase>(C)->removeAttributeAtIndex(Idx, (Attribute::AttrKind)KindID);
3221}
3222
3224 const char *K, unsigned KLen) {
3225 unwrap<CallBase>(C)->removeAttributeAtIndex(Idx, StringRef(K, KLen));
3226}
3227
3229 return wrap(unwrap<CallBase>(Instr)->getCalledOperand());
3230}
3231
3233 return wrap(unwrap<CallBase>(Instr)->getFunctionType());
3234}
3235
3237 return unwrap<CallBase>(C)->getNumOperandBundles();
3238}
3239
3241 unsigned Index) {
3242 return wrap(
3243 new OperandBundleDef(unwrap<CallBase>(C)->getOperandBundleAt(Index)));
3244}
3245
3246/*--.. Operations on call instructions (only) ..............................--*/
3247
3249 return unwrap<CallInst>(Call)->isTailCall();
3250}
3251
3253 unwrap<CallInst>(Call)->setTailCall(isTailCall);
3254}
3255
3259
3263
3264/*--.. Operations on invoke instructions (only) ............................--*/
3265
3267 return wrap(unwrap<InvokeInst>(Invoke)->getNormalDest());
3268}
3269
3272 return wrap(CRI->getUnwindDest());
3273 } else if (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {
3274 return wrap(CSI->getUnwindDest());
3275 }
3276 return wrap(unwrap<InvokeInst>(Invoke)->getUnwindDest());
3277}
3278
3280 unwrap<InvokeInst>(Invoke)->setNormalDest(unwrap(B));
3281}
3282
3285 return CRI->setUnwindDest(unwrap(B));
3286 } else if (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {
3287 return CSI->setUnwindDest(unwrap(B));
3288 }
3289 unwrap<InvokeInst>(Invoke)->setUnwindDest(unwrap(B));
3290}
3291
3293 return wrap(unwrap<CallBrInst>(CallBr)->getDefaultDest());
3294}
3295
3297 return unwrap<CallBrInst>(CallBr)->getNumIndirectDests();
3298}
3299
3301 return wrap(unwrap<CallBrInst>(CallBr)->getIndirectDest(Idx));
3302}
3303
3304/*--.. Operations on terminators ...........................................--*/
3305
3307 return unwrap<Instruction>(Term)->getNumSuccessors();
3308}
3309
3311 return wrap(unwrap<Instruction>(Term)->getSuccessor(i));
3312}
3313
3315 return unwrap<Instruction>(Term)->setSuccessor(i, unwrap(block));
3316}
3317
3318/*--.. Operations on branch instructions (only) ............................--*/
3319
3323
3327
3329 return unwrap<CondBrInst>(Branch)->setCondition(unwrap(Cond));
3330}
3331
3332/*--.. Operations on switch instructions (only) ............................--*/
3333
3335 return wrap(unwrap<SwitchInst>(Switch)->getDefaultDest());
3336}
3337
3339 assert(i > 0 && i <= unwrap<SwitchInst>(Switch)->getNumCases());
3340 auto It = unwrap<SwitchInst>(Switch)->case_begin() + (i - 1);
3341 return wrap(It->getCaseValue());
3342}
3343
3344void LLVMSetSwitchCaseValue(LLVMValueRef Switch, unsigned i,
3345 LLVMValueRef CaseValue) {
3346 assert(i > 0 && i <= unwrap<SwitchInst>(Switch)->getNumCases());
3347 auto It = unwrap<SwitchInst>(Switch)->case_begin() + (i - 1);
3348 It->setValue(unwrap<ConstantInt>(CaseValue));
3349}
3350
3351/*--.. Operations on alloca instructions (only) ............................--*/
3352
3354 return wrap(unwrap<AllocaInst>(Alloca)->getAllocatedType());
3355}
3356
3357/*--.. Operations on gep instructions (only) ...............................--*/
3358
3360 return unwrap<GEPOperator>(GEP)->isInBounds();
3361}
3362
3364 return unwrap<GetElementPtrInst>(GEP)->setIsInBounds(InBounds);
3365}
3366
3370
3375
3380
3381/*--.. Operations on phi nodes .............................................--*/
3382
3383void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
3384 LLVMBasicBlockRef *IncomingBlocks, unsigned Count) {
3385 PHINode *PhiVal = unwrap<PHINode>(PhiNode);
3386 for (unsigned I = 0; I != Count; ++I)
3387 PhiVal->addIncoming(unwrap(IncomingValues[I]), unwrap(IncomingBlocks[I]));
3388}
3389
3391 return unwrap<PHINode>(PhiNode)->getNumIncomingValues();
3392}
3393
3395 return wrap(unwrap<PHINode>(PhiNode)->getIncomingValue(Index));
3396}
3397
3399 return wrap(unwrap<PHINode>(PhiNode)->getIncomingBlock(Index));
3400}
3401
3402/*--.. Operations on extractvalue and insertvalue nodes ....................--*/
3403
3405 auto *I = unwrap(Inst);
3406 if (auto *GEP = dyn_cast<GEPOperator>(I))
3407 return GEP->getNumIndices();
3408 if (auto *EV = dyn_cast<ExtractValueInst>(I))
3409 return EV->getNumIndices();
3410 if (auto *IV = dyn_cast<InsertValueInst>(I))
3411 return IV->getNumIndices();
3413 "LLVMGetNumIndices applies only to extractvalue and insertvalue!");
3414}
3415
3416const unsigned *LLVMGetIndices(LLVMValueRef Inst) {
3417 auto *I = unwrap(Inst);
3418 if (auto *EV = dyn_cast<ExtractValueInst>(I))
3419 return EV->getIndices().data();
3420 if (auto *IV = dyn_cast<InsertValueInst>(I))
3421 return IV->getIndices().data();
3423 "LLVMGetIndices applies only to extractvalue and insertvalue!");
3424}
3425
3426
3427/*===-- Instruction builders ----------------------------------------------===*/
3428
3432
3436
3438 Instruction *Instr, bool BeforeDbgRecords) {
3439 BasicBlock::iterator I = Instr ? Instr->getIterator() : Block->end();
3440 I.setHeadBit(BeforeDbgRecords);
3441 Builder->SetInsertPoint(Block, I);
3442}
3443
3445 LLVMValueRef Instr) {
3446 return LLVMPositionBuilderImpl(unwrap(Builder), unwrap(Block),
3447 unwrap<Instruction>(Instr), false);
3448}
3449
3456
3459 return LLVMPositionBuilderImpl(unwrap(Builder), I->getParent(), I, false);
3460}
3461
3463 LLVMValueRef Instr) {
3465 return LLVMPositionBuilderImpl(unwrap(Builder), I->getParent(), I, true);
3466}
3467
3469 BasicBlock *BB = unwrap(Block);
3470 unwrap(Builder)->SetInsertPoint(BB);
3471}
3472
3474 return wrap(unwrap(Builder)->GetInsertBlock());
3475}
3476
3478 unwrap(Builder)->ClearInsertionPoint();
3479}
3480
3482 unwrap(Builder)->Insert(unwrap<Instruction>(Instr));
3483}
3484
3486 const char *Name) {
3487 unwrap(Builder)->Insert(unwrap<Instruction>(Instr), Name);
3488}
3489
3491 delete unwrap(Builder);
3492}
3493
3494/*--.. Metadata builders ...................................................--*/
3495
3497 return wrap(unwrap(Builder)->getCurrentDebugLocation().getAsMDNode());
3498}
3499
3501 if (Loc)
3502 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(unwrap<DILocation>(Loc)));
3503 else
3504 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc());
3505}
3506
3508 DILocation *Loc =
3509 L ? cast<DILocation>(unwrap<MetadataAsValue>(L)->getMetadata()) : nullptr;
3510 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(Loc));
3511}
3512
3514 LLVMContext &Context = unwrap(Builder)->getContext();
3516 Context, unwrap(Builder)->getCurrentDebugLocation().getAsMDNode()));
3517}
3518
3520 unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
3521}
3522
3524 unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
3525}
3526
3528 LLVMMetadataRef FPMathTag) {
3529
3530 unwrap(Builder)->setDefaultFPMathTag(FPMathTag
3531 ? unwrap<MDNode>(FPMathTag)
3532 : nullptr);
3533}
3534
3536 return wrap(&unwrap(Builder)->getContext());
3537}
3538
3540 return wrap(unwrap(Builder)->getDefaultFPMathTag());
3541}
3542
3543/*--.. Instruction builders ................................................--*/
3544
3546 return wrap(unwrap(B)->CreateRetVoid());
3547}
3548
3550 return wrap(unwrap(B)->CreateRet(unwrap(V)));
3551}
3552
3554 unsigned N) {
3555 return wrap(unwrap(B)->CreateAggregateRet({unwrap(RetVals), N}));
3556}
3557
3559 return wrap(unwrap(B)->CreateBr(unwrap(Dest)));
3560}
3561
3564 return wrap(unwrap(B)->CreateCondBr(unwrap(If), unwrap(Then), unwrap(Else)));
3565}
3566
3568 LLVMBasicBlockRef Else, unsigned NumCases) {
3569 return wrap(unwrap(B)->CreateSwitch(unwrap(V), unwrap(Else), NumCases));
3570}
3571
3573 unsigned NumDests) {
3574 return wrap(unwrap(B)->CreateIndirectBr(unwrap(Addr), NumDests));
3575}
3576
3578 LLVMBasicBlockRef DefaultDest,
3579 LLVMBasicBlockRef *IndirectDests,
3580 unsigned NumIndirectDests, LLVMValueRef *Args,
3581 unsigned NumArgs, LLVMOperandBundleRef *Bundles,
3582 unsigned NumBundles, const char *Name) {
3583
3585 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
3586 OperandBundleDef *OB = unwrap(Bundle);
3587 OBs.push_back(*OB);
3588 }
3589
3590 return wrap(unwrap(B)->CreateCallBr(
3591 unwrap<FunctionType>(Ty), unwrap(Fn), unwrap(DefaultDest),
3592 ArrayRef(unwrap(IndirectDests), NumIndirectDests),
3593 ArrayRef<Value *>(unwrap(Args), NumArgs), OBs, Name));
3594}
3595
3597 LLVMValueRef *Args, unsigned NumArgs,
3599 const char *Name) {
3600 return wrap(unwrap(B)->CreateInvoke(unwrap<FunctionType>(Ty), unwrap(Fn),
3601 unwrap(Then), unwrap(Catch),
3602 ArrayRef(unwrap(Args), NumArgs), Name));
3603}
3604
3607 unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
3608 LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name) {
3610 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
3611 OperandBundleDef *OB = unwrap(Bundle);
3612 OBs.push_back(*OB);
3613 }
3614 return wrap(unwrap(B)->CreateInvoke(
3615 unwrap<FunctionType>(Ty), unwrap(Fn), unwrap(Then), unwrap(Catch),
3616 ArrayRef(unwrap(Args), NumArgs), OBs, Name));
3617}
3618
3620 LLVMValueRef PersFn, unsigned NumClauses,
3621 const char *Name) {
3622 // The personality used to live on the landingpad instruction, but now it
3623 // lives on the parent function. For compatibility, take the provided
3624 // personality and put it on the parent function.
3625 if (PersFn)
3626 unwrap(B)->GetInsertBlock()->getParent()->setPersonalityFn(
3627 unwrap<Function>(PersFn));
3628 return wrap(unwrap(B)->CreateLandingPad(unwrap(Ty), NumClauses, Name));
3629}
3630
3632 LLVMValueRef *Args, unsigned NumArgs,
3633 const char *Name) {
3634 return wrap(unwrap(B)->CreateCatchPad(unwrap(ParentPad),
3635 ArrayRef(unwrap(Args), NumArgs), Name));
3636}
3637
3639 LLVMValueRef *Args, unsigned NumArgs,
3640 const char *Name) {
3641 if (ParentPad == nullptr) {
3643 ParentPad = wrap(Constant::getNullValue(Ty));
3644 }
3645 return wrap(unwrap(B)->CreateCleanupPad(
3646 unwrap(ParentPad), ArrayRef(unwrap(Args), NumArgs), Name));
3647}
3648
3650 return wrap(unwrap(B)->CreateResume(unwrap(Exn)));
3651}
3652
3654 LLVMBasicBlockRef UnwindBB,
3655 unsigned NumHandlers, const char *Name) {
3656 if (ParentPad == nullptr) {
3658 ParentPad = wrap(Constant::getNullValue(Ty));
3659 }
3660 return wrap(unwrap(B)->CreateCatchSwitch(unwrap(ParentPad), unwrap(UnwindBB),
3661 NumHandlers, Name));
3662}
3663
3665 LLVMBasicBlockRef BB) {
3666 return wrap(unwrap(B)->CreateCatchRet(unwrap<CatchPadInst>(CatchPad),
3667 unwrap(BB)));
3668}
3669
3671 LLVMBasicBlockRef BB) {
3672 return wrap(unwrap(B)->CreateCleanupRet(unwrap<CleanupPadInst>(CatchPad),
3673 unwrap(BB)));
3674}
3675
3677 return wrap(unwrap(B)->CreateUnreachable());
3678}
3679
3681 LLVMBasicBlockRef Dest) {
3682 unwrap<SwitchInst>(Switch)->addCase(unwrap<ConstantInt>(OnVal), unwrap(Dest));
3683}
3684
3686 unwrap<IndirectBrInst>(IndirectBr)->addDestination(unwrap(Dest));
3687}
3688
3689unsigned LLVMGetNumClauses(LLVMValueRef LandingPad) {
3690 return unwrap<LandingPadInst>(LandingPad)->getNumClauses();
3691}
3692
3693LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx) {
3694 return wrap(unwrap<LandingPadInst>(LandingPad)->getClause(Idx));
3695}
3696
3697void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal) {
3698 unwrap<LandingPadInst>(LandingPad)->addClause(unwrap<Constant>(ClauseVal));
3699}
3700
3702 return unwrap<LandingPadInst>(LandingPad)->isCleanup();
3703}
3704
3705void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val) {
3706 unwrap<LandingPadInst>(LandingPad)->setCleanup(Val);
3707}
3708
3710 unwrap<CatchSwitchInst>(CatchSwitch)->addHandler(unwrap(Dest));
3711}
3712
3713unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch) {
3714 return unwrap<CatchSwitchInst>(CatchSwitch)->getNumHandlers();
3715}
3716
3717void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers) {
3718 CatchSwitchInst *CSI = unwrap<CatchSwitchInst>(CatchSwitch);
3719 for (const BasicBlock *H : CSI->handlers())
3720 *Handlers++ = wrap(H);
3721}
3722
3724 return wrap(unwrap<CatchPadInst>(CatchPad)->getCatchSwitch());
3725}
3726
3728 unwrap<CatchPadInst>(CatchPad)
3729 ->setCatchSwitch(unwrap<CatchSwitchInst>(CatchSwitch));
3730}
3731
3732/*--.. Funclets ...........................................................--*/
3733
3735 return wrap(unwrap<FuncletPadInst>(Funclet)->getArgOperand(i));
3736}
3737
3738void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value) {
3739 unwrap<FuncletPadInst>(Funclet)->setArgOperand(i, unwrap(value));
3740}
3741
3742/*--.. Arithmetic ..........................................................--*/
3743
3745 FastMathFlags NewFMF;
3746 NewFMF.setAllowReassoc((FMF & LLVMFastMathAllowReassoc) != 0);
3747 NewFMF.setNoNaNs((FMF & LLVMFastMathNoNaNs) != 0);
3748 NewFMF.setNoInfs((FMF & LLVMFastMathNoInfs) != 0);
3749 NewFMF.setNoSignedZeros((FMF & LLVMFastMathNoSignedZeros) != 0);
3751 NewFMF.setAllowContract((FMF & LLVMFastMathAllowContract) != 0);
3752 NewFMF.setApproxFunc((FMF & LLVMFastMathApproxFunc) != 0);
3753
3754 return NewFMF;
3755}
3756
3759 if (FMF.allowReassoc())
3760 NewFMF |= LLVMFastMathAllowReassoc;
3761 if (FMF.noNaNs())
3762 NewFMF |= LLVMFastMathNoNaNs;
3763 if (FMF.noInfs())
3764 NewFMF |= LLVMFastMathNoInfs;
3765 if (FMF.noSignedZeros())
3766 NewFMF |= LLVMFastMathNoSignedZeros;
3767 if (FMF.allowReciprocal())
3769 if (FMF.allowContract())
3770 NewFMF |= LLVMFastMathAllowContract;
3771 if (FMF.approxFunc())
3772 NewFMF |= LLVMFastMathApproxFunc;
3773
3774 return NewFMF;
3775}
3776
3778 const char *Name) {
3779 return wrap(unwrap(B)->CreateAdd(unwrap(LHS), unwrap(RHS), Name));
3780}
3781
3783 const char *Name) {
3784 return wrap(unwrap(B)->CreateNSWAdd(unwrap(LHS), unwrap(RHS), Name));
3785}
3786
3788 const char *Name) {
3789 return wrap(unwrap(B)->CreateNUWAdd(unwrap(LHS), unwrap(RHS), Name));
3790}
3791
3793 const char *Name) {
3794 return wrap(unwrap(B)->CreateFAdd(unwrap(LHS), unwrap(RHS), Name));
3795}
3796
3798 const char *Name) {
3799 return wrap(unwrap(B)->CreateSub(unwrap(LHS), unwrap(RHS), Name));
3800}
3801
3803 const char *Name) {
3804 return wrap(unwrap(B)->CreateNSWSub(unwrap(LHS), unwrap(RHS), Name));
3805}
3806
3808 const char *Name) {
3809 return wrap(unwrap(B)->CreateNUWSub(unwrap(LHS), unwrap(RHS), Name));
3810}
3811
3813 const char *Name) {
3814 return wrap(unwrap(B)->CreateFSub(unwrap(LHS), unwrap(RHS), Name));
3815}
3816
3818 const char *Name) {
3819 return wrap(unwrap(B)->CreateMul(unwrap(LHS), unwrap(RHS), Name));
3820}
3821
3823 const char *Name) {
3824 return wrap(unwrap(B)->CreateNSWMul(unwrap(LHS), unwrap(RHS), Name));
3825}
3826
3828 const char *Name) {
3829 return wrap(unwrap(B)->CreateNUWMul(unwrap(LHS), unwrap(RHS), Name));
3830}
3831
3833 const char *Name) {
3834 return wrap(unwrap(B)->CreateFMul(unwrap(LHS), unwrap(RHS), Name));
3835}
3836
3838 const char *Name) {
3839 return wrap(unwrap(B)->CreateUDiv(unwrap(LHS), unwrap(RHS), Name));
3840}
3841
3843 LLVMValueRef RHS, const char *Name) {
3844 return wrap(unwrap(B)->CreateExactUDiv(unwrap(LHS), unwrap(RHS), Name));
3845}
3846
3848 const char *Name) {
3849 return wrap(unwrap(B)->CreateSDiv(unwrap(LHS), unwrap(RHS), Name));
3850}
3851
3853 LLVMValueRef RHS, const char *Name) {
3854 return wrap(unwrap(B)->CreateExactSDiv(unwrap(LHS), unwrap(RHS), Name));
3855}
3856
3858 const char *Name) {
3859 return wrap(unwrap(B)->CreateFDiv(unwrap(LHS), unwrap(RHS), Name));
3860}
3861
3863 const char *Name) {
3864 return wrap(unwrap(B)->CreateURem(unwrap(LHS), unwrap(RHS), Name));
3865}
3866
3868 const char *Name) {
3869 return wrap(unwrap(B)->CreateSRem(unwrap(LHS), unwrap(RHS), Name));
3870}
3871
3873 const char *Name) {
3874 return wrap(unwrap(B)->CreateFRem(unwrap(LHS), unwrap(RHS), Name));
3875}
3876
3878 const char *Name) {
3879 return wrap(unwrap(B)->CreateShl(unwrap(LHS), unwrap(RHS), Name));
3880}
3881
3883 const char *Name) {
3884 return wrap(unwrap(B)->CreateLShr(unwrap(LHS), unwrap(RHS), Name));
3885}
3886
3888 const char *Name) {
3889 return wrap(unwrap(B)->CreateAShr(unwrap(LHS), unwrap(RHS), Name));
3890}
3891
3893 const char *Name) {
3894 return wrap(unwrap(B)->CreateAnd(unwrap(LHS), unwrap(RHS), Name));
3895}
3896
3898 const char *Name) {
3899 return wrap(unwrap(B)->CreateOr(unwrap(LHS), unwrap(RHS), Name));
3900}
3901
3903 const char *Name) {
3904 return wrap(unwrap(B)->CreateXor(unwrap(LHS), unwrap(RHS), Name));
3905}
3906
3913
3915 return wrap(unwrap(B)->CreateNeg(unwrap(V), Name));
3916}
3917
3919 const char *Name) {
3920 return wrap(unwrap(B)->CreateNSWNeg(unwrap(V), Name));
3921}
3922
3924 const char *Name) {
3925 Value *Neg = unwrap(B)->CreateNeg(unwrap(V), Name);
3926 if (auto *I = dyn_cast<BinaryOperator>(Neg))
3927 I->setHasNoUnsignedWrap();
3928 return wrap(Neg);
3929}
3930
3932 return wrap(unwrap(B)->CreateFNeg(unwrap(V), Name));
3933}
3934
3936 return wrap(unwrap(B)->CreateNot(unwrap(V), Name));
3937}
3938
3940 Value *P = unwrap<Value>(ArithInst);
3941 return cast<Instruction>(P)->hasNoUnsignedWrap();
3942}
3943
3944void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW) {
3945 Value *P = unwrap<Value>(ArithInst);
3946 cast<Instruction>(P)->setHasNoUnsignedWrap(HasNUW);
3947}
3948
3950 Value *P = unwrap<Value>(ArithInst);
3951 return cast<Instruction>(P)->hasNoSignedWrap();
3952}
3953
3954void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW) {
3955 Value *P = unwrap<Value>(ArithInst);
3956 cast<Instruction>(P)->setHasNoSignedWrap(HasNSW);
3957}
3958
3960 Value *P = unwrap<Value>(DivOrShrInst);
3961 return cast<Instruction>(P)->isExact();
3962}
3963
3964void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact) {
3965 Value *P = unwrap<Value>(DivOrShrInst);
3966 cast<Instruction>(P)->setIsExact(IsExact);
3967}
3968
3970 Value *P = unwrap<Value>(NonNegInst);
3971 return cast<Instruction>(P)->hasNonNeg();
3972}
3973
3974void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg) {
3975 Value *P = unwrap<Value>(NonNegInst);
3976 cast<Instruction>(P)->setNonNeg(IsNonNeg);
3977}
3978
3980 Value *P = unwrap<Value>(FPMathInst);
3981 FastMathFlags FMF = cast<Instruction>(P)->getFastMathFlags();
3982 return mapToLLVMFastMathFlags(FMF);
3983}
3984
3986 Value *P = unwrap<Value>(FPMathInst);
3987 cast<Instruction>(P)->setFastMathFlags(mapFromLLVMFastMathFlags(FMF));
3988}
3989
3994
3996 Value *P = unwrap<Value>(Inst);
3997 return cast<PossiblyDisjointInst>(P)->isDisjoint();
3998}
3999
4001 Value *P = unwrap<Value>(Inst);
4002 cast<PossiblyDisjointInst>(P)->setIsDisjoint(IsDisjoint);
4003}
4004
4005/*--.. Memory ..............................................................--*/
4006
4008 const char *Name) {
4009 Type* ITy = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext());
4010 Constant* AllocSize = ConstantExpr::getSizeOf(unwrap(Ty));
4011 AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, ITy);
4012 return wrap(unwrap(B)->CreateMalloc(ITy, unwrap(Ty), AllocSize, nullptr,
4013 nullptr, Name));
4014}
4015
4017 LLVMValueRef Val, const char *Name) {
4018 Type* ITy = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext());
4019 Constant* AllocSize = ConstantExpr::getSizeOf(unwrap(Ty));
4020 AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, ITy);
4021 return wrap(unwrap(B)->CreateMalloc(ITy, unwrap(Ty), AllocSize, unwrap(Val),
4022 nullptr, Name));
4023}
4024
4026 LLVMValueRef Val, LLVMValueRef Len,
4027 unsigned Align) {
4028 return wrap(unwrap(B)->CreateMemSet(unwrap(Ptr), unwrap(Val), unwrap(Len),
4029 MaybeAlign(Align)));
4030}
4031
4033 LLVMValueRef Dst, unsigned DstAlign,
4034 LLVMValueRef Src, unsigned SrcAlign,
4036 return wrap(unwrap(B)->CreateMemCpy(unwrap(Dst), MaybeAlign(DstAlign),
4037 unwrap(Src), MaybeAlign(SrcAlign),
4038 unwrap(Size)));
4039}
4040
4042 LLVMValueRef Dst, unsigned DstAlign,
4043 LLVMValueRef Src, unsigned SrcAlign,
4045 return wrap(unwrap(B)->CreateMemMove(unwrap(Dst), MaybeAlign(DstAlign),
4046 unwrap(Src), MaybeAlign(SrcAlign),
4047 unwrap(Size)));
4048}
4049
4051 const char *Name) {
4052 return wrap(unwrap(B)->CreateAlloca(unwrap(Ty), nullptr, Name));
4053}
4054
4056 LLVMValueRef Val, const char *Name) {
4057 return wrap(unwrap(B)->CreateAlloca(unwrap(Ty), unwrap(Val), Name));
4058}
4059
4061 return wrap(unwrap(B)->CreateFree(unwrap(PointerVal)));
4062}
4063
4065 LLVMValueRef PointerVal, const char *Name) {
4066 return wrap(unwrap(B)->CreateLoad(unwrap(Ty), unwrap(PointerVal), Name));
4067}
4068
4070 LLVMValueRef PointerVal) {
4071 return wrap(unwrap(B)->CreateStore(unwrap(Val), unwrap(PointerVal)));
4072}
4073
4089
4105
4107 switch (BinOp) {
4139 }
4140
4141 llvm_unreachable("Invalid LLVMAtomicRMWBinOp value!");
4142}
4143
4145 switch (BinOp) {
4177 default: break;
4178 }
4179
4180 llvm_unreachable("Invalid AtomicRMWBinOp value!");
4181}
4182
4184 LLVMBool isSingleThread, const char *Name) {
4185 return wrap(
4186 unwrap(B)->CreateFence(mapFromLLVMOrdering(Ordering),
4187 isSingleThread ? SyncScope::SingleThread
4189 Name));
4190}
4191
4193 LLVMAtomicOrdering Ordering, unsigned SSID,
4194 const char *Name) {
4195 return wrap(
4196 unwrap(B)->CreateFence(mapFromLLVMOrdering(Ordering), SSID, Name));
4197}
4198
4200 LLVMValueRef Pointer, LLVMValueRef *Indices,
4201 unsigned NumIndices, const char *Name) {
4202 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4203 return wrap(unwrap(B)->CreateGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name));
4204}
4205
4207 LLVMValueRef Pointer, LLVMValueRef *Indices,
4208 unsigned NumIndices, const char *Name) {
4209 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4210 return wrap(
4211 unwrap(B)->CreateInBoundsGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name));
4212}
4213
4215 LLVMValueRef Pointer,
4216 LLVMValueRef *Indices,
4217 unsigned NumIndices, const char *Name,
4218 LLVMGEPNoWrapFlags NoWrapFlags) {
4219 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4220 return wrap(unwrap(B)->CreateGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name,
4221 mapFromLLVMGEPNoWrapFlags(NoWrapFlags)));
4222}
4223
4225 LLVMValueRef Pointer, unsigned Idx,
4226 const char *Name) {
4227 return wrap(
4228 unwrap(B)->CreateStructGEP(unwrap(Ty), unwrap(Pointer), Idx, Name));
4229}
4230
4232 const char *Name) {
4233 return wrap(unwrap(B)->CreateGlobalString(Str, Name));
4234}
4235
4237 const char *Name) {
4238 return wrap(unwrap(B)->CreateGlobalString(Str, Name));
4239}
4240
4242 return cast<Instruction>(unwrap(Inst))->isVolatile();
4243}
4244
4245void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile) {
4246 Value *P = unwrap(MemAccessInst);
4247 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4248 return LI->setVolatile(isVolatile);
4250 return SI->setVolatile(isVolatile);
4252 return AI->setVolatile(isVolatile);
4253 return cast<AtomicCmpXchgInst>(P)->setVolatile(isVolatile);
4254}
4255
4257 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->isWeak();
4258}
4259
4260void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak) {
4261 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->setWeak(isWeak);
4262}
4263
4265 Value *P = unwrap(MemAccessInst);
4267 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4268 O = LI->getOrdering();
4269 else if (StoreInst *SI = dyn_cast<StoreInst>(P))
4270 O = SI->getOrdering();
4271 else if (FenceInst *FI = dyn_cast<FenceInst>(P))
4272 O = FI->getOrdering();
4273 else
4274 O = cast<AtomicRMWInst>(P)->getOrdering();
4275 return mapToLLVMOrdering(O);
4276}
4277
4278void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering) {
4279 Value *P = unwrap(MemAccessInst);
4280 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4281
4282 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4283 return LI->setOrdering(O);
4284 else if (FenceInst *FI = dyn_cast<FenceInst>(P))
4285 return FI->setOrdering(O);
4286 else if (AtomicRMWInst *ARWI = dyn_cast<AtomicRMWInst>(P))
4287 return ARWI->setOrdering(O);
4288 return cast<StoreInst>(P)->setOrdering(O);
4289}
4290
4294
4296 unwrap<AtomicRMWInst>(Inst)->setOperation(mapFromLLVMRMWBinOp(BinOp));
4297}
4298
4299/*--.. Casts ...............................................................--*/
4300
4302 LLVMTypeRef DestTy, const char *Name) {
4303 return wrap(unwrap(B)->CreateTrunc(unwrap(Val), unwrap(DestTy), Name));
4304}
4305
4307 LLVMTypeRef DestTy, const char *Name) {
4308 return wrap(unwrap(B)->CreateZExt(unwrap(Val), unwrap(DestTy), Name));
4309}
4310
4312 LLVMTypeRef DestTy, const char *Name) {
4313 return wrap(unwrap(B)->CreateSExt(unwrap(Val), unwrap(DestTy), Name));
4314}
4315
4317 LLVMTypeRef DestTy, const char *Name) {
4318 return wrap(unwrap(B)->CreateFPToUI(unwrap(Val), unwrap(DestTy), Name));
4319}
4320
4322 LLVMTypeRef DestTy, const char *Name) {
4323 return wrap(unwrap(B)->CreateFPToSI(unwrap(Val), unwrap(DestTy), Name));
4324}
4325
4327 LLVMTypeRef DestTy, const char *Name) {
4328 return wrap(unwrap(B)->CreateUIToFP(unwrap(Val), unwrap(DestTy), Name));
4329}
4330
4332 LLVMTypeRef DestTy, const char *Name) {
4333 return wrap(unwrap(B)->CreateSIToFP(unwrap(Val), unwrap(DestTy), Name));
4334}
4335
4337 LLVMTypeRef DestTy, const char *Name) {
4338 return wrap(unwrap(B)->CreateFPTrunc(unwrap(Val), unwrap(DestTy), Name));
4339}
4340
4342 LLVMTypeRef DestTy, const char *Name) {
4343 return wrap(unwrap(B)->CreateFPExt(unwrap(Val), unwrap(DestTy), Name));
4344}
4345
4347 LLVMTypeRef DestTy, const char *Name) {
4348 return wrap(unwrap(B)->CreatePtrToInt(unwrap(Val), unwrap(DestTy), Name));
4349}
4350
4352 LLVMTypeRef DestTy, const char *Name) {
4353 return wrap(unwrap(B)->CreateIntToPtr(unwrap(Val), unwrap(DestTy), Name));
4354}
4355
4357 LLVMTypeRef DestTy, const char *Name) {
4358 return wrap(unwrap(B)->CreateBitCast(unwrap(Val), unwrap(DestTy), Name));
4359}
4360
4362 LLVMTypeRef DestTy, const char *Name) {
4363 return wrap(unwrap(B)->CreateAddrSpaceCast(unwrap(Val), unwrap(DestTy), Name));
4364}
4365
4367 LLVMTypeRef DestTy, const char *Name) {
4368 return wrap(unwrap(B)->CreateZExtOrBitCast(unwrap(Val), unwrap(DestTy),
4369 Name));
4370}
4371
4373 LLVMTypeRef DestTy, const char *Name) {
4374 return wrap(unwrap(B)->CreateSExtOrBitCast(unwrap(Val), unwrap(DestTy),
4375 Name));
4376}
4377
4379 LLVMTypeRef DestTy, const char *Name) {
4380 return wrap(unwrap(B)->CreateTruncOrBitCast(unwrap(Val), unwrap(DestTy),
4381 Name));
4382}
4383
4385 LLVMTypeRef DestTy, const char *Name) {
4386 return wrap(unwrap(B)->CreateCast(Instruction::CastOps(map_from_llvmopcode(Op)), unwrap(Val),
4387 unwrap(DestTy), Name));
4388}
4389
4391 LLVMTypeRef DestTy, const char *Name) {
4392 return wrap(unwrap(B)->CreatePointerCast(unwrap(Val), unwrap(DestTy), Name));
4393}
4394
4396 LLVMTypeRef DestTy, LLVMBool IsSigned,
4397 const char *Name) {
4398 return wrap(
4399 unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy), IsSigned, Name));
4400}
4401
4403 LLVMTypeRef DestTy, const char *Name) {
4404 return wrap(unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy),
4405 /*isSigned*/true, Name));
4406}
4407
4409 LLVMTypeRef DestTy, const char *Name) {
4410 return wrap(unwrap(B)->CreateFPCast(unwrap(Val), unwrap(DestTy), Name));
4411}
4412
4414 LLVMTypeRef DestTy, LLVMBool DestIsSigned) {
4416 unwrap(Src), SrcIsSigned, unwrap(DestTy), DestIsSigned));
4417}
4418
4419/*--.. Comparisons .........................................................--*/
4420
4423 const char *Name) {
4424 return wrap(unwrap(B)->CreateICmp(static_cast<ICmpInst::Predicate>(Op),
4425 unwrap(LHS), unwrap(RHS), Name));
4426}
4427
4430 const char *Name) {
4431 return wrap(unwrap(B)->CreateFCmp(static_cast<FCmpInst::Predicate>(Op),
4432 unwrap(LHS), unwrap(RHS), Name));
4433}
4434
4435/*--.. Miscellaneous instructions ..........................................--*/
4436
4438 return wrap(unwrap(B)->CreatePHI(unwrap(Ty), 0, Name));
4439}
4440
4442 LLVMValueRef *Args, unsigned NumArgs,
4443 const char *Name) {
4445 return wrap(unwrap(B)->CreateCall(FTy, unwrap(Fn),
4446 ArrayRef(unwrap(Args), NumArgs), Name));
4447}
4448
4451 LLVMValueRef Fn, LLVMValueRef *Args,
4452 unsigned NumArgs, LLVMOperandBundleRef *Bundles,
4453 unsigned NumBundles, const char *Name) {
4456 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
4457 OperandBundleDef *OB = unwrap(Bundle);
4458 OBs.push_back(*OB);
4459 }
4460 return wrap(unwrap(B)->CreateCall(
4461 FTy, unwrap(Fn), ArrayRef(unwrap(Args), NumArgs), OBs, Name));
4462}
4463
4465 LLVMValueRef Then, LLVMValueRef Else,
4466 const char *Name) {
4467 return wrap(unwrap(B)->CreateSelect(unwrap(If), unwrap(Then), unwrap(Else),
4468 Name));
4469}
4470
4472 LLVMTypeRef Ty, const char *Name) {
4473 return wrap(unwrap(B)->CreateVAArg(unwrap(List), unwrap(Ty), Name));
4474}
4475
4477 LLVMValueRef Index, const char *Name) {
4478 return wrap(unwrap(B)->CreateExtractElement(unwrap(VecVal), unwrap(Index),
4479 Name));
4480}
4481
4483 LLVMValueRef EltVal, LLVMValueRef Index,
4484 const char *Name) {
4485 return wrap(unwrap(B)->CreateInsertElement(unwrap(VecVal), unwrap(EltVal),
4486 unwrap(Index), Name));
4487}
4488
4490 LLVMValueRef V2, LLVMValueRef Mask,
4491 const char *Name) {
4492 return wrap(unwrap(B)->CreateShuffleVector(unwrap(V1), unwrap(V2),
4493 unwrap(Mask), Name));
4494}
4495
4497 unsigned Index, const char *Name) {
4498 return wrap(unwrap(B)->CreateExtractValue(unwrap(AggVal), Index, Name));
4499}
4500
4502 LLVMValueRef EltVal, unsigned Index,
4503 const char *Name) {
4504 return wrap(unwrap(B)->CreateInsertValue(unwrap(AggVal), unwrap(EltVal),
4505 Index, Name));
4506}
4507
4509 const char *Name) {
4510 return wrap(unwrap(B)->CreateFreeze(unwrap(Val), Name));
4511}
4512
4514 const char *Name) {
4515 return wrap(unwrap(B)->CreateIsNull(unwrap(Val), Name));
4516}
4517
4519 const char *Name) {
4520 return wrap(unwrap(B)->CreateIsNotNull(unwrap(Val), Name));
4521}
4522
4525 const char *Name) {
4526 IRBuilderBase *Builder = unwrap(B);
4527 Value *Diff =
4528 Builder->CreatePtrDiff(unwrap(ElemTy), unwrap(LHS), unwrap(RHS), Name);
4529 return wrap(Builder->CreateSExtOrTrunc(Diff, Builder->getInt64Ty()));
4530}
4531
4533 LLVMValueRef PTR, LLVMValueRef Val,
4534 LLVMAtomicOrdering ordering,
4535 LLVMBool singleThread) {
4537 return wrap(unwrap(B)->CreateAtomicRMW(
4538 intop, unwrap(PTR), unwrap(Val), MaybeAlign(),
4539 mapFromLLVMOrdering(ordering),
4540 singleThread ? SyncScope::SingleThread : SyncScope::System));
4541}
4542
4545 LLVMValueRef PTR, LLVMValueRef Val,
4546 LLVMAtomicOrdering ordering,
4547 unsigned SSID) {
4549 return wrap(unwrap(B)->CreateAtomicRMW(intop, unwrap(PTR), unwrap(Val),
4550 MaybeAlign(),
4551 mapFromLLVMOrdering(ordering), SSID));
4552}
4553
4555 LLVMValueRef Cmp, LLVMValueRef New,
4556 LLVMAtomicOrdering SuccessOrdering,
4557 LLVMAtomicOrdering FailureOrdering,
4558 LLVMBool singleThread) {
4559
4560 return wrap(unwrap(B)->CreateAtomicCmpXchg(
4561 unwrap(Ptr), unwrap(Cmp), unwrap(New), MaybeAlign(),
4562 mapFromLLVMOrdering(SuccessOrdering),
4563 mapFromLLVMOrdering(FailureOrdering),
4564 singleThread ? SyncScope::SingleThread : SyncScope::System));
4565}
4566
4568 LLVMValueRef Cmp, LLVMValueRef New,
4569 LLVMAtomicOrdering SuccessOrdering,
4570 LLVMAtomicOrdering FailureOrdering,
4571 unsigned SSID) {
4572 return wrap(unwrap(B)->CreateAtomicCmpXchg(
4573 unwrap(Ptr), unwrap(Cmp), unwrap(New), MaybeAlign(),
4574 mapFromLLVMOrdering(SuccessOrdering),
4575 mapFromLLVMOrdering(FailureOrdering), SSID));
4576}
4577
4579 Value *P = unwrap(SVInst);
4581 return I->getShuffleMask().size();
4582}
4583
4584int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt) {
4585 Value *P = unwrap(SVInst);
4587 return I->getMaskValue(Elt);
4588}
4589
4591
4593 return unwrap<Instruction>(Inst)->isAtomic();
4594}
4595
4597 // Backwards compatibility: return false for non-atomic instructions
4598 Instruction *I = unwrap<Instruction>(AtomicInst);
4599 if (!I->isAtomic())
4600 return 0;
4601
4603}
4604
4606 // Backwards compatibility: ignore non-atomic instructions
4607 Instruction *I = unwrap<Instruction>(AtomicInst);
4608 if (!I->isAtomic())
4609 return;
4610
4612 setAtomicSyncScopeID(I, SSID);
4613}
4614
4616 Instruction *I = unwrap<Instruction>(AtomicInst);
4617 assert(I->isAtomic() && "Expected an atomic instruction");
4618 return *getAtomicSyncScopeID(I);
4619}
4620
4621void LLVMSetAtomicSyncScopeID(LLVMValueRef AtomicInst, unsigned SSID) {
4622 Instruction *I = unwrap<Instruction>(AtomicInst);
4623 assert(I->isAtomic() && "Expected an atomic instruction");
4624 setAtomicSyncScopeID(I, SSID);
4625}
4626
4628 Value *P = unwrap(CmpXchgInst);
4629 return mapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getSuccessOrdering());
4630}
4631
4633 LLVMAtomicOrdering Ordering) {
4634 Value *P = unwrap(CmpXchgInst);
4635 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4636
4637 return cast<AtomicCmpXchgInst>(P)->setSuccessOrdering(O);
4638}
4639
4641 Value *P = unwrap(CmpXchgInst);
4642 return mapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getFailureOrdering());
4643}
4644
4646 LLVMAtomicOrdering Ordering) {
4647 Value *P = unwrap(CmpXchgInst);
4648 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4649
4650 return cast<AtomicCmpXchgInst>(P)->setFailureOrdering(O);
4651}
4652
4653/*===-- Module providers --------------------------------------------------===*/
4654
4659
4663
4664
4665/*===-- Memory buffers ----------------------------------------------------===*/
4666
4668 const char *Path,
4669 LLVMMemoryBufferRef *OutMemBuf,
4670 char **OutMessage) {
4671
4673 if (std::error_code EC = MBOrErr.getError()) {
4674 *OutMessage = strdup(EC.message().c_str());
4675 return 1;
4676 }
4677 *OutMemBuf = wrap(MBOrErr.get().release());
4678 return 0;
4679}
4680
4682 char **OutMessage) {
4684 if (std::error_code EC = MBOrErr.getError()) {
4685 *OutMessage = strdup(EC.message().c_str());
4686 return 1;
4687 }
4688 *OutMemBuf = wrap(MBOrErr.get().release());
4689 return 0;
4690}
4691
4693 const char *InputData,
4694 size_t InputDataLength,
4695 const char *BufferName,
4696 LLVMBool RequiresNullTerminator) {
4697
4698 return wrap(MemoryBuffer::getMemBuffer(StringRef(InputData, InputDataLength),
4699 StringRef(BufferName),
4700 RequiresNullTerminator).release());
4701}
4702
4704 const char *InputData,
4705 size_t InputDataLength,
4706 const char *BufferName) {
4707
4708 return wrap(
4709 MemoryBuffer::getMemBufferCopy(StringRef(InputData, InputDataLength),
4710 StringRef(BufferName)).release());
4711}
4712
4714 return unwrap(MemBuf)->getBufferStart();
4715}
4716
4718 return unwrap(MemBuf)->getBufferSize();
4719}
4720
4722 delete unwrap(MemBuf);
4723}
4724
4725/*===-- Pass Manager ------------------------------------------------------===*/
4726
4730
4734
4739
4743
4747
4751
4755
4757 delete unwrap(PM);
4758}
4759
4760/*===-- Threading ------------------------------------------------------===*/
4761
4765
4768
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_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:2972
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
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:3437
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:3757
static FastMathFlags mapFromLLVMFastMathFlags(LLVMFastMathFlags FMF)
Definition Core.cpp:3744
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:4074
static Intrinsic::ID llvm_map_to_intrinsic_id(unsigned ID)
Definition Core.cpp:2563
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:4090
LLVMTypeRef LLVMX86FP80Type(void)
Definition Core.cpp:789
LLVMBasicBlockRef LLVMInsertBasicBlock(LLVMBasicBlockRef BBRef, const char *Name)
Definition Core.cpp:2983
LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3923
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:4144
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:3433
LLVMTypeRef LLVMInt128Type(void)
Definition Core.cpp:739
static AtomicRMWInst::BinOp mapFromLLVMRMWBinOp(LLVMAtomicRMWBinOp BinOp)
Definition Core.cpp:4106
LLVMValueRef LLVMIsABranchInst(LLVMValueRef Val)
Definition Core.cpp:1187
LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal)
Definition Core.cpp:1860
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:6010
LLVM_ABI double convertToDouble() const
Converts this APFloat to host double value.
Definition APFloat.cpp:6069
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:105
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:124
@ EndAttrKinds
Sentinel value useful for loops.
Definition Attributes.h:129
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
InstListType::iterator iterator
Instruction iterators...
Definition BasicBlock.h:170
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:378
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:537
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:1382
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList)
Create an "inbounds" getelementptr.
Definition Constants.h:1507
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:1370
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:1368
static Constant * getNSWSub(Constant *C1, Constant *C2)
Definition Constants.h:1378
static Constant * getNUWAdd(Constant *C1, Constant *C2)
Definition Constants.h:1374
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:1470
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.
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:867
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:2910
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:348
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:563
Metadata node.
Definition Metadata.h:1069
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition Metadata.h:1567
A single uniqued string.
Definition Metadata.h:722
static LLVM_ABI MDString * get(LLVMContext &Context, StringRef Str)
Definition Metadata.cpp:615
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:111
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:1755
LLVM_ABI StringRef getName() const
Module * getParent()
Get the module that holds this named metadata collection.
Definition Metadata.h:1825
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:911
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:2213
static LLVM_ABI ScalableVectorType * get(Type *ElementType, unsigned MinNumElts)
Definition Type.cpp:889
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:477
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:802
static LLVM_ABI StructType * create(LLVMContext &Context, StringRef Name)
This creates an identified struct.
Definition Type.cpp:683
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:960
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:310
static LLVM_ABI Type * getX86_AMXTy(LLVMContext &C)
Definition Type.cpp:293
static LLVM_ABI Type * getMetadataTy(LLVMContext &C)
Definition Type.cpp:288
static LLVM_ABI Type * getTokenTy(LLVMContext &C)
Definition Type.cpp:289
static LLVM_ABI IntegerType * getInt128Ty(LLVMContext &C)
Definition Type.cpp:311
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
Definition Type.cpp:309
static LLVM_ABI Type * getPPC_FP128Ty(LLVMContext &C)
Definition Type.cpp:292
static LLVM_ABI Type * getFP128Ty(LLVMContext &C)
Definition Type.cpp:291
static LLVM_ABI Type * getLabelTy(LLVMContext &C)
Definition Type.cpp:283
@ 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:282
static LLVM_ABI IntegerType * getInt8Ty(LLVMContext &C)
Definition Type.cpp:307
static LLVM_ABI IntegerType * getInt16Ty(LLVMContext &C)
Definition Type.cpp:308
static LLVM_ABI IntegerType * getInt1Ty(LLVMContext &C)
Definition Type.cpp:306
static LLVM_ABI Type * getDoubleTy(LLVMContext &C)
Definition Type.cpp:287
static LLVM_ABI Type * getX86_FP80Ty(LLVMContext &C)
Definition Type.cpp:290
static LLVM_ABI Type * getFloatTy(LLVMContext &C)
Definition Type.cpp:286
static LLVM_ABI Type * getBFloatTy(LLVMContext &C)
Definition Type.cpp:285
static LLVM_ABI Type * getHalfTy(LLVMContext &C)
Definition Type.cpp:284
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:510
LLVM Value Representation.
Definition Value.h:75
Type * getType() const
All values are typed, get the type of this value.
Definition Value.h:255
LLVMContext & getContext() const
All values hold a context through their type.
Definition Value.h:258
use_iterator_impl< Use > use_iterator
Definition Value.h:353
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:3553
LLVMValueRef LLVMBuildMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3817
LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef B)
Definition Core.cpp:3545
LLVMValueRef LLVMBuildSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3797
LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3827
LLVMBool LLVMGetWeak(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4256
LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4384
LLVMValueRef LLVMBuildIsNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4513
LLVMValueRef LLVMBuildGEPWithNoWrapFlags(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name, LLVMGEPNoWrapFlags NoWrapFlags)
Creates a GetElementPtr instruction.
Definition Core.cpp:4214
LLVMValueRef LLVMBuildAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3777
void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak)
Definition Core.cpp:4260
LLVMValueRef LLVMBuildOr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3897
LLVMValueRef LLVMBuildBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4356
LLVMValueRef LLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3842
LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition Core.cpp:4199
LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3802
void LLVMPositionBuilderBeforeInstrAndDbgRecords(LLVMBuilderRef Builder, LLVMValueRef Instr)
Set the builder position before Instr and any attached debug records.
Definition Core.cpp:3462
LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4518
void LLVMDisposeBuilder(LLVMBuilderRef Builder)
Definition Core.cpp:3490
void LLVMClearInsertionPosition(LLVMBuilderRef Builder)
Definition Core.cpp:3477
LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PersFn, unsigned NumClauses, const char *Name)
Definition Core.cpp:3619
void LLVMSetIsDisjoint(LLVMValueRef Inst, LLVMBool IsDisjoint)
Sets the disjoint flag for the instruction.
Definition Core.cpp:4000
LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst)
Definition Core.cpp:4596
LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn)
Definition Core.cpp:3649
void LLVMSetAtomicRMWBinOp(LLVMValueRef Inst, LLVMAtomicRMWBinOp BinOp)
Definition Core.cpp:4295
LLVMValueRef LLVMBuildFDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3857
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:3605
LLVMValueRef LLVMBuildXor(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3902
LLVMBool LLVMGetExact(LLVMValueRef DivOrShrInst)
Definition Core.cpp:3959
LLVMValueRef LLVMBuildAddrSpaceCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4361
unsigned LLVMGetNumMaskElements(LLVMValueRef SVInst)
Get the number of elements in the mask of a ShuffleVector instruction.
Definition Core.cpp:4578
void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr)
Definition Core.cpp:3481
LLVMValueRef LLVMBuildCleanupRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition Core.cpp:3670
LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4321
void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers)
Obtain the basic blocks acting as handlers for a catchswitch instruction.
Definition Core.cpp:3717
LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4301
LLVMValueRef LLVMGetArgOperand(LLVMValueRef Funclet, unsigned i)
Definition Core.cpp:3734
LLVMValueRef LLVMBuildAnd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3892
unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch)
Definition Core.cpp:3713
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:3577
LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder)
Definition Core.cpp:3473
LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3847
LLVMValueRef LLVMBuildSExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4372
LLVMValueRef LLVMBuildCall2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:4441
void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW)
Definition Core.cpp:3954
LLVMMetadataRef LLVMGetCurrentDebugLocation2(LLVMBuilderRef Builder)
Get location information used by debugging information.
Definition Core.cpp:3496
LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3837
LLVMValueRef LLVMBuildSelect(LLVMBuilderRef B, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, const char *Name)
Definition Core.cpp:4464
void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr)
Set the builder position before Instr but after any attached debug records.
Definition Core.cpp:3457
LLVMBool LLVMCanValueUseFastMathFlags(LLVMValueRef V)
Check if a given value can potentially have fast math flags.
Definition Core.cpp:3990
void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value)
Definition Core.cpp:3738
LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef B, LLVMValueRef If, LLVMBasicBlockRef Then, LLVMBasicBlockRef Else)
Definition Core.cpp:3562
LLVMBool LLVMGetNUW(LLVMValueRef ArithInst)
Definition Core.cpp:3939
LLVMOpcode LLVMGetCastOpcode(LLVMValueRef Src, LLVMBool SrcIsSigned, LLVMTypeRef DestTy, LLVMBool DestIsSigned)
Definition Core.cpp:4413
void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr, const char *Name)
Definition Core.cpp:3485
LLVMValueRef LLVMBuildSRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3867
LLVMValueRef LLVMBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:3638
LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Deprecated: This cast is always signed.
Definition Core.cpp:4402
LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder)
Deprecated: Returning the NULL location will crash.
Definition Core.cpp:3513
LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef Index, const char *Name)
Definition Core.cpp:4476
LLVMValueRef LLVMBuildShl(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3877
LLVMBuilderRef LLVMCreateBuilderInContext(LLVMContextRef C)
Definition Core.cpp:3429
LLVMValueRef LLVMBuildCatchRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition Core.cpp:3664
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:4041
LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemAccessInst)
Definition Core.cpp:4264
LLVMValueRef LLVMBuildStructGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, unsigned Idx, const char *Name)
Definition Core.cpp:4224
int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt)
Get the mask value at position Elt in the mask of a ShuffleVector instruction.
Definition Core.cpp:4584
void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal, LLVMBasicBlockRef Dest)
Definition Core.cpp:3680
LLVMValueRef LLVMBuildBr(LLVMBuilderRef B, LLVMBasicBlockRef Dest)
Definition Core.cpp:3558
LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, const char *Name)
Definition Core.cpp:4482
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:3450
void LLVMSetFastMathFlags(LLVMValueRef FPMathInst, LLVMFastMathFlags FMF)
Sets the flags for which fast-math-style optimizations are allowed for this value.
Definition Core.cpp:3985
LLVMValueRef LLVMBuildIntCast2(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, LLVMBool IsSigned, const char *Name)
Definition Core.cpp:4395
LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3807
LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3792
LLVMValueRef LLVMBuildCatchPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:3631
LLVMValueRef LLVMBuildCallWithOperandBundles(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name)
Definition Core.cpp:4450
LLVMBool LLVMIsCleanup(LLVMValueRef LandingPad)
Definition Core.cpp:3701
LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4366
LLVMBool LLVMGetVolatile(LLVMValueRef Inst)
Definition Core.cpp:4241
LLVMValueRef LLVMBuildFPCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4408
LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4346
LLVMValueRef LLVMBuildPtrDiff2(LLVMBuilderRef B, LLVMTypeRef ElemTy, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4523
LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4378
LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4055
LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx)
Definition Core.cpp:3693
unsigned LLVMGetAtomicSyncScopeID(LLVMValueRef AtomicInst)
Returns the synchronization scope ID of an atomic instruction.
Definition Core.cpp:4615
LLVMValueRef LLVMBuildVAArg(LLVMBuilderRef B, LLVMValueRef List, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4471
LLVMValueRef LLVMBuildAtomicCmpXchgSyncScope(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, unsigned SSID)
Definition Core.cpp:4567
LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3907
LLVMBool LLVMIsAtomic(LLVMValueRef Inst)
Returns whether an instruction is an atomic instruction, e.g., atomicrmw, cmpxchg,...
Definition Core.cpp:4592
void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile)
Definition Core.cpp:4245
void LLVMSetAtomicSingleThread(LLVMValueRef AtomicInst, LLVMBool NewValue)
Definition Core.cpp:4605
LLVMValueRef LLVMBuildFRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3872
LLVMValueRef LLVMBuildURem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3862
LLVMValueRef LLVMBuildIntToPtr(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4351
LLVMBool LLVMGetNSW(LLVMValueRef ArithInst)
Definition Core.cpp:3949
LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3822
LLVMValueRef LLVMBuildFree(LLVMBuilderRef B, LLVMValueRef PointerVal)
Definition Core.cpp:4060
LLVMValueRef LLVMBuildNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3914
LLVMValueRef LLVMBuildFSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3812
LLVMValueRef LLVMBuildCatchSwitch(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMBasicBlockRef UnwindBB, unsigned NumHandlers, const char *Name)
Definition Core.cpp:3653
LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name)
Definition Core.cpp:4064
LLVMValueRef LLVMBuildInBoundsGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition Core.cpp:4206
LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4016
LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, LLVMBool singleThread)
Definition Core.cpp:4554
LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr, unsigned NumDests)
Definition Core.cpp:3572
LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef B)
Definition Core.cpp:3676
LLVMValueRef LLVMBuildSIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4331
LLVMValueRef LLVMBuildSExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4311
LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4316
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:3519
void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Builder, LLVMMetadataRef Loc)
Set location information used by debugging information.
Definition Core.cpp:3500
LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4050
void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L)
Deprecated: Passing the NULL location will crash.
Definition Core.cpp:3507
LLVMValueRef LLVMBuildPhi(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4437
void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest)
Definition Core.cpp:3685
LLVMBool LLVMGetNNeg(LLVMValueRef NonNegInst)
Gets if the instruction has the non-negative flag set.
Definition Core.cpp:3969
LLVMValueRef LLVMBuildAtomicRMWSyncScope(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, unsigned SSID)
Definition Core.cpp:4543
LLVMValueRef LLVMBuildRet(LLVMBuilderRef B, LLVMValueRef V)
Definition Core.cpp:3549
LLVMMetadataRef LLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder)
Get the dafult floating-point math metadata for a given builder.
Definition Core.cpp:3539
LLVMValueRef LLVMBuildExtractValue(LLVMBuilderRef B, LLVMValueRef AggVal, unsigned Index, const char *Name)
Definition Core.cpp:4496
LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str, const char *Name)
Deprecated: Use LLVMBuildGlobalString instead, which has identical behavior.
Definition Core.cpp:4236
LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3782
void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block)
Definition Core.cpp:3468
LLVMValueRef LLVMBuildFMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3832
LLVMValueRef LLVMBuildLShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3882
LLVMAtomicRMWBinOp LLVMGetAtomicRMWBinOp(LLVMValueRef Inst)
Definition Core.cpp:4291
LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3931
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:4025
void LLVMSetAtomicSyncScopeID(LLVMValueRef AtomicInst, unsigned SSID)
Sets the synchronization scope ID of an atomic instruction.
Definition Core.cpp:4621
LLVMContextRef LLVMGetBuilderContext(LLVMBuilderRef Builder)
Obtain the context to which this builder is associated.
Definition Core.cpp:3535
LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4007
LLVMValueRef LLVMBuildFreeze(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4508
LLVMValueRef LLVMBuildGlobalString(LLVMBuilderRef B, const char *Str, const char *Name)
Definition Core.cpp:4231
void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW)
Definition Core.cpp:3944
LLVMAtomicOrdering LLVMGetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4627
LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef B, LLVMRealPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4428
LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4390
LLVMValueRef LLVMBuildExactSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3852
LLVMValueRef LLVMBuildShuffleVector(LLVMBuilderRef B, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, const char *Name)
Definition Core.cpp:4489
LLVMValueRef LLVMBuildFPExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4341
void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val)
Definition Core.cpp:3705
LLVMValueRef LLVMBuildICmp(LLVMBuilderRef B, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4421
void LLVMSetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4645
void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal)
Definition Core.cpp:3697
LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, LLVMBool isSingleThread, const char *Name)
Definition Core.cpp:4183
void LLVMSetParentCatchSwitch(LLVMValueRef CatchPad, LLVMValueRef CatchSwitch)
Set the parent catchswitch instruction of a catchpad instruction.
Definition Core.cpp:3727
LLVMValueRef LLVMBuildFenceSyncScope(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, unsigned SSID, const char *Name)
Definition Core.cpp:4192
LLVMValueRef LLVMBuildUIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4326
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:3444
unsigned LLVMGetNumClauses(LLVMValueRef LandingPad)
Definition Core.cpp:3689
int LLVMGetUndefMaskElem(void)
Definition Core.cpp:4590
void LLVMSetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4632
LLVMValueRef LLVMGetParentCatchSwitch(LLVMValueRef CatchPad)
Get the parent catchswitch instruction of a catchpad instruction.
Definition Core.cpp:3723
LLVMFastMathFlags LLVMGetFastMathFlags(LLVMValueRef FPMathInst)
Get the flags for which fast-math-style optimizations are allowed for this value.
Definition Core.cpp:3979
LLVMBool LLVMGetIsDisjoint(LLVMValueRef Inst)
Gets whether the instruction has the disjoint flag set.
Definition Core.cpp:3995
LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef B, LLVMValueRef V, LLVMBasicBlockRef Else, unsigned NumCases)
Definition Core.cpp:3567
void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg)
Sets the non-negative flag for the instruction.
Definition Core.cpp:3974
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:4032
void LLVMAddHandler(LLVMValueRef CatchSwitch, LLVMBasicBlockRef Dest)
Definition Core.cpp:3709
void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact)
Definition Core.cpp:3964
LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3918
LLVMValueRef LLVMBuildAShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3887
LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, const char *Name)
Definition Core.cpp:3596
void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4278
LLVMValueRef LLVMBuildFPTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4336
LLVMValueRef LLVMBuildStore(LLVMBuilderRef B, LLVMValueRef Val, LLVMValueRef PointerVal)
Definition Core.cpp:4069
void LLVMAddMetadataToInst(LLVMBuilderRef Builder, LLVMValueRef Inst)
Same as LLVMSetInstDebugLocation.
Definition Core.cpp:3523
LLVMAtomicOrdering LLVMGetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4640
LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3787
LLVMValueRef LLVMBuildInsertValue(LLVMBuilderRef B, LLVMValueRef AggVal, LLVMValueRef EltVal, unsigned Index, const char *Name)
Definition Core.cpp:4501
void LLVMBuilderSetDefaultFPMathTag(LLVMBuilderRef Builder, LLVMMetadataRef FPMathTag)
Set the default floating-point math metadata for the given builder.
Definition Core.cpp:3527
LLVMValueRef LLVMBuildZExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4306
LLVMValueRef LLVMBuildNot(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3935
LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, LLVMBool singleThread)
Definition Core.cpp:4532
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange(const char *InputData, size_t InputDataLength, const char *BufferName, LLVMBool RequiresNullTerminator)
Definition Core.cpp:4692
size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4717
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData, size_t InputDataLength, const char *BufferName)
Definition Core.cpp:4703
const char * LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4713
LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const char *Path, LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
Definition Core.cpp:4667
LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
Definition Core.cpp:4681
void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4721
LLVMModuleProviderRef LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M)
Changes the type of M so it can be passed to FunctionPassManagers and the JIT.
Definition Core.cpp:4656
void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP)
Destroys the module M.
Definition Core.cpp:4660
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:2503
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:2524
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:2491
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:2485
LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn)
Decrement a Function iterator to the previous Function.
Definition Core.cpp:2532
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:2516
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:2499
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:2508
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:2850
unsigned LLVMGetNumOperandBundleArgs(LLVMOperandBundleRef Bundle)
Obtain the number of operands for an operand bundle.
Definition Core.cpp:2867
const char * LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len)
Obtain the tag of an operand bundle as a string.
Definition Core.cpp:2861
void LLVMDisposeOperandBundle(LLVMOperandBundleRef Bundle)
Destroy an operand bundle.
Definition Core.cpp:2857
LLVMValueRef LLVMGetOperandBundleArgAtIndex(LLVMOperandBundleRef Bundle, unsigned Index)
Obtain the operand for an operand bundle at the given index.
Definition Core.cpp:2871
LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef P)
Deprecated: Use LLVMCreateFunctionPassManagerForModule instead.
Definition Core.cpp:4735
LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M)
Constructs a new function-by-function pass pipeline over the module provider.
Definition Core.cpp:4731
LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM)
Finalizes all of the function passes scheduled in the function pass manager.
Definition Core.cpp:4752
void LLVMDisposePassManager(LLVMPassManagerRef PM)
Frees the memory of a pass pipeline.
Definition Core.cpp:4756
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:4748
LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM)
Initializes all of the function passes scheduled in the function pass manager.
Definition Core.cpp:4744
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:4740
LLVMPassManagerRef LLVMCreatePassManager()
Constructs a new whole-module pass pipeline.
Definition Core.cpp:4727
void LLVMStopMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
Definition Core.cpp:4766
LLVMBool LLVMStartMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
Definition Core.cpp:4762
LLVMBool LLVMIsMultithreaded()
Check whether LLVM is executing in thread-safe mode or not.
Definition Core.cpp:4769
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:3018
void LLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to after another one.
Definition Core.cpp:3000
LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn)
Obtain the first basic block in a function.
Definition Core.cpp:2916
LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C, const char *Name)
Create a new basic block without inserting it into a function.
Definition Core.cpp:2948
LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB)
Go backwards in a basic block iterator.
Definition Core.cpp:2940
LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn)
Obtain the last basic block in a function.
Definition Core.cpp:2924
LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB)
Obtain the terminator instruction for a basic block.
Definition Core.cpp:2898
const char * LLVMGetBasicBlockName(LLVMBasicBlockRef BB)
Obtain the string name of a basic block.
Definition Core.cpp:2890
void LLVMAppendExistingBasicBlock(LLVMValueRef Fn, LLVMBasicBlockRef BB)
Append the given basic block to the basic block list of the given function.
Definition Core.cpp:2961
void LLVMDeleteBasicBlock(LLVMBasicBlockRef BBRef)
Remove a basic block from a function and delete it.
Definition Core.cpp:2988
LLVMBasicBlockRef LLVMInsertBasicBlockInContext(LLVMContextRef C, LLVMBasicBlockRef BBRef, const char *Name)
Insert a basic block in a function before another basic block.
Definition Core.cpp:2976
void LLVMGetBasicBlocks(LLVMValueRef FnRef, LLVMBasicBlockRef *BasicBlocksRefs)
Obtain all of the basic blocks in a function.
Definition Core.cpp:2906
void LLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to before another one.
Definition Core.cpp:2996
LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB)
Obtain the function to which a basic block belongs.
Definition Core.cpp:2894
LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn)
Obtain the basic block that corresponds to the entry point of a function.
Definition Core.cpp:2912
LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB)
Obtain the first instruction in a basic block.
Definition Core.cpp:3010
void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder, LLVMBasicBlockRef BB)
Insert the given basic block after the insertion point of the given builder.
Definition Core.cpp:2953
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB)
Convert a basic block instance to a value type.
Definition Core.cpp:2878
LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val)
Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
Definition Core.cpp:2886
void LLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BBRef)
Remove a basic block from a function.
Definition Core.cpp:2992
LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB)
Advance a basic block iterator.
Definition Core.cpp:2932
unsigned LLVMCountBasicBlocks(LLVMValueRef FnRef)
Obtain the number of basic blocks in a function.
Definition Core.cpp:2902
LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C, LLVMValueRef FnRef, const char *Name)
Append a basic block to the end of a function.
Definition Core.cpp:2966
LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val)
Determine whether an LLVMValueRef is itself a basic block.
Definition Core.cpp:2882
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:1957
LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty)
Definition Core.cpp:1848
LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1869
LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1886
LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1963
LLVMValueRef LLVMAlignOf(LLVMTypeRef Ty)
Definition Core.cpp:1844
LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1952
LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1897
LLVMValueRef LLVMConstGEPWithNoWrapFlags(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices, LLVMGEPNoWrapFlags NoWrapFlags)
Creates a constant GetElementPtr expression.
Definition Core.cpp:1925
LLVMOpcode LLVMGetConstOpcode(LLVMValueRef ConstantVal)
Definition Core.cpp:1840
LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, LLVMValueRef IndexConstant)
Definition Core.cpp:1975
LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1874
LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal)
Definition Core.cpp:1852
LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1969
LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant, LLVMValueRef ElementValueConstant, LLVMValueRef IndexConstant)
Definition Core.cpp:1981
LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1903
LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1891
LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant, LLVMValueRef VectorBConstant, LLVMValueRef MaskConstant)
Definition Core.cpp:1989
LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1937
LLVMValueRef LLVMConstGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
Definition Core.cpp:1908
LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB)
Definition Core.cpp:2007
LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal)
Definition Core.cpp:1865
LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1880
LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1942
LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1947
LLVMValueRef LLVMConstInBoundsGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
Definition Core.cpp:1916
LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString, const char *Constraints, LLVMBool HasSideEffects, LLVMBool IsAlignStack)
Deprecated: Use LLVMGetInlineAsm instead.
Definition Core.cpp:1999
LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal)
Definition Core.cpp:1856
LLVMValueRef LLVMGetBlockAddressFunction(LLVMValueRef BlockAddr)
Gets the function associated with a given BlockAddress constant value.
Definition Core.cpp:2011
LLVMBasicBlockRef LLVMGetBlockAddressBasicBlock(LLVMValueRef BlockAddr)
Gets the basic block associated with a given BlockAddress constant value.
Definition Core.cpp:2015
LLVMUnnamedAddr LLVMGetUnnamedAddress(LLVMValueRef Global)
Definition Core.cpp:2153
LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global)
Returns the "value type" of a global value.
Definition Core.cpp:2188
unsigned LLVMGetAlignment(LLVMValueRef V)
Obtain the preferred alignment of the value.
Definition Core.cpp:2194
void LLVMSetSection(LLVMValueRef Global, const char *Section)
Definition Core.cpp:2129
void LLVMSetUnnamedAddress(LLVMValueRef Global, LLVMUnnamedAddr UnnamedAddr)
Definition Core.cpp:2165
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:2269
void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage)
Definition Core.cpp:2058
void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr)
Deprecated: Use LLVMSetUnnamedAddress instead.
Definition Core.cpp:2182
LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global)
Definition Core.cpp:2021
unsigned LLVMValueMetadataEntriesGetKind(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the kind of a value metadata entry at a specific index.
Definition Core.cpp:2250
void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class)
Definition Core.cpp:2148
LLVMVisibility LLVMGetVisibility(LLVMValueRef Global)
Definition Core.cpp:2133
LLVMValueMetadataEntry * LLVMGlobalCopyAllMetadata(LLVMValueRef Value, size_t *NumEntries)
Retrieves an array of metadata entries representing the metadata attached to this value.
Definition Core.cpp:2238
void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes)
Set the preferred alignment of the value.
Definition Core.cpp:2216
const char * LLVMGetSection(LLVMValueRef Global)
Definition Core.cpp:2123
void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz)
Definition Core.cpp:2138
LLVMLinkage LLVMGetLinkage(LLVMValueRef Global)
Definition Core.cpp:2029
void LLVMGlobalEraseMetadata(LLVMValueRef Global, unsigned Kind)
Erases a metadata attachment of the given kind if it exists.
Definition Core.cpp:2279
LLVMDLLStorageClass LLVMGetDLLStorageClass(LLVMValueRef Global)
Definition Core.cpp:2143
LLVMBool LLVMIsDeclaration(LLVMValueRef Global)
Definition Core.cpp:2025
void LLVMGlobalClearMetadata(LLVMValueRef Global)
Removes all metadata attachments from this value.
Definition Core.cpp:2283
void LLVMGlobalAddMetadata(LLVMValueRef Global, unsigned Kind, LLVMMetadataRef MD)
Adds a metadata attachment.
Definition Core.cpp:2274
LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global)
Deprecated: Use LLVMGetUnnamedAddress instead.
Definition Core.cpp:2178
LLVMMetadataRef LLVMValueMetadataEntriesGetMetadata(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the underlying metadata node of a value metadata entry at a specific index.
Definition Core.cpp:2258
void LLVMDisposeValueMetadataEntries(LLVMValueMetadataEntry *Entries)
Destroys value metadata entries.
Definition Core.cpp:2265
void LLVMGlobalAddDebugInfo(LLVMValueRef Global, LLVMMetadataRef GVE)
Add debuginfo metadata to this global.
Definition Core.cpp:2287
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:2771
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align)
Set the alignment for a function parameter.
Definition Core.cpp:2778
unsigned LLVMCountParams(LLVMValueRef FnRef)
Obtain the number of parameters in a function.
Definition Core.cpp:2726
void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs)
Obtain the parameters in a function.
Definition Core.cpp:2732
LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn)
Obtain the first parameter to a function.
Definition Core.cpp:2747
LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn)
Obtain the last parameter to a function.
Definition Core.cpp:2755
LLVMValueRef LLVMGetParam(LLVMValueRef FnRef, unsigned index)
Obtain the parameter at the specified index.
Definition Core.cpp:2738
LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg)
Obtain the next parameter to a function.
Definition Core.cpp:2763
LLVMValueRef LLVMGetParamParent(LLVMValueRef V)
Obtain the function to which this argument belongs.
Definition Core.cpp:2743
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:2602
void LLVMAddAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Add an attribute to a function.
Definition Core.cpp:2676
LLVMValueRef LLVMGetPrefixData(LLVMValueRef Fn)
Gets the prefix data associated with a function.
Definition Core.cpp:2644
LLVMValueRef LLVMGetPrologueData(LLVMValueRef Fn)
Gets the prologue data associated with a function.
Definition Core.cpp:2660
unsigned LLVMGetIntrinsicID(LLVMValueRef Fn)
Obtain the ID number from a function instance.
Definition Core.cpp:2557
LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn)
Obtain the personality function attached to the function.
Definition Core.cpp:2548
unsigned LLVMGetAttributeCountAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx)
Definition Core.cpp:2681
LLVMBool LLVMHasPersonalityFn(LLVMValueRef Fn)
Check whether the given function has a personality function.
Definition Core.cpp:2544
void LLVMRemoveStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:2712
void LLVMSetPrefixData(LLVMValueRef Fn, LLVMValueRef prefixData)
Sets the prefix data for the function.
Definition Core.cpp:2654
const char * LLVMGetGC(LLVMValueRef Fn)
Obtain the name of the garbage collector to use during code generation.
Definition Core.cpp:2631
char * LLVMIntrinsicCopyOverloadedName(unsigned ID, LLVMTypeRef *OverloadTypes, size_t OverloadCount, size_t *NameLength)
Deprecated: Use LLVMIntrinsicCopyOverloadedName2 instead.
Definition Core.cpp:2592
void LLVMSetGC(LLVMValueRef Fn, const char *GC)
Define the garbage collector to use during code generation.
Definition Core.cpp:2636
void LLVMSetPrologueData(LLVMValueRef Fn, LLVMValueRef prologueData)
Sets the prologue data for the function.
Definition Core.cpp:2670
void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn)
Set the personality function attached to the function.
Definition Core.cpp:2552
void LLVMGetAttributesAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
Definition Core.cpp:2686
unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn)
Obtain the calling function of a function.
Definition Core.cpp:2622
LLVMBool LLVMIntrinsicIsOverloaded(unsigned ID)
Obtain if the intrinsic identified by the given ID is overloaded.
Definition Core.cpp:2617
void LLVMDeleteFunction(LLVMValueRef Fn)
Remove a function from its containing module and deletes it.
Definition Core.cpp:2540
void LLVMRemoveEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:2707
LLVMAttributeRef LLVMGetEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:2693
unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen)
Obtain the intrinsic ID number which matches the given function name.
Definition Core.cpp:2613
const char * LLVMIntrinsicGetName(unsigned ID, size_t *NameLength)
Retrieves the name of an intrinsic.
Definition Core.cpp:2577
LLVMValueRef LLVMGetIntrinsicDeclaration(LLVMModuleRef Mod, unsigned ID, LLVMTypeRef *OverloadTypes, size_t OverloadCount)
Get or insert the declaration of an intrinsic.
Definition Core.cpp:2568
LLVMBool LLVMHasPrologueData(LLVMValueRef Fn)
Check if a given function has prologue data.
Definition Core.cpp:2665
LLVMBool LLVMHasPrefixData(LLVMValueRef Fn)
Check if a given function has prefix data.
Definition Core.cpp:2649
void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC)
Set the calling convention of a function.
Definition Core.cpp:2626
LLVMTypeRef LLVMIntrinsicGetType(LLVMContextRef Ctx, unsigned ID, LLVMTypeRef *OverloadTypes, size_t OverloadCount)
Retrieves the type of an intrinsic.
Definition Core.cpp:2584
void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A, const char *V)
Add a target-dependent attribute to a function.
Definition Core.cpp:2717
LLVMAttributeRef LLVMGetStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:2700
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:2800
LLVMValueRef LLVMGetNamedGlobalIFunc(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalIFunc value from a Module by its name.
Definition Core.cpp:2795
void LLVMRemoveGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module.
Definition Core.cpp:2844
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:2785
LLVMValueRef LLVMGetNextGlobalIFunc(LLVMValueRef IFunc)
Advance a GlobalIFunc iterator to the next GlobalIFunc.
Definition Core.cpp:2816
LLVMValueRef LLVMGetPreviousGlobalIFunc(LLVMValueRef IFunc)
Decrement a GlobalIFunc iterator to the previous GlobalIFunc.
Definition Core.cpp:2824
LLVMValueRef LLVMGetGlobalIFuncResolver(LLVMValueRef IFunc)
Retrieves the resolver function associated with this indirect function, or NULL if it doesn't not exi...
Definition Core.cpp:2832
void LLVMSetGlobalIFuncResolver(LLVMValueRef IFunc, LLVMValueRef Resolver)
Sets the resolver function associated with this indirect function.
Definition Core.cpp:2836
LLVMValueRef LLVMGetLastGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the last GlobalIFunc in a Module.
Definition Core.cpp:2808
void LLVMEraseGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module and delete it.
Definition Core.cpp:2840
LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca)
Obtain the type that is being allocated by the alloca instruction.
Definition Core.cpp:3353
void LLVMSetTailCall(LLVMValueRef Call, LLVMBool isTailCall)
Set whether a call instruction is a tail call.
Definition Core.cpp:3252
void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Definition Core.cpp:3184
unsigned LLVMGetNumOperandBundles(LLVMValueRef C)
Obtain the number of operand bundles attached to this instruction.
Definition Core.cpp:3236
void LLVMRemoveCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:3218
void LLVMRemoveCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:3223
LLVMAttributeRef LLVMGetCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:3204
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr)
Obtain the calling convention for a call instruction.
Definition Core.cpp:3167
LLVMBasicBlockRef LLVMGetCallBrDefaultDest(LLVMValueRef CallBr)
Get the default destination of a CallBr instruction.
Definition Core.cpp:3292
LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr)
Obtain the pointer to the function invoked by this instruction.
Definition Core.cpp:3228
void LLVMSetNormalDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the normal destination basic block.
Definition Core.cpp:3279
LLVMBool LLVMIsTailCall(LLVMValueRef Call)
Obtain whether a call instruction is a tail call.
Definition Core.cpp:3248
LLVMAttributeRef LLVMGetCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:3211
unsigned LLVMGetCallBrNumIndirectDests(LLVMValueRef CallBr)
Get the number of indirect destinations of a CallBr instruction.
Definition Core.cpp:3296
void LLVMGetCallSiteAttributes(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
Definition Core.cpp:3196
LLVMBasicBlockRef LLVMGetNormalDest(LLVMValueRef Invoke)
Return the normal destination basic block.
Definition Core.cpp:3266
unsigned LLVMGetNumArgOperands(LLVMValueRef Instr)
Obtain the argument count for a call instruction.
Definition Core.cpp:3158
void LLVMSetTailCallKind(LLVMValueRef Call, LLVMTailCallKind kind)
Set the call kind of the call instruction.
Definition Core.cpp:3260
LLVMOperandBundleRef LLVMGetOperandBundleAtIndex(LLVMValueRef C, unsigned Index)
Obtain the operand bundle attached to this instruction at the given index.
Definition Core.cpp:3240
LLVMBasicBlockRef LLVMGetCallBrIndirectDest(LLVMValueRef CallBr, unsigned Idx)
Get the indirect destination of a CallBr instruction at the given index.
Definition Core.cpp:3300
LLVMTailCallKind LLVMGetTailCallKind(LLVMValueRef Call)
Obtain a tail call kind of the call instruction.
Definition Core.cpp:3256
void LLVMSetUnwindDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the unwind destination basic block.
Definition Core.cpp:3283
LLVMTypeRef LLVMGetCalledFunctionType(LLVMValueRef Instr)
Obtain the function type called by this instruction.
Definition Core.cpp:3232
LLVMBasicBlockRef LLVMGetUnwindDest(LLVMValueRef Invoke)
Return the unwind destination basic block.
Definition Core.cpp:3270
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, LLVMAttributeIndex Idx, unsigned align)
Definition Core.cpp:3176
unsigned LLVMGetCallSiteAttributeCount(LLVMValueRef C, LLVMAttributeIndex Idx)
Definition Core.cpp:3189
void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC)
Set the calling convention for a call instruction.
Definition Core.cpp:3171
LLVMGEPNoWrapFlags LLVMGEPGetNoWrapFlags(LLVMValueRef GEP)
Get the no-wrap related flags for the given GEP instruction.
Definition Core.cpp:3371
LLVMBool LLVMIsInBounds(LLVMValueRef GEP)
Check whether the given GEP operator is inbounds.
Definition Core.cpp:3359
void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds)
Set the given GEP instruction to be inbounds or not.
Definition Core.cpp:3363
LLVMTypeRef LLVMGetGEPSourceElementType(LLVMValueRef GEP)
Get the source element type of the given GEP operator.
Definition Core.cpp:3367
void LLVMGEPSetNoWrapFlags(LLVMValueRef GEP, LLVMGEPNoWrapFlags NoWrapFlags)
Set the no-wrap related flags for the given GEP instruction.
Definition Core.cpp:3376
unsigned LLVMGetNumIndices(LLVMValueRef Inst)
Obtain the number of indices.
Definition Core.cpp:3404
const unsigned * LLVMGetIndices(LLVMValueRef Inst)
Obtain the indices as an array.
Definition Core.cpp:3416
LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
Definition Core.cpp:3398
LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMValueRef.
Definition Core.cpp:3394
void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues, LLVMBasicBlockRef *IncomingBlocks, unsigned Count)
Add an incoming value to the end of a PHI list.
Definition Core.cpp:3383
unsigned LLVMCountIncoming(LLVMValueRef PhiNode)
Obtain the number of incoming basic blocks to a PHI node.
Definition Core.cpp:3390
LLVMValueRef LLVMGetCondition(LLVMValueRef Branch)
Return the condition of a branch instruction.
Definition Core.cpp:3324
LLVMBasicBlockRef LLVMGetSuccessor(LLVMValueRef Term, unsigned i)
Return the specified successor.
Definition Core.cpp:3310
void LLVMSetCondition(LLVMValueRef Branch, LLVMValueRef Cond)
Set the condition of a branch instruction.
Definition Core.cpp:3328
void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block)
Update the specified successor to point at the provided block.
Definition Core.cpp:3314
LLVMValueRef LLVMGetSwitchCaseValue(LLVMValueRef Switch, unsigned i)
Obtain the case value for a successor of a switch instruction.
Definition Core.cpp:3338
LLVMBool LLVMIsConditional(LLVMValueRef Branch)
Return if an instruction is a conditional branch.
Definition Core.cpp:3320
LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef Switch)
Obtain the default destination basic block of a switch instruction.
Definition Core.cpp:3334
void LLVMSetSwitchCaseValue(LLVMValueRef Switch, unsigned i, LLVMValueRef CaseValue)
Set the case value for a successor of a switch instruction.
Definition Core.cpp:3344
unsigned LLVMGetNumSuccessors(LLVMValueRef Term)
Return the number of successors that this terminator has.
Definition Core.cpp:3306
LLVMRealPredicate LLVMGetFCmpPredicate(LLVMValueRef Inst)
Obtain the float predicate of an instruction.
Definition Core.cpp:3068
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:3042
LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst)
Obtain the instruction that occurred before this one.
Definition Core.cpp:3034
LLVMDbgRecordRef LLVMGetPreviousDbgRecord(LLVMDbgRecordRef Rec)
Obtain the previous DbgRecord in the sequence or NULL if there are no more.
Definition Core.cpp:3119
LLVMMetadataRef LLVMDbgVariableRecordGetExpression(LLVMDbgRecordRef Rec)
Get the debug info expression of the DbgVariableRecord.
Definition Core.cpp:3154
LLVMDbgRecordRef LLVMGetFirstDbgRecord(LLVMValueRef Inst)
Obtain the first debug record attached to an instruction.
Definition Core.cpp:3091
LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst)
Obtain the code opcode for an individual instruction.
Definition Core.cpp:3074
LLVMDbgRecordRef LLVMGetNextDbgRecord(LLVMDbgRecordRef Rec)
Obtain the next DbgRecord in the sequence or NULL if there are no more.
Definition Core.cpp:3111
LLVMDbgRecordRef LLVMGetLastDbgRecord(LLVMValueRef Inst)
Obtain the last debug record attached to an instruction.
Definition Core.cpp:3101
LLVMMetadataRef LLVMDbgVariableRecordGetVariable(LLVMDbgRecordRef Rec)
Get the debug info variable of the DbgVariableRecord.
Definition Core.cpp:3150
LLVMValueRef LLVMIsATerminatorInst(LLVMValueRef Inst)
Determine whether an instruction is a terminator.
Definition Core.cpp:3086
LLVMValueRef LLVMDbgVariableRecordGetValue(LLVMDbgRecordRef Rec, unsigned OpIdx)
Get the value of the DbgVariableRecord.
Definition Core.cpp:3145
LLVMDbgRecordKind LLVMDbgRecordGetKind(LLVMDbgRecordRef Rec)
Definition Core.cpp:3131
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:3050
LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst)
Obtain the basic block to which an instruction belongs.
Definition Core.cpp:3006
LLVMMetadataRef LLVMDbgRecordGetDebugLoc(LLVMDbgRecordRef Rec)
Get the debug location attached to the debug record.
Definition Core.cpp:3127
LLVMBool LLVMGetICmpSameSign(LLVMValueRef Inst)
Get whether or not an icmp instruction has the samesign flag.
Definition Core.cpp:3060
LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst)
Create a copy of 'this' instruction that is identical in all ways except the following:
Definition Core.cpp:3080
void LLVMInstructionEraseFromParent(LLVMValueRef Inst)
Remove and delete an instruction.
Definition Core.cpp:3046
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:3054
LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst)
Obtain the instruction that occurs after the one specified.
Definition Core.cpp:3026
void LLVMSetICmpSameSign(LLVMValueRef Inst, LLVMBool SameSign)
Set the samesign flag on an icmp instruction.
Definition Core.cpp:3064
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:2430
LLVMValueRef LLVMGetLastGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the last GlobalAlias in a Module.
Definition Core.cpp:2451
LLVMValueRef LLVMGetPreviousGlobalAlias(LLVMValueRef GA)
Decrement a GlobalAlias iterator to the previous GlobalAlias.
Definition Core.cpp:2467
void LLVMAliasSetAliasee(LLVMValueRef Alias, LLVMValueRef Aliasee)
Set the target value of an alias.
Definition Core.cpp:2479
LLVMValueRef LLVMGetFirstGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the first GlobalAlias in a Module.
Definition Core.cpp:2443
LLVMValueRef LLVMAliasGetAliasee(LLVMValueRef Alias)
Retrieve the target value of an alias.
Definition Core.cpp:2475
LLVMValueRef LLVMGetNamedGlobalAlias(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalAlias value from a Module by its name.
Definition Core.cpp:2438
LLVMValueRef LLVMGetNextGlobalAlias(LLVMValueRef GA)
Advance a GlobalAlias iterator to the next GlobalAlias.
Definition Core.cpp:2459
LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar)
Definition Core.cpp:2365
LLVMThreadLocalMode LLVMGetThreadLocalMode(LLVMValueRef GlobalVar)
Definition Core.cpp:2381
LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar)
Definition Core.cpp:2373
LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2341
void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal)
Definition Core.cpp:2369
LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar)
Definition Core.cpp:2420
LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M)
Definition Core.cpp:2325
LLVMValueRef LLVMGetNamedGlobalWithLength(LLVMModuleRef M, const char *Name, size_t Length)
Definition Core.cpp:2312
LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M)
Definition Core.cpp:2317
void LLVMSetThreadLocalMode(LLVMValueRef GlobalVar, LLVMThreadLocalMode Mode)
Definition Core.cpp:2398
LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2333
void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit)
Definition Core.cpp:2424
LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name)
Definition Core.cpp:2308
LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name, unsigned AddressSpace)
Definition Core.cpp:2299
void LLVMDeleteGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2349
void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant)
Definition Core.cpp:2377
LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:2294
LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar)
Definition Core.cpp:2353
void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal)
Definition Core.cpp:2360
#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:804
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:397
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:392
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