LLVM 23.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)->print(dest, nullptr);
478
479 dest.close();
480
481 if (dest.has_error()) {
482 std::string E = "Error printing to file: " + dest.error().message();
483 *ErrorMessage = strdup(E.c_str());
484 return true;
485 }
486
487 return false;
488}
489
491 std::string buf;
492 raw_string_ostream os(buf);
493
494 unwrap(M)->print(os, nullptr);
495
496 return strdup(buf.c_str());
497}
498
499/*--.. Operations on inline assembler ......................................--*/
500void LLVMSetModuleInlineAsm2(LLVMModuleRef M, const char *Asm, size_t Len) {
501 unwrap(M)->setModuleInlineAsm(StringRef(Asm, Len));
502}
503
504void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm) {
505 unwrap(M)->setModuleInlineAsm(StringRef(Asm));
506}
507
508void LLVMAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm, size_t Len) {
509 unwrap(M)->appendModuleInlineAsm(StringRef(Asm, Len));
510}
511
512const char *LLVMGetModuleInlineAsm(LLVMModuleRef M, size_t *Len) {
513 auto &Str = unwrap(M)->getModuleInlineAsm();
514 *Len = Str.length();
515 return Str.c_str();
516}
517
518LLVMValueRef LLVMGetInlineAsm(LLVMTypeRef Ty, const char *AsmString,
519 size_t AsmStringSize, const char *Constraints,
520 size_t ConstraintsSize, LLVMBool HasSideEffects,
521 LLVMBool IsAlignStack,
522 LLVMInlineAsmDialect Dialect, LLVMBool CanThrow) {
524 switch (Dialect) {
527 break;
530 break;
531 }
533 StringRef(AsmString, AsmStringSize),
534 StringRef(Constraints, ConstraintsSize),
535 HasSideEffects, IsAlignStack, AD, CanThrow));
536}
537
538const char *LLVMGetInlineAsmAsmString(LLVMValueRef InlineAsmVal, size_t *Len) {
539
540 Value *Val = unwrap<Value>(InlineAsmVal);
541 StringRef AsmString = cast<InlineAsm>(Val)->getAsmString();
542
543 *Len = AsmString.size();
544 return AsmString.data();
545}
546
548 size_t *Len) {
549 Value *Val = unwrap<Value>(InlineAsmVal);
550 StringRef ConstraintString = cast<InlineAsm>(Val)->getConstraintString();
551
552 *Len = ConstraintString.size();
553 return ConstraintString.data();
554}
555
557
558 Value *Val = unwrap<Value>(InlineAsmVal);
559 InlineAsm::AsmDialect Dialect = cast<InlineAsm>(Val)->getDialect();
560
561 switch (Dialect) {
566 }
567
568 llvm_unreachable("Unrecognized inline assembly dialect");
570}
571
573 Value *Val = unwrap<Value>(InlineAsmVal);
574 return (LLVMTypeRef)cast<InlineAsm>(Val)->getFunctionType();
575}
576
578 Value *Val = unwrap<Value>(InlineAsmVal);
579 return cast<InlineAsm>(Val)->hasSideEffects();
580}
581
583 Value *Val = unwrap<Value>(InlineAsmVal);
584 return cast<InlineAsm>(Val)->isAlignStack();
585}
586
588 Value *Val = unwrap<Value>(InlineAsmVal);
589 return cast<InlineAsm>(Val)->canThrow();
590}
591
592/*--.. Operations on module contexts ......................................--*/
594 return wrap(&unwrap(M)->getContext());
595}
596
597
598/*===-- Operations on types -----------------------------------------------===*/
599
600/*--.. Operations on all types (mostly) ....................................--*/
601
603 switch (unwrap(Ty)->getTypeID()) {
604 case Type::VoidTyID:
605 return LLVMVoidTypeKind;
606 case Type::HalfTyID:
607 return LLVMHalfTypeKind;
608 case Type::BFloatTyID:
609 return LLVMBFloatTypeKind;
610 case Type::FloatTyID:
611 return LLVMFloatTypeKind;
612 case Type::DoubleTyID:
613 return LLVMDoubleTypeKind;
616 case Type::FP128TyID:
617 return LLVMFP128TypeKind;
620 case Type::LabelTyID:
621 return LLVMLabelTypeKind;
624 case Type::ByteTyID:
625 return LLVMByteTypeKind;
627 return LLVMIntegerTypeKind;
630 case Type::StructTyID:
631 return LLVMStructTypeKind;
632 case Type::ArrayTyID:
633 return LLVMArrayTypeKind;
635 return LLVMPointerTypeKind;
637 return LLVMVectorTypeKind;
639 return LLVMX86_AMXTypeKind;
640 case Type::TokenTyID:
641 return LLVMTokenTypeKind;
647 llvm_unreachable("Typed pointers are unsupported via the C API");
648 }
649 llvm_unreachable("Unhandled TypeID.");
650}
651
653{
654 return unwrap(Ty)->isSized();
655}
656
658 return wrap(&unwrap(Ty)->getContext());
659}
660
662 return unwrap(Ty)->print(errs(), /*IsForDebug=*/true);
663}
664
666 std::string buf;
667 raw_string_ostream os(buf);
668
669 if (unwrap(Ty))
670 unwrap(Ty)->print(os);
671 else
672 os << "Printing <null> Type";
673
674 return strdup(buf.c_str());
675}
676
677/*--.. Operations on byte types ............................................--*/
678
680 return wrap(ByteType::get(*unwrap(C), NumBits));
681}
682
684 return unwrap<ByteType>(ByteTy)->getBitWidth();
685}
686
687/*--.. Operations on integer types .........................................--*/
688
708 return wrap(IntegerType::get(*unwrap(C), NumBits));
709}
710
729LLVMTypeRef LLVMIntType(unsigned NumBits) {
731}
732
733unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy) {
734 return unwrap<IntegerType>(IntegerTy)->getBitWidth();
735}
736
737/*--.. Operations on real types ............................................--*/
738
763
788
789/*--.. Operations on function types ........................................--*/
790
792 LLVMTypeRef *ParamTypes, unsigned ParamCount,
793 LLVMBool IsVarArg) {
794 ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
795 return wrap(FunctionType::get(unwrap(ReturnType), Tys, IsVarArg != 0));
796}
797
799 return unwrap<FunctionType>(FunctionTy)->isVarArg();
800}
801
803 return wrap(unwrap<FunctionType>(FunctionTy)->getReturnType());
804}
805
806unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy) {
807 return unwrap<FunctionType>(FunctionTy)->getNumParams();
808}
809
811 FunctionType *Ty = unwrap<FunctionType>(FunctionTy);
812 for (Type *T : Ty->params())
813 *Dest++ = wrap(T);
814}
815
816/*--.. Operations on struct types ..........................................--*/
817
819 unsigned ElementCount, LLVMBool Packed) {
820 ArrayRef<Type*> Tys(unwrap(ElementTypes), ElementCount);
821 return wrap(StructType::get(*unwrap(C), Tys, Packed != 0));
822}
823
825 unsigned ElementCount, LLVMBool Packed) {
827 ElementCount, Packed);
828}
829
831{
832 return wrap(StructType::create(*unwrap(C), Name));
833}
834
836{
838 if (!Type->hasName())
839 return nullptr;
840 return Type->getName().data();
841}
842
843void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes,
844 unsigned ElementCount, LLVMBool Packed) {
845 ArrayRef<Type*> Tys(unwrap(ElementTypes), ElementCount);
846 unwrap<StructType>(StructTy)->setBody(Tys, Packed != 0);
847}
848
850 return unwrap<StructType>(StructTy)->getNumElements();
851}
852
854 StructType *Ty = unwrap<StructType>(StructTy);
855 for (Type *T : Ty->elements())
856 *Dest++ = wrap(T);
857}
858
860 StructType *Ty = unwrap<StructType>(StructTy);
861 return wrap(Ty->getTypeAtIndex(i));
862}
863
865 return unwrap<StructType>(StructTy)->isPacked();
866}
867
869 return unwrap<StructType>(StructTy)->isOpaque();
870}
871
873 return unwrap<StructType>(StructTy)->isLiteral();
874}
875
877 return wrap(StructType::getTypeByName(unwrap(M)->getContext(), Name));
878}
879
881 return wrap(StructType::getTypeByName(*unwrap(C), Name));
882}
883
884/*--.. Operations on array, pointer, and vector types (sequence types) .....--*/
885
887 int i = 0;
888 for (auto *T : unwrap(Tp)->subtypes()) {
889 Arr[i] = wrap(T);
890 i++;
891 }
892}
893
895 return wrap(ArrayType::get(unwrap(ElementType), ElementCount));
896}
897
901
903 return wrap(
904 PointerType::get(unwrap(ElementType)->getContext(), AddressSpace));
905}
906
908 return true;
909}
910
912 return wrap(FixedVectorType::get(unwrap(ElementType), ElementCount));
913}
914
916 unsigned ElementCount) {
917 return wrap(ScalableVectorType::get(unwrap(ElementType), ElementCount));
918}
919
921 auto *Ty = unwrap(WrappedTy);
922 if (auto *ATy = dyn_cast<ArrayType>(Ty))
923 return wrap(ATy->getElementType());
924 return wrap(cast<VectorType>(Ty)->getElementType());
925}
926
928 return unwrap(Tp)->getNumContainedTypes();
929}
930
932 return unwrap<ArrayType>(ArrayTy)->getNumElements();
933}
934
936 return unwrap<ArrayType>(ArrayTy)->getNumElements();
937}
938
940 return unwrap<PointerType>(PointerTy)->getAddressSpace();
941}
942
943unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy) {
944 return unwrap<VectorType>(VectorTy)->getElementCount().getKnownMinValue();
945}
946
950
954
956 return wrap(unwrap<ConstantPtrAuth>(PtrAuth)->getDiscriminator());
957}
958
960 return wrap(unwrap<ConstantPtrAuth>(PtrAuth)->getAddrDiscriminator());
961}
962
963/*--.. Operations on other types ...........................................--*/
964
968
981
988
990 LLVMTypeRef *TypeParams,
991 unsigned TypeParamCount,
992 unsigned *IntParams,
993 unsigned IntParamCount) {
994 ArrayRef<Type *> TypeParamArray(unwrap(TypeParams), TypeParamCount);
995 ArrayRef<unsigned> IntParamArray(IntParams, IntParamCount);
996 return wrap(
997 TargetExtType::get(*unwrap(C), Name, TypeParamArray, IntParamArray));
998}
999
1000const char *LLVMGetTargetExtTypeName(LLVMTypeRef TargetExtTy) {
1002 return Type->getName().data();
1003}
1004
1007 return Type->getNumTypeParameters();
1008}
1009
1011 unsigned Idx) {
1013 return wrap(Type->getTypeParameter(Idx));
1014}
1015
1018 return Type->getNumIntParameters();
1019}
1020
1021unsigned LLVMGetTargetExtTypeIntParam(LLVMTypeRef TargetExtTy, unsigned Idx) {
1023 return Type->getIntParameter(Idx);
1024}
1025
1026/*===-- Operations on values ----------------------------------------------===*/
1027
1028/*--.. Operations on all values ............................................--*/
1029
1031 return wrap(unwrap(Val)->getType());
1032}
1033
1035 switch(unwrap(Val)->getValueID()) {
1036#define LLVM_C_API 1
1037#define HANDLE_VALUE(Name) \
1038 case Value::Name##Val: \
1039 return LLVM##Name##ValueKind;
1040#include "llvm/IR/Value.def"
1041 default:
1043 }
1044}
1045
1046const char *LLVMGetValueName2(LLVMValueRef Val, size_t *Length) {
1047 auto *V = unwrap(Val);
1048 *Length = V->getName().size();
1049 return V->getName().data();
1050}
1051
1052void LLVMSetValueName2(LLVMValueRef Val, const char *Name, size_t NameLen) {
1053 unwrap(Val)->setName(StringRef(Name, NameLen));
1054}
1055
1057 return unwrap(Val)->getName().data();
1058}
1059
1060void LLVMSetValueName(LLVMValueRef Val, const char *Name) {
1061 unwrap(Val)->setName(Name);
1062}
1063
1065 unwrap(Val)->print(errs(), /*IsForDebug=*/true);
1066}
1067
1069 std::string buf;
1070 raw_string_ostream os(buf);
1071
1072 if (unwrap(Val))
1073 unwrap(Val)->print(os);
1074 else
1075 os << "Printing <null> Value";
1076
1077 return strdup(buf.c_str());
1078}
1079
1081 return wrap(&unwrap(Val)->getContext());
1082}
1083
1085 std::string buf;
1086 raw_string_ostream os(buf);
1087
1088 if (unwrap(Record))
1089 unwrap(Record)->print(os);
1090 else
1091 os << "Printing <null> DbgRecord";
1092
1093 return strdup(buf.c_str());
1094}
1095
1097 unwrap(OldVal)->replaceAllUsesWith(unwrap(NewVal));
1098}
1099
1101 return unwrap<Instruction>(Inst)->hasMetadata();
1102}
1103
1105 auto *I = unwrap<Instruction>(Inst);
1106 assert(I && "Expected instruction");
1107 if (auto *MD = I->getMetadata(KindID))
1108 return wrap(MetadataAsValue::get(I->getContext(), MD));
1109 return nullptr;
1110}
1111
1112// MetadataAsValue uses a canonical format which strips the actual MDNode for
1113// MDNode with just a single constant value, storing just a ConstantAsMetadata
1114// This undoes this canonicalization, reconstructing the MDNode.
1116 Metadata *MD = MAV->getMetadata();
1118 "Expected a metadata node or a canonicalized constant");
1119
1120 if (MDNode *N = dyn_cast<MDNode>(MD))
1121 return N;
1122
1123 return MDNode::get(MAV->getContext(), MD);
1124}
1125
1126void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef Val) {
1127 MDNode *N = Val ? extractMDNode(unwrap<MetadataAsValue>(Val)) : nullptr;
1128
1129 unwrap<Instruction>(Inst)->setMetadata(KindID, N);
1130}
1131
1136
1139llvm_getMetadata(size_t *NumEntries,
1140 llvm::function_ref<void(MetadataEntries &)> AccessMD) {
1142 AccessMD(MVEs);
1143
1145 static_cast<LLVMOpaqueValueMetadataEntry *>(
1147 for (unsigned i = 0; i < MVEs.size(); ++i) {
1148 const auto &ModuleFlag = MVEs[i];
1149 Result[i].Kind = ModuleFlag.first;
1150 Result[i].Metadata = wrap(ModuleFlag.second);
1151 }
1152 *NumEntries = MVEs.size();
1153 return Result;
1154}
1155
1158 size_t *NumEntries) {
1159 return llvm_getMetadata(NumEntries, [&Value](MetadataEntries &Entries) {
1160 Entries.clear();
1161 unwrap<Instruction>(Value)->getAllMetadata(Entries);
1162 });
1163}
1164
1165/*--.. Conversion functions ................................................--*/
1166
1167#define LLVM_DEFINE_VALUE_CAST(name) \
1168 LLVMValueRef LLVMIsA##name(LLVMValueRef Val) { \
1169 return wrap(static_cast<Value*>(dyn_cast_or_null<name>(unwrap(Val)))); \
1170 }
1171
1173
1175 if (Value *V = unwrap(Val))
1176 return isa<UncondBrInst, CondBrInst>(V) ? Val : nullptr;
1177 return nullptr;
1178}
1179
1181 if (auto *MD = dyn_cast_or_null<MetadataAsValue>(unwrap(Val)))
1182 if (isa<MDNode>(MD->getMetadata()) ||
1183 isa<ValueAsMetadata>(MD->getMetadata()))
1184 return Val;
1185 return nullptr;
1186}
1187
1189 if (auto *MD = dyn_cast_or_null<MetadataAsValue>(unwrap(Val)))
1190 if (isa<ValueAsMetadata>(MD->getMetadata()))
1191 return Val;
1192 return nullptr;
1193}
1194
1196 if (auto *MD = dyn_cast_or_null<MetadataAsValue>(unwrap(Val)))
1197 if (isa<MDString>(MD->getMetadata()))
1198 return Val;
1199 return nullptr;
1200}
1201
1202/*--.. Operations on Uses ..................................................--*/
1204 Value *V = unwrap(Val);
1205 Value::use_iterator I = V->use_begin();
1206 if (I == V->use_end())
1207 return nullptr;
1208 return wrap(&*I);
1209}
1210
1212 Use *Next = unwrap(U)->getNext();
1213 if (Next)
1214 return wrap(Next);
1215 return nullptr;
1216}
1217
1219 return wrap(unwrap(U)->getUser());
1220}
1221
1225
1226/*--.. Operations on Users .................................................--*/
1227
1229 unsigned Index) {
1230 Metadata *Op = N->getOperand(Index);
1231 if (!Op)
1232 return nullptr;
1233 if (auto *C = dyn_cast<ConstantAsMetadata>(Op))
1234 return wrap(C->getValue());
1235 return wrap(MetadataAsValue::get(Context, Op));
1236}
1237
1239 Value *V = unwrap(Val);
1240 if (auto *MD = dyn_cast<MetadataAsValue>(V)) {
1241 if (auto *L = dyn_cast<ValueAsMetadata>(MD->getMetadata())) {
1242 assert(Index == 0 && "Function-local metadata can only have one operand");
1243 return wrap(L->getValue());
1244 }
1245 return getMDNodeOperandImpl(V->getContext(),
1246 cast<MDNode>(MD->getMetadata()), Index);
1247 }
1248
1249 return wrap(cast<User>(V)->getOperand(Index));
1250}
1251
1253 Value *V = unwrap(Val);
1254 return wrap(&cast<User>(V)->getOperandUse(Index));
1255}
1256
1257void LLVMSetOperand(LLVMValueRef Val, unsigned Index, LLVMValueRef Op) {
1258 unwrap<User>(Val)->setOperand(Index, unwrap(Op));
1259}
1260
1262 Value *V = unwrap(Val);
1263 if (isa<MetadataAsValue>(V))
1264 return LLVMGetMDNodeNumOperands(Val);
1265
1266 return cast<User>(V)->getNumOperands();
1267}
1268
1269/*--.. Operations on constants of any type .................................--*/
1270
1274
1278
1282
1286
1290
1292 if (Constant *C = dyn_cast<Constant>(unwrap(Val)))
1293 return C->isNullValue();
1294 return false;
1295}
1296
1300
1304
1308
1309/*--.. Operations on metadata nodes ........................................--*/
1310
1312 size_t SLen) {
1313 return wrap(MDString::get(*unwrap(C), StringRef(Str, SLen)));
1314}
1315
1320
1322 unsigned SLen) {
1323 LLVMContext &Context = *unwrap(C);
1325 Context, MDString::get(Context, StringRef(Str, SLen))));
1326}
1327
1328LLVMValueRef LLVMMDString(const char *Str, unsigned SLen) {
1330}
1331
1333 unsigned Count) {
1334 LLVMContext &Context = *unwrap(C);
1336 for (auto *OV : ArrayRef(Vals, Count)) {
1337 Value *V = unwrap(OV);
1338 Metadata *MD;
1339 if (!V)
1340 MD = nullptr;
1341 else if (auto *C = dyn_cast<Constant>(V))
1343 else if (auto *MDV = dyn_cast<MetadataAsValue>(V)) {
1344 MD = MDV->getMetadata();
1345 assert(!isa<LocalAsMetadata>(MD) && "Unexpected function-local metadata "
1346 "outside of direct argument to call");
1347 } else {
1348 // This is function-local metadata. Pretend to make an MDNode.
1349 assert(Count == 1 &&
1350 "Expected only one operand to function-local metadata");
1351 return wrap(MetadataAsValue::get(Context, LocalAsMetadata::get(V)));
1352 }
1353
1354 MDs.push_back(MD);
1355 }
1356 return wrap(MetadataAsValue::get(Context, MDNode::get(Context, MDs)));
1357}
1358
1362
1366
1368 auto *V = unwrap(Val);
1369 if (auto *C = dyn_cast<Constant>(V))
1371 if (auto *MAV = dyn_cast<MetadataAsValue>(V))
1372 return wrap(MAV->getMetadata());
1373 return wrap(ValueAsMetadata::get(V));
1374}
1375
1376const char *LLVMGetMDString(LLVMValueRef V, unsigned *Length) {
1377 if (const auto *MD = dyn_cast<MetadataAsValue>(unwrap(V)))
1378 if (const MDString *S = dyn_cast<MDString>(MD->getMetadata())) {
1379 *Length = S->getString().size();
1380 return S->getString().data();
1381 }
1382 *Length = 0;
1383 return nullptr;
1384}
1385
1387 auto *MD = unwrap<MetadataAsValue>(V);
1388 if (isa<ValueAsMetadata>(MD->getMetadata()))
1389 return 1;
1390 return cast<MDNode>(MD->getMetadata())->getNumOperands();
1391}
1392
1394 Module *Mod = unwrap(M);
1395 Module::named_metadata_iterator I = Mod->named_metadata_begin();
1396 if (I == Mod->named_metadata_end())
1397 return nullptr;
1398 return wrap(&*I);
1399}
1400
1402 Module *Mod = unwrap(M);
1403 Module::named_metadata_iterator I = Mod->named_metadata_end();
1404 if (I == Mod->named_metadata_begin())
1405 return nullptr;
1406 return wrap(&*--I);
1407}
1408
1410 NamedMDNode *NamedNode = unwrap(NMD);
1412 if (++I == NamedNode->getParent()->named_metadata_end())
1413 return nullptr;
1414 return wrap(&*I);
1415}
1416
1418 NamedMDNode *NamedNode = unwrap(NMD);
1420 if (I == NamedNode->getParent()->named_metadata_begin())
1421 return nullptr;
1422 return wrap(&*--I);
1423}
1424
1426 const char *Name, size_t NameLen) {
1427 return wrap(unwrap(M)->getNamedMetadata(StringRef(Name, NameLen)));
1428}
1429
1431 const char *Name, size_t NameLen) {
1432 return wrap(unwrap(M)->getOrInsertNamedMetadata({Name, NameLen}));
1433}
1434
1435const char *LLVMGetNamedMetadataName(LLVMNamedMDNodeRef NMD, size_t *NameLen) {
1436 NamedMDNode *NamedNode = unwrap(NMD);
1437 *NameLen = NamedNode->getName().size();
1438 return NamedNode->getName().data();
1439}
1440
1442 auto *MD = unwrap<MetadataAsValue>(V);
1443 if (auto *MDV = dyn_cast<ValueAsMetadata>(MD->getMetadata())) {
1444 *Dest = wrap(MDV->getValue());
1445 return;
1446 }
1447 const auto *N = cast<MDNode>(MD->getMetadata());
1448 const unsigned numOperands = N->getNumOperands();
1449 LLVMContext &Context = unwrap(V)->getContext();
1450 for (unsigned i = 0; i < numOperands; i++)
1451 Dest[i] = getMDNodeOperandImpl(Context, N, i);
1452}
1453
1455 LLVMMetadataRef Replacement) {
1456 auto *MD = cast<MetadataAsValue>(unwrap(V));
1457 auto *N = cast<MDNode>(MD->getMetadata());
1458 N->replaceOperandWith(Index, unwrap<Metadata>(Replacement));
1459}
1460
1461unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char *Name) {
1462 if (NamedMDNode *N = unwrap(M)->getNamedMetadata(Name)) {
1463 return N->getNumOperands();
1464 }
1465 return 0;
1466}
1467
1469 LLVMValueRef *Dest) {
1470 NamedMDNode *N = unwrap(M)->getNamedMetadata(Name);
1471 if (!N)
1472 return;
1473 LLVMContext &Context = unwrap(M)->getContext();
1474 for (unsigned i=0;i<N->getNumOperands();i++)
1475 Dest[i] = wrap(MetadataAsValue::get(Context, N->getOperand(i)));
1476}
1477
1479 LLVMValueRef Val) {
1480 NamedMDNode *N = unwrap(M)->getOrInsertNamedMetadata(Name);
1481 if (!N)
1482 return;
1483 if (!Val)
1484 return;
1485 N->addOperand(extractMDNode(unwrap<MetadataAsValue>(Val)));
1486}
1487
1488const char *LLVMGetDebugLocDirectory(LLVMValueRef Val, unsigned *Length) {
1489 if (!Length) return nullptr;
1490 StringRef S;
1491 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1492 if (const auto &DL = I->getDebugLoc()) {
1493 S = DL->getDirectory();
1494 }
1495 } else if (const auto *GV = dyn_cast<GlobalVariable>(unwrap(Val))) {
1497 GV->getDebugInfo(GVEs);
1498 if (GVEs.size())
1499 if (const DIGlobalVariable *DGV = GVEs[0]->getVariable())
1500 S = DGV->getDirectory();
1501 } else if (const auto *F = dyn_cast<Function>(unwrap(Val))) {
1502 if (const DISubprogram *DSP = F->getSubprogram())
1503 S = DSP->getDirectory();
1504 } else {
1505 assert(0 && "Expected Instruction, GlobalVariable or Function");
1506 return nullptr;
1507 }
1508 *Length = S.size();
1509 return S.data();
1510}
1511
1512const char *LLVMGetDebugLocFilename(LLVMValueRef Val, unsigned *Length) {
1513 if (!Length) return nullptr;
1514 StringRef S;
1515 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1516 if (const auto &DL = I->getDebugLoc()) {
1517 S = DL->getFilename();
1518 }
1519 } else if (const auto *GV = dyn_cast<GlobalVariable>(unwrap(Val))) {
1521 GV->getDebugInfo(GVEs);
1522 if (GVEs.size())
1523 if (const DIGlobalVariable *DGV = GVEs[0]->getVariable())
1524 S = DGV->getFilename();
1525 } else if (const auto *F = dyn_cast<Function>(unwrap(Val))) {
1526 if (const DISubprogram *DSP = F->getSubprogram())
1527 S = DSP->getFilename();
1528 } else {
1529 assert(0 && "Expected Instruction, GlobalVariable or Function");
1530 return nullptr;
1531 }
1532 *Length = S.size();
1533 return S.data();
1534}
1535
1537 unsigned L = 0;
1538 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1539 if (const auto &DL = I->getDebugLoc()) {
1540 L = DL->getLine();
1541 }
1542 } else if (const auto *GV = dyn_cast<GlobalVariable>(unwrap(Val))) {
1544 GV->getDebugInfo(GVEs);
1545 if (GVEs.size())
1546 if (const DIGlobalVariable *DGV = GVEs[0]->getVariable())
1547 L = DGV->getLine();
1548 } else if (const auto *F = dyn_cast<Function>(unwrap(Val))) {
1549 if (const DISubprogram *DSP = F->getSubprogram())
1550 L = DSP->getLine();
1551 } else {
1552 assert(0 && "Expected Instruction, GlobalVariable or Function");
1553 return -1;
1554 }
1555 return L;
1556}
1557
1559 unsigned C = 0;
1560 if (const auto *I = dyn_cast<Instruction>(unwrap(Val)))
1561 if (const auto &DL = I->getDebugLoc())
1562 C = DL->getColumn();
1563 return C;
1564}
1565
1566/*--.. Operations on scalar constants ......................................--*/
1567
1568LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N,
1569 LLVMBool SignExtend) {
1570 return wrap(ConstantInt::get(unwrap<IntegerType>(IntTy), N, SignExtend != 0));
1571}
1572
1574 unsigned NumWords,
1575 const uint64_t Words[]) {
1576 IntegerType *Ty = unwrap<IntegerType>(IntTy);
1577 return wrap(ConstantInt::get(
1578 Ty->getContext(), APInt(Ty->getBitWidth(), ArrayRef(Words, NumWords))));
1579}
1580
1582 uint8_t Radix) {
1583 return wrap(ConstantInt::get(unwrap<IntegerType>(IntTy), StringRef(Str),
1584 Radix));
1585}
1586
1588 unsigned SLen, uint8_t Radix) {
1589 return wrap(ConstantInt::get(unwrap<IntegerType>(IntTy), StringRef(Str, SLen),
1590 Radix));
1591}
1592
1593LLVMValueRef LLVMConstByte(LLVMTypeRef ByteTy, unsigned long long N) {
1594 return wrap(ConstantByte::get(unwrap<ByteType>(ByteTy), N));
1595}
1596
1598 unsigned NumWords,
1599 const uint64_t Words[]) {
1600 ByteType *Ty = unwrap<ByteType>(ByteTy);
1601 return wrap(ConstantByte::get(
1602 Ty->getContext(), APInt(Ty->getBitWidth(), ArrayRef(Words, NumWords))));
1603}
1604
1606 uint8_t Radix) {
1607 return wrap(
1608 ConstantByte::get(unwrap<ByteType>(ByteTy), StringRef(Str), Radix));
1609}
1610
1612 size_t SLen, uint8_t Radix) {
1613 return wrap(
1614 ConstantByte::get(unwrap<ByteType>(ByteTy), StringRef(Str, SLen), Radix));
1615}
1616
1618 return wrap(ConstantFP::get(unwrap(RealTy), N));
1619}
1620
1622 return wrap(ConstantFP::get(unwrap(RealTy), StringRef(Text)));
1623}
1624
1626 unsigned SLen) {
1627 return wrap(ConstantFP::get(unwrap(RealTy), StringRef(Str, SLen)));
1628}
1629
1631 Type *T = unwrap(Ty);
1632 unsigned SB = T->getScalarSizeInBits();
1633 APInt AI(SB, ArrayRef<uint64_t>(N, divideCeil(SB, 64)));
1634 APFloat Quad(T->getFltSemantics(), AI);
1635 return wrap(ConstantFP::get(T, Quad));
1636}
1637
1638unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal) {
1639 return unwrap<ConstantInt>(ConstantVal)->getZExtValue();
1640}
1641
1643 return unwrap<ConstantInt>(ConstantVal)->getSExtValue();
1644}
1645
1646unsigned long long LLVMConstByteGetZExtValue(LLVMValueRef ConstantVal) {
1647 return unwrap<ConstantByte>(ConstantVal)->getZExtValue();
1648}
1649
1651 return unwrap<ConstantByte>(ConstantVal)->getSExtValue();
1652}
1653
1654double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *LosesInfo) {
1655 ConstantFP *cFP = unwrap<ConstantFP>(ConstantVal) ;
1656 Type *Ty = cFP->getType();
1657
1658 if (Ty->isHalfTy() || Ty->isBFloatTy() || Ty->isFloatTy() ||
1659 Ty->isDoubleTy()) {
1660 *LosesInfo = false;
1661 return cFP->getValueAPF().convertToDouble();
1662 }
1663
1664 bool APFLosesInfo;
1665 APFloat APF = cFP->getValueAPF();
1667 *LosesInfo = APFLosesInfo;
1668 return APF.convertToDouble();
1669}
1670
1671/*--.. Operations on composite constants ...................................--*/
1672
1674 unsigned Length,
1675 LLVMBool DontNullTerminate) {
1676 /* Inverted the sense of AddNull because ', 0)' is a
1677 better mnemonic for null termination than ', 1)'. */
1679 DontNullTerminate == 0));
1680}
1681
1683 size_t Length,
1684 LLVMBool DontNullTerminate) {
1685 /* Inverted the sense of AddNull because ', 0)' is a
1686 better mnemonic for null termination than ', 1)'. */
1688 DontNullTerminate == 0));
1689}
1690
1691LLVMValueRef LLVMConstString(const char *Str, unsigned Length,
1692 LLVMBool DontNullTerminate) {
1694 DontNullTerminate);
1695}
1696
1698 return wrap(unwrap<Constant>(C)->getAggregateElement(Idx));
1699}
1700
1702 return wrap(unwrap<ConstantDataSequential>(C)->getElementAsConstant(idx));
1703}
1704
1708
1709const char *LLVMGetAsString(LLVMValueRef C, size_t *Length) {
1711 *Length = Str.size();
1712 return Str.data();
1713}
1714
1715const char *LLVMGetRawDataValues(LLVMValueRef C, size_t *SizeInBytes) {
1716 StringRef Str = unwrap<ConstantDataSequential>(C)->getRawDataValues();
1717 *SizeInBytes = Str.size();
1718 return Str.data();
1719}
1720
1722 LLVMValueRef *ConstantVals, unsigned Length) {
1724 return wrap(ConstantArray::get(ArrayType::get(unwrap(ElementTy), Length), V));
1725}
1726
1728 uint64_t Length) {
1730 return wrap(ConstantArray::get(ArrayType::get(unwrap(ElementTy), Length), V));
1731}
1732
1734 size_t SizeInBytes) {
1735 Type *Ty = unwrap(ElementTy);
1736 size_t Len = SizeInBytes / (Ty->getPrimitiveSizeInBits() / 8);
1737 return wrap(ConstantDataArray::getRaw(StringRef(Data, SizeInBytes), Len, Ty));
1738}
1739
1741 LLVMValueRef *ConstantVals,
1742 unsigned Count, LLVMBool Packed) {
1743 Constant **Elements = unwrap<Constant>(ConstantVals, Count);
1744 return wrap(ConstantStruct::getAnon(*unwrap(C), ArrayRef(Elements, Count),
1745 Packed != 0));
1746}
1747
1749 LLVMBool Packed) {
1751 Count, Packed);
1752}
1753
1755 LLVMValueRef *ConstantVals,
1756 unsigned Count) {
1757 Constant **Elements = unwrap<Constant>(ConstantVals, Count);
1758 StructType *Ty = unwrap<StructType>(StructTy);
1759
1760 return wrap(ConstantStruct::get(Ty, ArrayRef(Elements, Count)));
1761}
1762
1763LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size) {
1765 ArrayRef(unwrap<Constant>(ScalarConstantVals, Size), Size)));
1766}
1767
1776
1777/*-- Opcode mapping */
1778
1780{
1781 switch (opcode) {
1782 default: llvm_unreachable("Unhandled Opcode.");
1783#define HANDLE_INST(num, opc, clas) case num: return LLVM##opc;
1784#include "llvm/IR/Instruction.def"
1785#undef HANDLE_INST
1786 }
1787}
1788
1790{
1791 switch (code) {
1792#define HANDLE_INST(num, opc, clas) case LLVM##opc: return num;
1793#include "llvm/IR/Instruction.def"
1794#undef HANDLE_INST
1795 }
1796 llvm_unreachable("Unhandled Opcode.");
1797}
1798
1799/*-- GEP wrap flag conversions */
1800
1802 GEPNoWrapFlags NewGEPFlags;
1803 if ((GEPFlags & LLVMGEPFlagInBounds) != 0)
1804 NewGEPFlags |= GEPNoWrapFlags::inBounds();
1805 if ((GEPFlags & LLVMGEPFlagNUSW) != 0)
1806 NewGEPFlags |= GEPNoWrapFlags::noUnsignedSignedWrap();
1807 if ((GEPFlags & LLVMGEPFlagNUW) != 0)
1808 NewGEPFlags |= GEPNoWrapFlags::noUnsignedWrap();
1809
1810 return NewGEPFlags;
1811}
1812
1814 LLVMGEPNoWrapFlags NewGEPFlags = 0;
1815 if (GEPFlags.isInBounds())
1816 NewGEPFlags |= LLVMGEPFlagInBounds;
1817 if (GEPFlags.hasNoUnsignedSignedWrap())
1818 NewGEPFlags |= LLVMGEPFlagNUSW;
1819 if (GEPFlags.hasNoUnsignedWrap())
1820 NewGEPFlags |= LLVMGEPFlagNUW;
1821
1822 return NewGEPFlags;
1823}
1824
1825/*--.. Constant expressions ................................................--*/
1826
1830
1834
1838
1840 return wrap(ConstantExpr::getNeg(unwrap<Constant>(ConstantVal)));
1841}
1842
1846
1850
1851
1853 return wrap(ConstantExpr::getNot(unwrap<Constant>(ConstantVal)));
1854}
1855
1857 return wrap(ConstantExpr::getAdd(unwrap<Constant>(LHSConstant),
1858 unwrap<Constant>(RHSConstant)));
1859}
1860
1862 LLVMValueRef RHSConstant) {
1863 return wrap(ConstantExpr::getNSWAdd(unwrap<Constant>(LHSConstant),
1864 unwrap<Constant>(RHSConstant)));
1865}
1866
1868 LLVMValueRef RHSConstant) {
1869 return wrap(ConstantExpr::getNUWAdd(unwrap<Constant>(LHSConstant),
1870 unwrap<Constant>(RHSConstant)));
1871}
1872
1874 return wrap(ConstantExpr::getSub(unwrap<Constant>(LHSConstant),
1875 unwrap<Constant>(RHSConstant)));
1876}
1877
1879 LLVMValueRef RHSConstant) {
1880 return wrap(ConstantExpr::getNSWSub(unwrap<Constant>(LHSConstant),
1881 unwrap<Constant>(RHSConstant)));
1882}
1883
1885 LLVMValueRef RHSConstant) {
1886 return wrap(ConstantExpr::getNUWSub(unwrap<Constant>(LHSConstant),
1887 unwrap<Constant>(RHSConstant)));
1888}
1889
1891 return wrap(ConstantExpr::getXor(unwrap<Constant>(LHSConstant),
1892 unwrap<Constant>(RHSConstant)));
1893}
1894
1896 LLVMValueRef *ConstantIndices, unsigned NumIndices) {
1897 ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1898 NumIndices);
1899 Constant *Val = unwrap<Constant>(ConstantVal);
1900 return wrap(ConstantExpr::getGetElementPtr(unwrap(Ty), Val, IdxList));
1901}
1902
1904 LLVMValueRef *ConstantIndices,
1905 unsigned NumIndices) {
1906 ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1907 NumIndices);
1908 Constant *Val = unwrap<Constant>(ConstantVal);
1909 return wrap(ConstantExpr::getInBoundsGetElementPtr(unwrap(Ty), Val, IdxList));
1910}
1911
1913 LLVMValueRef ConstantVal,
1914 LLVMValueRef *ConstantIndices,
1915 unsigned NumIndices,
1916 LLVMGEPNoWrapFlags NoWrapFlags) {
1917 ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1918 NumIndices);
1919 Constant *Val = unwrap<Constant>(ConstantVal);
1921 unwrap(Ty), Val, IdxList, mapFromLLVMGEPNoWrapFlags(NoWrapFlags)));
1922}
1923
1925 return wrap(ConstantExpr::getTrunc(unwrap<Constant>(ConstantVal),
1926 unwrap(ToType)));
1927}
1928
1931 unwrap(ToType)));
1932}
1933
1936 unwrap(ToType)));
1937}
1938
1941 unwrap(ToType)));
1942}
1943
1945 LLVMTypeRef ToType) {
1947 unwrap(ToType)));
1948}
1949
1951 LLVMTypeRef ToType) {
1953 unwrap(ToType)));
1954}
1955
1957 LLVMTypeRef ToType) {
1959 unwrap(ToType)));
1960}
1961
1963 LLVMValueRef IndexConstant) {
1965 unwrap<Constant>(IndexConstant)));
1966}
1967
1969 LLVMValueRef ElementValueConstant,
1970 LLVMValueRef IndexConstant) {
1972 unwrap<Constant>(ElementValueConstant),
1973 unwrap<Constant>(IndexConstant)));
1974}
1975
1977 LLVMValueRef VectorBConstant,
1978 LLVMValueRef MaskConstant) {
1979 SmallVector<int, 16> IntMask;
1982 unwrap<Constant>(VectorBConstant),
1983 IntMask));
1984}
1985
1987 const char *Constraints,
1988 LLVMBool HasSideEffects,
1989 LLVMBool IsAlignStack) {
1990 return wrap(InlineAsm::get(dyn_cast<FunctionType>(unwrap(Ty)), AsmString,
1991 Constraints, HasSideEffects, IsAlignStack));
1992}
1993
1997
2001
2003 return wrap(unwrap<BlockAddress>(BlockAddr)->getBasicBlock());
2004}
2005
2006/*--.. Operations on global variables, functions, and aliases (globals) ....--*/
2007
2011
2015
2044
2047
2048 switch (Linkage) {
2051 break;
2054 break;
2057 break;
2060 break;
2062 LLVM_DEBUG(
2063 errs() << "LLVMSetLinkage(): LLVMLinkOnceODRAutoHideLinkage is no "
2064 "longer supported.");
2065 break;
2066 case LLVMWeakAnyLinkage:
2068 break;
2069 case LLVMWeakODRLinkage:
2071 break;
2074 break;
2077 break;
2078 case LLVMPrivateLinkage:
2080 break;
2083 break;
2086 break;
2088 LLVM_DEBUG(
2089 errs()
2090 << "LLVMSetLinkage(): LLVMDLLImportLinkage is no longer supported.");
2091 break;
2093 LLVM_DEBUG(
2094 errs()
2095 << "LLVMSetLinkage(): LLVMDLLExportLinkage is no longer supported.");
2096 break;
2099 break;
2100 case LLVMGhostLinkage:
2101 LLVM_DEBUG(
2102 errs() << "LLVMSetLinkage(): LLVMGhostLinkage is no longer supported.");
2103 break;
2104 case LLVMCommonLinkage:
2106 break;
2107 }
2108}
2109
2111 // Using .data() is safe because of how GlobalObject::setSection is
2112 // implemented.
2113 return unwrap<GlobalValue>(Global)->getSection().data();
2114}
2115
2116void LLVMSetSection(LLVMValueRef Global, const char *Section) {
2117 unwrap<GlobalObject>(Global)->setSection(Section);
2118}
2119
2121 return static_cast<LLVMVisibility>(
2122 unwrap<GlobalValue>(Global)->getVisibility());
2123}
2124
2127 ->setVisibility(static_cast<GlobalValue::VisibilityTypes>(Viz));
2128}
2129
2131 return static_cast<LLVMDLLStorageClass>(
2132 unwrap<GlobalValue>(Global)->getDLLStorageClass());
2133}
2134
2136 unwrap<GlobalValue>(Global)->setDLLStorageClass(
2137 static_cast<GlobalValue::DLLStorageClassTypes>(Class));
2138}
2139
2151
2164
2166 return unwrap<GlobalValue>(Global)->hasGlobalUnnamedAddr();
2167}
2168
2170 unwrap<GlobalValue>(Global)->setUnnamedAddr(
2171 HasUnnamedAddr ? GlobalValue::UnnamedAddr::Global
2173}
2174
2178
2179/*--.. Operations on global variables, load and store instructions .........--*/
2180
2182 Value *P = unwrap(V);
2184 return GV->getAlign() ? GV->getAlign()->value() : 0;
2186 return F->getAlign() ? F->getAlign()->value() : 0;
2188 return AI->getAlign().value();
2189 if (LoadInst *LI = dyn_cast<LoadInst>(P))
2190 return LI->getAlign().value();
2192 return SI->getAlign().value();
2194 return RMWI->getAlign().value();
2196 return CXI->getAlign().value();
2197
2199 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, "
2200 "and AtomicCmpXchgInst have alignment");
2201}
2202
2203void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes) {
2204 Value *P = unwrap(V);
2206 GV->setAlignment(MaybeAlign(Bytes));
2207 else if (Function *F = dyn_cast<Function>(P))
2208 F->setAlignment(MaybeAlign(Bytes));
2209 else if (AllocaInst *AI = dyn_cast<AllocaInst>(P))
2210 AI->setAlignment(Align(Bytes));
2211 else if (LoadInst *LI = dyn_cast<LoadInst>(P))
2212 LI->setAlignment(Align(Bytes));
2213 else if (StoreInst *SI = dyn_cast<StoreInst>(P))
2214 SI->setAlignment(Align(Bytes));
2215 else if (AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(P))
2216 RMWI->setAlignment(Align(Bytes));
2218 CXI->setAlignment(Align(Bytes));
2219 else
2221 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, and "
2222 "and AtomicCmpXchgInst have alignment");
2223}
2224
2226 size_t *NumEntries) {
2227 return llvm_getMetadata(NumEntries, [&Value](MetadataEntries &Entries) {
2228 Entries.clear();
2230 Instr->getAllMetadata(Entries);
2231 } else {
2232 unwrap<GlobalObject>(Value)->getAllMetadata(Entries);
2233 }
2234 });
2235}
2236
2238 unsigned Index) {
2240 static_cast<LLVMOpaqueValueMetadataEntry>(Entries[Index]);
2241 return MVE.Kind;
2242}
2243
2246 unsigned Index) {
2248 static_cast<LLVMOpaqueValueMetadataEntry>(Entries[Index]);
2249 return MVE.Metadata;
2250}
2251
2253 free(Entries);
2254}
2255
2257 LLVMMetadataRef MD) {
2258 unwrap<GlobalObject>(Global)->setMetadata(Kind, unwrap<MDNode>(MD));
2259}
2260
2262 LLVMMetadataRef MD) {
2263 unwrap<GlobalObject>(Global)->addMetadata(Kind, *unwrap<MDNode>(MD));
2264}
2265
2267 unwrap<GlobalObject>(Global)->eraseMetadata(Kind);
2268}
2269
2273
2278
2279/*--.. Operations on global variables ......................................--*/
2280
2282 return wrap(new GlobalVariable(*unwrap(M), unwrap(Ty), false,
2283 GlobalValue::ExternalLinkage, nullptr, Name));
2284}
2285
2287 const char *Name,
2288 unsigned AddressSpace) {
2289 return wrap(new GlobalVariable(*unwrap(M), unwrap(Ty), false,
2290 GlobalValue::ExternalLinkage, nullptr, Name,
2292 AddressSpace));
2293}
2294
2296 return wrap(unwrap(M)->getNamedGlobal(Name));
2297}
2298
2300 size_t Length) {
2301 return wrap(unwrap(M)->getNamedGlobal(StringRef(Name, Length)));
2302}
2303
2305 Module *Mod = unwrap(M);
2306 Module::global_iterator I = Mod->global_begin();
2307 if (I == Mod->global_end())
2308 return nullptr;
2309 return wrap(&*I);
2310}
2311
2313 Module *Mod = unwrap(M);
2314 Module::global_iterator I = Mod->global_end();
2315 if (I == Mod->global_begin())
2316 return nullptr;
2317 return wrap(&*--I);
2318}
2319
2321 GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2323 if (++I == GV->getParent()->global_end())
2324 return nullptr;
2325 return wrap(&*I);
2326}
2327
2329 GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2331 if (I == GV->getParent()->global_begin())
2332 return nullptr;
2333 return wrap(&*--I);
2334}
2335
2337 unwrap<GlobalVariable>(GlobalVar)->eraseFromParent();
2338}
2339
2341 GlobalVariable* GV = unwrap<GlobalVariable>(GlobalVar);
2342 if ( !GV->hasInitializer() )
2343 return nullptr;
2344 return wrap(GV->getInitializer());
2345}
2346
2347void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal) {
2348 unwrap<GlobalVariable>(GlobalVar)->setInitializer(
2349 ConstantVal ? unwrap<Constant>(ConstantVal) : nullptr);
2350}
2351
2353 return unwrap<GlobalVariable>(GlobalVar)->isThreadLocal();
2354}
2355
2356void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal) {
2357 unwrap<GlobalVariable>(GlobalVar)->setThreadLocal(IsThreadLocal != 0);
2358}
2359
2361 return unwrap<GlobalVariable>(GlobalVar)->isConstant();
2362}
2363
2364void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant) {
2365 unwrap<GlobalVariable>(GlobalVar)->setConstant(IsConstant != 0);
2366}
2367
2369 switch (unwrap<GlobalVariable>(GlobalVar)->getThreadLocalMode()) {
2371 return LLVMNotThreadLocal;
2379 return LLVMLocalExecTLSModel;
2380 }
2381
2382 llvm_unreachable("Invalid GlobalVariable thread local mode");
2383}
2384
2406
2408 return unwrap<GlobalVariable>(GlobalVar)->isExternallyInitialized();
2409}
2410
2412 unwrap<GlobalVariable>(GlobalVar)->setExternallyInitialized(IsExtInit);
2413}
2414
2415/*--.. Operations on aliases ......................................--*/
2416
2418 unsigned AddrSpace, LLVMValueRef Aliasee,
2419 const char *Name) {
2420 return wrap(GlobalAlias::create(unwrap(ValueTy), AddrSpace,
2422 unwrap<Constant>(Aliasee), unwrap(M)));
2423}
2424
2426 const char *Name, size_t NameLen) {
2427 return wrap(unwrap(M)->getNamedAlias(StringRef(Name, NameLen)));
2428}
2429
2431 Module *Mod = unwrap(M);
2432 Module::alias_iterator I = Mod->alias_begin();
2433 if (I == Mod->alias_end())
2434 return nullptr;
2435 return wrap(&*I);
2436}
2437
2439 Module *Mod = unwrap(M);
2440 Module::alias_iterator I = Mod->alias_end();
2441 if (I == Mod->alias_begin())
2442 return nullptr;
2443 return wrap(&*--I);
2444}
2445
2447 GlobalAlias *Alias = unwrap<GlobalAlias>(GA);
2449 if (++I == Alias->getParent()->alias_end())
2450 return nullptr;
2451 return wrap(&*I);
2452}
2453
2455 GlobalAlias *Alias = unwrap<GlobalAlias>(GA);
2457 if (I == Alias->getParent()->alias_begin())
2458 return nullptr;
2459 return wrap(&*--I);
2460}
2461
2463 return wrap(unwrap<GlobalAlias>(Alias)->getAliasee());
2464}
2465
2467 unwrap<GlobalAlias>(Alias)->setAliasee(unwrap<Constant>(Aliasee));
2468}
2469
2470/*--.. Operations on functions .............................................--*/
2471
2473 LLVMTypeRef FunctionTy) {
2474 return wrap(Function::Create(unwrap<FunctionType>(FunctionTy),
2476}
2477
2479 size_t NameLen, LLVMTypeRef FunctionTy) {
2480 return wrap(unwrap(M)
2481 ->getOrInsertFunction(StringRef(Name, NameLen),
2482 unwrap<FunctionType>(FunctionTy))
2483 .getCallee());
2484}
2485
2487 return wrap(unwrap(M)->getFunction(Name));
2488}
2489
2491 size_t Length) {
2492 return wrap(unwrap(M)->getFunction(StringRef(Name, Length)));
2493}
2494
2496 Module *Mod = unwrap(M);
2497 Module::iterator I = Mod->begin();
2498 if (I == Mod->end())
2499 return nullptr;
2500 return wrap(&*I);
2501}
2502
2504 Module *Mod = unwrap(M);
2505 Module::iterator I = Mod->end();
2506 if (I == Mod->begin())
2507 return nullptr;
2508 return wrap(&*--I);
2509}
2510
2512 Function *Func = unwrap<Function>(Fn);
2513 Module::iterator I(Func);
2514 if (++I == Func->getParent()->end())
2515 return nullptr;
2516 return wrap(&*I);
2517}
2518
2520 Function *Func = unwrap<Function>(Fn);
2521 Module::iterator I(Func);
2522 if (I == Func->getParent()->begin())
2523 return nullptr;
2524 return wrap(&*--I);
2525}
2526
2528 unwrap<Function>(Fn)->eraseFromParent();
2529}
2530
2532 return unwrap<Function>(Fn)->hasPersonalityFn();
2533}
2534
2536 return wrap(unwrap<Function>(Fn)->getPersonalityFn());
2537}
2538
2540 unwrap<Function>(Fn)->setPersonalityFn(
2541 PersonalityFn ? unwrap<Constant>(PersonalityFn) : nullptr);
2542}
2543
2545 if (Function *F = dyn_cast<Function>(unwrap(Fn)))
2546 return F->getIntrinsicID();
2547 return 0;
2548}
2549
2551 assert(ID < llvm::Intrinsic::num_intrinsics && "Intrinsic ID out of range");
2552 return llvm::Intrinsic::ID(ID);
2553}
2554
2556 unsigned ID,
2557 LLVMTypeRef *ParamTypes,
2558 size_t ParamCount) {
2559 ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
2560 auto IID = llvm_map_to_intrinsic_id(ID);
2562}
2563
2564const char *LLVMIntrinsicGetName(unsigned ID, size_t *NameLength) {
2565 auto IID = llvm_map_to_intrinsic_id(ID);
2566 auto Str = llvm::Intrinsic::getName(IID);
2567 *NameLength = Str.size();
2568 return Str.data();
2569}
2570
2572 LLVMTypeRef *ParamTypes, size_t ParamCount) {
2573 auto IID = llvm_map_to_intrinsic_id(ID);
2574 ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
2575 return wrap(llvm::Intrinsic::getType(*unwrap(Ctx), IID, Tys));
2576}
2577
2579 size_t ParamCount, size_t *NameLength) {
2580 auto IID = llvm_map_to_intrinsic_id(ID);
2581 ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
2582 auto Str = llvm::Intrinsic::getNameNoUnnamedTypes(IID, Tys);
2583 *NameLength = Str.length();
2584 return strdup(Str.c_str());
2585}
2586
2588 LLVMTypeRef *ParamTypes,
2589 size_t ParamCount, size_t *NameLength) {
2590 auto IID = llvm_map_to_intrinsic_id(ID);
2591 ArrayRef<Type *> Tys(unwrap(ParamTypes), ParamCount);
2592 auto Str = llvm::Intrinsic::getName(IID, Tys, unwrap(Mod));
2593 *NameLength = Str.length();
2594 return strdup(Str.c_str());
2595}
2596
2597unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen) {
2598 return Intrinsic::lookupIntrinsicID({Name, NameLen});
2599}
2600
2605
2607 return unwrap<Function>(Fn)->getCallingConv();
2608}
2609
2611 return unwrap<Function>(Fn)->setCallingConv(
2612 static_cast<CallingConv::ID>(CC));
2613}
2614
2615const char *LLVMGetGC(LLVMValueRef Fn) {
2617 return F->hasGC()? F->getGC().c_str() : nullptr;
2618}
2619
2620void LLVMSetGC(LLVMValueRef Fn, const char *GC) {
2622 if (GC)
2623 F->setGC(GC);
2624 else
2625 F->clearGC();
2626}
2627
2630 return wrap(F->getPrefixData());
2631}
2632
2635 return F->hasPrefixData();
2636}
2637
2640 Constant *prefix = unwrap<Constant>(prefixData);
2641 F->setPrefixData(prefix);
2642}
2643
2646 return wrap(F->getPrologueData());
2647}
2648
2651 return F->hasPrologueData();
2652}
2653
2656 Constant *prologue = unwrap<Constant>(prologueData);
2657 F->setPrologueData(prologue);
2658}
2659
2662 unwrap<Function>(F)->addAttributeAtIndex(Idx, unwrap(A));
2663}
2664
2666 auto AS = unwrap<Function>(F)->getAttributes().getAttributes(Idx);
2667 return AS.getNumAttributes();
2668}
2669
2671 LLVMAttributeRef *Attrs) {
2672 auto AS = unwrap<Function>(F)->getAttributes().getAttributes(Idx);
2673 for (auto A : AS)
2674 *Attrs++ = wrap(A);
2675}
2676
2679 unsigned KindID) {
2680 return wrap(unwrap<Function>(F)->getAttributeAtIndex(
2681 Idx, (Attribute::AttrKind)KindID));
2682}
2683
2686 const char *K, unsigned KLen) {
2687 return wrap(
2688 unwrap<Function>(F)->getAttributeAtIndex(Idx, StringRef(K, KLen)));
2689}
2690
2692 unsigned KindID) {
2693 unwrap<Function>(F)->removeAttributeAtIndex(Idx, (Attribute::AttrKind)KindID);
2694}
2695
2697 const char *K, unsigned KLen) {
2698 unwrap<Function>(F)->removeAttributeAtIndex(Idx, StringRef(K, KLen));
2699}
2700
2702 const char *V) {
2703 Function *Func = unwrap<Function>(Fn);
2704 Attribute Attr = Attribute::get(Func->getContext(), A, V);
2705 Func->addFnAttr(Attr);
2706}
2707
2708/*--.. Operations on parameters ............................................--*/
2709
2711 // This function is strictly redundant to
2712 // LLVMCountParamTypes(LLVMGlobalGetValueType(FnRef))
2713 return unwrap<Function>(FnRef)->arg_size();
2714}
2715
2716void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs) {
2717 Function *Fn = unwrap<Function>(FnRef);
2718 for (Argument &A : Fn->args())
2719 *ParamRefs++ = wrap(&A);
2720}
2721
2723 Function *Fn = unwrap<Function>(FnRef);
2724 return wrap(&Fn->arg_begin()[index]);
2725}
2726
2730
2732 Function *Func = unwrap<Function>(Fn);
2733 Function::arg_iterator I = Func->arg_begin();
2734 if (I == Func->arg_end())
2735 return nullptr;
2736 return wrap(&*I);
2737}
2738
2740 Function *Func = unwrap<Function>(Fn);
2741 Function::arg_iterator I = Func->arg_end();
2742 if (I == Func->arg_begin())
2743 return nullptr;
2744 return wrap(&*--I);
2745}
2746
2748 Argument *A = unwrap<Argument>(Arg);
2749 Function *Fn = A->getParent();
2750 if (A->getArgNo() + 1 >= Fn->arg_size())
2751 return nullptr;
2752 return wrap(&Fn->arg_begin()[A->getArgNo() + 1]);
2753}
2754
2756 Argument *A = unwrap<Argument>(Arg);
2757 if (A->getArgNo() == 0)
2758 return nullptr;
2759 return wrap(&A->getParent()->arg_begin()[A->getArgNo() - 1]);
2760}
2761
2762void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align) {
2763 Argument *A = unwrap<Argument>(Arg);
2764 A->addAttr(Attribute::getWithAlignment(A->getContext(), Align(align)));
2765}
2766
2767/*--.. Operations on ifuncs ................................................--*/
2768
2770 const char *Name, size_t NameLen,
2771 LLVMTypeRef Ty, unsigned AddrSpace,
2773 return wrap(GlobalIFunc::create(unwrap(Ty), AddrSpace,
2775 StringRef(Name, NameLen),
2777}
2778
2780 const char *Name, size_t NameLen) {
2781 return wrap(unwrap(M)->getNamedIFunc(StringRef(Name, NameLen)));
2782}
2783
2785 Module *Mod = unwrap(M);
2786 Module::ifunc_iterator I = Mod->ifunc_begin();
2787 if (I == Mod->ifunc_end())
2788 return nullptr;
2789 return wrap(&*I);
2790}
2791
2793 Module *Mod = unwrap(M);
2794 Module::ifunc_iterator I = Mod->ifunc_end();
2795 if (I == Mod->ifunc_begin())
2796 return nullptr;
2797 return wrap(&*--I);
2798}
2799
2801 GlobalIFunc *GIF = unwrap<GlobalIFunc>(IFunc);
2803 if (++I == GIF->getParent()->ifunc_end())
2804 return nullptr;
2805 return wrap(&*I);
2806}
2807
2809 GlobalIFunc *GIF = unwrap<GlobalIFunc>(IFunc);
2811 if (I == GIF->getParent()->ifunc_begin())
2812 return nullptr;
2813 return wrap(&*--I);
2814}
2815
2817 return wrap(unwrap<GlobalIFunc>(IFunc)->getResolver());
2818}
2819
2823
2825 unwrap<GlobalIFunc>(IFunc)->eraseFromParent();
2826}
2827
2829 unwrap<GlobalIFunc>(IFunc)->removeFromParent();
2830}
2831
2832/*--.. Operations on operand bundles........................................--*/
2833
2834LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, size_t TagLen,
2835 LLVMValueRef *Args,
2836 unsigned NumArgs) {
2837 return wrap(new OperandBundleDef(std::string(Tag, TagLen),
2838 ArrayRef(unwrap(Args), NumArgs)));
2839}
2840
2842 delete unwrap(Bundle);
2843}
2844
2845const char *LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len) {
2846 StringRef Str = unwrap(Bundle)->getTag();
2847 *Len = Str.size();
2848 return Str.data();
2849}
2850
2852 return unwrap(Bundle)->inputs().size();
2853}
2854
2856 unsigned Index) {
2857 return wrap(unwrap(Bundle)->inputs()[Index]);
2858}
2859
2860/*--.. Operations on basic blocks ..........................................--*/
2861
2863 return wrap(static_cast<Value*>(unwrap(BB)));
2864}
2865
2869
2873
2875 return unwrap(BB)->getName().data();
2876}
2877
2881
2883 return wrap(unwrap(BB)->getTerminator());
2884}
2885
2887 return unwrap<Function>(FnRef)->size();
2888}
2889
2891 Function *Fn = unwrap<Function>(FnRef);
2892 for (BasicBlock &BB : *Fn)
2893 *BasicBlocksRefs++ = wrap(&BB);
2894}
2895
2897 return wrap(&unwrap<Function>(Fn)->getEntryBlock());
2898}
2899
2901 Function *Func = unwrap<Function>(Fn);
2902 Function::iterator I = Func->begin();
2903 if (I == Func->end())
2904 return nullptr;
2905 return wrap(&*I);
2906}
2907
2909 Function *Func = unwrap<Function>(Fn);
2910 Function::iterator I = Func->end();
2911 if (I == Func->begin())
2912 return nullptr;
2913 return wrap(&*--I);
2914}
2915
2917 BasicBlock *Block = unwrap(BB);
2919 if (++I == Block->getParent()->end())
2920 return nullptr;
2921 return wrap(&*I);
2922}
2923
2925 BasicBlock *Block = unwrap(BB);
2927 if (I == Block->getParent()->begin())
2928 return nullptr;
2929 return wrap(&*--I);
2930}
2931
2936
2938 LLVMBasicBlockRef BB) {
2939 BasicBlock *ToInsert = unwrap(BB);
2940 BasicBlock *CurBB = unwrap(Builder)->GetInsertBlock();
2941 assert(CurBB && "current insertion point is invalid!");
2942 CurBB->getParent()->insert(std::next(CurBB->getIterator()), ToInsert);
2943}
2944
2946 LLVMBasicBlockRef BB) {
2947 unwrap<Function>(Fn)->insert(unwrap<Function>(Fn)->end(), unwrap(BB));
2948}
2949
2951 LLVMValueRef FnRef,
2952 const char *Name) {
2953 return wrap(BasicBlock::Create(*unwrap(C), Name, unwrap<Function>(FnRef)));
2954}
2955
2959
2961 LLVMBasicBlockRef BBRef,
2962 const char *Name) {
2963 BasicBlock *BB = unwrap(BBRef);
2964 return wrap(BasicBlock::Create(*unwrap(C), Name, BB->getParent(), BB));
2965}
2966
2971
2973 unwrap(BBRef)->eraseFromParent();
2974}
2975
2977 unwrap(BBRef)->removeFromParent();
2978}
2979
2981 unwrap(BB)->moveBefore(unwrap(MovePos));
2982}
2983
2985 unwrap(BB)->moveAfter(unwrap(MovePos));
2986}
2987
2988/*--.. Operations on instructions ..........................................--*/
2989
2993
2995 BasicBlock *Block = unwrap(BB);
2996 BasicBlock::iterator I = Block->begin();
2997 if (I == Block->end())
2998 return nullptr;
2999 return wrap(&*I);
3000}
3001
3003 BasicBlock *Block = unwrap(BB);
3004 BasicBlock::iterator I = Block->end();
3005 if (I == Block->begin())
3006 return nullptr;
3007 return wrap(&*--I);
3008}
3009
3011 Instruction *Instr = unwrap<Instruction>(Inst);
3012 BasicBlock::iterator I(Instr);
3013 if (++I == Instr->getParent()->end())
3014 return nullptr;
3015 return wrap(&*I);
3016}
3017
3019 Instruction *Instr = unwrap<Instruction>(Inst);
3020 BasicBlock::iterator I(Instr);
3021 if (I == Instr->getParent()->begin())
3022 return nullptr;
3023 return wrap(&*--I);
3024}
3025
3027 unwrap<Instruction>(Inst)->removeFromParent();
3028}
3029
3031 unwrap<Instruction>(Inst)->eraseFromParent();
3032}
3033
3035 unwrap<Instruction>(Inst)->deleteValue();
3036}
3037
3039 if (ICmpInst *I = dyn_cast<ICmpInst>(unwrap(Inst)))
3040 return (LLVMIntPredicate)I->getPredicate();
3041 return (LLVMIntPredicate)0;
3042}
3043
3045 return unwrap<ICmpInst>(Inst)->hasSameSign();
3046}
3047
3049 unwrap<ICmpInst>(Inst)->setSameSign(SameSign);
3050}
3051
3053 if (FCmpInst *I = dyn_cast<FCmpInst>(unwrap(Inst)))
3054 return (LLVMRealPredicate)I->getPredicate();
3055 return (LLVMRealPredicate)0;
3056}
3057
3060 return map_to_llvmopcode(C->getOpcode());
3061 return (LLVMOpcode)0;
3062}
3063
3066 return wrap(C->clone());
3067 return nullptr;
3068}
3069
3072 return (I && I->isTerminator()) ? wrap(I) : nullptr;
3073}
3074
3076 Instruction *Instr = unwrap<Instruction>(Inst);
3077 if (!Instr->DebugMarker)
3078 return nullptr;
3079 auto I = Instr->DebugMarker->StoredDbgRecords.begin();
3080 if (I == Instr->DebugMarker->StoredDbgRecords.end())
3081 return nullptr;
3082 return wrap(&*I);
3083}
3084
3086 Instruction *Instr = unwrap<Instruction>(Inst);
3087 if (!Instr->DebugMarker)
3088 return nullptr;
3089 auto I = Instr->DebugMarker->StoredDbgRecords.rbegin();
3090 if (I == Instr->DebugMarker->StoredDbgRecords.rend())
3091 return nullptr;
3092 return wrap(&*I);
3093}
3094
3098 if (++I == Record->getInstruction()->DebugMarker->StoredDbgRecords.end())
3099 return nullptr;
3100 return wrap(&*I);
3101}
3102
3106 if (I == Record->getInstruction()->DebugMarker->StoredDbgRecords.begin())
3107 return nullptr;
3108 return wrap(&*--I);
3109}
3110
3114
3118 return LLVMDbgRecordLabel;
3120 assert(VariableRecord && "unexpected record");
3121 if (VariableRecord->isDbgDeclare())
3122 return LLVMDbgRecordDeclare;
3123 if (VariableRecord->isDbgValue())
3124 return LLVMDbgRecordValue;
3125 assert(VariableRecord->isDbgAssign() && "unexpected record");
3126 return LLVMDbgRecordAssign;
3127}
3128
3133
3137
3141
3143 if (FuncletPadInst *FPI = dyn_cast<FuncletPadInst>(unwrap(Instr))) {
3144 return FPI->arg_size();
3145 }
3146 return unwrap<CallBase>(Instr)->arg_size();
3147}
3148
3149/*--.. Call and invoke instructions ........................................--*/
3150
3152 return unwrap<CallBase>(Instr)->getCallingConv();
3153}
3154
3156 return unwrap<CallBase>(Instr)->setCallingConv(
3157 static_cast<CallingConv::ID>(CC));
3158}
3159
3161 unsigned align) {
3162 auto *Call = unwrap<CallBase>(Instr);
3163 Attribute AlignAttr =
3164 Attribute::getWithAlignment(Call->getContext(), Align(align));
3165 Call->addAttributeAtIndex(Idx, AlignAttr);
3166}
3167
3170 unwrap<CallBase>(C)->addAttributeAtIndex(Idx, unwrap(A));
3171}
3172
3174 LLVMAttributeIndex Idx) {
3175 auto *Call = unwrap<CallBase>(C);
3176 auto AS = Call->getAttributes().getAttributes(Idx);
3177 return AS.getNumAttributes();
3178}
3179
3181 LLVMAttributeRef *Attrs) {
3182 auto *Call = unwrap<CallBase>(C);
3183 auto AS = Call->getAttributes().getAttributes(Idx);
3184 for (auto A : AS)
3185 *Attrs++ = wrap(A);
3186}
3187
3190 unsigned KindID) {
3191 return wrap(unwrap<CallBase>(C)->getAttributeAtIndex(
3192 Idx, (Attribute::AttrKind)KindID));
3193}
3194
3197 const char *K, unsigned KLen) {
3198 return wrap(
3199 unwrap<CallBase>(C)->getAttributeAtIndex(Idx, StringRef(K, KLen)));
3200}
3201
3203 unsigned KindID) {
3204 unwrap<CallBase>(C)->removeAttributeAtIndex(Idx, (Attribute::AttrKind)KindID);
3205}
3206
3208 const char *K, unsigned KLen) {
3209 unwrap<CallBase>(C)->removeAttributeAtIndex(Idx, StringRef(K, KLen));
3210}
3211
3213 return wrap(unwrap<CallBase>(Instr)->getCalledOperand());
3214}
3215
3217 return wrap(unwrap<CallBase>(Instr)->getFunctionType());
3218}
3219
3221 return unwrap<CallBase>(C)->getNumOperandBundles();
3222}
3223
3225 unsigned Index) {
3226 return wrap(
3227 new OperandBundleDef(unwrap<CallBase>(C)->getOperandBundleAt(Index)));
3228}
3229
3230/*--.. Operations on call instructions (only) ..............................--*/
3231
3233 return unwrap<CallInst>(Call)->isTailCall();
3234}
3235
3237 unwrap<CallInst>(Call)->setTailCall(isTailCall);
3238}
3239
3243
3247
3248/*--.. Operations on invoke instructions (only) ............................--*/
3249
3251 return wrap(unwrap<InvokeInst>(Invoke)->getNormalDest());
3252}
3253
3256 return wrap(CRI->getUnwindDest());
3257 } else if (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {
3258 return wrap(CSI->getUnwindDest());
3259 }
3260 return wrap(unwrap<InvokeInst>(Invoke)->getUnwindDest());
3261}
3262
3264 unwrap<InvokeInst>(Invoke)->setNormalDest(unwrap(B));
3265}
3266
3269 return CRI->setUnwindDest(unwrap(B));
3270 } else if (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {
3271 return CSI->setUnwindDest(unwrap(B));
3272 }
3273 unwrap<InvokeInst>(Invoke)->setUnwindDest(unwrap(B));
3274}
3275
3277 return wrap(unwrap<CallBrInst>(CallBr)->getDefaultDest());
3278}
3279
3281 return unwrap<CallBrInst>(CallBr)->getNumIndirectDests();
3282}
3283
3285 return wrap(unwrap<CallBrInst>(CallBr)->getIndirectDest(Idx));
3286}
3287
3288/*--.. Operations on terminators ...........................................--*/
3289
3291 return unwrap<Instruction>(Term)->getNumSuccessors();
3292}
3293
3295 return wrap(unwrap<Instruction>(Term)->getSuccessor(i));
3296}
3297
3299 return unwrap<Instruction>(Term)->setSuccessor(i, unwrap(block));
3300}
3301
3302/*--.. Operations on branch instructions (only) ............................--*/
3303
3307
3311
3313 return unwrap<CondBrInst>(Branch)->setCondition(unwrap(Cond));
3314}
3315
3316/*--.. Operations on switch instructions (only) ............................--*/
3317
3319 return wrap(unwrap<SwitchInst>(Switch)->getDefaultDest());
3320}
3321
3323 assert(i > 0 && i <= unwrap<SwitchInst>(Switch)->getNumCases());
3324 auto It = unwrap<SwitchInst>(Switch)->case_begin() + (i - 1);
3325 return wrap(It->getCaseValue());
3326}
3327
3328void LLVMSetSwitchCaseValue(LLVMValueRef Switch, unsigned i,
3329 LLVMValueRef CaseValue) {
3330 assert(i > 0 && i <= unwrap<SwitchInst>(Switch)->getNumCases());
3331 auto It = unwrap<SwitchInst>(Switch)->case_begin() + (i - 1);
3332 It->setValue(unwrap<ConstantInt>(CaseValue));
3333}
3334
3335/*--.. Operations on alloca instructions (only) ............................--*/
3336
3338 return wrap(unwrap<AllocaInst>(Alloca)->getAllocatedType());
3339}
3340
3341/*--.. Operations on gep instructions (only) ...............................--*/
3342
3344 return unwrap<GEPOperator>(GEP)->isInBounds();
3345}
3346
3348 return unwrap<GetElementPtrInst>(GEP)->setIsInBounds(InBounds);
3349}
3350
3354
3359
3364
3365/*--.. Operations on phi nodes .............................................--*/
3366
3367void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
3368 LLVMBasicBlockRef *IncomingBlocks, unsigned Count) {
3369 PHINode *PhiVal = unwrap<PHINode>(PhiNode);
3370 for (unsigned I = 0; I != Count; ++I)
3371 PhiVal->addIncoming(unwrap(IncomingValues[I]), unwrap(IncomingBlocks[I]));
3372}
3373
3375 return unwrap<PHINode>(PhiNode)->getNumIncomingValues();
3376}
3377
3379 return wrap(unwrap<PHINode>(PhiNode)->getIncomingValue(Index));
3380}
3381
3383 return wrap(unwrap<PHINode>(PhiNode)->getIncomingBlock(Index));
3384}
3385
3386/*--.. Operations on extractvalue and insertvalue nodes ....................--*/
3387
3389 auto *I = unwrap(Inst);
3390 if (auto *GEP = dyn_cast<GEPOperator>(I))
3391 return GEP->getNumIndices();
3392 if (auto *EV = dyn_cast<ExtractValueInst>(I))
3393 return EV->getNumIndices();
3394 if (auto *IV = dyn_cast<InsertValueInst>(I))
3395 return IV->getNumIndices();
3397 "LLVMGetNumIndices applies only to extractvalue and insertvalue!");
3398}
3399
3400const unsigned *LLVMGetIndices(LLVMValueRef Inst) {
3401 auto *I = unwrap(Inst);
3402 if (auto *EV = dyn_cast<ExtractValueInst>(I))
3403 return EV->getIndices().data();
3404 if (auto *IV = dyn_cast<InsertValueInst>(I))
3405 return IV->getIndices().data();
3407 "LLVMGetIndices applies only to extractvalue and insertvalue!");
3408}
3409
3410
3411/*===-- Instruction builders ----------------------------------------------===*/
3412
3416
3420
3422 Instruction *Instr, bool BeforeDbgRecords) {
3423 BasicBlock::iterator I = Instr ? Instr->getIterator() : Block->end();
3424 I.setHeadBit(BeforeDbgRecords);
3425 Builder->SetInsertPoint(Block, I);
3426}
3427
3429 LLVMValueRef Instr) {
3430 return LLVMPositionBuilderImpl(unwrap(Builder), unwrap(Block),
3431 unwrap<Instruction>(Instr), false);
3432}
3433
3440
3443 return LLVMPositionBuilderImpl(unwrap(Builder), I->getParent(), I, false);
3444}
3445
3447 LLVMValueRef Instr) {
3449 return LLVMPositionBuilderImpl(unwrap(Builder), I->getParent(), I, true);
3450}
3451
3453 BasicBlock *BB = unwrap(Block);
3454 unwrap(Builder)->SetInsertPoint(BB);
3455}
3456
3458 return wrap(unwrap(Builder)->GetInsertBlock());
3459}
3460
3462 unwrap(Builder)->ClearInsertionPoint();
3463}
3464
3466 unwrap(Builder)->Insert(unwrap<Instruction>(Instr));
3467}
3468
3470 const char *Name) {
3471 unwrap(Builder)->Insert(unwrap<Instruction>(Instr), Name);
3472}
3473
3475 delete unwrap(Builder);
3476}
3477
3478/*--.. Metadata builders ...................................................--*/
3479
3481 return wrap(unwrap(Builder)->getCurrentDebugLocation().getAsMDNode());
3482}
3483
3485 if (Loc)
3486 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(unwrap<MDNode>(Loc)));
3487 else
3488 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc());
3489}
3490
3492 MDNode *Loc =
3493 L ? cast<MDNode>(unwrap<MetadataAsValue>(L)->getMetadata()) : nullptr;
3494 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(Loc));
3495}
3496
3498 LLVMContext &Context = unwrap(Builder)->getContext();
3500 Context, unwrap(Builder)->getCurrentDebugLocation().getAsMDNode()));
3501}
3502
3504 unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
3505}
3506
3508 unwrap(Builder)->AddMetadataToInst(unwrap<Instruction>(Inst));
3509}
3510
3512 LLVMMetadataRef FPMathTag) {
3513
3514 unwrap(Builder)->setDefaultFPMathTag(FPMathTag
3515 ? unwrap<MDNode>(FPMathTag)
3516 : nullptr);
3517}
3518
3520 return wrap(&unwrap(Builder)->getContext());
3521}
3522
3524 return wrap(unwrap(Builder)->getDefaultFPMathTag());
3525}
3526
3527/*--.. Instruction builders ................................................--*/
3528
3530 return wrap(unwrap(B)->CreateRetVoid());
3531}
3532
3534 return wrap(unwrap(B)->CreateRet(unwrap(V)));
3535}
3536
3538 unsigned N) {
3539 return wrap(unwrap(B)->CreateAggregateRet({unwrap(RetVals), N}));
3540}
3541
3543 return wrap(unwrap(B)->CreateBr(unwrap(Dest)));
3544}
3545
3548 return wrap(unwrap(B)->CreateCondBr(unwrap(If), unwrap(Then), unwrap(Else)));
3549}
3550
3552 LLVMBasicBlockRef Else, unsigned NumCases) {
3553 return wrap(unwrap(B)->CreateSwitch(unwrap(V), unwrap(Else), NumCases));
3554}
3555
3557 unsigned NumDests) {
3558 return wrap(unwrap(B)->CreateIndirectBr(unwrap(Addr), NumDests));
3559}
3560
3562 LLVMBasicBlockRef DefaultDest,
3563 LLVMBasicBlockRef *IndirectDests,
3564 unsigned NumIndirectDests, LLVMValueRef *Args,
3565 unsigned NumArgs, LLVMOperandBundleRef *Bundles,
3566 unsigned NumBundles, const char *Name) {
3567
3569 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
3570 OperandBundleDef *OB = unwrap(Bundle);
3571 OBs.push_back(*OB);
3572 }
3573
3574 return wrap(unwrap(B)->CreateCallBr(
3575 unwrap<FunctionType>(Ty), unwrap(Fn), unwrap(DefaultDest),
3576 ArrayRef(unwrap(IndirectDests), NumIndirectDests),
3577 ArrayRef<Value *>(unwrap(Args), NumArgs), OBs, Name));
3578}
3579
3581 LLVMValueRef *Args, unsigned NumArgs,
3583 const char *Name) {
3584 return wrap(unwrap(B)->CreateInvoke(unwrap<FunctionType>(Ty), unwrap(Fn),
3585 unwrap(Then), unwrap(Catch),
3586 ArrayRef(unwrap(Args), NumArgs), Name));
3587}
3588
3591 unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
3592 LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name) {
3594 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
3595 OperandBundleDef *OB = unwrap(Bundle);
3596 OBs.push_back(*OB);
3597 }
3598 return wrap(unwrap(B)->CreateInvoke(
3599 unwrap<FunctionType>(Ty), unwrap(Fn), unwrap(Then), unwrap(Catch),
3600 ArrayRef(unwrap(Args), NumArgs), OBs, Name));
3601}
3602
3604 LLVMValueRef PersFn, unsigned NumClauses,
3605 const char *Name) {
3606 // The personality used to live on the landingpad instruction, but now it
3607 // lives on the parent function. For compatibility, take the provided
3608 // personality and put it on the parent function.
3609 if (PersFn)
3610 unwrap(B)->GetInsertBlock()->getParent()->setPersonalityFn(
3611 unwrap<Function>(PersFn));
3612 return wrap(unwrap(B)->CreateLandingPad(unwrap(Ty), NumClauses, Name));
3613}
3614
3616 LLVMValueRef *Args, unsigned NumArgs,
3617 const char *Name) {
3618 return wrap(unwrap(B)->CreateCatchPad(unwrap(ParentPad),
3619 ArrayRef(unwrap(Args), NumArgs), Name));
3620}
3621
3623 LLVMValueRef *Args, unsigned NumArgs,
3624 const char *Name) {
3625 if (ParentPad == nullptr) {
3626 Type *Ty = Type::getTokenTy(unwrap(B)->getContext());
3627 ParentPad = wrap(Constant::getNullValue(Ty));
3628 }
3629 return wrap(unwrap(B)->CreateCleanupPad(
3630 unwrap(ParentPad), ArrayRef(unwrap(Args), NumArgs), Name));
3631}
3632
3634 return wrap(unwrap(B)->CreateResume(unwrap(Exn)));
3635}
3636
3638 LLVMBasicBlockRef UnwindBB,
3639 unsigned NumHandlers, const char *Name) {
3640 if (ParentPad == nullptr) {
3641 Type *Ty = Type::getTokenTy(unwrap(B)->getContext());
3642 ParentPad = wrap(Constant::getNullValue(Ty));
3643 }
3644 return wrap(unwrap(B)->CreateCatchSwitch(unwrap(ParentPad), unwrap(UnwindBB),
3645 NumHandlers, Name));
3646}
3647
3649 LLVMBasicBlockRef BB) {
3650 return wrap(unwrap(B)->CreateCatchRet(unwrap<CatchPadInst>(CatchPad),
3651 unwrap(BB)));
3652}
3653
3655 LLVMBasicBlockRef BB) {
3656 return wrap(unwrap(B)->CreateCleanupRet(unwrap<CleanupPadInst>(CatchPad),
3657 unwrap(BB)));
3658}
3659
3661 return wrap(unwrap(B)->CreateUnreachable());
3662}
3663
3665 LLVMBasicBlockRef Dest) {
3666 unwrap<SwitchInst>(Switch)->addCase(unwrap<ConstantInt>(OnVal), unwrap(Dest));
3667}
3668
3670 unwrap<IndirectBrInst>(IndirectBr)->addDestination(unwrap(Dest));
3671}
3672
3673unsigned LLVMGetNumClauses(LLVMValueRef LandingPad) {
3674 return unwrap<LandingPadInst>(LandingPad)->getNumClauses();
3675}
3676
3677LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx) {
3678 return wrap(unwrap<LandingPadInst>(LandingPad)->getClause(Idx));
3679}
3680
3681void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal) {
3682 unwrap<LandingPadInst>(LandingPad)->addClause(unwrap<Constant>(ClauseVal));
3683}
3684
3686 return unwrap<LandingPadInst>(LandingPad)->isCleanup();
3687}
3688
3689void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val) {
3690 unwrap<LandingPadInst>(LandingPad)->setCleanup(Val);
3691}
3692
3694 unwrap<CatchSwitchInst>(CatchSwitch)->addHandler(unwrap(Dest));
3695}
3696
3697unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch) {
3698 return unwrap<CatchSwitchInst>(CatchSwitch)->getNumHandlers();
3699}
3700
3701void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers) {
3702 CatchSwitchInst *CSI = unwrap<CatchSwitchInst>(CatchSwitch);
3703 for (const BasicBlock *H : CSI->handlers())
3704 *Handlers++ = wrap(H);
3705}
3706
3708 return wrap(unwrap<CatchPadInst>(CatchPad)->getCatchSwitch());
3709}
3710
3712 unwrap<CatchPadInst>(CatchPad)
3713 ->setCatchSwitch(unwrap<CatchSwitchInst>(CatchSwitch));
3714}
3715
3716/*--.. Funclets ...........................................................--*/
3717
3719 return wrap(unwrap<FuncletPadInst>(Funclet)->getArgOperand(i));
3720}
3721
3722void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value) {
3723 unwrap<FuncletPadInst>(Funclet)->setArgOperand(i, unwrap(value));
3724}
3725
3726/*--.. Arithmetic ..........................................................--*/
3727
3729 FastMathFlags NewFMF;
3730 NewFMF.setAllowReassoc((FMF & LLVMFastMathAllowReassoc) != 0);
3731 NewFMF.setNoNaNs((FMF & LLVMFastMathNoNaNs) != 0);
3732 NewFMF.setNoInfs((FMF & LLVMFastMathNoInfs) != 0);
3733 NewFMF.setNoSignedZeros((FMF & LLVMFastMathNoSignedZeros) != 0);
3735 NewFMF.setAllowContract((FMF & LLVMFastMathAllowContract) != 0);
3736 NewFMF.setApproxFunc((FMF & LLVMFastMathApproxFunc) != 0);
3737
3738 return NewFMF;
3739}
3740
3743 if (FMF.allowReassoc())
3744 NewFMF |= LLVMFastMathAllowReassoc;
3745 if (FMF.noNaNs())
3746 NewFMF |= LLVMFastMathNoNaNs;
3747 if (FMF.noInfs())
3748 NewFMF |= LLVMFastMathNoInfs;
3749 if (FMF.noSignedZeros())
3750 NewFMF |= LLVMFastMathNoSignedZeros;
3751 if (FMF.allowReciprocal())
3753 if (FMF.allowContract())
3754 NewFMF |= LLVMFastMathAllowContract;
3755 if (FMF.approxFunc())
3756 NewFMF |= LLVMFastMathApproxFunc;
3757
3758 return NewFMF;
3759}
3760
3762 const char *Name) {
3763 return wrap(unwrap(B)->CreateAdd(unwrap(LHS), unwrap(RHS), Name));
3764}
3765
3767 const char *Name) {
3768 return wrap(unwrap(B)->CreateNSWAdd(unwrap(LHS), unwrap(RHS), Name));
3769}
3770
3772 const char *Name) {
3773 return wrap(unwrap(B)->CreateNUWAdd(unwrap(LHS), unwrap(RHS), Name));
3774}
3775
3777 const char *Name) {
3778 return wrap(unwrap(B)->CreateFAdd(unwrap(LHS), unwrap(RHS), Name));
3779}
3780
3782 const char *Name) {
3783 return wrap(unwrap(B)->CreateSub(unwrap(LHS), unwrap(RHS), Name));
3784}
3785
3787 const char *Name) {
3788 return wrap(unwrap(B)->CreateNSWSub(unwrap(LHS), unwrap(RHS), Name));
3789}
3790
3792 const char *Name) {
3793 return wrap(unwrap(B)->CreateNUWSub(unwrap(LHS), unwrap(RHS), Name));
3794}
3795
3797 const char *Name) {
3798 return wrap(unwrap(B)->CreateFSub(unwrap(LHS), unwrap(RHS), Name));
3799}
3800
3802 const char *Name) {
3803 return wrap(unwrap(B)->CreateMul(unwrap(LHS), unwrap(RHS), Name));
3804}
3805
3807 const char *Name) {
3808 return wrap(unwrap(B)->CreateNSWMul(unwrap(LHS), unwrap(RHS), Name));
3809}
3810
3812 const char *Name) {
3813 return wrap(unwrap(B)->CreateNUWMul(unwrap(LHS), unwrap(RHS), Name));
3814}
3815
3817 const char *Name) {
3818 return wrap(unwrap(B)->CreateFMul(unwrap(LHS), unwrap(RHS), Name));
3819}
3820
3822 const char *Name) {
3823 return wrap(unwrap(B)->CreateUDiv(unwrap(LHS), unwrap(RHS), Name));
3824}
3825
3827 LLVMValueRef RHS, const char *Name) {
3828 return wrap(unwrap(B)->CreateExactUDiv(unwrap(LHS), unwrap(RHS), Name));
3829}
3830
3832 const char *Name) {
3833 return wrap(unwrap(B)->CreateSDiv(unwrap(LHS), unwrap(RHS), Name));
3834}
3835
3837 LLVMValueRef RHS, const char *Name) {
3838 return wrap(unwrap(B)->CreateExactSDiv(unwrap(LHS), unwrap(RHS), Name));
3839}
3840
3842 const char *Name) {
3843 return wrap(unwrap(B)->CreateFDiv(unwrap(LHS), unwrap(RHS), Name));
3844}
3845
3847 const char *Name) {
3848 return wrap(unwrap(B)->CreateURem(unwrap(LHS), unwrap(RHS), Name));
3849}
3850
3852 const char *Name) {
3853 return wrap(unwrap(B)->CreateSRem(unwrap(LHS), unwrap(RHS), Name));
3854}
3855
3857 const char *Name) {
3858 return wrap(unwrap(B)->CreateFRem(unwrap(LHS), unwrap(RHS), Name));
3859}
3860
3862 const char *Name) {
3863 return wrap(unwrap(B)->CreateShl(unwrap(LHS), unwrap(RHS), Name));
3864}
3865
3867 const char *Name) {
3868 return wrap(unwrap(B)->CreateLShr(unwrap(LHS), unwrap(RHS), Name));
3869}
3870
3872 const char *Name) {
3873 return wrap(unwrap(B)->CreateAShr(unwrap(LHS), unwrap(RHS), Name));
3874}
3875
3877 const char *Name) {
3878 return wrap(unwrap(B)->CreateAnd(unwrap(LHS), unwrap(RHS), Name));
3879}
3880
3882 const char *Name) {
3883 return wrap(unwrap(B)->CreateOr(unwrap(LHS), unwrap(RHS), Name));
3884}
3885
3887 const char *Name) {
3888 return wrap(unwrap(B)->CreateXor(unwrap(LHS), unwrap(RHS), Name));
3889}
3890
3897
3899 return wrap(unwrap(B)->CreateNeg(unwrap(V), Name));
3900}
3901
3903 const char *Name) {
3904 return wrap(unwrap(B)->CreateNSWNeg(unwrap(V), Name));
3905}
3906
3908 const char *Name) {
3909 Value *Neg = unwrap(B)->CreateNeg(unwrap(V), Name);
3910 if (auto *I = dyn_cast<BinaryOperator>(Neg))
3911 I->setHasNoUnsignedWrap();
3912 return wrap(Neg);
3913}
3914
3916 return wrap(unwrap(B)->CreateFNeg(unwrap(V), Name));
3917}
3918
3920 return wrap(unwrap(B)->CreateNot(unwrap(V), Name));
3921}
3922
3924 Value *P = unwrap<Value>(ArithInst);
3925 return cast<Instruction>(P)->hasNoUnsignedWrap();
3926}
3927
3928void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW) {
3929 Value *P = unwrap<Value>(ArithInst);
3930 cast<Instruction>(P)->setHasNoUnsignedWrap(HasNUW);
3931}
3932
3934 Value *P = unwrap<Value>(ArithInst);
3935 return cast<Instruction>(P)->hasNoSignedWrap();
3936}
3937
3938void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW) {
3939 Value *P = unwrap<Value>(ArithInst);
3940 cast<Instruction>(P)->setHasNoSignedWrap(HasNSW);
3941}
3942
3944 Value *P = unwrap<Value>(DivOrShrInst);
3945 return cast<Instruction>(P)->isExact();
3946}
3947
3948void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact) {
3949 Value *P = unwrap<Value>(DivOrShrInst);
3950 cast<Instruction>(P)->setIsExact(IsExact);
3951}
3952
3954 Value *P = unwrap<Value>(NonNegInst);
3955 return cast<Instruction>(P)->hasNonNeg();
3956}
3957
3958void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg) {
3959 Value *P = unwrap<Value>(NonNegInst);
3960 cast<Instruction>(P)->setNonNeg(IsNonNeg);
3961}
3962
3964 Value *P = unwrap<Value>(FPMathInst);
3965 FastMathFlags FMF = cast<Instruction>(P)->getFastMathFlags();
3966 return mapToLLVMFastMathFlags(FMF);
3967}
3968
3970 Value *P = unwrap<Value>(FPMathInst);
3971 cast<Instruction>(P)->setFastMathFlags(mapFromLLVMFastMathFlags(FMF));
3972}
3973
3978
3980 Value *P = unwrap<Value>(Inst);
3981 return cast<PossiblyDisjointInst>(P)->isDisjoint();
3982}
3983
3985 Value *P = unwrap<Value>(Inst);
3986 cast<PossiblyDisjointInst>(P)->setIsDisjoint(IsDisjoint);
3987}
3988
3989/*--.. Memory ..............................................................--*/
3990
3992 const char *Name) {
3993 Type* ITy = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext());
3994 Constant* AllocSize = ConstantExpr::getSizeOf(unwrap(Ty));
3995 AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, ITy);
3996 return wrap(unwrap(B)->CreateMalloc(ITy, unwrap(Ty), AllocSize, nullptr,
3997 nullptr, Name));
3998}
3999
4001 LLVMValueRef Val, const char *Name) {
4002 Type* ITy = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext());
4003 Constant* AllocSize = ConstantExpr::getSizeOf(unwrap(Ty));
4004 AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, ITy);
4005 return wrap(unwrap(B)->CreateMalloc(ITy, unwrap(Ty), AllocSize, unwrap(Val),
4006 nullptr, Name));
4007}
4008
4010 LLVMValueRef Val, LLVMValueRef Len,
4011 unsigned Align) {
4012 return wrap(unwrap(B)->CreateMemSet(unwrap(Ptr), unwrap(Val), unwrap(Len),
4013 MaybeAlign(Align)));
4014}
4015
4017 LLVMValueRef Dst, unsigned DstAlign,
4018 LLVMValueRef Src, unsigned SrcAlign,
4020 return wrap(unwrap(B)->CreateMemCpy(unwrap(Dst), MaybeAlign(DstAlign),
4021 unwrap(Src), MaybeAlign(SrcAlign),
4022 unwrap(Size)));
4023}
4024
4026 LLVMValueRef Dst, unsigned DstAlign,
4027 LLVMValueRef Src, unsigned SrcAlign,
4029 return wrap(unwrap(B)->CreateMemMove(unwrap(Dst), MaybeAlign(DstAlign),
4030 unwrap(Src), MaybeAlign(SrcAlign),
4031 unwrap(Size)));
4032}
4033
4035 const char *Name) {
4036 return wrap(unwrap(B)->CreateAlloca(unwrap(Ty), nullptr, Name));
4037}
4038
4040 LLVMValueRef Val, const char *Name) {
4041 return wrap(unwrap(B)->CreateAlloca(unwrap(Ty), unwrap(Val), Name));
4042}
4043
4045 return wrap(unwrap(B)->CreateFree(unwrap(PointerVal)));
4046}
4047
4049 LLVMValueRef PointerVal, const char *Name) {
4050 return wrap(unwrap(B)->CreateLoad(unwrap(Ty), unwrap(PointerVal), Name));
4051}
4052
4054 LLVMValueRef PointerVal) {
4055 return wrap(unwrap(B)->CreateStore(unwrap(Val), unwrap(PointerVal)));
4056}
4057
4073
4089
4091 switch (BinOp) {
4123 }
4124
4125 llvm_unreachable("Invalid LLVMAtomicRMWBinOp value!");
4126}
4127
4129 switch (BinOp) {
4161 default: break;
4162 }
4163
4164 llvm_unreachable("Invalid AtomicRMWBinOp value!");
4165}
4166
4168 LLVMBool isSingleThread, const char *Name) {
4169 return wrap(
4170 unwrap(B)->CreateFence(mapFromLLVMOrdering(Ordering),
4171 isSingleThread ? SyncScope::SingleThread
4173 Name));
4174}
4175
4177 LLVMAtomicOrdering Ordering, unsigned SSID,
4178 const char *Name) {
4179 return wrap(
4180 unwrap(B)->CreateFence(mapFromLLVMOrdering(Ordering), SSID, Name));
4181}
4182
4184 LLVMValueRef Pointer, LLVMValueRef *Indices,
4185 unsigned NumIndices, const char *Name) {
4186 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4187 return wrap(unwrap(B)->CreateGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name));
4188}
4189
4191 LLVMValueRef Pointer, LLVMValueRef *Indices,
4192 unsigned NumIndices, const char *Name) {
4193 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4194 return wrap(
4195 unwrap(B)->CreateInBoundsGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name));
4196}
4197
4199 LLVMValueRef Pointer,
4200 LLVMValueRef *Indices,
4201 unsigned NumIndices, const char *Name,
4202 LLVMGEPNoWrapFlags NoWrapFlags) {
4203 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4204 return wrap(unwrap(B)->CreateGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name,
4205 mapFromLLVMGEPNoWrapFlags(NoWrapFlags)));
4206}
4207
4209 LLVMValueRef Pointer, unsigned Idx,
4210 const char *Name) {
4211 return wrap(
4212 unwrap(B)->CreateStructGEP(unwrap(Ty), unwrap(Pointer), Idx, Name));
4213}
4214
4216 const char *Name) {
4217 return wrap(unwrap(B)->CreateGlobalString(Str, Name));
4218}
4219
4221 const char *Name) {
4222 return wrap(unwrap(B)->CreateGlobalString(Str, Name));
4223}
4224
4226 return cast<Instruction>(unwrap(Inst))->isVolatile();
4227}
4228
4229void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile) {
4230 Value *P = unwrap(MemAccessInst);
4231 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4232 return LI->setVolatile(isVolatile);
4234 return SI->setVolatile(isVolatile);
4236 return AI->setVolatile(isVolatile);
4237 return cast<AtomicCmpXchgInst>(P)->setVolatile(isVolatile);
4238}
4239
4241 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->isWeak();
4242}
4243
4244void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak) {
4245 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->setWeak(isWeak);
4246}
4247
4249 Value *P = unwrap(MemAccessInst);
4251 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4252 O = LI->getOrdering();
4253 else if (StoreInst *SI = dyn_cast<StoreInst>(P))
4254 O = SI->getOrdering();
4255 else if (FenceInst *FI = dyn_cast<FenceInst>(P))
4256 O = FI->getOrdering();
4257 else
4258 O = cast<AtomicRMWInst>(P)->getOrdering();
4259 return mapToLLVMOrdering(O);
4260}
4261
4262void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering) {
4263 Value *P = unwrap(MemAccessInst);
4264 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4265
4266 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4267 return LI->setOrdering(O);
4268 else if (FenceInst *FI = dyn_cast<FenceInst>(P))
4269 return FI->setOrdering(O);
4270 else if (AtomicRMWInst *ARWI = dyn_cast<AtomicRMWInst>(P))
4271 return ARWI->setOrdering(O);
4272 return cast<StoreInst>(P)->setOrdering(O);
4273}
4274
4278
4280 unwrap<AtomicRMWInst>(Inst)->setOperation(mapFromLLVMRMWBinOp(BinOp));
4281}
4282
4283/*--.. Casts ...............................................................--*/
4284
4286 LLVMTypeRef DestTy, const char *Name) {
4287 return wrap(unwrap(B)->CreateTrunc(unwrap(Val), unwrap(DestTy), Name));
4288}
4289
4291 LLVMTypeRef DestTy, const char *Name) {
4292 return wrap(unwrap(B)->CreateZExt(unwrap(Val), unwrap(DestTy), Name));
4293}
4294
4296 LLVMTypeRef DestTy, const char *Name) {
4297 return wrap(unwrap(B)->CreateSExt(unwrap(Val), unwrap(DestTy), Name));
4298}
4299
4301 LLVMTypeRef DestTy, const char *Name) {
4302 return wrap(unwrap(B)->CreateFPToUI(unwrap(Val), unwrap(DestTy), Name));
4303}
4304
4306 LLVMTypeRef DestTy, const char *Name) {
4307 return wrap(unwrap(B)->CreateFPToSI(unwrap(Val), unwrap(DestTy), Name));
4308}
4309
4311 LLVMTypeRef DestTy, const char *Name) {
4312 return wrap(unwrap(B)->CreateUIToFP(unwrap(Val), unwrap(DestTy), Name));
4313}
4314
4316 LLVMTypeRef DestTy, const char *Name) {
4317 return wrap(unwrap(B)->CreateSIToFP(unwrap(Val), unwrap(DestTy), Name));
4318}
4319
4321 LLVMTypeRef DestTy, const char *Name) {
4322 return wrap(unwrap(B)->CreateFPTrunc(unwrap(Val), unwrap(DestTy), Name));
4323}
4324
4326 LLVMTypeRef DestTy, const char *Name) {
4327 return wrap(unwrap(B)->CreateFPExt(unwrap(Val), unwrap(DestTy), Name));
4328}
4329
4331 LLVMTypeRef DestTy, const char *Name) {
4332 return wrap(unwrap(B)->CreatePtrToInt(unwrap(Val), unwrap(DestTy), Name));
4333}
4334
4336 LLVMTypeRef DestTy, const char *Name) {
4337 return wrap(unwrap(B)->CreateIntToPtr(unwrap(Val), unwrap(DestTy), Name));
4338}
4339
4341 LLVMTypeRef DestTy, const char *Name) {
4342 return wrap(unwrap(B)->CreateBitCast(unwrap(Val), unwrap(DestTy), Name));
4343}
4344
4346 LLVMTypeRef DestTy, const char *Name) {
4347 return wrap(unwrap(B)->CreateAddrSpaceCast(unwrap(Val), unwrap(DestTy), Name));
4348}
4349
4351 LLVMTypeRef DestTy, const char *Name) {
4352 return wrap(unwrap(B)->CreateZExtOrBitCast(unwrap(Val), unwrap(DestTy),
4353 Name));
4354}
4355
4357 LLVMTypeRef DestTy, const char *Name) {
4358 return wrap(unwrap(B)->CreateSExtOrBitCast(unwrap(Val), unwrap(DestTy),
4359 Name));
4360}
4361
4363 LLVMTypeRef DestTy, const char *Name) {
4364 return wrap(unwrap(B)->CreateTruncOrBitCast(unwrap(Val), unwrap(DestTy),
4365 Name));
4366}
4367
4369 LLVMTypeRef DestTy, const char *Name) {
4370 return wrap(unwrap(B)->CreateCast(Instruction::CastOps(map_from_llvmopcode(Op)), unwrap(Val),
4371 unwrap(DestTy), Name));
4372}
4373
4375 LLVMTypeRef DestTy, const char *Name) {
4376 return wrap(unwrap(B)->CreatePointerCast(unwrap(Val), unwrap(DestTy), Name));
4377}
4378
4380 LLVMTypeRef DestTy, LLVMBool IsSigned,
4381 const char *Name) {
4382 return wrap(
4383 unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy), IsSigned, Name));
4384}
4385
4387 LLVMTypeRef DestTy, const char *Name) {
4388 return wrap(unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy),
4389 /*isSigned*/true, Name));
4390}
4391
4393 LLVMTypeRef DestTy, const char *Name) {
4394 return wrap(unwrap(B)->CreateFPCast(unwrap(Val), unwrap(DestTy), Name));
4395}
4396
4398 LLVMTypeRef DestTy, LLVMBool DestIsSigned) {
4400 unwrap(Src), SrcIsSigned, unwrap(DestTy), DestIsSigned));
4401}
4402
4403/*--.. Comparisons .........................................................--*/
4404
4407 const char *Name) {
4408 return wrap(unwrap(B)->CreateICmp(static_cast<ICmpInst::Predicate>(Op),
4409 unwrap(LHS), unwrap(RHS), Name));
4410}
4411
4414 const char *Name) {
4415 return wrap(unwrap(B)->CreateFCmp(static_cast<FCmpInst::Predicate>(Op),
4416 unwrap(LHS), unwrap(RHS), Name));
4417}
4418
4419/*--.. Miscellaneous instructions ..........................................--*/
4420
4422 return wrap(unwrap(B)->CreatePHI(unwrap(Ty), 0, Name));
4423}
4424
4426 LLVMValueRef *Args, unsigned NumArgs,
4427 const char *Name) {
4429 return wrap(unwrap(B)->CreateCall(FTy, unwrap(Fn),
4430 ArrayRef(unwrap(Args), NumArgs), Name));
4431}
4432
4435 LLVMValueRef Fn, LLVMValueRef *Args,
4436 unsigned NumArgs, LLVMOperandBundleRef *Bundles,
4437 unsigned NumBundles, const char *Name) {
4440 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
4441 OperandBundleDef *OB = unwrap(Bundle);
4442 OBs.push_back(*OB);
4443 }
4444 return wrap(unwrap(B)->CreateCall(
4445 FTy, unwrap(Fn), ArrayRef(unwrap(Args), NumArgs), OBs, Name));
4446}
4447
4449 LLVMValueRef Then, LLVMValueRef Else,
4450 const char *Name) {
4451 return wrap(unwrap(B)->CreateSelect(unwrap(If), unwrap(Then), unwrap(Else),
4452 Name));
4453}
4454
4456 LLVMTypeRef Ty, const char *Name) {
4457 return wrap(unwrap(B)->CreateVAArg(unwrap(List), unwrap(Ty), Name));
4458}
4459
4461 LLVMValueRef Index, const char *Name) {
4462 return wrap(unwrap(B)->CreateExtractElement(unwrap(VecVal), unwrap(Index),
4463 Name));
4464}
4465
4467 LLVMValueRef EltVal, LLVMValueRef Index,
4468 const char *Name) {
4469 return wrap(unwrap(B)->CreateInsertElement(unwrap(VecVal), unwrap(EltVal),
4470 unwrap(Index), Name));
4471}
4472
4474 LLVMValueRef V2, LLVMValueRef Mask,
4475 const char *Name) {
4476 return wrap(unwrap(B)->CreateShuffleVector(unwrap(V1), unwrap(V2),
4477 unwrap(Mask), Name));
4478}
4479
4481 unsigned Index, const char *Name) {
4482 return wrap(unwrap(B)->CreateExtractValue(unwrap(AggVal), Index, Name));
4483}
4484
4486 LLVMValueRef EltVal, unsigned Index,
4487 const char *Name) {
4488 return wrap(unwrap(B)->CreateInsertValue(unwrap(AggVal), unwrap(EltVal),
4489 Index, Name));
4490}
4491
4493 const char *Name) {
4494 return wrap(unwrap(B)->CreateFreeze(unwrap(Val), Name));
4495}
4496
4498 const char *Name) {
4499 return wrap(unwrap(B)->CreateIsNull(unwrap(Val), Name));
4500}
4501
4503 const char *Name) {
4504 return wrap(unwrap(B)->CreateIsNotNull(unwrap(Val), Name));
4505}
4506
4509 const char *Name) {
4510 IRBuilderBase *Builder = unwrap(B);
4511 Value *Diff =
4512 Builder->CreatePtrDiff(unwrap(ElemTy), unwrap(LHS), unwrap(RHS), Name);
4513 return wrap(Builder->CreateSExtOrTrunc(Diff, Builder->getInt64Ty()));
4514}
4515
4517 LLVMValueRef PTR, LLVMValueRef Val,
4518 LLVMAtomicOrdering ordering,
4519 LLVMBool singleThread) {
4521 return wrap(unwrap(B)->CreateAtomicRMW(
4522 intop, unwrap(PTR), unwrap(Val), MaybeAlign(),
4523 mapFromLLVMOrdering(ordering),
4524 singleThread ? SyncScope::SingleThread : SyncScope::System));
4525}
4526
4529 LLVMValueRef PTR, LLVMValueRef Val,
4530 LLVMAtomicOrdering ordering,
4531 unsigned SSID) {
4533 return wrap(unwrap(B)->CreateAtomicRMW(intop, unwrap(PTR), unwrap(Val),
4534 MaybeAlign(),
4535 mapFromLLVMOrdering(ordering), SSID));
4536}
4537
4539 LLVMValueRef Cmp, LLVMValueRef New,
4540 LLVMAtomicOrdering SuccessOrdering,
4541 LLVMAtomicOrdering FailureOrdering,
4542 LLVMBool singleThread) {
4543
4544 return wrap(unwrap(B)->CreateAtomicCmpXchg(
4545 unwrap(Ptr), unwrap(Cmp), unwrap(New), MaybeAlign(),
4546 mapFromLLVMOrdering(SuccessOrdering),
4547 mapFromLLVMOrdering(FailureOrdering),
4548 singleThread ? SyncScope::SingleThread : SyncScope::System));
4549}
4550
4552 LLVMValueRef Cmp, LLVMValueRef New,
4553 LLVMAtomicOrdering SuccessOrdering,
4554 LLVMAtomicOrdering FailureOrdering,
4555 unsigned SSID) {
4556 return wrap(unwrap(B)->CreateAtomicCmpXchg(
4557 unwrap(Ptr), unwrap(Cmp), unwrap(New), MaybeAlign(),
4558 mapFromLLVMOrdering(SuccessOrdering),
4559 mapFromLLVMOrdering(FailureOrdering), SSID));
4560}
4561
4563 Value *P = unwrap(SVInst);
4565 return I->getShuffleMask().size();
4566}
4567
4568int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt) {
4569 Value *P = unwrap(SVInst);
4571 return I->getMaskValue(Elt);
4572}
4573
4575
4577 return unwrap<Instruction>(Inst)->isAtomic();
4578}
4579
4581 // Backwards compatibility: return false for non-atomic instructions
4582 Instruction *I = unwrap<Instruction>(AtomicInst);
4583 if (!I->isAtomic())
4584 return 0;
4585
4587}
4588
4590 // Backwards compatibility: ignore non-atomic instructions
4591 Instruction *I = unwrap<Instruction>(AtomicInst);
4592 if (!I->isAtomic())
4593 return;
4594
4596 setAtomicSyncScopeID(I, SSID);
4597}
4598
4600 Instruction *I = unwrap<Instruction>(AtomicInst);
4601 assert(I->isAtomic() && "Expected an atomic instruction");
4602 return *getAtomicSyncScopeID(I);
4603}
4604
4605void LLVMSetAtomicSyncScopeID(LLVMValueRef AtomicInst, unsigned SSID) {
4606 Instruction *I = unwrap<Instruction>(AtomicInst);
4607 assert(I->isAtomic() && "Expected an atomic instruction");
4608 setAtomicSyncScopeID(I, SSID);
4609}
4610
4612 Value *P = unwrap(CmpXchgInst);
4613 return mapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getSuccessOrdering());
4614}
4615
4617 LLVMAtomicOrdering Ordering) {
4618 Value *P = unwrap(CmpXchgInst);
4619 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4620
4621 return cast<AtomicCmpXchgInst>(P)->setSuccessOrdering(O);
4622}
4623
4625 Value *P = unwrap(CmpXchgInst);
4626 return mapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getFailureOrdering());
4627}
4628
4630 LLVMAtomicOrdering Ordering) {
4631 Value *P = unwrap(CmpXchgInst);
4632 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4633
4634 return cast<AtomicCmpXchgInst>(P)->setFailureOrdering(O);
4635}
4636
4637/*===-- Module providers --------------------------------------------------===*/
4638
4643
4647
4648
4649/*===-- Memory buffers ----------------------------------------------------===*/
4650
4652 const char *Path,
4653 LLVMMemoryBufferRef *OutMemBuf,
4654 char **OutMessage) {
4655
4657 if (std::error_code EC = MBOrErr.getError()) {
4658 *OutMessage = strdup(EC.message().c_str());
4659 return 1;
4660 }
4661 *OutMemBuf = wrap(MBOrErr.get().release());
4662 return 0;
4663}
4664
4666 char **OutMessage) {
4668 if (std::error_code EC = MBOrErr.getError()) {
4669 *OutMessage = strdup(EC.message().c_str());
4670 return 1;
4671 }
4672 *OutMemBuf = wrap(MBOrErr.get().release());
4673 return 0;
4674}
4675
4677 const char *InputData,
4678 size_t InputDataLength,
4679 const char *BufferName,
4680 LLVMBool RequiresNullTerminator) {
4681
4682 return wrap(MemoryBuffer::getMemBuffer(StringRef(InputData, InputDataLength),
4683 StringRef(BufferName),
4684 RequiresNullTerminator).release());
4685}
4686
4688 const char *InputData,
4689 size_t InputDataLength,
4690 const char *BufferName) {
4691
4692 return wrap(
4693 MemoryBuffer::getMemBufferCopy(StringRef(InputData, InputDataLength),
4694 StringRef(BufferName)).release());
4695}
4696
4698 return unwrap(MemBuf)->getBufferStart();
4699}
4700
4702 return unwrap(MemBuf)->getBufferSize();
4703}
4704
4706 delete unwrap(MemBuf);
4707}
4708
4709/*===-- Pass Manager ------------------------------------------------------===*/
4710
4714
4718
4723
4727
4731
4735
4739
4741 delete unwrap(PM);
4742}
4743
4744/*===-- Threading ------------------------------------------------------===*/
4745
4749
4752
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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< 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:472
This file contains the declarations for the subclasses of Constant, which represent the different fla...
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:779
LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef C, unsigned idx)
Definition Core.cpp:1701
LLVMTypeRef LLVMInt64Type(void)
Definition Core.cpp:723
static Module::ModFlagBehavior map_to_llvmModFlagBehavior(LLVMModuleFlagBehavior Behavior)
Definition Core.cpp:359
LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
Definition Core.cpp:1748
#define LLVM_DEFINE_VALUE_CAST(name)
Definition Core.cpp:1167
LLVMBasicBlockRef LLVMAppendBasicBlock(LLVMValueRef FnRef, const char *Name)
Definition Core.cpp:2956
LLVMTypeRef LLVMVoidType(void)
Definition Core.cpp:982
static LLVMValueMetadataEntry * llvm_getMetadata(size_t *NumEntries, llvm::function_ref< void(MetadataEntries &)> AccessMD)
Definition Core.cpp:1139
static GEPNoWrapFlags mapFromLLVMGEPNoWrapFlags(LLVMGEPNoWrapFlags GEPFlags)
Definition Core.cpp:1801
LLVMValueRef LLVMMDString(const char *Str, unsigned SLen)
Definition Core.cpp:1328
static MDNode * extractMDNode(MetadataAsValue *MAV)
Definition Core.cpp:1115
SmallVectorImpl< std::pair< unsigned, MDNode * > > MetadataEntries
Definition Core.cpp:1137
static void LLVMPositionBuilderImpl(IRBuilder<> *Builder, BasicBlock *Block, Instruction *Instr, bool BeforeDbgRecords)
Definition Core.cpp:3421
static LLVMOpcode map_to_llvmopcode(int opcode)
Definition Core.cpp:1779
LLVMTypeRef LLVMBFloatType(void)
Definition Core.cpp:767
LLVMValueRef LLVMConstByteOfString(LLVMTypeRef ByteTy, const char Str[], uint8_t Radix)
Definition Core.cpp:1605
LLVMTypeRef LLVMInt32Type(void)
Definition Core.cpp:720
static LLVMFastMathFlags mapToLLVMFastMathFlags(FastMathFlags FMF)
Definition Core.cpp:3741
static FastMathFlags mapFromLLVMFastMathFlags(LLVMFastMathFlags FMF)
Definition Core.cpp:3728
LLVMTypeRef LLVMHalfType(void)
Definition Core.cpp:764
LLVMTypeRef LLVMIntType(unsigned NumBits)
Definition Core.cpp:729
LLVMTypeRef LLVMX86AMXType(void)
Definition Core.cpp:785
LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char Str[], uint8_t Radix)
Definition Core.cpp:1581
LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Definition Core.cpp:824
static AtomicOrdering mapFromLLVMOrdering(LLVMAtomicOrdering Ordering)
Definition Core.cpp:4058
static Intrinsic::ID llvm_map_to_intrinsic_id(unsigned ID)
Definition Core.cpp:2550
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:4074
LLVMTypeRef LLVMX86FP80Type(void)
Definition Core.cpp:776
LLVMBasicBlockRef LLVMInsertBasicBlock(LLVMBasicBlockRef BBRef, const char *Name)
Definition Core.cpp:2967
LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3907
static LLVMValueRef getMDNodeOperandImpl(LLVMContext &Context, const MDNode *N, unsigned Index)
Definition Core.cpp:1228
LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const char Str[], unsigned SLen)
Definition Core.cpp:1625
LLVMTypeRef LLVMPPCFP128Type(void)
Definition Core.cpp:782
LLVMTypeRef LLVMFloatType(void)
Definition Core.cpp:770
static int map_from_llvmopcode(LLVMOpcode code)
Definition Core.cpp:1789
static LLVMAtomicRMWBinOp mapToLLVMRMWBinOp(AtomicRMWInst::BinOp BinOp)
Definition Core.cpp:4128
LLVMTypeRef LLVMLabelType(void)
Definition Core.cpp:985
LLVMValueRef LLVMConstString(const char *Str, unsigned Length, LLVMBool DontNullTerminate)
Definition Core.cpp:1691
unsigned LLVMGetMDKindID(const char *Name, unsigned SLen)
Definition Core.cpp:152
LLVMTypeRef LLVMInt8Type(void)
Definition Core.cpp:714
LLVMTypeRef LLVMDoubleType(void)
Definition Core.cpp:773
LLVMValueRef LLVMConstByteOfStringAndSize(LLVMTypeRef ByteTy, const char Str[], size_t SLen, uint8_t Radix)
Definition Core.cpp:1611
LLVMTypeRef LLVMInt1Type(void)
Definition Core.cpp:711
LLVMBuilderRef LLVMCreateBuilder(void)
Definition Core.cpp:3417
LLVMTypeRef LLVMInt128Type(void)
Definition Core.cpp:726
static AtomicRMWInst::BinOp mapFromLLVMRMWBinOp(LLVMAtomicRMWBinOp BinOp)
Definition Core.cpp:4090
LLVMValueRef LLVMIsABranchInst(LLVMValueRef Val)
Definition Core.cpp:1174
LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal)
Definition Core.cpp:1847
LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const char Str[], unsigned SLen, uint8_t Radix)
Definition Core.cpp:1587
LLVMTypeRef LLVMInt16Type(void)
Definition Core.cpp:717
LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count)
Definition Core.cpp:1359
static LLVMContext & getGlobalContext()
Definition Core.cpp:95
static LLVMGEPNoWrapFlags mapToLLVMGEPNoWrapFlags(GEPNoWrapFlags GEPFlags)
Definition Core.cpp:1813
LLVMContextRef LLVMGetGlobalContext()
Definition Core.cpp:108
Module.h This file contains the declarations for the Module class.
#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
Machine Check Debug Module
static DebugLoc getDebugLoc(MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
Return the first DebugLoc that has line number information, given a range of instructions.
#define T
MachineInstr unsigned OpIdx
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")))
static Type * getValueType(Value *V)
Returns the type of the given value/instruction V.
#define LLVM_DEBUG(...)
Definition Debug.h:114
static SymbolRef::Type getType(const Symbol *Sym)
Definition TapiFile.cpp:39
unify loop Fixup each natural loop to have a single exit block
static std::optional< unsigned > getOpcode(ArrayRef< VPValue * > Values)
Returns the opcode of Values or ~0 if they do not all agree.
Definition VPlanSLP.cpp:247
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:297
static constexpr roundingMode rmNearestTiesToEven
Definition APFloat.h:344
LLVM_ABI opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
Definition APFloat.cpp:5976
LLVM_ABI double convertToDouble() const
Converts this APFloat to host double value.
Definition APFloat.cpp:6035
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
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
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:384
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:676
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:878
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:1357
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList)
Create an "inbounds" getelementptr.
Definition Constants.h:1482
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:1345
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:1343
static Constant * getNSWSub(Constant *C1, Constant *C2)
Definition Constants.h:1353
static Constant * getNUWAdd(Constant *C1, Constant *C2)
Definition Constants.h:1349
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:1445
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:629
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:93
bool noSignedZeros() const
Definition FMF.h:70
bool noInfs() const
Definition FMF.h:69
void setAllowReciprocal(bool B=true)
Definition FMF.h:90
bool allowReciprocal() const
Definition FMF.h:71
void setNoSignedZeros(bool B=true)
Definition FMF.h:87
bool allowReassoc() const
Flag queries.
Definition FMF.h:67
bool approxFunc() const
Definition FMF.h:73
void setNoNaNs(bool B=true)
Definition FMF.h:81
void setAllowReassoc(bool B=true)
Flag setters.
Definition FMF.h:78
bool noNaNs() const
Definition FMF.h:68
void setApproxFunc(bool B=true)
Definition FMF.h:96
void setNoInfs(bool B=true)
Definition FMF.h:84
bool allowContract() const
Definition FMF.h:72
An instruction for ordering other memory operations.
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
Definition Type.cpp:873
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:168
BasicBlockListType::iterator iterator
Definition Function.h:70
Argument * arg_iterator
Definition Function.h:73
iterator_range< arg_iterator > args()
Definition Function.h:892
arg_iterator arg_begin()
Definition Function.h:868
Function::iterator insert(Function::iterator Position, BasicBlock *BB)
Insert BB in the basic block list at Position.
Definition Function.h:755
size_t arg_size() const
Definition Function.h:901
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:425
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:613
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:670
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:2811
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:354
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:1080
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition Metadata.h:1572
A single uniqued string.
Definition Metadata.h:722
static LLVM_ABI MDString * get(LLVMContext &Context, StringRef Str)
Definition Metadata.cpp:614
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:110
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:67
global_iterator global_begin()
Definition Module.h:677
ifunc_iterator ifunc_begin()
Definition Module.h:746
ModFlagBehavior
This enumeration defines the supported behaviors of module flags.
Definition Module.h:117
@ AppendUnique
Appends the two values, which are required to be metadata nodes.
Definition Module.h:146
@ Override
Uses the specified value, regardless of the behavior or value of the other module.
Definition Module.h:138
@ Warning
Emits a warning if two values disagree.
Definition Module.h:124
@ Error
Emits an error if two values disagree, otherwise the resulting value is that of the operands.
Definition Module.h:120
@ Append
Appends the two values, which are required to be metadata nodes.
Definition Module.h:141
@ Require
Adds a requirement that another module flag be present and have a specified value after linking is pe...
Definition Module.h:133
global_iterator global_end()
Definition Module.h:679
NamedMDListType::iterator named_metadata_iterator
The named metadata iterators.
Definition Module.h:112
IFuncListType::iterator ifunc_iterator
The Global IFunc iterators.
Definition Module.h:107
named_metadata_iterator named_metadata_begin()
Definition Module.h:787
ifunc_iterator ifunc_end()
Definition Module.h:748
alias_iterator alias_end()
Definition Module.h:730
alias_iterator alias_begin()
Definition Module.h:728
FunctionListType::iterator iterator
The Function iterators.
Definition Module.h:92
GlobalListType::iterator global_iterator
The Global Variable iterator.
Definition Module.h:87
AliasListType::iterator alias_iterator
The Global Alias iterators.
Definition Module.h:102
named_metadata_iterator named_metadata_end()
Definition Module.h:792
A tuple of MDNodes.
Definition Metadata.h:1760
LLVM_ABI StringRef getName() const
Module * getParent()
Get the module that holds this named metadata collection.
Definition Metadata.h:1830
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(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space.
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:53
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
Definition Record.h:2199
static LLVM_ABI ScalableVectorType * get(Type *ElementType, unsigned MinNumElts)
Definition Type.cpp:895
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.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
constexpr size_t size() const
size - Get the string size.
Definition StringRef.h:143
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition StringRef.h:137
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:483
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:808
static LLVM_ABI StructType * create(LLVMContext &Context, StringRef Name)
This creates an identified struct.
Definition Type.cpp:689
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:978
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:47
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:314
static LLVM_ABI Type * getX86_AMXTy(LLVMContext &C)
Definition Type.cpp:297
static LLVM_ABI Type * getMetadataTy(LLVMContext &C)
Definition Type.cpp:292
static LLVM_ABI Type * getTokenTy(LLVMContext &C)
Definition Type.cpp:293
static LLVM_ABI IntegerType * getInt128Ty(LLVMContext &C)
Definition Type.cpp:315
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
Definition Type.cpp:313
static LLVM_ABI Type * getPPC_FP128Ty(LLVMContext &C)
Definition Type.cpp:296
static LLVM_ABI Type * getFP128Ty(LLVMContext &C)
Definition Type.cpp:295
static LLVM_ABI Type * getLabelTy(LLVMContext &C)
Definition Type.cpp:287
@ 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:286
static LLVM_ABI IntegerType * getInt8Ty(LLVMContext &C)
Definition Type.cpp:311
static LLVM_ABI IntegerType * getInt16Ty(LLVMContext &C)
Definition Type.cpp:312
static LLVM_ABI IntegerType * getInt1Ty(LLVMContext &C)
Definition Type.cpp:310
static LLVM_ABI Type * getDoubleTy(LLVMContext &C)
Definition Type.cpp:291
static LLVM_ABI Type * getX86_FP80Ty(LLVMContext &C)
Definition Type.cpp:294
static LLVM_ABI Type * getFloatTy(LLVMContext &C)
Definition Type.cpp:290
static LLVM_ABI Type * getBFloatTy(LLVMContext &C)
Definition Type.cpp:289
static LLVM_ABI Type * getHalfTy(LLVMContext &C)
Definition Type.cpp:288
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:509
LLVM Value Representation.
Definition Value.h:75
Type * getType() const
All values are typed, get the type of this value.
Definition Value.h:256
LLVMContext & getContext() const
All values hold a context through their type.
Definition Value.h:259
use_iterator_impl< Use > use_iterator
Definition Value.h:354
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:880
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:3537
LLVMValueRef LLVMBuildMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3801
LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef B)
Definition Core.cpp:3529
LLVMValueRef LLVMBuildSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3781
LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3811
LLVMBool LLVMGetWeak(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4240
LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4368
LLVMValueRef LLVMBuildIsNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4497
LLVMValueRef LLVMBuildGEPWithNoWrapFlags(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name, LLVMGEPNoWrapFlags NoWrapFlags)
Creates a GetElementPtr instruction.
Definition Core.cpp:4198
LLVMValueRef LLVMBuildAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3761
void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak)
Definition Core.cpp:4244
LLVMValueRef LLVMBuildOr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3881
LLVMValueRef LLVMBuildBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4340
LLVMValueRef LLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3826
LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition Core.cpp:4183
LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3786
void LLVMPositionBuilderBeforeInstrAndDbgRecords(LLVMBuilderRef Builder, LLVMValueRef Instr)
Set the builder position before Instr and any attached debug records.
Definition Core.cpp:3446
LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4502
void LLVMDisposeBuilder(LLVMBuilderRef Builder)
Definition Core.cpp:3474
void LLVMClearInsertionPosition(LLVMBuilderRef Builder)
Definition Core.cpp:3461
LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PersFn, unsigned NumClauses, const char *Name)
Definition Core.cpp:3603
void LLVMSetIsDisjoint(LLVMValueRef Inst, LLVMBool IsDisjoint)
Sets the disjoint flag for the instruction.
Definition Core.cpp:3984
LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst)
Definition Core.cpp:4580
LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn)
Definition Core.cpp:3633
void LLVMSetAtomicRMWBinOp(LLVMValueRef Inst, LLVMAtomicRMWBinOp BinOp)
Definition Core.cpp:4279
LLVMValueRef LLVMBuildFDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3841
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:3589
LLVMValueRef LLVMBuildXor(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3886
LLVMBool LLVMGetExact(LLVMValueRef DivOrShrInst)
Definition Core.cpp:3943
LLVMValueRef LLVMBuildAddrSpaceCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4345
unsigned LLVMGetNumMaskElements(LLVMValueRef SVInst)
Get the number of elements in the mask of a ShuffleVector instruction.
Definition Core.cpp:4562
void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr)
Definition Core.cpp:3465
LLVMValueRef LLVMBuildCleanupRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition Core.cpp:3654
LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4305
void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers)
Obtain the basic blocks acting as handlers for a catchswitch instruction.
Definition Core.cpp:3701
LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4285
LLVMValueRef LLVMGetArgOperand(LLVMValueRef Funclet, unsigned i)
Definition Core.cpp:3718
LLVMValueRef LLVMBuildAnd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3876
unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch)
Definition Core.cpp:3697
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:3561
LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder)
Definition Core.cpp:3457
LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3831
LLVMValueRef LLVMBuildSExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4356
LLVMValueRef LLVMBuildCall2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:4425
void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW)
Definition Core.cpp:3938
LLVMMetadataRef LLVMGetCurrentDebugLocation2(LLVMBuilderRef Builder)
Get location information used by debugging information.
Definition Core.cpp:3480
LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3821
LLVMValueRef LLVMBuildSelect(LLVMBuilderRef B, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, const char *Name)
Definition Core.cpp:4448
void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr)
Set the builder position before Instr but after any attached debug records.
Definition Core.cpp:3441
LLVMBool LLVMCanValueUseFastMathFlags(LLVMValueRef V)
Check if a given value can potentially have fast math flags.
Definition Core.cpp:3974
void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value)
Definition Core.cpp:3722
LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef B, LLVMValueRef If, LLVMBasicBlockRef Then, LLVMBasicBlockRef Else)
Definition Core.cpp:3546
LLVMBool LLVMGetNUW(LLVMValueRef ArithInst)
Definition Core.cpp:3923
LLVMOpcode LLVMGetCastOpcode(LLVMValueRef Src, LLVMBool SrcIsSigned, LLVMTypeRef DestTy, LLVMBool DestIsSigned)
Definition Core.cpp:4397
void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr, const char *Name)
Definition Core.cpp:3469
LLVMValueRef LLVMBuildSRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3851
LLVMValueRef LLVMBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:3622
LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Deprecated: This cast is always signed.
Definition Core.cpp:4386
LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder)
Deprecated: Returning the NULL location will crash.
Definition Core.cpp:3497
LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef Index, const char *Name)
Definition Core.cpp:4460
LLVMValueRef LLVMBuildShl(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3861
LLVMBuilderRef LLVMCreateBuilderInContext(LLVMContextRef C)
Definition Core.cpp:3413
LLVMValueRef LLVMBuildCatchRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition Core.cpp:3648
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:4025
LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemAccessInst)
Definition Core.cpp:4248
LLVMValueRef LLVMBuildStructGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, unsigned Idx, const char *Name)
Definition Core.cpp:4208
int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt)
Get the mask value at position Elt in the mask of a ShuffleVector instruction.
Definition Core.cpp:4568
void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal, LLVMBasicBlockRef Dest)
Definition Core.cpp:3664
LLVMValueRef LLVMBuildBr(LLVMBuilderRef B, LLVMBasicBlockRef Dest)
Definition Core.cpp:3542
LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, const char *Name)
Definition Core.cpp:4466
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:3434
void LLVMSetFastMathFlags(LLVMValueRef FPMathInst, LLVMFastMathFlags FMF)
Sets the flags for which fast-math-style optimizations are allowed for this value.
Definition Core.cpp:3969
LLVMValueRef LLVMBuildIntCast2(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, LLVMBool IsSigned, const char *Name)
Definition Core.cpp:4379
LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3791
LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3776
LLVMValueRef LLVMBuildCatchPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:3615
LLVMValueRef LLVMBuildCallWithOperandBundles(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name)
Definition Core.cpp:4434
LLVMBool LLVMIsCleanup(LLVMValueRef LandingPad)
Definition Core.cpp:3685
LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4350
LLVMBool LLVMGetVolatile(LLVMValueRef Inst)
Definition Core.cpp:4225
LLVMValueRef LLVMBuildFPCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4392
LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4330
LLVMValueRef LLVMBuildPtrDiff2(LLVMBuilderRef B, LLVMTypeRef ElemTy, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4507
LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4362
LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4039
LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx)
Definition Core.cpp:3677
unsigned LLVMGetAtomicSyncScopeID(LLVMValueRef AtomicInst)
Returns the synchronization scope ID of an atomic instruction.
Definition Core.cpp:4599
LLVMValueRef LLVMBuildVAArg(LLVMBuilderRef B, LLVMValueRef List, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4455
LLVMValueRef LLVMBuildAtomicCmpXchgSyncScope(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, unsigned SSID)
Definition Core.cpp:4551
LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3891
LLVMBool LLVMIsAtomic(LLVMValueRef Inst)
Returns whether an instruction is an atomic instruction, e.g., atomicrmw, cmpxchg,...
Definition Core.cpp:4576
void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile)
Definition Core.cpp:4229
void LLVMSetAtomicSingleThread(LLVMValueRef AtomicInst, LLVMBool NewValue)
Definition Core.cpp:4589
LLVMValueRef LLVMBuildFRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3856
LLVMValueRef LLVMBuildURem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3846
LLVMValueRef LLVMBuildIntToPtr(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4335
LLVMBool LLVMGetNSW(LLVMValueRef ArithInst)
Definition Core.cpp:3933
LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3806
LLVMValueRef LLVMBuildFree(LLVMBuilderRef B, LLVMValueRef PointerVal)
Definition Core.cpp:4044
LLVMValueRef LLVMBuildNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3898
LLVMValueRef LLVMBuildFSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3796
LLVMValueRef LLVMBuildCatchSwitch(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMBasicBlockRef UnwindBB, unsigned NumHandlers, const char *Name)
Definition Core.cpp:3637
LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name)
Definition Core.cpp:4048
LLVMValueRef LLVMBuildInBoundsGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition Core.cpp:4190
LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4000
LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, LLVMBool singleThread)
Definition Core.cpp:4538
LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr, unsigned NumDests)
Definition Core.cpp:3556
LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef B)
Definition Core.cpp:3660
LLVMValueRef LLVMBuildSIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4315
LLVMValueRef LLVMBuildSExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4295
LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4300
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:3503
void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Builder, LLVMMetadataRef Loc)
Set location information used by debugging information.
Definition Core.cpp:3484
LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4034
void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L)
Deprecated: Passing the NULL location will crash.
Definition Core.cpp:3491
LLVMValueRef LLVMBuildPhi(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4421
void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest)
Definition Core.cpp:3669
LLVMBool LLVMGetNNeg(LLVMValueRef NonNegInst)
Gets if the instruction has the non-negative flag set.
Definition Core.cpp:3953
LLVMValueRef LLVMBuildAtomicRMWSyncScope(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, unsigned SSID)
Definition Core.cpp:4527
LLVMValueRef LLVMBuildRet(LLVMBuilderRef B, LLVMValueRef V)
Definition Core.cpp:3533
LLVMMetadataRef LLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder)
Get the dafult floating-point math metadata for a given builder.
Definition Core.cpp:3523
LLVMValueRef LLVMBuildExtractValue(LLVMBuilderRef B, LLVMValueRef AggVal, unsigned Index, const char *Name)
Definition Core.cpp:4480
LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str, const char *Name)
Deprecated: Use LLVMBuildGlobalString instead, which has identical behavior.
Definition Core.cpp:4220
LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3766
void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block)
Definition Core.cpp:3452
LLVMValueRef LLVMBuildFMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3816
LLVMValueRef LLVMBuildLShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3866
LLVMAtomicRMWBinOp LLVMGetAtomicRMWBinOp(LLVMValueRef Inst)
Definition Core.cpp:4275
LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3915
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:4009
void LLVMSetAtomicSyncScopeID(LLVMValueRef AtomicInst, unsigned SSID)
Sets the synchronization scope ID of an atomic instruction.
Definition Core.cpp:4605
LLVMContextRef LLVMGetBuilderContext(LLVMBuilderRef Builder)
Obtain the context to which this builder is associated.
Definition Core.cpp:3519
LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:3991
LLVMValueRef LLVMBuildFreeze(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4492
LLVMValueRef LLVMBuildGlobalString(LLVMBuilderRef B, const char *Str, const char *Name)
Definition Core.cpp:4215
void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW)
Definition Core.cpp:3928
LLVMAtomicOrdering LLVMGetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4611
LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef B, LLVMRealPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4412
LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4374
LLVMValueRef LLVMBuildExactSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3836
LLVMValueRef LLVMBuildShuffleVector(LLVMBuilderRef B, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, const char *Name)
Definition Core.cpp:4473
LLVMValueRef LLVMBuildFPExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4325
void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val)
Definition Core.cpp:3689
LLVMValueRef LLVMBuildICmp(LLVMBuilderRef B, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4405
void LLVMSetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4629
void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal)
Definition Core.cpp:3681
LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, LLVMBool isSingleThread, const char *Name)
Definition Core.cpp:4167
void LLVMSetParentCatchSwitch(LLVMValueRef CatchPad, LLVMValueRef CatchSwitch)
Set the parent catchswitch instruction of a catchpad instruction.
Definition Core.cpp:3711
LLVMValueRef LLVMBuildFenceSyncScope(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, unsigned SSID, const char *Name)
Definition Core.cpp:4176
LLVMValueRef LLVMBuildUIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4310
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:3428
unsigned LLVMGetNumClauses(LLVMValueRef LandingPad)
Definition Core.cpp:3673
int LLVMGetUndefMaskElem(void)
Definition Core.cpp:4574
void LLVMSetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4616
LLVMValueRef LLVMGetParentCatchSwitch(LLVMValueRef CatchPad)
Get the parent catchswitch instruction of a catchpad instruction.
Definition Core.cpp:3707
LLVMFastMathFlags LLVMGetFastMathFlags(LLVMValueRef FPMathInst)
Get the flags for which fast-math-style optimizations are allowed for this value.
Definition Core.cpp:3963
LLVMBool LLVMGetIsDisjoint(LLVMValueRef Inst)
Gets whether the instruction has the disjoint flag set.
Definition Core.cpp:3979
LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef B, LLVMValueRef V, LLVMBasicBlockRef Else, unsigned NumCases)
Definition Core.cpp:3551
void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg)
Sets the non-negative flag for the instruction.
Definition Core.cpp:3958
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:4016
void LLVMAddHandler(LLVMValueRef CatchSwitch, LLVMBasicBlockRef Dest)
Definition Core.cpp:3693
void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact)
Definition Core.cpp:3948
LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3902
LLVMValueRef LLVMBuildAShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3871
LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, const char *Name)
Definition Core.cpp:3580
void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4262
LLVMValueRef LLVMBuildFPTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4320
LLVMValueRef LLVMBuildStore(LLVMBuilderRef B, LLVMValueRef Val, LLVMValueRef PointerVal)
Definition Core.cpp:4053
void LLVMAddMetadataToInst(LLVMBuilderRef Builder, LLVMValueRef Inst)
Adds the metadata registered with the given builder to the given instruction.
Definition Core.cpp:3507
LLVMAtomicOrdering LLVMGetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4624
LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3771
LLVMValueRef LLVMBuildInsertValue(LLVMBuilderRef B, LLVMValueRef AggVal, LLVMValueRef EltVal, unsigned Index, const char *Name)
Definition Core.cpp:4485
void LLVMBuilderSetDefaultFPMathTag(LLVMBuilderRef Builder, LLVMMetadataRef FPMathTag)
Set the default floating-point math metadata for the given builder.
Definition Core.cpp:3511
LLVMValueRef LLVMBuildZExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4290
LLVMValueRef LLVMBuildNot(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3919
LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, LLVMBool singleThread)
Definition Core.cpp:4516
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange(const char *InputData, size_t InputDataLength, const char *BufferName, LLVMBool RequiresNullTerminator)
Definition Core.cpp:4676
size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4701
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData, size_t InputDataLength, const char *BufferName)
Definition Core.cpp:4687
const char * LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4697
LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const char *Path, LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
Definition Core.cpp:4651
LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
Definition Core.cpp:4665
void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4705
LLVMModuleProviderRef LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M)
Changes the type of M so it can be passed to FunctionPassManagers and the JIT.
Definition Core.cpp:4640
void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP)
Destroys the module M.
Definition Core.cpp:4644
char * LLVMPrintModuleToString(LLVMModuleRef M)
Return a string representation of the module.
Definition Core.cpp:490
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:1430
LLVMValueRef LLVMGetNamedFunctionWithLength(LLVMModuleRef M, const char *Name, size_t Length)
Obtain a Function value from a Module by its name.
Definition Core.cpp:2490
unsigned LLVMGetDebugLocColumn(LLVMValueRef Val)
Return the column number of the debug location for this value, which must be an llvm::Instruction.
Definition Core.cpp:1558
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:1425
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:587
const char * LLVMGetModuleInlineAsm(LLVMModuleRef M, size_t *Len)
Get inline assembly for a module.
Definition Core.cpp:512
LLVMBool LLVMGetInlineAsmNeedsAlignedStack(LLVMValueRef InlineAsmVal)
Get if the inline asm snippet needs an aligned stack.
Definition Core.cpp:582
LLVMBool LLVMGetInlineAsmHasSideEffects(LLVMValueRef InlineAsmVal)
Get if the inline asm snippet has side effects.
Definition Core.cpp:577
unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char *Name)
Obtain the number of operands for named metadata in a module.
Definition Core.cpp:1461
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:572
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:593
LLVMInlineAsmDialect LLVMGetInlineAsmDialect(LLVMValueRef InlineAsmVal)
Get the dialect used by the inline asm snippet.
Definition Core.cpp:556
void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm)
Deprecated: Use LLVMSetModuleInlineAsm2 instead.
Definition Core.cpp:504
LLVMValueRef LLVMGetNextFunction(LLVMValueRef Fn)
Advance a Function iterator to the next Function.
Definition Core.cpp:2511
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:876
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:538
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:518
LLVMValueRef LLVMGetOrInsertFunction(LLVMModuleRef M, const char *Name, size_t NameLen, LLVMTypeRef FunctionTy)
Obtain or insert a function into a module.
Definition Core.cpp:2478
const char * LLVMGetInlineAsmConstraintString(LLVMValueRef InlineAsmVal, size_t *Len)
Get the raw constraint string for an inline assembly snippet.
Definition Core.cpp:547
LLVMNamedMDNodeRef LLVMGetNextNamedMetadata(LLVMNamedMDNodeRef NMD)
Advance a NamedMDNode iterator to the next NamedMDNode.
Definition Core.cpp:1409
void LLVMGetNamedMetadataOperands(LLVMModuleRef M, const char *Name, LLVMValueRef *Dest)
Obtain the named metadata operands for a module.
Definition Core.cpp:1468
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:2472
LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn)
Decrement a Function iterator to the previous Function.
Definition Core.cpp:2519
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:1488
void LLVMAddNamedMetadataOperand(LLVMModuleRef M, const char *Name, LLVMValueRef Val)
Add an operand to named metadata.
Definition Core.cpp:1478
unsigned LLVMGetDebugLocLine(LLVMValueRef Val)
Return the line number of the debug location for this value, which must be an llvm::Instruction,...
Definition Core.cpp:1536
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:2503
LLVMNamedMDNodeRef LLVMGetPreviousNamedMetadata(LLVMNamedMDNodeRef NMD)
Decrement a NamedMDNode iterator to the previous NamedMDNode.
Definition Core.cpp:1417
const char * LLVMGetNamedMetadataName(LLVMNamedMDNodeRef NMD, size_t *NameLen)
Retrieve the name of a NamedMDNode.
Definition Core.cpp:1435
LLVMValueRef LLVMGetNamedFunction(LLVMModuleRef M, const char *Name)
Obtain a Function value from a Module by its name.
Definition Core.cpp:2486
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:1512
void LLVMAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm, size_t Len)
Append inline assembly to a module.
Definition Core.cpp:508
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:1401
void LLVMSetModuleInlineAsm2(LLVMModuleRef M, const char *Asm, size_t Len)
Set inline assembly for a module.
Definition Core.cpp:500
LLVMValueRef LLVMGetFirstFunction(LLVMModuleRef M)
Obtain an iterator to the first Function in a Module.
Definition Core.cpp:2495
LLVMNamedMDNodeRef LLVMGetFirstNamedMetadata(LLVMModuleRef M)
Obtain an iterator to the first NamedMDNode in a Module.
Definition Core.cpp:1393
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:2834
unsigned LLVMGetNumOperandBundleArgs(LLVMOperandBundleRef Bundle)
Obtain the number of operands for an operand bundle.
Definition Core.cpp:2851
const char * LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len)
Obtain the tag of an operand bundle as a string.
Definition Core.cpp:2845
void LLVMDisposeOperandBundle(LLVMOperandBundleRef Bundle)
Destroy an operand bundle.
Definition Core.cpp:2841
LLVMValueRef LLVMGetOperandBundleArgAtIndex(LLVMOperandBundleRef Bundle, unsigned Index)
Obtain the operand for an operand bundle at the given index.
Definition Core.cpp:2855
LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef P)
Deprecated: Use LLVMCreateFunctionPassManagerForModule instead.
Definition Core.cpp:4719
LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M)
Constructs a new function-by-function pass pipeline over the module provider.
Definition Core.cpp:4715
LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM)
Finalizes all of the function passes scheduled in the function pass manager.
Definition Core.cpp:4736
void LLVMDisposePassManager(LLVMPassManagerRef PM)
Frees the memory of a pass pipeline.
Definition Core.cpp:4740
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:4732
LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM)
Initializes all of the function passes scheduled in the function pass manager.
Definition Core.cpp:4728
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:4724
LLVMPassManagerRef LLVMCreatePassManager()
Constructs a new whole-module pass pipeline.
Definition Core.cpp:4711
void LLVMStopMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
Definition Core.cpp:4750
LLVMBool LLVMStartMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
Definition Core.cpp:4746
LLVMBool LLVMIsMultithreaded()
Check whether LLVM is executing in thread-safe mode or not.
Definition Core.cpp:4753
LLVMTypeRef LLVMByteTypeInContext(LLVMContextRef C, unsigned NumBits)
Obtain a byte type from a context with specified bit width.
Definition Core.cpp:679
unsigned LLVMGetByteTypeWidth(LLVMTypeRef ByteTy)
Definition Core.cpp:683
LLVMTypeRef LLVMHalfTypeInContext(LLVMContextRef C)
Obtain a 16-bit floating point type from a context.
Definition Core.cpp:739
LLVMTypeRef LLVMBFloatTypeInContext(LLVMContextRef C)
Obtain a 16-bit brain floating point type from a context.
Definition Core.cpp:742
LLVMTypeRef LLVMPPCFP128TypeInContext(LLVMContextRef C)
Obtain a 128-bit floating point type (two 64-bits) from a context.
Definition Core.cpp:757
LLVMTypeRef LLVMDoubleTypeInContext(LLVMContextRef C)
Obtain a 64-bit floating point type from a context.
Definition Core.cpp:748
LLVMTypeRef LLVMFloatTypeInContext(LLVMContextRef C)
Obtain a 32-bit floating point type from a context.
Definition Core.cpp:745
LLVMTypeRef LLVMFP128TypeInContext(LLVMContextRef C)
Obtain a 128-bit floating point type (112-bit mantissa) from a context.
Definition Core.cpp:754
LLVMTypeRef LLVMX86FP80TypeInContext(LLVMContextRef C)
Obtain a 80-bit floating point type (X87) from a context.
Definition Core.cpp:751
LLVMTypeRef LLVMGetReturnType(LLVMTypeRef FunctionTy)
Obtain the Type this function Type returns.
Definition Core.cpp:802
LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType, LLVMTypeRef *ParamTypes, unsigned ParamCount, LLVMBool IsVarArg)
Obtain a function type consisting of a specified signature.
Definition Core.cpp:791
LLVMBool LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy)
Returns whether a function type is variadic.
Definition Core.cpp:798
unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy)
Obtain the number of parameters this function accepts.
Definition Core.cpp:806
void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest)
Obtain the types of a function's parameters.
Definition Core.cpp:810
LLVMTypeRef LLVMInt1TypeInContext(LLVMContextRef C)
Obtain an integer type from a context with specified bit width.
Definition Core.cpp:689
LLVMTypeRef LLVMInt8TypeInContext(LLVMContextRef C)
Definition Core.cpp:692
LLVMTypeRef LLVMInt32TypeInContext(LLVMContextRef C)
Definition Core.cpp:698
LLVMTypeRef LLVMIntTypeInContext(LLVMContextRef C, unsigned NumBits)
Definition Core.cpp:707
LLVMTypeRef LLVMInt64TypeInContext(LLVMContextRef C)
Definition Core.cpp:701
LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C)
Definition Core.cpp:695
unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy)
Definition Core.cpp:733
LLVMTypeRef LLVMInt128TypeInContext(LLVMContextRef C)
Definition Core.cpp:704
unsigned LLVMGetTargetExtTypeNumTypeParams(LLVMTypeRef TargetExtTy)
Obtain the number of type parameters for this target extension type.
Definition Core.cpp:1005
LLVMTypeRef LLVMX86AMXTypeInContext(LLVMContextRef C)
Create a X86 AMX type in a context.
Definition Core.cpp:760
const char * LLVMGetTargetExtTypeName(LLVMTypeRef TargetExtTy)
Obtain the name for this target extension type.
Definition Core.cpp:1000
LLVMTypeRef LLVMVoidTypeInContext(LLVMContextRef C)
Create a void type in a context.
Definition Core.cpp:969
LLVMTypeRef LLVMTokenTypeInContext(LLVMContextRef C)
Create a token type in a context.
Definition Core.cpp:975
unsigned LLVMGetTargetExtTypeNumIntParams(LLVMTypeRef TargetExtTy)
Obtain the number of int parameters for this target extension type.
Definition Core.cpp:1016
LLVMTypeRef LLVMLabelTypeInContext(LLVMContextRef C)
Create a label type in a context.
Definition Core.cpp:972
LLVMTypeRef LLVMMetadataTypeInContext(LLVMContextRef C)
Create a metadata type in a context.
Definition Core.cpp:978
LLVMTypeRef LLVMGetTargetExtTypeTypeParam(LLVMTypeRef TargetExtTy, unsigned Idx)
Get the type parameter at the given index for the target extension type.
Definition Core.cpp:1010
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:989
unsigned LLVMGetTargetExtTypeIntParam(LLVMTypeRef TargetExtTy, unsigned Idx)
Get the int parameter at the given index for the target extension type.
Definition Core.cpp:1021
LLVMValueRef LLVMGetConstantPtrAuthAddrDiscriminator(LLVMValueRef PtrAuth)
Get the address discriminator value for the associated ConstantPtrAuth constant.
Definition Core.cpp:959
LLVMBool LLVMPointerTypeIsOpaque(LLVMTypeRef Ty)
Determine whether a pointer is opaque.
Definition Core.cpp:907
LLVMTypeRef LLVMPointerTypeInContext(LLVMContextRef C, unsigned AddressSpace)
Create an opaque pointer type in a context.
Definition Core.cpp:965
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:911
LLVMTypeRef LLVMGetElementType(LLVMTypeRef WrappedTy)
Obtain the element type of an array or vector type.
Definition Core.cpp:920
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:915
LLVMValueRef LLVMGetConstantPtrAuthDiscriminator(LLVMValueRef PtrAuth)
Get the discriminator value for the associated ConstantPtrAuth constant.
Definition Core.cpp:955
uint64_t LLVMGetArrayLength2(LLVMTypeRef ArrayTy)
Obtain the length of an array type.
Definition Core.cpp:935
LLVMValueRef LLVMGetConstantPtrAuthKey(LLVMValueRef PtrAuth)
Get the key value for the associated ConstantPtrAuth constant.
Definition Core.cpp:951
unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy)
Obtain the length of an array type.
Definition Core.cpp:931
LLVMValueRef LLVMGetConstantPtrAuthPointer(LLVMValueRef PtrAuth)
Get the pointer value for the associated ConstantPtrAuth constant.
Definition Core.cpp:947
unsigned LLVMGetPointerAddressSpace(LLVMTypeRef PointerTy)
Obtain the address space of a pointer type.
Definition Core.cpp:939
LLVMTypeRef LLVMArrayType2(LLVMTypeRef ElementType, uint64_t ElementCount)
Create a fixed size array type that refers to a specific type.
Definition Core.cpp:898
unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy)
Obtain the (possibly scalable) number of elements in a vector type.
Definition Core.cpp:943
LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount)
Create a fixed size array type that refers to a specific type.
Definition Core.cpp:894
void LLVMGetSubtypes(LLVMTypeRef Tp, LLVMTypeRef *Arr)
Returns type's subtypes.
Definition Core.cpp:886
LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace)
Create a pointer type that points to a defined type.
Definition Core.cpp:902
unsigned LLVMGetNumContainedTypes(LLVMTypeRef Tp)
Return the number of types in the derived type.
Definition Core.cpp:927
LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Create a new structure type in a context.
Definition Core.cpp:818
void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest)
Get the elements within a structure.
Definition Core.cpp:853
LLVMTypeRef LLVMStructGetTypeAtIndex(LLVMTypeRef StructTy, unsigned i)
Get the type of the element at a given index in the structure.
Definition Core.cpp:859
LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy)
Determine whether a structure is packed.
Definition Core.cpp:864
LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name)
Create an empty structure in a context having a specified name.
Definition Core.cpp:830
void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Set the contents of a structure type.
Definition Core.cpp:843
LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy)
Determine whether a structure is opaque.
Definition Core.cpp:868
unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy)
Get the number of elements defined inside the structure.
Definition Core.cpp:849
const char * LLVMGetStructName(LLVMTypeRef Ty)
Obtain the name of a structure.
Definition Core.cpp:835
LLVMBool LLVMIsLiteralStruct(LLVMTypeRef StructTy)
Determine whether a structure is literal.
Definition Core.cpp:872
void LLVMDumpType(LLVMTypeRef Ty)
Dump a representation of a type to stderr.
Definition Core.cpp:661
LLVMBool LLVMTypeIsSized(LLVMTypeRef Ty)
Whether the type has a known size.
Definition Core.cpp:652
LLVMContextRef LLVMGetTypeContext(LLVMTypeRef Ty)
Obtain the context to which this type instance is associated.
Definition Core.cpp:657
char * LLVMPrintTypeToString(LLVMTypeRef Ty)
Return a string representation of the type.
Definition Core.cpp:665
LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty)
Obtain the enumerated type of a Type instance.
Definition Core.cpp:602
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:3002
void LLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to after another one.
Definition Core.cpp:2984
LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn)
Obtain the first basic block in a function.
Definition Core.cpp:2900
LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C, const char *Name)
Create a new basic block without inserting it into a function.
Definition Core.cpp:2932
LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB)
Go backwards in a basic block iterator.
Definition Core.cpp:2924
LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn)
Obtain the last basic block in a function.
Definition Core.cpp:2908
LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB)
Obtain the terminator instruction for a basic block.
Definition Core.cpp:2882
const char * LLVMGetBasicBlockName(LLVMBasicBlockRef BB)
Obtain the string name of a basic block.
Definition Core.cpp:2874
void LLVMAppendExistingBasicBlock(LLVMValueRef Fn, LLVMBasicBlockRef BB)
Append the given basic block to the basic block list of the given function.
Definition Core.cpp:2945
void LLVMDeleteBasicBlock(LLVMBasicBlockRef BBRef)
Remove a basic block from a function and delete it.
Definition Core.cpp:2972
LLVMBasicBlockRef LLVMInsertBasicBlockInContext(LLVMContextRef C, LLVMBasicBlockRef BBRef, const char *Name)
Insert a basic block in a function before another basic block.
Definition Core.cpp:2960
void LLVMGetBasicBlocks(LLVMValueRef FnRef, LLVMBasicBlockRef *BasicBlocksRefs)
Obtain all of the basic blocks in a function.
Definition Core.cpp:2890
void LLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to before another one.
Definition Core.cpp:2980
LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB)
Obtain the function to which a basic block belongs.
Definition Core.cpp:2878
LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn)
Obtain the basic block that corresponds to the entry point of a function.
Definition Core.cpp:2896
LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB)
Obtain the first instruction in a basic block.
Definition Core.cpp:2994
void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder, LLVMBasicBlockRef BB)
Insert the given basic block after the insertion point of the given builder.
Definition Core.cpp:2937
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB)
Convert a basic block instance to a value type.
Definition Core.cpp:2862
LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val)
Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
Definition Core.cpp:2870
void LLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BBRef)
Remove a basic block from a function.
Definition Core.cpp:2976
LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB)
Advance a basic block iterator.
Definition Core.cpp:2916
unsigned LLVMCountBasicBlocks(LLVMValueRef FnRef)
Obtain the number of basic blocks in a function.
Definition Core.cpp:2886
LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C, LLVMValueRef FnRef, const char *Name)
Append a basic block to the end of a function.
Definition Core.cpp:2950
LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val)
Determine whether an LLVMValueRef is itself a basic block.
Definition Core.cpp:2866
LLVMValueRef LLVMConstantPtrAuth(LLVMValueRef Ptr, LLVMValueRef Key, LLVMValueRef Disc, LLVMValueRef AddrDisc)
Create a ConstantPtrAuth constant with the given values.
Definition Core.cpp:1768
LLVMValueRef LLVMGetAggregateElement(LLVMValueRef C, unsigned Idx)
Get element of a constant aggregate (struct, array or vector) at the specified index.
Definition Core.cpp:1697
LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size)
Create a ConstantVector from values.
Definition Core.cpp:1763
LLVMValueRef LLVMConstStringInContext2(LLVMContextRef C, const char *Str, size_t Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential and initialize it with a string.
Definition Core.cpp:1682
LLVMValueRef LLVMConstDataArray(LLVMTypeRef ElementTy, const char *Data, size_t SizeInBytes)
Create a ConstantDataArray from raw values.
Definition Core.cpp:1733
LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, unsigned Length)
Create a ConstantArray from values.
Definition Core.cpp:1721
LLVMBool LLVMIsConstantString(LLVMValueRef C)
Returns true if the specified constant is an array of i8.
Definition Core.cpp:1705
LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str, unsigned Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential and initialize it with a string.
Definition Core.cpp:1673
LLVMValueRef LLVMConstArray2(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, uint64_t Length)
Create a ConstantArray from values.
Definition Core.cpp:1727
const char * LLVMGetAsString(LLVMValueRef C, size_t *Length)
Get the given constant data sequential as a string.
Definition Core.cpp:1709
LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy, LLVMValueRef *ConstantVals, unsigned Count)
Create a non-anonymous ConstantStruct from values.
Definition Core.cpp:1754
const char * LLVMGetRawDataValues(LLVMValueRef C, size_t *SizeInBytes)
Get the raw, underlying bytes of the given constant data sequential.
Definition Core.cpp:1715
LLVMValueRef LLVMConstStructInContext(LLVMContextRef C, LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
Create an anonymous ConstantStruct with the specified values.
Definition Core.cpp:1740
LLVMValueRef LLVMConstAddrSpaceCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1944
LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty)
Definition Core.cpp:1835
LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1856
LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1873
LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1950
LLVMValueRef LLVMAlignOf(LLVMTypeRef Ty)
Definition Core.cpp:1831
LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1939
LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1884
LLVMValueRef LLVMConstGEPWithNoWrapFlags(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices, LLVMGEPNoWrapFlags NoWrapFlags)
Creates a constant GetElementPtr expression.
Definition Core.cpp:1912
LLVMOpcode LLVMGetConstOpcode(LLVMValueRef ConstantVal)
Definition Core.cpp:1827
LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, LLVMValueRef IndexConstant)
Definition Core.cpp:1962
LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1861
LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal)
Definition Core.cpp:1839
LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1956
LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant, LLVMValueRef ElementValueConstant, LLVMValueRef IndexConstant)
Definition Core.cpp:1968
LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1890
LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1878
LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant, LLVMValueRef VectorBConstant, LLVMValueRef MaskConstant)
Definition Core.cpp:1976
LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1924
LLVMValueRef LLVMConstGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
Definition Core.cpp:1895
LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB)
Definition Core.cpp:1994
LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal)
Definition Core.cpp:1852
LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1867
LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1929
LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1934
LLVMValueRef LLVMConstInBoundsGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
Definition Core.cpp:1903
LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString, const char *Constraints, LLVMBool HasSideEffects, LLVMBool IsAlignStack)
Deprecated: Use LLVMGetInlineAsm instead.
Definition Core.cpp:1986
LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal)
Definition Core.cpp:1843
LLVMValueRef LLVMGetBlockAddressFunction(LLVMValueRef BlockAddr)
Gets the function associated with a given BlockAddress constant value.
Definition Core.cpp:1998
LLVMBasicBlockRef LLVMGetBlockAddressBasicBlock(LLVMValueRef BlockAddr)
Gets the basic block associated with a given BlockAddress constant value.
Definition Core.cpp:2002
LLVMUnnamedAddr LLVMGetUnnamedAddress(LLVMValueRef Global)
Definition Core.cpp:2140
LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global)
Returns the "value type" of a global value.
Definition Core.cpp:2175
unsigned LLVMGetAlignment(LLVMValueRef V)
Obtain the preferred alignment of the value.
Definition Core.cpp:2181
void LLVMSetSection(LLVMValueRef Global, const char *Section)
Definition Core.cpp:2116
void LLVMSetUnnamedAddress(LLVMValueRef Global, LLVMUnnamedAddr UnnamedAddr)
Definition Core.cpp:2152
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:2256
void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage)
Definition Core.cpp:2045
void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr)
Deprecated: Use LLVMSetUnnamedAddress instead.
Definition Core.cpp:2169
LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global)
Definition Core.cpp:2008
unsigned LLVMValueMetadataEntriesGetKind(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the kind of a value metadata entry at a specific index.
Definition Core.cpp:2237
void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class)
Definition Core.cpp:2135
LLVMVisibility LLVMGetVisibility(LLVMValueRef Global)
Definition Core.cpp:2120
LLVMValueMetadataEntry * LLVMGlobalCopyAllMetadata(LLVMValueRef Value, size_t *NumEntries)
Retrieves an array of metadata entries representing the metadata attached to this value.
Definition Core.cpp:2225
void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes)
Set the preferred alignment of the value.
Definition Core.cpp:2203
const char * LLVMGetSection(LLVMValueRef Global)
Definition Core.cpp:2110
void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz)
Definition Core.cpp:2125
LLVMLinkage LLVMGetLinkage(LLVMValueRef Global)
Definition Core.cpp:2016
void LLVMGlobalEraseMetadata(LLVMValueRef Global, unsigned Kind)
Erases a metadata attachment of the given kind if it exists.
Definition Core.cpp:2266
LLVMDLLStorageClass LLVMGetDLLStorageClass(LLVMValueRef Global)
Definition Core.cpp:2130
LLVMBool LLVMIsDeclaration(LLVMValueRef Global)
Definition Core.cpp:2012
void LLVMGlobalClearMetadata(LLVMValueRef Global)
Removes all metadata attachments from this value.
Definition Core.cpp:2270
void LLVMGlobalAddMetadata(LLVMValueRef Global, unsigned Kind, LLVMMetadataRef MD)
Adds a metadata attachment.
Definition Core.cpp:2261
LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global)
Deprecated: Use LLVMGetUnnamedAddress instead.
Definition Core.cpp:2165
LLVMMetadataRef LLVMValueMetadataEntriesGetMetadata(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the underlying metadata node of a value metadata entry at a specific index.
Definition Core.cpp:2245
void LLVMDisposeValueMetadataEntries(LLVMValueMetadataEntry *Entries)
Destroys value metadata entries.
Definition Core.cpp:2252
void LLVMGlobalAddDebugInfo(LLVMValueRef Global, LLVMMetadataRef GVE)
Add debuginfo metadata to this global.
Definition Core.cpp:2274
LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N, LLVMBool SignExtend)
Obtain a constant value for an integer type.
Definition Core.cpp:1568
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:1630
LLVMValueRef LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy, unsigned NumWords, const uint64_t Words[])
Obtain a constant value for an integer of arbitrary precision.
Definition Core.cpp:1573
long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal)
Obtain the sign extended value for an integer constant value.
Definition Core.cpp:1642
unsigned long long LLVMConstByteGetZExtValue(LLVMValueRef ConstantVal)
Obtain the zero extended value for a byte constant value.
Definition Core.cpp:1646
LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text)
Obtain a constant for a floating point value parsed from a string.
Definition Core.cpp:1621
LLVMValueRef LLVMConstByteOfArbitraryPrecision(LLVMTypeRef ByteTy, unsigned NumWords, const uint64_t Words[])
Obtain a constant value for a byte of arbitrary precision.
Definition Core.cpp:1597
double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *LosesInfo)
Obtain the double value for an floating point constant value.
Definition Core.cpp:1654
LLVMValueRef LLVMConstByte(LLVMTypeRef ByteTy, unsigned long long N)
Obtain a constant value for a byte type.
Definition Core.cpp:1593
LLVMValueRef LLVMConstReal(LLVMTypeRef RealTy, double N)
Obtain a constant value referring to a double floating point value.
Definition Core.cpp:1617
long long LLVMConstByteGetSExtValue(LLVMValueRef ConstantVal)
Obtain the sign extended value for a byte constant value.
Definition Core.cpp:1650
unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal)
Obtain the zero extended value for an integer constant value.
Definition Core.cpp:1638
LLVMValueRef LLVMGetPoison(LLVMTypeRef Ty)
Obtain a constant value referring to a poison value of a type.
Definition Core.cpp:1283
LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty)
Obtain a constant that is a constant pointer pointing to NULL for a specified type.
Definition Core.cpp:1305
LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty)
Obtain a constant value referring to an undefined value of a type.
Definition Core.cpp:1279
LLVMBool LLVMIsNull(LLVMValueRef Val)
Determine whether a value instance is null.
Definition Core.cpp:1291
LLVMValueRef LLVMConstNull(LLVMTypeRef Ty)
Obtain a constant value referring to the null instance of a type.
Definition Core.cpp:1271
LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty)
Obtain a constant value referring to the instance of a type consisting of all ones.
Definition Core.cpp:1275
LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg)
Obtain the previous parameter to a function.
Definition Core.cpp:2755
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align)
Set the alignment for a function parameter.
Definition Core.cpp:2762
unsigned LLVMCountParams(LLVMValueRef FnRef)
Obtain the number of parameters in a function.
Definition Core.cpp:2710
void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs)
Obtain the parameters in a function.
Definition Core.cpp:2716
LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn)
Obtain the first parameter to a function.
Definition Core.cpp:2731
LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn)
Obtain the last parameter to a function.
Definition Core.cpp:2739
LLVMValueRef LLVMGetParam(LLVMValueRef FnRef, unsigned index)
Obtain the parameter at the specified index.
Definition Core.cpp:2722
LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg)
Obtain the next parameter to a function.
Definition Core.cpp:2747
LLVMValueRef LLVMGetParamParent(LLVMValueRef V)
Obtain the function to which this argument belongs.
Definition Core.cpp:2727
void LLVMAddAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Add an attribute to a function.
Definition Core.cpp:2660
LLVMValueRef LLVMGetPrefixData(LLVMValueRef Fn)
Gets the prefix data associated with a function.
Definition Core.cpp:2628
LLVMValueRef LLVMGetPrologueData(LLVMValueRef Fn)
Gets the prologue data associated with a function.
Definition Core.cpp:2644
LLVMTypeRef LLVMIntrinsicGetType(LLVMContextRef Ctx, unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount)
Retrieves the type of an intrinsic.
Definition Core.cpp:2571
unsigned LLVMGetIntrinsicID(LLVMValueRef Fn)
Obtain the ID number from a function instance.
Definition Core.cpp:2544
LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn)
Obtain the personality function attached to the function.
Definition Core.cpp:2535
unsigned LLVMGetAttributeCountAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx)
Definition Core.cpp:2665
LLVMBool LLVMHasPersonalityFn(LLVMValueRef Fn)
Check whether the given function has a personality function.
Definition Core.cpp:2531
void LLVMRemoveStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:2696
void LLVMSetPrefixData(LLVMValueRef Fn, LLVMValueRef prefixData)
Sets the prefix data for the function.
Definition Core.cpp:2638
char * LLVMIntrinsicCopyOverloadedName(unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount, size_t *NameLength)
Deprecated: Use LLVMIntrinsicCopyOverloadedName2 instead.
Definition Core.cpp:2578
const char * LLVMGetGC(LLVMValueRef Fn)
Obtain the name of the garbage collector to use during code generation.
Definition Core.cpp:2615
void LLVMSetGC(LLVMValueRef Fn, const char *GC)
Define the garbage collector to use during code generation.
Definition Core.cpp:2620
void LLVMSetPrologueData(LLVMValueRef Fn, LLVMValueRef prologueData)
Sets the prologue data for the function.
Definition Core.cpp:2654
void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn)
Set the personality function attached to the function.
Definition Core.cpp:2539
void LLVMGetAttributesAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
Definition Core.cpp:2670
unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn)
Obtain the calling function of a function.
Definition Core.cpp:2606
LLVMBool LLVMIntrinsicIsOverloaded(unsigned ID)
Obtain if the intrinsic identified by the given ID is overloaded.
Definition Core.cpp:2601
char * LLVMIntrinsicCopyOverloadedName2(LLVMModuleRef Mod, unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount, size_t *NameLength)
Copies the name of an overloaded intrinsic identified by a given list of parameter types.
Definition Core.cpp:2587
void LLVMDeleteFunction(LLVMValueRef Fn)
Remove a function from its containing module and deletes it.
Definition Core.cpp:2527
void LLVMRemoveEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:2691
LLVMAttributeRef LLVMGetEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:2677
unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen)
Obtain the intrinsic ID number which matches the given function name.
Definition Core.cpp:2597
const char * LLVMIntrinsicGetName(unsigned ID, size_t *NameLength)
Retrieves the name of an intrinsic.
Definition Core.cpp:2564
LLVMValueRef LLVMGetIntrinsicDeclaration(LLVMModuleRef Mod, unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount)
Get or insert the declaration of an intrinsic.
Definition Core.cpp:2555
LLVMBool LLVMHasPrologueData(LLVMValueRef Fn)
Check if a given function has prologue data.
Definition Core.cpp:2649
LLVMBool LLVMHasPrefixData(LLVMValueRef Fn)
Check if a given function has prefix data.
Definition Core.cpp:2633
void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC)
Set the calling convention of a function.
Definition Core.cpp:2610
void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A, const char *V)
Add a target-dependent attribute to a function.
Definition Core.cpp:2701
LLVMAttributeRef LLVMGetStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:2684
LLVMValueRef LLVMIsAMDString(LLVMValueRef Val)
Definition Core.cpp:1195
LLVMBool LLVMIsPoison(LLVMValueRef Val)
Determine whether a value instance is poisonous.
Definition Core.cpp:1301
LLVMValueKind LLVMGetValueKind(LLVMValueRef Val)
Obtain the enumerated type of a Value instance.
Definition Core.cpp:1034
void LLVMDumpValue(LLVMValueRef Val)
Dump a representation of a value to stderr.
Definition Core.cpp:1064
const char * LLVMGetValueName(LLVMValueRef Val)
Deprecated: Use LLVMGetValueName2 instead.
Definition Core.cpp:1056
LLVMContextRef LLVMGetValueContext(LLVMValueRef Val)
Obtain the context to which this value is associated.
Definition Core.cpp:1080
void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal)
Replace all uses of a value with another one.
Definition Core.cpp:1096
const char * LLVMGetValueName2(LLVMValueRef Val, size_t *Length)
Obtain the string name of a value.
Definition Core.cpp:1046
void LLVMSetValueName(LLVMValueRef Val, const char *Name)
Deprecated: Use LLVMSetValueName2 instead.
Definition Core.cpp:1060
LLVMValueRef LLVMIsAMDNode(LLVMValueRef Val)
Definition Core.cpp:1180
char * LLVMPrintDbgRecordToString(LLVMDbgRecordRef Record)
Return a string representation of the DbgRecord.
Definition Core.cpp:1084
LLVMBool LLVMIsUndef(LLVMValueRef Val)
Determine whether a value instance is undefined.
Definition Core.cpp:1297
LLVMTypeRef LLVMTypeOf(LLVMValueRef Val)
Obtain the type of a value.
Definition Core.cpp:1030
char * LLVMPrintValueToString(LLVMValueRef Val)
Return a string representation of the value.
Definition Core.cpp:1068
LLVMValueRef LLVMIsAValueAsMetadata(LLVMValueRef Val)
Definition Core.cpp:1188
LLVMBool LLVMIsConstant(LLVMValueRef Ty)
Determine whether the specified value instance is constant.
Definition Core.cpp:1287
void LLVMSetValueName2(LLVMValueRef Val, const char *Name, size_t NameLen)
Set the string name of a value.
Definition Core.cpp:1052
LLVMValueRef LLVMGetFirstGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the first GlobalIFunc in a Module.
Definition Core.cpp:2784
LLVMValueRef LLVMGetNamedGlobalIFunc(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalIFunc value from a Module by its name.
Definition Core.cpp:2779
void LLVMRemoveGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module.
Definition Core.cpp:2828
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:2769
LLVMValueRef LLVMGetNextGlobalIFunc(LLVMValueRef IFunc)
Advance a GlobalIFunc iterator to the next GlobalIFunc.
Definition Core.cpp:2800
LLVMValueRef LLVMGetPreviousGlobalIFunc(LLVMValueRef IFunc)
Decrement a GlobalIFunc iterator to the previous GlobalIFunc.
Definition Core.cpp:2808
LLVMValueRef LLVMGetGlobalIFuncResolver(LLVMValueRef IFunc)
Retrieves the resolver function associated with this indirect function, or NULL if it doesn't not exi...
Definition Core.cpp:2816
void LLVMSetGlobalIFuncResolver(LLVMValueRef IFunc, LLVMValueRef Resolver)
Sets the resolver function associated with this indirect function.
Definition Core.cpp:2820
LLVMValueRef LLVMGetLastGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the last GlobalIFunc in a Module.
Definition Core.cpp:2792
void LLVMEraseGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module and delete it.
Definition Core.cpp:2824
LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca)
Obtain the type that is being allocated by the alloca instruction.
Definition Core.cpp:3337
void LLVMSetTailCall(LLVMValueRef Call, LLVMBool isTailCall)
Set whether a call instruction is a tail call.
Definition Core.cpp:3236
void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Definition Core.cpp:3168
unsigned LLVMGetNumOperandBundles(LLVMValueRef C)
Obtain the number of operand bundles attached to this instruction.
Definition Core.cpp:3220
void LLVMRemoveCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:3202
void LLVMRemoveCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:3207
LLVMAttributeRef LLVMGetCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:3188
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr)
Obtain the calling convention for a call instruction.
Definition Core.cpp:3151
LLVMBasicBlockRef LLVMGetCallBrDefaultDest(LLVMValueRef CallBr)
Get the default destination of a CallBr instruction.
Definition Core.cpp:3276
LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr)
Obtain the pointer to the function invoked by this instruction.
Definition Core.cpp:3212
void LLVMSetNormalDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the normal destination basic block.
Definition Core.cpp:3263
LLVMBool LLVMIsTailCall(LLVMValueRef Call)
Obtain whether a call instruction is a tail call.
Definition Core.cpp:3232
LLVMAttributeRef LLVMGetCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:3195
unsigned LLVMGetCallBrNumIndirectDests(LLVMValueRef CallBr)
Get the number of indirect destinations of a CallBr instruction.
Definition Core.cpp:3280
void LLVMGetCallSiteAttributes(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
Definition Core.cpp:3180
LLVMBasicBlockRef LLVMGetNormalDest(LLVMValueRef Invoke)
Return the normal destination basic block.
Definition Core.cpp:3250
unsigned LLVMGetNumArgOperands(LLVMValueRef Instr)
Obtain the argument count for a call instruction.
Definition Core.cpp:3142
void LLVMSetTailCallKind(LLVMValueRef Call, LLVMTailCallKind kind)
Set the call kind of the call instruction.
Definition Core.cpp:3244
LLVMOperandBundleRef LLVMGetOperandBundleAtIndex(LLVMValueRef C, unsigned Index)
Obtain the operand bundle attached to this instruction at the given index.
Definition Core.cpp:3224
LLVMBasicBlockRef LLVMGetCallBrIndirectDest(LLVMValueRef CallBr, unsigned Idx)
Get the indirect destination of a CallBr instruction at the given index.
Definition Core.cpp:3284
LLVMTailCallKind LLVMGetTailCallKind(LLVMValueRef Call)
Obtain a tail call kind of the call instruction.
Definition Core.cpp:3240
void LLVMSetUnwindDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the unwind destination basic block.
Definition Core.cpp:3267
LLVMTypeRef LLVMGetCalledFunctionType(LLVMValueRef Instr)
Obtain the function type called by this instruction.
Definition Core.cpp:3216
LLVMBasicBlockRef LLVMGetUnwindDest(LLVMValueRef Invoke)
Return the unwind destination basic block.
Definition Core.cpp:3254
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, LLVMAttributeIndex Idx, unsigned align)
Definition Core.cpp:3160
unsigned LLVMGetCallSiteAttributeCount(LLVMValueRef C, LLVMAttributeIndex Idx)
Definition Core.cpp:3173
void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC)
Set the calling convention for a call instruction.
Definition Core.cpp:3155
LLVMGEPNoWrapFlags LLVMGEPGetNoWrapFlags(LLVMValueRef GEP)
Get the no-wrap related flags for the given GEP instruction.
Definition Core.cpp:3355
LLVMBool LLVMIsInBounds(LLVMValueRef GEP)
Check whether the given GEP operator is inbounds.
Definition Core.cpp:3343
void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds)
Set the given GEP instruction to be inbounds or not.
Definition Core.cpp:3347
LLVMTypeRef LLVMGetGEPSourceElementType(LLVMValueRef GEP)
Get the source element type of the given GEP operator.
Definition Core.cpp:3351
void LLVMGEPSetNoWrapFlags(LLVMValueRef GEP, LLVMGEPNoWrapFlags NoWrapFlags)
Set the no-wrap related flags for the given GEP instruction.
Definition Core.cpp:3360
unsigned LLVMGetNumIndices(LLVMValueRef Inst)
Obtain the number of indices.
Definition Core.cpp:3388
const unsigned * LLVMGetIndices(LLVMValueRef Inst)
Obtain the indices as an array.
Definition Core.cpp:3400
LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
Definition Core.cpp:3382
LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMValueRef.
Definition Core.cpp:3378
void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues, LLVMBasicBlockRef *IncomingBlocks, unsigned Count)
Add an incoming value to the end of a PHI list.
Definition Core.cpp:3367
unsigned LLVMCountIncoming(LLVMValueRef PhiNode)
Obtain the number of incoming basic blocks to a PHI node.
Definition Core.cpp:3374
LLVMValueRef LLVMGetCondition(LLVMValueRef Branch)
Return the condition of a branch instruction.
Definition Core.cpp:3308
LLVMBasicBlockRef LLVMGetSuccessor(LLVMValueRef Term, unsigned i)
Return the specified successor.
Definition Core.cpp:3294
void LLVMSetCondition(LLVMValueRef Branch, LLVMValueRef Cond)
Set the condition of a branch instruction.
Definition Core.cpp:3312
void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block)
Update the specified successor to point at the provided block.
Definition Core.cpp:3298
LLVMValueRef LLVMGetSwitchCaseValue(LLVMValueRef Switch, unsigned i)
Obtain the case value for a successor of a switch instruction.
Definition Core.cpp:3322
LLVMBool LLVMIsConditional(LLVMValueRef Branch)
Return if an instruction is a conditional branch.
Definition Core.cpp:3304
LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef Switch)
Obtain the default destination basic block of a switch instruction.
Definition Core.cpp:3318
void LLVMSetSwitchCaseValue(LLVMValueRef Switch, unsigned i, LLVMValueRef CaseValue)
Set the case value for a successor of a switch instruction.
Definition Core.cpp:3328
unsigned LLVMGetNumSuccessors(LLVMValueRef Term)
Return the number of successors that this terminator has.
Definition Core.cpp:3290
LLVMRealPredicate LLVMGetFCmpPredicate(LLVMValueRef Inst)
Obtain the float predicate of an instruction.
Definition Core.cpp:3052
int LLVMHasMetadata(LLVMValueRef Inst)
Determine whether an instruction has any metadata attached.
Definition Core.cpp:1100
void LLVMInstructionRemoveFromParent(LLVMValueRef Inst)
Remove an instruction.
Definition Core.cpp:3026
LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst)
Obtain the instruction that occurred before this one.
Definition Core.cpp:3018
LLVMDbgRecordRef LLVMGetPreviousDbgRecord(LLVMDbgRecordRef Rec)
Obtain the previous DbgRecord in the sequence or NULL if there are no more.
Definition Core.cpp:3103
LLVMMetadataRef LLVMDbgVariableRecordGetExpression(LLVMDbgRecordRef Rec)
Get the debug info expression of the DbgVariableRecord.
Definition Core.cpp:3138
LLVMDbgRecordRef LLVMGetFirstDbgRecord(LLVMValueRef Inst)
Obtain the first debug record attached to an instruction.
Definition Core.cpp:3075
LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst)
Obtain the code opcode for an individual instruction.
Definition Core.cpp:3058
LLVMDbgRecordRef LLVMGetNextDbgRecord(LLVMDbgRecordRef Rec)
Obtain the next DbgRecord in the sequence or NULL if there are no more.
Definition Core.cpp:3095
LLVMDbgRecordRef LLVMGetLastDbgRecord(LLVMValueRef Inst)
Obtain the last debug record attached to an instruction.
Definition Core.cpp:3085
LLVMMetadataRef LLVMDbgVariableRecordGetVariable(LLVMDbgRecordRef Rec)
Get the debug info variable of the DbgVariableRecord.
Definition Core.cpp:3134
LLVMValueRef LLVMIsATerminatorInst(LLVMValueRef Inst)
Determine whether an instruction is a terminator.
Definition Core.cpp:3070
LLVMValueRef LLVMDbgVariableRecordGetValue(LLVMDbgRecordRef Rec, unsigned OpIdx)
Get the value of the DbgVariableRecord.
Definition Core.cpp:3129
LLVMDbgRecordKind LLVMDbgRecordGetKind(LLVMDbgRecordRef Rec)
Definition Core.cpp:3115
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:1157
void LLVMDeleteInstruction(LLVMValueRef Inst)
Delete an instruction.
Definition Core.cpp:3034
LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst)
Obtain the basic block to which an instruction belongs.
Definition Core.cpp:2990
LLVMMetadataRef LLVMDbgRecordGetDebugLoc(LLVMDbgRecordRef Rec)
Get the debug location attached to the debug record.
Definition Core.cpp:3111
LLVMBool LLVMGetICmpSameSign(LLVMValueRef Inst)
Get whether or not an icmp instruction has the samesign flag.
Definition Core.cpp:3044
LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst)
Create a copy of 'this' instruction that is identical in all ways except the following:
Definition Core.cpp:3064
void LLVMInstructionEraseFromParent(LLVMValueRef Inst)
Remove and delete an instruction.
Definition Core.cpp:3030
void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef Val)
Set metadata associated with an instruction value.
Definition Core.cpp:1126
LLVMValueRef LLVMGetMetadata(LLVMValueRef Inst, unsigned KindID)
Return metadata associated with an instruction value.
Definition Core.cpp:1104
LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst)
Obtain the predicate of an instruction.
Definition Core.cpp:3038
LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst)
Obtain the instruction that occurs after the one specified.
Definition Core.cpp:3010
void LLVMSetICmpSameSign(LLVMValueRef Inst, LLVMBool SameSign)
Set the samesign flag on an icmp instruction.
Definition Core.cpp:3048
LLVMMetadataRef LLVMMDNodeInContext2(LLVMContextRef C, LLVMMetadataRef *MDs, size_t Count)
Create an MDNode value with the given array of operands.
Definition Core.cpp:1316
const char * LLVMGetMDString(LLVMValueRef V, unsigned *Length)
Obtain the underlying string from a MDString value.
Definition Core.cpp:1376
LLVMValueRef LLVMMetadataAsValue(LLVMContextRef C, LLVMMetadataRef MD)
Obtain a Metadata as a Value.
Definition Core.cpp:1363
unsigned LLVMGetMDNodeNumOperands(LLVMValueRef V)
Obtain the number of operands from an MDNode value.
Definition Core.cpp:1386
LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str, unsigned SLen)
Deprecated: Use LLVMMDStringInContext2 instead.
Definition Core.cpp:1321
LLVMMetadataRef LLVMMDStringInContext2(LLVMContextRef C, const char *Str, size_t SLen)
Create an MDString value from a given string value.
Definition Core.cpp:1311
LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals, unsigned Count)
Deprecated: Use LLVMMDNodeInContext2 instead.
Definition Core.cpp:1332
void LLVMReplaceMDNodeOperandWith(LLVMValueRef V, unsigned Index, LLVMMetadataRef Replacement)
Replace an operand at a specific index in a llvm::MDNode value.
Definition Core.cpp:1454
LLVMMetadataRef LLVMValueAsMetadata(LLVMValueRef Val)
Obtain a Value as a Metadata.
Definition Core.cpp:1367
void LLVMGetMDNodeOperands(LLVMValueRef V, LLVMValueRef *Dest)
Obtain the given MDNode's operands.
Definition Core.cpp:1441
LLVMUseRef LLVMGetOperandUse(LLVMValueRef Val, unsigned Index)
Obtain the use of an operand at a specific index in a llvm::User value.
Definition Core.cpp:1252
int LLVMGetNumOperands(LLVMValueRef Val)
Obtain the number of operands in a llvm::User value.
Definition Core.cpp:1261
void LLVMSetOperand(LLVMValueRef Val, unsigned Index, LLVMValueRef Op)
Set an operand at a specific index in a llvm::User value.
Definition Core.cpp:1257
LLVMValueRef LLVMGetOperand(LLVMValueRef Val, unsigned Index)
Obtain an operand at a specific index in a llvm::User value.
Definition Core.cpp:1238
LLVMValueRef LLVMGetUser(LLVMUseRef U)
Obtain the user value for a user.
Definition Core.cpp:1218
LLVMValueRef LLVMGetUsedValue(LLVMUseRef U)
Obtain the value this use corresponds to.
Definition Core.cpp:1222
LLVMUseRef LLVMGetNextUse(LLVMUseRef U)
Obtain the next use of a value.
Definition Core.cpp:1211
LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val)
Obtain the first use of a value.
Definition Core.cpp:1203
#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:2417
LLVMValueRef LLVMGetLastGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the last GlobalAlias in a Module.
Definition Core.cpp:2438
LLVMValueRef LLVMGetPreviousGlobalAlias(LLVMValueRef GA)
Decrement a GlobalAlias iterator to the previous GlobalAlias.
Definition Core.cpp:2454
void LLVMAliasSetAliasee(LLVMValueRef Alias, LLVMValueRef Aliasee)
Set the target value of an alias.
Definition Core.cpp:2466
LLVMValueRef LLVMGetFirstGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the first GlobalAlias in a Module.
Definition Core.cpp:2430
LLVMValueRef LLVMAliasGetAliasee(LLVMValueRef Alias)
Retrieve the target value of an alias.
Definition Core.cpp:2462
LLVMValueRef LLVMGetNamedGlobalAlias(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalAlias value from a Module by its name.
Definition Core.cpp:2425
LLVMValueRef LLVMGetNextGlobalAlias(LLVMValueRef GA)
Advance a GlobalAlias iterator to the next GlobalAlias.
Definition Core.cpp:2446
LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar)
Definition Core.cpp:2352
LLVMThreadLocalMode LLVMGetThreadLocalMode(LLVMValueRef GlobalVar)
Definition Core.cpp:2368
LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar)
Definition Core.cpp:2360
LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2328
void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal)
Definition Core.cpp:2356
LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar)
Definition Core.cpp:2407
LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M)
Definition Core.cpp:2312
LLVMValueRef LLVMGetNamedGlobalWithLength(LLVMModuleRef M, const char *Name, size_t Length)
Definition Core.cpp:2299
LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M)
Definition Core.cpp:2304
void LLVMSetThreadLocalMode(LLVMValueRef GlobalVar, LLVMThreadLocalMode Mode)
Definition Core.cpp:2385
LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2320
void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit)
Definition Core.cpp:2411
LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name)
Definition Core.cpp:2295
LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name, unsigned AddressSpace)
Definition Core.cpp:2286
void LLVMDeleteGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2336
void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant)
Definition Core.cpp:2364
LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:2281
LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar)
Definition Core.cpp:2340
void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal)
Definition Core.cpp:2347
#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
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
LLVM_ABI Function * getOrInsertDeclaration(Module *M, ID id, ArrayRef< Type * > Tys={})
Look up the Function declaration of the intrinsic id in the Module M.
LLVM_ABI std::string getNameNoUnnamedTypes(ID Id, ArrayRef< Type * > Tys)
Return the LLVM name for an intrinsic.
LLVM_ABI StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
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 * > Tys={})
Return the function type 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:764
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
@ Length
Definition DWP.cpp:532
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
FunctionAddr VTableAddr Count
Definition InstrProf.h:139
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:394
FunctionAddr VTableAddr uintptr_t uintptr_t Data
Definition InstrProf.h:189
Attribute unwrap(LLVMAttributeRef Attr)
Definition Attributes.h:397
OperandBundleDefT< Value * > OperandBundleDef
Definition AutoUpgrade.h:34
FunctionAddr VTableAddr Next
Definition InstrProf.h:141
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
LLVM_ABI void initializeSafepointIRVerifierPass(PassRegistry &)
#define N
LLVMModuleFlagBehavior Behavior
Definition Core.cpp:352
LLVMMetadataRef Metadata
Definition Core.cpp:355
LLVMMetadataRef Metadata
Definition Core.cpp:1134
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