LLVM 20.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/IR/Attributes.h"
16#include "llvm/IR/BasicBlock.h"
18#include "llvm/IR/Constants.h"
23#include "llvm/IR/GlobalAlias.h"
25#include "llvm/IR/IRBuilder.h"
26#include "llvm/IR/InlineAsm.h"
28#include "llvm/IR/LLVMContext.h"
30#include "llvm/IR/Module.h"
32#include "llvm/PassRegistry.h"
33#include "llvm/Support/Debug.h"
41#include <cassert>
42#include <cstdlib>
43#include <cstring>
44#include <system_error>
45
46using namespace llvm;
47
49
51 return reinterpret_cast<BasicBlock **>(BBs);
52}
53
54#define DEBUG_TYPE "ir"
55
62}
63
66}
67
68/*===-- Version query -----------------------------------------------------===*/
69
70void LLVMGetVersion(unsigned *Major, unsigned *Minor, unsigned *Patch) {
71 if (Major)
72 *Major = LLVM_VERSION_MAJOR;
73 if (Minor)
74 *Minor = LLVM_VERSION_MINOR;
75 if (Patch)
76 *Patch = LLVM_VERSION_PATCH;
77}
78
79/*===-- Error handling ----------------------------------------------------===*/
80
81char *LLVMCreateMessage(const char *Message) {
82 return strdup(Message);
83}
84
85void LLVMDisposeMessage(char *Message) {
86 free(Message);
87}
88
89
90/*===-- Operations on contexts --------------------------------------------===*/
91
93 static LLVMContext GlobalContext;
94 return GlobalContext;
95}
96
98 return wrap(new LLVMContext());
99}
100
102
104 LLVMDiagnosticHandler Handler,
105 void *DiagnosticContext) {
106 unwrap(C)->setDiagnosticHandlerCallBack(
108 Handler),
109 DiagnosticContext);
110}
111
113 return LLVM_EXTENSION reinterpret_cast<LLVMDiagnosticHandler>(
114 unwrap(C)->getDiagnosticHandlerCallBack());
115}
116
118 return unwrap(C)->getDiagnosticContext();
119}
120
122 void *OpaqueHandle) {
123 auto YieldCallback =
124 LLVM_EXTENSION reinterpret_cast<LLVMContext::YieldCallbackTy>(Callback);
125 unwrap(C)->setYieldCallback(YieldCallback, OpaqueHandle);
126}
127
129 return unwrap(C)->shouldDiscardValueNames();
130}
131
133 unwrap(C)->setDiscardValueNames(Discard);
134}
135
137 delete unwrap(C);
138}
139
141 unsigned SLen) {
142 return unwrap(C)->getMDKindID(StringRef(Name, SLen));
143}
144
145unsigned LLVMGetMDKindID(const char *Name, unsigned SLen) {
147}
148
149unsigned LLVMGetEnumAttributeKindForName(const char *Name, size_t SLen) {
151}
152
154 return Attribute::AttrKind::EndAttrKinds;
155}
156
158 uint64_t Val) {
159 auto &Ctx = *unwrap(C);
160 auto AttrKind = (Attribute::AttrKind)KindID;
161 return wrap(Attribute::get(Ctx, AttrKind, Val));
162}
163
165 return unwrap(A).getKindAsEnum();
166}
167
169 auto Attr = unwrap(A);
170 if (Attr.isEnumAttribute())
171 return 0;
172 return Attr.getValueAsInt();
173}
174
176 LLVMTypeRef type_ref) {
177 auto &Ctx = *unwrap(C);
178 auto AttrKind = (Attribute::AttrKind)KindID;
179 return wrap(Attribute::get(Ctx, AttrKind, unwrap(type_ref)));
180}
181
183 auto Attr = unwrap(A);
184 return wrap(Attr.getValueAsType());
185}
186
188 unsigned KindID,
189 unsigned NumBits,
190 const uint64_t LowerWords[],
191 const uint64_t UpperWords[]) {
192 auto &Ctx = *unwrap(C);
193 auto AttrKind = (Attribute::AttrKind)KindID;
194 unsigned NumWords = divideCeil(NumBits, 64);
195 return wrap(Attribute::get(
196 Ctx, AttrKind,
197 ConstantRange(APInt(NumBits, ArrayRef(LowerWords, NumWords)),
198 APInt(NumBits, ArrayRef(UpperWords, NumWords)))));
199}
200
202 const char *K, unsigned KLength,
203 const char *V, unsigned VLength) {
204 return wrap(Attribute::get(*unwrap(C), StringRef(K, KLength),
205 StringRef(V, VLength)));
206}
207
209 unsigned *Length) {
210 auto S = unwrap(A).getKindAsString();
211 *Length = S.size();
212 return S.data();
213}
214
216 unsigned *Length) {
217 auto S = unwrap(A).getValueAsString();
218 *Length = S.size();
219 return S.data();
220}
221
223 auto Attr = unwrap(A);
224 return Attr.isEnumAttribute() || Attr.isIntAttribute();
225}
226
228 return unwrap(A).isStringAttribute();
229}
230
232 return unwrap(A).isTypeAttribute();
233}
234
236 std::string MsgStorage;
237 raw_string_ostream Stream(MsgStorage);
239
240 unwrap(DI)->print(DP);
241 Stream.flush();
242
243 return LLVMCreateMessage(MsgStorage.c_str());
244}
245
247 LLVMDiagnosticSeverity severity;
248
249 switch(unwrap(DI)->getSeverity()) {
250 default:
251 severity = LLVMDSError;
252 break;
253 case DS_Warning:
254 severity = LLVMDSWarning;
255 break;
256 case DS_Remark:
257 severity = LLVMDSRemark;
258 break;
259 case DS_Note:
260 severity = LLVMDSNote;
261 break;
262 }
263
264 return severity;
265}
266
267/*===-- Operations on modules ---------------------------------------------===*/
268
270 return wrap(new Module(ModuleID, getGlobalContext()));
271}
272
275 return wrap(new Module(ModuleID, *unwrap(C)));
276}
277
279 delete unwrap(M);
280}
281
282const char *LLVMGetModuleIdentifier(LLVMModuleRef M, size_t *Len) {
283 auto &Str = unwrap(M)->getModuleIdentifier();
284 *Len = Str.length();
285 return Str.c_str();
286}
287
288void LLVMSetModuleIdentifier(LLVMModuleRef M, const char *Ident, size_t Len) {
289 unwrap(M)->setModuleIdentifier(StringRef(Ident, Len));
290}
291
292const char *LLVMGetSourceFileName(LLVMModuleRef M, size_t *Len) {
293 auto &Str = unwrap(M)->getSourceFileName();
294 *Len = Str.length();
295 return Str.c_str();
296}
297
298void LLVMSetSourceFileName(LLVMModuleRef M, const char *Name, size_t Len) {
299 unwrap(M)->setSourceFileName(StringRef(Name, Len));
300}
301
302/*--.. Data layout .........................................................--*/
304 return unwrap(M)->getDataLayoutStr().c_str();
305}
306
308 return LLVMGetDataLayoutStr(M);
309}
310
311void LLVMSetDataLayout(LLVMModuleRef M, const char *DataLayoutStr) {
312 unwrap(M)->setDataLayout(DataLayoutStr);
313}
314
315/*--.. Target triple .......................................................--*/
317 return unwrap(M)->getTargetTriple().c_str();
318}
319
320void LLVMSetTarget(LLVMModuleRef M, const char *Triple) {
321 unwrap(M)->setTargetTriple(Triple);
322}
323
324/*--.. Module flags ........................................................--*/
327 const char *Key;
328 size_t KeyLen;
330};
331
334 switch (Behavior) {
336 return Module::ModFlagBehavior::Error;
338 return Module::ModFlagBehavior::Warning;
340 return Module::ModFlagBehavior::Require;
342 return Module::ModFlagBehavior::Override;
344 return Module::ModFlagBehavior::Append;
346 return Module::ModFlagBehavior::AppendUnique;
347 }
348 llvm_unreachable("Unknown LLVMModuleFlagBehavior");
349}
350
353 switch (Behavior) {
354 case Module::ModFlagBehavior::Error:
356 case Module::ModFlagBehavior::Warning:
358 case Module::ModFlagBehavior::Require:
360 case Module::ModFlagBehavior::Override:
362 case Module::ModFlagBehavior::Append:
364 case Module::ModFlagBehavior::AppendUnique:
366 default:
367 llvm_unreachable("Unhandled Flag Behavior");
368 }
369}
370
373 unwrap(M)->getModuleFlagsMetadata(MFEs);
374
376 safe_malloc(MFEs.size() * sizeof(LLVMOpaqueModuleFlagEntry)));
377 for (unsigned i = 0; i < MFEs.size(); ++i) {
378 const auto &ModuleFlag = MFEs[i];
379 Result[i].Behavior = map_from_llvmModFlagBehavior(ModuleFlag.Behavior);
380 Result[i].Key = ModuleFlag.Key->getString().data();
381 Result[i].KeyLen = ModuleFlag.Key->getString().size();
382 Result[i].Metadata = wrap(ModuleFlag.Val);
383 }
384 *Len = MFEs.size();
385 return Result;
386}
387
389 free(Entries);
390}
391
394 unsigned Index) {
396 static_cast<LLVMOpaqueModuleFlagEntry>(Entries[Index]);
397 return MFE.Behavior;
398}
399
401 unsigned Index, size_t *Len) {
403 static_cast<LLVMOpaqueModuleFlagEntry>(Entries[Index]);
404 *Len = MFE.KeyLen;
405 return MFE.Key;
406}
407
409 unsigned Index) {
411 static_cast<LLVMOpaqueModuleFlagEntry>(Entries[Index]);
412 return MFE.Metadata;
413}
414
416 const char *Key, size_t KeyLen) {
417 return wrap(unwrap(M)->getModuleFlag({Key, KeyLen}));
418}
419
421 const char *Key, size_t KeyLen,
422 LLVMMetadataRef Val) {
423 unwrap(M)->addModuleFlag(map_to_llvmModFlagBehavior(Behavior),
424 {Key, KeyLen}, unwrap(Val));
425}
426
428 return unwrap(M)->IsNewDbgInfoFormat;
429}
430
432 unwrap(M)->setIsNewDbgInfoFormat(UseNewFormat);
433}
434
435/*--.. Printing modules ....................................................--*/
436
438 unwrap(M)->print(errs(), nullptr,
439 /*ShouldPreserveUseListOrder=*/false, /*IsForDebug=*/true);
440}
441
443 char **ErrorMessage) {
444 std::error_code EC;
445 raw_fd_ostream dest(Filename, EC, sys::fs::OF_TextWithCRLF);
446 if (EC) {
447 *ErrorMessage = strdup(EC.message().c_str());
448 return true;
449 }
450
451 unwrap(M)->print(dest, nullptr);
452
453 dest.close();
454
455 if (dest.has_error()) {
456 std::string E = "Error printing to file: " + dest.error().message();
457 *ErrorMessage = strdup(E.c_str());
458 return true;
459 }
460
461 return false;
462}
463
465 std::string buf;
466 raw_string_ostream os(buf);
467
468 unwrap(M)->print(os, nullptr);
469 os.flush();
470
471 return strdup(buf.c_str());
472}
473
474/*--.. Operations on inline assembler ......................................--*/
475void LLVMSetModuleInlineAsm2(LLVMModuleRef M, const char *Asm, size_t Len) {
476 unwrap(M)->setModuleInlineAsm(StringRef(Asm, Len));
477}
478
479void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm) {
480 unwrap(M)->setModuleInlineAsm(StringRef(Asm));
481}
482
483void LLVMAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm, size_t Len) {
484 unwrap(M)->appendModuleInlineAsm(StringRef(Asm, Len));
485}
486
487const char *LLVMGetModuleInlineAsm(LLVMModuleRef M, size_t *Len) {
488 auto &Str = unwrap(M)->getModuleInlineAsm();
489 *Len = Str.length();
490 return Str.c_str();
491}
492
493LLVMValueRef LLVMGetInlineAsm(LLVMTypeRef Ty, const char *AsmString,
494 size_t AsmStringSize, const char *Constraints,
495 size_t ConstraintsSize, LLVMBool HasSideEffects,
496 LLVMBool IsAlignStack,
497 LLVMInlineAsmDialect Dialect, LLVMBool CanThrow) {
499 switch (Dialect) {
502 break;
505 break;
506 }
507 return wrap(InlineAsm::get(unwrap<FunctionType>(Ty),
508 StringRef(AsmString, AsmStringSize),
509 StringRef(Constraints, ConstraintsSize),
510 HasSideEffects, IsAlignStack, AD, CanThrow));
511}
512
513const char *LLVMGetInlineAsmAsmString(LLVMValueRef InlineAsmVal, size_t *Len) {
514
515 Value *Val = unwrap<Value>(InlineAsmVal);
516 const std::string &AsmString = cast<InlineAsm>(Val)->getAsmString();
517
518 *Len = AsmString.length();
519 return AsmString.c_str();
520}
521
523 size_t *Len) {
524 Value *Val = unwrap<Value>(InlineAsmVal);
525 const std::string &ConstraintString =
526 cast<InlineAsm>(Val)->getConstraintString();
527
528 *Len = ConstraintString.length();
529 return ConstraintString.c_str();
530}
531
533
534 Value *Val = unwrap<Value>(InlineAsmVal);
535 InlineAsm::AsmDialect Dialect = cast<InlineAsm>(Val)->getDialect();
536
537 switch (Dialect) {
542 }
543
544 llvm_unreachable("Unrecognized inline assembly dialect");
546}
547
549 Value *Val = unwrap<Value>(InlineAsmVal);
550 return (LLVMTypeRef)cast<InlineAsm>(Val)->getFunctionType();
551}
552
554 Value *Val = unwrap<Value>(InlineAsmVal);
555 return cast<InlineAsm>(Val)->hasSideEffects();
556}
557
559 Value *Val = unwrap<Value>(InlineAsmVal);
560 return cast<InlineAsm>(Val)->isAlignStack();
561}
562
564 Value *Val = unwrap<Value>(InlineAsmVal);
565 return cast<InlineAsm>(Val)->canThrow();
566}
567
568/*--.. Operations on module contexts ......................................--*/
570 return wrap(&unwrap(M)->getContext());
571}
572
573
574/*===-- Operations on types -----------------------------------------------===*/
575
576/*--.. Operations on all types (mostly) ....................................--*/
577
579 switch (unwrap(Ty)->getTypeID()) {
580 case Type::VoidTyID:
581 return LLVMVoidTypeKind;
582 case Type::HalfTyID:
583 return LLVMHalfTypeKind;
584 case Type::BFloatTyID:
585 return LLVMBFloatTypeKind;
586 case Type::FloatTyID:
587 return LLVMFloatTypeKind;
588 case Type::DoubleTyID:
589 return LLVMDoubleTypeKind;
592 case Type::FP128TyID:
593 return LLVMFP128TypeKind;
596 case Type::LabelTyID:
597 return LLVMLabelTypeKind;
601 return LLVMIntegerTypeKind;
604 case Type::StructTyID:
605 return LLVMStructTypeKind;
606 case Type::ArrayTyID:
607 return LLVMArrayTypeKind;
609 return LLVMPointerTypeKind;
611 return LLVMVectorTypeKind;
613 return LLVMX86_MMXTypeKind;
615 return LLVMX86_AMXTypeKind;
616 case Type::TokenTyID:
617 return LLVMTokenTypeKind;
623 llvm_unreachable("Typed pointers are unsupported via the C API");
624 }
625 llvm_unreachable("Unhandled TypeID.");
626}
627
629{
630 return unwrap(Ty)->isSized();
631}
632
634 return wrap(&unwrap(Ty)->getContext());
635}
636
638 return unwrap(Ty)->print(errs(), /*IsForDebug=*/true);
639}
640
642 std::string buf;
643 raw_string_ostream os(buf);
644
645 if (unwrap(Ty))
646 unwrap(Ty)->print(os);
647 else
648 os << "Printing <null> Type";
649
650 os.flush();
651
652 return strdup(buf.c_str());
653}
654
655/*--.. Operations on integer types .........................................--*/
656
659}
662}
665}
668}
671}
674}
676 return wrap(IntegerType::get(*unwrap(C), NumBits));
677}
678
681}
684}
687}
690}
693}
696}
697LLVMTypeRef LLVMIntType(unsigned NumBits) {
699}
700
701unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy) {
702 return unwrap<IntegerType>(IntegerTy)->getBitWidth();
703}
704
705/*--.. Operations on real types ............................................--*/
706
709}
712}
715}
718}
721}
724}
727}
730}
733}
734
737}
740}
743}
746}
749}
752}
755}
758}
761}
762
763/*--.. Operations on function types ........................................--*/
764
766 LLVMTypeRef *ParamTypes, unsigned ParamCount,
767 LLVMBool IsVarArg) {
768 ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
769 return wrap(FunctionType::get(unwrap(ReturnType), Tys, IsVarArg != 0));
770}
771
773 return unwrap<FunctionType>(FunctionTy)->isVarArg();
774}
775
777 return wrap(unwrap<FunctionType>(FunctionTy)->getReturnType());
778}
779
780unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy) {
781 return unwrap<FunctionType>(FunctionTy)->getNumParams();
782}
783
785 FunctionType *Ty = unwrap<FunctionType>(FunctionTy);
786 for (Type *T : Ty->params())
787 *Dest++ = wrap(T);
788}
789
790/*--.. Operations on struct types ..........................................--*/
791
793 unsigned ElementCount, LLVMBool Packed) {
794 ArrayRef<Type*> Tys(unwrap(ElementTypes), ElementCount);
795 return wrap(StructType::get(*unwrap(C), Tys, Packed != 0));
796}
797
799 unsigned ElementCount, LLVMBool Packed) {
800 return LLVMStructTypeInContext(LLVMGetGlobalContext(), ElementTypes,
801 ElementCount, Packed);
802}
803
805{
806 return wrap(StructType::create(*unwrap(C), Name));
807}
808
810{
811 StructType *Type = unwrap<StructType>(Ty);
812 if (!Type->hasName())
813 return nullptr;
814 return Type->getName().data();
815}
816
817void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes,
818 unsigned ElementCount, LLVMBool Packed) {
819 ArrayRef<Type*> Tys(unwrap(ElementTypes), ElementCount);
820 unwrap<StructType>(StructTy)->setBody(Tys, Packed != 0);
821}
822
824 return unwrap<StructType>(StructTy)->getNumElements();
825}
826
828 StructType *Ty = unwrap<StructType>(StructTy);
829 for (Type *T : Ty->elements())
830 *Dest++ = wrap(T);
831}
832
834 StructType *Ty = unwrap<StructType>(StructTy);
835 return wrap(Ty->getTypeAtIndex(i));
836}
837
839 return unwrap<StructType>(StructTy)->isPacked();
840}
841
843 return unwrap<StructType>(StructTy)->isOpaque();
844}
845
847 return unwrap<StructType>(StructTy)->isLiteral();
848}
849
851 return wrap(StructType::getTypeByName(unwrap(M)->getContext(), Name));
852}
853
856}
857
858/*--.. Operations on array, pointer, and vector types (sequence types) .....--*/
859
861 int i = 0;
862 for (auto *T : unwrap(Tp)->subtypes()) {
863 Arr[i] = wrap(T);
864 i++;
865 }
866}
867
869 return wrap(ArrayType::get(unwrap(ElementType), ElementCount));
870}
871
873 return wrap(ArrayType::get(unwrap(ElementType), ElementCount));
874}
875
877 return wrap(PointerType::get(unwrap(ElementType), AddressSpace));
878}
879
881 return true;
882}
883
885 return wrap(FixedVectorType::get(unwrap(ElementType), ElementCount));
886}
887
889 unsigned ElementCount) {
890 return wrap(ScalableVectorType::get(unwrap(ElementType), ElementCount));
891}
892
894 auto *Ty = unwrap(WrappedTy);
895 if (auto *ATy = dyn_cast<ArrayType>(Ty))
896 return wrap(ATy->getElementType());
897 return wrap(cast<VectorType>(Ty)->getElementType());
898}
899
901 return unwrap(Tp)->getNumContainedTypes();
902}
903
905 return unwrap<ArrayType>(ArrayTy)->getNumElements();
906}
907
909 return unwrap<ArrayType>(ArrayTy)->getNumElements();
910}
911
913 return unwrap<PointerType>(PointerTy)->getAddressSpace();
914}
915
916unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy) {
917 return unwrap<VectorType>(VectorTy)->getElementCount().getKnownMinValue();
918}
919
921 return wrap(unwrap<ConstantPtrAuth>(PtrAuth)->getPointer());
922}
923
925 return wrap(unwrap<ConstantPtrAuth>(PtrAuth)->getKey());
926}
927
929 return wrap(unwrap<ConstantPtrAuth>(PtrAuth)->getDiscriminator());
930}
931
933 return wrap(unwrap<ConstantPtrAuth>(PtrAuth)->getAddrDiscriminator());
934}
935
936/*--.. Operations on other types ...........................................--*/
937
939 return wrap(PointerType::get(*unwrap(C), AddressSpace));
940}
941
943 return wrap(Type::getVoidTy(*unwrap(C)));
944}
946 return wrap(Type::getLabelTy(*unwrap(C)));
947}
949 return wrap(Type::getTokenTy(*unwrap(C)));
950}
952 return wrap(Type::getMetadataTy(*unwrap(C)));
953}
954
957}
960}
961
963 LLVMTypeRef *TypeParams,
964 unsigned TypeParamCount,
965 unsigned *IntParams,
966 unsigned IntParamCount) {
967 ArrayRef<Type *> TypeParamArray(unwrap(TypeParams), TypeParamCount);
968 ArrayRef<unsigned> IntParamArray(IntParams, IntParamCount);
969 return wrap(
970 TargetExtType::get(*unwrap(C), Name, TypeParamArray, IntParamArray));
971}
972
973const char *LLVMGetTargetExtTypeName(LLVMTypeRef TargetExtTy) {
974 TargetExtType *Type = unwrap<TargetExtType>(TargetExtTy);
975 return Type->getName().data();
976}
977
979 TargetExtType *Type = unwrap<TargetExtType>(TargetExtTy);
980 return Type->getNumTypeParameters();
981}
982
984 unsigned Idx) {
985 TargetExtType *Type = unwrap<TargetExtType>(TargetExtTy);
986 return wrap(Type->getTypeParameter(Idx));
987}
988
990 TargetExtType *Type = unwrap<TargetExtType>(TargetExtTy);
991 return Type->getNumIntParameters();
992}
993
994unsigned LLVMGetTargetExtTypeIntParam(LLVMTypeRef TargetExtTy, unsigned Idx) {
995 TargetExtType *Type = unwrap<TargetExtType>(TargetExtTy);
996 return Type->getIntParameter(Idx);
997}
998
999/*===-- Operations on values ----------------------------------------------===*/
1000
1001/*--.. Operations on all values ............................................--*/
1002
1004 return wrap(unwrap(Val)->getType());
1005}
1006
1008 switch(unwrap(Val)->getValueID()) {
1009#define LLVM_C_API 1
1010#define HANDLE_VALUE(Name) \
1011 case Value::Name##Val: \
1012 return LLVM##Name##ValueKind;
1013#include "llvm/IR/Value.def"
1014 default:
1016 }
1017}
1018
1019const char *LLVMGetValueName2(LLVMValueRef Val, size_t *Length) {
1020 auto *V = unwrap(Val);
1021 *Length = V->getName().size();
1022 return V->getName().data();
1023}
1024
1025void LLVMSetValueName2(LLVMValueRef Val, const char *Name, size_t NameLen) {
1026 unwrap(Val)->setName(StringRef(Name, NameLen));
1027}
1028
1030 return unwrap(Val)->getName().data();
1031}
1032
1033void LLVMSetValueName(LLVMValueRef Val, const char *Name) {
1034 unwrap(Val)->setName(Name);
1035}
1036
1038 unwrap(Val)->print(errs(), /*IsForDebug=*/true);
1039}
1040
1042 std::string buf;
1043 raw_string_ostream os(buf);
1044
1045 if (unwrap(Val))
1046 unwrap(Val)->print(os);
1047 else
1048 os << "Printing <null> Value";
1049
1050 os.flush();
1051
1052 return strdup(buf.c_str());
1053}
1054
1056 std::string buf;
1057 raw_string_ostream os(buf);
1058
1059 if (unwrap(Record))
1060 unwrap(Record)->print(os);
1061 else
1062 os << "Printing <null> DbgRecord";
1063
1064 os.flush();
1065
1066 return strdup(buf.c_str());
1067}
1068
1070 unwrap(OldVal)->replaceAllUsesWith(unwrap(NewVal));
1071}
1072
1074 return unwrap<Instruction>(Inst)->hasMetadata();
1075}
1076
1078 auto *I = unwrap<Instruction>(Inst);
1079 assert(I && "Expected instruction");
1080 if (auto *MD = I->getMetadata(KindID))
1081 return wrap(MetadataAsValue::get(I->getContext(), MD));
1082 return nullptr;
1083}
1084
1085// MetadataAsValue uses a canonical format which strips the actual MDNode for
1086// MDNode with just a single constant value, storing just a ConstantAsMetadata
1087// This undoes this canonicalization, reconstructing the MDNode.
1089 Metadata *MD = MAV->getMetadata();
1090 assert((isa<MDNode>(MD) || isa<ConstantAsMetadata>(MD)) &&
1091 "Expected a metadata node or a canonicalized constant");
1092
1093 if (MDNode *N = dyn_cast<MDNode>(MD))
1094 return N;
1095
1096 return MDNode::get(MAV->getContext(), MD);
1097}
1098
1099void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef Val) {
1100 MDNode *N = Val ? extractMDNode(unwrap<MetadataAsValue>(Val)) : nullptr;
1101
1102 unwrap<Instruction>(Inst)->setMetadata(KindID, N);
1103}
1104
1106 unsigned Kind;
1108};
1109
1112llvm_getMetadata(size_t *NumEntries,
1113 llvm::function_ref<void(MetadataEntries &)> AccessMD) {
1115 AccessMD(MVEs);
1116
1118 static_cast<LLVMOpaqueValueMetadataEntry *>(
1120 for (unsigned i = 0; i < MVEs.size(); ++i) {
1121 const auto &ModuleFlag = MVEs[i];
1122 Result[i].Kind = ModuleFlag.first;
1123 Result[i].Metadata = wrap(ModuleFlag.second);
1124 }
1125 *NumEntries = MVEs.size();
1126 return Result;
1127}
1128
1131 size_t *NumEntries) {
1132 return llvm_getMetadata(NumEntries, [&Value](MetadataEntries &Entries) {
1133 Entries.clear();
1134 unwrap<Instruction>(Value)->getAllMetadata(Entries);
1135 });
1136}
1137
1138/*--.. Conversion functions ................................................--*/
1139
1140#define LLVM_DEFINE_VALUE_CAST(name) \
1141 LLVMValueRef LLVMIsA##name(LLVMValueRef Val) { \
1142 return wrap(static_cast<Value*>(dyn_cast_or_null<name>(unwrap(Val)))); \
1143 }
1144
1146
1148 if (auto *MD = dyn_cast_or_null<MetadataAsValue>(unwrap(Val)))
1149 if (isa<MDNode>(MD->getMetadata()) ||
1150 isa<ValueAsMetadata>(MD->getMetadata()))
1151 return Val;
1152 return nullptr;
1153}
1154
1156 if (auto *MD = dyn_cast_or_null<MetadataAsValue>(unwrap(Val)))
1157 if (isa<ValueAsMetadata>(MD->getMetadata()))
1158 return Val;
1159 return nullptr;
1160}
1161
1163 if (auto *MD = dyn_cast_or_null<MetadataAsValue>(unwrap(Val)))
1164 if (isa<MDString>(MD->getMetadata()))
1165 return Val;
1166 return nullptr;
1167}
1168
1169/*--.. Operations on Uses ..................................................--*/
1171 Value *V = unwrap(Val);
1172 Value::use_iterator I = V->use_begin();
1173 if (I == V->use_end())
1174 return nullptr;
1175 return wrap(&*I);
1176}
1177
1179 Use *Next = unwrap(U)->getNext();
1180 if (Next)
1181 return wrap(Next);
1182 return nullptr;
1183}
1184
1186 return wrap(unwrap(U)->getUser());
1187}
1188
1190 return wrap(unwrap(U)->get());
1191}
1192
1193/*--.. Operations on Users .................................................--*/
1194
1196 unsigned Index) {
1197 Metadata *Op = N->getOperand(Index);
1198 if (!Op)
1199 return nullptr;
1200 if (auto *C = dyn_cast<ConstantAsMetadata>(Op))
1201 return wrap(C->getValue());
1202 return wrap(MetadataAsValue::get(Context, Op));
1203}
1204
1206 Value *V = unwrap(Val);
1207 if (auto *MD = dyn_cast<MetadataAsValue>(V)) {
1208 if (auto *L = dyn_cast<ValueAsMetadata>(MD->getMetadata())) {
1209 assert(Index == 0 && "Function-local metadata can only have one operand");
1210 return wrap(L->getValue());
1211 }
1212 return getMDNodeOperandImpl(V->getContext(),
1213 cast<MDNode>(MD->getMetadata()), Index);
1214 }
1215
1216 return wrap(cast<User>(V)->getOperand(Index));
1217}
1218
1220 Value *V = unwrap(Val);
1221 return wrap(&cast<User>(V)->getOperandUse(Index));
1222}
1223
1225 unwrap<User>(Val)->setOperand(Index, unwrap(Op));
1226}
1227
1229 Value *V = unwrap(Val);
1230 if (isa<MetadataAsValue>(V))
1231 return LLVMGetMDNodeNumOperands(Val);
1232
1233 return cast<User>(V)->getNumOperands();
1234}
1235
1236/*--.. Operations on constants of any type .................................--*/
1237
1239 return wrap(Constant::getNullValue(unwrap(Ty)));
1240}
1241
1244}
1245
1247 return wrap(UndefValue::get(unwrap(Ty)));
1248}
1249
1251 return wrap(PoisonValue::get(unwrap(Ty)));
1252}
1253
1255 return isa<Constant>(unwrap(Ty));
1256}
1257
1259 if (Constant *C = dyn_cast<Constant>(unwrap(Val)))
1260 return C->isNullValue();
1261 return false;
1262}
1263
1265 return isa<UndefValue>(unwrap(Val));
1266}
1267
1269 return isa<PoisonValue>(unwrap(Val));
1270}
1271
1273 return wrap(ConstantPointerNull::get(unwrap<PointerType>(Ty)));
1274}
1275
1276/*--.. Operations on metadata nodes ........................................--*/
1277
1279 size_t SLen) {
1280 return wrap(MDString::get(*unwrap(C), StringRef(Str, SLen)));
1281}
1282
1284 size_t Count) {
1285 return wrap(MDNode::get(*unwrap(C), ArrayRef<Metadata*>(unwrap(MDs), Count)));
1286}
1287
1289 unsigned SLen) {
1290 LLVMContext &Context = *unwrap(C);
1292 Context, MDString::get(Context, StringRef(Str, SLen))));
1293}
1294
1295LLVMValueRef LLVMMDString(const char *Str, unsigned SLen) {
1296 return LLVMMDStringInContext(LLVMGetGlobalContext(), Str, SLen);
1297}
1298
1300 unsigned Count) {
1301 LLVMContext &Context = *unwrap(C);
1303 for (auto *OV : ArrayRef(Vals, Count)) {
1304 Value *V = unwrap(OV);
1305 Metadata *MD;
1306 if (!V)
1307 MD = nullptr;
1308 else if (auto *C = dyn_cast<Constant>(V))
1310 else if (auto *MDV = dyn_cast<MetadataAsValue>(V)) {
1311 MD = MDV->getMetadata();
1312 assert(!isa<LocalAsMetadata>(MD) && "Unexpected function-local metadata "
1313 "outside of direct argument to call");
1314 } else {
1315 // This is function-local metadata. Pretend to make an MDNode.
1316 assert(Count == 1 &&
1317 "Expected only one operand to function-local metadata");
1318 return wrap(MetadataAsValue::get(Context, LocalAsMetadata::get(V)));
1319 }
1320
1321 MDs.push_back(MD);
1322 }
1323 return wrap(MetadataAsValue::get(Context, MDNode::get(Context, MDs)));
1324}
1325
1326LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count) {
1327 return LLVMMDNodeInContext(LLVMGetGlobalContext(), Vals, Count);
1328}
1329
1331 return wrap(MetadataAsValue::get(*unwrap(C), unwrap(MD)));
1332}
1333
1335 auto *V = unwrap(Val);
1336 if (auto *C = dyn_cast<Constant>(V))
1338 if (auto *MAV = dyn_cast<MetadataAsValue>(V))
1339 return wrap(MAV->getMetadata());
1340 return wrap(ValueAsMetadata::get(V));
1341}
1342
1343const char *LLVMGetMDString(LLVMValueRef V, unsigned *Length) {
1344 if (const auto *MD = dyn_cast<MetadataAsValue>(unwrap(V)))
1345 if (const MDString *S = dyn_cast<MDString>(MD->getMetadata())) {
1346 *Length = S->getString().size();
1347 return S->getString().data();
1348 }
1349 *Length = 0;
1350 return nullptr;
1351}
1352
1354 auto *MD = unwrap<MetadataAsValue>(V);
1355 if (isa<ValueAsMetadata>(MD->getMetadata()))
1356 return 1;
1357 return cast<MDNode>(MD->getMetadata())->getNumOperands();
1358}
1359
1361 Module *Mod = unwrap(M);
1363 if (I == Mod->named_metadata_end())
1364 return nullptr;
1365 return wrap(&*I);
1366}
1367
1369 Module *Mod = unwrap(M);
1371 if (I == Mod->named_metadata_begin())
1372 return nullptr;
1373 return wrap(&*--I);
1374}
1375
1377 NamedMDNode *NamedNode = unwrap(NMD);
1379 if (++I == NamedNode->getParent()->named_metadata_end())
1380 return nullptr;
1381 return wrap(&*I);
1382}
1383
1385 NamedMDNode *NamedNode = unwrap(NMD);
1387 if (I == NamedNode->getParent()->named_metadata_begin())
1388 return nullptr;
1389 return wrap(&*--I);
1390}
1391
1393 const char *Name, size_t NameLen) {
1394 return wrap(unwrap(M)->getNamedMetadata(StringRef(Name, NameLen)));
1395}
1396
1398 const char *Name, size_t NameLen) {
1399 return wrap(unwrap(M)->getOrInsertNamedMetadata({Name, NameLen}));
1400}
1401
1402const char *LLVMGetNamedMetadataName(LLVMNamedMDNodeRef NMD, size_t *NameLen) {
1403 NamedMDNode *NamedNode = unwrap(NMD);
1404 *NameLen = NamedNode->getName().size();
1405 return NamedNode->getName().data();
1406}
1407
1409 auto *MD = unwrap<MetadataAsValue>(V);
1410 if (auto *MDV = dyn_cast<ValueAsMetadata>(MD->getMetadata())) {
1411 *Dest = wrap(MDV->getValue());
1412 return;
1413 }
1414 const auto *N = cast<MDNode>(MD->getMetadata());
1415 const unsigned numOperands = N->getNumOperands();
1416 LLVMContext &Context = unwrap(V)->getContext();
1417 for (unsigned i = 0; i < numOperands; i++)
1418 Dest[i] = getMDNodeOperandImpl(Context, N, i);
1419}
1420
1422 LLVMMetadataRef Replacement) {
1423 auto *MD = cast<MetadataAsValue>(unwrap(V));
1424 auto *N = cast<MDNode>(MD->getMetadata());
1425 N->replaceOperandWith(Index, unwrap<Metadata>(Replacement));
1426}
1427
1429 if (NamedMDNode *N = unwrap(M)->getNamedMetadata(Name)) {
1430 return N->getNumOperands();
1431 }
1432 return 0;
1433}
1434
1436 LLVMValueRef *Dest) {
1437 NamedMDNode *N = unwrap(M)->getNamedMetadata(Name);
1438 if (!N)
1439 return;
1440 LLVMContext &Context = unwrap(M)->getContext();
1441 for (unsigned i=0;i<N->getNumOperands();i++)
1442 Dest[i] = wrap(MetadataAsValue::get(Context, N->getOperand(i)));
1443}
1444
1446 LLVMValueRef Val) {
1447 NamedMDNode *N = unwrap(M)->getOrInsertNamedMetadata(Name);
1448 if (!N)
1449 return;
1450 if (!Val)
1451 return;
1452 N->addOperand(extractMDNode(unwrap<MetadataAsValue>(Val)));
1453}
1454
1455const char *LLVMGetDebugLocDirectory(LLVMValueRef Val, unsigned *Length) {
1456 if (!Length) return nullptr;
1457 StringRef S;
1458 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1459 if (const auto &DL = I->getDebugLoc()) {
1460 S = DL->getDirectory();
1461 }
1462 } else if (const auto *GV = dyn_cast<GlobalVariable>(unwrap(Val))) {
1464 GV->getDebugInfo(GVEs);
1465 if (GVEs.size())
1466 if (const DIGlobalVariable *DGV = GVEs[0]->getVariable())
1467 S = DGV->getDirectory();
1468 } else if (const auto *F = dyn_cast<Function>(unwrap(Val))) {
1469 if (const DISubprogram *DSP = F->getSubprogram())
1470 S = DSP->getDirectory();
1471 } else {
1472 assert(0 && "Expected Instruction, GlobalVariable or Function");
1473 return nullptr;
1474 }
1475 *Length = S.size();
1476 return S.data();
1477}
1478
1479const char *LLVMGetDebugLocFilename(LLVMValueRef Val, unsigned *Length) {
1480 if (!Length) return nullptr;
1481 StringRef S;
1482 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1483 if (const auto &DL = I->getDebugLoc()) {
1484 S = DL->getFilename();
1485 }
1486 } else if (const auto *GV = dyn_cast<GlobalVariable>(unwrap(Val))) {
1488 GV->getDebugInfo(GVEs);
1489 if (GVEs.size())
1490 if (const DIGlobalVariable *DGV = GVEs[0]->getVariable())
1491 S = DGV->getFilename();
1492 } else if (const auto *F = dyn_cast<Function>(unwrap(Val))) {
1493 if (const DISubprogram *DSP = F->getSubprogram())
1494 S = DSP->getFilename();
1495 } else {
1496 assert(0 && "Expected Instruction, GlobalVariable or Function");
1497 return nullptr;
1498 }
1499 *Length = S.size();
1500 return S.data();
1501}
1502
1504 unsigned L = 0;
1505 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1506 if (const auto &DL = I->getDebugLoc()) {
1507 L = DL->getLine();
1508 }
1509 } else if (const auto *GV = dyn_cast<GlobalVariable>(unwrap(Val))) {
1511 GV->getDebugInfo(GVEs);
1512 if (GVEs.size())
1513 if (const DIGlobalVariable *DGV = GVEs[0]->getVariable())
1514 L = DGV->getLine();
1515 } else if (const auto *F = dyn_cast<Function>(unwrap(Val))) {
1516 if (const DISubprogram *DSP = F->getSubprogram())
1517 L = DSP->getLine();
1518 } else {
1519 assert(0 && "Expected Instruction, GlobalVariable or Function");
1520 return -1;
1521 }
1522 return L;
1523}
1524
1526 unsigned C = 0;
1527 if (const auto *I = dyn_cast<Instruction>(unwrap(Val)))
1528 if (const auto &DL = I->getDebugLoc())
1529 C = DL->getColumn();
1530 return C;
1531}
1532
1533/*--.. Operations on scalar constants ......................................--*/
1534
1535LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N,
1536 LLVMBool SignExtend) {
1537 return wrap(ConstantInt::get(unwrap<IntegerType>(IntTy), N, SignExtend != 0));
1538}
1539
1541 unsigned NumWords,
1542 const uint64_t Words[]) {
1543 IntegerType *Ty = unwrap<IntegerType>(IntTy);
1544 return wrap(ConstantInt::get(
1545 Ty->getContext(), APInt(Ty->getBitWidth(), ArrayRef(Words, NumWords))));
1546}
1547
1549 uint8_t Radix) {
1550 return wrap(ConstantInt::get(unwrap<IntegerType>(IntTy), StringRef(Str),
1551 Radix));
1552}
1553
1555 unsigned SLen, uint8_t Radix) {
1556 return wrap(ConstantInt::get(unwrap<IntegerType>(IntTy), StringRef(Str, SLen),
1557 Radix));
1558}
1559
1561 return wrap(ConstantFP::get(unwrap(RealTy), N));
1562}
1563
1565 return wrap(ConstantFP::get(unwrap(RealTy), StringRef(Text)));
1566}
1567
1569 unsigned SLen) {
1570 return wrap(ConstantFP::get(unwrap(RealTy), StringRef(Str, SLen)));
1571}
1572
1573unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal) {
1574 return unwrap<ConstantInt>(ConstantVal)->getZExtValue();
1575}
1576
1578 return unwrap<ConstantInt>(ConstantVal)->getSExtValue();
1579}
1580
1581double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *LosesInfo) {
1582 ConstantFP *cFP = unwrap<ConstantFP>(ConstantVal) ;
1583 Type *Ty = cFP->getType();
1584
1585 if (Ty->isHalfTy() || Ty->isBFloatTy() || Ty->isFloatTy() ||
1586 Ty->isDoubleTy()) {
1587 *LosesInfo = false;
1588 return cFP->getValueAPF().convertToDouble();
1589 }
1590
1591 bool APFLosesInfo;
1592 APFloat APF = cFP->getValueAPF();
1593 APF.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven, &APFLosesInfo);
1594 *LosesInfo = APFLosesInfo;
1595 return APF.convertToDouble();
1596}
1597
1598/*--.. Operations on composite constants ...................................--*/
1599
1601 unsigned Length,
1602 LLVMBool DontNullTerminate) {
1603 /* Inverted the sense of AddNull because ', 0)' is a
1604 better mnemonic for null termination than ', 1)'. */
1606 DontNullTerminate == 0));
1607}
1608
1610 size_t Length,
1611 LLVMBool DontNullTerminate) {
1612 /* Inverted the sense of AddNull because ', 0)' is a
1613 better mnemonic for null termination than ', 1)'. */
1615 DontNullTerminate == 0));
1616}
1617
1618LLVMValueRef LLVMConstString(const char *Str, unsigned Length,
1619 LLVMBool DontNullTerminate) {
1621 DontNullTerminate);
1622}
1623
1625 return wrap(unwrap<Constant>(C)->getAggregateElement(Idx));
1626}
1627
1629 return wrap(unwrap<ConstantDataSequential>(C)->getElementAsConstant(idx));
1630}
1631
1633 return unwrap<ConstantDataSequential>(C)->isString();
1634}
1635
1636const char *LLVMGetAsString(LLVMValueRef C, size_t *Length) {
1637 StringRef Str = unwrap<ConstantDataSequential>(C)->getAsString();
1638 *Length = Str.size();
1639 return Str.data();
1640}
1641
1643 LLVMValueRef *ConstantVals, unsigned Length) {
1644 ArrayRef<Constant*> V(unwrap<Constant>(ConstantVals, Length), Length);
1645 return wrap(ConstantArray::get(ArrayType::get(unwrap(ElementTy), Length), V));
1646}
1647
1649 uint64_t Length) {
1650 ArrayRef<Constant *> V(unwrap<Constant>(ConstantVals, Length), Length);
1651 return wrap(ConstantArray::get(ArrayType::get(unwrap(ElementTy), Length), V));
1652}
1653
1655 LLVMValueRef *ConstantVals,
1656 unsigned Count, LLVMBool Packed) {
1657 Constant **Elements = unwrap<Constant>(ConstantVals, Count);
1658 return wrap(ConstantStruct::getAnon(*unwrap(C), ArrayRef(Elements, Count),
1659 Packed != 0));
1660}
1661
1662LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
1663 LLVMBool Packed) {
1664 return LLVMConstStructInContext(LLVMGetGlobalContext(), ConstantVals, Count,
1665 Packed);
1666}
1667
1669 LLVMValueRef *ConstantVals,
1670 unsigned Count) {
1671 Constant **Elements = unwrap<Constant>(ConstantVals, Count);
1672 StructType *Ty = unwrap<StructType>(StructTy);
1673
1674 return wrap(ConstantStruct::get(Ty, ArrayRef(Elements, Count)));
1675}
1676
1677LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size) {
1679 ArrayRef(unwrap<Constant>(ScalarConstantVals, Size), Size)));
1680}
1681
1683 LLVMValueRef Disc, LLVMValueRef AddrDisc) {
1685 unwrap<Constant>(Ptr), unwrap<ConstantInt>(Key),
1686 unwrap<ConstantInt>(Disc), unwrap<Constant>(AddrDisc)));
1687}
1688
1689/*-- Opcode mapping */
1690
1692{
1693 switch (opcode) {
1694 default: llvm_unreachable("Unhandled Opcode.");
1695#define HANDLE_INST(num, opc, clas) case num: return LLVM##opc;
1696#include "llvm/IR/Instruction.def"
1697#undef HANDLE_INST
1698 }
1699}
1700
1702{
1703 switch (code) {
1704#define HANDLE_INST(num, opc, clas) case LLVM##opc: return num;
1705#include "llvm/IR/Instruction.def"
1706#undef HANDLE_INST
1707 }
1708 llvm_unreachable("Unhandled Opcode.");
1709}
1710
1711/*-- GEP wrap flag conversions */
1712
1714 GEPNoWrapFlags NewGEPFlags;
1715 if ((GEPFlags & LLVMGEPFlagInBounds) != 0)
1716 NewGEPFlags |= GEPNoWrapFlags::inBounds();
1717 if ((GEPFlags & LLVMGEPFlagNUSW) != 0)
1718 NewGEPFlags |= GEPNoWrapFlags::noUnsignedSignedWrap();
1719 if ((GEPFlags & LLVMGEPFlagNUW) != 0)
1720 NewGEPFlags |= GEPNoWrapFlags::noUnsignedWrap();
1721
1722 return NewGEPFlags;
1723}
1724
1726 LLVMGEPNoWrapFlags NewGEPFlags = 0;
1727 if (GEPFlags.isInBounds())
1728 NewGEPFlags |= LLVMGEPFlagInBounds;
1729 if (GEPFlags.hasNoUnsignedSignedWrap())
1730 NewGEPFlags |= LLVMGEPFlagNUSW;
1731 if (GEPFlags.hasNoUnsignedWrap())
1732 NewGEPFlags |= LLVMGEPFlagNUW;
1733
1734 return NewGEPFlags;
1735}
1736
1737/*--.. Constant expressions ................................................--*/
1738
1740 return map_to_llvmopcode(unwrap<ConstantExpr>(ConstantVal)->getOpcode());
1741}
1742
1745}
1746
1748 return wrap(ConstantExpr::getSizeOf(unwrap(Ty)));
1749}
1750
1752 return wrap(ConstantExpr::getNeg(unwrap<Constant>(ConstantVal)));
1753}
1754
1756 return wrap(ConstantExpr::getNSWNeg(unwrap<Constant>(ConstantVal)));
1757}
1758
1760 return wrap(ConstantExpr::getNeg(unwrap<Constant>(ConstantVal)));
1761}
1762
1763
1765 return wrap(ConstantExpr::getNot(unwrap<Constant>(ConstantVal)));
1766}
1767
1769 return wrap(ConstantExpr::getAdd(unwrap<Constant>(LHSConstant),
1770 unwrap<Constant>(RHSConstant)));
1771}
1772
1774 LLVMValueRef RHSConstant) {
1775 return wrap(ConstantExpr::getNSWAdd(unwrap<Constant>(LHSConstant),
1776 unwrap<Constant>(RHSConstant)));
1777}
1778
1780 LLVMValueRef RHSConstant) {
1781 return wrap(ConstantExpr::getNUWAdd(unwrap<Constant>(LHSConstant),
1782 unwrap<Constant>(RHSConstant)));
1783}
1784
1786 return wrap(ConstantExpr::getSub(unwrap<Constant>(LHSConstant),
1787 unwrap<Constant>(RHSConstant)));
1788}
1789
1791 LLVMValueRef RHSConstant) {
1792 return wrap(ConstantExpr::getNSWSub(unwrap<Constant>(LHSConstant),
1793 unwrap<Constant>(RHSConstant)));
1794}
1795
1797 LLVMValueRef RHSConstant) {
1798 return wrap(ConstantExpr::getNUWSub(unwrap<Constant>(LHSConstant),
1799 unwrap<Constant>(RHSConstant)));
1800}
1801
1803 return wrap(ConstantExpr::getMul(unwrap<Constant>(LHSConstant),
1804 unwrap<Constant>(RHSConstant)));
1805}
1806
1808 LLVMValueRef RHSConstant) {
1809 return wrap(ConstantExpr::getNSWMul(unwrap<Constant>(LHSConstant),
1810 unwrap<Constant>(RHSConstant)));
1811}
1812
1814 LLVMValueRef RHSConstant) {
1815 return wrap(ConstantExpr::getNUWMul(unwrap<Constant>(LHSConstant),
1816 unwrap<Constant>(RHSConstant)));
1817}
1818
1820 return wrap(ConstantExpr::getXor(unwrap<Constant>(LHSConstant),
1821 unwrap<Constant>(RHSConstant)));
1822}
1823
1825 LLVMValueRef *ConstantIndices, unsigned NumIndices) {
1826 ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1827 NumIndices);
1828 Constant *Val = unwrap<Constant>(ConstantVal);
1829 return wrap(ConstantExpr::getGetElementPtr(unwrap(Ty), Val, IdxList));
1830}
1831
1833 LLVMValueRef *ConstantIndices,
1834 unsigned NumIndices) {
1835 ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1836 NumIndices);
1837 Constant *Val = unwrap<Constant>(ConstantVal);
1838 return wrap(ConstantExpr::getInBoundsGetElementPtr(unwrap(Ty), Val, IdxList));
1839}
1840
1842 LLVMValueRef ConstantVal,
1843 LLVMValueRef *ConstantIndices,
1844 unsigned NumIndices,
1845 LLVMGEPNoWrapFlags NoWrapFlags) {
1846 ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1847 NumIndices);
1848 Constant *Val = unwrap<Constant>(ConstantVal);
1850 unwrap(Ty), Val, IdxList, mapFromLLVMGEPNoWrapFlags(NoWrapFlags)));
1851}
1852
1854 return wrap(ConstantExpr::getTrunc(unwrap<Constant>(ConstantVal),
1855 unwrap(ToType)));
1856}
1857
1859 return wrap(ConstantExpr::getPtrToInt(unwrap<Constant>(ConstantVal),
1860 unwrap(ToType)));
1861}
1862
1864 return wrap(ConstantExpr::getIntToPtr(unwrap<Constant>(ConstantVal),
1865 unwrap(ToType)));
1866}
1867
1869 return wrap(ConstantExpr::getBitCast(unwrap<Constant>(ConstantVal),
1870 unwrap(ToType)));
1871}
1872
1874 LLVMTypeRef ToType) {
1875 return wrap(ConstantExpr::getAddrSpaceCast(unwrap<Constant>(ConstantVal),
1876 unwrap(ToType)));
1877}
1878
1880 LLVMTypeRef ToType) {
1881 return wrap(ConstantExpr::getTruncOrBitCast(unwrap<Constant>(ConstantVal),
1882 unwrap(ToType)));
1883}
1884
1886 LLVMTypeRef ToType) {
1887 return wrap(ConstantExpr::getPointerCast(unwrap<Constant>(ConstantVal),
1888 unwrap(ToType)));
1889}
1890
1892 LLVMValueRef IndexConstant) {
1893 return wrap(ConstantExpr::getExtractElement(unwrap<Constant>(VectorConstant),
1894 unwrap<Constant>(IndexConstant)));
1895}
1896
1898 LLVMValueRef ElementValueConstant,
1899 LLVMValueRef IndexConstant) {
1900 return wrap(ConstantExpr::getInsertElement(unwrap<Constant>(VectorConstant),
1901 unwrap<Constant>(ElementValueConstant),
1902 unwrap<Constant>(IndexConstant)));
1903}
1904
1906 LLVMValueRef VectorBConstant,
1907 LLVMValueRef MaskConstant) {
1908 SmallVector<int, 16> IntMask;
1909 ShuffleVectorInst::getShuffleMask(unwrap<Constant>(MaskConstant), IntMask);
1910 return wrap(ConstantExpr::getShuffleVector(unwrap<Constant>(VectorAConstant),
1911 unwrap<Constant>(VectorBConstant),
1912 IntMask));
1913}
1914
1916 const char *Constraints,
1917 LLVMBool HasSideEffects,
1918 LLVMBool IsAlignStack) {
1919 return wrap(InlineAsm::get(dyn_cast<FunctionType>(unwrap(Ty)), AsmString,
1920 Constraints, HasSideEffects, IsAlignStack));
1921}
1922
1924 return wrap(BlockAddress::get(unwrap<Function>(F), unwrap(BB)));
1925}
1926
1928 return wrap(unwrap<BlockAddress>(BlockAddr)->getFunction());
1929}
1930
1932 return wrap(unwrap<BlockAddress>(BlockAddr)->getBasicBlock());
1933}
1934
1935/*--.. Operations on global variables, functions, and aliases (globals) ....--*/
1936
1938 return wrap(unwrap<GlobalValue>(Global)->getParent());
1939}
1940
1942 return unwrap<GlobalValue>(Global)->isDeclaration();
1943}
1944
1946 switch (unwrap<GlobalValue>(Global)->getLinkage()) {
1948 return LLVMExternalLinkage;
1956 return LLVMWeakAnyLinkage;
1958 return LLVMWeakODRLinkage;
1960 return LLVMAppendingLinkage;
1962 return LLVMInternalLinkage;
1964 return LLVMPrivateLinkage;
1968 return LLVMCommonLinkage;
1969 }
1970
1971 llvm_unreachable("Invalid GlobalValue linkage!");
1972}
1973
1975 GlobalValue *GV = unwrap<GlobalValue>(Global);
1976
1977 switch (Linkage) {
1980 break;
1983 break;
1986 break;
1989 break;
1991 LLVM_DEBUG(
1992 errs() << "LLVMSetLinkage(): LLVMLinkOnceODRAutoHideLinkage is no "
1993 "longer supported.");
1994 break;
1995 case LLVMWeakAnyLinkage:
1997 break;
1998 case LLVMWeakODRLinkage:
2000 break;
2003 break;
2006 break;
2007 case LLVMPrivateLinkage:
2009 break;
2012 break;
2015 break;
2017 LLVM_DEBUG(
2018 errs()
2019 << "LLVMSetLinkage(): LLVMDLLImportLinkage is no longer supported.");
2020 break;
2022 LLVM_DEBUG(
2023 errs()
2024 << "LLVMSetLinkage(): LLVMDLLExportLinkage is no longer supported.");
2025 break;
2028 break;
2029 case LLVMGhostLinkage:
2030 LLVM_DEBUG(
2031 errs() << "LLVMSetLinkage(): LLVMGhostLinkage is no longer supported.");
2032 break;
2033 case LLVMCommonLinkage:
2035 break;
2036 }
2037}
2038
2040 // Using .data() is safe because of how GlobalObject::setSection is
2041 // implemented.
2042 return unwrap<GlobalValue>(Global)->getSection().data();
2043}
2044
2045void LLVMSetSection(LLVMValueRef Global, const char *Section) {
2046 unwrap<GlobalObject>(Global)->setSection(Section);
2047}
2048
2050 return static_cast<LLVMVisibility>(
2051 unwrap<GlobalValue>(Global)->getVisibility());
2052}
2053
2055 unwrap<GlobalValue>(Global)
2056 ->setVisibility(static_cast<GlobalValue::VisibilityTypes>(Viz));
2057}
2058
2060 return static_cast<LLVMDLLStorageClass>(
2061 unwrap<GlobalValue>(Global)->getDLLStorageClass());
2062}
2063
2065 unwrap<GlobalValue>(Global)->setDLLStorageClass(
2066 static_cast<GlobalValue::DLLStorageClassTypes>(Class));
2067}
2068
2070 switch (unwrap<GlobalValue>(Global)->getUnnamedAddr()) {
2071 case GlobalVariable::UnnamedAddr::None:
2072 return LLVMNoUnnamedAddr;
2073 case GlobalVariable::UnnamedAddr::Local:
2074 return LLVMLocalUnnamedAddr;
2075 case GlobalVariable::UnnamedAddr::Global:
2076 return LLVMGlobalUnnamedAddr;
2077 }
2078 llvm_unreachable("Unknown UnnamedAddr kind!");
2079}
2080
2082 GlobalValue *GV = unwrap<GlobalValue>(Global);
2083
2084 switch (UnnamedAddr) {
2085 case LLVMNoUnnamedAddr:
2086 return GV->setUnnamedAddr(GlobalVariable::UnnamedAddr::None);
2088 return GV->setUnnamedAddr(GlobalVariable::UnnamedAddr::Local);
2090 return GV->setUnnamedAddr(GlobalVariable::UnnamedAddr::Global);
2091 }
2092}
2093
2095 return unwrap<GlobalValue>(Global)->hasGlobalUnnamedAddr();
2096}
2097
2099 unwrap<GlobalValue>(Global)->setUnnamedAddr(
2100 HasUnnamedAddr ? GlobalValue::UnnamedAddr::Global
2101 : GlobalValue::UnnamedAddr::None);
2102}
2103
2105 return wrap(unwrap<GlobalValue>(Global)->getValueType());
2106}
2107
2108/*--.. Operations on global variables, load and store instructions .........--*/
2109
2111 Value *P = unwrap(V);
2112 if (GlobalObject *GV = dyn_cast<GlobalObject>(P))
2113 return GV->getAlign() ? GV->getAlign()->value() : 0;
2114 if (AllocaInst *AI = dyn_cast<AllocaInst>(P))
2115 return AI->getAlign().value();
2116 if (LoadInst *LI = dyn_cast<LoadInst>(P))
2117 return LI->getAlign().value();
2118 if (StoreInst *SI = dyn_cast<StoreInst>(P))
2119 return SI->getAlign().value();
2120 if (AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(P))
2121 return RMWI->getAlign().value();
2122 if (AtomicCmpXchgInst *CXI = dyn_cast<AtomicCmpXchgInst>(P))
2123 return CXI->getAlign().value();
2124
2126 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, "
2127 "and AtomicCmpXchgInst have alignment");
2128}
2129
2130void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes) {
2131 Value *P = unwrap(V);
2132 if (GlobalObject *GV = dyn_cast<GlobalObject>(P))
2133 GV->setAlignment(MaybeAlign(Bytes));
2134 else if (AllocaInst *AI = dyn_cast<AllocaInst>(P))
2135 AI->setAlignment(Align(Bytes));
2136 else if (LoadInst *LI = dyn_cast<LoadInst>(P))
2137 LI->setAlignment(Align(Bytes));
2138 else if (StoreInst *SI = dyn_cast<StoreInst>(P))
2139 SI->setAlignment(Align(Bytes));
2140 else if (AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(P))
2141 RMWI->setAlignment(Align(Bytes));
2142 else if (AtomicCmpXchgInst *CXI = dyn_cast<AtomicCmpXchgInst>(P))
2143 CXI->setAlignment(Align(Bytes));
2144 else
2146 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, and "
2147 "and AtomicCmpXchgInst have alignment");
2148}
2149
2151 size_t *NumEntries) {
2152 return llvm_getMetadata(NumEntries, [&Value](MetadataEntries &Entries) {
2153 Entries.clear();
2154 if (Instruction *Instr = dyn_cast<Instruction>(unwrap(Value))) {
2155 Instr->getAllMetadata(Entries);
2156 } else {
2157 unwrap<GlobalObject>(Value)->getAllMetadata(Entries);
2158 }
2159 });
2160}
2161
2163 unsigned Index) {
2165 static_cast<LLVMOpaqueValueMetadataEntry>(Entries[Index]);
2166 return MVE.Kind;
2167}
2168
2171 unsigned Index) {
2173 static_cast<LLVMOpaqueValueMetadataEntry>(Entries[Index]);
2174 return MVE.Metadata;
2175}
2176
2178 free(Entries);
2179}
2180
2182 LLVMMetadataRef MD) {
2183 unwrap<GlobalObject>(Global)->setMetadata(Kind, unwrap<MDNode>(MD));
2184}
2185
2187 unwrap<GlobalObject>(Global)->eraseMetadata(Kind);
2188}
2189
2191 unwrap<GlobalObject>(Global)->clearMetadata();
2192}
2193
2194/*--.. Operations on global variables ......................................--*/
2195
2197 return wrap(new GlobalVariable(*unwrap(M), unwrap(Ty), false,
2199}
2200
2202 const char *Name,
2203 unsigned AddressSpace) {
2204 return wrap(new GlobalVariable(*unwrap(M), unwrap(Ty), false,
2206 nullptr, GlobalVariable::NotThreadLocal,
2207 AddressSpace));
2208}
2209
2211 return wrap(unwrap(M)->getNamedGlobal(Name));
2212}
2213
2215 Module *Mod = unwrap(M);
2217 if (I == Mod->global_end())
2218 return nullptr;
2219 return wrap(&*I);
2220}
2221
2223 Module *Mod = unwrap(M);
2225 if (I == Mod->global_begin())
2226 return nullptr;
2227 return wrap(&*--I);
2228}
2229
2231 GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2233 if (++I == GV->getParent()->global_end())
2234 return nullptr;
2235 return wrap(&*I);
2236}
2237
2239 GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2241 if (I == GV->getParent()->global_begin())
2242 return nullptr;
2243 return wrap(&*--I);
2244}
2245
2247 unwrap<GlobalVariable>(GlobalVar)->eraseFromParent();
2248}
2249
2251 GlobalVariable* GV = unwrap<GlobalVariable>(GlobalVar);
2252 if ( !GV->hasInitializer() )
2253 return nullptr;
2254 return wrap(GV->getInitializer());
2255}
2256
2257void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal) {
2258 unwrap<GlobalVariable>(GlobalVar)
2259 ->setInitializer(unwrap<Constant>(ConstantVal));
2260}
2261
2263 return unwrap<GlobalVariable>(GlobalVar)->isThreadLocal();
2264}
2265
2266void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal) {
2267 unwrap<GlobalVariable>(GlobalVar)->setThreadLocal(IsThreadLocal != 0);
2268}
2269
2271 return unwrap<GlobalVariable>(GlobalVar)->isConstant();
2272}
2273
2274void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant) {
2275 unwrap<GlobalVariable>(GlobalVar)->setConstant(IsConstant != 0);
2276}
2277
2279 switch (unwrap<GlobalVariable>(GlobalVar)->getThreadLocalMode()) {
2280 case GlobalVariable::NotThreadLocal:
2281 return LLVMNotThreadLocal;
2282 case GlobalVariable::GeneralDynamicTLSModel:
2284 case GlobalVariable::LocalDynamicTLSModel:
2286 case GlobalVariable::InitialExecTLSModel:
2288 case GlobalVariable::LocalExecTLSModel:
2289 return LLVMLocalExecTLSModel;
2290 }
2291
2292 llvm_unreachable("Invalid GlobalVariable thread local mode");
2293}
2294
2296 GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
2297
2298 switch (Mode) {
2299 case LLVMNotThreadLocal:
2300 GV->setThreadLocalMode(GlobalVariable::NotThreadLocal);
2301 break;
2303 GV->setThreadLocalMode(GlobalVariable::GeneralDynamicTLSModel);
2304 break;
2306 GV->setThreadLocalMode(GlobalVariable::LocalDynamicTLSModel);
2307 break;
2309 GV->setThreadLocalMode(GlobalVariable::InitialExecTLSModel);
2310 break;
2312 GV->setThreadLocalMode(GlobalVariable::LocalExecTLSModel);
2313 break;
2314 }
2315}
2316
2318 return unwrap<GlobalVariable>(GlobalVar)->isExternallyInitialized();
2319}
2320
2322 unwrap<GlobalVariable>(GlobalVar)->setExternallyInitialized(IsExtInit);
2323}
2324
2325/*--.. Operations on aliases ......................................--*/
2326
2328 unsigned AddrSpace, LLVMValueRef Aliasee,
2329 const char *Name) {
2330 return wrap(GlobalAlias::create(unwrap(ValueTy), AddrSpace,
2332 unwrap<Constant>(Aliasee), unwrap(M)));
2333}
2334
2336 const char *Name, size_t NameLen) {
2337 return wrap(unwrap(M)->getNamedAlias(StringRef(Name, NameLen)));
2338}
2339
2341 Module *Mod = unwrap(M);
2343 if (I == Mod->alias_end())
2344 return nullptr;
2345 return wrap(&*I);
2346}
2347
2349 Module *Mod = unwrap(M);
2351 if (I == Mod->alias_begin())
2352 return nullptr;
2353 return wrap(&*--I);
2354}
2355
2357 GlobalAlias *Alias = unwrap<GlobalAlias>(GA);
2359 if (++I == Alias->getParent()->alias_end())
2360 return nullptr;
2361 return wrap(&*I);
2362}
2363
2365 GlobalAlias *Alias = unwrap<GlobalAlias>(GA);
2367 if (I == Alias->getParent()->alias_begin())
2368 return nullptr;
2369 return wrap(&*--I);
2370}
2371
2373 return wrap(unwrap<GlobalAlias>(Alias)->getAliasee());
2374}
2375
2377 unwrap<GlobalAlias>(Alias)->setAliasee(unwrap<Constant>(Aliasee));
2378}
2379
2380/*--.. Operations on functions .............................................--*/
2381
2383 LLVMTypeRef FunctionTy) {
2384 return wrap(Function::Create(unwrap<FunctionType>(FunctionTy),
2386}
2387
2389 return wrap(unwrap(M)->getFunction(Name));
2390}
2391
2393 Module *Mod = unwrap(M);
2395 if (I == Mod->end())
2396 return nullptr;
2397 return wrap(&*I);
2398}
2399
2401 Module *Mod = unwrap(M);
2403 if (I == Mod->begin())
2404 return nullptr;
2405 return wrap(&*--I);
2406}
2407
2409 Function *Func = unwrap<Function>(Fn);
2410 Module::iterator I(Func);
2411 if (++I == Func->getParent()->end())
2412 return nullptr;
2413 return wrap(&*I);
2414}
2415
2417 Function *Func = unwrap<Function>(Fn);
2418 Module::iterator I(Func);
2419 if (I == Func->getParent()->begin())
2420 return nullptr;
2421 return wrap(&*--I);
2422}
2423
2425 unwrap<Function>(Fn)->eraseFromParent();
2426}
2427
2429 return unwrap<Function>(Fn)->hasPersonalityFn();
2430}
2431
2433 return wrap(unwrap<Function>(Fn)->getPersonalityFn());
2434}
2435
2437 unwrap<Function>(Fn)->setPersonalityFn(unwrap<Constant>(PersonalityFn));
2438}
2439
2441 if (Function *F = dyn_cast<Function>(unwrap(Fn)))
2442 return F->getIntrinsicID();
2443 return 0;
2444}
2445
2447 assert(ID < llvm::Intrinsic::num_intrinsics && "Intrinsic ID out of range");
2448 return llvm::Intrinsic::ID(ID);
2449}
2450
2452 unsigned ID,
2453 LLVMTypeRef *ParamTypes,
2454 size_t ParamCount) {
2455 ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
2456 auto IID = llvm_map_to_intrinsic_id(ID);
2457 return wrap(llvm::Intrinsic::getDeclaration(unwrap(Mod), IID, Tys));
2458}
2459
2460const char *LLVMIntrinsicGetName(unsigned ID, size_t *NameLength) {
2461 auto IID = llvm_map_to_intrinsic_id(ID);
2462 auto Str = llvm::Intrinsic::getName(IID);
2463 *NameLength = Str.size();
2464 return Str.data();
2465}
2466
2468 LLVMTypeRef *ParamTypes, size_t ParamCount) {
2469 auto IID = llvm_map_to_intrinsic_id(ID);
2470 ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
2471 return wrap(llvm::Intrinsic::getType(*unwrap(Ctx), IID, Tys));
2472}
2473
2475 LLVMTypeRef *ParamTypes,
2476 size_t ParamCount,
2477 size_t *NameLength) {
2478 auto IID = llvm_map_to_intrinsic_id(ID);
2479 ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
2480 auto Str = llvm::Intrinsic::getNameNoUnnamedTypes(IID, Tys);
2481 *NameLength = Str.length();
2482 return strdup(Str.c_str());
2483}
2484
2486 LLVMTypeRef *ParamTypes,
2487 size_t ParamCount,
2488 size_t *NameLength) {
2489 auto IID = llvm_map_to_intrinsic_id(ID);
2490 ArrayRef<Type *> Tys(unwrap(ParamTypes), ParamCount);
2491 auto Str = llvm::Intrinsic::getName(IID, Tys, unwrap(Mod));
2492 *NameLength = Str.length();
2493 return strdup(Str.c_str());
2494}
2495
2496unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen) {
2497 return Function::lookupIntrinsicID({Name, NameLen});
2498}
2499
2501 auto IID = llvm_map_to_intrinsic_id(ID);
2503}
2504
2506 return unwrap<Function>(Fn)->getCallingConv();
2507}
2508
2510 return unwrap<Function>(Fn)->setCallingConv(
2511 static_cast<CallingConv::ID>(CC));
2512}
2513
2514const char *LLVMGetGC(LLVMValueRef Fn) {
2515 Function *F = unwrap<Function>(Fn);
2516 return F->hasGC()? F->getGC().c_str() : nullptr;
2517}
2518
2519void LLVMSetGC(LLVMValueRef Fn, const char *GC) {
2520 Function *F = unwrap<Function>(Fn);
2521 if (GC)
2522 F->setGC(GC);
2523 else
2524 F->clearGC();
2525}
2526
2528 Function *F = unwrap<Function>(Fn);
2529 return wrap(F->getPrefixData());
2530}
2531
2533 Function *F = unwrap<Function>(Fn);
2534 return F->hasPrefixData();
2535}
2536
2538 Function *F = unwrap<Function>(Fn);
2539 Constant *prefix = unwrap<Constant>(prefixData);
2540 F->setPrefixData(prefix);
2541}
2542
2544 Function *F = unwrap<Function>(Fn);
2545 return wrap(F->getPrologueData());
2546}
2547
2549 Function *F = unwrap<Function>(Fn);
2550 return F->hasPrologueData();
2551}
2552
2554 Function *F = unwrap<Function>(Fn);
2555 Constant *prologue = unwrap<Constant>(prologueData);
2556 F->setPrologueData(prologue);
2557}
2558
2561 unwrap<Function>(F)->addAttributeAtIndex(Idx, unwrap(A));
2562}
2563
2565 auto AS = unwrap<Function>(F)->getAttributes().getAttributes(Idx);
2566 return AS.getNumAttributes();
2567}
2568
2570 LLVMAttributeRef *Attrs) {
2571 auto AS = unwrap<Function>(F)->getAttributes().getAttributes(Idx);
2572 for (auto A : AS)
2573 *Attrs++ = wrap(A);
2574}
2575
2578 unsigned KindID) {
2579 return wrap(unwrap<Function>(F)->getAttributeAtIndex(
2580 Idx, (Attribute::AttrKind)KindID));
2581}
2582
2585 const char *K, unsigned KLen) {
2586 return wrap(
2587 unwrap<Function>(F)->getAttributeAtIndex(Idx, StringRef(K, KLen)));
2588}
2589
2591 unsigned KindID) {
2592 unwrap<Function>(F)->removeAttributeAtIndex(Idx, (Attribute::AttrKind)KindID);
2593}
2594
2596 const char *K, unsigned KLen) {
2597 unwrap<Function>(F)->removeAttributeAtIndex(Idx, StringRef(K, KLen));
2598}
2599
2601 const char *V) {
2602 Function *Func = unwrap<Function>(Fn);
2603 Attribute Attr = Attribute::get(Func->getContext(), A, V);
2604 Func->addFnAttr(Attr);
2605}
2606
2607/*--.. Operations on parameters ............................................--*/
2608
2610 // This function is strictly redundant to
2611 // LLVMCountParamTypes(LLVMGlobalGetValueType(FnRef))
2612 return unwrap<Function>(FnRef)->arg_size();
2613}
2614
2615void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs) {
2616 Function *Fn = unwrap<Function>(FnRef);
2617 for (Argument &A : Fn->args())
2618 *ParamRefs++ = wrap(&A);
2619}
2620
2622 Function *Fn = unwrap<Function>(FnRef);
2623 return wrap(&Fn->arg_begin()[index]);
2624}
2625
2627 return wrap(unwrap<Argument>(V)->getParent());
2628}
2629
2631 Function *Func = unwrap<Function>(Fn);
2632 Function::arg_iterator I = Func->arg_begin();
2633 if (I == Func->arg_end())
2634 return nullptr;
2635 return wrap(&*I);
2636}
2637
2639 Function *Func = unwrap<Function>(Fn);
2640 Function::arg_iterator I = Func->arg_end();
2641 if (I == Func->arg_begin())
2642 return nullptr;
2643 return wrap(&*--I);
2644}
2645
2647 Argument *A = unwrap<Argument>(Arg);
2648 Function *Fn = A->getParent();
2649 if (A->getArgNo() + 1 >= Fn->arg_size())
2650 return nullptr;
2651 return wrap(&Fn->arg_begin()[A->getArgNo() + 1]);
2652}
2653
2655 Argument *A = unwrap<Argument>(Arg);
2656 if (A->getArgNo() == 0)
2657 return nullptr;
2658 return wrap(&A->getParent()->arg_begin()[A->getArgNo() - 1]);
2659}
2660
2661void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align) {
2662 Argument *A = unwrap<Argument>(Arg);
2663 A->addAttr(Attribute::getWithAlignment(A->getContext(), Align(align)));
2664}
2665
2666/*--.. Operations on ifuncs ................................................--*/
2667
2669 const char *Name, size_t NameLen,
2670 LLVMTypeRef Ty, unsigned AddrSpace,
2672 return wrap(GlobalIFunc::create(unwrap(Ty), AddrSpace,
2674 StringRef(Name, NameLen),
2675 unwrap<Constant>(Resolver), unwrap(M)));
2676}
2677
2679 const char *Name, size_t NameLen) {
2680 return wrap(unwrap(M)->getNamedIFunc(StringRef(Name, NameLen)));
2681}
2682
2684 Module *Mod = unwrap(M);
2686 if (I == Mod->ifunc_end())
2687 return nullptr;
2688 return wrap(&*I);
2689}
2690
2692 Module *Mod = unwrap(M);
2694 if (I == Mod->ifunc_begin())
2695 return nullptr;
2696 return wrap(&*--I);
2697}
2698
2700 GlobalIFunc *GIF = unwrap<GlobalIFunc>(IFunc);
2702 if (++I == GIF->getParent()->ifunc_end())
2703 return nullptr;
2704 return wrap(&*I);
2705}
2706
2708 GlobalIFunc *GIF = unwrap<GlobalIFunc>(IFunc);
2710 if (I == GIF->getParent()->ifunc_begin())
2711 return nullptr;
2712 return wrap(&*--I);
2713}
2714
2716 return wrap(unwrap<GlobalIFunc>(IFunc)->getResolver());
2717}
2718
2720 unwrap<GlobalIFunc>(IFunc)->setResolver(unwrap<Constant>(Resolver));
2721}
2722
2724 unwrap<GlobalIFunc>(IFunc)->eraseFromParent();
2725}
2726
2728 unwrap<GlobalIFunc>(IFunc)->removeFromParent();
2729}
2730
2731/*--.. Operations on operand bundles........................................--*/
2732
2734 LLVMValueRef *Args,
2735 unsigned NumArgs) {
2736 return wrap(new OperandBundleDef(std::string(Tag, TagLen),
2737 ArrayRef(unwrap(Args), NumArgs)));
2738}
2739
2741 delete unwrap(Bundle);
2742}
2743
2744const char *LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len) {
2745 StringRef Str = unwrap(Bundle)->getTag();
2746 *Len = Str.size();
2747 return Str.data();
2748}
2749
2751 return unwrap(Bundle)->inputs().size();
2752}
2753
2755 unsigned Index) {
2756 return wrap(unwrap(Bundle)->inputs()[Index]);
2757}
2758
2759/*--.. Operations on basic blocks ..........................................--*/
2760
2762 return wrap(static_cast<Value*>(unwrap(BB)));
2763}
2764
2766 return isa<BasicBlock>(unwrap(Val));
2767}
2768
2770 return wrap(unwrap<BasicBlock>(Val));
2771}
2772
2774 return unwrap(BB)->getName().data();
2775}
2776
2778 return wrap(unwrap(BB)->getParent());
2779}
2780
2782 return wrap(unwrap(BB)->getTerminator());
2783}
2784
2786 return unwrap<Function>(FnRef)->size();
2787}
2788
2790 Function *Fn = unwrap<Function>(FnRef);
2791 for (BasicBlock &BB : *Fn)
2792 *BasicBlocksRefs++ = wrap(&BB);
2793}
2794
2796 return wrap(&unwrap<Function>(Fn)->getEntryBlock());
2797}
2798
2800 Function *Func = unwrap<Function>(Fn);
2801 Function::iterator I = Func->begin();
2802 if (I == Func->end())
2803 return nullptr;
2804 return wrap(&*I);
2805}
2806
2808 Function *Func = unwrap<Function>(Fn);
2809 Function::iterator I = Func->end();
2810 if (I == Func->begin())
2811 return nullptr;
2812 return wrap(&*--I);
2813}
2814
2816 BasicBlock *Block = unwrap(BB);
2818 if (++I == Block->getParent()->end())
2819 return nullptr;
2820 return wrap(&*I);
2821}
2822
2824 BasicBlock *Block = unwrap(BB);
2826 if (I == Block->getParent()->begin())
2827 return nullptr;
2828 return wrap(&*--I);
2829}
2830
2832 const char *Name) {
2834}
2835
2837 LLVMBasicBlockRef BB) {
2838 BasicBlock *ToInsert = unwrap(BB);
2839 BasicBlock *CurBB = unwrap(Builder)->GetInsertBlock();
2840 assert(CurBB && "current insertion point is invalid!");
2841 CurBB->getParent()->insert(std::next(CurBB->getIterator()), ToInsert);
2842}
2843
2845 LLVMBasicBlockRef BB) {
2846 unwrap<Function>(Fn)->insert(unwrap<Function>(Fn)->end(), unwrap(BB));
2847}
2848
2850 LLVMValueRef FnRef,
2851 const char *Name) {
2852 return wrap(BasicBlock::Create(*unwrap(C), Name, unwrap<Function>(FnRef)));
2853}
2854
2857}
2858
2860 LLVMBasicBlockRef BBRef,
2861 const char *Name) {
2862 BasicBlock *BB = unwrap(BBRef);
2863 return wrap(BasicBlock::Create(*unwrap(C), Name, BB->getParent(), BB));
2864}
2865
2867 const char *Name) {
2869}
2870
2872 unwrap(BBRef)->eraseFromParent();
2873}
2874
2876 unwrap(BBRef)->removeFromParent();
2877}
2878
2880 unwrap(BB)->moveBefore(unwrap(MovePos));
2881}
2882
2884 unwrap(BB)->moveAfter(unwrap(MovePos));
2885}
2886
2887/*--.. Operations on instructions ..........................................--*/
2888
2890 return wrap(unwrap<Instruction>(Inst)->getParent());
2891}
2892
2894 BasicBlock *Block = unwrap(BB);
2895 BasicBlock::iterator I = Block->begin();
2896 if (I == Block->end())
2897 return nullptr;
2898 return wrap(&*I);
2899}
2900
2902 BasicBlock *Block = unwrap(BB);
2903 BasicBlock::iterator I = Block->end();
2904 if (I == Block->begin())
2905 return nullptr;
2906 return wrap(&*--I);
2907}
2908
2910 Instruction *Instr = unwrap<Instruction>(Inst);
2911 BasicBlock::iterator I(Instr);
2912 if (++I == Instr->getParent()->end())
2913 return nullptr;
2914 return wrap(&*I);
2915}
2916
2918 Instruction *Instr = unwrap<Instruction>(Inst);
2919 BasicBlock::iterator I(Instr);
2920 if (I == Instr->getParent()->begin())
2921 return nullptr;
2922 return wrap(&*--I);
2923}
2924
2926 unwrap<Instruction>(Inst)->removeFromParent();
2927}
2928
2930 unwrap<Instruction>(Inst)->eraseFromParent();
2931}
2932
2934 unwrap<Instruction>(Inst)->deleteValue();
2935}
2936
2938 if (ICmpInst *I = dyn_cast<ICmpInst>(unwrap(Inst)))
2939 return (LLVMIntPredicate)I->getPredicate();
2940 return (LLVMIntPredicate)0;
2941}
2942
2944 if (FCmpInst *I = dyn_cast<FCmpInst>(unwrap(Inst)))
2945 return (LLVMRealPredicate)I->getPredicate();
2946 return (LLVMRealPredicate)0;
2947}
2948
2950 if (Instruction *C = dyn_cast<Instruction>(unwrap(Inst)))
2951 return map_to_llvmopcode(C->getOpcode());
2952 return (LLVMOpcode)0;
2953}
2954
2956 if (Instruction *C = dyn_cast<Instruction>(unwrap(Inst)))
2957 return wrap(C->clone());
2958 return nullptr;
2959}
2960
2962 Instruction *I = dyn_cast<Instruction>(unwrap(Inst));
2963 return (I && I->isTerminator()) ? wrap(I) : nullptr;
2964}
2965
2967 if (FuncletPadInst *FPI = dyn_cast<FuncletPadInst>(unwrap(Instr))) {
2968 return FPI->arg_size();
2969 }
2970 return unwrap<CallBase>(Instr)->arg_size();
2971}
2972
2973/*--.. Call and invoke instructions ........................................--*/
2974
2976 return unwrap<CallBase>(Instr)->getCallingConv();
2977}
2978
2980 return unwrap<CallBase>(Instr)->setCallingConv(
2981 static_cast<CallingConv::ID>(CC));
2982}
2983
2985 unsigned align) {
2986 auto *Call = unwrap<CallBase>(Instr);
2987 Attribute AlignAttr =
2988 Attribute::getWithAlignment(Call->getContext(), Align(align));
2989 Call->addAttributeAtIndex(Idx, AlignAttr);
2990}
2991
2994 unwrap<CallBase>(C)->addAttributeAtIndex(Idx, unwrap(A));
2995}
2996
2999 auto *Call = unwrap<CallBase>(C);
3000 auto AS = Call->getAttributes().getAttributes(Idx);
3001 return AS.getNumAttributes();
3002}
3003
3005 LLVMAttributeRef *Attrs) {
3006 auto *Call = unwrap<CallBase>(C);
3007 auto AS = Call->getAttributes().getAttributes(Idx);
3008 for (auto A : AS)
3009 *Attrs++ = wrap(A);
3010}
3011
3014 unsigned KindID) {
3015 return wrap(unwrap<CallBase>(C)->getAttributeAtIndex(
3016 Idx, (Attribute::AttrKind)KindID));
3017}
3018
3021 const char *K, unsigned KLen) {
3022 return wrap(
3023 unwrap<CallBase>(C)->getAttributeAtIndex(Idx, StringRef(K, KLen)));
3024}
3025
3027 unsigned KindID) {
3028 unwrap<CallBase>(C)->removeAttributeAtIndex(Idx, (Attribute::AttrKind)KindID);
3029}
3030
3032 const char *K, unsigned KLen) {
3033 unwrap<CallBase>(C)->removeAttributeAtIndex(Idx, StringRef(K, KLen));
3034}
3035
3037 return wrap(unwrap<CallBase>(Instr)->getCalledOperand());
3038}
3039
3041 return wrap(unwrap<CallBase>(Instr)->getFunctionType());
3042}
3043
3045 return unwrap<CallBase>(C)->getNumOperandBundles();
3046}
3047
3049 unsigned Index) {
3050 return wrap(
3051 new OperandBundleDef(unwrap<CallBase>(C)->getOperandBundleAt(Index)));
3052}
3053
3054/*--.. Operations on call instructions (only) ..............................--*/
3055
3057 return unwrap<CallInst>(Call)->isTailCall();
3058}
3059
3060void LLVMSetTailCall(LLVMValueRef Call, LLVMBool isTailCall) {
3061 unwrap<CallInst>(Call)->setTailCall(isTailCall);
3062}
3063
3065 return (LLVMTailCallKind)unwrap<CallInst>(Call)->getTailCallKind();
3066}
3067
3069 unwrap<CallInst>(Call)->setTailCallKind((CallInst::TailCallKind)kind);
3070}
3071
3072/*--.. Operations on invoke instructions (only) ............................--*/
3073
3075 return wrap(unwrap<InvokeInst>(Invoke)->getNormalDest());
3076}
3077
3079 if (CleanupReturnInst *CRI = dyn_cast<CleanupReturnInst>(unwrap(Invoke))) {
3080 return wrap(CRI->getUnwindDest());
3081 } else if (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {
3082 return wrap(CSI->getUnwindDest());
3083 }
3084 return wrap(unwrap<InvokeInst>(Invoke)->getUnwindDest());
3085}
3086
3088 unwrap<InvokeInst>(Invoke)->setNormalDest(unwrap(B));
3089}
3090
3092 if (CleanupReturnInst *CRI = dyn_cast<CleanupReturnInst>(unwrap(Invoke))) {
3093 return CRI->setUnwindDest(unwrap(B));
3094 } else if (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {
3095 return CSI->setUnwindDest(unwrap(B));
3096 }
3097 unwrap<InvokeInst>(Invoke)->setUnwindDest(unwrap(B));
3098}
3099
3101 return wrap(unwrap<CallBrInst>(CallBr)->getDefaultDest());
3102}
3103
3105 return unwrap<CallBrInst>(CallBr)->getNumIndirectDests();
3106}
3107
3109 return wrap(unwrap<CallBrInst>(CallBr)->getIndirectDest(Idx));
3110}
3111
3112/*--.. Operations on terminators ...........................................--*/
3113
3115 return unwrap<Instruction>(Term)->getNumSuccessors();
3116}
3117
3119 return wrap(unwrap<Instruction>(Term)->getSuccessor(i));
3120}
3121
3123 return unwrap<Instruction>(Term)->setSuccessor(i, unwrap(block));
3124}
3125
3126/*--.. Operations on branch instructions (only) ............................--*/
3127
3129 return unwrap<BranchInst>(Branch)->isConditional();
3130}
3131
3133 return wrap(unwrap<BranchInst>(Branch)->getCondition());
3134}
3135
3137 return unwrap<BranchInst>(Branch)->setCondition(unwrap(Cond));
3138}
3139
3140/*--.. Operations on switch instructions (only) ............................--*/
3141
3143 return wrap(unwrap<SwitchInst>(Switch)->getDefaultDest());
3144}
3145
3146/*--.. Operations on alloca instructions (only) ............................--*/
3147
3149 return wrap(unwrap<AllocaInst>(Alloca)->getAllocatedType());
3150}
3151
3152/*--.. Operations on gep instructions (only) ...............................--*/
3153
3155 return unwrap<GEPOperator>(GEP)->isInBounds();
3156}
3157
3159 return unwrap<GetElementPtrInst>(GEP)->setIsInBounds(InBounds);
3160}
3161
3163 return wrap(unwrap<GEPOperator>(GEP)->getSourceElementType());
3164}
3165
3167 GEPOperator *GEPOp = unwrap<GEPOperator>(GEP);
3168 return mapToLLVMGEPNoWrapFlags(GEPOp->getNoWrapFlags());
3169}
3170
3172 GetElementPtrInst *GEPInst = unwrap<GetElementPtrInst>(GEP);
3173 GEPInst->setNoWrapFlags(mapFromLLVMGEPNoWrapFlags(NoWrapFlags));
3174}
3175
3176/*--.. Operations on phi nodes .............................................--*/
3177
3178void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
3179 LLVMBasicBlockRef *IncomingBlocks, unsigned Count) {
3180 PHINode *PhiVal = unwrap<PHINode>(PhiNode);
3181 for (unsigned I = 0; I != Count; ++I)
3182 PhiVal->addIncoming(unwrap(IncomingValues[I]), unwrap(IncomingBlocks[I]));
3183}
3184
3186 return unwrap<PHINode>(PhiNode)->getNumIncomingValues();
3187}
3188
3190 return wrap(unwrap<PHINode>(PhiNode)->getIncomingValue(Index));
3191}
3192
3194 return wrap(unwrap<PHINode>(PhiNode)->getIncomingBlock(Index));
3195}
3196
3197/*--.. Operations on extractvalue and insertvalue nodes ....................--*/
3198
3200 auto *I = unwrap(Inst);
3201 if (auto *GEP = dyn_cast<GEPOperator>(I))
3202 return GEP->getNumIndices();
3203 if (auto *EV = dyn_cast<ExtractValueInst>(I))
3204 return EV->getNumIndices();
3205 if (auto *IV = dyn_cast<InsertValueInst>(I))
3206 return IV->getNumIndices();
3208 "LLVMGetNumIndices applies only to extractvalue and insertvalue!");
3209}
3210
3211const unsigned *LLVMGetIndices(LLVMValueRef Inst) {
3212 auto *I = unwrap(Inst);
3213 if (auto *EV = dyn_cast<ExtractValueInst>(I))
3214 return EV->getIndices().data();
3215 if (auto *IV = dyn_cast<InsertValueInst>(I))
3216 return IV->getIndices().data();
3218 "LLVMGetIndices applies only to extractvalue and insertvalue!");
3219}
3220
3221
3222/*===-- Instruction builders ----------------------------------------------===*/
3223
3225 return wrap(new IRBuilder<>(*unwrap(C)));
3226}
3227
3230}
3231
3233 Instruction *Instr, bool BeforeDbgRecords) {
3234 BasicBlock::iterator I = Instr ? Instr->getIterator() : Block->end();
3235 I.setHeadBit(BeforeDbgRecords);
3236 Builder->SetInsertPoint(Block, I);
3237}
3238
3240 LLVMValueRef Instr) {
3241 return LLVMPositionBuilderImpl(unwrap(Builder), unwrap(Block),
3242 unwrap<Instruction>(Instr), false);
3243}
3244
3247 LLVMValueRef Instr) {
3248 return LLVMPositionBuilderImpl(unwrap(Builder), unwrap(Block),
3249 unwrap<Instruction>(Instr), true);
3250}
3251
3253 Instruction *I = unwrap<Instruction>(Instr);
3254 return LLVMPositionBuilderImpl(unwrap(Builder), I->getParent(), I, false);
3255}
3256
3258 LLVMValueRef Instr) {
3259 Instruction *I = unwrap<Instruction>(Instr);
3260 return LLVMPositionBuilderImpl(unwrap(Builder), I->getParent(), I, true);
3261}
3262
3264 BasicBlock *BB = unwrap(Block);
3265 unwrap(Builder)->SetInsertPoint(BB);
3266}
3267
3269 return wrap(unwrap(Builder)->GetInsertBlock());
3270}
3271
3273 unwrap(Builder)->ClearInsertionPoint();
3274}
3275
3277 unwrap(Builder)->Insert(unwrap<Instruction>(Instr));
3278}
3279
3281 const char *Name) {
3282 unwrap(Builder)->Insert(unwrap<Instruction>(Instr), Name);
3283}
3284
3286 delete unwrap(Builder);
3287}
3288
3289/*--.. Metadata builders ...................................................--*/
3290
3292 return wrap(unwrap(Builder)->getCurrentDebugLocation().getAsMDNode());
3293}
3294
3296 if (Loc)
3297 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(unwrap<MDNode>(Loc)));
3298 else
3299 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc());
3300}
3301
3303 MDNode *Loc =
3304 L ? cast<MDNode>(unwrap<MetadataAsValue>(L)->getMetadata()) : nullptr;
3305 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(Loc));
3306}
3307
3309 LLVMContext &Context = unwrap(Builder)->getContext();
3311 Context, unwrap(Builder)->getCurrentDebugLocation().getAsMDNode()));
3312}
3313
3315 unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
3316}
3317
3319 unwrap(Builder)->AddMetadataToInst(unwrap<Instruction>(Inst));
3320}
3321
3323 LLVMMetadataRef FPMathTag) {
3324
3325 unwrap(Builder)->setDefaultFPMathTag(FPMathTag
3326 ? unwrap<MDNode>(FPMathTag)
3327 : nullptr);
3328}
3329
3331 return wrap(unwrap(Builder)->getDefaultFPMathTag());
3332}
3333
3334/*--.. Instruction builders ................................................--*/
3335
3337 return wrap(unwrap(B)->CreateRetVoid());
3338}
3339
3341 return wrap(unwrap(B)->CreateRet(unwrap(V)));
3342}
3343
3345 unsigned N) {
3346 return wrap(unwrap(B)->CreateAggregateRet(unwrap(RetVals), N));
3347}
3348
3350 return wrap(unwrap(B)->CreateBr(unwrap(Dest)));
3351}
3352
3355 return wrap(unwrap(B)->CreateCondBr(unwrap(If), unwrap(Then), unwrap(Else)));
3356}
3357
3359 LLVMBasicBlockRef Else, unsigned NumCases) {
3360 return wrap(unwrap(B)->CreateSwitch(unwrap(V), unwrap(Else), NumCases));
3361}
3362
3364 unsigned NumDests) {
3365 return wrap(unwrap(B)->CreateIndirectBr(unwrap(Addr), NumDests));
3366}
3367
3369 LLVMBasicBlockRef DefaultDest,
3370 LLVMBasicBlockRef *IndirectDests,
3371 unsigned NumIndirectDests, LLVMValueRef *Args,
3372 unsigned NumArgs, LLVMOperandBundleRef *Bundles,
3373 unsigned NumBundles, const char *Name) {
3374
3376 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
3377 OperandBundleDef *OB = unwrap(Bundle);
3378 OBs.push_back(*OB);
3379 }
3380
3381 return wrap(unwrap(B)->CreateCallBr(
3382 unwrap<FunctionType>(Ty), unwrap(Fn), unwrap(DefaultDest),
3383 ArrayRef(unwrap(IndirectDests), NumIndirectDests),
3384 ArrayRef<Value *>(unwrap(Args), NumArgs), OBs, Name));
3385}
3386
3388 LLVMValueRef *Args, unsigned NumArgs,
3390 const char *Name) {
3391 return wrap(unwrap(B)->CreateInvoke(unwrap<FunctionType>(Ty), unwrap(Fn),
3392 unwrap(Then), unwrap(Catch),
3393 ArrayRef(unwrap(Args), NumArgs), Name));
3394}
3395
3398 unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
3399 LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name) {
3401 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
3402 OperandBundleDef *OB = unwrap(Bundle);
3403 OBs.push_back(*OB);
3404 }
3405 return wrap(unwrap(B)->CreateInvoke(
3406 unwrap<FunctionType>(Ty), unwrap(Fn), unwrap(Then), unwrap(Catch),
3407 ArrayRef(unwrap(Args), NumArgs), OBs, Name));
3408}
3409
3411 LLVMValueRef PersFn, unsigned NumClauses,
3412 const char *Name) {
3413 // The personality used to live on the landingpad instruction, but now it
3414 // lives on the parent function. For compatibility, take the provided
3415 // personality and put it on the parent function.
3416 if (PersFn)
3417 unwrap(B)->GetInsertBlock()->getParent()->setPersonalityFn(
3418 unwrap<Function>(PersFn));
3419 return wrap(unwrap(B)->CreateLandingPad(unwrap(Ty), NumClauses, Name));
3420}
3421
3423 LLVMValueRef *Args, unsigned NumArgs,
3424 const char *Name) {
3425 return wrap(unwrap(B)->CreateCatchPad(unwrap(ParentPad),
3426 ArrayRef(unwrap(Args), NumArgs), Name));
3427}
3428
3430 LLVMValueRef *Args, unsigned NumArgs,
3431 const char *Name) {
3432 if (ParentPad == nullptr) {
3433 Type *Ty = Type::getTokenTy(unwrap(B)->getContext());
3434 ParentPad = wrap(Constant::getNullValue(Ty));
3435 }
3436 return wrap(unwrap(B)->CreateCleanupPad(
3437 unwrap(ParentPad), ArrayRef(unwrap(Args), NumArgs), Name));
3438}
3439
3441 return wrap(unwrap(B)->CreateResume(unwrap(Exn)));
3442}
3443
3445 LLVMBasicBlockRef UnwindBB,
3446 unsigned NumHandlers, const char *Name) {
3447 if (ParentPad == nullptr) {
3448 Type *Ty = Type::getTokenTy(unwrap(B)->getContext());
3449 ParentPad = wrap(Constant::getNullValue(Ty));
3450 }
3451 return wrap(unwrap(B)->CreateCatchSwitch(unwrap(ParentPad), unwrap(UnwindBB),
3452 NumHandlers, Name));
3453}
3454
3456 LLVMBasicBlockRef BB) {
3457 return wrap(unwrap(B)->CreateCatchRet(unwrap<CatchPadInst>(CatchPad),
3458 unwrap(BB)));
3459}
3460
3462 LLVMBasicBlockRef BB) {
3463 return wrap(unwrap(B)->CreateCleanupRet(unwrap<CleanupPadInst>(CatchPad),
3464 unwrap(BB)));
3465}
3466
3468 return wrap(unwrap(B)->CreateUnreachable());
3469}
3470
3472 LLVMBasicBlockRef Dest) {
3473 unwrap<SwitchInst>(Switch)->addCase(unwrap<ConstantInt>(OnVal), unwrap(Dest));
3474}
3475
3477 unwrap<IndirectBrInst>(IndirectBr)->addDestination(unwrap(Dest));
3478}
3479
3480unsigned LLVMGetNumClauses(LLVMValueRef LandingPad) {
3481 return unwrap<LandingPadInst>(LandingPad)->getNumClauses();
3482}
3483
3485 return wrap(unwrap<LandingPadInst>(LandingPad)->getClause(Idx));
3486}
3487
3489 unwrap<LandingPadInst>(LandingPad)->addClause(unwrap<Constant>(ClauseVal));
3490}
3491
3493 return unwrap<LandingPadInst>(LandingPad)->isCleanup();
3494}
3495
3496void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val) {
3497 unwrap<LandingPadInst>(LandingPad)->setCleanup(Val);
3498}
3499
3501 unwrap<CatchSwitchInst>(CatchSwitch)->addHandler(unwrap(Dest));
3502}
3503
3504unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch) {
3505 return unwrap<CatchSwitchInst>(CatchSwitch)->getNumHandlers();
3506}
3507
3508void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers) {
3509 CatchSwitchInst *CSI = unwrap<CatchSwitchInst>(CatchSwitch);
3510 for (const BasicBlock *H : CSI->handlers())
3511 *Handlers++ = wrap(H);
3512}
3513
3515 return wrap(unwrap<CatchPadInst>(CatchPad)->getCatchSwitch());
3516}
3517
3519 unwrap<CatchPadInst>(CatchPad)
3520 ->setCatchSwitch(unwrap<CatchSwitchInst>(CatchSwitch));
3521}
3522
3523/*--.. Funclets ...........................................................--*/
3524
3526 return wrap(unwrap<FuncletPadInst>(Funclet)->getArgOperand(i));
3527}
3528
3530 unwrap<FuncletPadInst>(Funclet)->setArgOperand(i, unwrap(value));
3531}
3532
3533/*--.. Arithmetic ..........................................................--*/
3534
3536 FastMathFlags NewFMF;
3537 NewFMF.setAllowReassoc((FMF & LLVMFastMathAllowReassoc) != 0);
3538 NewFMF.setNoNaNs((FMF & LLVMFastMathNoNaNs) != 0);
3539 NewFMF.setNoInfs((FMF & LLVMFastMathNoInfs) != 0);
3540 NewFMF.setNoSignedZeros((FMF & LLVMFastMathNoSignedZeros) != 0);
3542 NewFMF.setAllowContract((FMF & LLVMFastMathAllowContract) != 0);
3543 NewFMF.setApproxFunc((FMF & LLVMFastMathApproxFunc) != 0);
3544
3545 return NewFMF;
3546}
3547
3550 if (FMF.allowReassoc())
3551 NewFMF |= LLVMFastMathAllowReassoc;
3552 if (FMF.noNaNs())
3553 NewFMF |= LLVMFastMathNoNaNs;
3554 if (FMF.noInfs())
3555 NewFMF |= LLVMFastMathNoInfs;
3556 if (FMF.noSignedZeros())
3557 NewFMF |= LLVMFastMathNoSignedZeros;
3558 if (FMF.allowReciprocal())
3560 if (FMF.allowContract())
3561 NewFMF |= LLVMFastMathAllowContract;
3562 if (FMF.approxFunc())
3563 NewFMF |= LLVMFastMathApproxFunc;
3564
3565 return NewFMF;
3566}
3567
3569 const char *Name) {
3570 return wrap(unwrap(B)->CreateAdd(unwrap(LHS), unwrap(RHS), Name));
3571}
3572
3574 const char *Name) {
3575 return wrap(unwrap(B)->CreateNSWAdd(unwrap(LHS), unwrap(RHS), Name));
3576}
3577
3579 const char *Name) {
3580 return wrap(unwrap(B)->CreateNUWAdd(unwrap(LHS), unwrap(RHS), Name));
3581}
3582
3584 const char *Name) {
3585 return wrap(unwrap(B)->CreateFAdd(unwrap(LHS), unwrap(RHS), Name));
3586}
3587
3589 const char *Name) {
3590 return wrap(unwrap(B)->CreateSub(unwrap(LHS), unwrap(RHS), Name));
3591}
3592
3594 const char *Name) {
3595 return wrap(unwrap(B)->CreateNSWSub(unwrap(LHS), unwrap(RHS), Name));
3596}
3597
3599 const char *Name) {
3600 return wrap(unwrap(B)->CreateNUWSub(unwrap(LHS), unwrap(RHS), Name));
3601}
3602
3604 const char *Name) {
3605 return wrap(unwrap(B)->CreateFSub(unwrap(LHS), unwrap(RHS), Name));
3606}
3607
3609 const char *Name) {
3610 return wrap(unwrap(B)->CreateMul(unwrap(LHS), unwrap(RHS), Name));
3611}
3612
3614 const char *Name) {
3615 return wrap(unwrap(B)->CreateNSWMul(unwrap(LHS), unwrap(RHS), Name));
3616}
3617
3619 const char *Name) {
3620 return wrap(unwrap(B)->CreateNUWMul(unwrap(LHS), unwrap(RHS), Name));
3621}
3622
3624 const char *Name) {
3625 return wrap(unwrap(B)->CreateFMul(unwrap(LHS), unwrap(RHS), Name));
3626}
3627
3629 const char *Name) {
3630 return wrap(unwrap(B)->CreateUDiv(unwrap(LHS), unwrap(RHS), Name));
3631}
3632
3634 LLVMValueRef RHS, const char *Name) {
3635 return wrap(unwrap(B)->CreateExactUDiv(unwrap(LHS), unwrap(RHS), Name));
3636}
3637
3639 const char *Name) {
3640 return wrap(unwrap(B)->CreateSDiv(unwrap(LHS), unwrap(RHS), Name));
3641}
3642
3644 LLVMValueRef RHS, const char *Name) {
3645 return wrap(unwrap(B)->CreateExactSDiv(unwrap(LHS), unwrap(RHS), Name));
3646}
3647
3649 const char *Name) {
3650 return wrap(unwrap(B)->CreateFDiv(unwrap(LHS), unwrap(RHS), Name));
3651}
3652
3654 const char *Name) {
3655 return wrap(unwrap(B)->CreateURem(unwrap(LHS), unwrap(RHS), Name));
3656}
3657
3659 const char *Name) {
3660 return wrap(unwrap(B)->CreateSRem(unwrap(LHS), unwrap(RHS), Name));
3661}
3662
3664 const char *Name) {
3665 return wrap(unwrap(B)->CreateFRem(unwrap(LHS), unwrap(RHS), Name));
3666}
3667
3669 const char *Name) {
3670 return wrap(unwrap(B)->CreateShl(unwrap(LHS), unwrap(RHS), Name));
3671}
3672
3674 const char *Name) {
3675 return wrap(unwrap(B)->CreateLShr(unwrap(LHS), unwrap(RHS), Name));
3676}
3677
3679 const char *Name) {
3680 return wrap(unwrap(B)->CreateAShr(unwrap(LHS), unwrap(RHS), Name));
3681}
3682
3684 const char *Name) {
3685 return wrap(unwrap(B)->CreateAnd(unwrap(LHS), unwrap(RHS), Name));
3686}
3687
3689 const char *Name) {
3690 return wrap(unwrap(B)->CreateOr(unwrap(LHS), unwrap(RHS), Name));
3691}
3692
3694 const char *Name) {
3695 return wrap(unwrap(B)->CreateXor(unwrap(LHS), unwrap(RHS), Name));
3696}
3697
3699 LLVMValueRef LHS, LLVMValueRef RHS,
3700 const char *Name) {
3702 unwrap(RHS), Name));
3703}
3704
3706 return wrap(unwrap(B)->CreateNeg(unwrap(V), Name));
3707}
3708
3710 const char *Name) {
3711 return wrap(unwrap(B)->CreateNSWNeg(unwrap(V), Name));
3712}
3713
3715 const char *Name) {
3716 Value *Neg = unwrap(B)->CreateNeg(unwrap(V), Name);
3717 if (auto *I = dyn_cast<BinaryOperator>(Neg))
3718 I->setHasNoUnsignedWrap();
3719 return wrap(Neg);
3720}
3721
3723 return wrap(unwrap(B)->CreateFNeg(unwrap(V), Name));
3724}
3725
3727 return wrap(unwrap(B)->CreateNot(unwrap(V), Name));
3728}
3729
3731 Value *P = unwrap<Value>(ArithInst);
3732 return cast<Instruction>(P)->hasNoUnsignedWrap();
3733}
3734
3735void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW) {
3736 Value *P = unwrap<Value>(ArithInst);
3737 cast<Instruction>(P)->setHasNoUnsignedWrap(HasNUW);
3738}
3739
3741 Value *P = unwrap<Value>(ArithInst);
3742 return cast<Instruction>(P)->hasNoSignedWrap();
3743}
3744
3745void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW) {
3746 Value *P = unwrap<Value>(ArithInst);
3747 cast<Instruction>(P)->setHasNoSignedWrap(HasNSW);
3748}
3749
3751 Value *P = unwrap<Value>(DivOrShrInst);
3752 return cast<Instruction>(P)->isExact();
3753}
3754
3755void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact) {
3756 Value *P = unwrap<Value>(DivOrShrInst);
3757 cast<Instruction>(P)->setIsExact(IsExact);
3758}
3759
3761 Value *P = unwrap<Value>(NonNegInst);
3762 return cast<Instruction>(P)->hasNonNeg();
3763}
3764
3765void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg) {
3766 Value *P = unwrap<Value>(NonNegInst);
3767 cast<Instruction>(P)->setNonNeg(IsNonNeg);
3768}
3769
3771 Value *P = unwrap<Value>(FPMathInst);
3772 FastMathFlags FMF = cast<Instruction>(P)->getFastMathFlags();
3773 return mapToLLVMFastMathFlags(FMF);
3774}
3775
3777 Value *P = unwrap<Value>(FPMathInst);
3778 cast<Instruction>(P)->setFastMathFlags(mapFromLLVMFastMathFlags(FMF));
3779}
3780
3782 Value *Val = unwrap<Value>(V);
3783 return isa<FPMathOperator>(Val);
3784}
3785
3787 Value *P = unwrap<Value>(Inst);
3788 return cast<PossiblyDisjointInst>(P)->isDisjoint();
3789}
3790
3792 Value *P = unwrap<Value>(Inst);
3793 cast<PossiblyDisjointInst>(P)->setIsDisjoint(IsDisjoint);
3794}
3795
3796/*--.. Memory ..............................................................--*/
3797
3799 const char *Name) {
3800 Type* ITy = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext());
3801 Constant* AllocSize = ConstantExpr::getSizeOf(unwrap(Ty));
3802 AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, ITy);
3803 return wrap(unwrap(B)->CreateMalloc(ITy, unwrap(Ty), AllocSize, nullptr,
3804 nullptr, Name));
3805}
3806
3808 LLVMValueRef Val, const char *Name) {
3809 Type* ITy = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext());
3810 Constant* AllocSize = ConstantExpr::getSizeOf(unwrap(Ty));
3811 AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, ITy);
3812 return wrap(unwrap(B)->CreateMalloc(ITy, unwrap(Ty), AllocSize, unwrap(Val),
3813 nullptr, Name));
3814}
3815
3817 LLVMValueRef Val, LLVMValueRef Len,
3818 unsigned Align) {
3819 return wrap(unwrap(B)->CreateMemSet(unwrap(Ptr), unwrap(Val), unwrap(Len),
3820 MaybeAlign(Align)));
3821}
3822
3824 LLVMValueRef Dst, unsigned DstAlign,
3825 LLVMValueRef Src, unsigned SrcAlign,
3827 return wrap(unwrap(B)->CreateMemCpy(unwrap(Dst), MaybeAlign(DstAlign),
3828 unwrap(Src), MaybeAlign(SrcAlign),
3829 unwrap(Size)));
3830}
3831
3833 LLVMValueRef Dst, unsigned DstAlign,
3834 LLVMValueRef Src, unsigned SrcAlign,
3836 return wrap(unwrap(B)->CreateMemMove(unwrap(Dst), MaybeAlign(DstAlign),
3837 unwrap(Src), MaybeAlign(SrcAlign),
3838 unwrap(Size)));
3839}
3840
3842 const char *Name) {
3843 return wrap(unwrap(B)->CreateAlloca(unwrap(Ty), nullptr, Name));
3844}
3845
3847 LLVMValueRef Val, const char *Name) {
3848 return wrap(unwrap(B)->CreateAlloca(unwrap(Ty), unwrap(Val), Name));
3849}
3850
3852 return wrap(unwrap(B)->CreateFree(unwrap(PointerVal)));
3853}
3854
3856 LLVMValueRef PointerVal, const char *Name) {
3857 return wrap(unwrap(B)->CreateLoad(unwrap(Ty), unwrap(PointerVal), Name));
3858}
3859
3861 LLVMValueRef PointerVal) {
3862 return wrap(unwrap(B)->CreateStore(unwrap(Val), unwrap(PointerVal)));
3863}
3864
3866 switch (Ordering) {
3867 case LLVMAtomicOrderingNotAtomic: return AtomicOrdering::NotAtomic;
3868 case LLVMAtomicOrderingUnordered: return AtomicOrdering::Unordered;
3869 case LLVMAtomicOrderingMonotonic: return AtomicOrdering::Monotonic;
3870 case LLVMAtomicOrderingAcquire: return AtomicOrdering::Acquire;
3871 case LLVMAtomicOrderingRelease: return AtomicOrdering::Release;
3873 return AtomicOrdering::AcquireRelease;
3875 return AtomicOrdering::SequentiallyConsistent;
3876 }
3877
3878 llvm_unreachable("Invalid LLVMAtomicOrdering value!");
3879}
3880
3882 switch (Ordering) {
3883 case AtomicOrdering::NotAtomic: return LLVMAtomicOrderingNotAtomic;
3884 case AtomicOrdering::Unordered: return LLVMAtomicOrderingUnordered;
3885 case AtomicOrdering::Monotonic: return LLVMAtomicOrderingMonotonic;
3886 case AtomicOrdering::Acquire: return LLVMAtomicOrderingAcquire;
3887 case AtomicOrdering::Release: return LLVMAtomicOrderingRelease;
3888 case AtomicOrdering::AcquireRelease:
3890 case AtomicOrdering::SequentiallyConsistent:
3892 }
3893
3894 llvm_unreachable("Invalid AtomicOrdering value!");
3895}
3896
3898 switch (BinOp) {
3918 }
3919
3920 llvm_unreachable("Invalid LLVMAtomicRMWBinOp value!");
3921}
3922
3924 switch (BinOp) {
3944 default: break;
3945 }
3946
3947 llvm_unreachable("Invalid AtomicRMWBinOp value!");
3948}
3949
3950// TODO: Should this and other atomic instructions support building with
3951// "syncscope"?
3953 LLVMBool isSingleThread, const char *Name) {
3954 return wrap(
3955 unwrap(B)->CreateFence(mapFromLLVMOrdering(Ordering),
3956 isSingleThread ? SyncScope::SingleThread
3958 Name));
3959}
3960
3962 LLVMValueRef Pointer, LLVMValueRef *Indices,
3963 unsigned NumIndices, const char *Name) {
3964 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
3965 return wrap(unwrap(B)->CreateGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name));
3966}
3967
3969 LLVMValueRef Pointer, LLVMValueRef *Indices,
3970 unsigned NumIndices, const char *Name) {
3971 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
3972 return wrap(
3973 unwrap(B)->CreateInBoundsGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name));
3974}
3975
3977 LLVMValueRef Pointer,
3978 LLVMValueRef *Indices,
3979 unsigned NumIndices, const char *Name,
3980 LLVMGEPNoWrapFlags NoWrapFlags) {
3981 ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices);
3982 return wrap(unwrap(B)->CreateGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name,
3983 mapFromLLVMGEPNoWrapFlags(NoWrapFlags)));
3984}
3985
3987 LLVMValueRef Pointer, unsigned Idx,
3988 const char *Name) {
3989 return wrap(
3990 unwrap(B)->CreateStructGEP(unwrap(Ty), unwrap(Pointer), Idx, Name));
3991}
3992
3994 const char *Name) {
3995 return wrap(unwrap(B)->CreateGlobalString(Str, Name));
3996}
3997
3999 const char *Name) {
4000 return wrap(unwrap(B)->CreateGlobalStringPtr(Str, Name));
4001}
4002
4004 Value *P = unwrap(MemAccessInst);
4005 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4006 return LI->isVolatile();
4007 if (StoreInst *SI = dyn_cast<StoreInst>(P))
4008 return SI->isVolatile();
4009 if (AtomicRMWInst *AI = dyn_cast<AtomicRMWInst>(P))
4010 return AI->isVolatile();
4011 return cast<AtomicCmpXchgInst>(P)->isVolatile();
4012}
4013
4014void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile) {
4015 Value *P = unwrap(MemAccessInst);
4016 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4017 return LI->setVolatile(isVolatile);
4018 if (StoreInst *SI = dyn_cast<StoreInst>(P))
4019 return SI->setVolatile(isVolatile);
4020 if (AtomicRMWInst *AI = dyn_cast<AtomicRMWInst>(P))
4021 return AI->setVolatile(isVolatile);
4022 return cast<AtomicCmpXchgInst>(P)->setVolatile(isVolatile);
4023}
4024
4026 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->isWeak();
4027}
4028
4029void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak) {
4030 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->setWeak(isWeak);
4031}
4032
4034 Value *P = unwrap(MemAccessInst);
4036 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4037 O = LI->getOrdering();
4038 else if (StoreInst *SI = dyn_cast<StoreInst>(P))
4039 O = SI->getOrdering();
4040 else if (FenceInst *FI = dyn_cast<FenceInst>(P))
4041 O = FI->getOrdering();
4042 else
4043 O = cast<AtomicRMWInst>(P)->getOrdering();
4044 return mapToLLVMOrdering(O);
4045}
4046
4047void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering) {
4048 Value *P = unwrap(MemAccessInst);
4049 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4050
4051 if (LoadInst *LI = dyn_cast<LoadInst>(P))
4052 return LI->setOrdering(O);
4053 else if (FenceInst *FI = dyn_cast<FenceInst>(P))
4054 return FI->setOrdering(O);
4055 else if (AtomicRMWInst *ARWI = dyn_cast<AtomicRMWInst>(P))
4056 return ARWI->setOrdering(O);
4057 return cast<StoreInst>(P)->setOrdering(O);
4058}
4059
4061 return mapToLLVMRMWBinOp(unwrap<AtomicRMWInst>(Inst)->getOperation());
4062}
4063
4065 unwrap<AtomicRMWInst>(Inst)->setOperation(mapFromLLVMRMWBinOp(BinOp));
4066}
4067
4068/*--.. Casts ...............................................................--*/
4069
4071 LLVMTypeRef DestTy, const char *Name) {
4072 return wrap(unwrap(B)->CreateTrunc(unwrap(Val), unwrap(DestTy), Name));
4073}
4074
4076 LLVMTypeRef DestTy, const char *Name) {
4077 return wrap(unwrap(B)->CreateZExt(unwrap(Val), unwrap(DestTy), Name));
4078}
4079
4081 LLVMTypeRef DestTy, const char *Name) {
4082 return wrap(unwrap(B)->CreateSExt(unwrap(Val), unwrap(DestTy), Name));
4083}
4084
4086 LLVMTypeRef DestTy, const char *Name) {
4087 return wrap(unwrap(B)->CreateFPToUI(unwrap(Val), unwrap(DestTy), Name));
4088}
4089
4091 LLVMTypeRef DestTy, const char *Name) {
4092 return wrap(unwrap(B)->CreateFPToSI(unwrap(Val), unwrap(DestTy), Name));
4093}
4094
4096 LLVMTypeRef DestTy, const char *Name) {
4097 return wrap(unwrap(B)->CreateUIToFP(unwrap(Val), unwrap(DestTy), Name));
4098}
4099
4101 LLVMTypeRef DestTy, const char *Name) {
4102 return wrap(unwrap(B)->CreateSIToFP(unwrap(Val), unwrap(DestTy), Name));
4103}
4104
4106 LLVMTypeRef DestTy, const char *Name) {
4107 return wrap(unwrap(B)->CreateFPTrunc(unwrap(Val), unwrap(DestTy), Name));
4108}
4109
4111 LLVMTypeRef DestTy, const char *Name) {
4112 return wrap(unwrap(B)->CreateFPExt(unwrap(Val), unwrap(DestTy), Name));
4113}
4114
4116 LLVMTypeRef DestTy, const char *Name) {
4117 return wrap(unwrap(B)->CreatePtrToInt(unwrap(Val), unwrap(DestTy), Name));
4118}
4119
4121 LLVMTypeRef DestTy, const char *Name) {
4122 return wrap(unwrap(B)->CreateIntToPtr(unwrap(Val), unwrap(DestTy), Name));
4123}
4124
4126 LLVMTypeRef DestTy, const char *Name) {
4127 return wrap(unwrap(B)->CreateBitCast(unwrap(Val), unwrap(DestTy), Name));
4128}
4129
4131 LLVMTypeRef DestTy, const char *Name) {
4132 return wrap(unwrap(B)->CreateAddrSpaceCast(unwrap(Val), unwrap(DestTy), Name));
4133}
4134
4136 LLVMTypeRef DestTy, const char *Name) {
4137 return wrap(unwrap(B)->CreateZExtOrBitCast(unwrap(Val), unwrap(DestTy),
4138 Name));
4139}
4140
4142 LLVMTypeRef DestTy, const char *Name) {
4143 return wrap(unwrap(B)->CreateSExtOrBitCast(unwrap(Val), unwrap(DestTy),
4144 Name));
4145}
4146
4148 LLVMTypeRef DestTy, const char *Name) {
4149 return wrap(unwrap(B)->CreateTruncOrBitCast(unwrap(Val), unwrap(DestTy),
4150 Name));
4151}
4152
4154 LLVMTypeRef DestTy, const char *Name) {
4155 return wrap(unwrap(B)->CreateCast(Instruction::CastOps(map_from_llvmopcode(Op)), unwrap(Val),
4156 unwrap(DestTy), Name));
4157}
4158
4160 LLVMTypeRef DestTy, const char *Name) {
4161 return wrap(unwrap(B)->CreatePointerCast(unwrap(Val), unwrap(DestTy), Name));
4162}
4163
4165 LLVMTypeRef DestTy, LLVMBool IsSigned,
4166 const char *Name) {
4167 return wrap(
4168 unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy), IsSigned, Name));
4169}
4170
4172 LLVMTypeRef DestTy, const char *Name) {
4173 return wrap(unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy),
4174 /*isSigned*/true, Name));
4175}
4176
4178 LLVMTypeRef DestTy, const char *Name) {
4179 return wrap(unwrap(B)->CreateFPCast(unwrap(Val), unwrap(DestTy), Name));
4180}
4181
4183 LLVMTypeRef DestTy, LLVMBool DestIsSigned) {
4185 unwrap(Src), SrcIsSigned, unwrap(DestTy), DestIsSigned));
4186}
4187
4188/*--.. Comparisons .........................................................--*/
4189
4191 LLVMValueRef LHS, LLVMValueRef RHS,
4192 const char *Name) {
4193 return wrap(unwrap(B)->CreateICmp(static_cast<ICmpInst::Predicate>(Op),
4194 unwrap(LHS), unwrap(RHS), Name));
4195}
4196
4198 LLVMValueRef LHS, LLVMValueRef RHS,
4199 const char *Name) {
4200 return wrap(unwrap(B)->CreateFCmp(static_cast<FCmpInst::Predicate>(Op),
4201 unwrap(LHS), unwrap(RHS), Name));
4202}
4203
4204/*--.. Miscellaneous instructions ..........................................--*/
4205
4207 return wrap(unwrap(B)->CreatePHI(unwrap(Ty), 0, Name));
4208}
4209
4211 LLVMValueRef *Args, unsigned NumArgs,
4212 const char *Name) {
4213 FunctionType *FTy = unwrap<FunctionType>(Ty);
4214 return wrap(unwrap(B)->CreateCall(FTy, unwrap(Fn),
4215 ArrayRef(unwrap(Args), NumArgs), Name));
4216}
4217
4220 LLVMValueRef Fn, LLVMValueRef *Args,
4221 unsigned NumArgs, LLVMOperandBundleRef *Bundles,
4222 unsigned NumBundles, const char *Name) {
4223 FunctionType *FTy = unwrap<FunctionType>(Ty);
4225 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
4226 OperandBundleDef *OB = unwrap(Bundle);
4227 OBs.push_back(*OB);
4228 }
4229 return wrap(unwrap(B)->CreateCall(
4230 FTy, unwrap(Fn), ArrayRef(unwrap(Args), NumArgs), OBs, Name));
4231}
4232
4234 LLVMValueRef Then, LLVMValueRef Else,
4235 const char *Name) {
4236 return wrap(unwrap(B)->CreateSelect(unwrap(If), unwrap(Then), unwrap(Else),
4237 Name));
4238}
4239
4241 LLVMTypeRef Ty, const char *Name) {
4242 return wrap(unwrap(B)->CreateVAArg(unwrap(List), unwrap(Ty), Name));
4243}
4244
4246 LLVMValueRef Index, const char *Name) {
4247 return wrap(unwrap(B)->CreateExtractElement(unwrap(VecVal), unwrap(Index),
4248 Name));
4249}
4250
4253 const char *Name) {
4254 return wrap(unwrap(B)->CreateInsertElement(unwrap(VecVal), unwrap(EltVal),
4255 unwrap(Index), Name));
4256}
4257
4259 LLVMValueRef V2, LLVMValueRef Mask,
4260 const char *Name) {
4261 return wrap(unwrap(B)->CreateShuffleVector(unwrap(V1), unwrap(V2),
4262 unwrap(Mask), Name));
4263}
4264
4266 unsigned Index, const char *Name) {
4267 return wrap(unwrap(B)->CreateExtractValue(unwrap(AggVal), Index, Name));
4268}
4269
4271 LLVMValueRef EltVal, unsigned Index,
4272 const char *Name) {
4273 return wrap(unwrap(B)->CreateInsertValue(unwrap(AggVal), unwrap(EltVal),
4274 Index, Name));
4275}
4276
4278 const char *Name) {
4279 return wrap(unwrap(B)->CreateFreeze(unwrap(Val), Name));
4280}
4281
4283 const char *Name) {
4284 return wrap(unwrap(B)->CreateIsNull(unwrap(Val), Name));
4285}
4286
4288 const char *Name) {
4289 return wrap(unwrap(B)->CreateIsNotNull(unwrap(Val), Name));
4290}
4291
4293 LLVMValueRef LHS, LLVMValueRef RHS,
4294 const char *Name) {
4295 return wrap(unwrap(B)->CreatePtrDiff(unwrap(ElemTy), unwrap(LHS),
4296 unwrap(RHS), Name));
4297}
4298
4300 LLVMValueRef PTR, LLVMValueRef Val,
4301 LLVMAtomicOrdering ordering,
4302 LLVMBool singleThread) {
4304 return wrap(unwrap(B)->CreateAtomicRMW(
4305 intop, unwrap(PTR), unwrap(Val), MaybeAlign(),
4306 mapFromLLVMOrdering(ordering),
4307 singleThread ? SyncScope::SingleThread : SyncScope::System));
4308}
4309
4311 LLVMValueRef Cmp, LLVMValueRef New,
4312 LLVMAtomicOrdering SuccessOrdering,
4313 LLVMAtomicOrdering FailureOrdering,
4314 LLVMBool singleThread) {
4315
4316 return wrap(unwrap(B)->CreateAtomicCmpXchg(
4317 unwrap(Ptr), unwrap(Cmp), unwrap(New), MaybeAlign(),
4318 mapFromLLVMOrdering(SuccessOrdering),
4319 mapFromLLVMOrdering(FailureOrdering),
4320 singleThread ? SyncScope::SingleThread : SyncScope::System));
4321}
4322
4324 Value *P = unwrap(SVInst);
4325 ShuffleVectorInst *I = cast<ShuffleVectorInst>(P);
4326 return I->getShuffleMask().size();
4327}
4328
4329int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt) {
4330 Value *P = unwrap(SVInst);
4331 ShuffleVectorInst *I = cast<ShuffleVectorInst>(P);
4332 return I->getMaskValue(Elt);
4333}
4334
4336
4338 Value *P = unwrap(AtomicInst);
4339
4340 if (AtomicRMWInst *I = dyn_cast<AtomicRMWInst>(P))
4341 return I->getSyncScopeID() == SyncScope::SingleThread;
4342 else if (FenceInst *FI = dyn_cast<FenceInst>(P))
4343 return FI->getSyncScopeID() == SyncScope::SingleThread;
4344 else if (StoreInst *SI = dyn_cast<StoreInst>(P))
4345 return SI->getSyncScopeID() == SyncScope::SingleThread;
4346 else if (LoadInst *LI = dyn_cast<LoadInst>(P))
4347 return LI->getSyncScopeID() == SyncScope::SingleThread;
4348 return cast<AtomicCmpXchgInst>(P)->getSyncScopeID() ==
4350}
4351
4353 Value *P = unwrap(AtomicInst);
4355
4356 if (AtomicRMWInst *I = dyn_cast<AtomicRMWInst>(P))
4357 return I->setSyncScopeID(SSID);
4358 else if (FenceInst *FI = dyn_cast<FenceInst>(P))
4359 return FI->setSyncScopeID(SSID);
4360 else if (StoreInst *SI = dyn_cast<StoreInst>(P))
4361 return SI->setSyncScopeID(SSID);
4362 else if (LoadInst *LI = dyn_cast<LoadInst>(P))
4363 return LI->setSyncScopeID(SSID);
4364 return cast<AtomicCmpXchgInst>(P)->setSyncScopeID(SSID);
4365}
4366
4368 Value *P = unwrap(CmpXchgInst);
4369 return mapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getSuccessOrdering());
4370}
4371
4373 LLVMAtomicOrdering Ordering) {
4374 Value *P = unwrap(CmpXchgInst);
4375 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4376
4377 return cast<AtomicCmpXchgInst>(P)->setSuccessOrdering(O);
4378}
4379
4381 Value *P = unwrap(CmpXchgInst);
4382 return mapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getFailureOrdering());
4383}
4384
4386 LLVMAtomicOrdering Ordering) {
4387 Value *P = unwrap(CmpXchgInst);
4388 AtomicOrdering O = mapFromLLVMOrdering(Ordering);
4389
4390 return cast<AtomicCmpXchgInst>(P)->setFailureOrdering(O);
4391}
4392
4393/*===-- Module providers --------------------------------------------------===*/
4394
4397 return reinterpret_cast<LLVMModuleProviderRef>(M);
4398}
4399
4401 delete unwrap(MP);
4402}
4403
4404
4405/*===-- Memory buffers ----------------------------------------------------===*/
4406
4408 const char *Path,
4409 LLVMMemoryBufferRef *OutMemBuf,
4410 char **OutMessage) {
4411
4413 if (std::error_code EC = MBOrErr.getError()) {
4414 *OutMessage = strdup(EC.message().c_str());
4415 return 1;
4416 }
4417 *OutMemBuf = wrap(MBOrErr.get().release());
4418 return 0;
4419}
4420
4422 char **OutMessage) {
4424 if (std::error_code EC = MBOrErr.getError()) {
4425 *OutMessage = strdup(EC.message().c_str());
4426 return 1;
4427 }
4428 *OutMemBuf = wrap(MBOrErr.get().release());
4429 return 0;
4430}
4431
4433 const char *InputData,
4434 size_t InputDataLength,
4435 const char *BufferName,
4436 LLVMBool RequiresNullTerminator) {
4437
4438 return wrap(MemoryBuffer::getMemBuffer(StringRef(InputData, InputDataLength),
4439 StringRef(BufferName),
4440 RequiresNullTerminator).release());
4441}
4442
4444 const char *InputData,
4445 size_t InputDataLength,
4446 const char *BufferName) {
4447
4448 return wrap(
4449 MemoryBuffer::getMemBufferCopy(StringRef(InputData, InputDataLength),
4450 StringRef(BufferName)).release());
4451}
4452
4454 return unwrap(MemBuf)->getBufferStart();
4455}
4456
4458 return unwrap(MemBuf)->getBufferSize();
4459}
4460
4462 delete unwrap(MemBuf);
4463}
4464
4465/*===-- Pass Manager ------------------------------------------------------===*/
4466
4468 return wrap(new legacy::PassManager());
4469}
4470
4472 return wrap(new legacy::FunctionPassManager(unwrap(M)));
4473}
4474
4477 reinterpret_cast<LLVMModuleRef>(P));
4478}
4479
4481 return unwrap<legacy::PassManager>(PM)->run(*unwrap(M));
4482}
4483
4485 return unwrap<legacy::FunctionPassManager>(FPM)->doInitialization();
4486}
4487
4489 return unwrap<legacy::FunctionPassManager>(FPM)->run(*unwrap<Function>(F));
4490}
4491
4493 return unwrap<legacy::FunctionPassManager>(FPM)->doFinalization();
4494}
4495
4497 delete unwrap(PM);
4498}
4499
4500/*===-- Threading ------------------------------------------------------===*/
4501
4503 return LLVMIsMultithreaded();
4504}
4505
4507}
4508
4510 return llvm_is_multithreaded();
4511}
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< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#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:348
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
Given that RA is a live value
#define LLVM_DEBUG(X)
Definition: Debug.h:101
uint64_t Addr
std::string Name
uint64_t Size
static Function * getFunction(Constant *C)
Definition: Evaluator.cpp:236
static char getTypeID(Type *Ty)
#define op(i)
Hexagon Common GEP
LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef C, unsigned idx)
Definition: Core.cpp:1628
static Module::ModFlagBehavior map_to_llvmModFlagBehavior(LLVMModuleFlagBehavior Behavior)
Definition: Core.cpp:333
#define LLVM_DEFINE_VALUE_CAST(name)
Definition: Core.cpp:1140
static LLVMValueMetadataEntry * llvm_getMetadata(size_t *NumEntries, llvm::function_ref< void(MetadataEntries &)> AccessMD)
Definition: Core.cpp:1112
static GEPNoWrapFlags mapFromLLVMGEPNoWrapFlags(LLVMGEPNoWrapFlags GEPFlags)
Definition: Core.cpp:1713
static MDNode * extractMDNode(MetadataAsValue *MAV)
Definition: Core.cpp:1088
static void LLVMPositionBuilderImpl(IRBuilder<> *Builder, BasicBlock *Block, Instruction *Instr, bool BeforeDbgRecords)
Definition: Core.cpp:3232
static LLVMOpcode map_to_llvmopcode(int opcode)
Definition: Core.cpp:1691
static LLVMFastMathFlags mapToLLVMFastMathFlags(FastMathFlags FMF)
Definition: Core.cpp:3548
static FastMathFlags mapFromLLVMFastMathFlags(LLVMFastMathFlags FMF)
Definition: Core.cpp:3535
LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char Str[], uint8_t Radix)
Definition: Core.cpp:1548
static AtomicOrdering mapFromLLVMOrdering(LLVMAtomicOrdering Ordering)
Definition: Core.cpp:3865
static Intrinsic::ID llvm_map_to_intrinsic_id(unsigned ID)
Definition: Core.cpp:2446
static LLVMModuleFlagBehavior map_from_llvmModFlagBehavior(Module::ModFlagBehavior Behavior)
Definition: Core.cpp:352
static LLVMAtomicOrdering mapToLLVMOrdering(AtomicOrdering Ordering)
Definition: Core.cpp:3881
LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition: Core.cpp:3714
static LLVMValueRef getMDNodeOperandImpl(LLVMContext &Context, const MDNode *N, unsigned Index)
Definition: Core.cpp:1195
LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const char Str[], unsigned SLen)
Definition: Core.cpp:1568
static int map_from_llvmopcode(LLVMOpcode code)
Definition: Core.cpp:1701
static LLVMAtomicRMWBinOp mapToLLVMRMWBinOp(AtomicRMWInst::BinOp BinOp)
Definition: Core.cpp:3923
static AtomicRMWInst::BinOp mapFromLLVMRMWBinOp(LLVMAtomicRMWBinOp BinOp)
Definition: Core.cpp:3897
LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal)
Definition: Core.cpp:1759
LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const char Str[], unsigned SLen, uint8_t Radix)
Definition: Core.cpp:1554
static LLVMContext & getGlobalContext()
Definition: Core.cpp:92
static LLVMGEPNoWrapFlags mapToLLVMGEPNoWrapFlags(GEPNoWrapFlags GEPFlags)
Definition: Core.cpp:1725
BasicBlock ** unwrap(LLVMBasicBlockRef *BBs)
Definition: Core.cpp:50
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
#define H(x, y, z)
Definition: MD5.cpp:57
Module.h This file contains the declarations for the Module class.
#define P(N)
Module * Mod
const NodeList & List
Definition: RDFGraph.cpp:201
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)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static SymbolRef::Type getType(const Symbol *Sym)
Definition: TapiFile.cpp:40
unify loop Fixup each natural loop to have a single exit block
static std::optional< unsigned > getOpcode(ArrayRef< VPValue * > Values)
Returns the opcode of Values or ~0 if they do not all agree.
Definition: VPlanSLP.cpp:191
Value * RHS
Value * LHS
static const uint32_t IV[8]
Definition: blake3_impl.h:78
opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
Definition: APFloat.cpp:5317
double convertToDouble() const
Converts this APFloat to host double value.
Definition: APFloat.cpp:5376
Class for arbitrary precision integers.
Definition: APInt.h:78
an instruction to allocate memory on the stack
Definition: Instructions.h:61
This class represents an incoming formal argument to a Function.
Definition: Argument.h:31
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
An instruction that atomically checks whether a specified value is in a memory location,...
Definition: Instructions.h:495
an instruction that atomically reads a memory location, combines it with another value,...
Definition: Instructions.h:696
BinOp
This enumeration lists the possible modifications atomicrmw can make.
Definition: Instructions.h:708
@ Add
*p = old + v
Definition: Instructions.h:712
@ FAdd
*p = old + v
Definition: Instructions.h:733
@ Min
*p = old <signed v ? old : v
Definition: Instructions.h:726
@ Or
*p = old | v
Definition: Instructions.h:720
@ Sub
*p = old - v
Definition: Instructions.h:714
@ And
*p = old & v
Definition: Instructions.h:716
@ Xor
*p = old ^ v
Definition: Instructions.h:722
@ FSub
*p = old - v
Definition: Instructions.h:736
@ UIncWrap
Increment one up to a maximum value.
Definition: Instructions.h:748
@ Max
*p = old >signed v ? old : v
Definition: Instructions.h:724
@ UMin
*p = old <unsigned v ? old : v
Definition: Instructions.h:730
@ FMin
*p = minnum(old, v) minnum matches the behavior of llvm.minnum.
Definition: Instructions.h:744
@ UMax
*p = old >unsigned v ? old : v
Definition: Instructions.h:728
@ FMax
*p = maxnum(old, v) maxnum matches the behavior of llvm.maxnum.
Definition: Instructions.h:740
@ UDecWrap
Decrement one until a minimum value or zero.
Definition: Instructions.h:752
@ Nand
*p = ~(old & v)
Definition: Instructions.h:718
static Attribute::AttrKind getAttrKindFromName(StringRef AttrName)
Definition: Attributes.cpp:303
static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
Definition: Attributes.cpp:94
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
Definition: Attributes.h:86
static Attribute getWithAlignment(LLVMContext &Context, Align Alignment)
Return a uniquified Attribute object that has the specific alignment set.
Definition: Attributes.cpp:232
LLVM Basic Block Representation.
Definition: BasicBlock.h:61
void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW=nullptr, bool ShouldPreserveUseListOrder=false, bool IsForDebug=false) const
Print the basic block to an output stream with an optional AssemblyAnnotationWriter.
Definition: AsmWriter.cpp:4862
void setIsNewDbgInfoFormat(bool NewFlag)
Ensure the block is in "old" dbg.value format (NewFlag == false) or in the new format (NewFlag == tru...
Definition: BasicBlock.cpp:152
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
Definition: BasicBlock.h:202
void moveAfter(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it right after MovePos in the function M...
Definition: BasicBlock.cpp:285
void removeFromParent()
Unlink 'this' from the containing function, but do not delete it.
Definition: BasicBlock.cpp:273
const Function * getParent() const
Return the enclosing method, or null if none.
Definition: BasicBlock.h:209
SymbolTableList< BasicBlock >::iterator eraseFromParent()
Unlink 'this' from the containing function and delete it.
Definition: BasicBlock.cpp:277
InstListType::iterator iterator
Instruction iterators...
Definition: BasicBlock.h:167
LLVMContext & getContext() const
Get the context in which this basic block lives.
Definition: BasicBlock.cpp:168
bool IsNewDbgInfoFormat
Flag recording whether or not this block stores debug-info in the form of intrinsic instructions (fal...
Definition: BasicBlock.h:67
size_t size() const
Definition: BasicBlock.h:459
void moveBefore(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it into the function that MovePos lives ...
Definition: BasicBlock.h:366
static BlockAddress * get(Function *F, BasicBlock *BB)
Return a BlockAddress for the specified function and basic block.
Definition: Constants.cpp:1871
static 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:757
static Constant * get(ArrayType *T, ArrayRef< Constant * > V)
Definition: Constants.cpp:1292
static ConstantAsMetadata * get(Constant *C)
Definition: Metadata.h:528
static Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true)
This method constructs a CDS and initializes it with a text string.
Definition: Constants.cpp:2938
static Constant * getIntToPtr(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Definition: Constants.cpp:2269
static Constant * getExtractElement(Constant *Vec, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
Definition: Constants.cpp:2516
static Constant * getAlignOf(Type *Ty)
getAlignOf constant expr - computes the alignment of a type in a target independent way (Note: the re...
Definition: Constants.cpp:2452
static Constant * getNUWSub(Constant *C1, Constant *C2)
Definition: Constants.h:1149
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList)
Create an "inbounds" getelementptr.
Definition: Constants.h:1267
static Constant * getPointerCast(Constant *C, Type *Ty)
Create a BitCast, AddrSpaceCast, or a PtrToInt cast constant expression.
Definition: Constants.cpp:2215
static Constant * getTruncOrBitCast(Constant *C, Type *Ty)
Definition: Constants.cpp:2209
static Constant * getNSWAdd(Constant *C1, Constant *C2)
Definition: Constants.h:1137
static Constant * getSub(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Definition: Constants.cpp:2606
static Constant * getNot(Constant *C)
Definition: Constants.cpp:2593
static Constant * getInsertElement(Constant *Vec, Constant *Elt, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
Definition: Constants.cpp:2538
static Constant * getPtrToInt(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Definition: Constants.cpp:2255
static Constant * getShuffleVector(Constant *V1, Constant *V2, ArrayRef< int > Mask, Type *OnlyIfReducedTy=nullptr)
Definition: Constants.cpp:2561
static Constant * getSizeOf(Type *Ty)
getSizeOf constant expr - computes the (alloc) size of a type (in address-units, not bits) in a targe...
Definition: Constants.cpp:2442
static Constant * getXor(Constant *C1, Constant *C2)
Definition: Constants.cpp:2620
static Constant * getMul(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Definition: Constants.cpp:2613
static Constant * getNSWNeg(Constant *C)
Definition: Constants.h:1135
static Constant * getNSWSub(Constant *C1, Constant *C2)
Definition: Constants.h:1145
static Constant * getNUWAdd(Constant *C1, Constant *C2)
Definition: Constants.h:1141
static Constant * getAddrSpaceCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Definition: Constants.cpp:2295
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:1240
static Constant * getAdd(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Definition: Constants.cpp:2599
static Constant * getBitCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Definition: Constants.cpp:2283
static Constant * getNSWMul(Constant *C1, Constant *C2)
Definition: Constants.h:1153
static Constant * getNeg(Constant *C, bool HasNSW=false)
Definition: Constants.cpp:2587
static Constant * getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Definition: Constants.cpp:2241
static Constant * getNUWMul(Constant *C1, Constant *C2)
Definition: Constants.h:1157
ConstantFP - Floating Point Values [float, double].
Definition: Constants.h:269
const APFloat & getValueAPF() const
Definition: Constants.h:312
static ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
Definition: Constants.cpp:1800
static ConstantPtrAuth * get(Constant *Ptr, ConstantInt *Key, ConstantInt *Disc, Constant *AddrDisc)
Return a pointer signed with the specified parameters.
Definition: Constants.cpp:2046
This class represents a range of values.
Definition: ConstantRange.h:47
static Constant * get(StructType *T, ArrayRef< Constant * > V)
Definition: Constants.cpp:1357
static Constant * getAnon(ArrayRef< Constant * > V, bool Packed=false)
Return an anonymous struct that has the specified elements.
Definition: Constants.h:477
static Constant * get(ArrayRef< Constant * > V)
Definition: Constants.cpp:1399
This is an important base class in LLVM.
Definition: Constant.h:42
static Constant * getAllOnesValue(Type *Ty)
Definition: Constants.cpp:417
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
Definition: Constants.cpp:370
Subprogram description.
This class represents an Operation in the Expression.
A debug info location.
Definition: DebugLoc.h:33
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:20
void setAllowContract(bool B=true)
Definition: FMF.h:91
bool noSignedZeros() const
Definition: FMF.h:68
bool noInfs() const
Definition: FMF.h:67
void setAllowReciprocal(bool B=true)
Definition: FMF.h:88
bool allowReciprocal() const
Definition: FMF.h:69
void setNoSignedZeros(bool B=true)
Definition: FMF.h:85
bool allowReassoc() const
Flag queries.
Definition: FMF.h:65
bool approxFunc() const
Definition: FMF.h:71
void setNoNaNs(bool B=true)
Definition: FMF.h:79
void setAllowReassoc(bool B=true)
Flag setters.
Definition: FMF.h:76
bool noNaNs() const
Definition: FMF.h:66
void setApproxFunc(bool B=true)
Definition: FMF.h:94
void setNoInfs(bool B=true)
Definition: FMF.h:82
bool allowContract() const
Definition: FMF.h:70
An instruction for ordering other memory operations.
Definition: Instructions.h:420
static FixedVectorType * get(Type *ElementType, unsigned NumElts)
Definition: Type.cpp:692
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
Definition: Function.h:165
BasicBlockListType::iterator iterator
Definition: Function.h:69
static Intrinsic::ID lookupIntrinsicID(StringRef Name)
This does the actual lookup of an intrinsic ID which matches the given function name.
Definition: Function.cpp:956
iterator_range< arg_iterator > args()
Definition: Function.h:855
void setPersonalityFn(Constant *Fn)
Definition: Function.cpp:1968
arg_iterator arg_begin()
Definition: Function.h:831
Function::iterator insert(Function::iterator Position, BasicBlock *BB)
Insert BB in the basic block list at Position.
Definition: Function.h:745
size_t arg_size() const
Definition: Function.h:864
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:406
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
Definition: Instructions.h:915
void setNoWrapFlags(GEPNoWrapFlags NW)
Set nowrap flags for GEP instruction.
static 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:544
static 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:601
void setUnnamedAddr(UnnamedAddr Val)
Definition: GlobalValue.h:231
void setThreadLocalMode(ThreadLocalMode Val)
Definition: GlobalValue.h:267
void setLinkage(LinkageTypes LT)
Definition: GlobalValue.h:537
DLLStorageClassTypes
Storage classes of global values for PE targets.
Definition: GlobalValue.h:73
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:656
VisibilityTypes
An enumeration for the kinds of visibility of global values.
Definition: GlobalValue.h:66
@ PrivateLinkage
Like Internal, but omit from symbol table.
Definition: GlobalValue.h:60
@ CommonLinkage
Tentative definitions.
Definition: GlobalValue.h:62
@ InternalLinkage
Rename collisions when linking (static functions).
Definition: GlobalValue.h:59
@ LinkOnceAnyLinkage
Keep one copy of function when linking (inline)
Definition: GlobalValue.h:54
@ WeakODRLinkage
Same, but only replaced by something equivalent.
Definition: GlobalValue.h:57
@ ExternalLinkage
Externally visible function.
Definition: GlobalValue.h:52
@ WeakAnyLinkage
Keep one copy of named function when linking (weak)
Definition: GlobalValue.h:56
@ AppendingLinkage
Special purpose, only applies to global arrays.
Definition: GlobalValue.h:58
@ AvailableExternallyLinkage
Available for inspection, not emission.
Definition: GlobalValue.h:53
@ ExternalWeakLinkage
ExternalWeak linkage description.
Definition: GlobalValue.h:61
@ LinkOnceODRLinkage
Same, but only replaced by something equivalent.
Definition: GlobalValue.h:55
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.
void SetInsertPoint(BasicBlock *TheBB)
This specifies that created instructions should be appended to the end of the specified block.
Definition: IRBuilder.h:177
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition: IRBuilder.h:2671
static 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.
Definition: DerivedTypes.h:40
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition: Type.cpp:278
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
Definition: DerivedTypes.h:72
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
void(*)(LLVMContext *Context, void *OpaqueHandle) YieldCallbackTy
Defines the type of a yield callback.
Definition: LLVMContext.h:164
An instruction for reading from memory.
Definition: Instructions.h:174
static LocalAsMetadata * get(Value *Local)
Definition: Metadata.h:554
Metadata node.
Definition: Metadata.h:1067
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1541
A single uniqued string.
Definition: Metadata.h:720
static MDString * get(LLVMContext &Context, StringRef Str)
Definition: Metadata.cpp:600
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:176
static MetadataAsValue * get(LLVMContext &Context, Metadata *MD)
Definition: Metadata.cpp:103
Metadata * getMetadata() const
Definition: Metadata.h:193
Root of the metadata hierarchy.
Definition: Metadata.h:62
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
global_iterator global_begin()
Definition: Module.h:694
ifunc_iterator ifunc_begin()
Definition: Module.h:752
ModFlagBehavior
This enumeration defines the supported behaviors of module flags.
Definition: Module.h:115
global_iterator global_end()
Definition: Module.h:696
NamedMDListType::iterator named_metadata_iterator
The named metadata iterators.
Definition: Module.h:110
iterator begin()
Definition: Module.h:712
IFuncListType::iterator ifunc_iterator
The Global IFunc iterators.
Definition: Module.h:105
named_metadata_iterator named_metadata_begin()
Definition: Module.h:793
ifunc_iterator ifunc_end()
Definition: Module.h:754
alias_iterator alias_end()
Definition: Module.h:736
alias_iterator alias_begin()
Definition: Module.h:734
FunctionListType::iterator iterator
The Function iterators.
Definition: Module.h:90
GlobalListType::iterator global_iterator
The Global Variable iterator.
Definition: Module.h:85
AliasListType::iterator alias_iterator
The Global Alias iterators.
Definition: Module.h:100
iterator end()
Definition: Module.h:714
named_metadata_iterator named_metadata_end()
Definition: Module.h:798
A tuple of MDNodes.
Definition: Metadata.h:1729
StringRef getName() const
Definition: Metadata.cpp:1398
Module * getParent()
Get the module that holds this named metadata collection.
Definition: Metadata.h:1799
A container for an operand bundle being viewed as a set of values rather than a set of uses.
Definition: InstrTypes.h:1189
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...
Definition: PassRegistry.h:37
static PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
Definition: Constants.cpp:1852
A global registry used in conjunction with static constructors to make pluggable components (like tar...
Definition: Registry.h:44
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
Definition: Record.h:2213
static ScalableVectorType * get(Type *ElementType, unsigned MinNumElts)
Definition: Type.cpp:713
This instruction constructs a fixed permutation of two input vectors.
ArrayRef< int > getShuffleMask() const
size_t size() const
Definition: SmallVector.h:91
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:586
void push_back(const T &Elt)
Definition: SmallVector.h:426
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
An instruction for storing to memory.
Definition: Instructions.h:290
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
constexpr size_t size() const
size - Get the string size.
Definition: StringRef.h:137
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition: StringRef.h:131
Class to represent struct types.
Definition: DerivedTypes.h:216
static 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:373
ArrayRef< Type * > elements() const
Definition: DerivedTypes.h:333
static 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:632
static StructType * create(LLVMContext &Context, StringRef Name)
This creates an identified struct.
Definition: Type.cpp:513
Type * getTypeAtIndex(const Value *V) const
Given an index value into the type, return the type of the element.
Definition: Type.cpp:612
Class to represent target extensions types, which are generally unintrospectable from target-independ...
Definition: DerivedTypes.h:720
static TargetExtType * get(LLVMContext &Context, StringRef Name, ArrayRef< Type * > Types=std::nullopt, ArrayRef< unsigned > Ints=std::nullopt)
Return a target extension type having the specified name and optional type and integer parameters.
Definition: Type.cpp:796
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
static Type * getHalfTy(LLVMContext &C)
static Type * getDoubleTy(LLVMContext &C)
static Type * getX86_FP80Ty(LLVMContext &C)
static Type * getBFloatTy(LLVMContext &C)
static IntegerType * getInt1Ty(LLVMContext &C)
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
Definition: Type.h:154
static Type * getX86_AMXTy(LLVMContext &C)
bool isBFloatTy() const
Return true if this is 'bfloat', a 16-bit bfloat type.
Definition: Type.h:146
static Type * getMetadataTy(LLVMContext &C)
@ X86_MMXTyID
MMX vectors (64 bits, X86 specific)
Definition: Type.h:66
@ X86_AMXTyID
AMX vectors (8192 bits, X86 specific)
Definition: Type.h:67
@ FunctionTyID
Functions.
Definition: Type.h:72
@ ArrayTyID
Arrays.
Definition: Type.h:75
@ TypedPointerTyID
Typed pointer used by some GPU targets.
Definition: Type.h:78
@ HalfTyID
16-bit floating point type
Definition: Type.h:56
@ TargetExtTyID
Target extension type.
Definition: Type.h:79
@ VoidTyID
type with no size
Definition: Type.h:63
@ ScalableVectorTyID
Scalable SIMD vector type.
Definition: Type.h:77
@ LabelTyID
Labels.
Definition: Type.h:64
@ FloatTyID
32-bit floating point type
Definition: Type.h:58
@ StructTyID
Structures.
Definition: Type.h:74
@ IntegerTyID
Arbitrary bit width integers.
Definition: Type.h:71
@ FixedVectorTyID
Fixed width SIMD vector type.
Definition: Type.h:76
@ BFloatTyID
16-bit floating point type (7-bit significand)
Definition: Type.h:57
@ DoubleTyID
64-bit floating point type
Definition: Type.h:59
@ X86_FP80TyID
80-bit floating point type (X87)
Definition: Type.h:60
@ PPC_FP128TyID
128-bit floating point type (two 64-bits, PowerPC)
Definition: Type.h:62
@ MetadataTyID
Metadata.
Definition: Type.h:65
@ TokenTyID
Tokens.
Definition: Type.h:68
@ PointerTyID
Pointers.
Definition: Type.h:73
@ FP128TyID
128-bit floating point type (112-bit significand)
Definition: Type.h:61
static Type * getX86_MMXTy(LLVMContext &C)
static Type * getVoidTy(LLVMContext &C)
static Type * getLabelTy(LLVMContext &C)
static Type * getFP128Ty(LLVMContext &C)
static IntegerType * getInt16Ty(LLVMContext &C)
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
Definition: Type.h:143
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition: Type.h:129
static IntegerType * getInt8Ty(LLVMContext &C)
static IntegerType * getInt128Ty(LLVMContext &C)
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
Definition: Type.h:157
static Type * getTokenTy(LLVMContext &C)
static IntegerType * getInt32Ty(LLVMContext &C)
static IntegerType * getInt64Ty(LLVMContext &C)
static Type * getFloatTy(LLVMContext &C)
static Type * getPPC_FP128Ty(LLVMContext &C)
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
Definition: Constants.cpp:1833
A Use represents the edge between a Value definition and its users.
Definition: Use.h:43
static ValueAsMetadata * get(Value *V)
Definition: Metadata.cpp:495
LLVM Value Representation.
Definition: Value.h:74
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:255
void setName(const Twine &Name)
Change the name of the value.
Definition: Value.cpp:377
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
Definition: Value.cpp:534
use_iterator_impl< Use > use_iterator
Definition: Value.h:353
LLVMContext & getContext() const
All values hold a context through their type.
Definition: Value.cpp:1075
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:309
An efficient, type-erasing, non-owning reference to a callable.
self_iterator getIterator()
Definition: ilist_node.h:132
FunctionPassManager manages FunctionPasses.
PassManager manages ModulePassManagers.
A raw_ostream that writes to a file descriptor.
Definition: raw_ostream.h:460
bool has_error() const
Return the value of the flag in this raw_fd_ostream indicating whether an output error has been encou...
Definition: raw_ostream.h:562
std::error_code error() const
Definition: raw_ostream.h:556
void close()
Manually flush the stream and close the file.
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:661
LLVMContextRef LLVMGetGlobalContext()
Obtain the global context instance.
Definition: Core.cpp:101
unsigned LLVMGetEnumAttributeKind(LLVMAttributeRef A)
Get the unique id corresponding to the enum attribute passed as argument.
Definition: Core.cpp:164
void LLVMContextSetDiscardValueNames(LLVMContextRef C, LLVMBool Discard)
Set whether the given context discards all value names.
Definition: Core.cpp:132
uint64_t LLVMGetEnumAttributeValue(LLVMAttributeRef A)
Get the enum attribute's value.
Definition: Core.cpp:168
LLVMTypeRef LLVMGetTypeAttributeValue(LLVMAttributeRef A)
Get the type attribute's value.
Definition: Core.cpp:182
unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char *Name, unsigned SLen)
Definition: Core.cpp:140
LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI)
Return an enum LLVMDiagnosticSeverity.
Definition: Core.cpp:246
char * LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI)
Return a string representation of the DiagnosticInfo.
Definition: Core.cpp:235
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:149
LLVMDiagnosticHandler LLVMContextGetDiagnosticHandler(LLVMContextRef C)
Get the diagnostic handler of this context.
Definition: Core.cpp:112
LLVMBool LLVMContextShouldDiscardValueNames(LLVMContextRef C)
Retrieve whether the given context is set to discard all value names.
Definition: Core.cpp:128
LLVMAttributeRef LLVMCreateTypeAttribute(LLVMContextRef C, unsigned KindID, LLVMTypeRef type_ref)
Create a type attribute.
Definition: Core.cpp:175
LLVMAttributeRef LLVMCreateStringAttribute(LLVMContextRef C, const char *K, unsigned KLength, const char *V, unsigned VLength)
Create a string attribute.
Definition: Core.cpp:201
LLVMAttributeRef LLVMCreateConstantRangeAttribute(LLVMContextRef C, unsigned KindID, unsigned NumBits, const uint64_t LowerWords[], const uint64_t UpperWords[])
Create a ConstantRange attribute.
Definition: Core.cpp:187
void LLVMContextDispose(LLVMContextRef C)
Destroy a context instance.
Definition: Core.cpp:136
LLVMAttributeRef LLVMCreateEnumAttribute(LLVMContextRef C, unsigned KindID, uint64_t Val)
Create an enum attribute.
Definition: Core.cpp:157
const char * LLVMGetStringAttributeKind(LLVMAttributeRef A, unsigned *Length)
Get the string attribute's kind.
Definition: Core.cpp:208
LLVMTypeRef LLVMGetTypeByName2(LLVMContextRef C, const char *Name)
Obtain a Type from a context by its registered name.
Definition: Core.cpp:854
LLVMContextRef LLVMContextCreate()
Create a new context.
Definition: Core.cpp:97
void(* LLVMYieldCallback)(LLVMContextRef, void *)
Definition: Core.h:565
unsigned LLVMGetLastEnumAttributeKind(void)
Definition: Core.cpp:153
LLVMBool LLVMIsStringAttribute(LLVMAttributeRef A)
Definition: Core.cpp:227
LLVMBool LLVMIsTypeAttribute(LLVMAttributeRef A)
Definition: Core.cpp:231
const char * LLVMGetStringAttributeValue(LLVMAttributeRef A, unsigned *Length)
Get the string attribute's value.
Definition: Core.cpp:215
void LLVMContextSetYieldCallback(LLVMContextRef C, LLVMYieldCallback Callback, void *OpaqueHandle)
Set the yield callback function for this context.
Definition: Core.cpp:121
unsigned LLVMGetMDKindID(const char *Name, unsigned SLen)
Definition: Core.cpp:145
void LLVMContextSetDiagnosticHandler(LLVMContextRef C, LLVMDiagnosticHandler Handler, void *DiagnosticContext)
Set the diagnostic handler for this context.
Definition: Core.cpp:103
void(* LLVMDiagnosticHandler)(LLVMDiagnosticInfoRef, void *)
Definition: Core.h:564
void * LLVMContextGetDiagnosticContext(LLVMContextRef C)
Get the diagnostic context of this context.
Definition: Core.cpp:117
LLVMBool LLVMIsEnumAttribute(LLVMAttributeRef A)
Check for the different types of attributes.
Definition: Core.cpp:222
LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name)
Definition: Core.cpp:3855
LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str, const char *Name)
Definition: Core.cpp:3998
LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, LLVMBool isSingleThread, const char *Name)
Definition: Core.cpp:3952
LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, LLVMBool singleThread)
Definition: Core.cpp:4299
LLVMBool LLVMGetIsDisjoint(LLVMValueRef Inst)
Gets whether the instruction has the disjoint flag set.
Definition: Core.cpp:3786
LLVMValueRef LLVMBuildNot(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition: Core.cpp:3726
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:3396
LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3593
LLVMValueRef LLVMBuildAnd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3683
LLVMValueRef LLVMBuildFPExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4110
void LLVMClearInsertionPosition(LLVMBuilderRef Builder)
Definition: Core.cpp:3272
LLVMValueRef LLVMBuildFDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3648
void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak)
Definition: Core.cpp:4029
void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW)
Definition: Core.cpp:3745
LLVMValueRef LLVMBuildFreeze(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition: Core.cpp:4277
LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3583
LLVMValueRef LLVMBuildFMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3623
LLVMValueRef LLVMBuildZExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4075
LLVMValueRef LLVMBuildSExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4080
LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4147
LLVMValueRef LLVMBuildSExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4141
LLVMValueRef LLVMBuildBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4125
void LLVMBuilderSetDefaultFPMathTag(LLVMBuilderRef Builder, LLVMMetadataRef FPMathTag)
Set the default floating-point math metadata for the given builder.
Definition: Core.cpp:3322
LLVMValueRef LLVMBuildExtractValue(LLVMBuilderRef B, LLVMValueRef AggVal, unsigned Index, const char *Name)
Definition: Core.cpp:4265
LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef B, LLVMRealPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:4197
void LLVMSetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition: Core.cpp:4385
LLVMValueRef LLVMBuildFPTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4105
LLVMAtomicOrdering LLVMGetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst)
Definition: Core.cpp:4380
LLVMOpcode LLVMGetCastOpcode(LLVMValueRef Src, LLVMBool SrcIsSigned, LLVMTypeRef DestTy, LLVMBool DestIsSigned)
Definition: Core.cpp:4182
LLVMAtomicRMWBinOp LLVMGetAtomicRMWBinOp(LLVMValueRef Inst)
Definition: Core.cpp:4060
void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW)
Definition: Core.cpp:3735
LLVMValueRef LLVMBuildSIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4100
LLVMValueRef LLVMBuildShl(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3668
void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Builder, LLVMMetadataRef Loc)
Set location information used by debugging information.
Definition: Core.cpp:3295
int LLVMGetUndefMaskElem(void)
Definition: Core.cpp:4335
LLVMBool LLVMGetWeak(LLVMValueRef CmpXchgInst)
Definition: Core.cpp:4025
LLVMValueRef LLVMBuildFRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3663
LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition: Core.cpp:3841
LLVMValueRef LLVMBuildSelect(LLVMBuilderRef B, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, const char *Name)
Definition: Core.cpp:4233
LLVMValueRef LLVMBuildCatchPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition: Core.cpp:3422
void LLVMSetIsDisjoint(LLVMValueRef Inst, LLVMBool IsDisjoint)
Sets the disjoint flag for the instruction.
Definition: Core.cpp:3791
LLVMValueRef LLVMBuildMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3608
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:3245
LLVMValueRef LLVMBuildExactSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3643
LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3598
LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition: Core.cpp:3798
LLVMValueRef LLVMBuildIsNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition: Core.cpp:4282
LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PersFn, unsigned NumClauses, const char *Name)
Definition: Core.cpp:3410
LLVMValueRef LLVMBuildAggregateRet(LLVMBuilderRef B, LLVMValueRef *RetVals, unsigned N)
Definition: Core.cpp:3344
LLVMValueRef LLVMBuildAShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3678
LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, const char *Name)
Definition: Core.cpp:3387
LLVMValueRef LLVMBuildCallWithOperandBundles(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name)
Definition: Core.cpp:4219
LLVMValueRef LLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3633
void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering)
Definition: Core.cpp:4047
void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val)
Definition: Core.cpp:3496
LLVMValueRef LLVMGetArgOperand(LLVMValueRef Funclet, unsigned i)
Definition: Core.cpp:3525
LLVMValueRef LLVMBuildInsertValue(LLVMBuilderRef B, LLVMValueRef AggVal, LLVMValueRef EltVal, unsigned Index, const char *Name)
Definition: Core.cpp:4270
LLVMValueRef LLVMBuildAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3568
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:3816
LLVMValueRef LLVMBuildBr(LLVMBuilderRef B, LLVMBasicBlockRef Dest)
Definition: Core.cpp:3349
LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3613
LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3698
LLVMValueRef LLVMBuildSRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3658
void LLVMDisposeBuilder(LLVMBuilderRef Builder)
Definition: Core.cpp:3285
int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt)
Get the mask value at position Elt in the mask of a ShuffleVector instruction.
Definition: Core.cpp:4329
LLVMValueRef LLVMBuildFSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3603
LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx)
Definition: Core.cpp:3484
LLVMMetadataRef LLVMGetCurrentDebugLocation2(LLVMBuilderRef Builder)
Get location information used by debugging information.
Definition: Core.cpp:3291
LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
Definition: Core.cpp:3846
LLVMValueRef LLVMBuildVAArg(LLVMBuilderRef B, LLVMValueRef List, LLVMTypeRef Ty, const char *Name)
Definition: Core.cpp:4240
LLVMBuilderRef LLVMCreateBuilderInContext(LLVMContextRef C)
Definition: Core.cpp:3224
LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, LLVMBool singleThread)
Definition: Core.cpp:4310
LLVMValueRef LLVMBuildICmp(LLVMBuilderRef B, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:4190
LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4159
LLVMValueRef LLVMGetParentCatchSwitch(LLVMValueRef CatchPad)
Get the parent catchswitch instruction of a catchpad instruction.
Definition: Core.cpp:3514
void LLVMSetAtomicSingleThread(LLVMValueRef AtomicInst, LLVMBool NewValue)
Definition: Core.cpp:4352
LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4153
LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4070
LLVMValueRef LLVMBuildURem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3653
void LLVMSetAtomicRMWBinOp(LLVMValueRef Inst, LLVMAtomicRMWBinOp BinOp)
Definition: Core.cpp:4064
LLVMValueRef LLVMBuildCall2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition: Core.cpp:4210
void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal)
Definition: Core.cpp:3488
LLVMValueRef LLVMBuildOr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3688
LLVMBool LLVMGetNUW(LLVMValueRef ArithInst)
Definition: Core.cpp:3730
LLVMValueRef LLVMBuildAddrSpaceCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4130
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:3368
LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4085
void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L)
Deprecated: Passing the NULL location will crash.
Definition: Core.cpp:3302
LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4090
LLVMValueRef LLVMBuildIntCast2(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, LLVMBool IsSigned, const char *Name)
Definition: Core.cpp:4164
LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3573
LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition: Core.cpp:3722
LLVMMetadataRef LLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder)
Get the dafult floating-point math metadata for a given builder.
Definition: Core.cpp:3330
LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3628
void LLVMSetParentCatchSwitch(LLVMValueRef CatchPad, LLVMValueRef CatchSwitch)
Set the parent catchswitch instruction of a catchpad instruction.
Definition: Core.cpp:3518
LLVMValueRef LLVMBuildCatchRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition: Core.cpp:3455
LLVMValueRef LLVMBuildStructGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, unsigned Idx, const char *Name)
Definition: Core.cpp:3986
unsigned LLVMGetNumClauses(LLVMValueRef LandingPad)
Definition: Core.cpp:3480
LLVMBool LLVMGetNNeg(LLVMValueRef NonNegInst)
Gets if the instruction has the non-negative flag set.
Definition: Core.cpp:3760
LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3638
LLVMValueRef LLVMBuildStore(LLVMBuilderRef B, LLVMValueRef Val, LLVMValueRef PointerVal)
Definition: Core.cpp:3860
LLVMValueRef LLVMBuildCatchSwitch(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMBasicBlockRef UnwindBB, unsigned NumHandlers, const char *Name)
Definition: Core.cpp:3444
LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Deprecated: This cast is always signed.
Definition: Core.cpp:4171
LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
Definition: Core.cpp:3807
LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4135
LLVMValueRef LLVMBuildInBoundsGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition: Core.cpp:3968
void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers)
Obtain the basic blocks acting as handlers for a catchswitch instruction.
Definition: Core.cpp:3508
LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemAccessInst)
Definition: Core.cpp:4033
LLVMValueRef LLVMBuildUIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4095
LLVMValueRef LLVMBuildIntToPtr(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4120
LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef B, LLVMValueRef If, LLVMBasicBlockRef Then, LLVMBasicBlockRef Else)
Definition: Core.cpp:3353
LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr, unsigned NumDests)
Definition: Core.cpp:3363
void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest)
Definition: Core.cpp:3476
LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition: Core.cpp:3709
LLVMValueRef LLVMBuildXor(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3693
LLVMValueRef LLVMBuildGlobalString(LLVMBuilderRef B, const char *Str, const char *Name)
Definition: Core.cpp:3993
LLVMBool LLVMGetExact(LLVMValueRef DivOrShrInst)
Definition: Core.cpp:3750
LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
Definition: Core.cpp:4287
void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value)
Definition: Core.cpp:3529
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:3823
LLVMValueRef LLVMBuildPtrDiff2(LLVMBuilderRef B, LLVMTypeRef ElemTy, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:4292
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:3314
void LLVMAddMetadataToInst(LLVMBuilderRef Builder, LLVMValueRef Inst)
Adds the metadata registered with the given builder to the given instruction.
Definition: Core.cpp:3318
LLVMValueRef LLVMBuildSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3588
LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3578
LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef B)
Definition: Core.cpp:3467
LLVMValueRef LLVMBuildShuffleVector(LLVMBuilderRef B, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, const char *Name)
Definition: Core.cpp:4258
void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile)
Definition: Core.cpp:4014
LLVMValueRef LLVMBuildFree(LLVMBuilderRef B, LLVMValueRef PointerVal)
Definition: Core.cpp:3851
LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition: Core.cpp:3961
unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch)
Definition: Core.cpp:3504
LLVMValueRef LLVMBuildFPCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4177
LLVMBuilderRef LLVMCreateBuilder(void)
Definition: Core.cpp:3228
void LLVMSetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition: Core.cpp:4372
LLVMValueRef LLVMBuildPhi(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
Definition: Core.cpp:4206
LLVMBool LLVMCanValueUseFastMathFlags(LLVMValueRef V)
Check if a given value can potentially have fast math flags.
Definition: Core.cpp:3781
void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal, LLVMBasicBlockRef Dest)
Definition: Core.cpp:3471
LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst)
Definition: Core.cpp:4337
LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn)
Definition: Core.cpp:3440
LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef B, LLVMValueRef V, LLVMBasicBlockRef Else, unsigned NumCases)
Definition: Core.cpp:3358
void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr)
Definition: Core.cpp:3276
LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:4115
LLVMBool LLVMIsCleanup(LLVMValueRef LandingPad)
Definition: Core.cpp:3492
LLVMBool LLVMGetNSW(LLVMValueRef ArithInst)
Definition: Core.cpp:3740
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:3832
LLVMValueRef LLVMBuildLShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3673
unsigned LLVMGetNumMaskElements(LLVMValueRef SVInst)
Get the number of elements in the mask of a ShuffleVector instruction.
Definition: Core.cpp:4323
LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef B)
Definition: Core.cpp:3336
LLVMValueRef LLVMBuildRet(LLVMBuilderRef B, LLVMValueRef V)
Definition: Core.cpp:3340
void LLVMAddHandler(LLVMValueRef CatchSwitch, LLVMBasicBlockRef Dest)
Definition: Core.cpp:3500
void LLVMPositionBuilderBeforeInstrAndDbgRecords(LLVMBuilderRef Builder, LLVMValueRef Instr)
Set the builder position before Instr and any attached debug records.
Definition: Core.cpp:3257
LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef Index, const char *Name)
Definition: Core.cpp:4245
void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr)
Set the builder position before Instr but after any attached debug records.
Definition: Core.cpp:3252
LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder)
Deprecated: Returning the NULL location will crash.
Definition: Core.cpp:3308
LLVMAtomicOrdering LLVMGetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst)
Definition: Core.cpp:4367
void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg)
Sets the non-negative flag for the instruction.
Definition: Core.cpp:3765
void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact)
Definition: Core.cpp:3755
LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder)
Definition: Core.cpp:3268
LLVMValueRef LLVMBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition: Core.cpp:3429
void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr, const char *Name)
Definition: Core.cpp:3280
void LLVMSetFastMathFlags(LLVMValueRef FPMathInst, LLVMFastMathFlags FMF)
Sets the flags for which fast-math-style optimizations are allowed for this value.
Definition: Core.cpp:3776
LLVMValueRef LLVMBuildGEPWithNoWrapFlags(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name, LLVMGEPNoWrapFlags NoWrapFlags)
Creates a GetElementPtr instruction.
Definition: Core.cpp:3976
LLVMFastMathFlags LLVMGetFastMathFlags(LLVMValueRef FPMathInst)
Get the flags for which fast-math-style optimizations are allowed for this value.
Definition: Core.cpp:3770
LLVMValueRef LLVMBuildNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition: Core.cpp:3705
LLVMBool LLVMGetVolatile(LLVMValueRef MemAccessInst)
Definition: Core.cpp:4003
LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3618
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:3239
void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block)
Definition: Core.cpp:3263
LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, const char *Name)
Definition: Core.cpp:4251
LLVMValueRef LLVMBuildCleanupRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition: Core.cpp:3461
void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf)
Definition: Core.cpp:4461
size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf)
Definition: Core.cpp:4457
LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
Definition: Core.cpp:4421
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange(const char *InputData, size_t InputDataLength, const char *BufferName, LLVMBool RequiresNullTerminator)
Definition: Core.cpp:4432
LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const char *Path, LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
Definition: Core.cpp:4407
const char * LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf)
Definition: Core.cpp:4453
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData, size_t InputDataLength, const char *BufferName)
Definition: Core.cpp:4443
LLVMModuleProviderRef LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M)
Changes the type of M so it can be passed to FunctionPassManagers and the JIT.
Definition: Core.cpp:4396
void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP)
Destroys the module M.
Definition: Core.cpp:4400
const char * LLVMGetModuleIdentifier(LLVMModuleRef M, size_t *Len)
Obtain the identifier of a module.
Definition: Core.cpp:282
void LLVMSetDataLayout(LLVMModuleRef M, const char *DataLayoutStr)
Set the data layout for a module.
Definition: Core.cpp:311
LLVMValueRef LLVMAddFunction(LLVMModuleRef M, const char *Name, LLVMTypeRef FunctionTy)
Add a function to a module under a specified name.
Definition: Core.cpp:2382
LLVMBool LLVMIsNewDbgInfoFormat(LLVMModuleRef M)
Soon to be deprecated.
Definition: Core.cpp:427
LLVMNamedMDNodeRef LLVMGetPreviousNamedMetadata(LLVMNamedMDNodeRef NMD)
Decrement a NamedMDNode iterator to the previous NamedMDNode.
Definition: Core.cpp:1384
LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name)
Deprecated: Use LLVMGetTypeByName2 instead.
Definition: Core.cpp:850
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:298
void LLVMDumpModule(LLVMModuleRef M)
Dump a representation of a module to stderr.
Definition: Core.cpp:437
void LLVMAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm, size_t Len)
Append inline assembly to a module.
Definition: Core.cpp:483
LLVMValueRef LLVMGetFirstFunction(LLVMModuleRef M)
Obtain an iterator to the first Function in a Module.
Definition: Core.cpp:2392
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:1479
LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename, char **ErrorMessage)
Print a representation of a module to a file.
Definition: Core.cpp:442
void LLVMDisposeModule(LLVMModuleRef M)
Destroy a module instance.
Definition: Core.cpp:278
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:493
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:1455
const char * LLVMGetModuleInlineAsm(LLVMModuleRef M, size_t *Len)
Get inline assembly for a module.
Definition: Core.cpp:487
const char * LLVMGetSourceFileName(LLVMModuleRef M, size_t *Len)
Obtain the module's original source file name.
Definition: Core.cpp:292
const char * LLVMGetNamedMetadataName(LLVMNamedMDNodeRef NMD, size_t *NameLen)
Retrieve the name of a NamedMDNode.
Definition: Core.cpp:1402
LLVMContextRef LLVMGetModuleContext(LLVMModuleRef M)
Obtain the context to which this module is associated.
Definition: Core.cpp:569
const char * LLVMGetInlineAsmConstraintString(LLVMValueRef InlineAsmVal, size_t *Len)
Get the raw constraint string for an inline assembly snippet.
Definition: Core.cpp:522
LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID, LLVMContextRef C)
Create a new, empty module in a specific context.
Definition: Core.cpp:273
LLVMMetadataRef LLVMModuleFlagEntriesGetMetadata(LLVMModuleFlagEntry *Entries, unsigned Index)
Returns the metadata for a module flag entry at a specific index.
Definition: Core.cpp:408
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:400
LLVMValueRef LLVMGetLastFunction(LLVMModuleRef M)
Obtain an iterator to the last Function in a Module.
Definition: Core.cpp:2400
void LLVMSetTarget(LLVMModuleRef M, const char *Triple)
Set the target triple for a module.
Definition: Core.cpp:320
const char * LLVMGetDataLayoutStr(LLVMModuleRef M)
Obtain the data layout for a module.
Definition: Core.cpp:303
const char * LLVMGetInlineAsmAsmString(LLVMValueRef InlineAsmVal, size_t *Len)
Get the template string used for an inline assembly snippet.
Definition: Core.cpp:513
LLVMModuleFlagBehavior LLVMModuleFlagEntriesGetFlagBehavior(LLVMModuleFlagEntry *Entries, unsigned Index)
Returns the flag behavior for a module flag entry at a specific index.
Definition: Core.cpp:393
unsigned LLVMGetDebugLocColumn(LLVMValueRef Val)
Return the column number of the debug location for this value, which must be an llvm::Instruction.
Definition: Core.cpp:1525
unsigned LLVMGetDebugLocLine(LLVMValueRef Val)
Return the line number of the debug location for this value, which must be an llvm::Instruction,...
Definition: Core.cpp:1503
LLVMBool LLVMGetInlineAsmNeedsAlignedStack(LLVMValueRef InlineAsmVal)
Get if the inline asm snippet needs an aligned stack.
Definition: Core.cpp:558
LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID)
Create a new, empty module in the global context.
Definition: Core.cpp:269
LLVMModuleFlagEntry * LLVMCopyModuleFlagsMetadata(LLVMModuleRef M, size_t *Len)
Returns the module flags as an array of flag-key-value triples.
Definition: Core.cpp:371
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:420
void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm)
Deprecated: Use LLVMSetModuleInlineAsm2 instead.
Definition: Core.cpp:479
LLVMBool LLVMGetInlineAsmHasSideEffects(LLVMValueRef InlineAsmVal)
Get if the inline asm snippet has side effects.
Definition: Core.cpp:553
void LLVMDisposeModuleFlagsMetadata(LLVMModuleFlagEntry *Entries)
Destroys module flags metadata entries.
Definition: Core.cpp:388
LLVMInlineAsmDialect LLVMGetInlineAsmDialect(LLVMValueRef InlineAsmVal)
Get the dialect used by the inline asm snippet.
Definition: Core.cpp:532
unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char *Name)
Obtain the number of operands for named metadata in a module.
Definition: Core.cpp:1428
const char * LLVMGetTarget(LLVMModuleRef M)
Obtain the target triple for a module.
Definition: Core.cpp:316
LLVMNamedMDNodeRef LLVMGetNextNamedMetadata(LLVMNamedMDNodeRef NMD)
Advance a NamedMDNode iterator to the next NamedMDNode.
Definition: Core.cpp:1376
void LLVMSetModuleInlineAsm2(LLVMModuleRef M, const char *Asm, size_t Len)
Set inline assembly for a module.
Definition: Core.cpp:475
LLVMNamedMDNodeRef LLVMGetLastNamedMetadata(LLVMModuleRef M)
Obtain an iterator to the last NamedMDNode in a Module.
Definition: Core.cpp:1368
LLVMBool LLVMGetInlineAsmCanUnwind(LLVMValueRef InlineAsmVal)
Get if the inline asm snippet may unwind the stack.
Definition: Core.cpp:563
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:415
const char * LLVMGetDataLayout(LLVMModuleRef M)
Definition: Core.cpp:307
LLVMValueRef LLVMGetNamedFunction(LLVMModuleRef M, const char *Name)
Obtain a Function value from a Module by its name.
Definition: Core.cpp:2388
void LLVMSetIsNewDbgInfoFormat(LLVMModuleRef M, LLVMBool UseNewFormat)
Soon to be deprecated.
Definition: Core.cpp:431
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:1392
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:1397
LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn)
Decrement a Function iterator to the previous Function.
Definition: Core.cpp:2416
char * LLVMPrintModuleToString(LLVMModuleRef M)
Return a string representation of the module.
Definition: Core.cpp:464
void LLVMGetNamedMetadataOperands(LLVMModuleRef M, const char *Name, LLVMValueRef *Dest)
Obtain the named metadata operands for a module.
Definition: Core.cpp:1435
LLVMValueRef LLVMGetNextFunction(LLVMValueRef Fn)
Advance a Function iterator to the next Function.
Definition: Core.cpp:2408
LLVMTypeRef LLVMGetInlineAsmFunctionType(LLVMValueRef InlineAsmVal)
Get the function type of the inline assembly snippet.
Definition: Core.cpp:548
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:288
void LLVMAddNamedMetadataOperand(LLVMModuleRef M, const char *Name, LLVMValueRef Val)
Add an operand to named metadata.
Definition: Core.cpp:1445
LLVMNamedMDNodeRef LLVMGetFirstNamedMetadata(LLVMModuleRef M)
Obtain an iterator to the first NamedMDNode in a Module.
Definition: Core.cpp:1360
LLVMValueRef LLVMGetOperandBundleArgAtIndex(LLVMOperandBundleRef Bundle, unsigned Index)
Obtain the operand for an operand bundle at the given index.
Definition: Core.cpp:2754
unsigned LLVMGetNumOperandBundleArgs(LLVMOperandBundleRef Bundle)
Obtain the number of operands for an operand bundle.
Definition: Core.cpp:2750
LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, size_t TagLen, LLVMValueRef *Args, unsigned NumArgs)
Create a new operand bundle.
Definition: Core.cpp:2733
void LLVMDisposeOperandBundle(LLVMOperandBundleRef Bundle)
Destroy an operand bundle.
Definition: Core.cpp:2740
const char * LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len)
Obtain the tag of an operand bundle as a string.
Definition: Core.cpp:2744
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:4480
LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef P)
Deprecated: Use LLVMCreateFunctionPassManagerForModule instead.
Definition: Core.cpp:4475
LLVMPassManagerRef LLVMCreatePassManager()
Constructs a new whole-module pass pipeline.
Definition: Core.cpp:4467
void LLVMDisposePassManager(LLVMPassManagerRef PM)
Frees the memory of a pass pipeline.
Definition: Core.cpp:4496
LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM)
Finalizes all of the function passes scheduled in the function pass manager.
Definition: Core.cpp:4492
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:4488
LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM)
Initializes all of the function passes scheduled in the function pass manager.
Definition: Core.cpp:4484
LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M)
Constructs a new function-by-function pass pipeline over the module provider.
Definition: Core.cpp:4471
LLVMBool LLVMIsMultithreaded()
Check whether LLVM is executing in thread-safe mode or not.
Definition: Core.cpp:4509
LLVMBool LLVMStartMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
Definition: Core.cpp:4502
void LLVMStopMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
Definition: Core.cpp:4506
LLVMTypeRef LLVMFP128Type(void)
Definition: Core.cpp:750
LLVMTypeRef LLVMFP128TypeInContext(LLVMContextRef C)
Obtain a 128-bit floating point type (112-bit mantissa) from a context.
Definition: Core.cpp:722
LLVMTypeRef LLVMDoubleTypeInContext(LLVMContextRef C)
Obtain a 64-bit floating point type from a context.
Definition: Core.cpp:716
LLVMTypeRef LLVMX86FP80TypeInContext(LLVMContextRef C)
Obtain a 80-bit floating point type (X87) from a context.
Definition: Core.cpp:719
LLVMTypeRef LLVMHalfTypeInContext(LLVMContextRef C)
Obtain a 16-bit floating point type from a context.
Definition: Core.cpp:707
LLVMTypeRef LLVMBFloatTypeInContext(LLVMContextRef C)
Obtain a 16-bit brain floating point type from a context.
Definition: Core.cpp:710
LLVMTypeRef LLVMBFloatType(void)
Definition: Core.cpp:738
LLVMTypeRef LLVMFloatTypeInContext(LLVMContextRef C)
Obtain a 32-bit floating point type from a context.
Definition: Core.cpp:713
LLVMTypeRef LLVMHalfType(void)
Obtain a floating point type from the global context.
Definition: Core.cpp:735
LLVMTypeRef LLVMX86FP80Type(void)
Definition: Core.cpp:747
LLVMTypeRef LLVMPPCFP128Type(void)
Definition: Core.cpp:753
LLVMTypeRef LLVMFloatType(void)
Definition: Core.cpp:741
LLVMTypeRef LLVMDoubleType(void)
Definition: Core.cpp:744
LLVMTypeRef LLVMPPCFP128TypeInContext(LLVMContextRef C)
Obtain a 128-bit floating point type (two 64-bits) from a context.
Definition: Core.cpp:725
LLVMBool LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy)
Returns whether a function type is variadic.
Definition: Core.cpp:772
unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy)
Obtain the number of parameters this function accepts.
Definition: Core.cpp:780
void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest)
Obtain the types of a function's parameters.
Definition: Core.cpp:784
LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType, LLVMTypeRef *ParamTypes, unsigned ParamCount, LLVMBool IsVarArg)
Obtain a function type consisting of a specified signature.
Definition: Core.cpp:765
LLVMTypeRef LLVMGetReturnType(LLVMTypeRef FunctionTy)
Obtain the Type this function Type returns.
Definition: Core.cpp:776
LLVMTypeRef LLVMInt64Type(void)
Definition: Core.cpp:691
LLVMTypeRef LLVMInt64TypeInContext(LLVMContextRef C)
Definition: Core.cpp:669
LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C)
Definition: Core.cpp:663
LLVMTypeRef LLVMIntTypeInContext(LLVMContextRef C, unsigned NumBits)
Definition: Core.cpp:675
LLVMTypeRef LLVMInt1TypeInContext(LLVMContextRef C)
Obtain an integer type from a context with specified bit width.
Definition: Core.cpp:657
LLVMTypeRef LLVMInt32Type(void)
Definition: Core.cpp:688
LLVMTypeRef LLVMInt32TypeInContext(LLVMContextRef C)
Definition: Core.cpp:666
LLVMTypeRef LLVMInt128TypeInContext(LLVMContextRef C)
Definition: Core.cpp:672
LLVMTypeRef LLVMIntType(unsigned NumBits)
Definition: Core.cpp:697
LLVMTypeRef LLVMInt8TypeInContext(LLVMContextRef C)
Definition: Core.cpp:660
LLVMTypeRef LLVMInt8Type(void)
Definition: Core.cpp:682
LLVMTypeRef LLVMInt1Type(void)
Obtain an integer type from the global context with a specified bit width.
Definition: Core.cpp:679
LLVMTypeRef LLVMInt128Type(void)
Definition: Core.cpp:694
unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy)
Definition: Core.cpp:701
LLVMTypeRef LLVMInt16Type(void)
Definition: Core.cpp:685
LLVMTypeRef LLVMX86MMXTypeInContext(LLVMContextRef C)
Create a X86 MMX type in a context.
Definition: Core.cpp:728
LLVMTypeRef LLVMVoidType(void)
These are similar to the above functions except they operate on the global context.
Definition: Core.cpp:955
const char * LLVMGetTargetExtTypeName(LLVMTypeRef TargetExtTy)
Obtain the name for this target extension type.
Definition: Core.cpp:973
LLVMTypeRef LLVMGetTargetExtTypeTypeParam(LLVMTypeRef TargetExtTy, unsigned Idx)
Get the type parameter at the given index for the target extension type.
Definition: Core.cpp:983
unsigned LLVMGetTargetExtTypeNumTypeParams(LLVMTypeRef TargetExtTy)
Obtain the number of type parameters for this target extension type.
Definition: Core.cpp:978
LLVMTypeRef LLVMX86AMXTypeInContext(LLVMContextRef C)
Create a X86 AMX type in a context.
Definition: Core.cpp:731
LLVMTypeRef LLVMMetadataTypeInContext(LLVMContextRef C)
Create a metadata type in a context.
Definition: Core.cpp:951
LLVMTypeRef LLVMTokenTypeInContext(LLVMContextRef C)
Create a token type in a context.
Definition: Core.cpp:948
LLVMTypeRef LLVMX86AMXType(void)
Definition: Core.cpp:759
LLVMTypeRef LLVMLabelTypeInContext(LLVMContextRef C)
Create a label type in a context.
Definition: Core.cpp:945
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:962
unsigned LLVMGetTargetExtTypeNumIntParams(LLVMTypeRef TargetExtTy)
Obtain the number of int parameters for this target extension type.
Definition: Core.cpp:989
unsigned LLVMGetTargetExtTypeIntParam(LLVMTypeRef TargetExtTy, unsigned Idx)
Get the int parameter at the given index for the target extension type.
Definition: Core.cpp:994
LLVMTypeRef LLVMX86MMXType(void)
Definition: Core.cpp:756
LLVMTypeRef LLVMLabelType(void)
Definition: Core.cpp:958
LLVMTypeRef LLVMVoidTypeInContext(LLVMContextRef C)
Create a void type in a context.
Definition: Core.cpp:942
unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy)
Obtain the length of an array type.
Definition: Core.cpp:904
LLVMTypeRef LLVMGetElementType(LLVMTypeRef WrappedTy)
Obtain the element type of an array or vector type.
Definition: Core.cpp:893
unsigned LLVMGetPointerAddressSpace(LLVMTypeRef PointerTy)
Obtain the address space of a pointer type.
Definition: Core.cpp:912
uint64_t LLVMGetArrayLength2(LLVMTypeRef ArrayTy)
Obtain the length of an array type.
Definition: Core.cpp:908
LLVMValueRef LLVMGetConstantPtrAuthPointer(LLVMValueRef PtrAuth)
Get the pointer value for the associated ConstantPtrAuth constant.
Definition: Core.cpp:920
LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace)
Create a pointer type that points to a defined type.
Definition: Core.cpp:876
unsigned LLVMGetNumContainedTypes(LLVMTypeRef Tp)
Return the number of types in the derived type.
Definition: Core.cpp:900
LLVMValueRef LLVMGetConstantPtrAuthDiscriminator(LLVMValueRef PtrAuth)
Get the discriminator value for the associated ConstantPtrAuth constant.
Definition: Core.cpp:928
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:884
LLVMBool LLVMPointerTypeIsOpaque(LLVMTypeRef Ty)
Determine whether a pointer is opaque.
Definition: Core.cpp:880
LLVMTypeRef LLVMPointerTypeInContext(LLVMContextRef C, unsigned AddressSpace)
Create an opaque pointer type in a context.
Definition: Core.cpp:938
LLVMValueRef LLVMGetConstantPtrAuthKey(LLVMValueRef PtrAuth)
Get the key value for the associated ConstantPtrAuth constant.
Definition: Core.cpp:924
LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount)
Create a fixed size array type that refers to a specific type.
Definition: Core.cpp:868
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:888
LLVMTypeRef LLVMArrayType2(LLVMTypeRef ElementType, uint64_t ElementCount)
Create a fixed size array type that refers to a specific type.
Definition: Core.cpp:872
void LLVMGetSubtypes(LLVMTypeRef Tp, LLVMTypeRef *Arr)
Returns type's subtypes.
Definition: Core.cpp:860
LLVMValueRef LLVMGetConstantPtrAuthAddrDiscriminator(LLVMValueRef PtrAuth)
Get the address discriminator value for the associated ConstantPtrAuth constant.
Definition: Core.cpp:932
unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy)
Obtain the (possibly scalable) number of elements in a vector type.
Definition: Core.cpp:916
void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Set the contents of a structure type.
Definition: Core.cpp:817
LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy)
Determine whether a structure is packed.
Definition: Core.cpp:838
LLVMTypeRef LLVMStructGetTypeAtIndex(LLVMTypeRef StructTy, unsigned i)
Get the type of the element at a given index in the structure.
Definition: Core.cpp:833
LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Create a new structure type in the global context.
Definition: Core.cpp:798
const char * LLVMGetStructName(LLVMTypeRef Ty)
Obtain the name of a structure.
Definition: Core.cpp:809
void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest)
Get the elements within a structure.
Definition: Core.cpp:827
LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy)
Determine whether a structure is opaque.
Definition: Core.cpp:842
unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy)
Get the number of elements defined inside the structure.
Definition: Core.cpp:823
LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name)
Create an empty structure in a context having a specified name.
Definition: Core.cpp:804
LLVMBool LLVMIsLiteralStruct(LLVMTypeRef StructTy)
Determine whether a structure is literal.
Definition: Core.cpp:846
LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Create a new structure type in a context.
Definition: Core.cpp:792
LLVMBool LLVMTypeIsSized(LLVMTypeRef Ty)
Whether the type has a known size.
Definition: Core.cpp:628
LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty)
Obtain the enumerated type of a Type instance.
Definition: Core.cpp:578
char * LLVMPrintTypeToString(LLVMTypeRef Ty)
Return a string representation of the type.
Definition: Core.cpp:641
void LLVMDumpType(LLVMTypeRef Ty)
Dump a representation of a type to stderr.
Definition: Core.cpp:637
LLVMContextRef LLVMGetTypeContext(LLVMTypeRef Ty)
Obtain the context to which this type instance is associated.
Definition: Core.cpp:633
LLVMTailCallKind
Tail call kind for LLVMSetTailCallKind and LLVMGetTailCallKind.
Definition: Core.h:484
LLVMLinkage
Definition: Core.h:172
LLVMOpcode
External users depend on the following values being stable.
Definition: Core.h:60
LLVMRealPredicate
Definition: Core.h:305
LLVMTypeKind
Definition: Core.h:148
LLVMDLLStorageClass
Definition: Core.h:207
LLVMValueKind
Definition: Core.h:257
unsigned LLVMAttributeIndex
Definition: Core.h:475
LLVMIntPredicate
Definition: Core.h:292
unsigned LLVMFastMathFlags
Flags to indicate what fast-math-style optimizations are allowed on operations.
Definition: Core.h:512
LLVMUnnamedAddr
Definition: Core.h:201
LLVMModuleFlagBehavior
Definition: Core.h:412
LLVMDiagnosticSeverity
Definition: Core.h:400
LLVMVisibility
Definition: Core.h:195
LLVMAtomicRMWBinOp
Definition: Core.h:364
LLVMThreadLocalMode
Definition: Core.h:329
unsigned LLVMGEPNoWrapFlags
Flags that constrain the allowed wrap semantics of a getelementptr instruction.
Definition: Core.h:526
LLVMAtomicOrdering
Definition: Core.h:337
LLVMInlineAsmDialect
Definition: Core.h:407
@ LLVMDLLImportLinkage
Obsolete.
Definition: Core.h:186
@ LLVMInternalLinkage
Rename collisions when linking (static functions)
Definition: Core.h:183
@ LLVMLinkOnceAnyLinkage
Keep one copy of function when linking (inline)
Definition: Core.h:175
@ LLVMExternalLinkage
Externally visible function.
Definition: Core.h:173
@ LLVMExternalWeakLinkage
ExternalWeak linkage description.
Definition: Core.h:188
@ LLVMLinkOnceODRLinkage
Same, but only replaced by something equivalent.
Definition: Core.h:176
@ LLVMPrivateLinkage
Like Internal, but omit from symbol table.
Definition: Core.h:185
@ LLVMDLLExportLinkage
Obsolete.
Definition: Core.h:187
@ LLVMLinkerPrivateLinkage
Like Private, but linker removes.
Definition: Core.h:191
@ LLVMWeakODRLinkage
Same, but only replaced by something equivalent.
Definition: Core.h:180
@ LLVMGhostLinkage
Obsolete.
Definition: Core.h:189
@ LLVMWeakAnyLinkage
Keep one copy of function when linking (weak)
Definition: Core.h:179
@ LLVMAppendingLinkage
Special purpose, only applies to global arrays.
Definition: Core.h:182
@ LLVMCommonLinkage
Tentative definitions.
Definition: Core.h:190
@ LLVMLinkOnceODRAutoHideLinkage
Obsolete.
Definition: Core.h:178
@ LLVMLinkerPrivateWeakLinkage
Like LinkerPrivate, but is weak.
Definition: Core.h:192
@ LLVMAvailableExternallyLinkage
Definition: Core.h:174
@ LLVMHalfTypeKind
16 bit floating point type
Definition: Core.h:150
@ LLVMFP128TypeKind
128 bit floating point type (112-bit mantissa)
Definition: Core.h:154
@ LLVMIntegerTypeKind
Arbitrary bit width integers.
Definition: Core.h:157
@ LLVMPointerTypeKind
Pointers.
Definition: Core.h:161
@ LLVMX86_FP80TypeKind
80 bit floating point type (X87)
Definition: Core.h:153
@ LLVMX86_AMXTypeKind
X86 AMX.
Definition: Core.h:168
@ LLVMMetadataTypeKind
Metadata.
Definition: Core.h:163
@ LLVMScalableVectorTypeKind
Scalable SIMD vector type.
Definition: Core.h:166
@ LLVMArrayTypeKind
Arrays.
Definition: Core.h:160
@ LLVMBFloatTypeKind
16 bit brain floating point type
Definition: Core.h:167
@ LLVMStructTypeKind
Structures.
Definition: Core.h:159
@ LLVMLabelTypeKind
Labels.
Definition: Core.h:156
@ LLVMDoubleTypeKind
64 bit floating point type
Definition: Core.h:152
@ LLVMVoidTypeKind
type with no size
Definition: Core.h:149
@ LLVMTokenTypeKind
Tokens.
Definition: Core.h:165
@ LLVMFloatTypeKind
32 bit floating point type
Definition: Core.h:151
@ LLVMFunctionTypeKind
Functions.
Definition: Core.h:158
@ LLVMVectorTypeKind
Fixed width SIMD vector type.
Definition: Core.h:162
@ LLVMPPC_FP128TypeKind
128 bit floating point type (two 64-bits)
Definition: Core.h:155
@ LLVMTargetExtTypeKind
Target extension type.
Definition: Core.h:169
@ LLVMX86_MMXTypeKind
X86 MMX.
Definition: Core.h:164
@ LLVMInstructionValueKind
Definition: Core.h:286
@ LLVMGEPFlagInBounds
Definition: Core.h:515
@ LLVMGEPFlagNUSW
Definition: Core.h:516
@ LLVMGEPFlagNUW
Definition: Core.h:517
@ LLVMGlobalUnnamedAddr
Address of the GV is globally insignificant.
Definition: Core.h:204
@ LLVMLocalUnnamedAddr
Address of the GV is locally insignificant.
Definition: Core.h:203
@ LLVMNoUnnamedAddr
Address of the GV is significant.
Definition: Core.h:202
@ LLVMModuleFlagBehaviorRequire
Adds a requirement that another module flag be present and have a specified value after linking is pe...
Definition: Core.h:438
@ LLVMModuleFlagBehaviorWarning
Emits a warning if two values disagree.
Definition: Core.h:426
@ LLVMModuleFlagBehaviorOverride
Uses the specified value, regardless of the behavior or value of the other module.
Definition: Core.h:446
@ LLVMModuleFlagBehaviorAppendUnique
Appends the two values, which are required to be metadata nodes.
Definition: Core.h:460
@ LLVMModuleFlagBehaviorAppend
Appends the two values, which are required to be metadata nodes.
Definition: Core.h:452
@ LLVMModuleFlagBehaviorError
Emits an error if two values disagree, otherwise the resulting value is that of the operands.
Definition: Core.h:419
@ LLVMDSWarning
Definition: Core.h:402
@ LLVMDSNote
Definition: Core.h:404
@ LLVMDSError
Definition: Core.h:401
@ LLVMDSRemark
Definition: Core.h:403
@ LLVMAtomicRMWBinOpXor
Xor a value and return the old one.
Definition: Core.h:371
@ LLVMAtomicRMWBinOpXchg
Set the new value and return the one old.
Definition: Core.h:365
@ LLVMAtomicRMWBinOpSub
Subtract a value and return the old one.
Definition: Core.h:367
@ LLVMAtomicRMWBinOpUMax
Sets the value if it's greater than the original using an unsigned comparison and return the old one.
Definition: Core.h:378
@ LLVMAtomicRMWBinOpAnd
And a value and return the old one.
Definition: Core.h:368
@ LLVMAtomicRMWBinOpUDecWrap
Decrements the value, wrapping back to the input value when decremented below zero.
Definition: Core.h:396
@ LLVMAtomicRMWBinOpFMax
Sets the value if it's greater than the original using an floating point comparison and return the ol...
Definition: Core.h:388
@ LLVMAtomicRMWBinOpMin
Sets the value if it's Smaller than the original using a signed comparison and return the old one.
Definition: Core.h:375
@ LLVMAtomicRMWBinOpOr
OR a value and return the old one.
Definition: Core.h:370
@ LLVMAtomicRMWBinOpFMin
Sets the value if it's smaller than the original using an floating point comparison and return the ol...
Definition: Core.h:391
@ LLVMAtomicRMWBinOpMax
Sets the value if it's greater than the original using a signed comparison and return the old one.
Definition: Core.h:372
@ LLVMAtomicRMWBinOpUIncWrap
Increments the value, wrapping back to zero when incremented above input value.
Definition: Core.h:394
@ LLVMAtomicRMWBinOpFAdd
Add a floating point value and return the old one.
Definition: Core.h:384
@ LLVMAtomicRMWBinOpFSub
Subtract a floating point value and return the old one.
Definition: Core.h:386
@ LLVMAtomicRMWBinOpAdd
Add a value and return the old one.
Definition: Core.h:366
@ LLVMAtomicRMWBinOpUMin
Sets the value if it's greater than the original using an unsigned comparison and return the old one.
Definition: Core.h:381
@ LLVMAtomicRMWBinOpNand
Not-And a value and return the old one.
Definition: Core.h:369
@ LLVMFastMathAllowReassoc
Definition: Core.h:492
@ LLVMFastMathNoSignedZeros
Definition: Core.h:495
@ LLVMFastMathApproxFunc
Definition: Core.h:498
@ LLVMFastMathNoInfs
Definition: Core.h:494
@ LLVMFastMathNoNaNs
Definition: Core.h:493
@ LLVMFastMathNone
Definition: Core.h:499
@ LLVMFastMathAllowContract
Definition: Core.h:497
@ LLVMFastMathAllowReciprocal
Definition: Core.h:496
@ LLVMGeneralDynamicTLSModel
Definition: Core.h:331
@ LLVMLocalDynamicTLSModel
Definition: Core.h:332
@ LLVMNotThreadLocal
Definition: Core.h:330
@ LLVMInitialExecTLSModel
Definition: Core.h:333
@ LLVMLocalExecTLSModel
Definition: Core.h:334
@ LLVMAtomicOrderingAcquireRelease
provides both an Acquire and a Release barrier (for fences and operations which both read and write m...
Definition: Core.h:350
@ LLVMAtomicOrderingRelease
Release is similar to Acquire, but with a barrier of the sort necessary to release a lock.
Definition: Core.h:347
@ LLVMAtomicOrderingAcquire
Acquire provides a barrier of the sort necessary to acquire a lock to access other memory with normal...
Definition: Core.h:344
@ LLVMAtomicOrderingMonotonic
guarantees that if you take all the operations affecting a specific address, a consistent ordering ex...
Definition: Core.h:341
@ LLVMAtomicOrderingSequentiallyConsistent
provides Acquire semantics for loads and Release semantics for stores.
Definition: Core.h:354
@ LLVMAtomicOrderingNotAtomic
A load or store which is not atomic.
Definition: Core.h:338
@ LLVMAtomicOrderingUnordered
Lowest level of atomicity, guarantees somewhat sane results, lock free.
Definition: Core.h:339
@ LLVMInlineAsmDialectATT
Definition: Core.h:408
@ LLVMInlineAsmDialectIntel
Definition: Core.h:409
LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB)
Advance a basic block iterator.
Definition: Core.cpp:2815
void LLVMAppendExistingBasicBlock(LLVMValueRef Fn, LLVMBasicBlockRef BB)
Append the given basic block to the basic block list of the given function.
Definition: Core.cpp:2844
void LLVMDeleteBasicBlock(LLVMBasicBlockRef BBRef)
Remove a basic block from a function and delete it.
Definition: Core.cpp:2871
LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn)
Obtain the first basic block in a function.
Definition: Core.cpp:2799
LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val)
Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
Definition: Core.cpp:2769
LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C, const char *Name)
Create a new basic block without inserting it into a function.
Definition: Core.cpp:2831
void LLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BBRef)
Remove a basic block from a function.
Definition: Core.cpp:2875
void LLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to before another one.
Definition: Core.cpp:2879
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB)
Convert a basic block instance to a value type.
Definition: Core.cpp:2761
void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder, LLVMBasicBlockRef BB)
Insert the given basic block after the insertion point of the given builder.
Definition: Core.cpp:2836
void LLVMGetBasicBlocks(LLVMValueRef FnRef, LLVMBasicBlockRef *BasicBlocksRefs)
Obtain all of the basic blocks in a function.
Definition: Core.cpp:2789
LLVMBasicBlockRef LLVMAppendBasicBlock(LLVMValueRef FnRef, const char *Name)
Append a basic block to the end of a function using the global context.
Definition: Core.cpp:2855
LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB)
Obtain the terminator instruction for a basic block.
Definition: Core.cpp:2781
unsigned LLVMCountBasicBlocks(LLVMValueRef FnRef)
Obtain the number of basic blocks in a function.
Definition: Core.cpp:2785
void LLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to after another one.
Definition: Core.cpp:2883
LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn)
Obtain the last basic block in a function.
Definition: Core.cpp:2807
LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C, LLVMValueRef FnRef, const char *Name)
Append a basic block to the end of a function.
Definition: Core.cpp:2849
LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB)
Obtain the function to which a basic block belongs.
Definition: Core.cpp:2777
LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB)
Obtain the first instruction in a basic block.
Definition: Core.cpp:2893
LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB)
Obtain the last instruction in a basic block.
Definition: Core.cpp:2901
LLVMBasicBlockRef LLVMInsertBasicBlockInContext(LLVMContextRef C, LLVMBasicBlockRef BBRef, const char *Name)
Insert a basic block in a function before another basic block.
Definition: Core.cpp:2859
LLVMBasicBlockRef LLVMInsertBasicBlock(LLVMBasicBlockRef BBRef, const char *Name)
Insert a basic block in a function using the global context.
Definition: Core.cpp:2866
LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn)
Obtain the basic block that corresponds to the entry point of a function.
Definition: Core.cpp:2795
LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val)
Determine whether an LLVMValueRef is itself a basic block.
Definition: Core.cpp:2765
const char * LLVMGetBasicBlockName(LLVMBasicBlockRef BB)
Obtain the string name of a basic block.
Definition: Core.cpp:2773
LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB)
Go backwards in a basic block iterator.
Definition: Core.cpp:2823
LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
Create a ConstantStruct in the global Context.
Definition: Core.cpp:1662
LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, unsigned Length)
Create a ConstantArray from values.
Definition: Core.cpp:1642
LLVMValueRef LLVMConstArray2(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, uint64_t Length)
Create a ConstantArray from values.
Definition: Core.cpp:1648
LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size)
Create a ConstantVector from values.
Definition: Core.cpp:1677
LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str, unsigned Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential and initialize it with a string.
Definition: Core.cpp:1600
LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy, LLVMValueRef *ConstantVals, unsigned Count)
Create a non-anonymous ConstantStruct from values.
Definition: Core.cpp:1668
LLVMBool LLVMIsConstantString(LLVMValueRef C)
Returns true if the specified constant is an array of i8.
Definition: Core.cpp:1632
LLVMValueRef LLVMConstantPtrAuth(LLVMValueRef Ptr, LLVMValueRef Key, LLVMValueRef Disc, LLVMValueRef AddrDisc)
Create a ConstantPtrAuth constant with the given values.
Definition: Core.cpp:1682
LLVMValueRef LLVMGetAggregateElement(LLVMValueRef C, unsigned Idx)
Get element of a constant aggregate (struct, array or vector) at the specified index.
Definition: Core.cpp:1624
LLVMValueRef LLVMConstString(const char *Str, unsigned Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential with string content in the global context.
Definition: Core.cpp:1618
const char * LLVMGetAsString(LLVMValueRef C, size_t *Length)
Get the given constant data sequential as a string.
Definition: Core.cpp:1636
LLVMValueRef LLVMConstStringInContext2(LLVMContextRef C, const char *Str, size_t Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential and initialize it with a string.
Definition: Core.cpp:1609
LLVMValueRef LLVMConstStructInContext(LLVMContextRef C, LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
Create an anonymous ConstantStruct with the specified values.
Definition: Core.cpp:1654
LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition: Core.cpp:1885
LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1802
LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition: Core.cpp:1879
LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty)
Definition: Core.cpp:1747
LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition: Core.cpp:1858
LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1796
LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1779
LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition: Core.cpp:1863
LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition: Core.cpp:1853
LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal)
Definition: Core.cpp:1764
LLVMValueRef LLVMGetBlockAddressFunction(LLVMValueRef BlockAddr)
Gets the function associated with a given BlockAddress constant value.
Definition: Core.cpp:1927
LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1807
LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, LLVMValueRef IndexConstant)
Definition: Core.cpp:1891
LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant, LLVMValueRef ElementValueConstant, LLVMValueRef IndexConstant)
Definition: Core.cpp:1897
LLVMValueRef LLVMConstInBoundsGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
Definition: Core.cpp:1832
LLVMValueRef LLVMConstAddrSpaceCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition: Core.cpp:1873
LLVMBasicBlockRef LLVMGetBlockAddressBasicBlock(LLVMValueRef BlockAddr)
Gets the basic block associated with a given BlockAddress constant value.
Definition: Core.cpp:1931
LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1773
LLVMValueRef LLVMAlignOf(LLVMTypeRef Ty)
Definition: Core.cpp:1743
LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString, const char *Constraints, LLVMBool HasSideEffects, LLVMBool IsAlignStack)
Deprecated: Use LLVMGetInlineAsm instead.
Definition: Core.cpp:1915
LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1819
LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition: Core.cpp:1868
LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal)
Definition: Core.cpp:1755
LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1813
LLVMValueRef LLVMConstGEPWithNoWrapFlags(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices, LLVMGEPNoWrapFlags NoWrapFlags)
Creates a constant GetElementPtr expression.
Definition: Core.cpp:1841
LLVMValueRef LLVMConstGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
Definition: Core.cpp:1824
LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1785
LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1768
LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant, LLVMValueRef VectorBConstant, LLVMValueRef MaskConstant)
Definition: Core.cpp:1905
LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal)
Definition: Core.cpp:1751
LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB)
Definition: Core.cpp:1923
LLVMOpcode LLVMGetConstOpcode(LLVMValueRef ConstantVal)
Definition: Core.cpp:1739
LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1790
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:2181
unsigned LLVMValueMetadataEntriesGetKind(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the kind of a value metadata entry at a specific index.
Definition: Core.cpp:2162
void LLVMDisposeValueMetadataEntries(LLVMValueMetadataEntry *Entries)
Destroys value metadata entries.
Definition: Core.cpp:2177
void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz)
Definition: Core.cpp:2054
LLVMDLLStorageClass LLVMGetDLLStorageClass(LLVMValueRef Global)
Definition: Core.cpp:2059
void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes)
Set the preferred alignment of the value.
Definition: Core.cpp:2130
LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global)
Definition: Core.cpp:1937
const char * LLVMGetSection(LLVMValueRef Global)
Definition: Core.cpp:2039
LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global)
Returns the "value type" of a global value.
Definition: Core.cpp:2104
LLVMBool LLVMIsDeclaration(LLVMValueRef Global)
Definition: Core.cpp:1941
LLVMVisibility LLVMGetVisibility(LLVMValueRef Global)
Definition: Core.cpp:2049
void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class)
Definition: Core.cpp:2064
LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global)
Deprecated: Use LLVMGetUnnamedAddress instead.
Definition: Core.cpp:2094
LLVMLinkage LLVMGetLinkage(LLVMValueRef Global)
Definition: Core.cpp:1945
LLVMUnnamedAddr LLVMGetUnnamedAddress(LLVMValueRef Global)
Definition: Core.cpp:2069
LLVMMetadataRef LLVMValueMetadataEntriesGetMetadata(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the underlying metadata node of a value metadata entry at a specific index.
Definition: Core.cpp:2170
void LLVMSetUnnamedAddress(LLVMValueRef Global, LLVMUnnamedAddr UnnamedAddr)
Definition: Core.cpp:2081
void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage)
Definition: Core.cpp:1974
void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr)
Deprecated: Use LLVMSetUnnamedAddress instead.
Definition: Core.cpp:2098
void LLVMGlobalClearMetadata(LLVMValueRef Global)
Removes all metadata attachments from this value.
Definition: Core.cpp:2190
unsigned LLVMGetAlignment(LLVMValueRef V)
Obtain the preferred alignment of the value.
Definition: Core.cpp:2110
void LLVMSetSection(LLVMValueRef Global, const char *Section)
Definition: Core.cpp:2045
void LLVMGlobalEraseMetadata(LLVMValueRef Global, unsigned Kind)
Erases a metadata attachment of the given kind if it exists.
Definition: Core.cpp:2186
LLVMValueMetadataEntry * LLVMGlobalCopyAllMetadata(LLVMValueRef Value, size_t *NumEntries)
Retrieves an array of metadata entries representing the metadata attached to this value.
Definition: Core.cpp:2150
LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N, LLVMBool SignExtend)
Obtain a constant value for an integer type.
Definition: Core.cpp:1535
LLVMValueRef LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy, unsigned NumWords, const uint64_t Words[])
Obtain a constant value for an integer of arbitrary precision.
Definition: Core.cpp:1540
LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text)
Obtain a constant for a floating point value parsed from a string.
Definition: Core.cpp:1564
double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *LosesInfo)
Obtain the double value for an floating point constant value.
Definition: Core.cpp:1581
long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal)
Obtain the sign extended value for an integer constant value.
Definition: Core.cpp:1577
unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal)
Obtain the zero extended value for an integer constant value.
Definition: Core.cpp:1573
LLVMValueRef LLVMConstReal(LLVMTypeRef RealTy, double N)
Obtain a constant value referring to a double floating point value.
Definition: Core.cpp:1560
LLVMBool LLVMIsNull(LLVMValueRef Val)
Determine whether a value instance is null.
Definition: Core.cpp:1258
LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty)
Obtain a constant value referring to an undefined value of a type.
Definition: Core.cpp:1246
LLVMValueRef LLVMGetPoison(LLVMTypeRef Ty)
Obtain a constant value referring to a poison value of a type.
Definition: Core.cpp:1250
LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty)
Obtain a constant value referring to the instance of a type consisting of all ones.
Definition: Core.cpp:1242
LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty)
Obtain a constant that is a constant pointer pointing to NULL for a specified type.
Definition: Core.cpp:1272
LLVMValueRef LLVMConstNull(LLVMTypeRef Ty)
Obtain a constant value referring to the null instance of a type.
Definition: Core.cpp:1238
unsigned LLVMCountParams(LLVMValueRef FnRef)
Obtain the number of parameters in a function.
Definition: Core.cpp:2609
LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg)
Obtain the previous parameter to a function.
Definition: Core.cpp:2654
LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg)
Obtain the next parameter to a function.
Definition: Core.cpp:2646
LLVMValueRef LLVMGetParamParent(LLVMValueRef V)
Obtain the function to which this argument belongs.
Definition: Core.cpp:2626
LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn)
Obtain the first parameter to a function.
Definition: Core.cpp:2630
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align)
Set the alignment for a function parameter.
Definition: Core.cpp:2661
LLVMValueRef LLVMGetParam(LLVMValueRef FnRef, unsigned index)
Obtain the parameter at the specified index.
Definition: Core.cpp:2621
LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn)
Obtain the last parameter to a function.
Definition: Core.cpp:2638
void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs)
Obtain the parameters in a function.
Definition: Core.cpp:2615
void LLVMSetGC(LLVMValueRef Fn, const char *GC)
Define the garbage collector to use during code generation.
Definition: Core.cpp:2519
const char * LLVMGetGC(LLVMValueRef Fn)
Obtain the name of the garbage collector to use during code generation.
Definition: Core.cpp:2514
LLVMValueRef LLVMGetPrologueData(LLVMValueRef Fn)
Gets the prologue data associated with a function.
Definition: Core.cpp:2543
void LLVMRemoveEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
Definition: Core.cpp:2590
unsigned LLVMGetAttributeCountAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx)
Definition: Core.cpp:2564
LLVMBool LLVMHasPersonalityFn(LLVMValueRef Fn)
Check whether the given function has a personality function.
Definition: Core.cpp:2428
unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen)
Obtain the intrinsic ID number which matches the given function name.
Definition: Core.cpp:2496
const char * LLVMIntrinsicGetName(unsigned ID, size_t *NameLength)
Retrieves the name of an intrinsic.
Definition: Core.cpp:2460
unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn)
Obtain the calling function of a function.
Definition: Core.cpp:2505
LLVMValueRef LLVMGetPrefixData(LLVMValueRef Fn)
Gets the prefix data associated with a function.
Definition: Core.cpp:2527
void LLVMRemoveStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition: Core.cpp:2595
void LLVMSetPrefixData(LLVMValueRef Fn, LLVMValueRef prefixData)
Sets the prefix data for the function.
Definition: Core.cpp:2537
LLVMAttributeRef LLVMGetStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition: Core.cpp:2583
LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn)
Obtain the personality function attached to the function.
Definition: Core.cpp:2432
void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn)
Set the personality function attached to the function.
Definition: Core.cpp:2436
LLVMBool LLVMIntrinsicIsOverloaded(unsigned ID)
Obtain if the intrinsic identified by the given ID is overloaded.
Definition: Core.cpp:2500
void LLVMAddAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Add an attribute to a function.
Definition: Core.cpp:2559
void LLVMDeleteFunction(LLVMValueRef Fn)
Remove a function from its containing module and deletes it.
Definition: Core.cpp:2424
const char * LLVMIntrinsicCopyOverloadedName2(LLVMModuleRef Mod, unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount, size_t *NameLength)
Copies the name of an overloaded intrinsic identified by a given list of parameter types.
Definition: Core.cpp:2485
void LLVMSetPrologueData(LLVMValueRef Fn, LLVMValueRef prologueData)
Sets the prologue data for the function.
Definition: Core.cpp:2553
const char * LLVMIntrinsicCopyOverloadedName(unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount, size_t *NameLength)
Deprecated: Use LLVMIntrinsicCopyOverloadedName2 instead.
Definition: Core.cpp:2474
LLVMBool LLVMHasPrologueData(LLVMValueRef Fn)
Check if a given function has prologue data.
Definition: Core.cpp:2548
LLVMBool LLVMHasPrefixData(LLVMValueRef Fn)
Check if a given function has prefix data.
Definition: Core.cpp:2532
void LLVMGetAttributesAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
Definition: Core.cpp:2569
void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC)
Set the calling convention of a function.
Definition: Core.cpp:2509
LLVMValueRef LLVMGetIntrinsicDeclaration(LLVMModuleRef Mod, unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount)
Create or insert the declaration of an intrinsic.
Definition: Core.cpp:2451
LLVMAttributeRef LLVMGetEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
Definition: Core.cpp:2576
void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A, const char *V)
Add a target-dependent attribute to a function.
Definition: Core.cpp:2600
LLVMTypeRef LLVMIntrinsicGetType(LLVMContextRef Ctx, unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount)
Retrieves the type of an intrinsic.
Definition: Core.cpp:2467
unsigned LLVMGetIntrinsicID(LLVMValueRef Fn)
Obtain the ID number from a function instance.
Definition: Core.cpp:2440
LLVMValueKind LLVMGetValueKind(LLVMValueRef Val)
Obtain the enumerated type of a Value instance.
Definition: Core.cpp:1007
const char * LLVMGetValueName(LLVMValueRef Val)
Deprecated: Use LLVMGetValueName2 instead.
Definition: Core.cpp:1029
LLVMTypeRef LLVMTypeOf(LLVMValueRef Val)
Obtain the type of a value.
Definition: Core.cpp:1003
LLVMBool LLVMIsConstant(LLVMValueRef Ty)
Determine whether the specified value instance is constant.
Definition: Core.cpp:1254
void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal)
Replace all uses of a value with another one.
Definition: Core.cpp:1069
const char * LLVMGetValueName2(LLVMValueRef Val, size_t *Length)
Obtain the string name of a value.
Definition: Core.cpp:1019
char * LLVMPrintDbgRecordToString(LLVMDbgRecordRef Record)
Return a string representation of the DbgRecord.
Definition: Core.cpp:1055
void LLVMSetValueName(LLVMValueRef Val, const char *Name)
Deprecated: Use LLVMSetValueName2 instead.
Definition: Core.cpp:1033
void LLVMDumpValue(LLVMValueRef Val)
Dump a representation of a value to stderr.
Definition: Core.cpp:1037
LLVMBool LLVMIsUndef(LLVMValueRef Val)
Determine whether a value instance is undefined.
Definition: Core.cpp:1264
LLVMValueRef LLVMIsAMDNode(LLVMValueRef Val)
Definition: Core.cpp:1147
LLVMBool LLVMIsPoison(LLVMValueRef Val)
Determine whether a value instance is poisonous.
Definition: Core.cpp:1268
LLVMValueRef LLVMIsAMDString(LLVMValueRef Val)
Definition: Core.cpp:1162
void LLVMSetValueName2(LLVMValueRef Val, const char *Name, size_t NameLen)
Set the string name of a value.
Definition: Core.cpp:1025
LLVMValueRef LLVMIsAValueAsMetadata(LLVMValueRef Val)
Definition: Core.cpp:1155
char * LLVMPrintValueToString(LLVMValueRef Val)
Return a string representation of the value.
Definition: Core.cpp:1041
void LLVMEraseGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module and delete it.
Definition: Core.cpp:2723
void LLVMRemoveGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module.
Definition: Core.cpp:2727
LLVMValueRef LLVMGetNextGlobalIFunc(LLVMValueRef IFunc)
Advance a GlobalIFunc iterator to the next GlobalIFunc.
Definition: Core.cpp:2699
LLVMValueRef LLVMGetNamedGlobalIFunc(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalIFunc value from a Module by its name.
Definition: Core.cpp:2678
LLVMValueRef LLVMGetLastGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the last GlobalIFunc in a Module.
Definition: Core.cpp:2691
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:2668
void LLVMSetGlobalIFuncResolver(LLVMValueRef IFunc, LLVMValueRef Resolver)
Sets the resolver function associated with this indirect function.
Definition: Core.cpp:2719
LLVMValueRef LLVMGetFirstGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the first GlobalIFunc in a Module.
Definition: Core.cpp:2683
LLVMValueRef LLVMGetGlobalIFuncResolver(LLVMValueRef IFunc)
Retrieves the resolver function associated with this indirect function, or NULL if it doesn't not exi...
Definition: Core.cpp:2715
LLVMValueRef LLVMGetPreviousGlobalIFunc(LLVMValueRef IFunc)
Decrement a GlobalIFunc iterator to the previous GlobalIFunc.
Definition: Core.cpp:2707
LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca)
Obtain the type that is being allocated by the alloca instruction.
Definition: Core.cpp:3148
LLVMOperandBundleRef LLVMGetOperandBundleAtIndex(LLVMValueRef C, unsigned Index)
Obtain the operand bundle attached to this instruction at the given index.
Definition: Core.cpp:3048
LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr)
Obtain the pointer to the function invoked by this instruction.
Definition: Core.cpp:3036
void LLVMGetCallSiteAttributes(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
Definition: Core.cpp:3004
unsigned LLVMGetNumArgOperands(LLVMValueRef Instr)
Obtain the argument count for a call instruction.
Definition: Core.cpp:2966
void LLVMSetNormalDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the normal destination basic block.
Definition: Core.cpp:3087
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr)
Obtain the calling convention for a call instruction.
Definition: Core.cpp:2975
LLVMTypeRef LLVMGetCalledFunctionType(LLVMValueRef Instr)
Obtain the function type called by this instruction.
Definition: Core.cpp:3040
unsigned LLVMGetCallSiteAttributeCount(LLVMValueRef C, LLVMAttributeIndex Idx)
Definition: Core.cpp:2997
void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Definition: Core.cpp:2992
unsigned LLVMGetNumOperandBundles(LLVMValueRef C)
Obtain the number of operand bundles attached to this instruction.
Definition: Core.cpp:3044
LLVMBasicBlockRef LLVMGetCallBrIndirectDest(LLVMValueRef CallBr, unsigned Idx)
Get the indirect destination of a CallBr instruction at the given index.
Definition: Core.cpp:3108
void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC)
Set the calling convention for a call instruction.
Definition: Core.cpp:2979
LLVMAttributeRef LLVMGetCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
Definition: Core.cpp:3012
LLVMBasicBlockRef LLVMGetNormalDest(LLVMValueRef Invoke)
Return the normal destination basic block.
Definition: Core.cpp:3074
void LLVMRemoveCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
Definition: Core.cpp:3026
unsigned LLVMGetCallBrNumIndirectDests(LLVMValueRef CallBr)
Get the number of indirect destinations of a CallBr instruction.
Definition: Core.cpp:3104
void LLVMSetUnwindDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the unwind destination basic block.
Definition: Core.cpp:3091
void LLVMSetTailCall(LLVMValueRef Call, LLVMBool isTailCall)
Set whether a call instruction is a tail call.
Definition: Core.cpp:3060
LLVMBool LLVMIsTailCall(LLVMValueRef Call)
Obtain whether a call instruction is a tail call.
Definition: Core.cpp:3056
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, LLVMAttributeIndex Idx, unsigned align)
Definition: Core.cpp:2984
LLVMBasicBlockRef LLVMGetCallBrDefaultDest(LLVMValueRef CallBr)
Get the default destination of a CallBr instruction.
Definition: Core.cpp:3100
void LLVMRemoveCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition: Core.cpp:3031
LLVMTailCallKind LLVMGetTailCallKind(LLVMValueRef Call)
Obtain a tail call kind of the call instruction.
Definition: Core.cpp:3064
void LLVMSetTailCallKind(LLVMValueRef Call, LLVMTailCallKind kind)
Set the call kind of the call instruction.
Definition: Core.cpp:3068
LLVMAttributeRef LLVMGetCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
Definition: Core.cpp:3019
LLVMBasicBlockRef LLVMGetUnwindDest(LLVMValueRef Invoke)
Return the unwind destination basic block.
Definition: Core.cpp:3078
LLVMTypeRef LLVMGetGEPSourceElementType(LLVMValueRef GEP)
Get the source element type of the given GEP operator.
Definition: Core.cpp:3162
LLVMBool LLVMIsInBounds(LLVMValueRef GEP)
Check whether the given GEP operator is inbounds.
Definition: Core.cpp:3154
void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds)
Set the given GEP instruction to be inbounds or not.
Definition: Core.cpp:3158
void LLVMGEPSetNoWrapFlags(LLVMValueRef GEP, LLVMGEPNoWrapFlags NoWrapFlags)
Set the no-wrap related flags for the given GEP instruction.
Definition: Core.cpp:3171
LLVMGEPNoWrapFlags LLVMGEPGetNoWrapFlags(LLVMValueRef GEP)
Get the no-wrap related flags for the given GEP instruction.
Definition: Core.cpp:3166
const unsigned * LLVMGetIndices(LLVMValueRef Inst)
Obtain the indices as an array.
Definition: Core.cpp:3211
unsigned LLVMGetNumIndices(LLVMValueRef Inst)
Obtain the number of indices.
Definition: Core.cpp:3199
void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues, LLVMBasicBlockRef *IncomingBlocks, unsigned Count)
Add an incoming value to the end of a PHI list.
Definition: Core.cpp:3178
LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMValueRef.
Definition: Core.cpp:3189
unsigned LLVMCountIncoming(LLVMValueRef PhiNode)
Obtain the number of incoming basic blocks to a PHI node.
Definition: Core.cpp:3185
LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
Definition: Core.cpp:3193
unsigned LLVMGetNumSuccessors(LLVMValueRef Term)
Return the number of successors that this terminator has.
Definition: Core.cpp:3114
LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef Switch)
Obtain the default destination basic block of a switch instruction.
Definition: Core.cpp:3142
void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block)
Update the specified successor to point at the provided block.
Definition: Core.cpp:3122
void LLVMSetCondition(LLVMValueRef Branch, LLVMValueRef Cond)
Set the condition of a branch instruction.
Definition: Core.cpp:3136
LLVMValueRef LLVMGetCondition(LLVMValueRef Branch)
Return the condition of a branch instruction.
Definition: Core.cpp:3132
LLVMBool LLVMIsConditional(LLVMValueRef Branch)
Return if a branch is conditional.
Definition: Core.cpp:3128
LLVMBasicBlockRef LLVMGetSuccessor(LLVMValueRef Term, unsigned i)
Return the specified successor.
Definition: Core.cpp:3118
LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst)
Create a copy of 'this' instruction that is identical in all ways except the following:
Definition: Core.cpp:2955
LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst)
Obtain the instruction that occurs after the one specified.
Definition: Core.cpp:2909
void LLVMDeleteInstruction(LLVMValueRef Inst)
Delete an instruction.
Definition: Core.cpp:2933
LLVMValueRef LLVMIsATerminatorInst(LLVMValueRef Inst)
Determine whether an instruction is a terminator.
Definition: Core.cpp:2961
LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst)
Obtain the code opcode for an individual instruction.
Definition: Core.cpp:2949
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:1130
LLVMRealPredicate LLVMGetFCmpPredicate(LLVMValueRef Inst)
Obtain the float predicate of an instruction.
Definition: Core.cpp:2943
int LLVMHasMetadata(LLVMValueRef Inst)
Determine whether an instruction has any metadata attached.
Definition: Core.cpp:1073
void LLVMInstructionEraseFromParent(LLVMValueRef Inst)
Remove and delete an instruction.
Definition: Core.cpp:2929
void LLVMInstructionRemoveFromParent(LLVMValueRef Inst)
Remove an instruction.
Definition: Core.cpp:2925
LLVMValueRef LLVMGetMetadata(LLVMValueRef Inst, unsigned KindID)
Return metadata associated with an instruction value.
Definition: Core.cpp:1077
LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst)
Obtain the predicate of an instruction.
Definition: Core.cpp:2937
void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef Val)
Set metadata associated with an instruction value.
Definition: Core.cpp:1099
LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst)
Obtain the basic block to which an instruction belongs.
Definition: Core.cpp:2889
LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst)
Obtain the instruction that occurred before this one.
Definition: Core.cpp:2917
LLVMValueRef LLVMMetadataAsValue(LLVMContextRef C, LLVMMetadataRef MD)
Obtain a Metadata as a Value.
Definition: Core.cpp:1330
LLVMValueRef LLVMMDString(const char *Str, unsigned SLen)
Deprecated: Use LLVMMDStringInContext2 instead.
Definition: Core.cpp:1295
void LLVMReplaceMDNodeOperandWith(LLVMValueRef V, unsigned Index, LLVMMetadataRef Replacement)
Replace an operand at a specific index in a llvm::MDNode value.
Definition: Core.cpp:1421
LLVMMetadataRef LLVMMDStringInContext2(LLVMContextRef C, const char *Str, size_t SLen)
Create an MDString value from a given string value.
Definition: Core.cpp:1278
LLVMMetadataRef LLVMMDNodeInContext2(LLVMContextRef C, LLVMMetadataRef *MDs, size_t Count)
Create an MDNode value with the given array of operands.
Definition: Core.cpp:1283
LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str, unsigned SLen)
Deprecated: Use LLVMMDStringInContext2 instead.
Definition: Core.cpp:1288
LLVMMetadataRef LLVMValueAsMetadata(LLVMValueRef Val)
Obtain a Value as a Metadata.
Definition: Core.cpp:1334
LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals, unsigned Count)
Deprecated: Use LLVMMDNodeInContext2 instead.
Definition: Core.cpp:1299
const char * LLVMGetMDString(LLVMValueRef V, unsigned *Length)
Obtain the underlying string from a MDString value.
Definition: Core.cpp:1343
unsigned LLVMGetMDNodeNumOperands(LLVMValueRef V)
Obtain the number of operands from an MDNode value.
Definition: Core.cpp:1353
void LLVMGetMDNodeOperands(LLVMValueRef V, LLVMValueRef *Dest)
Obtain the given MDNode's operands.
Definition: Core.cpp:1408
LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count)
Deprecated: Use LLVMMDNodeInContext2 instead.
Definition: Core.cpp:1326
int LLVMGetNumOperands(LLVMValueRef Val)
Obtain the number of operands in a llvm::User value.
Definition: Core.cpp:1228
void LLVMSetOperand(LLVMValueRef Val, unsigned Index, LLVMValueRef Op)
Set an operand at a specific index in a llvm::User value.
Definition: Core.cpp:1224
LLVMUseRef LLVMGetOperandUse(LLVMValueRef Val, unsigned Index)
Obtain the use of an operand at a specific index in a llvm::User value.
Definition: Core.cpp:1219
LLVMValueRef LLVMGetOperand(LLVMValueRef Val, unsigned Index)
Obtain an operand at a specific index in a llvm::User value.
Definition: Core.cpp:1205
LLVMValueRef LLVMGetUser(LLVMUseRef U)
Obtain the user value for a user.
Definition: Core.cpp:1185
LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val)
Obtain the first use of a value.
Definition: Core.cpp:1170
LLVMUseRef LLVMGetNextUse(LLVMUseRef U)
Obtain the next use of a value.
Definition: Core.cpp:1178
LLVMValueRef LLVMGetUsedValue(LLVMUseRef U)
Obtain the value this use corresponds to.
Definition: Core.cpp:1189
#define LLVM_FOR_EACH_VALUE_SUBCLASS(macro)
Definition: Core.h:1826
void LLVMShutdown()
Deallocate and destroy all ManagedStatic variables.
Definition: Core.cpp:64
void LLVMGetVersion(unsigned *Major, unsigned *Minor, unsigned *Patch)
Return the major, minor, and patch version of LLVM.
Definition: Core.cpp:70
void LLVMDisposeMessage(char *Message)
Definition: Core.cpp:85
char * LLVMCreateMessage(const char *Message)
Definition: Core.cpp:81
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 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 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
void LLVMAliasSetAliasee(LLVMValueRef Alias, LLVMValueRef Aliasee)
Set the target value of an alias.
Definition: Core.cpp:2376
LLVMValueRef LLVMGetLastGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the last GlobalAlias in a Module.
Definition: Core.cpp:2348
LLVMValueRef LLVMGetNextGlobalAlias(LLVMValueRef GA)
Advance a GlobalAlias iterator to the next GlobalAlias.
Definition: Core.cpp:2356
LLVMValueRef LLVMAliasGetAliasee(LLVMValueRef Alias)
Retrieve the target value of an alias.
Definition: Core.cpp:2372
LLVMValueRef LLVMGetPreviousGlobalAlias(LLVMValueRef GA)
Decrement a GlobalAlias iterator to the previous GlobalAlias.
Definition: Core.cpp:2364
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:2327
LLVMValueRef LLVMGetFirstGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the first GlobalAlias in a Module.
Definition: Core.cpp:2340
LLVMValueRef LLVMGetNamedGlobalAlias(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalAlias value from a Module by its name.
Definition: Core.cpp:2335
void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant)
Definition: Core.cpp:2274
void LLVMSetThreadLocalMode(LLVMValueRef GlobalVar, LLVMThreadLocalMode Mode)
Definition: Core.cpp:2295
LLVMThreadLocalMode LLVMGetThreadLocalMode(LLVMValueRef GlobalVar)
Definition: Core.cpp:2278
LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M)
Definition: Core.cpp:2214
LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar)
Definition: Core.cpp:2230
LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar)
Definition: Core.cpp:2317
LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name)
Definition: Core.cpp:2196
LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M)
Definition: Core.cpp:2222
void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit)
Definition: Core.cpp:2321
LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar)
Definition: Core.cpp:2238
void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal)
Definition: Core.cpp:2266
LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar)
Definition: Core.cpp:2250
void LLVMDeleteGlobal(LLVMValueRef GlobalVar)
Definition: Core.cpp:2246
LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar)
Definition: Core.cpp:2262
LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar)
Definition: Core.cpp:2270
LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name, unsigned AddressSpace)
Definition: Core.cpp:2201
void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal)
Definition: Core.cpp:2257
LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name)
Definition: Core.cpp:2210
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys=std::nullopt)
Return the function type for an intrinsic.
Definition: Function.cpp:1481
std::string getNameNoUnnamedTypes(ID Id, ArrayRef< Type * > Tys)
Return the LLVM name for an intrinsic.
Definition: Function.cpp:1111
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
Definition: Function.cpp:1071
bool isOverloaded(ID id)
Returns true if the intrinsic can be overloaded.
Definition: Function.cpp:1502
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=std::nullopt)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
Definition: Function.cpp:1513
@ SingleThread
Synchronized with respect to signal handlers executing in the same thread.
Definition: LLVMContext.h:54
@ System
Synchronized with respect to all concurrently executing threads.
Definition: LLVMContext.h:57
@ OF_TextWithCRLF
The file should be opened in text mode and use a carriage linefeed '\r '.
Definition: FileSystem.h:767
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Length
Definition: DWP.cpp:480
constexpr bool llvm_is_multithreaded()
Returns true if LLVM is compiled with support for multi-threading, and false otherwise.
Definition: Threading.h:53
void initializeSafepointIRVerifierPass(PassRegistry &)
AddressSpace
Definition: NVPTXBaseInfo.h:21
void * PointerTy
Definition: GenericValue.h:21
void initializeVerifierLegacyPassPass(PassRegistry &)
OperandBundleDefT< Value * > OperandBundleDef
Definition: AutoUpgrade.h:33
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
void initializeCore(PassRegistry &)
Initialize all passes linked into the Core library.
Definition: Core.cpp:56
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc(size_t Sz)
Definition: MemAlloc.h:25
constexpr int PoisonMaskElem
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:403
void initializeDominatorTreeWrapperPassPass(PassRegistry &)
void initializePrintModulePassWrapperPass(PassRegistry &)
@ DS_Remark
@ DS_Warning
void llvm_shutdown()
llvm_shutdown - Deallocate and destroy all ManagedStatic variables.
LLVMAttributeRef wrap(Attribute Attr)
Definition: Attributes.h:315
void initializePrintFunctionPassWrapperPass(PassRegistry &)
#define N
LLVMModuleFlagBehavior Behavior
Definition: Core.cpp:326
const char * Key
Definition: Core.cpp:327
LLVMMetadataRef Metadata
Definition: Core.cpp:329
LLVMMetadataRef Metadata
Definition: Core.cpp:1107
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
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:117