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 Module *Mod = unwrap(M);
514 ArrayRef<Module::GlobalAsmFragment> Frags = Mod->getModuleInlineAsm();
515 if (Frags.empty()) {
516 *Len = 0;
517 return nullptr;
518 }
519
520 if (Frags.size() != 1)
521 reportFatalUsageError("LLVMGetModuleInlineAsm is not supported if there is "
522 "more than one module inline assembly fragment");
523
524 auto &Str = Frags.begin()->Asm;
525 *Len = Str.length();
526 return Str.c_str();
527}
528
529LLVMValueRef LLVMGetInlineAsm(LLVMTypeRef Ty, const char *AsmString,
530 size_t AsmStringSize, const char *Constraints,
531 size_t ConstraintsSize, LLVMBool HasSideEffects,
532 LLVMBool IsAlignStack,
533 LLVMInlineAsmDialect Dialect, LLVMBool CanThrow) {
535 switch (Dialect) {
538 break;
541 break;
542 }
544 StringRef(AsmString, AsmStringSize),
545 StringRef(Constraints, ConstraintsSize),
546 HasSideEffects, IsAlignStack, AD, CanThrow));
547}
548
549const char *LLVMGetInlineAsmAsmString(LLVMValueRef InlineAsmVal, size_t *Len) {
550
551 Value *Val = unwrap<Value>(InlineAsmVal);
552 StringRef AsmString = cast<InlineAsm>(Val)->getAsmString();
553
554 *Len = AsmString.size();
555 return AsmString.data();
556}
557
559 size_t *Len) {
560 Value *Val = unwrap<Value>(InlineAsmVal);
561 StringRef ConstraintString = cast<InlineAsm>(Val)->getConstraintString();
562
563 *Len = ConstraintString.size();
564 return ConstraintString.data();
565}
566
568
569 Value *Val = unwrap<Value>(InlineAsmVal);
570 InlineAsm::AsmDialect Dialect = cast<InlineAsm>(Val)->getDialect();
571
572 switch (Dialect) {
577 }
578
579 llvm_unreachable("Unrecognized inline assembly dialect");
581}
582
584 Value *Val = unwrap<Value>(InlineAsmVal);
585 return (LLVMTypeRef)cast<InlineAsm>(Val)->getFunctionType();
586}
587
589 Value *Val = unwrap<Value>(InlineAsmVal);
590 return cast<InlineAsm>(Val)->hasSideEffects();
591}
592
594 Value *Val = unwrap<Value>(InlineAsmVal);
595 return cast<InlineAsm>(Val)->isAlignStack();
596}
597
599 Value *Val = unwrap<Value>(InlineAsmVal);
600 return cast<InlineAsm>(Val)->canThrow();
601}
602
603/*--.. Operations on module contexts ......................................--*/
607
608
609/*===-- Operations on types -----------------------------------------------===*/
610
611/*--.. Operations on all types (mostly) ....................................--*/
612
614 switch (unwrap(Ty)->getTypeID()) {
615 case Type::VoidTyID:
616 return LLVMVoidTypeKind;
617 case Type::HalfTyID:
618 return LLVMHalfTypeKind;
619 case Type::BFloatTyID:
620 return LLVMBFloatTypeKind;
621 case Type::FloatTyID:
622 return LLVMFloatTypeKind;
623 case Type::DoubleTyID:
624 return LLVMDoubleTypeKind;
627 case Type::FP128TyID:
628 return LLVMFP128TypeKind;
631 case Type::LabelTyID:
632 return LLVMLabelTypeKind;
635 case Type::ByteTyID:
636 return LLVMByteTypeKind;
638 return LLVMIntegerTypeKind;
641 case Type::StructTyID:
642 return LLVMStructTypeKind;
643 case Type::ArrayTyID:
644 return LLVMArrayTypeKind;
646 return LLVMPointerTypeKind;
648 return LLVMVectorTypeKind;
650 return LLVMX86_AMXTypeKind;
651 case Type::TokenTyID:
652 return LLVMTokenTypeKind;
658 llvm_unreachable("Typed pointers are unsupported via the C API");
659 }
660 llvm_unreachable("Unhandled TypeID.");
661}
662
664{
665 return unwrap(Ty)->isSized();
666}
667
671
673 return unwrap(Ty)->print(errs(), /*IsForDebug=*/true);
674}
675
677 std::string buf;
678 raw_string_ostream os(buf);
679
680 if (unwrap(Ty))
681 unwrap(Ty)->print(os);
682 else
683 os << "Printing <null> Type";
684
685 return strdup(buf.c_str());
686}
687
688/*--.. Operations on byte types ............................................--*/
689
691 return wrap(ByteType::get(*unwrap(C), NumBits));
692}
693
695 return unwrap<ByteType>(ByteTy)->getBitWidth();
696}
697
698/*--.. Operations on integer types .........................................--*/
699
719 return wrap(IntegerType::get(*unwrap(C), NumBits));
720}
721
740LLVMTypeRef LLVMIntType(unsigned NumBits) {
742}
743
744unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy) {
745 return unwrap<IntegerType>(IntegerTy)->getBitWidth();
746}
747
748/*--.. Operations on real types ............................................--*/
749
774
799
800/*--.. Operations on function types ........................................--*/
801
803 LLVMTypeRef *ParamTypes, unsigned ParamCount,
804 LLVMBool IsVarArg) {
805 ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
806 return wrap(FunctionType::get(unwrap(ReturnType), Tys, IsVarArg != 0));
807}
808
810 return unwrap<FunctionType>(FunctionTy)->isVarArg();
811}
812
814 return wrap(unwrap<FunctionType>(FunctionTy)->getReturnType());
815}
816
817unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy) {
818 return unwrap<FunctionType>(FunctionTy)->getNumParams();
819}
820
822 FunctionType *Ty = unwrap<FunctionType>(FunctionTy);
823 for (Type *T : Ty->params())
824 *Dest++ = wrap(T);
825}
826
827/*--.. Operations on struct types ..........................................--*/
828
830 unsigned ElementCount, LLVMBool Packed) {
831 ArrayRef<Type*> Tys(unwrap(ElementTypes), ElementCount);
832 return wrap(StructType::get(*unwrap(C), Tys, Packed != 0));
833}
834
836 unsigned ElementCount, LLVMBool Packed) {
838 ElementCount, Packed);
839}
840
842{
843 return wrap(StructType::create(*unwrap(C), Name));
844}
845
847{
849 if (!Type->hasName())
850 return nullptr;
851 return Type->getName().data();
852}
853
854void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes,
855 unsigned ElementCount, LLVMBool Packed) {
856 ArrayRef<Type*> Tys(unwrap(ElementTypes), ElementCount);
857 unwrap<StructType>(StructTy)->setBody(Tys, Packed != 0);
858}
859
861 return unwrap<StructType>(StructTy)->getNumElements();
862}
863
865 StructType *Ty = unwrap<StructType>(StructTy);
866 for (Type *T : Ty->elements())
867 *Dest++ = wrap(T);
868}
869
871 StructType *Ty = unwrap<StructType>(StructTy);
872 return wrap(Ty->getTypeAtIndex(i));
873}
874
876 return unwrap<StructType>(StructTy)->isPacked();
877}
878
880 return unwrap<StructType>(StructTy)->isOpaque();
881}
882
884 return unwrap<StructType>(StructTy)->isLiteral();
885}
886
888 return wrap(StructType::getTypeByName(unwrap(M)->getContext(), Name));
889}
890
892 return wrap(StructType::getTypeByName(*unwrap(C), Name));
893}
894
895/*--.. Operations on array, pointer, and vector types (sequence types) .....--*/
896
898 int i = 0;
899 for (auto *T : unwrap(Tp)->subtypes()) {
900 Arr[i] = wrap(T);
901 i++;
902 }
903}
904
906 return wrap(ArrayType::get(unwrap(ElementType), ElementCount));
907}
908
912
914 return wrap(
916}
917
919 return true;
920}
921
923 return wrap(FixedVectorType::get(unwrap(ElementType), ElementCount));
924}
925
927 unsigned ElementCount) {
928 return wrap(ScalableVectorType::get(unwrap(ElementType), ElementCount));
929}
930
932 auto *Ty = unwrap(WrappedTy);
933 if (auto *ATy = dyn_cast<ArrayType>(Ty))
934 return wrap(ATy->getElementType());
935 return wrap(cast<VectorType>(Ty)->getElementType());
936}
937
939 return unwrap(Tp)->getNumContainedTypes();
940}
941
943 return unwrap<ArrayType>(ArrayTy)->getNumElements();
944}
945
947 return unwrap<ArrayType>(ArrayTy)->getNumElements();
948}
949
951 return unwrap<PointerType>(PointerTy)->getAddressSpace();
952}
953
954unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy) {
955 return unwrap<VectorType>(VectorTy)->getElementCount().getKnownMinValue();
956}
957
961
965
967 return wrap(unwrap<ConstantPtrAuth>(PtrAuth)->getDiscriminator());
968}
969
971 return wrap(unwrap<ConstantPtrAuth>(PtrAuth)->getAddrDiscriminator());
972}
973
974/*--.. Operations on other types ...........................................--*/
975
979
992
999
1001 LLVMTypeRef *TypeParams,
1002 unsigned TypeParamCount,
1003 unsigned *IntParams,
1004 unsigned IntParamCount) {
1005 ArrayRef<Type *> TypeParamArray(unwrap(TypeParams), TypeParamCount);
1006 ArrayRef<unsigned> IntParamArray(IntParams, IntParamCount);
1007 return wrap(
1008 TargetExtType::get(*unwrap(C), Name, TypeParamArray, IntParamArray));
1009}
1010
1011const char *LLVMGetTargetExtTypeName(LLVMTypeRef TargetExtTy) {
1013 return Type->getName().data();
1014}
1015
1018 return Type->getNumTypeParameters();
1019}
1020
1022 unsigned Idx) {
1024 return wrap(Type->getTypeParameter(Idx));
1025}
1026
1029 return Type->getNumIntParameters();
1030}
1031
1032unsigned LLVMGetTargetExtTypeIntParam(LLVMTypeRef TargetExtTy, unsigned Idx) {
1034 return Type->getIntParameter(Idx);
1035}
1036
1037/*===-- Operations on values ----------------------------------------------===*/
1038
1039/*--.. Operations on all values ............................................--*/
1040
1042 return wrap(unwrap(Val)->getType());
1043}
1044
1046 switch(unwrap(Val)->getValueID()) {
1047#define LLVM_C_API 1
1048#define HANDLE_VALUE(Name) \
1049 case Value::Name##Val: \
1050 return LLVM##Name##ValueKind;
1051#include "llvm/IR/Value.def"
1052 default:
1054 }
1055}
1056
1057const char *LLVMGetValueName2(LLVMValueRef Val, size_t *Length) {
1058 auto *V = unwrap(Val);
1059 *Length = V->getName().size();
1060 return V->getName().data();
1061}
1062
1063void LLVMSetValueName2(LLVMValueRef Val, const char *Name, size_t NameLen) {
1064 unwrap(Val)->setName(StringRef(Name, NameLen));
1065}
1066
1068 return unwrap(Val)->getName().data();
1069}
1070
1071void LLVMSetValueName(LLVMValueRef Val, const char *Name) {
1072 unwrap(Val)->setName(Name);
1073}
1074
1076 unwrap(Val)->print(errs(), /*IsForDebug=*/true);
1077}
1078
1080 std::string buf;
1081 raw_string_ostream os(buf);
1082
1083 if (unwrap(Val))
1084 unwrap(Val)->print(os);
1085 else
1086 os << "Printing <null> Value";
1087
1088 return strdup(buf.c_str());
1089}
1090
1094
1096 std::string buf;
1097 raw_string_ostream os(buf);
1098
1099 if (unwrap(Record))
1100 unwrap(Record)->print(os);
1101 else
1102 os << "Printing <null> DbgRecord";
1103
1104 return strdup(buf.c_str());
1105}
1106
1108 unwrap(OldVal)->replaceAllUsesWith(unwrap(NewVal));
1109}
1110
1112 return unwrap<Instruction>(Inst)->hasMetadata();
1113}
1114
1116 auto *I = unwrap<Instruction>(Inst);
1117 assert(I && "Expected instruction");
1118 if (auto *MD = I->getMetadata(KindID))
1119 return wrap(MetadataAsValue::get(I->getContext(), MD));
1120 return nullptr;
1121}
1122
1123// MetadataAsValue uses a canonical format which strips the actual MDNode for
1124// MDNode with just a single constant value, storing just a ConstantAsMetadata
1125// This undoes this canonicalization, reconstructing the MDNode.
1127 Metadata *MD = MAV->getMetadata();
1129 "Expected a metadata node or a canonicalized constant");
1130
1131 if (MDNode *N = dyn_cast<MDNode>(MD))
1132 return N;
1133
1134 return MDNode::get(MAV->getContext(), MD);
1135}
1136
1137void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef Val) {
1138 MDNode *N = Val ? extractMDNode(unwrap<MetadataAsValue>(Val)) : nullptr;
1139
1140 unwrap<Instruction>(Inst)->setMetadata(KindID, N);
1141}
1142
1147
1150llvm_getMetadata(size_t *NumEntries,
1151 llvm::function_ref<void(MetadataEntries &)> AccessMD) {
1153 AccessMD(MVEs);
1154
1156 static_cast<LLVMOpaqueValueMetadataEntry *>(
1158 for (unsigned i = 0; i < MVEs.size(); ++i) {
1159 const auto &ModuleFlag = MVEs[i];
1160 Result[i].Kind = ModuleFlag.first;
1161 Result[i].Metadata = wrap(ModuleFlag.second);
1162 }
1163 *NumEntries = MVEs.size();
1164 return Result;
1165}
1166
1169 size_t *NumEntries) {
1170 return llvm_getMetadata(NumEntries, [&Value](MetadataEntries &Entries) {
1171 Entries.clear();
1172 unwrap<Instruction>(Value)->getAllMetadata(Entries);
1173 });
1174}
1175
1176/*--.. Conversion functions ................................................--*/
1177
1178#define LLVM_DEFINE_VALUE_CAST(name) \
1179 LLVMValueRef LLVMIsA##name(LLVMValueRef Val) { \
1180 return wrap(static_cast<Value*>(dyn_cast_or_null<name>(unwrap(Val)))); \
1181 }
1182
1184
1186 if (Value *V = unwrap(Val))
1187 return isa<UncondBrInst, CondBrInst>(V) ? Val : nullptr;
1188 return nullptr;
1189}
1190
1192 if (auto *MD = dyn_cast_or_null<MetadataAsValue>(unwrap(Val)))
1193 if (isa<MDNode>(MD->getMetadata()) ||
1194 isa<ValueAsMetadata>(MD->getMetadata()))
1195 return Val;
1196 return nullptr;
1197}
1198
1200 if (auto *MD = dyn_cast_or_null<MetadataAsValue>(unwrap(Val)))
1201 if (isa<ValueAsMetadata>(MD->getMetadata()))
1202 return Val;
1203 return nullptr;
1204}
1205
1207 if (auto *MD = dyn_cast_or_null<MetadataAsValue>(unwrap(Val)))
1208 if (isa<MDString>(MD->getMetadata()))
1209 return Val;
1210 return nullptr;
1211}
1212
1213/*--.. Operations on Uses ..................................................--*/
1215 Value *V = unwrap(Val);
1216 Value::use_iterator I = V->use_begin();
1217 if (I == V->use_end())
1218 return nullptr;
1219 return wrap(&*I);
1220}
1221
1223 Use *Next = unwrap(U)->getNext();
1224 if (Next)
1225 return wrap(Next);
1226 return nullptr;
1227}
1228
1230 return wrap(unwrap(U)->getUser());
1231}
1232
1236
1237/*--.. Operations on Users .................................................--*/
1238
1240 unsigned Index) {
1241 Metadata *Op = N->getOperand(Index);
1242 if (!Op)
1243 return nullptr;
1244 if (auto *C = dyn_cast<ConstantAsMetadata>(Op))
1245 return wrap(C->getValue());
1246 return wrap(MetadataAsValue::get(Context, Op));
1247}
1248
1250 Value *V = unwrap(Val);
1251 if (auto *MD = dyn_cast<MetadataAsValue>(V)) {
1252 if (auto *L = dyn_cast<ValueAsMetadata>(MD->getMetadata())) {
1253 assert(Index == 0 && "Function-local metadata can only have one operand");
1254 return wrap(L->getValue());
1255 }
1256 return getMDNodeOperandImpl(V->getContext(),
1257 cast<MDNode>(MD->getMetadata()), Index);
1258 }
1259
1260 return wrap(cast<User>(V)->getOperand(Index));
1261}
1262
1264 Value *V = unwrap(Val);
1265 return wrap(&cast<User>(V)->getOperandUse(Index));
1266}
1267
1268void LLVMSetOperand(LLVMValueRef Val, unsigned Index, LLVMValueRef Op) {
1269 unwrap<User>(Val)->setOperand(Index, unwrap(Op));
1270}
1271
1273 Value *V = unwrap(Val);
1274 if (isa<MetadataAsValue>(V))
1275 return LLVMGetMDNodeNumOperands(Val);
1276
1277 return cast<User>(V)->getNumOperands();
1278}
1279
1280/*--.. Operations on constants of any type .................................--*/
1281
1285
1289
1293
1297
1301
1303 if (Constant *C = dyn_cast<Constant>(unwrap(Val)))
1304 return C->isNullValue();
1305 return false;
1306}
1307
1311
1315
1319
1320/*--.. Operations on metadata nodes ........................................--*/
1321
1323 size_t SLen) {
1324 return wrap(MDString::get(*unwrap(C), StringRef(Str, SLen)));
1325}
1326
1331
1333 unsigned SLen) {
1334 LLVMContext &Context = *unwrap(C);
1336 Context, MDString::get(Context, StringRef(Str, SLen))));
1337}
1338
1339LLVMValueRef LLVMMDString(const char *Str, unsigned SLen) {
1341}
1342
1344 unsigned Count) {
1345 LLVMContext &Context = *unwrap(C);
1347 for (auto *OV : ArrayRef(Vals, Count)) {
1348 Value *V = unwrap(OV);
1349 Metadata *MD;
1350 if (!V)
1351 MD = nullptr;
1352 else if (auto *C = dyn_cast<Constant>(V))
1354 else if (auto *MDV = dyn_cast<MetadataAsValue>(V)) {
1355 MD = MDV->getMetadata();
1356 assert(!isa<LocalAsMetadata>(MD) && "Unexpected function-local metadata "
1357 "outside of direct argument to call");
1358 } else {
1359 // This is function-local metadata. Pretend to make an MDNode.
1360 assert(Count == 1 &&
1361 "Expected only one operand to function-local metadata");
1362 return wrap(MetadataAsValue::get(Context, LocalAsMetadata::get(V)));
1363 }
1364
1365 MDs.push_back(MD);
1366 }
1367 return wrap(MetadataAsValue::get(Context, MDNode::get(Context, MDs)));
1368}
1369
1373
1377
1379 auto *V = unwrap(Val);
1380 if (auto *C = dyn_cast<Constant>(V))
1382 if (auto *MAV = dyn_cast<MetadataAsValue>(V))
1383 return wrap(MAV->getMetadata());
1384 return wrap(ValueAsMetadata::get(V));
1385}
1386
1387const char *LLVMGetMDString(LLVMValueRef V, unsigned *Length) {
1388 if (const auto *MD = dyn_cast<MetadataAsValue>(unwrap(V)))
1389 if (const MDString *S = dyn_cast<MDString>(MD->getMetadata())) {
1390 *Length = S->getString().size();
1391 return S->getString().data();
1392 }
1393 *Length = 0;
1394 return nullptr;
1395}
1396
1398 auto *MD = unwrap<MetadataAsValue>(V);
1399 if (isa<ValueAsMetadata>(MD->getMetadata()))
1400 return 1;
1401 return cast<MDNode>(MD->getMetadata())->getNumOperands();
1402}
1403
1405 Module *Mod = unwrap(M);
1406 Module::named_metadata_iterator I = Mod->named_metadata_begin();
1407 if (I == Mod->named_metadata_end())
1408 return nullptr;
1409 return wrap(&*I);
1410}
1411
1413 Module *Mod = unwrap(M);
1414 Module::named_metadata_iterator I = Mod->named_metadata_end();
1415 if (I == Mod->named_metadata_begin())
1416 return nullptr;
1417 return wrap(&*--I);
1418}
1419
1421 NamedMDNode *NamedNode = unwrap(NMD);
1423 if (++I == NamedNode->getParent()->named_metadata_end())
1424 return nullptr;
1425 return wrap(&*I);
1426}
1427
1429 NamedMDNode *NamedNode = unwrap(NMD);
1431 if (I == NamedNode->getParent()->named_metadata_begin())
1432 return nullptr;
1433 return wrap(&*--I);
1434}
1435
1437 const char *Name, size_t NameLen) {
1438 return wrap(unwrap(M)->getNamedMetadata(StringRef(Name, NameLen)));
1439}
1440
1442 const char *Name, size_t NameLen) {
1443 return wrap(unwrap(M)->getOrInsertNamedMetadata({Name, NameLen}));
1444}
1445
1446const char *LLVMGetNamedMetadataName(LLVMNamedMDNodeRef NMD, size_t *NameLen) {
1447 NamedMDNode *NamedNode = unwrap(NMD);
1448 *NameLen = NamedNode->getName().size();
1449 return NamedNode->getName().data();
1450}
1451
1453 auto *MD = unwrap<MetadataAsValue>(V);
1454 if (auto *MDV = dyn_cast<ValueAsMetadata>(MD->getMetadata())) {
1455 *Dest = wrap(MDV->getValue());
1456 return;
1457 }
1458 const auto *N = cast<MDNode>(MD->getMetadata());
1459 const unsigned numOperands = N->getNumOperands();
1460 LLVMContext &Context = unwrap(V)->getContext();
1461 for (unsigned i = 0; i < numOperands; i++)
1462 Dest[i] = getMDNodeOperandImpl(Context, N, i);
1463}
1464
1466 LLVMMetadataRef Replacement) {
1467 auto *MD = cast<MetadataAsValue>(unwrap(V));
1468 auto *N = cast<MDNode>(MD->getMetadata());
1469 N->replaceOperandWith(Index, unwrap<Metadata>(Replacement));
1470}
1471
1472unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char *Name) {
1473 if (NamedMDNode *N = unwrap(M)->getNamedMetadata(Name)) {
1474 return N->getNumOperands();
1475 }
1476 return 0;
1477}
1478
1480 LLVMValueRef *Dest) {
1481 NamedMDNode *N = unwrap(M)->getNamedMetadata(Name);
1482 if (!N)
1483 return;
1484 LLVMContext &Context = unwrap(M)->getContext();
1485 for (unsigned i=0;i<N->getNumOperands();i++)
1486 Dest[i] = wrap(MetadataAsValue::get(Context, N->getOperand(i)));
1487}
1488
1490 LLVMValueRef Val) {
1491 NamedMDNode *N = unwrap(M)->getOrInsertNamedMetadata(Name);
1492 if (!N)
1493 return;
1494 if (!Val)
1495 return;
1496 N->addOperand(extractMDNode(unwrap<MetadataAsValue>(Val)));
1497}
1498
1499const char *LLVMGetDebugLocDirectory(LLVMValueRef Val, unsigned *Length) {
1500 if (!Length) return nullptr;
1501 StringRef S;
1502 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1503 if (const auto &DL = I->getDebugLoc()) {
1504 S = DL->getDirectory();
1505 }
1506 } else if (const auto *GV = dyn_cast<GlobalVariable>(unwrap(Val))) {
1508 GV->getDebugInfo(GVEs);
1509 if (GVEs.size())
1510 if (const DIGlobalVariable *DGV = GVEs[0]->getVariable())
1511 S = DGV->getDirectory();
1512 } else if (const auto *F = dyn_cast<Function>(unwrap(Val))) {
1513 if (const DISubprogram *DSP = F->getSubprogram())
1514 S = DSP->getDirectory();
1515 } else {
1516 assert(0 && "Expected Instruction, GlobalVariable or Function");
1517 return nullptr;
1518 }
1519 *Length = S.size();
1520 return S.data();
1521}
1522
1523const char *LLVMGetDebugLocFilename(LLVMValueRef Val, unsigned *Length) {
1524 if (!Length) return nullptr;
1525 StringRef S;
1526 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1527 if (const auto &DL = I->getDebugLoc()) {
1528 S = DL->getFilename();
1529 }
1530 } else if (const auto *GV = dyn_cast<GlobalVariable>(unwrap(Val))) {
1532 GV->getDebugInfo(GVEs);
1533 if (GVEs.size())
1534 if (const DIGlobalVariable *DGV = GVEs[0]->getVariable())
1535 S = DGV->getFilename();
1536 } else if (const auto *F = dyn_cast<Function>(unwrap(Val))) {
1537 if (const DISubprogram *DSP = F->getSubprogram())
1538 S = DSP->getFilename();
1539 } else {
1540 assert(0 && "Expected Instruction, GlobalVariable or Function");
1541 return nullptr;
1542 }
1543 *Length = S.size();
1544 return S.data();
1545}
1546
1548 unsigned L = 0;
1549 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1550 if (const auto &DL = I->getDebugLoc()) {
1551 L = DL->getLine();
1552 }
1553 } else if (const auto *GV = dyn_cast<GlobalVariable>(unwrap(Val))) {
1555 GV->getDebugInfo(GVEs);
1556 if (GVEs.size())
1557 if (const DIGlobalVariable *DGV = GVEs[0]->getVariable())
1558 L = DGV->getLine();
1559 } else if (const auto *F = dyn_cast<Function>(unwrap(Val))) {
1560 if (const DISubprogram *DSP = F->getSubprogram())
1561 L = DSP->getLine();
1562 } else {
1563 assert(0 && "Expected Instruction, GlobalVariable or Function");
1564 return -1;
1565 }
1566 return L;
1567}
1568
1570 unsigned C = 0;
1571 if (const auto *I = dyn_cast<Instruction>(unwrap(Val)))
1572 if (const auto &DL = I->getDebugLoc())
1573 C = DL->getColumn();
1574 return C;
1575}
1576
1577/*--.. Operations on scalar constants ......................................--*/
1578
1579LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N,
1580 LLVMBool SignExtend) {
1581 return wrap(ConstantInt::get(unwrap<IntegerType>(IntTy), N, SignExtend != 0));
1582}
1583
1585 unsigned NumWords,
1586 const uint64_t Words[]) {
1587 IntegerType *Ty = unwrap<IntegerType>(IntTy);
1588 return wrap(ConstantInt::get(
1589 Ty->getContext(), APInt(Ty->getBitWidth(), ArrayRef(Words, NumWords))));
1590}
1591
1593 uint8_t Radix) {
1594 return wrap(ConstantInt::get(unwrap<IntegerType>(IntTy), StringRef(Str),
1595 Radix));
1596}
1597
1599 unsigned SLen, uint8_t Radix) {
1600 return wrap(ConstantInt::get(unwrap<IntegerType>(IntTy), StringRef(Str, SLen),
1601 Radix));
1602}
1603
1604LLVMValueRef LLVMConstByte(LLVMTypeRef ByteTy, unsigned long long N) {
1605 return wrap(ConstantByte::get(unwrap<ByteType>(ByteTy), N));
1606}
1607
1609 unsigned NumWords,
1610 const uint64_t Words[]) {
1611 ByteType *Ty = unwrap<ByteType>(ByteTy);
1612 return wrap(ConstantByte::get(
1613 Ty->getContext(), APInt(Ty->getBitWidth(), ArrayRef(Words, NumWords))));
1614}
1615
1617 uint8_t Radix) {
1618 return wrap(
1619 ConstantByte::get(unwrap<ByteType>(ByteTy), StringRef(Str), Radix));
1620}
1621
1623 size_t SLen, uint8_t Radix) {
1624 return wrap(
1625 ConstantByte::get(unwrap<ByteType>(ByteTy), StringRef(Str, SLen), Radix));
1626}
1627
1629 return wrap(ConstantFP::get(unwrap(RealTy), N));
1630}
1631
1633 return wrap(ConstantFP::get(unwrap(RealTy), StringRef(Text)));
1634}
1635
1637 unsigned SLen) {
1638 return wrap(ConstantFP::get(unwrap(RealTy), StringRef(Str, SLen)));
1639}
1640
1642 Type *T = unwrap(Ty);
1643 unsigned SB = T->getScalarSizeInBits();
1644 APInt AI(SB, ArrayRef<uint64_t>(N, divideCeil(SB, 64)));
1645 APFloat Quad(T->getFltSemantics(), AI);
1646 return wrap(ConstantFP::get(T, Quad));
1647}
1648
1649unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal) {
1650 return unwrap<ConstantInt>(ConstantVal)->getZExtValue();
1651}
1652
1654 return unwrap<ConstantInt>(ConstantVal)->getSExtValue();
1655}
1656
1657unsigned long long LLVMConstByteGetZExtValue(LLVMValueRef ConstantVal) {
1658 return unwrap<ConstantByte>(ConstantVal)->getZExtValue();
1659}
1660
1662 return unwrap<ConstantByte>(ConstantVal)->getSExtValue();
1663}
1664
1665double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *LosesInfo) {
1666 ConstantFP *cFP = unwrap<ConstantFP>(ConstantVal) ;
1667 Type *Ty = cFP->getType();
1668
1669 if (Ty->isHalfTy() || Ty->isBFloatTy() || Ty->isFloatTy() ||
1670 Ty->isDoubleTy()) {
1671 *LosesInfo = false;
1672 return cFP->getValueAPF().convertToDouble();
1673 }
1674
1675 bool APFLosesInfo;
1676 APFloat APF = cFP->getValueAPF();
1678 *LosesInfo = APFLosesInfo;
1679 return APF.convertToDouble();
1680}
1681
1682/*--.. Operations on composite constants ...................................--*/
1683
1685 unsigned Length,
1686 LLVMBool DontNullTerminate) {
1687 /* Inverted the sense of AddNull because ', 0)' is a
1688 better mnemonic for null termination than ', 1)'. */
1690 DontNullTerminate == 0));
1691}
1692
1694 size_t Length,
1695 LLVMBool DontNullTerminate) {
1696 /* Inverted the sense of AddNull because ', 0)' is a
1697 better mnemonic for null termination than ', 1)'. */
1699 DontNullTerminate == 0));
1700}
1701
1702LLVMValueRef LLVMConstString(const char *Str, unsigned Length,
1703 LLVMBool DontNullTerminate) {
1705 DontNullTerminate);
1706}
1707
1709 return wrap(unwrap<Constant>(C)->getAggregateElement(Idx));
1710}
1711
1713 return wrap(unwrap<ConstantDataSequential>(C)->getElementAsConstant(idx));
1714}
1715
1719
1720const char *LLVMGetAsString(LLVMValueRef C, size_t *Length) {
1722 *Length = Str.size();
1723 return Str.data();
1724}
1725
1726const char *LLVMGetRawDataValues(LLVMValueRef C, size_t *SizeInBytes) {
1727 StringRef Str = unwrap<ConstantDataSequential>(C)->getRawDataValues();
1728 *SizeInBytes = Str.size();
1729 return Str.data();
1730}
1731
1733 LLVMValueRef *ConstantVals, unsigned Length) {
1735 return wrap(ConstantArray::get(ArrayType::get(unwrap(ElementTy), Length), V));
1736}
1737
1739 uint64_t Length) {
1741 return wrap(ConstantArray::get(ArrayType::get(unwrap(ElementTy), Length), V));
1742}
1743
1745 size_t SizeInBytes) {
1746 Type *Ty = unwrap(ElementTy);
1747 size_t Len = SizeInBytes / (Ty->getPrimitiveSizeInBits() / 8);
1748 return wrap(ConstantDataArray::getRaw(StringRef(Data, SizeInBytes), Len, Ty));
1749}
1750
1752 LLVMValueRef *ConstantVals,
1753 unsigned Count, LLVMBool Packed) {
1754 Constant **Elements = unwrap<Constant>(ConstantVals, Count);
1755 return wrap(ConstantStruct::getAnon(*unwrap(C), ArrayRef(Elements, Count),
1756 Packed != 0));
1757}
1758
1760 LLVMBool Packed) {
1762 Count, Packed);
1763}
1764
1766 LLVMValueRef *ConstantVals,
1767 unsigned Count) {
1768 Constant **Elements = unwrap<Constant>(ConstantVals, Count);
1769 StructType *Ty = unwrap<StructType>(StructTy);
1770
1771 return wrap(ConstantStruct::get(Ty, ArrayRef(Elements, Count)));
1772}
1773
1774LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size) {
1776 ArrayRef(unwrap<Constant>(ScalarConstantVals, Size), Size)));
1777}
1778
1787
1788/*-- Opcode mapping */
1789
1791{
1792 switch (opcode) {
1793 default: llvm_unreachable("Unhandled Opcode.");
1794#define HANDLE_INST(num, opc, clas) case num: return LLVM##opc;
1795#include "llvm/IR/Instruction.def"
1796#undef HANDLE_INST
1797 }
1798}
1799
1801{
1802 switch (code) {
1803#define HANDLE_INST(num, opc, clas) case LLVM##opc: return num;
1804#include "llvm/IR/Instruction.def"
1805#undef HANDLE_INST
1806 }
1807 llvm_unreachable("Unhandled Opcode.");
1808}
1809
1810/*-- GEP wrap flag conversions */
1811
1813 GEPNoWrapFlags NewGEPFlags;
1814 if ((GEPFlags & LLVMGEPFlagInBounds) != 0)
1815 NewGEPFlags |= GEPNoWrapFlags::inBounds();
1816 if ((GEPFlags & LLVMGEPFlagNUSW) != 0)
1817 NewGEPFlags |= GEPNoWrapFlags::noUnsignedSignedWrap();
1818 if ((GEPFlags & LLVMGEPFlagNUW) != 0)
1819 NewGEPFlags |= GEPNoWrapFlags::noUnsignedWrap();
1820
1821 return NewGEPFlags;
1822}
1823
1825 LLVMGEPNoWrapFlags NewGEPFlags = 0;
1826 if (GEPFlags.isInBounds())
1827 NewGEPFlags |= LLVMGEPFlagInBounds;
1828 if (GEPFlags.hasNoUnsignedSignedWrap())
1829 NewGEPFlags |= LLVMGEPFlagNUSW;
1830 if (GEPFlags.hasNoUnsignedWrap())
1831 NewGEPFlags |= LLVMGEPFlagNUW;
1832
1833 return NewGEPFlags;
1834}
1835
1836/*--.. Constant expressions ................................................--*/
1837
1839 return map_to_llvmopcode(unwrap<ConstantExpr>(ConstantVal)->getOpcode());
1840}
1841
1845
1849
1851 return wrap(ConstantExpr::getNeg(unwrap<Constant>(ConstantVal)));
1852}
1853
1857
1861
1862
1864 return wrap(ConstantExpr::getNot(unwrap<Constant>(ConstantVal)));
1865}
1866
1868 return wrap(ConstantExpr::getAdd(unwrap<Constant>(LHSConstant),
1869 unwrap<Constant>(RHSConstant)));
1870}
1871
1873 LLVMValueRef RHSConstant) {
1874 return wrap(ConstantExpr::getNSWAdd(unwrap<Constant>(LHSConstant),
1875 unwrap<Constant>(RHSConstant)));
1876}
1877
1879 LLVMValueRef RHSConstant) {
1880 return wrap(ConstantExpr::getNUWAdd(unwrap<Constant>(LHSConstant),
1881 unwrap<Constant>(RHSConstant)));
1882}
1883
1885 return wrap(ConstantExpr::getSub(unwrap<Constant>(LHSConstant),
1886 unwrap<Constant>(RHSConstant)));
1887}
1888
1890 LLVMValueRef RHSConstant) {
1891 return wrap(ConstantExpr::getNSWSub(unwrap<Constant>(LHSConstant),
1892 unwrap<Constant>(RHSConstant)));
1893}
1894
1896 LLVMValueRef RHSConstant) {
1897 return wrap(ConstantExpr::getNUWSub(unwrap<Constant>(LHSConstant),
1898 unwrap<Constant>(RHSConstant)));
1899}
1900
1902 return wrap(ConstantExpr::getXor(unwrap<Constant>(LHSConstant),
1903 unwrap<Constant>(RHSConstant)));
1904}
1905
1907 LLVMValueRef *ConstantIndices, unsigned NumIndices) {
1908 ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1909 NumIndices);
1910 Constant *Val = unwrap<Constant>(ConstantVal);
1911 return wrap(ConstantExpr::getGetElementPtr(unwrap(Ty), Val, IdxList));
1912}
1913
1915 LLVMValueRef *ConstantIndices,
1916 unsigned NumIndices) {
1917 ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1918 NumIndices);
1919 Constant *Val = unwrap<Constant>(ConstantVal);
1920 return wrap(ConstantExpr::getInBoundsGetElementPtr(unwrap(Ty), Val, IdxList));
1921}
1922
1924 LLVMValueRef ConstantVal,
1925 LLVMValueRef *ConstantIndices,
1926 unsigned NumIndices,
1927 LLVMGEPNoWrapFlags NoWrapFlags) {
1928 ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1929 NumIndices);
1930 Constant *Val = unwrap<Constant>(ConstantVal);
1932 unwrap(Ty), Val, IdxList, mapFromLLVMGEPNoWrapFlags(NoWrapFlags)));
1933}
1934
1936 return wrap(ConstantExpr::getTrunc(unwrap<Constant>(ConstantVal),
1937 unwrap(ToType)));
1938}
1939
1942 unwrap(ToType)));
1943}
1944
1947 unwrap(ToType)));
1948}
1949
1952 unwrap(ToType)));
1953}
1954
1956 LLVMTypeRef ToType) {
1958 unwrap(ToType)));
1959}
1960
1962 LLVMTypeRef ToType) {
1964 unwrap(ToType)));
1965}
1966
1968 LLVMTypeRef ToType) {
1970 unwrap(ToType)));
1971}
1972
1974 LLVMValueRef IndexConstant) {
1976 unwrap<Constant>(IndexConstant)));
1977}
1978
1980 LLVMValueRef ElementValueConstant,
1981 LLVMValueRef IndexConstant) {
1983 unwrap<Constant>(ElementValueConstant),
1984 unwrap<Constant>(IndexConstant)));
1985}
1986
1988 LLVMValueRef VectorBConstant,
1989 LLVMValueRef MaskConstant) {
1990 SmallVector<int, 16> IntMask;
1993 unwrap<Constant>(VectorBConstant),
1994 IntMask));
1995}
1996
1998 const char *Constraints,
1999 LLVMBool HasSideEffects,
2000 LLVMBool IsAlignStack) {
2001 return wrap(InlineAsm::get(dyn_cast<FunctionType>(unwrap(Ty)), AsmString,
2002 Constraints, HasSideEffects, IsAlignStack));
2003}
2004
2008
2012
2014 return wrap(unwrap<BlockAddress>(BlockAddr)->getBasicBlock());
2015}
2016
2017/*--.. Operations on global variables, functions, and aliases (globals) ....--*/
2018
2022
2026
2055
2058
2059 switch (Linkage) {
2062 break;
2065 break;
2068 break;
2071 break;
2073 LLVM_DEBUG(
2074 errs() << "LLVMSetLinkage(): LLVMLinkOnceODRAutoHideLinkage is no "
2075 "longer supported.");
2076 break;
2077 case LLVMWeakAnyLinkage:
2079 break;
2080 case LLVMWeakODRLinkage:
2082 break;
2085 break;
2088 break;
2089 case LLVMPrivateLinkage:
2091 break;
2094 break;
2097 break;
2099 LLVM_DEBUG(
2100 errs()
2101 << "LLVMSetLinkage(): LLVMDLLImportLinkage is no longer supported.");
2102 break;
2104 LLVM_DEBUG(
2105 errs()
2106 << "LLVMSetLinkage(): LLVMDLLExportLinkage is no longer supported.");
2107 break;
2110 break;
2111 case LLVMGhostLinkage:
2112 LLVM_DEBUG(
2113 errs() << "LLVMSetLinkage(): LLVMGhostLinkage is no longer supported.");
2114 break;
2115 case LLVMCommonLinkage:
2117 break;
2118 }
2119}
2120
2122 // Using .data() is safe because of how GlobalObject::setSection is
2123 // implemented.
2124 return unwrap<GlobalValue>(Global)->getSection().data();
2125}
2126
2127void LLVMSetSection(LLVMValueRef Global, const char *Section) {
2128 unwrap<GlobalObject>(Global)->setSection(Section);
2129}
2130
2132 return static_cast<LLVMVisibility>(
2133 unwrap<GlobalValue>(Global)->getVisibility());
2134}
2135
2138 ->setVisibility(static_cast<GlobalValue::VisibilityTypes>(Viz));
2139}
2140
2142 return static_cast<LLVMDLLStorageClass>(
2143 unwrap<GlobalValue>(Global)->getDLLStorageClass());
2144}
2145
2147 unwrap<GlobalValue>(Global)->setDLLStorageClass(
2148 static_cast<GlobalValue::DLLStorageClassTypes>(Class));
2149}
2150
2162
2175
2177 return unwrap<GlobalValue>(Global)->hasGlobalUnnamedAddr();
2178}
2179
2181 unwrap<GlobalValue>(Global)->setUnnamedAddr(
2182 HasUnnamedAddr ? GlobalValue::UnnamedAddr::Global
2184}
2185
2189
2190/*--.. Operations on global variables, load and store instructions .........--*/
2191
2193 Value *P = unwrap(V);
2195 return GV->getAlign() ? GV->getAlign()->value() : 0;
2197 return F->getAlign() ? F->getAlign()->value() : 0;
2199 return AI->getAlign().value();
2200 if (LoadInst *LI = dyn_cast<LoadInst>(P))
2201 return LI->getAlign().value();
2203 return SI->getAlign().value();
2205 return RMWI->getAlign().value();
2207 return CXI->getAlign().value();
2208
2210 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, "
2211 "and AtomicCmpXchgInst have alignment");
2212}
2213
2214void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes) {
2215 Value *P = unwrap(V);
2217 GV->setAlignment(MaybeAlign(Bytes));
2218 else if (Function *F = dyn_cast<Function>(P))
2219 F->setAlignment(MaybeAlign(Bytes));
2220 else if (AllocaInst *AI = dyn_cast<AllocaInst>(P))
2221 AI->setAlignment(Align(Bytes));
2222 else if (LoadInst *LI = dyn_cast<LoadInst>(P))
2223 LI->setAlignment(Align(Bytes));
2224 else if (StoreInst *SI = dyn_cast<StoreInst>(P))
2225 SI->setAlignment(Align(Bytes));
2226 else if (AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(P))
2227 RMWI->setAlignment(Align(Bytes));
2229 CXI->setAlignment(Align(Bytes));
2230 else
2232 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, and "
2233 "and AtomicCmpXchgInst have alignment");
2234}
2235
2237 size_t *NumEntries) {
2238 return llvm_getMetadata(NumEntries, [&Value](MetadataEntries &Entries) {
2239 Entries.clear();
2241 Instr->getAllMetadata(Entries);
2242 } else {
2243 unwrap<GlobalObject>(Value)->getAllMetadata(Entries);
2244 }
2245 });
2246}
2247
2249 unsigned Index) {
2251 static_cast<LLVMOpaqueValueMetadataEntry>(Entries[Index]);
2252 return MVE.Kind;
2253}
2254
2257 unsigned Index) {
2259 static_cast<LLVMOpaqueValueMetadataEntry>(Entries[Index]);
2260 return MVE.Metadata;
2261}
2262
2264 free(Entries);
2265}
2266
2268 LLVMMetadataRef MD) {
2269 unwrap<GlobalObject>(Global)->setMetadata(Kind, unwrap<MDNode>(MD));
2270}
2271
2273 LLVMMetadataRef MD) {
2274 unwrap<GlobalObject>(Global)->addMetadata(Kind, *unwrap<MDNode>(MD));
2275}
2276
2278 unwrap<GlobalObject>(Global)->eraseMetadata(Kind);
2279}
2280
2284
2289
2290/*--.. Operations on global variables ......................................--*/
2291
2293 return wrap(new GlobalVariable(*unwrap(M), unwrap(Ty), false,
2294 GlobalValue::ExternalLinkage, nullptr, Name));
2295}
2296
2298 const char *Name,
2299 unsigned AddressSpace) {
2300 return wrap(new GlobalVariable(*unwrap(M), unwrap(Ty), false,
2301 GlobalValue::ExternalLinkage, nullptr, Name,
2303 AddressSpace));
2304}
2305
2307 return wrap(unwrap(M)->getNamedGlobal(Name));
2308}
2309
2311 size_t Length) {
2312 return wrap(unwrap(M)->getNamedGlobal(StringRef(Name, Length)));
2313}
2314
2316 Module *Mod = unwrap(M);
2317 Module::global_iterator I = Mod->global_begin();
2318 if (I == Mod->global_end())
2319 return nullptr;
2320 return wrap(&*I);
2321}
2322
2324 Module *Mod = unwrap(M);
2325 Module::global_iterator I = Mod->global_end();
2326 if (I == Mod->global_begin())
2327 return nullptr;
2328 return wrap(&*--I);
2329}
2330
2332 GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2334 if (++I == GV->getParent()->global_end())
2335 return nullptr;
2336 return wrap(&*I);
2337}
2338
2340 GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2342 if (I == GV->getParent()->global_begin())
2343 return nullptr;
2344 return wrap(&*--I);
2345}
2346
2348 unwrap<GlobalVariable>(GlobalVar)->eraseFromParent();
2349}
2350
2352 GlobalVariable* GV = unwrap<GlobalVariable>(GlobalVar);
2353 if ( !GV->hasInitializer() )
2354 return nullptr;
2355 return wrap(GV->getInitializer());
2356}
2357
2358void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal) {
2359 unwrap<GlobalVariable>(GlobalVar)->setInitializer(
2360 ConstantVal ? unwrap<Constant>(ConstantVal) : nullptr);
2361}
2362
2364 return unwrap<GlobalVariable>(GlobalVar)->isThreadLocal();
2365}
2366
2367void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal) {
2368 unwrap<GlobalVariable>(GlobalVar)->setThreadLocal(IsThreadLocal != 0);
2369}
2370
2372 return unwrap<GlobalVariable>(GlobalVar)->isConstant();
2373}
2374
2375void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant) {
2376 unwrap<GlobalVariable>(GlobalVar)->setConstant(IsConstant != 0);
2377}
2378
2380 switch (unwrap<GlobalVariable>(GlobalVar)->getThreadLocalMode()) {
2382 return LLVMNotThreadLocal;
2390 return LLVMLocalExecTLSModel;
2391 }
2392
2393 llvm_unreachable("Invalid GlobalVariable thread local mode");
2394}
2395
2417
2419 return unwrap<GlobalVariable>(GlobalVar)->isExternallyInitialized();
2420}
2421
2423 unwrap<GlobalVariable>(GlobalVar)->setExternallyInitialized(IsExtInit);
2424}
2425
2426/*--.. Operations on aliases ......................................--*/
2427
2429 unsigned AddrSpace, LLVMValueRef Aliasee,
2430 const char *Name) {
2431 return wrap(GlobalAlias::create(unwrap(ValueTy), AddrSpace,
2433 unwrap<Constant>(Aliasee), unwrap(M)));
2434}
2435
2437 const char *Name, size_t NameLen) {
2438 return wrap(unwrap(M)->getNamedAlias(StringRef(Name, NameLen)));
2439}
2440
2442 Module *Mod = unwrap(M);
2443 Module::alias_iterator I = Mod->alias_begin();
2444 if (I == Mod->alias_end())
2445 return nullptr;
2446 return wrap(&*I);
2447}
2448
2450 Module *Mod = unwrap(M);
2451 Module::alias_iterator I = Mod->alias_end();
2452 if (I == Mod->alias_begin())
2453 return nullptr;
2454 return wrap(&*--I);
2455}
2456
2458 GlobalAlias *Alias = unwrap<GlobalAlias>(GA);
2460 if (++I == Alias->getParent()->alias_end())
2461 return nullptr;
2462 return wrap(&*I);
2463}
2464
2466 GlobalAlias *Alias = unwrap<GlobalAlias>(GA);
2468 if (I == Alias->getParent()->alias_begin())
2469 return nullptr;
2470 return wrap(&*--I);
2471}
2472
2474 return wrap(unwrap<GlobalAlias>(Alias)->getAliasee());
2475}
2476
2478 unwrap<GlobalAlias>(Alias)->setAliasee(unwrap<Constant>(Aliasee));
2479}
2480
2481/*--.. Operations on functions .............................................--*/
2482
2484 LLVMTypeRef FunctionTy) {
2485 return wrap(Function::Create(unwrap<FunctionType>(FunctionTy),
2487}
2488
2490 size_t NameLen, LLVMTypeRef FunctionTy) {
2491 return wrap(unwrap(M)
2492 ->getOrInsertFunction(StringRef(Name, NameLen),
2493 unwrap<FunctionType>(FunctionTy))
2494 .getCallee());
2495}
2496
2498 return wrap(unwrap(M)->getFunction(Name));
2499}
2500
2502 size_t Length) {
2503 return wrap(unwrap(M)->getFunction(StringRef(Name, Length)));
2504}
2505
2507 Module *Mod = unwrap(M);
2508 Module::iterator I = Mod->begin();
2509 if (I == Mod->end())
2510 return nullptr;
2511 return wrap(&*I);
2512}
2513
2515 Module *Mod = unwrap(M);
2516 Module::iterator I = Mod->end();
2517 if (I == Mod->begin())
2518 return nullptr;
2519 return wrap(&*--I);
2520}
2521
2523 Function *Func = unwrap<Function>(Fn);
2524 Module::iterator I(Func);
2525 if (++I == Func->getParent()->end())
2526 return nullptr;
2527 return wrap(&*I);
2528}
2529
2531 Function *Func = unwrap<Function>(Fn);
2532 Module::iterator I(Func);
2533 if (I == Func->getParent()->begin())
2534 return nullptr;
2535 return wrap(&*--I);
2536}
2537
2539 unwrap<Function>(Fn)->eraseFromParent();
2540}
2541
2543 return unwrap<Function>(Fn)->hasPersonalityFn();
2544}
2545
2547 return wrap(unwrap<Function>(Fn)->getPersonalityFn());
2548}
2549
2551 unwrap<Function>(Fn)->setPersonalityFn(
2552 PersonalityFn ? unwrap<Constant>(PersonalityFn) : nullptr);
2553}
2554
2556 if (Function *F = dyn_cast<Function>(unwrap(Fn)))
2557 return F->getIntrinsicID();
2558 return 0;
2559}
2560
2562 assert(ID < llvm::Intrinsic::num_intrinsics && "Intrinsic ID out of range");
2563 return llvm::Intrinsic::ID(ID);
2564}
2565
2567 LLVMTypeRef *OverloadTypes,
2568 size_t OverloadCount) {
2569 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2570 auto IID = llvm_map_to_intrinsic_id(ID);
2571 return wrap(
2573}
2574
2575const char *LLVMIntrinsicGetName(unsigned ID, size_t *NameLength) {
2576 auto IID = llvm_map_to_intrinsic_id(ID);
2577 auto Str = llvm::Intrinsic::getName(IID);
2578 *NameLength = Str.size();
2579 return Str.data();
2580}
2581
2583 LLVMTypeRef *OverloadTypes,
2584 size_t OverloadCount) {
2585 auto IID = llvm_map_to_intrinsic_id(ID);
2586 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2587 return wrap(llvm::Intrinsic::getType(*unwrap(Ctx), IID, OverloadTys));
2588}
2589
2590char *LLVMIntrinsicCopyOverloadedName(unsigned ID, LLVMTypeRef *OverloadTypes,
2591 size_t OverloadCount,
2592 size_t *NameLength) {
2593 auto IID = llvm_map_to_intrinsic_id(ID);
2594 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2595 auto Str = llvm::Intrinsic::getNameNoUnnamedTypes(IID, OverloadTys);
2596 *NameLength = Str.length();
2597 return strdup(Str.c_str());
2598}
2599
2601 LLVMTypeRef *OverloadTypes,
2602 size_t OverloadCount,
2603 size_t *NameLength) {
2604 auto IID = llvm_map_to_intrinsic_id(ID);
2605 ArrayRef<Type *> OverloadTys(unwrap(OverloadTypes), OverloadCount);
2606 auto Str = llvm::Intrinsic::getName(IID, OverloadTys, unwrap(Mod));
2607 *NameLength = Str.length();
2608 return strdup(Str.c_str());
2609}
2610
2611unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen) {
2612 return Intrinsic::lookupIntrinsicID({Name, NameLen});
2613}
2614
2619
2621 return unwrap<Function>(Fn)->getCallingConv();
2622}
2623
2625 return unwrap<Function>(Fn)->setCallingConv(
2626 static_cast<CallingConv::ID>(CC));
2627}
2628
2629const char *LLVMGetGC(LLVMValueRef Fn) {
2631 return F->hasGC()? F->getGC().c_str() : nullptr;
2632}
2633
2634void LLVMSetGC(LLVMValueRef Fn, const char *GC) {
2636 if (GC)
2637 F->setGC(GC);
2638 else
2639 F->clearGC();
2640}
2641
2644 return wrap(F->getPrefixData());
2645}
2646
2649 return F->hasPrefixData();
2650}
2651
2654 Constant *prefix = unwrap<Constant>(prefixData);
2655 F->setPrefixData(prefix);
2656}
2657
2660 return wrap(F->getPrologueData());
2661}
2662
2665 return F->hasPrologueData();
2666}
2667
2670 Constant *prologue = unwrap<Constant>(prologueData);
2671 F->setPrologueData(prologue);
2672}
2673
2676 unwrap<Function>(F)->addAttributeAtIndex(Idx, unwrap(A));
2677}
2678
2680 auto AS = unwrap<Function>(F)->getAttributes().getAttributes(Idx);
2681 return AS.getNumAttributes();
2682}
2683
2685 LLVMAttributeRef *Attrs) {
2686 auto AS = unwrap<Function>(F)->getAttributes().getAttributes(Idx);
2687 for (auto A : AS)
2688 *Attrs++ = wrap(A);
2689}
2690
2693 unsigned KindID) {
2694 return wrap(unwrap<Function>(F)->getAttributeAtIndex(
2695 Idx, (Attribute::AttrKind)KindID));
2696}
2697
2700 const char *K, unsigned KLen) {
2701 return wrap(
2702 unwrap<Function>(F)->getAttributeAtIndex(Idx, StringRef(K, KLen)));
2703}
2704
2706 unsigned KindID) {
2707 unwrap<Function>(F)->removeAttributeAtIndex(Idx, (Attribute::AttrKind)KindID);
2708}
2709
2711 const char *K, unsigned KLen) {
2712 unwrap<Function>(F)->removeAttributeAtIndex(Idx, StringRef(K, KLen));
2713}
2714
2716 const char *V) {
2717 Function *Func = unwrap<Function>(Fn);
2718 Attribute Attr = Attribute::get(Func->getContext(), A, V);
2719 Func->addFnAttr(Attr);
2720}
2721
2722/*--.. Operations on parameters ............................................--*/
2723
2725 // This function is strictly redundant to
2726 // LLVMCountParamTypes(LLVMGlobalGetValueType(FnRef))
2727 return unwrap<Function>(FnRef)->arg_size();
2728}
2729
2730void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs) {
2731 Function *Fn = unwrap<Function>(FnRef);
2732 for (Argument &A : Fn->args())
2733 *ParamRefs++ = wrap(&A);
2734}
2735
2737 Function *Fn = unwrap<Function>(FnRef);
2738 return wrap(&Fn->arg_begin()[index]);
2739}
2740
2744
2746 Function *Func = unwrap<Function>(Fn);
2747 Function::arg_iterator I = Func->arg_begin();
2748 if (I == Func->arg_end())
2749 return nullptr;
2750 return wrap(&*I);
2751}
2752
2754 Function *Func = unwrap<Function>(Fn);
2755 Function::arg_iterator I = Func->arg_end();
2756 if (I == Func->arg_begin())
2757 return nullptr;
2758 return wrap(&*--I);
2759}
2760
2762 Argument *A = unwrap<Argument>(Arg);
2763 Function *Fn = A->getParent();
2764 if (A->getArgNo() + 1 >= Fn->arg_size())
2765 return nullptr;
2766 return wrap(&Fn->arg_begin()[A->getArgNo() + 1]);
2767}
2768
2770 Argument *A = unwrap<Argument>(Arg);
2771 if (A->getArgNo() == 0)
2772 return nullptr;
2773 return wrap(&A->getParent()->arg_begin()[A->getArgNo() - 1]);
2774}
2775
2777 Argument *A = unwrap<Argument>(Arg);
2778 A->addAttr(Attribute::getWithAlignment(A->getContext(), Align(align)));
2779}
2780
2781/*--.. Operations on ifuncs ................................................--*/
2782
2784 const char *Name, size_t NameLen,
2785 LLVMTypeRef Ty, unsigned AddrSpace,
2787 return wrap(GlobalIFunc::create(unwrap(Ty), AddrSpace,
2789 StringRef(Name, NameLen),
2791}
2792
2794 const char *Name, size_t NameLen) {
2795 return wrap(unwrap(M)->getNamedIFunc(StringRef(Name, NameLen)));
2796}
2797
2799 Module *Mod = unwrap(M);
2800 Module::ifunc_iterator I = Mod->ifunc_begin();
2801 if (I == Mod->ifunc_end())
2802 return nullptr;
2803 return wrap(&*I);
2804}
2805
2807 Module *Mod = unwrap(M);
2808 Module::ifunc_iterator I = Mod->ifunc_end();
2809 if (I == Mod->ifunc_begin())
2810 return nullptr;
2811 return wrap(&*--I);
2812}
2813
2815 GlobalIFunc *GIF = unwrap<GlobalIFunc>(IFunc);
2817 if (++I == GIF->getParent()->ifunc_end())
2818 return nullptr;
2819 return wrap(&*I);
2820}
2821
2823 GlobalIFunc *GIF = unwrap<GlobalIFunc>(IFunc);
2825 if (I == GIF->getParent()->ifunc_begin())
2826 return nullptr;
2827 return wrap(&*--I);
2828}
2829
2831 return wrap(unwrap<GlobalIFunc>(IFunc)->getResolver());
2832}
2833
2837
2839 unwrap<GlobalIFunc>(IFunc)->eraseFromParent();
2840}
2841
2843 unwrap<GlobalIFunc>(IFunc)->removeFromParent();
2844}
2845
2846/*--.. Operations on operand bundles........................................--*/
2847
2848LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, size_t TagLen,
2849 LLVMValueRef *Args,
2850 unsigned NumArgs) {
2851 return wrap(new OperandBundleDef(std::string(Tag, TagLen),
2852 ArrayRef(unwrap(Args), NumArgs)));
2853}
2854
2856 delete unwrap(Bundle);
2857}
2858
2859const char *LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len) {
2860 StringRef Str = unwrap(Bundle)->getTag();
2861 *Len = Str.size();
2862 return Str.data();
2863}
2864
2866 return unwrap(Bundle)->inputs().size();
2867}
2868
2870 unsigned Index) {
2871 return wrap(unwrap(Bundle)->inputs()[Index]);
2872}
2873
2874/*--.. Operations on basic blocks ..........................................--*/
2875
2877 return wrap(static_cast<Value*>(unwrap(BB)));
2878}
2879
2883
2887
2889 return unwrap(BB)->getName().data();
2890}
2891
2895
2897 return wrap(unwrap(BB)->getTerminatorOrNull());
2898}
2899
2901 return unwrap<Function>(FnRef)->size();
2902}
2903
2905 Function *Fn = unwrap<Function>(FnRef);
2906 for (BasicBlock &BB : *Fn)
2907 *BasicBlocksRefs++ = wrap(&BB);
2908}
2909
2911 return wrap(&unwrap<Function>(Fn)->getEntryBlock());
2912}
2913
2915 Function *Func = unwrap<Function>(Fn);
2916 Function::iterator I = Func->begin();
2917 if (I == Func->end())
2918 return nullptr;
2919 return wrap(&*I);
2920}
2921
2923 Function *Func = unwrap<Function>(Fn);
2924 Function::iterator I = Func->end();
2925 if (I == Func->begin())
2926 return nullptr;
2927 return wrap(&*--I);
2928}
2929
2931 BasicBlock *Block = unwrap(BB);
2933 if (++I == Block->getParent()->end())
2934 return nullptr;
2935 return wrap(&*I);
2936}
2937
2939 BasicBlock *Block = unwrap(BB);
2941 if (I == Block->getParent()->begin())
2942 return nullptr;
2943 return wrap(&*--I);
2944}
2945
2950
2952 LLVMBasicBlockRef BB) {
2953 BasicBlock *ToInsert = unwrap(BB);
2954 BasicBlock *CurBB = unwrap(Builder)->GetInsertBlock();
2955 assert(CurBB && "current insertion point is invalid!");
2956 CurBB->getParent()->insert(std::next(CurBB->getIterator()), ToInsert);
2957}
2958
2960 LLVMBasicBlockRef BB) {
2961 unwrap<Function>(Fn)->insert(unwrap<Function>(Fn)->end(), unwrap(BB));
2962}
2963
2965 LLVMValueRef FnRef,
2966 const char *Name) {
2967 return wrap(BasicBlock::Create(*unwrap(C), Name, unwrap<Function>(FnRef)));
2968}
2969
2973
2975 LLVMBasicBlockRef BBRef,
2976 const char *Name) {
2977 BasicBlock *BB = unwrap(BBRef);
2978 return wrap(BasicBlock::Create(*unwrap(C), Name, BB->getParent(), BB));
2979}
2980
2985
2987 unwrap(BBRef)->eraseFromParent();
2988}
2989
2991 unwrap(BBRef)->removeFromParent();
2992}
2993
2995 unwrap(BB)->moveBefore(unwrap(MovePos));
2996}
2997
2999 unwrap(BB)->moveAfter(unwrap(MovePos));
3000}
3001
3002/*--.. Operations on instructions ..........................................--*/
3003
3007
3009 BasicBlock *Block = unwrap(BB);
3010 BasicBlock::iterator I = Block->begin();
3011 if (I == Block->end())
3012 return nullptr;
3013 return wrap(&*I);
3014}
3015
3017 BasicBlock *Block = unwrap(BB);
3018 BasicBlock::iterator I = Block->end();
3019 if (I == Block->begin())
3020 return nullptr;
3021 return wrap(&*--I);
3022}
3023
3025 Instruction *Instr = unwrap<Instruction>(Inst);
3026 BasicBlock::iterator I(Instr);
3027 if (++I == Instr->getParent()->end())
3028 return nullptr;
3029 return wrap(&*I);
3030}
3031
3033 Instruction *Instr = unwrap<Instruction>(Inst);
3034 BasicBlock::iterator I(Instr);
3035 if (I == Instr->getParent()->begin())
3036 return nullptr;
3037 return wrap(&*--I);
3038}
3039
3041 unwrap<Instruction>(Inst)->removeFromParent();
3042}
3043
3045 unwrap<Instruction>(Inst)->eraseFromParent();
3046}
3047
3049 unwrap<Instruction>(Inst)->deleteValue();
3050}
3051
3053 if (ICmpInst *I = dyn_cast<ICmpInst>(unwrap(Inst)))
3054 return (LLVMIntPredicate)I->getPredicate();
3055 return (LLVMIntPredicate)0;
3056}
3057
3059 return unwrap<ICmpInst>(Inst)->hasSameSign();
3060}
3061
3063 unwrap<ICmpInst>(Inst)->setSameSign(SameSign);
3064}
3065
3067 if (FCmpInst *I = dyn_cast<FCmpInst>(unwrap(Inst)))
3068 return (LLVMRealPredicate)I->getPredicate();
3069 return (LLVMRealPredicate)0;
3070}
3071
3074 return map_to_llvmopcode(C->getOpcode());
3075 return (LLVMOpcode)0;
3076}
3077
3080 return wrap(C->clone());
3081 return nullptr;
3082}
3083
3086 return (I && I->isTerminator()) ? wrap(I) : nullptr;
3087}
3088
3090 Instruction *Instr = unwrap<Instruction>(Inst);
3091 if (!Instr->DebugMarker)
3092 return nullptr;
3093 auto I = Instr->DebugMarker->StoredDbgRecords.begin();
3094 if (I == Instr->DebugMarker->StoredDbgRecords.end())
3095 return nullptr;
3096 return wrap(&*I);
3097}
3098
3100 Instruction *Instr = unwrap<Instruction>(Inst);
3101 if (!Instr->DebugMarker)
3102 return nullptr;
3103 auto I = Instr->DebugMarker->StoredDbgRecords.rbegin();
3104 if (I == Instr->DebugMarker->StoredDbgRecords.rend())
3105 return nullptr;
3106 return wrap(&*I);
3107}
3108
3112 if (++I == Record->getInstruction()->DebugMarker->StoredDbgRecords.end())
3113 return nullptr;
3114 return wrap(&*I);
3115}
3116
3120 if (I == Record->getInstruction()->DebugMarker->StoredDbgRecords.begin())
3121 return nullptr;
3122 return wrap(&*--I);
3123}
3124
3128
3132 return LLVMDbgRecordLabel;
3134 assert(VariableRecord && "unexpected record");
3135 if (VariableRecord->isDbgDeclare())
3136 return LLVMDbgRecordDeclare;
3137 if (VariableRecord->isDbgValue())
3138 return LLVMDbgRecordValue;
3139 assert(VariableRecord->isDbgAssign() && "unexpected record");
3140 return LLVMDbgRecordAssign;
3141}
3142
3147
3151
3155
3157 if (FuncletPadInst *FPI = dyn_cast<FuncletPadInst>(unwrap(Instr))) {
3158 return FPI->arg_size();
3159 }
3160 return unwrap<CallBase>(Instr)->arg_size();
3161}
3162
3163/*--.. Call and invoke instructions ........................................--*/
3164
3166 return unwrap<CallBase>(Instr)->getCallingConv();
3167}
3168
3170 return unwrap<CallBase>(Instr)->setCallingConv(
3171 static_cast<CallingConv::ID>(CC));
3172}
3173
3175 unsigned align) {
3176 auto *Call = unwrap<CallBase>(Instr);
3177 Attribute AlignAttr =
3179 Call->addAttributeAtIndex(Idx, AlignAttr);
3180}
3181
3184 unwrap<CallBase>(C)->addAttributeAtIndex(Idx, unwrap(A));
3185}
3186
3188 LLVMAttributeIndex Idx) {
3189 auto *Call = unwrap<CallBase>(C);
3190 auto AS = Call->getAttributes().getAttributes(Idx);
3191 return AS.getNumAttributes();
3192}
3193
3195 LLVMAttributeRef *Attrs) {
3196 auto *Call = unwrap<CallBase>(C);
3197 auto AS = Call->getAttributes().getAttributes(Idx);
3198 for (auto A : AS)
3199 *Attrs++ = wrap(A);
3200}
3201
3204 unsigned KindID) {
3205 return wrap(unwrap<CallBase>(C)->getAttributeAtIndex(
3206 Idx, (Attribute::AttrKind)KindID));
3207}
3208
3211 const char *K, unsigned KLen) {
3212 return wrap(
3213 unwrap<CallBase>(C)->getAttributeAtIndex(Idx, StringRef(K, KLen)));
3214}
3215
3217 unsigned KindID) {
3218 unwrap<CallBase>(C)->removeAttributeAtIndex(Idx, (Attribute::AttrKind)KindID);
3219}
3220
3222 const char *K, unsigned KLen) {
3223 unwrap<CallBase>(C)->removeAttributeAtIndex(Idx, StringRef(K, KLen));
3224}
3225
3227 return wrap(unwrap<CallBase>(Instr)->getCalledOperand());
3228}
3229
3231 return wrap(unwrap<CallBase>(Instr)->getFunctionType());
3232}
3233
3235 return unwrap<CallBase>(C)->getNumOperandBundles();
3236}
3237
3239 unsigned Index) {
3240 return wrap(
3241 new OperandBundleDef(unwrap<CallBase>(C)->getOperandBundleAt(Index)));
3242}
3243
3244/*--.. Operations on call instructions (only) ..............................--*/
3245
3247 return unwrap<CallInst>(Call)->isTailCall();
3248}
3249
3251 unwrap<CallInst>(Call)->setTailCall(isTailCall);
3252}
3253
3257
3261
3262/*--.. Operations on invoke instructions (only) ............................--*/
3263
3265 return wrap(unwrap<InvokeInst>(Invoke)->getNormalDest());
3266}
3267
3270 return wrap(CRI->getUnwindDest());
3271 } else if (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {
3272 return wrap(CSI->getUnwindDest());
3273 }
3274 return wrap(unwrap<InvokeInst>(Invoke)->getUnwindDest());
3275}
3276
3278 unwrap<InvokeInst>(Invoke)->setNormalDest(unwrap(B));
3279}
3280
3283 return CRI->setUnwindDest(unwrap(B));
3284 } else if (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {
3285 return CSI->setUnwindDest(unwrap(B));
3286 }
3287 unwrap<InvokeInst>(Invoke)->setUnwindDest(unwrap(B));
3288}
3289
3291 return wrap(unwrap<CallBrInst>(CallBr)->getDefaultDest());
3292}
3293
3295 return unwrap<CallBrInst>(CallBr)->getNumIndirectDests();
3296}
3297
3299 return wrap(unwrap<CallBrInst>(CallBr)->getIndirectDest(Idx));
3300}
3301
3302/*--.. Operations on terminators ...........................................--*/
3303
3305 return unwrap<Instruction>(Term)->getNumSuccessors();
3306}
3307
3309 return wrap(unwrap<Instruction>(Term)->getSuccessor(i));
3310}
3311
3313 return unwrap<Instruction>(Term)->setSuccessor(i, unwrap(block));
3314}
3315
3316/*--.. Operations on branch instructions (only) ............................--*/
3317
3321
3325
3327 return unwrap<CondBrInst>(Branch)->setCondition(unwrap(Cond));
3328}
3329
3330/*--.. Operations on switch instructions (only) ............................--*/
3331
3333 return wrap(unwrap<SwitchInst>(Switch)->getDefaultDest());
3334}
3335
3337 assert(i > 0 && i <= unwrap<SwitchInst>(Switch)->getNumCases());
3338 auto It = unwrap<SwitchInst>(Switch)->case_begin() + (i - 1);
3339 return wrap(It->getCaseValue());
3340}
3341
3342void LLVMSetSwitchCaseValue(LLVMValueRef Switch, unsigned i,
3343 LLVMValueRef CaseValue) {
3344 assert(i > 0 && i <= unwrap<SwitchInst>(Switch)->getNumCases());
3345 auto It = unwrap<SwitchInst>(Switch)->case_begin() + (i - 1);
3346 It->setValue(unwrap<ConstantInt>(CaseValue));
3347}
3348
3349/*--.. Operations on alloca instructions (only) ............................--*/
3350
3352 return wrap(unwrap<AllocaInst>(Alloca)->getAllocatedType());
3353}
3354
3355/*--.. Operations on gep instructions (only) ...............................--*/
3356
3358 return unwrap<GEPOperator>(GEP)->isInBounds();
3359}
3360
3362 return unwrap<GetElementPtrInst>(GEP)->setIsInBounds(InBounds);
3363}
3364
3368
3373
3378
3379/*--.. Operations on phi nodes .............................................--*/
3380
3381void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
3382 LLVMBasicBlockRef *IncomingBlocks, unsigned Count) {
3383 PHINode *PhiVal = unwrap<PHINode>(PhiNode);
3384 for (unsigned I = 0; I != Count; ++I)
3385 PhiVal->addIncoming(unwrap(IncomingValues[I]), unwrap(IncomingBlocks[I]));
3386}
3387
3389 return unwrap<PHINode>(PhiNode)->getNumIncomingValues();
3390}
3391
3393 return wrap(unwrap<PHINode>(PhiNode)->getIncomingValue(Index));
3394}
3395
3397 return wrap(unwrap<PHINode>(PhiNode)->getIncomingBlock(Index));
3398}
3399
3400/*--.. Operations on extractvalue and insertvalue nodes ....................--*/
3401
3403 auto *I = unwrap(Inst);
3404 if (auto *GEP = dyn_cast<GEPOperator>(I))
3405 return GEP->getNumIndices();
3406 if (auto *EV = dyn_cast<ExtractValueInst>(I))
3407 return EV->getNumIndices();
3408 if (auto *IV = dyn_cast<InsertValueInst>(I))
3409 return IV->getNumIndices();
3411 "LLVMGetNumIndices applies only to extractvalue and insertvalue!");
3412}
3413
3414const unsigned *LLVMGetIndices(LLVMValueRef Inst) {
3415 auto *I = unwrap(Inst);
3416 if (auto *EV = dyn_cast<ExtractValueInst>(I))
3417 return EV->getIndices().data();
3418 if (auto *IV = dyn_cast<InsertValueInst>(I))
3419 return IV->getIndices().data();
3421 "LLVMGetIndices applies only to extractvalue and insertvalue!");
3422}
3423
3424
3425/*===-- Instruction builders ----------------------------------------------===*/
3426
3430
3434
3436 Instruction *Instr, bool BeforeDbgRecords) {
3437 BasicBlock::iterator I = Instr ? Instr->getIterator() : Block->end();
3438 I.setHeadBit(BeforeDbgRecords);
3439 Builder->SetInsertPoint(Block, I);
3440}
3441
3443 LLVMValueRef Instr) {
3444 return LLVMPositionBuilderImpl(unwrap(Builder), unwrap(Block),
3445 unwrap<Instruction>(Instr), false);
3446}
3447
3454
3457 return LLVMPositionBuilderImpl(unwrap(Builder), I->getParent(), I, false);
3458}
3459
3461 LLVMValueRef Instr) {
3463 return LLVMPositionBuilderImpl(unwrap(Builder), I->getParent(), I, true);
3464}
3465
3467 BasicBlock *BB = unwrap(Block);
3468 unwrap(Builder)->SetInsertPoint(BB);
3469}
3470
3472 return wrap(unwrap(Builder)->GetInsertBlock());
3473}
3474
3476 unwrap(Builder)->ClearInsertionPoint();
3477}
3478
3480 unwrap(Builder)->Insert(unwrap<Instruction>(Instr));
3481}
3482
3484 const char *Name) {
3485 unwrap(Builder)->Insert(unwrap<Instruction>(Instr), Name);
3486}
3487
3489 delete unwrap(Builder);
3490}
3491
3492/*--.. Metadata builders ...................................................--*/
3493
3495 return wrap(unwrap(Builder)->getCurrentDebugLocation().getAsMDNode());
3496}
3497
3499 if (Loc)
3500 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(unwrap<DILocation>(Loc)));
3501 else
3502 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc());
3503}
3504
3506 DILocation *Loc =
3507 L ? cast<DILocation>(unwrap<MetadataAsValue>(L)->getMetadata()) : nullptr;
3508 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(Loc));
3509}
3510
3512 LLVMContext &Context = unwrap(Builder)->getContext();
3514 Context, unwrap(Builder)->getCurrentDebugLocation().getAsMDNode()));
3515}
3516
3518 unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
3519}
3520
3522 unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
3523}
3524
3526 LLVMMetadataRef FPMathTag) {
3527
3528 unwrap(Builder)->setDefaultFPMathTag(FPMathTag
3529 ? unwrap<MDNode>(FPMathTag)
3530 : nullptr);
3531}
3532
3534 return wrap(&unwrap(Builder)->getContext());
3535}
3536
3538 return wrap(unwrap(Builder)->getDefaultFPMathTag());
3539}
3540
3541/*--.. Instruction builders ................................................--*/
3542
3544 return wrap(unwrap(B)->CreateRetVoid());
3545}
3546
3548 return wrap(unwrap(B)->CreateRet(unwrap(V)));
3549}
3550
3552 unsigned N) {
3553 return wrap(unwrap(B)->CreateAggregateRet({unwrap(RetVals), N}));
3554}
3555
3557 return wrap(unwrap(B)->CreateBr(unwrap(Dest)));
3558}
3559
3562 return wrap(unwrap(B)->CreateCondBr(unwrap(If), unwrap(Then), unwrap(Else)));
3563}
3564
3566 LLVMBasicBlockRef Else, unsigned NumCases) {
3567 return wrap(unwrap(B)->CreateSwitch(unwrap(V), unwrap(Else), NumCases));
3568}
3569
3571 unsigned NumDests) {
3572 return wrap(unwrap(B)->CreateIndirectBr(unwrap(Addr), NumDests));
3573}
3574
3576 LLVMBasicBlockRef DefaultDest,
3577 LLVMBasicBlockRef *IndirectDests,
3578 unsigned NumIndirectDests, LLVMValueRef *Args,
3579 unsigned NumArgs, LLVMOperandBundleRef *Bundles,
3580 unsigned NumBundles, const char *Name) {
3581
3583 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
3584 OperandBundleDef *OB = unwrap(Bundle);
3585 OBs.push_back(*OB);
3586 }
3587
3588 return wrap(unwrap(B)->CreateCallBr(
3589 unwrap<FunctionType>(Ty), unwrap(Fn), unwrap(DefaultDest),
3590 ArrayRef(unwrap(IndirectDests), NumIndirectDests),
3591 ArrayRef<Value *>(unwrap(Args), NumArgs), OBs, Name));
3592}
3593
3595 LLVMValueRef *Args, unsigned NumArgs,
3597 const char *Name) {
3598 return wrap(unwrap(B)->CreateInvoke(unwrap<FunctionType>(Ty), unwrap(Fn),
3599 unwrap(Then), unwrap(Catch),
3600 ArrayRef(unwrap(Args), NumArgs), Name));
3601}
3602
3605 unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
3606 LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name) {
3608 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
3609 OperandBundleDef *OB = unwrap(Bundle);
3610 OBs.push_back(*OB);
3611 }
3612 return wrap(unwrap(B)->CreateInvoke(
3613 unwrap<FunctionType>(Ty), unwrap(Fn), unwrap(Then), unwrap(Catch),
3614 ArrayRef(unwrap(Args), NumArgs), OBs, Name));
3615}
3616
3618 LLVMValueRef PersFn, unsigned NumClauses,
3619 const char *Name) {
3620 // The personality used to live on the landingpad instruction, but now it
3621 // lives on the parent function. For compatibility, take the provided
3622 // personality and put it on the parent function.
3623 if (PersFn)
3624 unwrap(B)->GetInsertBlock()->getParent()->setPersonalityFn(
3625 unwrap<Function>(PersFn));
3626 return wrap(unwrap(B)->CreateLandingPad(unwrap(Ty), NumClauses, Name));
3627}
3628
3630 LLVMValueRef *Args, unsigned NumArgs,
3631 const char *Name) {
3632 return wrap(unwrap(B)->CreateCatchPad(unwrap(ParentPad),
3633 ArrayRef(unwrap(Args), NumArgs), Name));
3634}
3635
3637 LLVMValueRef *Args, unsigned NumArgs,
3638 const char *Name) {
3639 if (ParentPad == nullptr) {
3641 ParentPad = wrap(Constant::getNullValue(Ty));
3642 }
3643 return wrap(unwrap(B)->CreateCleanupPad(
3644 unwrap(ParentPad), ArrayRef(unwrap(Args), NumArgs), Name));
3645}
3646
3648 return wrap(unwrap(B)->CreateResume(unwrap(Exn)));
3649}
3650
3652 LLVMBasicBlockRef UnwindBB,
3653 unsigned NumHandlers, const char *Name) {
3654 if (ParentPad == nullptr) {
3656 ParentPad = wrap(Constant::getNullValue(Ty));
3657 }
3658 return wrap(unwrap(B)->CreateCatchSwitch(unwrap(ParentPad), unwrap(UnwindBB),
3659 NumHandlers, Name));
3660}
3661
3663 LLVMBasicBlockRef BB) {
3664 return wrap(unwrap(B)->CreateCatchRet(unwrap<CatchPadInst>(CatchPad),
3665 unwrap(BB)));
3666}
3667
3669 LLVMBasicBlockRef BB) {
3670 return wrap(unwrap(B)->CreateCleanupRet(unwrap<CleanupPadInst>(CatchPad),
3671 unwrap(BB)));
3672}
3673
3675 return wrap(unwrap(B)->CreateUnreachable());
3676}
3677
3679 LLVMBasicBlockRef Dest) {
3680 unwrap<SwitchInst>(Switch)->addCase(unwrap<ConstantInt>(OnVal), unwrap(Dest));
3681}
3682
3684 unwrap<IndirectBrInst>(IndirectBr)->addDestination(unwrap(Dest));
3685}
3686
3687unsigned LLVMGetNumClauses(LLVMValueRef LandingPad) {
3688 return unwrap<LandingPadInst>(LandingPad)->getNumClauses();
3689}
3690
3691LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx) {
3692 return wrap(unwrap<LandingPadInst>(LandingPad)->getClause(Idx));
3693}
3694
3695void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal) {
3696 unwrap<LandingPadInst>(LandingPad)->addClause(unwrap<Constant>(ClauseVal));
3697}
3698
3700 return unwrap<LandingPadInst>(LandingPad)->isCleanup();
3701}
3702
3703void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val) {
3704 unwrap<LandingPadInst>(LandingPad)->setCleanup(Val);
3705}
3706
3708 unwrap<CatchSwitchInst>(CatchSwitch)->addHandler(unwrap(Dest));
3709}
3710
3711unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch) {
3712 return unwrap<CatchSwitchInst>(CatchSwitch)->getNumHandlers();
3713}
3714
3715void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers) {
3716 CatchSwitchInst *CSI = unwrap<CatchSwitchInst>(CatchSwitch);
3717 for (const BasicBlock *H : CSI->handlers())
3718 *Handlers++ = wrap(H);
3719}
3720
3722 return wrap(unwrap<CatchPadInst>(CatchPad)->getCatchSwitch());
3723}
3724
3726 unwrap<CatchPadInst>(CatchPad)
3727 ->setCatchSwitch(unwrap<CatchSwitchInst>(CatchSwitch));
3728}
3729
3730/*--.. Funclets ...........................................................--*/
3731
3733 return wrap(unwrap<FuncletPadInst>(Funclet)->getArgOperand(i));
3734}
3735
3736void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value) {
3737 unwrap<FuncletPadInst>(Funclet)->setArgOperand(i, unwrap(value));
3738}
3739
3740/*--.. Arithmetic ..........................................................--*/
3741
3743 FastMathFlags NewFMF;
3744 NewFMF.setAllowReassoc((FMF & LLVMFastMathAllowReassoc) != 0);
3745 NewFMF.setNoNaNs((FMF & LLVMFastMathNoNaNs) != 0);
3746 NewFMF.setNoInfs((FMF & LLVMFastMathNoInfs) != 0);
3747 NewFMF.setNoSignedZeros((FMF & LLVMFastMathNoSignedZeros) != 0);
3749 NewFMF.setAllowContract((FMF & LLVMFastMathAllowContract) != 0);
3750 NewFMF.setApproxFunc((FMF & LLVMFastMathApproxFunc) != 0);
3751
3752 return NewFMF;
3753}
3754
3757 if (FMF.allowReassoc())
3758 NewFMF |= LLVMFastMathAllowReassoc;
3759 if (FMF.noNaNs())
3760 NewFMF |= LLVMFastMathNoNaNs;
3761 if (FMF.noInfs())
3762 NewFMF |= LLVMFastMathNoInfs;
3763 if (FMF.noSignedZeros())
3764 NewFMF |= LLVMFastMathNoSignedZeros;
3765 if (FMF.allowReciprocal())
3767 if (FMF.allowContract())
3768 NewFMF |= LLVMFastMathAllowContract;
3769 if (FMF.approxFunc())
3770 NewFMF |= LLVMFastMathApproxFunc;
3771
3772 return NewFMF;
3773}
3774
3776 const char *Name) {
3777 return wrap(unwrap(B)->CreateAdd(unwrap(LHS), unwrap(RHS), Name));
3778}
3779
3781 const char *Name) {
3782 return wrap(unwrap(B)->CreateNSWAdd(unwrap(LHS), unwrap(RHS), Name));
3783}
3784
3786 const char *Name) {
3787 return wrap(unwrap(B)->CreateNUWAdd(unwrap(LHS), unwrap(RHS), Name));
3788}
3789
3791 const char *Name) {
3792 return wrap(unwrap(B)->CreateFAdd(unwrap(LHS), unwrap(RHS), Name));
3793}
3794
3796 const char *Name) {
3797 return wrap(unwrap(B)->CreateSub(unwrap(LHS), unwrap(RHS), Name));
3798}
3799
3801 const char *Name) {
3802 return wrap(unwrap(B)->CreateNSWSub(unwrap(LHS), unwrap(RHS), Name));
3803}
3804
3806 const char *Name) {
3807 return wrap(unwrap(B)->CreateNUWSub(unwrap(LHS), unwrap(RHS), Name));
3808}
3809
3811 const char *Name) {
3812 return wrap(unwrap(B)->CreateFSub(unwrap(LHS), unwrap(RHS), Name));
3813}
3814
3816 const char *Name) {
3817 return wrap(unwrap(B)->CreateMul(unwrap(LHS), unwrap(RHS), Name));
3818}
3819
3821 const char *Name) {
3822 return wrap(unwrap(B)->CreateNSWMul(unwrap(LHS), unwrap(RHS), Name));
3823}
3824
3826 const char *Name) {
3827 return wrap(unwrap(B)->CreateNUWMul(unwrap(LHS), unwrap(RHS), Name));
3828}
3829
3831 const char *Name) {
3832 return wrap(unwrap(B)->CreateFMul(unwrap(LHS), unwrap(RHS), Name));
3833}
3834
3836 const char *Name) {
3837 return wrap(unwrap(B)->CreateUDiv(unwrap(LHS), unwrap(RHS), Name));
3838}
3839
3841 LLVMValueRef RHS, const char *Name) {
3842 return wrap(unwrap(B)->CreateExactUDiv(unwrap(LHS), unwrap(RHS), Name));
3843}
3844
3846 const char *Name) {
3847 return wrap(unwrap(B)->CreateSDiv(unwrap(LHS), unwrap(RHS), Name));
3848}
3849
3851 LLVMValueRef RHS, const char *Name) {
3852 return wrap(unwrap(B)->CreateExactSDiv(unwrap(LHS), unwrap(RHS), Name));
3853}
3854
3856 const char *Name) {
3857 return wrap(unwrap(B)->CreateFDiv(unwrap(LHS), unwrap(RHS), Name));
3858}
3859
3861 const char *Name) {
3862 return wrap(unwrap(B)->CreateURem(unwrap(LHS), unwrap(RHS), Name));
3863}
3864
3866 const char *Name) {
3867 return wrap(unwrap(B)->CreateSRem(unwrap(LHS), unwrap(RHS), Name));
3868}
3869
3871 const char *Name) {
3872 return wrap(unwrap(B)->CreateFRem(unwrap(LHS), unwrap(RHS), Name));
3873}
3874
3876 const char *Name) {
3877 return wrap(unwrap(B)->CreateShl(unwrap(LHS), unwrap(RHS), Name));
3878}
3879
3881 const char *Name) {
3882 return wrap(unwrap(B)->CreateLShr(unwrap(LHS), unwrap(RHS), Name));
3883}
3884
3886 const char *Name) {
3887 return wrap(unwrap(B)->CreateAShr(unwrap(LHS), unwrap(RHS), Name));
3888}
3889
3891 const char *Name) {
3892 return wrap(unwrap(B)->CreateAnd(unwrap(LHS), unwrap(RHS), Name));
3893}
3894
3896 const char *Name) {
3897 return wrap(unwrap(B)->CreateOr(unwrap(LHS), unwrap(RHS), Name));
3898}
3899
3901 const char *Name) {
3902 return wrap(unwrap(B)->CreateXor(unwrap(LHS), unwrap(RHS), Name));
3903}
3904
3911
3913 return wrap(unwrap(B)->CreateNeg(unwrap(V), Name));
3914}
3915
3917 const char *Name) {
3918 return wrap(unwrap(B)->CreateNSWNeg(unwrap(V), Name));
3919}
3920
3922 const char *Name) {
3923 Value *Neg = unwrap(B)->CreateNeg(unwrap(V), Name);
3924 if (auto *I = dyn_cast<BinaryOperator>(Neg))
3925 I->setHasNoUnsignedWrap();
3926 return wrap(Neg);
3927}
3928
3930 return wrap(unwrap(B)->CreateFNeg(unwrap(V), Name));
3931}
3932
3934 return wrap(unwrap(B)->CreateNot(unwrap(V), Name));
3935}
3936
3938 Value *P = unwrap<Value>(ArithInst);
3939 return cast<Instruction>(P)->hasNoUnsignedWrap();
3940}
3941
3942void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW) {
3943 Value *P = unwrap<Value>(ArithInst);
3944 cast<Instruction>(P)->setHasNoUnsignedWrap(HasNUW);
3945}
3946
3948 Value *P = unwrap<Value>(ArithInst);
3949 return cast<Instruction>(P)->hasNoSignedWrap();
3950}
3951
3952void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW) {
3953 Value *P = unwrap<Value>(ArithInst);
3954 cast<Instruction>(P)->setHasNoSignedWrap(HasNSW);
3955}
3956
3958 Value *P = unwrap<Value>(DivOrShrInst);
3959 return cast<Instruction>(P)->isExact();
3960}
3961
3962void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact) {
3963 Value *P = unwrap<Value>(DivOrShrInst);
3964 cast<Instruction>(P)->setIsExact(IsExact);
3965}
3966
3968 Value *P = unwrap<Value>(NonNegInst);
3969 return cast<Instruction>(P)->hasNonNeg();
3970}
3971
3972void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg) {
3973 Value *P = unwrap<Value>(NonNegInst);
3974 cast<Instruction>(P)->setNonNeg(IsNonNeg);
3975}
3976
3978 Value *P = unwrap<Value>(FPMathInst);
3979 FastMathFlags FMF = cast<Instruction>(P)->getFastMathFlags();
3980 return mapToLLVMFastMathFlags(FMF);
3981}
3982
3984 Value *P = unwrap<Value>(FPMathInst);
3985 cast<Instruction>(P)->setFastMathFlags(mapFromLLVMFastMathFlags(FMF));
3986}
3987
3992
3994 Value *P = unwrap<Value>(Inst);
3995 return cast<PossiblyDisjointInst>(P)->isDisjoint();
3996}
3997
3999 Value *P = unwrap<Value>(Inst);
4000 cast<PossiblyDisjointInst>(P)->setIsDisjoint(IsDisjoint);
4001}
4002
4003/*--.. Memory ..............................................................--*/
4004
4006 const char *Name) {
4007 Type* ITy = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext());
4008 Constant* AllocSize = ConstantExpr::getSizeOf(unwrap(Ty));
4009 AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, ITy);
4010 return wrap(unwrap(B)->CreateMalloc(ITy, unwrap(Ty), AllocSize, nullptr,
4011 nullptr, Name));
4012}
4013
4015 LLVMValueRef Val, const char *Name) {
4016 Type* ITy = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext());
4017 Constant* AllocSize = ConstantExpr::getSizeOf(unwrap(Ty));
4018 AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, ITy);
4019 return wrap(unwrap(B)->CreateMalloc(ITy, unwrap(Ty), AllocSize, unwrap(Val),
4020 nullptr, Name));
4021}
4022
4024 LLVMValueRef Val, LLVMValueRef Len,
4025 unsigned Align) {
4026 return wrap(unwrap(B)->CreateMemSet(unwrap(Ptr), unwrap(Val), unwrap(Len),
4027 MaybeAlign(Align)));
4028}
4029
4031 LLVMValueRef Dst, unsigned DstAlign,
4032 LLVMValueRef Src, unsigned SrcAlign,
4034 return wrap(unwrap(B)->CreateMemCpy(unwrap(Dst), MaybeAlign(DstAlign),
4035 unwrap(Src), MaybeAlign(SrcAlign),
4036 unwrap(Size)));
4037}
4038
4040 LLVMValueRef Dst, unsigned DstAlign,
4041 LLVMValueRef Src, unsigned SrcAlign,
4043 return wrap(unwrap(B)->CreateMemMove(unwrap(Dst), MaybeAlign(DstAlign),
4044 unwrap(Src), MaybeAlign(SrcAlign),
4045 unwrap(Size)));
4046}
4047
4049 const char *Name) {
4050 return wrap(unwrap(B)->CreateAlloca(unwrap(Ty), nullptr, Name));
4051}
4052
4054 LLVMValueRef Val, const char *Name) {
4055 return wrap(unwrap(B)->CreateAlloca(unwrap(Ty), unwrap(Val), Name));
4056}
4057
4059 return wrap(unwrap(B)->CreateFree(unwrap(PointerVal)));
4060}
4061
4063 LLVMValueRef PointerVal, const char *Name) {
4064 return wrap(unwrap(B)->CreateLoad(unwrap(Ty), unwrap(PointerVal), Name));
4065}
4066
4068 LLVMValueRef PointerVal) {
4069 return wrap(unwrap(B)->CreateStore(unwrap(Val), unwrap(PointerVal)));
4070}
4071
4087
4103
4105 switch (BinOp) {
4137 }
4138
4139 llvm_unreachable("Invalid LLVMAtomicRMWBinOp value!");
4140}
4141
4143 switch (BinOp) {
4175 default: break;
4176 }
4177
4178 llvm_unreachable("Invalid AtomicRMWBinOp value!");
4179}
4180
4182 LLVMBool isSingleThread, const char *Name) {
4183 return wrap(
4184 unwrap(B)->CreateFence(mapFromLLVMOrdering(Ordering),
4185 isSingleThread ? SyncScope::SingleThread
4187 Name));
4188}
4189
4191 LLVMAtomicOrdering Ordering, unsigned SSID,
4192 const char *Name) {
4193 return wrap(
4194 unwrap(B)->CreateFence(mapFromLLVMOrdering(Ordering), SSID, Name));
4195}
4196
4198 LLVMValueRef Pointer, LLVMValueRef *Indices,
4199 unsigned NumIndices, const char *Name) {
4200 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4201 return wrap(unwrap(B)->CreateGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name));
4202}
4203
4205 LLVMValueRef Pointer, LLVMValueRef *Indices,
4206 unsigned NumIndices, const char *Name) {
4207 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4208 return wrap(
4209 unwrap(B)->CreateInBoundsGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name));
4210}
4211
4213 LLVMValueRef Pointer,
4214 LLVMValueRef *Indices,
4215 unsigned NumIndices, const char *Name,
4216 LLVMGEPNoWrapFlags NoWrapFlags) {
4217 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
4218 return wrap(unwrap(B)->CreateGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name,
4219 mapFromLLVMGEPNoWrapFlags(NoWrapFlags)));
4220}
4221
4223 LLVMValueRef Pointer, unsigned Idx,
4224 const char *Name) {
4225 return wrap(
4226 unwrap(B)->CreateStructGEP(unwrap(Ty), unwrap(Pointer), Idx, Name));
4227}
4228
4230 const char *Name) {
4231 return wrap(unwrap(B)->CreateGlobalString(Str, Name));
4232}
4233
4235 const char *Name) {
4236 return wrap(unwrap(B)->CreateGlobalString(Str, Name));
4237}
4238
4240 return cast<Instruction>(unwrap(Inst))->isVolatile();
4241}
4242
4243void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile) {
4244 Value *P = unwrap(MemAccessInst);
4245 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4246 return LI->setVolatile(isVolatile);
4248 return SI->setVolatile(isVolatile);
4250 return AI->setVolatile(isVolatile);
4251 return cast<AtomicCmpXchgInst>(P)->setVolatile(isVolatile);
4252}
4253
4255 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->isWeak();
4256}
4257
4258void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak) {
4259 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->setWeak(isWeak);
4260}
4261
4263 Value *P = unwrap(MemAccessInst);
4265 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4266 O = LI->getOrdering();
4267 else if (StoreInst *SI = dyn_cast<StoreInst>(P))
4268 O = SI->getOrdering();
4269 else if (FenceInst *FI = dyn_cast<FenceInst>(P))
4270 O = FI->getOrdering();
4271 else
4272 O = cast<AtomicRMWInst>(P)->getOrdering();
4273 return mapToLLVMOrdering(O);
4274}
4275
4276void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering) {
4277 Value *P = unwrap(MemAccessInst);
4278 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4279
4280 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4281 return LI->setOrdering(O);
4282 else if (FenceInst *FI = dyn_cast<FenceInst>(P))
4283 return FI->setOrdering(O);
4284 else if (AtomicRMWInst *ARWI = dyn_cast<AtomicRMWInst>(P))
4285 return ARWI->setOrdering(O);
4286 return cast<StoreInst>(P)->setOrdering(O);
4287}
4288
4292
4294 unwrap<AtomicRMWInst>(Inst)->setOperation(mapFromLLVMRMWBinOp(BinOp));
4295}
4296
4297/*--.. Casts ...............................................................--*/
4298
4300 LLVMTypeRef DestTy, const char *Name) {
4301 return wrap(unwrap(B)->CreateTrunc(unwrap(Val), unwrap(DestTy), Name));
4302}
4303
4305 LLVMTypeRef DestTy, const char *Name) {
4306 return wrap(unwrap(B)->CreateZExt(unwrap(Val), unwrap(DestTy), Name));
4307}
4308
4310 LLVMTypeRef DestTy, const char *Name) {
4311 return wrap(unwrap(B)->CreateSExt(unwrap(Val), unwrap(DestTy), Name));
4312}
4313
4315 LLVMTypeRef DestTy, const char *Name) {
4316 return wrap(unwrap(B)->CreateFPToUI(unwrap(Val), unwrap(DestTy), Name));
4317}
4318
4320 LLVMTypeRef DestTy, const char *Name) {
4321 return wrap(unwrap(B)->CreateFPToSI(unwrap(Val), unwrap(DestTy), Name));
4322}
4323
4325 LLVMTypeRef DestTy, const char *Name) {
4326 return wrap(unwrap(B)->CreateUIToFP(unwrap(Val), unwrap(DestTy), Name));
4327}
4328
4330 LLVMTypeRef DestTy, const char *Name) {
4331 return wrap(unwrap(B)->CreateSIToFP(unwrap(Val), unwrap(DestTy), Name));
4332}
4333
4335 LLVMTypeRef DestTy, const char *Name) {
4336 return wrap(unwrap(B)->CreateFPTrunc(unwrap(Val), unwrap(DestTy), Name));
4337}
4338
4340 LLVMTypeRef DestTy, const char *Name) {
4341 return wrap(unwrap(B)->CreateFPExt(unwrap(Val), unwrap(DestTy), Name));
4342}
4343
4345 LLVMTypeRef DestTy, const char *Name) {
4346 return wrap(unwrap(B)->CreatePtrToInt(unwrap(Val), unwrap(DestTy), Name));
4347}
4348
4350 LLVMTypeRef DestTy, const char *Name) {
4351 return wrap(unwrap(B)->CreateIntToPtr(unwrap(Val), unwrap(DestTy), Name));
4352}
4353
4355 LLVMTypeRef DestTy, const char *Name) {
4356 return wrap(unwrap(B)->CreateBitCast(unwrap(Val), unwrap(DestTy), Name));
4357}
4358
4360 LLVMTypeRef DestTy, const char *Name) {
4361 return wrap(unwrap(B)->CreateAddrSpaceCast(unwrap(Val), unwrap(DestTy), Name));
4362}
4363
4365 LLVMTypeRef DestTy, const char *Name) {
4366 return wrap(unwrap(B)->CreateZExtOrBitCast(unwrap(Val), unwrap(DestTy),
4367 Name));
4368}
4369
4371 LLVMTypeRef DestTy, const char *Name) {
4372 return wrap(unwrap(B)->CreateSExtOrBitCast(unwrap(Val), unwrap(DestTy),
4373 Name));
4374}
4375
4377 LLVMTypeRef DestTy, const char *Name) {
4378 return wrap(unwrap(B)->CreateTruncOrBitCast(unwrap(Val), unwrap(DestTy),
4379 Name));
4380}
4381
4383 LLVMTypeRef DestTy, const char *Name) {
4384 return wrap(unwrap(B)->CreateCast(Instruction::CastOps(map_from_llvmopcode(Op)), unwrap(Val),
4385 unwrap(DestTy), Name));
4386}
4387
4389 LLVMTypeRef DestTy, const char *Name) {
4390 return wrap(unwrap(B)->CreatePointerCast(unwrap(Val), unwrap(DestTy), Name));
4391}
4392
4394 LLVMTypeRef DestTy, LLVMBool IsSigned,
4395 const char *Name) {
4396 return wrap(
4397 unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy), IsSigned, Name));
4398}
4399
4401 LLVMTypeRef DestTy, const char *Name) {
4402 return wrap(unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy),
4403 /*isSigned*/true, Name));
4404}
4405
4407 LLVMTypeRef DestTy, const char *Name) {
4408 return wrap(unwrap(B)->CreateFPCast(unwrap(Val), unwrap(DestTy), Name));
4409}
4410
4412 LLVMTypeRef DestTy, LLVMBool DestIsSigned) {
4414 unwrap(Src), SrcIsSigned, unwrap(DestTy), DestIsSigned));
4415}
4416
4417/*--.. Comparisons .........................................................--*/
4418
4421 const char *Name) {
4422 return wrap(unwrap(B)->CreateICmp(static_cast<ICmpInst::Predicate>(Op),
4423 unwrap(LHS), unwrap(RHS), Name));
4424}
4425
4428 const char *Name) {
4429 return wrap(unwrap(B)->CreateFCmp(static_cast<FCmpInst::Predicate>(Op),
4430 unwrap(LHS), unwrap(RHS), Name));
4431}
4432
4433/*--.. Miscellaneous instructions ..........................................--*/
4434
4436 return wrap(unwrap(B)->CreatePHI(unwrap(Ty), 0, Name));
4437}
4438
4440 LLVMValueRef *Args, unsigned NumArgs,
4441 const char *Name) {
4443 return wrap(unwrap(B)->CreateCall(FTy, unwrap(Fn),
4444 ArrayRef(unwrap(Args), NumArgs), Name));
4445}
4446
4449 LLVMValueRef Fn, LLVMValueRef *Args,
4450 unsigned NumArgs, LLVMOperandBundleRef *Bundles,
4451 unsigned NumBundles, const char *Name) {
4454 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
4455 OperandBundleDef *OB = unwrap(Bundle);
4456 OBs.push_back(*OB);
4457 }
4458 return wrap(unwrap(B)->CreateCall(
4459 FTy, unwrap(Fn), ArrayRef(unwrap(Args), NumArgs), OBs, Name));
4460}
4461
4463 LLVMValueRef Then, LLVMValueRef Else,
4464 const char *Name) {
4465 return wrap(unwrap(B)->CreateSelect(unwrap(If), unwrap(Then), unwrap(Else),
4466 Name));
4467}
4468
4470 LLVMTypeRef Ty, const char *Name) {
4471 return wrap(unwrap(B)->CreateVAArg(unwrap(List), unwrap(Ty), Name));
4472}
4473
4475 LLVMValueRef Index, const char *Name) {
4476 return wrap(unwrap(B)->CreateExtractElement(unwrap(VecVal), unwrap(Index),
4477 Name));
4478}
4479
4481 LLVMValueRef EltVal, LLVMValueRef Index,
4482 const char *Name) {
4483 return wrap(unwrap(B)->CreateInsertElement(unwrap(VecVal), unwrap(EltVal),
4484 unwrap(Index), Name));
4485}
4486
4488 LLVMValueRef V2, LLVMValueRef Mask,
4489 const char *Name) {
4490 return wrap(unwrap(B)->CreateShuffleVector(unwrap(V1), unwrap(V2),
4491 unwrap(Mask), Name));
4492}
4493
4495 unsigned Index, const char *Name) {
4496 return wrap(unwrap(B)->CreateExtractValue(unwrap(AggVal), Index, Name));
4497}
4498
4500 LLVMValueRef EltVal, unsigned Index,
4501 const char *Name) {
4502 return wrap(unwrap(B)->CreateInsertValue(unwrap(AggVal), unwrap(EltVal),
4503 Index, Name));
4504}
4505
4507 const char *Name) {
4508 return wrap(unwrap(B)->CreateFreeze(unwrap(Val), Name));
4509}
4510
4512 const char *Name) {
4513 return wrap(unwrap(B)->CreateIsNull(unwrap(Val), Name));
4514}
4515
4517 const char *Name) {
4518 return wrap(unwrap(B)->CreateIsNotNull(unwrap(Val), Name));
4519}
4520
4523 const char *Name) {
4524 IRBuilderBase *Builder = unwrap(B);
4525 Value *Diff =
4526 Builder->CreatePtrDiff(unwrap(ElemTy), unwrap(LHS), unwrap(RHS), Name);
4527 return wrap(Builder->CreateSExtOrTrunc(Diff, Builder->getInt64Ty()));
4528}
4529
4531 LLVMValueRef PTR, LLVMValueRef Val,
4532 LLVMAtomicOrdering ordering,
4533 LLVMBool singleThread) {
4535 return wrap(unwrap(B)->CreateAtomicRMW(
4536 intop, unwrap(PTR), unwrap(Val), MaybeAlign(),
4537 mapFromLLVMOrdering(ordering),
4538 singleThread ? SyncScope::SingleThread : SyncScope::System));
4539}
4540
4543 LLVMValueRef PTR, LLVMValueRef Val,
4544 LLVMAtomicOrdering ordering,
4545 unsigned SSID) {
4547 return wrap(unwrap(B)->CreateAtomicRMW(intop, unwrap(PTR), unwrap(Val),
4548 MaybeAlign(),
4549 mapFromLLVMOrdering(ordering), SSID));
4550}
4551
4553 LLVMValueRef Cmp, LLVMValueRef New,
4554 LLVMAtomicOrdering SuccessOrdering,
4555 LLVMAtomicOrdering FailureOrdering,
4556 LLVMBool singleThread) {
4557
4558 return wrap(unwrap(B)->CreateAtomicCmpXchg(
4559 unwrap(Ptr), unwrap(Cmp), unwrap(New), MaybeAlign(),
4560 mapFromLLVMOrdering(SuccessOrdering),
4561 mapFromLLVMOrdering(FailureOrdering),
4562 singleThread ? SyncScope::SingleThread : SyncScope::System));
4563}
4564
4566 LLVMValueRef Cmp, LLVMValueRef New,
4567 LLVMAtomicOrdering SuccessOrdering,
4568 LLVMAtomicOrdering FailureOrdering,
4569 unsigned SSID) {
4570 return wrap(unwrap(B)->CreateAtomicCmpXchg(
4571 unwrap(Ptr), unwrap(Cmp), unwrap(New), MaybeAlign(),
4572 mapFromLLVMOrdering(SuccessOrdering),
4573 mapFromLLVMOrdering(FailureOrdering), SSID));
4574}
4575
4577 Value *P = unwrap(SVInst);
4579 return I->getShuffleMask().size();
4580}
4581
4582int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt) {
4583 Value *P = unwrap(SVInst);
4585 return I->getMaskValue(Elt);
4586}
4587
4589
4591 return unwrap<Instruction>(Inst)->isAtomic();
4592}
4593
4595 // Backwards compatibility: return false for non-atomic instructions
4596 Instruction *I = unwrap<Instruction>(AtomicInst);
4597 if (!I->isAtomic())
4598 return 0;
4599
4601}
4602
4604 // Backwards compatibility: ignore non-atomic instructions
4605 Instruction *I = unwrap<Instruction>(AtomicInst);
4606 if (!I->isAtomic())
4607 return;
4608
4610 setAtomicSyncScopeID(I, SSID);
4611}
4612
4614 Instruction *I = unwrap<Instruction>(AtomicInst);
4615 assert(I->isAtomic() && "Expected an atomic instruction");
4616 return *getAtomicSyncScopeID(I);
4617}
4618
4619void LLVMSetAtomicSyncScopeID(LLVMValueRef AtomicInst, unsigned SSID) {
4620 Instruction *I = unwrap<Instruction>(AtomicInst);
4621 assert(I->isAtomic() && "Expected an atomic instruction");
4622 setAtomicSyncScopeID(I, SSID);
4623}
4624
4626 Value *P = unwrap(CmpXchgInst);
4627 return mapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getSuccessOrdering());
4628}
4629
4631 LLVMAtomicOrdering Ordering) {
4632 Value *P = unwrap(CmpXchgInst);
4633 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4634
4635 return cast<AtomicCmpXchgInst>(P)->setSuccessOrdering(O);
4636}
4637
4639 Value *P = unwrap(CmpXchgInst);
4640 return mapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getFailureOrdering());
4641}
4642
4644 LLVMAtomicOrdering Ordering) {
4645 Value *P = unwrap(CmpXchgInst);
4646 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4647
4648 return cast<AtomicCmpXchgInst>(P)->setFailureOrdering(O);
4649}
4650
4651/*===-- Module providers --------------------------------------------------===*/
4652
4657
4661
4662
4663/*===-- Memory buffers ----------------------------------------------------===*/
4664
4666 const char *Path,
4667 LLVMMemoryBufferRef *OutMemBuf,
4668 char **OutMessage) {
4669
4671 if (std::error_code EC = MBOrErr.getError()) {
4672 *OutMessage = strdup(EC.message().c_str());
4673 return 1;
4674 }
4675 *OutMemBuf = wrap(MBOrErr.get().release());
4676 return 0;
4677}
4678
4680 char **OutMessage) {
4682 if (std::error_code EC = MBOrErr.getError()) {
4683 *OutMessage = strdup(EC.message().c_str());
4684 return 1;
4685 }
4686 *OutMemBuf = wrap(MBOrErr.get().release());
4687 return 0;
4688}
4689
4691 const char *InputData,
4692 size_t InputDataLength,
4693 const char *BufferName,
4694 LLVMBool RequiresNullTerminator) {
4695
4696 return wrap(MemoryBuffer::getMemBuffer(StringRef(InputData, InputDataLength),
4697 StringRef(BufferName),
4698 RequiresNullTerminator).release());
4699}
4700
4702 const char *InputData,
4703 size_t InputDataLength,
4704 const char *BufferName) {
4705
4706 return wrap(
4707 MemoryBuffer::getMemBufferCopy(StringRef(InputData, InputDataLength),
4708 StringRef(BufferName)).release());
4709}
4710
4712 return unwrap(MemBuf)->getBufferStart();
4713}
4714
4716 return unwrap(MemBuf)->getBufferSize();
4717}
4718
4720 delete unwrap(MemBuf);
4721}
4722
4723/*===-- Pass Manager ------------------------------------------------------===*/
4724
4728
4732
4737
4741
4745
4749
4753
4755 delete unwrap(PM);
4756}
4757
4758/*===-- Threading ------------------------------------------------------===*/
4759
4763
4766
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:483
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static uint64_t align(uint64_t Size)
DXIL Finalize Linkage
static char getTypeID(Type *Ty)
static Value * getCondition(Instruction *I)
#define op(i)
Hexagon Common GEP
Value * getPointer(Value *Ptr)
LLVMTypeRef LLVMFP128Type(void)
Definition Core.cpp:790
LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef C, unsigned idx)
Definition Core.cpp:1712
LLVMTypeRef LLVMInt64Type(void)
Definition Core.cpp:734
static Module::ModFlagBehavior map_to_llvmModFlagBehavior(LLVMModuleFlagBehavior Behavior)
Definition Core.cpp:359
LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
Definition Core.cpp:1759
#define LLVM_DEFINE_VALUE_CAST(name)
Definition Core.cpp:1178
LLVMBasicBlockRef LLVMAppendBasicBlock(LLVMValueRef FnRef, const char *Name)
Definition Core.cpp:2970
LLVMTypeRef LLVMVoidType(void)
Definition Core.cpp:993
static LLVMValueMetadataEntry * llvm_getMetadata(size_t *NumEntries, llvm::function_ref< void(MetadataEntries &)> AccessMD)
Definition Core.cpp:1150
static GEPNoWrapFlags mapFromLLVMGEPNoWrapFlags(LLVMGEPNoWrapFlags GEPFlags)
Definition Core.cpp:1812
LLVMValueRef LLVMMDString(const char *Str, unsigned SLen)
Definition Core.cpp:1339
static MDNode * extractMDNode(MetadataAsValue *MAV)
Definition Core.cpp:1126
SmallVectorImpl< std::pair< unsigned, MDNode * > > MetadataEntries
Definition Core.cpp:1148
static void LLVMPositionBuilderImpl(IRBuilder<> *Builder, BasicBlock *Block, Instruction *Instr, bool BeforeDbgRecords)
Definition Core.cpp:3435
static LLVMOpcode map_to_llvmopcode(int opcode)
Definition Core.cpp:1790
LLVMTypeRef LLVMBFloatType(void)
Definition Core.cpp:778
LLVMValueRef LLVMConstByteOfString(LLVMTypeRef ByteTy, const char Str[], uint8_t Radix)
Definition Core.cpp:1616
LLVMTypeRef LLVMInt32Type(void)
Definition Core.cpp:731
static LLVMFastMathFlags mapToLLVMFastMathFlags(FastMathFlags FMF)
Definition Core.cpp:3755
static FastMathFlags mapFromLLVMFastMathFlags(LLVMFastMathFlags FMF)
Definition Core.cpp:3742
LLVMTypeRef LLVMHalfType(void)
Definition Core.cpp:775
LLVMTypeRef LLVMIntType(unsigned NumBits)
Definition Core.cpp:740
LLVMTypeRef LLVMX86AMXType(void)
Definition Core.cpp:796
LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char Str[], uint8_t Radix)
Definition Core.cpp:1592
LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Definition Core.cpp:835
static AtomicOrdering mapFromLLVMOrdering(LLVMAtomicOrdering Ordering)
Definition Core.cpp:4072
static Intrinsic::ID llvm_map_to_intrinsic_id(unsigned ID)
Definition Core.cpp:2561
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:4088
LLVMTypeRef LLVMX86FP80Type(void)
Definition Core.cpp:787
LLVMBasicBlockRef LLVMInsertBasicBlock(LLVMBasicBlockRef BBRef, const char *Name)
Definition Core.cpp:2981
LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3921
static LLVMValueRef getMDNodeOperandImpl(LLVMContext &Context, const MDNode *N, unsigned Index)
Definition Core.cpp:1239
LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const char Str[], unsigned SLen)
Definition Core.cpp:1636
LLVMTypeRef LLVMPPCFP128Type(void)
Definition Core.cpp:793
LLVMTypeRef LLVMFloatType(void)
Definition Core.cpp:781
static int map_from_llvmopcode(LLVMOpcode code)
Definition Core.cpp:1800
static LLVMAtomicRMWBinOp mapToLLVMRMWBinOp(AtomicRMWInst::BinOp BinOp)
Definition Core.cpp:4142
LLVMTypeRef LLVMLabelType(void)
Definition Core.cpp:996
LLVMValueRef LLVMConstString(const char *Str, unsigned Length, LLVMBool DontNullTerminate)
Definition Core.cpp:1702
unsigned LLVMGetMDKindID(const char *Name, unsigned SLen)
Definition Core.cpp:152
LLVMTypeRef LLVMInt8Type(void)
Definition Core.cpp:725
LLVMTypeRef LLVMDoubleType(void)
Definition Core.cpp:784
LLVMValueRef LLVMConstByteOfStringAndSize(LLVMTypeRef ByteTy, const char Str[], size_t SLen, uint8_t Radix)
Definition Core.cpp:1622
LLVMTypeRef LLVMInt1Type(void)
Definition Core.cpp:722
LLVMBuilderRef LLVMCreateBuilder(void)
Definition Core.cpp:3431
LLVMTypeRef LLVMInt128Type(void)
Definition Core.cpp:737
static AtomicRMWInst::BinOp mapFromLLVMRMWBinOp(LLVMAtomicRMWBinOp BinOp)
Definition Core.cpp:4104
LLVMValueRef LLVMIsABranchInst(LLVMValueRef Val)
Definition Core.cpp:1185
LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal)
Definition Core.cpp:1858
LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const char Str[], unsigned SLen, uint8_t Radix)
Definition Core.cpp:1598
LLVMTypeRef LLVMInt16Type(void)
Definition Core.cpp:728
LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count)
Definition Core.cpp:1370
static LLVMContext & getGlobalContext()
Definition Core.cpp:95
static LLVMGEPNoWrapFlags mapToLLVMGEPNoWrapFlags(GEPNoWrapFlags GEPFlags)
Definition Core.cpp:1824
LLVMContextRef LLVMGetGlobalContext()
Definition Core.cpp:108
Module.h This file contains the declarations for the Module class.
static constexpr Value * getValue(Ty &ValueOrUse)
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
#define H(x, y, z)
Definition MD5.cpp:56
Machine Check Debug Module
#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, bool LookThroughCmp=false)
Returns the "element type" of the given value/instruction V.
Func MI getDebugLoc()))
Func getContext().diagnose(DiagnosticInfoUnsupported(Func
#define LLVM_DEBUG(...)
Definition Debug.h:119
static SymbolRef::Type getType(const Symbol *Sym)
Definition TapiFile.cpp:39
unify loop Fixup each natural loop to have a single exit block
static Function * getFunction(FunctionType *Ty, const Twine &Name, Module *M)
Value * RHS
Value * LHS
static const uint32_t IV[8]
Definition blake3_impl.h:83
static const fltSemantics & IEEEdouble()
Definition APFloat.h:298
static constexpr roundingMode rmNearestTiesToEven
Definition APFloat.h:345
LLVM_ABI opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
Definition APFloat.cpp:5920
LLVM_ABI double convertToDouble() const
Converts this APFloat to host double value.
Definition APFloat.cpp:5979
Class for arbitrary precision integers.
Definition APInt.h:78
an instruction to allocate memory on the stack
This class represents an incoming formal argument to a Function.
Definition Argument.h:32
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
size_t size() const
Get the array size.
Definition ArrayRef.h:141
iterator begin() const
Definition ArrayRef.h:129
bool empty() const
Check if the array is empty.
Definition ArrayRef.h:136
static LLVM_ABI ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
An instruction that atomically checks whether a specified value is in a memory location,...
an instruction that atomically reads a memory location, combines it with another value,...
BinOp
This enumeration lists the possible modifications atomicrmw can make.
@ Add
*p = old + v
@ FAdd
*p = old + v
@ USubCond
Subtract only if no unsigned overflow.
@ FMinimum
*p = minimum(old, v) minimum matches the behavior of llvm.minimum.
@ Min
*p = old <signed v ? old : v
@ Sub
*p = old - v
@ And
*p = old & v
@ Xor
*p = old ^ v
@ USubSat
*p = usub.sat(old, v) usub.sat matches the behavior of llvm.usub.sat.
@ FMaximum
*p = maximum(old, v) maximum matches the behavior of llvm.maximum.
@ FSub
*p = old - v
@ UIncWrap
Increment one up to a maximum value.
@ Max
*p = old >signed v ? old : v
@ UMin
*p = old <unsigned v ? old : v
@ FMin
*p = minnum(old, v) minnum matches the behavior of llvm.minnum.
@ UMax
*p = old >unsigned v ? old : v
@ FMaximumNum
*p = maximumnum(old, v) maximumnum matches the behavior of llvm.maximumnum.
@ FMax
*p = maxnum(old, v) maxnum matches the behavior of llvm.maxnum.
@ UDecWrap
Decrement one until a minimum value or zero.
@ FMinimumNum
*p = minimumnum(old, v) minimumnum matches the behavior of llvm.minimumnum.
@ Nand
*p = ~(old & v)
Functions, function parameters, and return types can have attributes to indicate how they should be t...
Definition Attributes.h:105
LLVM_ABI bool isStringAttribute() const
Return true if the attribute is a string (target-dependent) attribute.
static LLVM_ABI Attribute::AttrKind getAttrKindFromName(StringRef AttrName)
LLVM_ABI StringRef getKindAsString() const
Return the attribute's kind as a string.
static LLVM_ABI Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
LLVM_ABI std::string getAsString(bool InAttrGrp=false) const
The Attribute is converted to a string of equivalent mnemonic.
LLVM_ABI Attribute::AttrKind getKindAsEnum() const
Return the attribute's kind as an enum (Attribute::AttrKind).
LLVM_ABI StringRef getValueAsString() const
Return the attribute's value as a string.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
Definition Attributes.h:124
@ EndAttrKinds
Sentinel value useful for loops.
Definition Attributes.h:129
LLVM_ABI bool isTypeAttribute() const
Return true if the attribute is a type attribute.
static LLVM_ABI Attribute getWithAlignment(LLVMContext &Context, Align Alignment)
Return a uniquified Attribute object that has the specific alignment set.
LLVM Basic Block Representation.
Definition BasicBlock.h:62
const Function * getParent() const
Return the enclosing method, or null if none.
Definition BasicBlock.h:213
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
Definition BasicBlock.h:206
InstListType::iterator iterator
Instruction iterators...
Definition BasicBlock.h:170
static LLVM_ABI BlockAddress * get(Function *F, BasicBlock *BB)
Return a BlockAddress for the specified function and basic block.
Class to represent byte types.
static LLVM_ABI ByteType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing a ByteType.
Definition Type.cpp:378
static LLVM_ABI Instruction::CastOps getCastOpcode(const Value *Val, bool SrcIsSigned, Type *Ty, bool DstIsSigned)
Returns the opcode necessary to cast Val into Ty using usual casting rules.
handler_range handlers()
iteration adapter for range-for loops.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition InstrTypes.h:740
static LLVM_ABI Constant * get(ArrayType *T, ArrayRef< Constant * > V)
static ConstantAsMetadata * get(Constant *C)
Definition Metadata.h:537
static LLVM_ABI Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true, bool ByteString=false)
This method constructs a CDS and initializes it with a text string.
static Constant * getRaw(StringRef Data, uint64_t NumElements, Type *ElementTy)
getRaw() constructor - Return a constant with array type with an element count and element type match...
Definition Constants.h:897
static LLVM_ABI Constant * getIntToPtr(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static LLVM_ABI Constant * getExtractElement(Constant *Vec, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
static LLVM_ABI Constant * getAlignOf(Type *Ty)
getAlignOf constant expr - computes the alignment of a type in a target independent way (Note: the re...
static Constant * getNUWSub(Constant *C1, Constant *C2)
Definition Constants.h:1382
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList)
Create an "inbounds" getelementptr.
Definition Constants.h:1507
static LLVM_ABI Constant * getPointerCast(Constant *C, Type *Ty)
Create a BitCast, AddrSpaceCast, or a PtrToInt cast constant expression.
static LLVM_ABI Constant * getTruncOrBitCast(Constant *C, Type *Ty)
static Constant * getNSWAdd(Constant *C1, Constant *C2)
Definition Constants.h:1370
static LLVM_ABI Constant * getSub(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
static LLVM_ABI Constant * getNot(Constant *C)
static LLVM_ABI Constant * getInsertElement(Constant *Vec, Constant *Elt, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
static LLVM_ABI Constant * getPtrToInt(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static LLVM_ABI Constant * getShuffleVector(Constant *V1, Constant *V2, ArrayRef< int > Mask, Type *OnlyIfReducedTy=nullptr)
static LLVM_ABI Constant * getSizeOf(Type *Ty)
getSizeOf constant expr - computes the (alloc) size of a type (in address-units, not bits) in a targe...
static LLVM_ABI Constant * getXor(Constant *C1, Constant *C2)
static Constant * getNSWNeg(Constant *C)
Definition Constants.h:1368
static Constant * getNSWSub(Constant *C1, Constant *C2)
Definition Constants.h:1378
static Constant * getNUWAdd(Constant *C1, Constant *C2)
Definition Constants.h:1374
static LLVM_ABI Constant * getAddrSpaceCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static Constant * getGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList, GEPNoWrapFlags NW=GEPNoWrapFlags::none(), std::optional< ConstantRange > InRange=std::nullopt, Type *OnlyIfReducedTy=nullptr)
Getelementptr form.
Definition Constants.h:1470
static LLVM_ABI Constant * getAdd(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
static LLVM_ABI Constant * getBitCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static LLVM_ABI Constant * getNeg(Constant *C, bool HasNSW=false)
static LLVM_ABI Constant * getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced=false)
ConstantFP - Floating Point Values [float, double].
Definition Constants.h:420
const APFloat & getValueAPF() const
Definition Constants.h:463
static LLVM_ABI ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
static LLVM_ABI ConstantPtrAuth * get(Constant *Ptr, ConstantInt *Key, ConstantInt *Disc, Constant *AddrDisc, Constant *DeactivationSymbol)
Return a pointer signed with the specified parameters.
This class represents a range of values.
static LLVM_ABI Constant * get(StructType *T, ArrayRef< Constant * > V)
static Constant * getAnon(ArrayRef< Constant * > V, bool Packed=false)
Return an anonymous struct that has the specified elements.
Definition Constants.h:643
static LLVM_ABI Constant * get(ArrayRef< Constant * > V)
This is an important base class in LLVM.
Definition Constant.h:43
static LLVM_ABI Constant * getAllOnesValue(Type *Ty)
static LLVM_ABI Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
Subprogram description. Uses SubclassData1.
Base class for non-instruction debug metadata records that have positions within IR.
Record of a variable value-assignment, aka a non instruction representation of the dbg....
Basic diagnostic printer that uses an underlying raw_ostream.
Represents either an error or a value T.
Definition ErrorOr.h:56
reference get()
Definition ErrorOr.h:149
std::error_code getError() const
Definition ErrorOr.h:152
This instruction compares its operands according to the predicate given to the constructor.
Convenience struct for specifying and reasoning about fast-math flags.
Definition FMF.h:23
void setAllowContract(bool B=true)
Definition FMF.h:90
bool noSignedZeros() const
Definition FMF.h:67
bool noInfs() const
Definition FMF.h:66
void setAllowReciprocal(bool B=true)
Definition FMF.h:87
bool allowReciprocal() const
Definition FMF.h:68
void setNoSignedZeros(bool B=true)
Definition FMF.h:84
bool allowReassoc() const
Flag queries.
Definition FMF.h:64
bool approxFunc() const
Definition FMF.h:70
void setNoNaNs(bool B=true)
Definition FMF.h:78
void setAllowReassoc(bool B=true)
Flag setters.
Definition FMF.h:75
bool noNaNs() const
Definition FMF.h:65
void setApproxFunc(bool B=true)
Definition FMF.h:93
void setNoInfs(bool B=true)
Definition FMF.h:81
bool allowContract() const
Definition FMF.h:69
An instruction for ordering other memory operations.
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
Definition Type.cpp:867
static LLVM_ABI FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
Definition Function.h:168
BasicBlockListType::iterator iterator
Definition Function.h:70
Argument * arg_iterator
Definition Function.h:73
iterator_range< arg_iterator > args()
Definition Function.h:866
arg_iterator arg_begin()
Definition Function.h:842
Function::iterator insert(Function::iterator Position, BasicBlock *BB)
Insert BB in the basic block list at Position.
Definition Function.h:729
size_t arg_size() const
Definition Function.h:875
Represents flags for the getelementptr instruction/expression.
static GEPNoWrapFlags inBounds()
static GEPNoWrapFlags noUnsignedWrap()
static GEPNoWrapFlags noUnsignedSignedWrap()
bool hasNoUnsignedSignedWrap() const
bool hasNoUnsignedWrap() const
bool isInBounds() const
GEPNoWrapFlags getNoWrapFlags() const
Definition Operator.h:385
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
LLVM_ABI void setNoWrapFlags(GEPNoWrapFlags NW)
Set nowrap flags for GEP instruction.
static LLVM_ABI GlobalAlias * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Aliasee, Module *Parent)
If a parent module is specified, the alias is automatically inserted into the end of the specified mo...
Definition Globals.cpp:692
static LLVM_ABI GlobalIFunc * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Resolver, Module *Parent)
If a parent module is specified, the ifunc is automatically inserted into the end of the specified mo...
Definition Globals.cpp:749
void setUnnamedAddr(UnnamedAddr Val)
void setThreadLocalMode(ThreadLocalMode Val)
void setLinkage(LinkageTypes LT)
DLLStorageClassTypes
Storage classes of global values for PE targets.
Definition GlobalValue.h:74
Module * getParent()
Get the module that this global value is contained inside of...
VisibilityTypes
An enumeration for the kinds of visibility of global values.
Definition GlobalValue.h:67
@ PrivateLinkage
Like Internal, but omit from symbol table.
Definition GlobalValue.h:61
@ CommonLinkage
Tentative definitions.
Definition GlobalValue.h:63
@ InternalLinkage
Rename collisions when linking (static functions).
Definition GlobalValue.h:60
@ LinkOnceAnyLinkage
Keep one copy of function when linking (inline)
Definition GlobalValue.h:55
@ WeakODRLinkage
Same, but only replaced by something equivalent.
Definition GlobalValue.h:58
@ ExternalLinkage
Externally visible function.
Definition GlobalValue.h:53
@ WeakAnyLinkage
Keep one copy of named function when linking (weak)
Definition GlobalValue.h:57
@ AppendingLinkage
Special purpose, only applies to global arrays.
Definition GlobalValue.h:59
@ AvailableExternallyLinkage
Available for inspection, not emission.
Definition GlobalValue.h:54
@ ExternalWeakLinkage
ExternalWeak linkage description.
Definition GlobalValue.h:62
@ LinkOnceODRLinkage
Same, but only replaced by something equivalent.
Definition GlobalValue.h:56
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
bool hasInitializer() const
Definitions have initializers, declarations don't.
This instruction compares its operands according to the predicate given to the constructor.
Common base class shared among various IRBuilders.
Definition IRBuilder.h:114
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition IRBuilder.h:2893
static LLVM_ABI InlineAsm * get(FunctionType *Ty, StringRef AsmString, StringRef Constraints, bool hasSideEffects, bool isAlignStack=false, AsmDialect asmDialect=AD_ATT, bool canThrow=false)
InlineAsm::get - Return the specified uniqued inline asm string.
Definition InlineAsm.cpp:43
Class to represent integer types.
static LLVM_ABI IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition Type.cpp:348
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:68
void(*)(LLVMContext *Context, void *OpaqueHandle) YieldCallbackTy
Defines the type of a yield callback.
An instruction for reading from memory.
static LocalAsMetadata * get(Value *Local)
Definition Metadata.h:563
Metadata node.
Definition Metadata.h:1069
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition Metadata.h:1565
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:777
ifunc_iterator ifunc_begin()
Definition Module.h:846
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:779
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:887
ifunc_iterator ifunc_end()
Definition Module.h:848
alias_iterator alias_end()
Definition Module.h:830
alias_iterator alias_begin()
Definition Module.h:828
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:892
A tuple of MDNodes.
Definition Metadata.h:1753
LLVM_ABI StringRef getName() const
Module * getParent()
Get the module that holds this named metadata collection.
Definition Metadata.h:1823
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:116
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
Definition Record.h:2202
static LLVM_ABI ScalableVectorType * get(Type *ElementType, unsigned MinNumElts)
Definition Type.cpp:889
This instruction constructs a fixed permutation of two input vectors.
ArrayRef< int > getShuffleMask() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An instruction for storing to memory.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
constexpr size_t size() const
Get the string size.
Definition StringRef.h:144
constexpr const char * data() const
Get a pointer to the start of the string (which may not be null terminated).
Definition StringRef.h:138
Class to represent struct types.
static LLVM_ABI StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
Definition Type.cpp:477
static LLVM_ABI StructType * getTypeByName(LLVMContext &C, StringRef Name)
Return the type with the specified name, or null if there is none by that name.
Definition Type.cpp:802
static LLVM_ABI StructType * create(LLVMContext &Context, StringRef Name)
This creates an identified struct.
Definition Type.cpp:683
Class to represent target extensions types, which are generally unintrospectable from target-independ...
static LLVM_ABI TargetExtType * get(LLVMContext &Context, StringRef Name, ArrayRef< Type * > Types={}, ArrayRef< unsigned > Ints={})
Return a target extension type having the specified name and optional type and integer parameters.
Definition Type.cpp:972
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:310
static LLVM_ABI Type * getX86_AMXTy(LLVMContext &C)
Definition Type.cpp:293
static LLVM_ABI Type * getMetadataTy(LLVMContext &C)
Definition Type.cpp:288
static LLVM_ABI Type * getTokenTy(LLVMContext &C)
Definition Type.cpp:289
static LLVM_ABI IntegerType * getInt128Ty(LLVMContext &C)
Definition Type.cpp:311
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
Definition Type.cpp:309
static LLVM_ABI Type * getPPC_FP128Ty(LLVMContext &C)
Definition Type.cpp:292
static LLVM_ABI Type * getFP128Ty(LLVMContext &C)
Definition Type.cpp:291
static LLVM_ABI Type * getLabelTy(LLVMContext &C)
Definition Type.cpp:283
@ X86_AMXTyID
AMX vectors (8192 bits, X86 specific)
Definition Type.h:67
@ FunctionTyID
Functions.
Definition Type.h:73
@ ArrayTyID
Arrays.
Definition Type.h:76
@ TypedPointerTyID
Typed pointer used by some GPU targets.
Definition Type.h:79
@ HalfTyID
16-bit floating point type
Definition Type.h:57
@ TargetExtTyID
Target extension type.
Definition Type.h:80
@ VoidTyID
type with no size
Definition Type.h:64
@ ScalableVectorTyID
Scalable SIMD vector type.
Definition Type.h:78
@ LabelTyID
Labels.
Definition Type.h:65
@ FloatTyID
32-bit floating point type
Definition Type.h:59
@ StructTyID
Structures.
Definition Type.h:75
@ IntegerTyID
Arbitrary bit width integers.
Definition Type.h:71
@ FixedVectorTyID
Fixed width SIMD vector type.
Definition Type.h:77
@ BFloatTyID
16-bit floating point type (7-bit significand)
Definition Type.h:58
@ DoubleTyID
64-bit floating point type
Definition Type.h:60
@ X86_FP80TyID
80-bit floating point type (X87)
Definition Type.h:61
@ PPC_FP128TyID
128-bit floating point type (two 64-bits, PowerPC)
Definition Type.h:63
@ MetadataTyID
Metadata.
Definition Type.h:66
@ TokenTyID
Tokens.
Definition Type.h:68
@ ByteTyID
Arbitrary bit width bytes.
Definition Type.h:72
@ PointerTyID
Pointers.
Definition Type.h:74
@ FP128TyID
128-bit floating point type (112-bit significand)
Definition Type.h:62
static LLVM_ABI Type * getVoidTy(LLVMContext &C)
Definition Type.cpp:282
static LLVM_ABI IntegerType * getInt8Ty(LLVMContext &C)
Definition Type.cpp:307
static LLVM_ABI IntegerType * getInt16Ty(LLVMContext &C)
Definition Type.cpp:308
static LLVM_ABI IntegerType * getInt1Ty(LLVMContext &C)
Definition Type.cpp:306
static LLVM_ABI Type * getDoubleTy(LLVMContext &C)
Definition Type.cpp:287
static LLVM_ABI Type * getX86_FP80Ty(LLVMContext &C)
Definition Type.cpp:290
static LLVM_ABI Type * getFloatTy(LLVMContext &C)
Definition Type.cpp:286
static LLVM_ABI Type * getBFloatTy(LLVMContext &C)
Definition Type.cpp:285
static LLVM_ABI Type * getHalfTy(LLVMContext &C)
Definition Type.cpp:284
static LLVM_ABI UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
A Use represents the edge between a Value definition and its users.
Definition Use.h:35
static LLVM_ABI ValueAsMetadata * get(Value *V)
Definition Metadata.cpp:509
LLVM Value Representation.
Definition Value.h:75
Type * getType() const
All values are typed, get the type of this value.
Definition Value.h:255
LLVMContext & getContext() const
All values hold a context through their type.
Definition Value.h:258
use_iterator_impl< Use > use_iterator
Definition Value.h:353
An efficient, type-erasing, non-owning reference to a callable.
self_iterator getIterator()
Definition ilist_node.h:123
FunctionPassManager manages FunctionPasses.
PassManager manages ModulePassManagers.
A raw_ostream that writes to a file descriptor.
bool has_error() const
Return the value of the flag in this raw_fd_ostream indicating whether an output error has been encou...
std::error_code error() const
void close()
Manually flush the stream and close the file.
A raw_ostream that writes to an std::string.
ilist_select_iterator_type< OptionsT, false, false > iterator
CallInst * Call
LLVMTypeRef LLVMGetTypeByName2(LLVMContextRef C, const char *Name)
Obtain a Type from a context by its registered name.
Definition Core.cpp:891
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:3551
LLVMValueRef LLVMBuildMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3815
LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef B)
Definition Core.cpp:3543
LLVMValueRef LLVMBuildSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3795
LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3825
LLVMBool LLVMGetWeak(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4254
LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4382
LLVMValueRef LLVMBuildIsNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4511
LLVMValueRef LLVMBuildGEPWithNoWrapFlags(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name, LLVMGEPNoWrapFlags NoWrapFlags)
Creates a GetElementPtr instruction.
Definition Core.cpp:4212
LLVMValueRef LLVMBuildAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3775
void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak)
Definition Core.cpp:4258
LLVMValueRef LLVMBuildOr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3895
LLVMValueRef LLVMBuildBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4354
LLVMValueRef LLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3840
LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition Core.cpp:4197
LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3800
void LLVMPositionBuilderBeforeInstrAndDbgRecords(LLVMBuilderRef Builder, LLVMValueRef Instr)
Set the builder position before Instr and any attached debug records.
Definition Core.cpp:3460
LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4516
void LLVMDisposeBuilder(LLVMBuilderRef Builder)
Definition Core.cpp:3488
void LLVMClearInsertionPosition(LLVMBuilderRef Builder)
Definition Core.cpp:3475
LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PersFn, unsigned NumClauses, const char *Name)
Definition Core.cpp:3617
void LLVMSetIsDisjoint(LLVMValueRef Inst, LLVMBool IsDisjoint)
Sets the disjoint flag for the instruction.
Definition Core.cpp:3998
LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst)
Definition Core.cpp:4594
LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn)
Definition Core.cpp:3647
void LLVMSetAtomicRMWBinOp(LLVMValueRef Inst, LLVMAtomicRMWBinOp BinOp)
Definition Core.cpp:4293
LLVMValueRef LLVMBuildFDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3855
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:3603
LLVMValueRef LLVMBuildXor(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3900
LLVMBool LLVMGetExact(LLVMValueRef DivOrShrInst)
Definition Core.cpp:3957
LLVMValueRef LLVMBuildAddrSpaceCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4359
unsigned LLVMGetNumMaskElements(LLVMValueRef SVInst)
Get the number of elements in the mask of a ShuffleVector instruction.
Definition Core.cpp:4576
void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr)
Definition Core.cpp:3479
LLVMValueRef LLVMBuildCleanupRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition Core.cpp:3668
LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4319
void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers)
Obtain the basic blocks acting as handlers for a catchswitch instruction.
Definition Core.cpp:3715
LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4299
LLVMValueRef LLVMGetArgOperand(LLVMValueRef Funclet, unsigned i)
Definition Core.cpp:3732
LLVMValueRef LLVMBuildAnd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3890
unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch)
Definition Core.cpp:3711
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:3575
LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder)
Definition Core.cpp:3471
LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3845
LLVMValueRef LLVMBuildSExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4370
LLVMValueRef LLVMBuildCall2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:4439
void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW)
Definition Core.cpp:3952
LLVMMetadataRef LLVMGetCurrentDebugLocation2(LLVMBuilderRef Builder)
Get location information used by debugging information.
Definition Core.cpp:3494
LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3835
LLVMValueRef LLVMBuildSelect(LLVMBuilderRef B, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, const char *Name)
Definition Core.cpp:4462
void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr)
Set the builder position before Instr but after any attached debug records.
Definition Core.cpp:3455
LLVMBool LLVMCanValueUseFastMathFlags(LLVMValueRef V)
Check if a given value can potentially have fast math flags.
Definition Core.cpp:3988
void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value)
Definition Core.cpp:3736
LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef B, LLVMValueRef If, LLVMBasicBlockRef Then, LLVMBasicBlockRef Else)
Definition Core.cpp:3560
LLVMBool LLVMGetNUW(LLVMValueRef ArithInst)
Definition Core.cpp:3937
LLVMOpcode LLVMGetCastOpcode(LLVMValueRef Src, LLVMBool SrcIsSigned, LLVMTypeRef DestTy, LLVMBool DestIsSigned)
Definition Core.cpp:4411
void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr, const char *Name)
Definition Core.cpp:3483
LLVMValueRef LLVMBuildSRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3865
LLVMValueRef LLVMBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:3636
LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Deprecated: This cast is always signed.
Definition Core.cpp:4400
LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder)
Deprecated: Returning the NULL location will crash.
Definition Core.cpp:3511
LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef Index, const char *Name)
Definition Core.cpp:4474
LLVMValueRef LLVMBuildShl(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3875
LLVMBuilderRef LLVMCreateBuilderInContext(LLVMContextRef C)
Definition Core.cpp:3427
LLVMValueRef LLVMBuildCatchRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition Core.cpp:3662
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:4039
LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemAccessInst)
Definition Core.cpp:4262
LLVMValueRef LLVMBuildStructGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, unsigned Idx, const char *Name)
Definition Core.cpp:4222
int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt)
Get the mask value at position Elt in the mask of a ShuffleVector instruction.
Definition Core.cpp:4582
void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal, LLVMBasicBlockRef Dest)
Definition Core.cpp:3678
LLVMValueRef LLVMBuildBr(LLVMBuilderRef B, LLVMBasicBlockRef Dest)
Definition Core.cpp:3556
LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, const char *Name)
Definition Core.cpp:4480
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:3448
void LLVMSetFastMathFlags(LLVMValueRef FPMathInst, LLVMFastMathFlags FMF)
Sets the flags for which fast-math-style optimizations are allowed for this value.
Definition Core.cpp:3983
LLVMValueRef LLVMBuildIntCast2(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, LLVMBool IsSigned, const char *Name)
Definition Core.cpp:4393
LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3805
LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3790
LLVMValueRef LLVMBuildCatchPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition Core.cpp:3629
LLVMValueRef LLVMBuildCallWithOperandBundles(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name)
Definition Core.cpp:4448
LLVMBool LLVMIsCleanup(LLVMValueRef LandingPad)
Definition Core.cpp:3699
LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4364
LLVMBool LLVMGetVolatile(LLVMValueRef Inst)
Definition Core.cpp:4239
LLVMValueRef LLVMBuildFPCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4406
LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4344
LLVMValueRef LLVMBuildPtrDiff2(LLVMBuilderRef B, LLVMTypeRef ElemTy, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4521
LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4376
LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4053
LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx)
Definition Core.cpp:3691
unsigned LLVMGetAtomicSyncScopeID(LLVMValueRef AtomicInst)
Returns the synchronization scope ID of an atomic instruction.
Definition Core.cpp:4613
LLVMValueRef LLVMBuildVAArg(LLVMBuilderRef B, LLVMValueRef List, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4469
LLVMValueRef LLVMBuildAtomicCmpXchgSyncScope(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, unsigned SSID)
Definition Core.cpp:4565
LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3905
LLVMBool LLVMIsAtomic(LLVMValueRef Inst)
Returns whether an instruction is an atomic instruction, e.g., atomicrmw, cmpxchg,...
Definition Core.cpp:4590
void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile)
Definition Core.cpp:4243
void LLVMSetAtomicSingleThread(LLVMValueRef AtomicInst, LLVMBool NewValue)
Definition Core.cpp:4603
LLVMValueRef LLVMBuildFRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3870
LLVMValueRef LLVMBuildURem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3860
LLVMValueRef LLVMBuildIntToPtr(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4349
LLVMBool LLVMGetNSW(LLVMValueRef ArithInst)
Definition Core.cpp:3947
LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3820
LLVMValueRef LLVMBuildFree(LLVMBuilderRef B, LLVMValueRef PointerVal)
Definition Core.cpp:4058
LLVMValueRef LLVMBuildNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3912
LLVMValueRef LLVMBuildFSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3810
LLVMValueRef LLVMBuildCatchSwitch(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMBasicBlockRef UnwindBB, unsigned NumHandlers, const char *Name)
Definition Core.cpp:3651
LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name)
Definition Core.cpp:4062
LLVMValueRef LLVMBuildInBoundsGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition Core.cpp:4204
LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4014
LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, LLVMBool singleThread)
Definition Core.cpp:4552
LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr, unsigned NumDests)
Definition Core.cpp:3570
LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef B)
Definition Core.cpp:3674
LLVMValueRef LLVMBuildSIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4329
LLVMValueRef LLVMBuildSExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4309
LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4314
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:3517
void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Builder, LLVMMetadataRef Loc)
Set location information used by debugging information.
Definition Core.cpp:3498
LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4048
void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L)
Deprecated: Passing the NULL location will crash.
Definition Core.cpp:3505
LLVMValueRef LLVMBuildPhi(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4435
void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest)
Definition Core.cpp:3683
LLVMBool LLVMGetNNeg(LLVMValueRef NonNegInst)
Gets if the instruction has the non-negative flag set.
Definition Core.cpp:3967
LLVMValueRef LLVMBuildAtomicRMWSyncScope(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, unsigned SSID)
Definition Core.cpp:4541
LLVMValueRef LLVMBuildRet(LLVMBuilderRef B, LLVMValueRef V)
Definition Core.cpp:3547
LLVMMetadataRef LLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder)
Get the dafult floating-point math metadata for a given builder.
Definition Core.cpp:3537
LLVMValueRef LLVMBuildExtractValue(LLVMBuilderRef B, LLVMValueRef AggVal, unsigned Index, const char *Name)
Definition Core.cpp:4494
LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str, const char *Name)
Deprecated: Use LLVMBuildGlobalString instead, which has identical behavior.
Definition Core.cpp:4234
LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3780
void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block)
Definition Core.cpp:3466
LLVMValueRef LLVMBuildFMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3830
LLVMValueRef LLVMBuildLShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3880
LLVMAtomicRMWBinOp LLVMGetAtomicRMWBinOp(LLVMValueRef Inst)
Definition Core.cpp:4289
LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3929
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:4023
void LLVMSetAtomicSyncScopeID(LLVMValueRef AtomicInst, unsigned SSID)
Sets the synchronization scope ID of an atomic instruction.
Definition Core.cpp:4619
LLVMContextRef LLVMGetBuilderContext(LLVMBuilderRef Builder)
Obtain the context to which this builder is associated.
Definition Core.cpp:3533
LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:4005
LLVMValueRef LLVMBuildFreeze(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition Core.cpp:4506
LLVMValueRef LLVMBuildGlobalString(LLVMBuilderRef B, const char *Str, const char *Name)
Definition Core.cpp:4229
void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW)
Definition Core.cpp:3942
LLVMAtomicOrdering LLVMGetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4625
LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef B, LLVMRealPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4426
LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4388
LLVMValueRef LLVMBuildExactSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3850
LLVMValueRef LLVMBuildShuffleVector(LLVMBuilderRef B, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, const char *Name)
Definition Core.cpp:4487
LLVMValueRef LLVMBuildFPExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4339
void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val)
Definition Core.cpp:3703
LLVMValueRef LLVMBuildICmp(LLVMBuilderRef B, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:4419
void LLVMSetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4643
void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal)
Definition Core.cpp:3695
LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, LLVMBool isSingleThread, const char *Name)
Definition Core.cpp:4181
void LLVMSetParentCatchSwitch(LLVMValueRef CatchPad, LLVMValueRef CatchSwitch)
Set the parent catchswitch instruction of a catchpad instruction.
Definition Core.cpp:3725
LLVMValueRef LLVMBuildFenceSyncScope(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, unsigned SSID, const char *Name)
Definition Core.cpp:4190
LLVMValueRef LLVMBuildUIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4324
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:3442
unsigned LLVMGetNumClauses(LLVMValueRef LandingPad)
Definition Core.cpp:3687
int LLVMGetUndefMaskElem(void)
Definition Core.cpp:4588
void LLVMSetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4630
LLVMValueRef LLVMGetParentCatchSwitch(LLVMValueRef CatchPad)
Get the parent catchswitch instruction of a catchpad instruction.
Definition Core.cpp:3721
LLVMFastMathFlags LLVMGetFastMathFlags(LLVMValueRef FPMathInst)
Get the flags for which fast-math-style optimizations are allowed for this value.
Definition Core.cpp:3977
LLVMBool LLVMGetIsDisjoint(LLVMValueRef Inst)
Gets whether the instruction has the disjoint flag set.
Definition Core.cpp:3993
LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef B, LLVMValueRef V, LLVMBasicBlockRef Else, unsigned NumCases)
Definition Core.cpp:3565
void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg)
Sets the non-negative flag for the instruction.
Definition Core.cpp:3972
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:4030
void LLVMAddHandler(LLVMValueRef CatchSwitch, LLVMBasicBlockRef Dest)
Definition Core.cpp:3707
void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact)
Definition Core.cpp:3962
LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3916
LLVMValueRef LLVMBuildAShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3885
LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, const char *Name)
Definition Core.cpp:3594
void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering)
Definition Core.cpp:4276
LLVMValueRef LLVMBuildFPTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4334
LLVMValueRef LLVMBuildStore(LLVMBuilderRef B, LLVMValueRef Val, LLVMValueRef PointerVal)
Definition Core.cpp:4067
void LLVMAddMetadataToInst(LLVMBuilderRef Builder, LLVMValueRef Inst)
Same as LLVMSetInstDebugLocation.
Definition Core.cpp:3521
LLVMAtomicOrdering LLVMGetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst)
Definition Core.cpp:4638
LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition Core.cpp:3785
LLVMValueRef LLVMBuildInsertValue(LLVMBuilderRef B, LLVMValueRef AggVal, LLVMValueRef EltVal, unsigned Index, const char *Name)
Definition Core.cpp:4499
void LLVMBuilderSetDefaultFPMathTag(LLVMBuilderRef Builder, LLVMMetadataRef FPMathTag)
Set the default floating-point math metadata for the given builder.
Definition Core.cpp:3525
LLVMValueRef LLVMBuildZExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition Core.cpp:4304
LLVMValueRef LLVMBuildNot(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition Core.cpp:3933
LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, LLVMBool singleThread)
Definition Core.cpp:4530
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange(const char *InputData, size_t InputDataLength, const char *BufferName, LLVMBool RequiresNullTerminator)
Definition Core.cpp:4690
size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4715
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData, size_t InputDataLength, const char *BufferName)
Definition Core.cpp:4701
const char * LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4711
LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const char *Path, LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
Definition Core.cpp:4665
LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
Definition Core.cpp:4679
void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf)
Definition Core.cpp:4719
LLVMModuleProviderRef LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M)
Changes the type of M so it can be passed to FunctionPassManagers and the JIT.
Definition Core.cpp:4654
void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP)
Destroys the module M.
Definition Core.cpp:4658
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:1441
LLVMValueRef LLVMGetNamedFunctionWithLength(LLVMModuleRef M, const char *Name, size_t Length)
Obtain a Function value from a Module by its name.
Definition Core.cpp:2501
unsigned LLVMGetDebugLocColumn(LLVMValueRef Val)
Return the column number of the debug location for this value, which must be an llvm::Instruction.
Definition Core.cpp:1569
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:1436
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:598
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:593
LLVMBool LLVMGetInlineAsmHasSideEffects(LLVMValueRef InlineAsmVal)
Get if the inline asm snippet has side effects.
Definition Core.cpp:588
unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char *Name)
Obtain the number of operands for named metadata in a module.
Definition Core.cpp:1472
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:583
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:604
LLVMInlineAsmDialect LLVMGetInlineAsmDialect(LLVMValueRef InlineAsmVal)
Get the dialect used by the inline asm snippet.
Definition Core.cpp:567
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:2522
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:887
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:549
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:529
LLVMValueRef LLVMGetOrInsertFunction(LLVMModuleRef M, const char *Name, size_t NameLen, LLVMTypeRef FunctionTy)
Obtain or insert a function into a module.
Definition Core.cpp:2489
const char * LLVMGetInlineAsmConstraintString(LLVMValueRef InlineAsmVal, size_t *Len)
Get the raw constraint string for an inline assembly snippet.
Definition Core.cpp:558
LLVMNamedMDNodeRef LLVMGetNextNamedMetadata(LLVMNamedMDNodeRef NMD)
Advance a NamedMDNode iterator to the next NamedMDNode.
Definition Core.cpp:1420
void LLVMGetNamedMetadataOperands(LLVMModuleRef M, const char *Name, LLVMValueRef *Dest)
Obtain the named metadata operands for a module.
Definition Core.cpp:1479
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:2483
LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn)
Decrement a Function iterator to the previous Function.
Definition Core.cpp:2530
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:1499
void LLVMAddNamedMetadataOperand(LLVMModuleRef M, const char *Name, LLVMValueRef Val)
Add an operand to named metadata.
Definition Core.cpp:1489
unsigned LLVMGetDebugLocLine(LLVMValueRef Val)
Return the line number of the debug location for this value, which must be an llvm::Instruction,...
Definition Core.cpp:1547
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:2514
LLVMNamedMDNodeRef LLVMGetPreviousNamedMetadata(LLVMNamedMDNodeRef NMD)
Decrement a NamedMDNode iterator to the previous NamedMDNode.
Definition Core.cpp:1428
const char * LLVMGetNamedMetadataName(LLVMNamedMDNodeRef NMD, size_t *NameLen)
Retrieve the name of a NamedMDNode.
Definition Core.cpp:1446
LLVMValueRef LLVMGetNamedFunction(LLVMModuleRef M, const char *Name)
Obtain a Function value from a Module by its name.
Definition Core.cpp:2497
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:1523
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:1412
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:2506
LLVMNamedMDNodeRef LLVMGetFirstNamedMetadata(LLVMModuleRef M)
Obtain an iterator to the first NamedMDNode in a Module.
Definition Core.cpp:1404
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:2848
unsigned LLVMGetNumOperandBundleArgs(LLVMOperandBundleRef Bundle)
Obtain the number of operands for an operand bundle.
Definition Core.cpp:2865
const char * LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len)
Obtain the tag of an operand bundle as a string.
Definition Core.cpp:2859
void LLVMDisposeOperandBundle(LLVMOperandBundleRef Bundle)
Destroy an operand bundle.
Definition Core.cpp:2855
LLVMValueRef LLVMGetOperandBundleArgAtIndex(LLVMOperandBundleRef Bundle, unsigned Index)
Obtain the operand for an operand bundle at the given index.
Definition Core.cpp:2869
LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef P)
Deprecated: Use LLVMCreateFunctionPassManagerForModule instead.
Definition Core.cpp:4733
LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M)
Constructs a new function-by-function pass pipeline over the module provider.
Definition Core.cpp:4729
LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM)
Finalizes all of the function passes scheduled in the function pass manager.
Definition Core.cpp:4750
void LLVMDisposePassManager(LLVMPassManagerRef PM)
Frees the memory of a pass pipeline.
Definition Core.cpp:4754
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:4746
LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM)
Initializes all of the function passes scheduled in the function pass manager.
Definition Core.cpp:4742
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:4738
LLVMPassManagerRef LLVMCreatePassManager()
Constructs a new whole-module pass pipeline.
Definition Core.cpp:4725
void LLVMStopMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
Definition Core.cpp:4764
LLVMBool LLVMStartMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
Definition Core.cpp:4760
LLVMBool LLVMIsMultithreaded()
Check whether LLVM is executing in thread-safe mode or not.
Definition Core.cpp:4767
LLVMTypeRef LLVMByteTypeInContext(LLVMContextRef C, unsigned NumBits)
Obtain a byte type from a context with specified bit width.
Definition Core.cpp:690
unsigned LLVMGetByteTypeWidth(LLVMTypeRef ByteTy)
Definition Core.cpp:694
LLVMTypeRef LLVMHalfTypeInContext(LLVMContextRef C)
Obtain a 16-bit floating point type from a context.
Definition Core.cpp:750
LLVMTypeRef LLVMBFloatTypeInContext(LLVMContextRef C)
Obtain a 16-bit brain floating point type from a context.
Definition Core.cpp:753
LLVMTypeRef LLVMPPCFP128TypeInContext(LLVMContextRef C)
Obtain a 128-bit floating point type (two 64-bits) from a context.
Definition Core.cpp:768
LLVMTypeRef LLVMDoubleTypeInContext(LLVMContextRef C)
Obtain a 64-bit floating point type from a context.
Definition Core.cpp:759
LLVMTypeRef LLVMFloatTypeInContext(LLVMContextRef C)
Obtain a 32-bit floating point type from a context.
Definition Core.cpp:756
LLVMTypeRef LLVMFP128TypeInContext(LLVMContextRef C)
Obtain a 128-bit floating point type (112-bit mantissa) from a context.
Definition Core.cpp:765
LLVMTypeRef LLVMX86FP80TypeInContext(LLVMContextRef C)
Obtain a 80-bit floating point type (X87) from a context.
Definition Core.cpp:762
LLVMTypeRef LLVMGetReturnType(LLVMTypeRef FunctionTy)
Obtain the Type this function Type returns.
Definition Core.cpp:813
LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType, LLVMTypeRef *ParamTypes, unsigned ParamCount, LLVMBool IsVarArg)
Obtain a function type consisting of a specified signature.
Definition Core.cpp:802
LLVMBool LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy)
Returns whether a function type is variadic.
Definition Core.cpp:809
unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy)
Obtain the number of parameters this function accepts.
Definition Core.cpp:817
void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest)
Obtain the types of a function's parameters.
Definition Core.cpp:821
LLVMTypeRef LLVMInt1TypeInContext(LLVMContextRef C)
Obtain an integer type from a context with specified bit width.
Definition Core.cpp:700
LLVMTypeRef LLVMInt8TypeInContext(LLVMContextRef C)
Definition Core.cpp:703
LLVMTypeRef LLVMInt32TypeInContext(LLVMContextRef C)
Definition Core.cpp:709
LLVMTypeRef LLVMIntTypeInContext(LLVMContextRef C, unsigned NumBits)
Definition Core.cpp:718
LLVMTypeRef LLVMInt64TypeInContext(LLVMContextRef C)
Definition Core.cpp:712
LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C)
Definition Core.cpp:706
unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy)
Definition Core.cpp:744
LLVMTypeRef LLVMInt128TypeInContext(LLVMContextRef C)
Definition Core.cpp:715
unsigned LLVMGetTargetExtTypeNumTypeParams(LLVMTypeRef TargetExtTy)
Obtain the number of type parameters for this target extension type.
Definition Core.cpp:1016
LLVMTypeRef LLVMX86AMXTypeInContext(LLVMContextRef C)
Create a X86 AMX type in a context.
Definition Core.cpp:771
const char * LLVMGetTargetExtTypeName(LLVMTypeRef TargetExtTy)
Obtain the name for this target extension type.
Definition Core.cpp:1011
LLVMTypeRef LLVMVoidTypeInContext(LLVMContextRef C)
Create a void type in a context.
Definition Core.cpp:980
LLVMTypeRef LLVMTokenTypeInContext(LLVMContextRef C)
Create a token type in a context.
Definition Core.cpp:986
unsigned LLVMGetTargetExtTypeNumIntParams(LLVMTypeRef TargetExtTy)
Obtain the number of int parameters for this target extension type.
Definition Core.cpp:1027
LLVMTypeRef LLVMLabelTypeInContext(LLVMContextRef C)
Create a label type in a context.
Definition Core.cpp:983
LLVMTypeRef LLVMMetadataTypeInContext(LLVMContextRef C)
Create a metadata type in a context.
Definition Core.cpp:989
LLVMTypeRef LLVMGetTargetExtTypeTypeParam(LLVMTypeRef TargetExtTy, unsigned Idx)
Get the type parameter at the given index for the target extension type.
Definition Core.cpp:1021
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:1000
unsigned LLVMGetTargetExtTypeIntParam(LLVMTypeRef TargetExtTy, unsigned Idx)
Get the int parameter at the given index for the target extension type.
Definition Core.cpp:1032
LLVMValueRef LLVMGetConstantPtrAuthAddrDiscriminator(LLVMValueRef PtrAuth)
Get the address discriminator value for the associated ConstantPtrAuth constant.
Definition Core.cpp:970
LLVMBool LLVMPointerTypeIsOpaque(LLVMTypeRef Ty)
Determine whether a pointer is opaque.
Definition Core.cpp:918
LLVMTypeRef LLVMPointerTypeInContext(LLVMContextRef C, unsigned AddressSpace)
Create an opaque pointer type in a context.
Definition Core.cpp:976
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:922
LLVMTypeRef LLVMGetElementType(LLVMTypeRef WrappedTy)
Obtain the element type of an array or vector type.
Definition Core.cpp:931
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:926
LLVMValueRef LLVMGetConstantPtrAuthDiscriminator(LLVMValueRef PtrAuth)
Get the discriminator value for the associated ConstantPtrAuth constant.
Definition Core.cpp:966
uint64_t LLVMGetArrayLength2(LLVMTypeRef ArrayTy)
Obtain the length of an array type.
Definition Core.cpp:946
LLVMValueRef LLVMGetConstantPtrAuthKey(LLVMValueRef PtrAuth)
Get the key value for the associated ConstantPtrAuth constant.
Definition Core.cpp:962
unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy)
Obtain the length of an array type.
Definition Core.cpp:942
LLVMValueRef LLVMGetConstantPtrAuthPointer(LLVMValueRef PtrAuth)
Get the pointer value for the associated ConstantPtrAuth constant.
Definition Core.cpp:958
unsigned LLVMGetPointerAddressSpace(LLVMTypeRef PointerTy)
Obtain the address space of a pointer type.
Definition Core.cpp:950
LLVMTypeRef LLVMArrayType2(LLVMTypeRef ElementType, uint64_t ElementCount)
Create a fixed size array type that refers to a specific type.
Definition Core.cpp:909
unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy)
Obtain the (possibly scalable) number of elements in a vector type.
Definition Core.cpp:954
LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount)
Create a fixed size array type that refers to a specific type.
Definition Core.cpp:905
void LLVMGetSubtypes(LLVMTypeRef Tp, LLVMTypeRef *Arr)
Returns type's subtypes.
Definition Core.cpp:897
LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace)
Create a pointer type that points to a defined type.
Definition Core.cpp:913
unsigned LLVMGetNumContainedTypes(LLVMTypeRef Tp)
Return the number of types in the derived type.
Definition Core.cpp:938
LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Create a new structure type in a context.
Definition Core.cpp:829
void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest)
Get the elements within a structure.
Definition Core.cpp:864
LLVMTypeRef LLVMStructGetTypeAtIndex(LLVMTypeRef StructTy, unsigned i)
Get the type of the element at a given index in the structure.
Definition Core.cpp:870
LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy)
Determine whether a structure is packed.
Definition Core.cpp:875
LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name)
Create an empty structure in a context having a specified name.
Definition Core.cpp:841
void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Set the contents of a structure type.
Definition Core.cpp:854
LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy)
Determine whether a structure is opaque.
Definition Core.cpp:879
unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy)
Get the number of elements defined inside the structure.
Definition Core.cpp:860
const char * LLVMGetStructName(LLVMTypeRef Ty)
Obtain the name of a structure.
Definition Core.cpp:846
LLVMBool LLVMIsLiteralStruct(LLVMTypeRef StructTy)
Determine whether a structure is literal.
Definition Core.cpp:883
void LLVMDumpType(LLVMTypeRef Ty)
Dump a representation of a type to stderr.
Definition Core.cpp:672
LLVMBool LLVMTypeIsSized(LLVMTypeRef Ty)
Whether the type has a known size.
Definition Core.cpp:663
LLVMContextRef LLVMGetTypeContext(LLVMTypeRef Ty)
Obtain the context to which this type instance is associated.
Definition Core.cpp:668
char * LLVMPrintTypeToString(LLVMTypeRef Ty)
Return a string representation of the type.
Definition Core.cpp:676
LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty)
Obtain the enumerated type of a Type instance.
Definition Core.cpp:613
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:3016
void LLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to after another one.
Definition Core.cpp:2998
LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn)
Obtain the first basic block in a function.
Definition Core.cpp:2914
LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C, const char *Name)
Create a new basic block without inserting it into a function.
Definition Core.cpp:2946
LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB)
Go backwards in a basic block iterator.
Definition Core.cpp:2938
LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn)
Obtain the last basic block in a function.
Definition Core.cpp:2922
LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB)
Obtain the terminator instruction for a basic block.
Definition Core.cpp:2896
const char * LLVMGetBasicBlockName(LLVMBasicBlockRef BB)
Obtain the string name of a basic block.
Definition Core.cpp:2888
void LLVMAppendExistingBasicBlock(LLVMValueRef Fn, LLVMBasicBlockRef BB)
Append the given basic block to the basic block list of the given function.
Definition Core.cpp:2959
void LLVMDeleteBasicBlock(LLVMBasicBlockRef BBRef)
Remove a basic block from a function and delete it.
Definition Core.cpp:2986
LLVMBasicBlockRef LLVMInsertBasicBlockInContext(LLVMContextRef C, LLVMBasicBlockRef BBRef, const char *Name)
Insert a basic block in a function before another basic block.
Definition Core.cpp:2974
void LLVMGetBasicBlocks(LLVMValueRef FnRef, LLVMBasicBlockRef *BasicBlocksRefs)
Obtain all of the basic blocks in a function.
Definition Core.cpp:2904
void LLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to before another one.
Definition Core.cpp:2994
LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB)
Obtain the function to which a basic block belongs.
Definition Core.cpp:2892
LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn)
Obtain the basic block that corresponds to the entry point of a function.
Definition Core.cpp:2910
LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB)
Obtain the first instruction in a basic block.
Definition Core.cpp:3008
void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder, LLVMBasicBlockRef BB)
Insert the given basic block after the insertion point of the given builder.
Definition Core.cpp:2951
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB)
Convert a basic block instance to a value type.
Definition Core.cpp:2876
LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val)
Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
Definition Core.cpp:2884
void LLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BBRef)
Remove a basic block from a function.
Definition Core.cpp:2990
LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB)
Advance a basic block iterator.
Definition Core.cpp:2930
unsigned LLVMCountBasicBlocks(LLVMValueRef FnRef)
Obtain the number of basic blocks in a function.
Definition Core.cpp:2900
LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C, LLVMValueRef FnRef, const char *Name)
Append a basic block to the end of a function.
Definition Core.cpp:2964
LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val)
Determine whether an LLVMValueRef is itself a basic block.
Definition Core.cpp:2880
LLVMValueRef LLVMConstantPtrAuth(LLVMValueRef Ptr, LLVMValueRef Key, LLVMValueRef Disc, LLVMValueRef AddrDisc)
Create a ConstantPtrAuth constant with the given values.
Definition Core.cpp:1779
LLVMValueRef LLVMGetAggregateElement(LLVMValueRef C, unsigned Idx)
Get element of a constant aggregate (struct, array or vector) at the specified index.
Definition Core.cpp:1708
LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size)
Create a ConstantVector from values.
Definition Core.cpp:1774
LLVMValueRef LLVMConstStringInContext2(LLVMContextRef C, const char *Str, size_t Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential and initialize it with a string.
Definition Core.cpp:1693
LLVMValueRef LLVMConstDataArray(LLVMTypeRef ElementTy, const char *Data, size_t SizeInBytes)
Create a ConstantDataArray from raw values.
Definition Core.cpp:1744
LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, unsigned Length)
Create a ConstantArray from values.
Definition Core.cpp:1732
LLVMBool LLVMIsConstantString(LLVMValueRef C)
Returns true if the specified constant is an array of i8.
Definition Core.cpp:1716
LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str, unsigned Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential and initialize it with a string.
Definition Core.cpp:1684
LLVMValueRef LLVMConstArray2(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, uint64_t Length)
Create a ConstantArray from values.
Definition Core.cpp:1738
const char * LLVMGetAsString(LLVMValueRef C, size_t *Length)
Get the given constant data sequential as a string.
Definition Core.cpp:1720
LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy, LLVMValueRef *ConstantVals, unsigned Count)
Create a non-anonymous ConstantStruct from values.
Definition Core.cpp:1765
const char * LLVMGetRawDataValues(LLVMValueRef C, size_t *SizeInBytes)
Get the raw, underlying bytes of the given constant data sequential.
Definition Core.cpp:1726
LLVMValueRef LLVMConstStructInContext(LLVMContextRef C, LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
Create an anonymous ConstantStruct with the specified values.
Definition Core.cpp:1751
LLVMValueRef LLVMConstAddrSpaceCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1955
LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty)
Definition Core.cpp:1846
LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1867
LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1884
LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1961
LLVMValueRef LLVMAlignOf(LLVMTypeRef Ty)
Definition Core.cpp:1842
LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1950
LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1895
LLVMValueRef LLVMConstGEPWithNoWrapFlags(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices, LLVMGEPNoWrapFlags NoWrapFlags)
Creates a constant GetElementPtr expression.
Definition Core.cpp:1923
LLVMOpcode LLVMGetConstOpcode(LLVMValueRef ConstantVal)
Definition Core.cpp:1838
LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, LLVMValueRef IndexConstant)
Definition Core.cpp:1973
LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1872
LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal)
Definition Core.cpp:1850
LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1967
LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant, LLVMValueRef ElementValueConstant, LLVMValueRef IndexConstant)
Definition Core.cpp:1979
LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1901
LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1889
LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant, LLVMValueRef VectorBConstant, LLVMValueRef MaskConstant)
Definition Core.cpp:1987
LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1935
LLVMValueRef LLVMConstGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
Definition Core.cpp:1906
LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB)
Definition Core.cpp:2005
LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal)
Definition Core.cpp:1863
LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition Core.cpp:1878
LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1940
LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition Core.cpp:1945
LLVMValueRef LLVMConstInBoundsGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
Definition Core.cpp:1914
LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString, const char *Constraints, LLVMBool HasSideEffects, LLVMBool IsAlignStack)
Deprecated: Use LLVMGetInlineAsm instead.
Definition Core.cpp:1997
LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal)
Definition Core.cpp:1854
LLVMValueRef LLVMGetBlockAddressFunction(LLVMValueRef BlockAddr)
Gets the function associated with a given BlockAddress constant value.
Definition Core.cpp:2009
LLVMBasicBlockRef LLVMGetBlockAddressBasicBlock(LLVMValueRef BlockAddr)
Gets the basic block associated with a given BlockAddress constant value.
Definition Core.cpp:2013
LLVMUnnamedAddr LLVMGetUnnamedAddress(LLVMValueRef Global)
Definition Core.cpp:2151
LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global)
Returns the "value type" of a global value.
Definition Core.cpp:2186
unsigned LLVMGetAlignment(LLVMValueRef V)
Obtain the preferred alignment of the value.
Definition Core.cpp:2192
void LLVMSetSection(LLVMValueRef Global, const char *Section)
Definition Core.cpp:2127
void LLVMSetUnnamedAddress(LLVMValueRef Global, LLVMUnnamedAddr UnnamedAddr)
Definition Core.cpp:2163
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:2267
void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage)
Definition Core.cpp:2056
void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr)
Deprecated: Use LLVMSetUnnamedAddress instead.
Definition Core.cpp:2180
LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global)
Definition Core.cpp:2019
unsigned LLVMValueMetadataEntriesGetKind(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the kind of a value metadata entry at a specific index.
Definition Core.cpp:2248
void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class)
Definition Core.cpp:2146
LLVMVisibility LLVMGetVisibility(LLVMValueRef Global)
Definition Core.cpp:2131
LLVMValueMetadataEntry * LLVMGlobalCopyAllMetadata(LLVMValueRef Value, size_t *NumEntries)
Retrieves an array of metadata entries representing the metadata attached to this value.
Definition Core.cpp:2236
void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes)
Set the preferred alignment of the value.
Definition Core.cpp:2214
const char * LLVMGetSection(LLVMValueRef Global)
Definition Core.cpp:2121
void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz)
Definition Core.cpp:2136
LLVMLinkage LLVMGetLinkage(LLVMValueRef Global)
Definition Core.cpp:2027
void LLVMGlobalEraseMetadata(LLVMValueRef Global, unsigned Kind)
Erases a metadata attachment of the given kind if it exists.
Definition Core.cpp:2277
LLVMDLLStorageClass LLVMGetDLLStorageClass(LLVMValueRef Global)
Definition Core.cpp:2141
LLVMBool LLVMIsDeclaration(LLVMValueRef Global)
Definition Core.cpp:2023
void LLVMGlobalClearMetadata(LLVMValueRef Global)
Removes all metadata attachments from this value.
Definition Core.cpp:2281
void LLVMGlobalAddMetadata(LLVMValueRef Global, unsigned Kind, LLVMMetadataRef MD)
Adds a metadata attachment.
Definition Core.cpp:2272
LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global)
Deprecated: Use LLVMGetUnnamedAddress instead.
Definition Core.cpp:2176
LLVMMetadataRef LLVMValueMetadataEntriesGetMetadata(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the underlying metadata node of a value metadata entry at a specific index.
Definition Core.cpp:2256
void LLVMDisposeValueMetadataEntries(LLVMValueMetadataEntry *Entries)
Destroys value metadata entries.
Definition Core.cpp:2263
void LLVMGlobalAddDebugInfo(LLVMValueRef Global, LLVMMetadataRef GVE)
Add debuginfo metadata to this global.
Definition Core.cpp:2285
LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N, LLVMBool SignExtend)
Obtain a constant value for an integer type.
Definition Core.cpp:1579
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:1641
LLVMValueRef LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy, unsigned NumWords, const uint64_t Words[])
Obtain a constant value for an integer of arbitrary precision.
Definition Core.cpp:1584
long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal)
Obtain the sign extended value for an integer constant value.
Definition Core.cpp:1653
unsigned long long LLVMConstByteGetZExtValue(LLVMValueRef ConstantVal)
Obtain the zero extended value for a byte constant value.
Definition Core.cpp:1657
LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text)
Obtain a constant for a floating point value parsed from a string.
Definition Core.cpp:1632
LLVMValueRef LLVMConstByteOfArbitraryPrecision(LLVMTypeRef ByteTy, unsigned NumWords, const uint64_t Words[])
Obtain a constant value for a byte of arbitrary precision.
Definition Core.cpp:1608
double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *LosesInfo)
Obtain the double value for an floating point constant value.
Definition Core.cpp:1665
LLVMValueRef LLVMConstByte(LLVMTypeRef ByteTy, unsigned long long N)
Obtain a constant value for a byte type.
Definition Core.cpp:1604
LLVMValueRef LLVMConstReal(LLVMTypeRef RealTy, double N)
Obtain a constant value referring to a double floating point value.
Definition Core.cpp:1628
long long LLVMConstByteGetSExtValue(LLVMValueRef ConstantVal)
Obtain the sign extended value for a byte constant value.
Definition Core.cpp:1661
unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal)
Obtain the zero extended value for an integer constant value.
Definition Core.cpp:1649
LLVMValueRef LLVMGetPoison(LLVMTypeRef Ty)
Obtain a constant value referring to a poison value of a type.
Definition Core.cpp:1294
LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty)
Obtain a constant that is a constant pointer pointing to NULL for a specified type.
Definition Core.cpp:1316
LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty)
Obtain a constant value referring to an undefined value of a type.
Definition Core.cpp:1290
LLVMBool LLVMIsNull(LLVMValueRef Val)
Determine whether a value instance is null.
Definition Core.cpp:1302
LLVMValueRef LLVMConstNull(LLVMTypeRef Ty)
Obtain a constant value referring to the null instance of a type.
Definition Core.cpp:1282
LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty)
Obtain a constant value referring to the instance of a type consisting of all ones.
Definition Core.cpp:1286
LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg)
Obtain the previous parameter to a function.
Definition Core.cpp:2769
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align)
Set the alignment for a function parameter.
Definition Core.cpp:2776
unsigned LLVMCountParams(LLVMValueRef FnRef)
Obtain the number of parameters in a function.
Definition Core.cpp:2724
void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs)
Obtain the parameters in a function.
Definition Core.cpp:2730
LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn)
Obtain the first parameter to a function.
Definition Core.cpp:2745
LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn)
Obtain the last parameter to a function.
Definition Core.cpp:2753
LLVMValueRef LLVMGetParam(LLVMValueRef FnRef, unsigned index)
Obtain the parameter at the specified index.
Definition Core.cpp:2736
LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg)
Obtain the next parameter to a function.
Definition Core.cpp:2761
LLVMValueRef LLVMGetParamParent(LLVMValueRef V)
Obtain the function to which this argument belongs.
Definition Core.cpp:2741
char * LLVMIntrinsicCopyOverloadedName2(LLVMModuleRef Mod, unsigned ID, LLVMTypeRef *OverloadTypes, size_t OverloadCount, size_t *NameLength)
Copies the name of an overloaded intrinsic identified by a given list of overload types.
Definition Core.cpp:2600
void LLVMAddAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Add an attribute to a function.
Definition Core.cpp:2674
LLVMValueRef LLVMGetPrefixData(LLVMValueRef Fn)
Gets the prefix data associated with a function.
Definition Core.cpp:2642
LLVMValueRef LLVMGetPrologueData(LLVMValueRef Fn)
Gets the prologue data associated with a function.
Definition Core.cpp:2658
unsigned LLVMGetIntrinsicID(LLVMValueRef Fn)
Obtain the ID number from a function instance.
Definition Core.cpp:2555
LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn)
Obtain the personality function attached to the function.
Definition Core.cpp:2546
unsigned LLVMGetAttributeCountAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx)
Definition Core.cpp:2679
LLVMBool LLVMHasPersonalityFn(LLVMValueRef Fn)
Check whether the given function has a personality function.
Definition Core.cpp:2542
void LLVMRemoveStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:2710
void LLVMSetPrefixData(LLVMValueRef Fn, LLVMValueRef prefixData)
Sets the prefix data for the function.
Definition Core.cpp:2652
const char * LLVMGetGC(LLVMValueRef Fn)
Obtain the name of the garbage collector to use during code generation.
Definition Core.cpp:2629
char * LLVMIntrinsicCopyOverloadedName(unsigned ID, LLVMTypeRef *OverloadTypes, size_t OverloadCount, size_t *NameLength)
Deprecated: Use LLVMIntrinsicCopyOverloadedName2 instead.
Definition Core.cpp:2590
void LLVMSetGC(LLVMValueRef Fn, const char *GC)
Define the garbage collector to use during code generation.
Definition Core.cpp:2634
void LLVMSetPrologueData(LLVMValueRef Fn, LLVMValueRef prologueData)
Sets the prologue data for the function.
Definition Core.cpp:2668
void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn)
Set the personality function attached to the function.
Definition Core.cpp:2550
void LLVMGetAttributesAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
Definition Core.cpp:2684
unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn)
Obtain the calling function of a function.
Definition Core.cpp:2620
LLVMBool LLVMIntrinsicIsOverloaded(unsigned ID)
Obtain if the intrinsic identified by the given ID is overloaded.
Definition Core.cpp:2615
void LLVMDeleteFunction(LLVMValueRef Fn)
Remove a function from its containing module and deletes it.
Definition Core.cpp:2538
void LLVMRemoveEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:2705
LLVMAttributeRef LLVMGetEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:2691
unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen)
Obtain the intrinsic ID number which matches the given function name.
Definition Core.cpp:2611
const char * LLVMIntrinsicGetName(unsigned ID, size_t *NameLength)
Retrieves the name of an intrinsic.
Definition Core.cpp:2575
LLVMValueRef LLVMGetIntrinsicDeclaration(LLVMModuleRef Mod, unsigned ID, LLVMTypeRef *OverloadTypes, size_t OverloadCount)
Get or insert the declaration of an intrinsic.
Definition Core.cpp:2566
LLVMBool LLVMHasPrologueData(LLVMValueRef Fn)
Check if a given function has prologue data.
Definition Core.cpp:2663
LLVMBool LLVMHasPrefixData(LLVMValueRef Fn)
Check if a given function has prefix data.
Definition Core.cpp:2647
void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC)
Set the calling convention of a function.
Definition Core.cpp:2624
LLVMTypeRef LLVMIntrinsicGetType(LLVMContextRef Ctx, unsigned ID, LLVMTypeRef *OverloadTypes, size_t OverloadCount)
Retrieves the type of an intrinsic.
Definition Core.cpp:2582
void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A, const char *V)
Add a target-dependent attribute to a function.
Definition Core.cpp:2715
LLVMAttributeRef LLVMGetStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:2698
LLVMValueRef LLVMIsAMDString(LLVMValueRef Val)
Definition Core.cpp:1206
LLVMBool LLVMIsPoison(LLVMValueRef Val)
Determine whether a value instance is poisonous.
Definition Core.cpp:1312
LLVMValueKind LLVMGetValueKind(LLVMValueRef Val)
Obtain the enumerated type of a Value instance.
Definition Core.cpp:1045
void LLVMDumpValue(LLVMValueRef Val)
Dump a representation of a value to stderr.
Definition Core.cpp:1075
const char * LLVMGetValueName(LLVMValueRef Val)
Deprecated: Use LLVMGetValueName2 instead.
Definition Core.cpp:1067
LLVMContextRef LLVMGetValueContext(LLVMValueRef Val)
Obtain the context to which this value is associated.
Definition Core.cpp:1091
void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal)
Replace all uses of a value with another one.
Definition Core.cpp:1107
const char * LLVMGetValueName2(LLVMValueRef Val, size_t *Length)
Obtain the string name of a value.
Definition Core.cpp:1057
void LLVMSetValueName(LLVMValueRef Val, const char *Name)
Deprecated: Use LLVMSetValueName2 instead.
Definition Core.cpp:1071
LLVMValueRef LLVMIsAMDNode(LLVMValueRef Val)
Definition Core.cpp:1191
char * LLVMPrintDbgRecordToString(LLVMDbgRecordRef Record)
Return a string representation of the DbgRecord.
Definition Core.cpp:1095
LLVMBool LLVMIsUndef(LLVMValueRef Val)
Determine whether a value instance is undefined.
Definition Core.cpp:1308
LLVMTypeRef LLVMTypeOf(LLVMValueRef Val)
Obtain the type of a value.
Definition Core.cpp:1041
char * LLVMPrintValueToString(LLVMValueRef Val)
Return a string representation of the value.
Definition Core.cpp:1079
LLVMValueRef LLVMIsAValueAsMetadata(LLVMValueRef Val)
Definition Core.cpp:1199
LLVMBool LLVMIsConstant(LLVMValueRef Ty)
Determine whether the specified value instance is constant.
Definition Core.cpp:1298
void LLVMSetValueName2(LLVMValueRef Val, const char *Name, size_t NameLen)
Set the string name of a value.
Definition Core.cpp:1063
LLVMValueRef LLVMGetFirstGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the first GlobalIFunc in a Module.
Definition Core.cpp:2798
LLVMValueRef LLVMGetNamedGlobalIFunc(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalIFunc value from a Module by its name.
Definition Core.cpp:2793
void LLVMRemoveGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module.
Definition Core.cpp:2842
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:2783
LLVMValueRef LLVMGetNextGlobalIFunc(LLVMValueRef IFunc)
Advance a GlobalIFunc iterator to the next GlobalIFunc.
Definition Core.cpp:2814
LLVMValueRef LLVMGetPreviousGlobalIFunc(LLVMValueRef IFunc)
Decrement a GlobalIFunc iterator to the previous GlobalIFunc.
Definition Core.cpp:2822
LLVMValueRef LLVMGetGlobalIFuncResolver(LLVMValueRef IFunc)
Retrieves the resolver function associated with this indirect function, or NULL if it doesn't not exi...
Definition Core.cpp:2830
void LLVMSetGlobalIFuncResolver(LLVMValueRef IFunc, LLVMValueRef Resolver)
Sets the resolver function associated with this indirect function.
Definition Core.cpp:2834
LLVMValueRef LLVMGetLastGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the last GlobalIFunc in a Module.
Definition Core.cpp:2806
void LLVMEraseGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module and delete it.
Definition Core.cpp:2838
LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca)
Obtain the type that is being allocated by the alloca instruction.
Definition Core.cpp:3351
void LLVMSetTailCall(LLVMValueRef Call, LLVMBool isTailCall)
Set whether a call instruction is a tail call.
Definition Core.cpp:3250
void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Definition Core.cpp:3182
unsigned LLVMGetNumOperandBundles(LLVMValueRef C)
Obtain the number of operand bundles attached to this instruction.
Definition Core.cpp:3234
void LLVMRemoveCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:3216
void LLVMRemoveCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:3221
LLVMAttributeRef LLVMGetCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
Definition Core.cpp:3202
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr)
Obtain the calling convention for a call instruction.
Definition Core.cpp:3165
LLVMBasicBlockRef LLVMGetCallBrDefaultDest(LLVMValueRef CallBr)
Get the default destination of a CallBr instruction.
Definition Core.cpp:3290
LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr)
Obtain the pointer to the function invoked by this instruction.
Definition Core.cpp:3226
void LLVMSetNormalDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the normal destination basic block.
Definition Core.cpp:3277
LLVMBool LLVMIsTailCall(LLVMValueRef Call)
Obtain whether a call instruction is a tail call.
Definition Core.cpp:3246
LLVMAttributeRef LLVMGetCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition Core.cpp:3209
unsigned LLVMGetCallBrNumIndirectDests(LLVMValueRef CallBr)
Get the number of indirect destinations of a CallBr instruction.
Definition Core.cpp:3294
void LLVMGetCallSiteAttributes(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
Definition Core.cpp:3194
LLVMBasicBlockRef LLVMGetNormalDest(LLVMValueRef Invoke)
Return the normal destination basic block.
Definition Core.cpp:3264
unsigned LLVMGetNumArgOperands(LLVMValueRef Instr)
Obtain the argument count for a call instruction.
Definition Core.cpp:3156
void LLVMSetTailCallKind(LLVMValueRef Call, LLVMTailCallKind kind)
Set the call kind of the call instruction.
Definition Core.cpp:3258
LLVMOperandBundleRef LLVMGetOperandBundleAtIndex(LLVMValueRef C, unsigned Index)
Obtain the operand bundle attached to this instruction at the given index.
Definition Core.cpp:3238
LLVMBasicBlockRef LLVMGetCallBrIndirectDest(LLVMValueRef CallBr, unsigned Idx)
Get the indirect destination of a CallBr instruction at the given index.
Definition Core.cpp:3298
LLVMTailCallKind LLVMGetTailCallKind(LLVMValueRef Call)
Obtain a tail call kind of the call instruction.
Definition Core.cpp:3254
void LLVMSetUnwindDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the unwind destination basic block.
Definition Core.cpp:3281
LLVMTypeRef LLVMGetCalledFunctionType(LLVMValueRef Instr)
Obtain the function type called by this instruction.
Definition Core.cpp:3230
LLVMBasicBlockRef LLVMGetUnwindDest(LLVMValueRef Invoke)
Return the unwind destination basic block.
Definition Core.cpp:3268
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, LLVMAttributeIndex Idx, unsigned align)
Definition Core.cpp:3174
unsigned LLVMGetCallSiteAttributeCount(LLVMValueRef C, LLVMAttributeIndex Idx)
Definition Core.cpp:3187
void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC)
Set the calling convention for a call instruction.
Definition Core.cpp:3169
LLVMGEPNoWrapFlags LLVMGEPGetNoWrapFlags(LLVMValueRef GEP)
Get the no-wrap related flags for the given GEP instruction.
Definition Core.cpp:3369
LLVMBool LLVMIsInBounds(LLVMValueRef GEP)
Check whether the given GEP operator is inbounds.
Definition Core.cpp:3357
void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds)
Set the given GEP instruction to be inbounds or not.
Definition Core.cpp:3361
LLVMTypeRef LLVMGetGEPSourceElementType(LLVMValueRef GEP)
Get the source element type of the given GEP operator.
Definition Core.cpp:3365
void LLVMGEPSetNoWrapFlags(LLVMValueRef GEP, LLVMGEPNoWrapFlags NoWrapFlags)
Set the no-wrap related flags for the given GEP instruction.
Definition Core.cpp:3374
unsigned LLVMGetNumIndices(LLVMValueRef Inst)
Obtain the number of indices.
Definition Core.cpp:3402
const unsigned * LLVMGetIndices(LLVMValueRef Inst)
Obtain the indices as an array.
Definition Core.cpp:3414
LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
Definition Core.cpp:3396
LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMValueRef.
Definition Core.cpp:3392
void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues, LLVMBasicBlockRef *IncomingBlocks, unsigned Count)
Add an incoming value to the end of a PHI list.
Definition Core.cpp:3381
unsigned LLVMCountIncoming(LLVMValueRef PhiNode)
Obtain the number of incoming basic blocks to a PHI node.
Definition Core.cpp:3388
LLVMValueRef LLVMGetCondition(LLVMValueRef Branch)
Return the condition of a branch instruction.
Definition Core.cpp:3322
LLVMBasicBlockRef LLVMGetSuccessor(LLVMValueRef Term, unsigned i)
Return the specified successor.
Definition Core.cpp:3308
void LLVMSetCondition(LLVMValueRef Branch, LLVMValueRef Cond)
Set the condition of a branch instruction.
Definition Core.cpp:3326
void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block)
Update the specified successor to point at the provided block.
Definition Core.cpp:3312
LLVMValueRef LLVMGetSwitchCaseValue(LLVMValueRef Switch, unsigned i)
Obtain the case value for a successor of a switch instruction.
Definition Core.cpp:3336
LLVMBool LLVMIsConditional(LLVMValueRef Branch)
Return if an instruction is a conditional branch.
Definition Core.cpp:3318
LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef Switch)
Obtain the default destination basic block of a switch instruction.
Definition Core.cpp:3332
void LLVMSetSwitchCaseValue(LLVMValueRef Switch, unsigned i, LLVMValueRef CaseValue)
Set the case value for a successor of a switch instruction.
Definition Core.cpp:3342
unsigned LLVMGetNumSuccessors(LLVMValueRef Term)
Return the number of successors that this terminator has.
Definition Core.cpp:3304
LLVMRealPredicate LLVMGetFCmpPredicate(LLVMValueRef Inst)
Obtain the float predicate of an instruction.
Definition Core.cpp:3066
int LLVMHasMetadata(LLVMValueRef Inst)
Determine whether an instruction has any metadata attached.
Definition Core.cpp:1111
void LLVMInstructionRemoveFromParent(LLVMValueRef Inst)
Remove an instruction.
Definition Core.cpp:3040
LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst)
Obtain the instruction that occurred before this one.
Definition Core.cpp:3032
LLVMDbgRecordRef LLVMGetPreviousDbgRecord(LLVMDbgRecordRef Rec)
Obtain the previous DbgRecord in the sequence or NULL if there are no more.
Definition Core.cpp:3117
LLVMMetadataRef LLVMDbgVariableRecordGetExpression(LLVMDbgRecordRef Rec)
Get the debug info expression of the DbgVariableRecord.
Definition Core.cpp:3152
LLVMDbgRecordRef LLVMGetFirstDbgRecord(LLVMValueRef Inst)
Obtain the first debug record attached to an instruction.
Definition Core.cpp:3089
LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst)
Obtain the code opcode for an individual instruction.
Definition Core.cpp:3072
LLVMDbgRecordRef LLVMGetNextDbgRecord(LLVMDbgRecordRef Rec)
Obtain the next DbgRecord in the sequence or NULL if there are no more.
Definition Core.cpp:3109
LLVMDbgRecordRef LLVMGetLastDbgRecord(LLVMValueRef Inst)
Obtain the last debug record attached to an instruction.
Definition Core.cpp:3099
LLVMMetadataRef LLVMDbgVariableRecordGetVariable(LLVMDbgRecordRef Rec)
Get the debug info variable of the DbgVariableRecord.
Definition Core.cpp:3148
LLVMValueRef LLVMIsATerminatorInst(LLVMValueRef Inst)
Determine whether an instruction is a terminator.
Definition Core.cpp:3084
LLVMValueRef LLVMDbgVariableRecordGetValue(LLVMDbgRecordRef Rec, unsigned OpIdx)
Get the value of the DbgVariableRecord.
Definition Core.cpp:3143
LLVMDbgRecordKind LLVMDbgRecordGetKind(LLVMDbgRecordRef Rec)
Definition Core.cpp:3129
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:1168
void LLVMDeleteInstruction(LLVMValueRef Inst)
Delete an instruction.
Definition Core.cpp:3048
LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst)
Obtain the basic block to which an instruction belongs.
Definition Core.cpp:3004
LLVMMetadataRef LLVMDbgRecordGetDebugLoc(LLVMDbgRecordRef Rec)
Get the debug location attached to the debug record.
Definition Core.cpp:3125
LLVMBool LLVMGetICmpSameSign(LLVMValueRef Inst)
Get whether or not an icmp instruction has the samesign flag.
Definition Core.cpp:3058
LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst)
Create a copy of 'this' instruction that is identical in all ways except the following:
Definition Core.cpp:3078
void LLVMInstructionEraseFromParent(LLVMValueRef Inst)
Remove and delete an instruction.
Definition Core.cpp:3044
void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef Val)
Set metadata associated with an instruction value.
Definition Core.cpp:1137
LLVMValueRef LLVMGetMetadata(LLVMValueRef Inst, unsigned KindID)
Return metadata associated with an instruction value.
Definition Core.cpp:1115
LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst)
Obtain the predicate of an instruction.
Definition Core.cpp:3052
LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst)
Obtain the instruction that occurs after the one specified.
Definition Core.cpp:3024
void LLVMSetICmpSameSign(LLVMValueRef Inst, LLVMBool SameSign)
Set the samesign flag on an icmp instruction.
Definition Core.cpp:3062
LLVMMetadataRef LLVMMDNodeInContext2(LLVMContextRef C, LLVMMetadataRef *MDs, size_t Count)
Create an MDNode value with the given array of operands.
Definition Core.cpp:1327
const char * LLVMGetMDString(LLVMValueRef V, unsigned *Length)
Obtain the underlying string from a MDString value.
Definition Core.cpp:1387
LLVMValueRef LLVMMetadataAsValue(LLVMContextRef C, LLVMMetadataRef MD)
Obtain a Metadata as a Value.
Definition Core.cpp:1374
unsigned LLVMGetMDNodeNumOperands(LLVMValueRef V)
Obtain the number of operands from an MDNode value.
Definition Core.cpp:1397
LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str, unsigned SLen)
Deprecated: Use LLVMMDStringInContext2 instead.
Definition Core.cpp:1332
LLVMMetadataRef LLVMMDStringInContext2(LLVMContextRef C, const char *Str, size_t SLen)
Create an MDString value from a given string value.
Definition Core.cpp:1322
LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals, unsigned Count)
Deprecated: Use LLVMMDNodeInContext2 instead.
Definition Core.cpp:1343
void LLVMReplaceMDNodeOperandWith(LLVMValueRef V, unsigned Index, LLVMMetadataRef Replacement)
Replace an operand at a specific index in a llvm::MDNode value.
Definition Core.cpp:1465
LLVMMetadataRef LLVMValueAsMetadata(LLVMValueRef Val)
Obtain a Value as a Metadata.
Definition Core.cpp:1378
void LLVMGetMDNodeOperands(LLVMValueRef V, LLVMValueRef *Dest)
Obtain the given MDNode's operands.
Definition Core.cpp:1452
LLVMUseRef LLVMGetOperandUse(LLVMValueRef Val, unsigned Index)
Obtain the use of an operand at a specific index in a llvm::User value.
Definition Core.cpp:1263
int LLVMGetNumOperands(LLVMValueRef Val)
Obtain the number of operands in a llvm::User value.
Definition Core.cpp:1272
void LLVMSetOperand(LLVMValueRef Val, unsigned Index, LLVMValueRef Op)
Set an operand at a specific index in a llvm::User value.
Definition Core.cpp:1268
LLVMValueRef LLVMGetOperand(LLVMValueRef Val, unsigned Index)
Obtain an operand at a specific index in a llvm::User value.
Definition Core.cpp:1249
LLVMValueRef LLVMGetUser(LLVMUseRef U)
Obtain the user value for a user.
Definition Core.cpp:1229
LLVMValueRef LLVMGetUsedValue(LLVMUseRef U)
Obtain the value this use corresponds to.
Definition Core.cpp:1233
LLVMUseRef LLVMGetNextUse(LLVMUseRef U)
Obtain the next use of a value.
Definition Core.cpp:1222
LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val)
Obtain the first use of a value.
Definition Core.cpp:1214
#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:2428
LLVMValueRef LLVMGetLastGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the last GlobalAlias in a Module.
Definition Core.cpp:2449
LLVMValueRef LLVMGetPreviousGlobalAlias(LLVMValueRef GA)
Decrement a GlobalAlias iterator to the previous GlobalAlias.
Definition Core.cpp:2465
void LLVMAliasSetAliasee(LLVMValueRef Alias, LLVMValueRef Aliasee)
Set the target value of an alias.
Definition Core.cpp:2477
LLVMValueRef LLVMGetFirstGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the first GlobalAlias in a Module.
Definition Core.cpp:2441
LLVMValueRef LLVMAliasGetAliasee(LLVMValueRef Alias)
Retrieve the target value of an alias.
Definition Core.cpp:2473
LLVMValueRef LLVMGetNamedGlobalAlias(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalAlias value from a Module by its name.
Definition Core.cpp:2436
LLVMValueRef LLVMGetNextGlobalAlias(LLVMValueRef GA)
Advance a GlobalAlias iterator to the next GlobalAlias.
Definition Core.cpp:2457
LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar)
Definition Core.cpp:2363
LLVMThreadLocalMode LLVMGetThreadLocalMode(LLVMValueRef GlobalVar)
Definition Core.cpp:2379
LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar)
Definition Core.cpp:2371
LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2339
void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal)
Definition Core.cpp:2367
LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar)
Definition Core.cpp:2418
LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M)
Definition Core.cpp:2323
LLVMValueRef LLVMGetNamedGlobalWithLength(LLVMModuleRef M, const char *Name, size_t Length)
Definition Core.cpp:2310
LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M)
Definition Core.cpp:2315
void LLVMSetThreadLocalMode(LLVMValueRef GlobalVar, LLVMThreadLocalMode Mode)
Definition Core.cpp:2396
LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2331
void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit)
Definition Core.cpp:2422
LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name)
Definition Core.cpp:2306
LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name, unsigned AddressSpace)
Definition Core.cpp:2297
void LLVMDeleteGlobal(LLVMValueRef GlobalVar)
Definition Core.cpp:2347
void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant)
Definition Core.cpp:2375
LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name)
Definition Core.cpp:2292
LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar)
Definition Core.cpp:2351
void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal)
Definition Core.cpp:2358
#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 StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
LLVM_ABI Function * getOrInsertDeclaration(Module *M, ID id, ArrayRef< Type * > OverloadTys={})
Look up the Function declaration of the intrinsic id in the Module M.
LLVM_ABI ID lookupIntrinsicID(StringRef Name)
This does the actual lookup of an intrinsic ID which matches the given function name.
LLVM_ABI bool isOverloaded(ID id)
Returns true if the intrinsic can be overloaded.
LLVM_ABI FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > OverloadTys={})
Return the function type for an intrinsic.
LLVM_ABI std::string getNameNoUnnamedTypes(ID Id, ArrayRef< Type * > OverloadTys)
Return the LLVM name for an intrinsic.
@ SingleThread
Synchronized with respect to signal handlers executing in the same thread.
Definition LLVMContext.h:55
@ System
Synchronized with respect to all concurrently executing threads.
Definition LLVMContext.h:58
@ OF_TextWithCRLF
The file should be opened in text mode and use a carriage linefeed '\r '.
Definition FileSystem.h:804
This is an optimization pass for GlobalISel generic memory operations.
@ Length
Definition DWP.cpp:573
constexpr bool llvm_is_multithreaded()
Returns true if LLVM is compiled with support for multi-threading, and false otherwise.
Definition Threading.h:52
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
LLVM_ABI void initializePrintModulePassWrapperPass(PassRegistry &)
void * PointerTy
void setAtomicSyncScopeID(Instruction *I, SyncScope::ID SSID)
A helper function that sets an atomic operation's sync scope.
auto dyn_cast_or_null(const Y &Val)
Definition Casting.h:753
LLVM_ABI LLVMContextRef getGlobalContextForCAPI()
Get the deprecated global context for use by the C API.
Definition Core.cpp:100
LLVM_ABI void initializeVerifierLegacyPassPass(PassRegistry &)
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
std::optional< SyncScope::ID > getAtomicSyncScopeID(const Instruction *I)
A helper function that returns an atomic operation's sync scope; returns std::nullopt if it is not an...
LLVM_ABI void initializeCore(PassRegistry &)
Initialize all passes linked into the Core library.
Definition Core.cpp:59
LLVM_ABI void initializeDominatorTreeWrapperPassPass(PassRegistry &)
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc(size_t Sz)
Definition MemAlloc.h:25
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
LLVM_ABI void initializePrintFunctionPassWrapperPass(PassRegistry &)
constexpr int PoisonMaskElem
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
@ Global
Append to llvm.global_dtors.
AtomicOrdering
Atomic ordering for LLVM's memory model.
constexpr T divideCeil(U Numerator, V Denominator)
Returns the integer ceil(Numerator / Denominator).
Definition MathExtras.h:394
Attribute unwrap(LLVMAttributeRef Attr)
Definition Attributes.h:397
OperandBundleDefT< Value * > OperandBundleDef
Definition AutoUpgrade.h:34
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
Definition InstrProf.h:145
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
LLVM_ABI void llvm_shutdown()
llvm_shutdown - Deallocate and destroy all ManagedStatic variables.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
LLVMAttributeRef wrap(Attribute Attr)
Definition Attributes.h:392
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Next
Definition InstrProf.h:147
LLVM_ABI void initializeSafepointIRVerifierPass(PassRegistry &)
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
Definition Error.cpp:177
#define N
LLVMModuleFlagBehavior Behavior
Definition Core.cpp:352
LLVMMetadataRef Metadata
Definition Core.cpp:355
LLVMMetadataRef Metadata
Definition Core.cpp:1145
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