44#include <system_error>
54#define DEBUG_TYPE "ir"
72 *Major = LLVM_VERSION_MAJOR;
74 *Minor = LLVM_VERSION_MINOR;
76 *Patch = LLVM_VERSION_PATCH;
82 return strdup(Message);
105 void *DiagnosticContext) {
106 unwrap(
C)->setDiagnosticHandlerCallBack(
114 unwrap(
C)->getDiagnosticHandlerCallBack());
118 return unwrap(
C)->getDiagnosticContext();
122 void *OpaqueHandle) {
125 unwrap(
C)->setYieldCallback(YieldCallback, OpaqueHandle);
129 return unwrap(
C)->shouldDiscardValueNames();
133 unwrap(
C)->setDiscardValueNames(Discard);
154 return Attribute::AttrKind::EndAttrKinds;
165 return unwrap(
A).getKindAsEnum();
170 if (Attr.isEnumAttribute())
172 return Attr.getValueAsInt();
184 return wrap(Attr.getValueAsType());
202 const char *K,
unsigned KLength,
203 const char *V,
unsigned VLength) {
210 auto S =
unwrap(
A).getKindAsString();
217 auto S =
unwrap(
A).getValueAsString();
224 return Attr.isEnumAttribute() || Attr.isIntAttribute();
228 return unwrap(
A).isStringAttribute();
232 return unwrap(
A).isTypeAttribute();
236 std::string MsgStorage;
249 switch(
unwrap(DI)->getSeverity()) {
283 auto &Str =
unwrap(M)->getModuleIdentifier();
293 auto &Str =
unwrap(M)->getSourceFileName();
304 return unwrap(M)->getDataLayoutStr().c_str();
312 unwrap(M)->setDataLayout(DataLayoutStr);
317 return unwrap(M)->getTargetTriple().c_str();
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;
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:
373 unwrap(M)->getModuleFlagsMetadata(MFEs);
377 for (
unsigned i = 0; i < MFEs.
size(); ++i) {
378 const auto &ModuleFlag = MFEs[i];
380 Result[i].Key = ModuleFlag.Key->getString().data();
381 Result[i].KeyLen = ModuleFlag.Key->getString().size();
382 Result[i].Metadata =
wrap(ModuleFlag.Val);
401 unsigned Index,
size_t *Len) {
416 const char *Key,
size_t KeyLen) {
417 return wrap(
unwrap(M)->getModuleFlag({Key, KeyLen}));
421 const char *Key,
size_t KeyLen,
424 {Key, KeyLen},
unwrap(Val));
443 char **ErrorMessage) {
447 *ErrorMessage = strdup(EC.message().c_str());
456 std::string E =
"Error printing to file: " + dest.
error().message();
457 *ErrorMessage = strdup(E.c_str());
471 return strdup(buf.c_str());
488 auto &Str =
unwrap(M)->getModuleInlineAsm();
494 size_t AsmStringSize,
const char *Constraints,
495 size_t ConstraintsSize,
LLVMBool HasSideEffects,
510 HasSideEffects, IsAlignStack, AD, CanThrow));
515 Value *Val = unwrap<Value>(InlineAsmVal);
516 const std::string &AsmString = cast<InlineAsm>(Val)->getAsmString();
518 *Len = AsmString.length();
519 return AsmString.c_str();
524 Value *Val = unwrap<Value>(InlineAsmVal);
525 const std::string &ConstraintString =
526 cast<InlineAsm>(Val)->getConstraintString();
528 *Len = ConstraintString.length();
529 return ConstraintString.c_str();
534 Value *Val = unwrap<Value>(InlineAsmVal);
549 Value *Val = unwrap<Value>(InlineAsmVal);
550 return (
LLVMTypeRef)cast<InlineAsm>(Val)->getFunctionType();
554 Value *Val = unwrap<Value>(InlineAsmVal);
555 return cast<InlineAsm>(Val)->hasSideEffects();
559 Value *Val = unwrap<Value>(InlineAsmVal);
560 return cast<InlineAsm>(Val)->isAlignStack();
564 Value *Val = unwrap<Value>(InlineAsmVal);
565 return cast<InlineAsm>(Val)->canThrow();
630 return unwrap(Ty)->isSized();
648 os <<
"Printing <null> Type";
652 return strdup(buf.c_str());
702 return unwrap<IntegerType>(IntegerTy)->getBitWidth();
769 return wrap(FunctionType::get(
unwrap(ReturnType), Tys, IsVarArg != 0));
773 return unwrap<FunctionType>(FunctionTy)->isVarArg();
777 return wrap(unwrap<FunctionType>(FunctionTy)->getReturnType());
781 return unwrap<FunctionType>(FunctionTy)->getNumParams();
786 for (
Type *
T : Ty->params())
812 if (!
Type->hasName())
814 return Type->getName().data();
820 unwrap<StructType>(StructTy)->setBody(Tys, Packed != 0);
824 return unwrap<StructType>(StructTy)->getNumElements();
828 StructType *Ty = unwrap<StructType>(StructTy);
834 StructType *Ty = unwrap<StructType>(StructTy);
839 return unwrap<StructType>(StructTy)->isPacked();
843 return unwrap<StructType>(StructTy)->isOpaque();
847 return unwrap<StructType>(StructTy)->isLiteral();
862 for (
auto *
T :
unwrap(Tp)->subtypes()) {
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());
901 return unwrap(Tp)->getNumContainedTypes();
905 return unwrap<ArrayType>(ArrayTy)->getNumElements();
909 return unwrap<ArrayType>(ArrayTy)->getNumElements();
913 return unwrap<PointerType>(
PointerTy)->getAddressSpace();
917 return unwrap<VectorType>(VectorTy)->getElementCount().getKnownMinValue();
948 unsigned TypeParamCount,
950 unsigned IntParamCount) {
966 switch(
unwrap(Val)->getValueID()) {
968#define HANDLE_VALUE(Name) \
969 case Value::Name##Val: \
970 return LLVM##Name##ValueKind;
971#include "llvm/IR/Value.def"
979 *
Length = V->getName().size();
980 return V->getName().data();
1006 os <<
"Printing <null> Value";
1010 return strdup(buf.c_str());
1020 os <<
"Printing <null> DbgRecord";
1024 return strdup(buf.c_str());
1032 return unwrap<Instruction>(Inst)->hasMetadata();
1036 auto *
I = unwrap<Instruction>(Inst);
1037 assert(
I &&
"Expected instruction");
1038 if (
auto *MD =
I->getMetadata(KindID))
1048 assert((isa<MDNode>(MD) || isa<ConstantAsMetadata>(MD)) &&
1049 "Expected a metadata node or a canonicalized constant");
1051 if (
MDNode *
N = dyn_cast<MDNode>(MD))
1060 unwrap<Instruction>(Inst)->setMetadata(KindID,
N);
1078 for (
unsigned i = 0; i < MVEs.
size(); ++i) {
1079 const auto &ModuleFlag = MVEs[i];
1080 Result[i].Kind = ModuleFlag.first;
1081 Result[i].Metadata =
wrap(ModuleFlag.second);
1083 *NumEntries = MVEs.
size();
1089 size_t *NumEntries) {
1092 unwrap<Instruction>(
Value)->getAllMetadata(Entries);
1098#define LLVM_DEFINE_VALUE_CAST(name) \
1099 LLVMValueRef LLVMIsA##name(LLVMValueRef Val) { \
1100 return wrap(static_cast<Value*>(dyn_cast_or_null<name>(unwrap(Val)))); \
1106 if (
auto *MD = dyn_cast_or_null<MetadataAsValue>(
unwrap(Val)))
1107 if (isa<MDNode>(MD->getMetadata()) ||
1108 isa<ValueAsMetadata>(MD->getMetadata()))
1114 if (
auto *MD = dyn_cast_or_null<MetadataAsValue>(
unwrap(Val)))
1115 if (isa<ValueAsMetadata>(MD->getMetadata()))
1121 if (
auto *MD = dyn_cast_or_null<MetadataAsValue>(
unwrap(Val)))
1122 if (isa<MDString>(MD->getMetadata()))
1131 if (
I == V->use_end())
1158 if (
auto *
C = dyn_cast<ConstantAsMetadata>(
Op))
1159 return wrap(
C->getValue());
1165 if (
auto *MD = dyn_cast<MetadataAsValue>(V)) {
1166 if (
auto *L = dyn_cast<ValueAsMetadata>(MD->getMetadata())) {
1167 assert(
Index == 0 &&
"Function-local metadata can only have one operand");
1168 return wrap(L->getValue());
1171 cast<MDNode>(MD->getMetadata()),
Index);
1174 return wrap(cast<User>(V)->getOperand(
Index));
1179 return wrap(&cast<User>(V)->getOperandUse(
Index));
1188 if (isa<MetadataAsValue>(V))
1191 return cast<User>(V)->getNumOperands();
1213 return isa<Constant>(
unwrap(Ty));
1218 return C->isNullValue();
1223 return isa<UndefValue>(
unwrap(Val));
1227 return isa<PoisonValue>(
unwrap(Val));
1261 for (
auto *OV :
ArrayRef(Vals, Count)) {
1266 else if (
auto *
C = dyn_cast<Constant>(V))
1268 else if (
auto *MDV = dyn_cast<MetadataAsValue>(V)) {
1269 MD = MDV->getMetadata();
1270 assert(!isa<LocalAsMetadata>(MD) &&
"Unexpected function-local metadata "
1271 "outside of direct argument to call");
1275 "Expected only one operand to function-local metadata");
1294 if (
auto *
C = dyn_cast<Constant>(V))
1296 if (
auto *MAV = dyn_cast<MetadataAsValue>(V))
1297 return wrap(MAV->getMetadata());
1302 if (
const auto *MD = dyn_cast<MetadataAsValue>(
unwrap(V)))
1303 if (
const MDString *S = dyn_cast<MDString>(MD->getMetadata())) {
1304 *
Length = S->getString().size();
1305 return S->getString().data();
1312 auto *MD = unwrap<MetadataAsValue>(V);
1313 if (isa<ValueAsMetadata>(MD->getMetadata()))
1315 return cast<MDNode>(MD->getMetadata())->getNumOperands();
1351 const char *
Name,
size_t NameLen) {
1356 const char *
Name,
size_t NameLen) {
1357 return wrap(
unwrap(M)->getOrInsertNamedMetadata({
Name, NameLen}));
1367 auto *MD = unwrap<MetadataAsValue>(V);
1368 if (
auto *MDV = dyn_cast<ValueAsMetadata>(MD->getMetadata())) {
1369 *Dest =
wrap(MDV->getValue());
1372 const auto *
N = cast<MDNode>(MD->getMetadata());
1373 const unsigned numOperands =
N->getNumOperands();
1375 for (
unsigned i = 0; i < numOperands; i++)
1381 auto *MD = cast<MetadataAsValue>(
unwrap(V));
1382 auto *
N = cast<MDNode>(MD->getMetadata());
1383 N->replaceOperandWith(
Index, unwrap<Metadata>(Replacement));
1388 return N->getNumOperands();
1399 for (
unsigned i=0;i<
N->getNumOperands();i++)
1414 if (!
Length)
return nullptr;
1416 if (
const auto *
I = dyn_cast<Instruction>(
unwrap(Val))) {
1417 if (
const auto &
DL =
I->getDebugLoc()) {
1418 S =
DL->getDirectory();
1420 }
else if (
const auto *GV = dyn_cast<GlobalVariable>(
unwrap(Val))) {
1422 GV->getDebugInfo(GVEs);
1425 S = DGV->getDirectory();
1426 }
else if (
const auto *
F = dyn_cast<Function>(
unwrap(Val))) {
1428 S = DSP->getDirectory();
1430 assert(0 &&
"Expected Instruction, GlobalVariable or Function");
1438 if (!
Length)
return nullptr;
1440 if (
const auto *
I = dyn_cast<Instruction>(
unwrap(Val))) {
1441 if (
const auto &
DL =
I->getDebugLoc()) {
1442 S =
DL->getFilename();
1444 }
else if (
const auto *GV = dyn_cast<GlobalVariable>(
unwrap(Val))) {
1446 GV->getDebugInfo(GVEs);
1449 S = DGV->getFilename();
1450 }
else if (
const auto *
F = dyn_cast<Function>(
unwrap(Val))) {
1452 S = DSP->getFilename();
1454 assert(0 &&
"Expected Instruction, GlobalVariable or Function");
1463 if (
const auto *
I = dyn_cast<Instruction>(
unwrap(Val))) {
1464 if (
const auto &
DL =
I->getDebugLoc()) {
1467 }
else if (
const auto *GV = dyn_cast<GlobalVariable>(
unwrap(Val))) {
1469 GV->getDebugInfo(GVEs);
1473 }
else if (
const auto *
F = dyn_cast<Function>(
unwrap(Val))) {
1477 assert(0 &&
"Expected Instruction, GlobalVariable or Function");
1485 if (
const auto *
I = dyn_cast<Instruction>(
unwrap(Val)))
1486 if (
const auto &
DL =
I->getDebugLoc())
1487 C =
DL->getColumn();
1495 return wrap(ConstantInt::get(unwrap<IntegerType>(IntTy),
N, SignExtend != 0));
1502 return wrap(ConstantInt::get(
1508 return wrap(ConstantInt::get(unwrap<IntegerType>(IntTy),
StringRef(Str),
1513 unsigned SLen, uint8_t Radix) {
1514 return wrap(ConstantInt::get(unwrap<IntegerType>(IntTy),
StringRef(Str, SLen),
1532 return unwrap<ConstantInt>(ConstantVal)->getZExtValue();
1536 return unwrap<ConstantInt>(ConstantVal)->getSExtValue();
1540 ConstantFP *cFP = unwrap<ConstantFP>(ConstantVal) ;
1551 APF.
convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven, &APFLosesInfo);
1552 *LosesInfo = APFLosesInfo;
1564 DontNullTerminate == 0));
1573 DontNullTerminate == 0));
1583 return wrap(unwrap<Constant>(
C)->getAggregateElement(
Idx));
1587 return wrap(unwrap<ConstantDataSequential>(
C)->getElementAsConstant(idx));
1591 return unwrap<ConstantDataSequential>(
C)->isString();
1595 StringRef Str = unwrap<ConstantDataSequential>(
C)->getAsString();
1615 Constant **Elements = unwrap<Constant>(ConstantVals, Count);
1629 Constant **Elements = unwrap<Constant>(ConstantVals, Count);
1630 StructType *Ty = unwrap<StructType>(StructTy);
1646#define HANDLE_INST(num, opc, clas) case num: return LLVM##opc;
1647#include "llvm/IR/Instruction.def"
1655#define HANDLE_INST(num, opc, clas) case LLVM##opc: return num;
1656#include "llvm/IR/Instruction.def"
1695 unwrap<Constant>(RHSConstant)));
1701 unwrap<Constant>(RHSConstant)));
1707 unwrap<Constant>(RHSConstant)));
1712 unwrap<Constant>(RHSConstant)));
1718 unwrap<Constant>(RHSConstant)));
1724 unwrap<Constant>(RHSConstant)));
1729 unwrap<Constant>(RHSConstant)));
1735 unwrap<Constant>(RHSConstant)));
1741 unwrap<Constant>(RHSConstant)));
1746 unwrap<Constant>(RHSConstant)));
1752 unwrap<Constant>(LHSConstant),
1753 unwrap<Constant>(RHSConstant)));
1759 unwrap<Constant>(LHSConstant),
1760 unwrap<Constant>(RHSConstant)));
1765 unwrap<Constant>(RHSConstant)));
1772 Constant *Val = unwrap<Constant>(ConstantVal);
1778 unsigned NumIndices) {
1781 Constant *Val = unwrap<Constant>(ConstantVal);
1826 unwrap<Constant>(IndexConstant)));
1833 unwrap<Constant>(ElementValueConstant),
1834 unwrap<Constant>(IndexConstant)));
1843 unwrap<Constant>(VectorBConstant),
1848 const char *Constraints,
1852 Constraints, HasSideEffects, IsAlignStack));
1864 return wrap(unwrap<BlockAddress>(BlockAddr)->getBasicBlock());
1874 return unwrap<GlobalValue>(
Global)->isDeclaration();
1878 switch (unwrap<GlobalValue>(
Global)->getLinkage()) {
1924 errs() <<
"LLVMSetLinkage(): LLVMLinkOnceODRAutoHideLinkage is no "
1925 "longer supported.");
1951 <<
"LLVMSetLinkage(): LLVMDLLImportLinkage is no longer supported.");
1956 <<
"LLVMSetLinkage(): LLVMDLLExportLinkage is no longer supported.");
1963 errs() <<
"LLVMSetLinkage(): LLVMGhostLinkage is no longer supported.");
1974 return unwrap<GlobalValue>(
Global)->getSection().data();
1978 unwrap<GlobalObject>(
Global)->setSection(Section);
1983 unwrap<GlobalValue>(
Global)->getVisibility());
1987 unwrap<GlobalValue>(
Global)
1993 unwrap<GlobalValue>(
Global)->getDLLStorageClass());
1997 unwrap<GlobalValue>(
Global)->setDLLStorageClass(
2002 switch (unwrap<GlobalValue>(
Global)->getUnnamedAddr()) {
2003 case GlobalVariable::UnnamedAddr::None:
2005 case GlobalVariable::UnnamedAddr::Local:
2007 case GlobalVariable::UnnamedAddr::Global:
2016 switch (UnnamedAddr) {
2027 return unwrap<GlobalValue>(
Global)->hasGlobalUnnamedAddr();
2031 unwrap<GlobalValue>(
Global)->setUnnamedAddr(
2032 HasUnnamedAddr ? GlobalValue::UnnamedAddr::Global
2033 : GlobalValue::UnnamedAddr::None);
2037 return wrap(unwrap<GlobalValue>(
Global)->getValueType());
2045 return GV->getAlign() ? GV->getAlign()->value() : 0;
2047 return AI->getAlign().value();
2048 if (
LoadInst *LI = dyn_cast<LoadInst>(
P))
2049 return LI->getAlign().value();
2051 return SI->getAlign().value();
2053 return RMWI->getAlign().value();
2055 return CXI->getAlign().value();
2058 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, "
2059 "and AtomicCmpXchgInst have alignment");
2066 else if (
AllocaInst *AI = dyn_cast<AllocaInst>(
P))
2067 AI->setAlignment(
Align(Bytes));
2068 else if (
LoadInst *LI = dyn_cast<LoadInst>(
P))
2069 LI->setAlignment(
Align(Bytes));
2070 else if (
StoreInst *SI = dyn_cast<StoreInst>(
P))
2071 SI->setAlignment(
Align(Bytes));
2073 RMWI->setAlignment(
Align(Bytes));
2075 CXI->setAlignment(
Align(Bytes));
2078 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, and "
2079 "and AtomicCmpXchgInst have alignment");
2083 size_t *NumEntries) {
2087 Instr->getAllMetadata(Entries);
2089 unwrap<GlobalObject>(
Value)->getAllMetadata(Entries);
2115 unwrap<GlobalObject>(
Global)->setMetadata(Kind, unwrap<MDNode>(MD));
2119 unwrap<GlobalObject>(
Global)->eraseMetadata(Kind);
2123 unwrap<GlobalObject>(
Global)->clearMetadata();
2138 nullptr, GlobalVariable::NotThreadLocal,
2179 unwrap<GlobalVariable>(GlobalVar)->eraseFromParent();
2190 unwrap<GlobalVariable>(GlobalVar)
2191 ->setInitializer(unwrap<Constant>(ConstantVal));
2195 return unwrap<GlobalVariable>(GlobalVar)->isThreadLocal();
2199 unwrap<GlobalVariable>(GlobalVar)->setThreadLocal(IsThreadLocal != 0);
2203 return unwrap<GlobalVariable>(GlobalVar)->isConstant();
2207 unwrap<GlobalVariable>(GlobalVar)->setConstant(IsConstant != 0);
2211 switch (unwrap<GlobalVariable>(GlobalVar)->getThreadLocalMode()) {
2212 case GlobalVariable::NotThreadLocal:
2214 case GlobalVariable::GeneralDynamicTLSModel:
2216 case GlobalVariable::LocalDynamicTLSModel:
2218 case GlobalVariable::InitialExecTLSModel:
2220 case GlobalVariable::LocalExecTLSModel:
2250 return unwrap<GlobalVariable>(GlobalVar)->isExternallyInitialized();
2254 unwrap<GlobalVariable>(GlobalVar)->setExternallyInitialized(IsExtInit);
2264 unwrap<Constant>(Aliasee),
unwrap(M)));
2268 const char *
Name,
size_t NameLen) {
2305 return wrap(unwrap<GlobalAlias>(Alias)->getAliasee());
2309 unwrap<GlobalAlias>(Alias)->setAliasee(unwrap<Constant>(Aliasee));
2341 Function *Func = unwrap<Function>(Fn);
2343 if (++
I == Func->getParent()->end())
2349 Function *Func = unwrap<Function>(Fn);
2351 if (
I == Func->getParent()->begin())
2357 unwrap<Function>(Fn)->eraseFromParent();
2361 return unwrap<Function>(Fn)->hasPersonalityFn();
2365 return wrap(unwrap<Function>(Fn)->getPersonalityFn());
2369 unwrap<Function>(Fn)->setPersonalityFn(unwrap<Constant>(PersonalityFn));
2374 return F->getIntrinsicID();
2379 assert(
ID < llvm::Intrinsic::num_intrinsics &&
"Intrinsic ID out of range");
2386 size_t ParamCount) {
2395 *NameLength = Str.size();
2409 size_t *NameLength) {
2413 *NameLength = Str.length();
2414 return strdup(Str.c_str());
2420 size_t *NameLength) {
2424 *NameLength = Str.length();
2425 return strdup(Str.c_str());
2438 return unwrap<Function>(Fn)->getCallingConv();
2442 return unwrap<Function>(Fn)->setCallingConv(
2448 return F->hasGC()?
F->getGC().c_str() :
nullptr;
2461 return wrap(
F->getPrefixData());
2466 return F->hasPrefixData();
2471 Constant *prefix = unwrap<Constant>(prefixData);
2472 F->setPrefixData(prefix);
2477 return wrap(
F->getPrologueData());
2482 return F->hasPrologueData();
2487 Constant *prologue = unwrap<Constant>(prologueData);
2488 F->setPrologueData(prologue);
2493 unwrap<Function>(
F)->addAttributeAtIndex(
Idx,
unwrap(
A));
2497 auto AS = unwrap<Function>(
F)->getAttributes().getAttributes(
Idx);
2498 return AS.getNumAttributes();
2503 auto AS = unwrap<Function>(
F)->getAttributes().getAttributes(
Idx);
2511 return wrap(unwrap<Function>(
F)->getAttributeAtIndex(
2517 const char *K,
unsigned KLen) {
2519 unwrap<Function>(
F)->getAttributeAtIndex(
Idx,
StringRef(K, KLen)));
2528 const char *K,
unsigned KLen) {
2529 unwrap<Function>(
F)->removeAttributeAtIndex(
Idx,
StringRef(K, KLen));
2534 Function *Func = unwrap<Function>(Fn);
2536 Func->addFnAttr(Attr);
2544 return unwrap<Function>(FnRef)->arg_size();
2548 Function *Fn = unwrap<Function>(FnRef);
2550 *ParamRefs++ =
wrap(&
A);
2554 Function *Fn = unwrap<Function>(FnRef);
2563 Function *Func = unwrap<Function>(Fn);
2565 if (
I == Func->arg_end())
2571 Function *Func = unwrap<Function>(Fn);
2573 if (
I == Func->arg_begin())
2581 if (
A->getArgNo() + 1 >= Fn->
arg_size())
2588 if (
A->getArgNo() == 0)
2590 return wrap(&
A->getParent()->arg_begin()[
A->getArgNo() - 1]);
2601 const char *
Name,
size_t NameLen,
2611 const char *
Name,
size_t NameLen) {
2648 return wrap(unwrap<GlobalIFunc>(IFunc)->getResolver());
2652 unwrap<GlobalIFunc>(IFunc)->setResolver(unwrap<Constant>(
Resolver));
2656 unwrap<GlobalIFunc>(IFunc)->eraseFromParent();
2660 unwrap<GlobalIFunc>(IFunc)->removeFromParent();
2698 return isa<BasicBlock>(
unwrap(Val));
2702 return wrap(unwrap<BasicBlock>(Val));
2718 return unwrap<Function>(FnRef)->size();
2722 Function *Fn = unwrap<Function>(FnRef);
2724 *BasicBlocksRefs++ =
wrap(&BB);
2728 return wrap(&unwrap<Function>(Fn)->getEntryBlock());
2732 Function *Func = unwrap<Function>(Fn);
2734 if (
I == Func->end())
2740 Function *Func = unwrap<Function>(Fn);
2742 if (
I == Func->begin())
2750 if (++
I ==
Block->getParent()->end())
2758 if (
I ==
Block->getParent()->begin())
2772 assert(CurBB &&
"current insertion point is invalid!");
2778 unwrap<Function>(Fn)->insert(unwrap<Function>(Fn)->end(),
unwrap(BB));
2844 if (++
I == Instr->getParent()->end())
2852 if (
I == Instr->getParent()->begin())
2858 unwrap<Instruction>(Inst)->removeFromParent();
2862 unwrap<Instruction>(Inst)->eraseFromParent();
2866 unwrap<Instruction>(Inst)->deleteValue();
2873 if (CE->getOpcode() == Instruction::ICmp)
2882 if (CE->getOpcode() == Instruction::FCmp)
2895 return wrap(
C->clone());
2901 return (
I &&
I->isTerminator()) ?
wrap(
I) :
nullptr;
2906 return FPI->arg_size();
2908 return unwrap<CallBase>(Instr)->arg_size();
2914 return unwrap<CallBase>(Instr)->getCallingConv();
2918 return unwrap<CallBase>(Instr)->setCallingConv(
2924 auto *Call = unwrap<CallBase>(Instr);
2927 Call->addAttributeAtIndex(
Idx, AlignAttr);
2932 unwrap<CallBase>(
C)->addAttributeAtIndex(
Idx,
unwrap(
A));
2937 auto *Call = unwrap<CallBase>(
C);
2938 auto AS = Call->getAttributes().getAttributes(
Idx);
2939 return AS.getNumAttributes();
2944 auto *Call = unwrap<CallBase>(
C);
2945 auto AS = Call->getAttributes().getAttributes(
Idx);
2953 return wrap(unwrap<CallBase>(
C)->getAttributeAtIndex(
2959 const char *K,
unsigned KLen) {
2961 unwrap<CallBase>(
C)->getAttributeAtIndex(
Idx,
StringRef(K, KLen)));
2970 const char *K,
unsigned KLen) {
2971 unwrap<CallBase>(
C)->removeAttributeAtIndex(
Idx,
StringRef(K, KLen));
2975 return wrap(unwrap<CallBase>(Instr)->getCalledOperand());
2979 return wrap(unwrap<CallBase>(Instr)->getFunctionType());
2983 return unwrap<CallBase>(
C)->getNumOperandBundles();
2995 return unwrap<CallInst>(Call)->isTailCall();
2999 unwrap<CallInst>(Call)->setTailCall(isTailCall);
3013 return wrap(unwrap<InvokeInst>(Invoke)->getNormalDest());
3018 return wrap(CRI->getUnwindDest());
3020 return wrap(CSI->getUnwindDest());
3022 return wrap(unwrap<InvokeInst>(Invoke)->getUnwindDest());
3026 unwrap<InvokeInst>(Invoke)->setNormalDest(
unwrap(
B));
3031 return CRI->setUnwindDest(
unwrap(
B));
3033 return CSI->setUnwindDest(
unwrap(
B));
3035 unwrap<InvokeInst>(Invoke)->setUnwindDest(
unwrap(
B));
3039 return wrap(unwrap<CallBrInst>(CallBr)->getDefaultDest());
3043 return unwrap<CallBrInst>(CallBr)->getNumIndirectDests();
3047 return wrap(unwrap<CallBrInst>(CallBr)->getIndirectDest(
Idx));
3053 return unwrap<Instruction>(Term)->getNumSuccessors();
3057 return wrap(unwrap<Instruction>(Term)->getSuccessor(i));
3061 return unwrap<Instruction>(Term)->setSuccessor(i,
unwrap(
block));
3067 return unwrap<BranchInst>(Branch)->isConditional();
3071 return wrap(unwrap<BranchInst>(Branch)->getCondition());
3075 return unwrap<BranchInst>(Branch)->setCondition(
unwrap(
Cond));
3081 return wrap(unwrap<SwitchInst>(Switch)->getDefaultDest());
3087 return wrap(unwrap<AllocaInst>(Alloca)->getAllocatedType());
3093 return unwrap<GEPOperator>(
GEP)->isInBounds();
3097 return unwrap<GetElementPtrInst>(
GEP)->setIsInBounds(InBounds);
3101 return wrap(unwrap<GEPOperator>(
GEP)->getSourceElementType());
3108 PHINode *PhiVal = unwrap<PHINode>(PhiNode);
3109 for (
unsigned I = 0;
I != Count; ++
I)
3114 return unwrap<PHINode>(PhiNode)->getNumIncomingValues();
3118 return wrap(unwrap<PHINode>(PhiNode)->getIncomingValue(
Index));
3122 return wrap(unwrap<PHINode>(PhiNode)->getIncomingBlock(
Index));
3129 if (
auto *
GEP = dyn_cast<GEPOperator>(
I))
3130 return GEP->getNumIndices();
3131 if (
auto *EV = dyn_cast<ExtractValueInst>(
I))
3132 return EV->getNumIndices();
3133 if (
auto *
IV = dyn_cast<InsertValueInst>(
I))
3134 return IV->getNumIndices();
3136 "LLVMGetNumIndices applies only to extractvalue and insertvalue!");
3141 if (
auto *EV = dyn_cast<ExtractValueInst>(
I))
3142 return EV->getIndices().data();
3143 if (
auto *
IV = dyn_cast<InsertValueInst>(
I))
3144 return IV->getIndices().data();
3146 "LLVMGetIndices applies only to extractvalue and insertvalue!");
3163 auto I = Instr ? unwrap<Instruction>(Instr)->getIterator() : BB->
end();
3164 unwrap(Builder)->SetInsertPoint(BB,
I);
3169 unwrap(Builder)->SetInsertPoint(
I->getParent(),
I->getIterator());
3174 unwrap(Builder)->SetInsertPoint(BB);
3178 return wrap(
unwrap(Builder)->GetInsertBlock());
3182 unwrap(Builder)->ClearInsertionPoint();
3186 unwrap(Builder)->Insert(unwrap<Instruction>(Instr));
3191 unwrap(Builder)->Insert(unwrap<Instruction>(Instr),
Name);
3201 return wrap(
unwrap(Builder)->getCurrentDebugLocation().getAsMDNode());
3206 unwrap(Builder)->SetCurrentDebugLocation(
DebugLoc(unwrap<MDNode>(Loc)));
3213 L ? cast<MDNode>(unwrap<MetadataAsValue>(L)->getMetadata()) :
nullptr;
3220 Context,
unwrap(Builder)->getCurrentDebugLocation().getAsMDNode()));
3224 unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
3228 unwrap(Builder)->AddMetadataToInst(unwrap<Instruction>(Inst));
3234 unwrap(Builder)->setDefaultFPMathTag(FPMathTag
3235 ? unwrap<MDNode>(FPMathTag)
3240 return wrap(
unwrap(Builder)->getDefaultFPMathTag());
3273 unsigned NumDests) {
3282 unsigned NumBundles,
const char *
Name) {
3285 for (
auto *Bundle :
ArrayRef(Bundles, NumBundles)) {
3291 unwrap<FunctionType>(Ty),
unwrap(Fn),
unwrap(DefaultDest),
3310 for (
auto *Bundle :
ArrayRef(Bundles, NumBundles)) {
3327 unwrap<Function>(PersFn));
3341 if (ParentPad ==
nullptr) {
3355 unsigned NumHandlers,
const char *
Name) {
3356 if (ParentPad ==
nullptr) {
3361 NumHandlers,
Name));
3366 return wrap(
unwrap(
B)->CreateCatchRet(unwrap<CatchPadInst>(CatchPad),
3372 return wrap(
unwrap(
B)->CreateCleanupRet(unwrap<CleanupPadInst>(CatchPad),
3382 unwrap<SwitchInst>(Switch)->addCase(unwrap<ConstantInt>(OnVal),
unwrap(Dest));
3386 unwrap<IndirectBrInst>(IndirectBr)->addDestination(
unwrap(Dest));
3390 return unwrap<LandingPadInst>(LandingPad)->getNumClauses();
3394 return wrap(unwrap<LandingPadInst>(LandingPad)->getClause(
Idx));
3398 unwrap<LandingPadInst>(LandingPad)->addClause(unwrap<Constant>(
ClauseVal));
3402 return unwrap<LandingPadInst>(LandingPad)->isCleanup();
3406 unwrap<LandingPadInst>(LandingPad)->setCleanup(Val);
3410 unwrap<CatchSwitchInst>(CatchSwitch)->addHandler(
unwrap(Dest));
3414 return unwrap<CatchSwitchInst>(CatchSwitch)->getNumHandlers();
3420 *Handlers++ =
wrap(
H);
3424 return wrap(unwrap<CatchPadInst>(CatchPad)->getCatchSwitch());
3428 unwrap<CatchPadInst>(CatchPad)
3429 ->setCatchSwitch(unwrap<CatchSwitchInst>(CatchSwitch));
3435 return wrap(unwrap<FuncletPadInst>(Funclet)->getArgOperand(i));
3439 unwrap<FuncletPadInst>(Funclet)->setArgOperand(i,
unwrap(
value));
3626 if (
auto *
I = dyn_cast<BinaryOperator>(Neg))
3627 I->setHasNoUnsignedWrap();
3640 Value *
P = unwrap<Value>(ArithInst);
3641 return cast<Instruction>(
P)->hasNoUnsignedWrap();
3645 Value *
P = unwrap<Value>(ArithInst);
3646 cast<Instruction>(
P)->setHasNoUnsignedWrap(HasNUW);
3650 Value *
P = unwrap<Value>(ArithInst);
3651 return cast<Instruction>(
P)->hasNoSignedWrap();
3655 Value *
P = unwrap<Value>(ArithInst);
3656 cast<Instruction>(
P)->setHasNoSignedWrap(HasNSW);
3660 Value *
P = unwrap<Value>(DivOrShrInst);
3661 return cast<Instruction>(
P)->isExact();
3665 Value *
P = unwrap<Value>(DivOrShrInst);
3666 cast<Instruction>(
P)->setIsExact(IsExact);
3670 Value *
P = unwrap<Value>(NonNegInst);
3671 return cast<Instruction>(
P)->hasNonNeg();
3675 Value *
P = unwrap<Value>(NonNegInst);
3676 cast<Instruction>(
P)->setNonNeg(IsNonNeg);
3680 Value *
P = unwrap<Value>(FPMathInst);
3686 Value *
P = unwrap<Value>(FPMathInst);
3691 Value *Val = unwrap<Value>(V);
3692 return isa<FPMathOperator>(Val);
3696 Value *
P = unwrap<Value>(Inst);
3697 return cast<PossiblyDisjointInst>(
P)->isDisjoint();
3701 Value *
P = unwrap<Value>(Inst);
3702 cast<PossiblyDisjointInst>(
P)->setIsDisjoint(IsDisjoint);
3782 return AtomicOrdering::AcquireRelease;
3784 return AtomicOrdering::SequentiallyConsistent;
3797 case AtomicOrdering::AcquireRelease:
3799 case AtomicOrdering::SequentiallyConsistent:
3872 unsigned NumIndices,
const char *
Name) {
3879 unsigned NumIndices,
const char *
Name) {
3904 if (
LoadInst *LI = dyn_cast<LoadInst>(
P))
3905 return LI->isVolatile();
3907 return SI->isVolatile();
3909 return AI->isVolatile();
3910 return cast<AtomicCmpXchgInst>(
P)->isVolatile();
3915 if (
LoadInst *LI = dyn_cast<LoadInst>(
P))
3916 return LI->setVolatile(isVolatile);
3918 return SI->setVolatile(isVolatile);
3920 return AI->setVolatile(isVolatile);
3921 return cast<AtomicCmpXchgInst>(
P)->setVolatile(isVolatile);
3925 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->isWeak();
3929 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->setWeak(isWeak);
3935 if (
LoadInst *LI = dyn_cast<LoadInst>(
P))
3936 O = LI->getOrdering();
3937 else if (
StoreInst *SI = dyn_cast<StoreInst>(
P))
3938 O = SI->getOrdering();
3939 else if (
FenceInst *FI = dyn_cast<FenceInst>(
P))
3940 O = FI->getOrdering();
3942 O = cast<AtomicRMWInst>(
P)->getOrdering();
3950 if (
LoadInst *LI = dyn_cast<LoadInst>(
P))
3951 return LI->setOrdering(O);
3952 else if (
FenceInst *FI = dyn_cast<FenceInst>(
P))
3953 return FI->setOrdering(O);
3955 return ARWI->setOrdering(O);
3956 return cast<StoreInst>(
P)->setOrdering(O);
4084 unwrap(Src), SrcIsSigned,
unwrap(DestTy), DestIsSigned));
4121 unsigned NumBundles,
const char *
Name) {
4124 for (
auto *Bundle :
ArrayRef(Bundles, NumBundles)) {
4225 return I->getShuffleMask().size();
4231 return I->getMaskValue(Elt);
4241 else if (
FenceInst *FI = dyn_cast<FenceInst>(
P))
4243 else if (
StoreInst *SI = dyn_cast<StoreInst>(
P))
4245 else if (
LoadInst *LI = dyn_cast<LoadInst>(
P))
4247 return cast<AtomicCmpXchgInst>(
P)->getSyncScopeID() ==
4256 return I->setSyncScopeID(SSID);
4257 else if (
FenceInst *FI = dyn_cast<FenceInst>(
P))
4258 return FI->setSyncScopeID(SSID);
4259 else if (
StoreInst *SI = dyn_cast<StoreInst>(
P))
4260 return SI->setSyncScopeID(SSID);
4261 else if (
LoadInst *LI = dyn_cast<LoadInst>(
P))
4262 return LI->setSyncScopeID(SSID);
4263 return cast<AtomicCmpXchgInst>(
P)->setSyncScopeID(SSID);
4276 return cast<AtomicCmpXchgInst>(
P)->setSuccessOrdering(O);
4289 return cast<AtomicCmpXchgInst>(
P)->setFailureOrdering(O);
4309 char **OutMessage) {
4312 if (std::error_code EC = MBOrErr.
getError()) {
4313 *OutMessage = strdup(EC.message().c_str());
4316 *OutMemBuf =
wrap(MBOrErr.
get().release());
4321 char **OutMessage) {
4323 if (std::error_code EC = MBOrErr.
getError()) {
4324 *OutMessage = strdup(EC.message().c_str());
4327 *OutMemBuf =
wrap(MBOrErr.
get().release());
4332 const char *InputData,
4333 size_t InputDataLength,
4334 const char *BufferName,
4339 RequiresNullTerminator).
release());
4343 const char *InputData,
4344 size_t InputDataLength,
4345 const char *BufferName) {
4353 return unwrap(MemBuf)->getBufferStart();
4357 return unwrap(MemBuf)->getBufferSize();
4380 return unwrap<legacy::PassManager>(PM)->run(*
unwrap(M));
4384 return unwrap<legacy::FunctionPassManager>(FPM)->doInitialization();
4388 return unwrap<legacy::FunctionPassManager>(FPM)->run(*unwrap<Function>(
F));
4392 return unwrap<legacy::FunctionPassManager>(FPM)->doFinalization();
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
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.
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
static Function * getFunction(Constant *C)
static char getTypeID(Type *Ty)
LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef C, unsigned idx)
static Module::ModFlagBehavior map_to_llvmModFlagBehavior(LLVMModuleFlagBehavior Behavior)
#define LLVM_DEFINE_VALUE_CAST(name)
static LLVMValueMetadataEntry * llvm_getMetadata(size_t *NumEntries, llvm::function_ref< void(MetadataEntries &)> AccessMD)
static MDNode * extractMDNode(MetadataAsValue *MAV)
static LLVMOpcode map_to_llvmopcode(int opcode)
static LLVMFastMathFlags mapToLLVMFastMathFlags(FastMathFlags FMF)
static FastMathFlags mapFromLLVMFastMathFlags(LLVMFastMathFlags FMF)
LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char Str[], uint8_t Radix)
static AtomicOrdering mapFromLLVMOrdering(LLVMAtomicOrdering Ordering)
static Intrinsic::ID llvm_map_to_intrinsic_id(unsigned ID)
static LLVMModuleFlagBehavior map_from_llvmModFlagBehavior(Module::ModFlagBehavior Behavior)
static LLVMAtomicOrdering mapToLLVMOrdering(AtomicOrdering Ordering)
LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
static LLVMValueRef getMDNodeOperandImpl(LLVMContext &Context, const MDNode *N, unsigned Index)
LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const char Str[], unsigned SLen)
static int map_from_llvmopcode(LLVMOpcode code)
static LLVMAtomicRMWBinOp mapToLLVMRMWBinOp(AtomicRMWInst::BinOp BinOp)
static AtomicRMWInst::BinOp mapFromLLVMRMWBinOp(LLVMAtomicRMWBinOp BinOp)
LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal)
LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const char Str[], unsigned SLen, uint8_t Radix)
static LLVMContext & getGlobalContext()
BasicBlock ** unwrap(LLVMBasicBlockRef *BBs)
Module.h This file contains the declarations for the Module class.
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)
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.
static const uint32_t IV[8]
opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
double convertToDouble() const
Converts this APFloat to host double value.
Class for arbitrary precision integers.
an instruction to allocate memory on the stack
This class represents an incoming formal argument to a Function.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
An instruction that atomically checks whether a specified value is in a memory location,...
an instruction that atomically reads a memory location, combines it with another value,...
BinOp
This enumeration lists the possible modifications atomicrmw can make.
@ Min
*p = old <signed v ? old : v
@ UIncWrap
Increment one up to a maximum value.
@ Max
*p = old >signed v ? old : v
@ UMin
*p = old <unsigned v ? old : v
@ FMin
*p = minnum(old, v) minnum matches the behavior of llvm.minnum.
@ UMax
*p = old >unsigned v ? old : v
@ FMax
*p = maxnum(old, v) maxnum matches the behavior of llvm.maxnum.
@ UDecWrap
Decrement one until a minimum value or zero.
static Attribute::AttrKind getAttrKindFromName(StringRef AttrName)
static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
static Attribute getWithAlignment(LLVMContext &Context, Align Alignment)
Return a uniquified Attribute object that has the specific alignment set.
LLVM Basic Block Representation.
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.
void setIsNewDbgInfoFormat(bool NewFlag)
Ensure the block is in "old" dbg.value format (NewFlag == false) or in the new format (NewFlag == tru...
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
void moveAfter(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it right after MovePos in the function M...
void removeFromParent()
Unlink 'this' from the containing function, but do not delete it.
const Function * getParent() const
Return the enclosing method, or null if none.
SymbolTableList< BasicBlock >::iterator eraseFromParent()
Unlink 'this' from the containing function and delete it.
InstListType::iterator iterator
Instruction iterators...
LLVMContext & getContext() const
Get the context in which this basic block lives.
bool IsNewDbgInfoFormat
Flag recording whether or not this block stores debug-info in the form of intrinsic instructions (fal...
void moveBefore(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it into the function that MovePos lives ...
static BlockAddress * get(Function *F, BasicBlock *BB)
Return a BlockAddress for the specified function and basic block.
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.
static Constant * get(ArrayType *T, ArrayRef< Constant * > V)
static Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true)
This method constructs a CDS and initializes it with a text string.
A constant value that is initialized with an expression using other constant values.
static Constant * getFCmp(unsigned short pred, Constant *LHS, Constant *RHS, bool OnlyIfReduced=false)
static Constant * getIntToPtr(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static Constant * getExtractElement(Constant *Vec, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
static Constant * getAlignOf(Type *Ty)
getAlignOf constant expr - computes the alignment of a type in a target independent way (Note: the re...
static Constant * getNUWSub(Constant *C1, Constant *C2)
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList)
Create an "inbounds" getelementptr.
static Constant * getPointerCast(Constant *C, Type *Ty)
Create a BitCast, AddrSpaceCast, or a PtrToInt cast constant expression.
static Constant * getTruncOrBitCast(Constant *C, Type *Ty)
static Constant * getNSWAdd(Constant *C1, Constant *C2)
static Constant * getSub(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
static Constant * getNot(Constant *C)
static Constant * getInsertElement(Constant *Vec, Constant *Elt, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
static Constant * getPtrToInt(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static Constant * getICmp(unsigned short pred, Constant *LHS, Constant *RHS, bool OnlyIfReduced=false)
get* - Return some common constants without having to specify the full Instruction::OPCODE identifier...
static Constant * getGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList, bool InBounds=false, std::optional< ConstantRange > InRange=std::nullopt, Type *OnlyIfReducedTy=nullptr)
Getelementptr form.
static Constant * getShuffleVector(Constant *V1, Constant *V2, ArrayRef< int > Mask, Type *OnlyIfReducedTy=nullptr)
static Constant * getSizeOf(Type *Ty)
getSizeOf constant expr - computes the (alloc) size of a type (in address-units, not bits) in a targe...
static Constant * getXor(Constant *C1, Constant *C2)
static Constant * getMul(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
static Constant * getNSWNeg(Constant *C)
static Constant * getNSWSub(Constant *C1, Constant *C2)
static Constant * getShl(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
static Constant * getNUWAdd(Constant *C1, Constant *C2)
static Constant * getAddrSpaceCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static Constant * getAdd(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
static Constant * getBitCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static Constant * getNSWMul(Constant *C1, Constant *C2)
static Constant * getNeg(Constant *C, bool HasNSW=false)
static Constant * getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static Constant * getNUWMul(Constant *C1, Constant *C2)
ConstantFP - Floating Point Values [float, double].
const APFloat & getValueAPF() const
static ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
This class represents a range of values.
static Constant * get(StructType *T, ArrayRef< Constant * > V)
static Constant * getAnon(ArrayRef< Constant * > V, bool Packed=false)
Return an anonymous struct that has the specified elements.
static Constant * get(ArrayRef< Constant * > V)
This is an important base class in LLVM.
static Constant * getAllOnesValue(Type *Ty)
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
This class represents an Operation in the Expression.
Basic diagnostic printer that uses an underlying raw_ostream.
Represents either an error or a value T.
std::error_code getError() const
This instruction compares its operands according to the predicate given to the constructor.
Convenience struct for specifying and reasoning about fast-math flags.
void setAllowContract(bool B=true)
bool noSignedZeros() const
void setAllowReciprocal(bool B=true)
bool allowReciprocal() const
void setNoSignedZeros(bool B=true)
bool allowReassoc() const
Flag queries.
void setNoNaNs(bool B=true)
void setAllowReassoc(bool B=true)
Flag setters.
void setApproxFunc(bool B=true)
void setNoInfs(bool B=true)
bool allowContract() const
An instruction for ordering other memory operations.
static FixedVectorType * get(Type *ElementType, unsigned NumElts)
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
BasicBlockListType::iterator iterator
static Intrinsic::ID lookupIntrinsicID(StringRef Name)
This does the actual lookup of an intrinsic ID which matches the given function name.
iterator_range< arg_iterator > args()
void setPersonalityFn(Constant *Fn)
Function::iterator insert(Function::iterator Position, BasicBlock *BB)
Insert BB in the basic block list at Position.
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...
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...
void setUnnamedAddr(UnnamedAddr Val)
void setThreadLocalMode(ThreadLocalMode Val)
void setLinkage(LinkageTypes LT)
DLLStorageClassTypes
Storage classes of global values for PE targets.
Module * getParent()
Get the module that this global value is contained inside of...
VisibilityTypes
An enumeration for the kinds of visibility of global values.
@ PrivateLinkage
Like Internal, but omit from symbol table.
@ CommonLinkage
Tentative definitions.
@ InternalLinkage
Rename collisions when linking (static functions).
@ LinkOnceAnyLinkage
Keep one copy of function when linking (inline)
@ WeakODRLinkage
Same, but only replaced by something equivalent.
@ ExternalLinkage
Externally visible function.
@ WeakAnyLinkage
Keep one copy of named function when linking (weak)
@ AppendingLinkage
Special purpose, only applies to global arrays.
@ AvailableExternallyLinkage
Available for inspection, not emission.
@ ExternalWeakLinkage
ExternalWeak linkage description.
@ LinkOnceODRLinkage
Same, but only replaced by something equivalent.
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.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
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.
Class to represent integer types.
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
This is an important class for using LLVM in a threaded context.
void(*)(LLVMContext *Context, void *OpaqueHandle) YieldCallbackTy
Defines the type of a yield callback.
An instruction for reading from memory.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static MDString * get(LLVMContext &Context, StringRef Str)
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.
A Module instance is used to store all the information related to an LLVM module.
global_iterator global_begin()
ifunc_iterator ifunc_begin()
ModFlagBehavior
This enumeration defines the supported behaviors of module flags.
global_iterator global_end()
NamedMDListType::iterator named_metadata_iterator
The named metadata iterators.
IFuncListType::iterator ifunc_iterator
The Global IFunc iterators.
named_metadata_iterator named_metadata_begin()
ifunc_iterator ifunc_end()
alias_iterator alias_end()
alias_iterator alias_begin()
FunctionListType::iterator iterator
The Function iterators.
GlobalListType::iterator global_iterator
The Global Variable iterator.
AliasListType::iterator alias_iterator
The Global Alias iterators.
named_metadata_iterator named_metadata_end()
StringRef getName() const
Module * getParent()
Get the module that holds this named metadata collection.
A container for an operand bundle being viewed as a set of values rather than a set of uses.
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
static PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
A global registry used in conjunction with static constructors to make pluggable components (like tar...
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
static ScalableVectorType * get(Type *ElementType, unsigned MinNumElts)
This instruction constructs a fixed permutation of two input vectors.
ArrayRef< int > getShuffleMask() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An instruction for storing to memory.
StringRef - Represent a constant reference to a string, i.e.
constexpr size_t size() const
size - Get the string size.
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Class to represent struct types.
static StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
ArrayRef< Type * > elements() const
static StructType * getTypeByName(LLVMContext &C, StringRef Name)
Return the type with the specified name, or null if there is none by that name.
static StructType * create(LLVMContext &Context, StringRef Name)
This creates an identified struct.
Type * getTypeAtIndex(const Value *V) const
Given an index value into the type, return the type of the element.
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.
Triple - Helper class for working with autoconf configuration names.
The instances of the Type class are immutable: once they are created, they are never changed.
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.
static Type * getX86_AMXTy(LLVMContext &C)
bool isBFloatTy() const
Return true if this is 'bfloat', a 16-bit bfloat type.
static Type * getMetadataTy(LLVMContext &C)
@ X86_MMXTyID
MMX vectors (64 bits, X86 specific)
@ X86_AMXTyID
AMX vectors (8192 bits, X86 specific)
@ TypedPointerTyID
Typed pointer used by some GPU targets.
@ HalfTyID
16-bit floating point type
@ TargetExtTyID
Target extension type.
@ VoidTyID
type with no size
@ ScalableVectorTyID
Scalable SIMD vector type.
@ FloatTyID
32-bit floating point type
@ IntegerTyID
Arbitrary bit width integers.
@ FixedVectorTyID
Fixed width SIMD vector type.
@ BFloatTyID
16-bit floating point type (7-bit significand)
@ DoubleTyID
64-bit floating point type
@ X86_FP80TyID
80-bit floating point type (X87)
@ PPC_FP128TyID
128-bit floating point type (two 64-bits, PowerPC)
@ FP128TyID
128-bit floating point type (112-bit significand)
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.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
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.
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.
A Use represents the edge between a Value definition and its users.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
void setName(const Twine &Name)
Change the name of the value.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
use_iterator_impl< Use > use_iterator
LLVMContext & getContext() const
All values hold a context through their type.
StringRef getName() const
Return a constant reference to the value's name.
An efficient, type-erasing, non-owning reference to a callable.
self_iterator getIterator()
FunctionPassManager manages FunctionPasses.
PassManager manages ModulePassManagers.
A raw_ostream that writes to a file descriptor.
bool has_error() const
Return the value of the flag in this raw_fd_ostream indicating whether an output error has been encou...
std::error_code error() const
void close()
Manually flush the stream and close the file.
A raw_ostream that writes to an std::string.
LLVMContextRef LLVMGetGlobalContext()
Obtain the global context instance.
unsigned LLVMGetEnumAttributeKind(LLVMAttributeRef A)
Get the unique id corresponding to the enum attribute passed as argument.
void LLVMContextSetDiscardValueNames(LLVMContextRef C, LLVMBool Discard)
Set whether the given context discards all value names.
uint64_t LLVMGetEnumAttributeValue(LLVMAttributeRef A)
Get the enum attribute's value.
LLVMTypeRef LLVMGetTypeAttributeValue(LLVMAttributeRef A)
Get the type attribute's value.
unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char *Name, unsigned SLen)
LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI)
Return an enum LLVMDiagnosticSeverity.
char * LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI)
Return a string representation of the DiagnosticInfo.
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.
LLVMDiagnosticHandler LLVMContextGetDiagnosticHandler(LLVMContextRef C)
Get the diagnostic handler of this context.
LLVMBool LLVMContextShouldDiscardValueNames(LLVMContextRef C)
Retrieve whether the given context is set to discard all value names.
LLVMAttributeRef LLVMCreateTypeAttribute(LLVMContextRef C, unsigned KindID, LLVMTypeRef type_ref)
Create a type attribute.
LLVMAttributeRef LLVMCreateStringAttribute(LLVMContextRef C, const char *K, unsigned KLength, const char *V, unsigned VLength)
Create a string attribute.
LLVMAttributeRef LLVMCreateConstantRangeAttribute(LLVMContextRef C, unsigned KindID, unsigned NumBits, const uint64_t LowerWords[], const uint64_t UpperWords[])
Create a ConstantRange attribute.
void LLVMContextDispose(LLVMContextRef C)
Destroy a context instance.
LLVMAttributeRef LLVMCreateEnumAttribute(LLVMContextRef C, unsigned KindID, uint64_t Val)
Create an enum attribute.
const char * LLVMGetStringAttributeKind(LLVMAttributeRef A, unsigned *Length)
Get the string attribute's kind.
LLVMTypeRef LLVMGetTypeByName2(LLVMContextRef C, const char *Name)
Obtain a Type from a context by its registered name.
LLVMContextRef LLVMContextCreate()
Create a new context.
void(* LLVMYieldCallback)(LLVMContextRef, void *)
unsigned LLVMGetLastEnumAttributeKind(void)
LLVMBool LLVMIsStringAttribute(LLVMAttributeRef A)
LLVMBool LLVMIsTypeAttribute(LLVMAttributeRef A)
const char * LLVMGetStringAttributeValue(LLVMAttributeRef A, unsigned *Length)
Get the string attribute's value.
void LLVMContextSetYieldCallback(LLVMContextRef C, LLVMYieldCallback Callback, void *OpaqueHandle)
Set the yield callback function for this context.
unsigned LLVMGetMDKindID(const char *Name, unsigned SLen)
void LLVMContextSetDiagnosticHandler(LLVMContextRef C, LLVMDiagnosticHandler Handler, void *DiagnosticContext)
Set the diagnostic handler for this context.
void(* LLVMDiagnosticHandler)(LLVMDiagnosticInfoRef, void *)
void * LLVMContextGetDiagnosticContext(LLVMContextRef C)
Get the diagnostic context of this context.
LLVMBool LLVMIsEnumAttribute(LLVMAttributeRef A)
Check for the different types of attributes.
LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name)
LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str, const char *Name)
LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, LLVMBool isSingleThread, const char *Name)
LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, LLVMBool singleThread)
LLVMBool LLVMGetIsDisjoint(LLVMValueRef Inst)
Gets whether the instruction has the disjoint flag set.
LLVMValueRef LLVMBuildNot(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
LLVMValueRef LLVMBuildInvokeWithOperandBundles(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name)
LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildAnd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildFPExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
void LLVMClearInsertionPosition(LLVMBuilderRef Builder)
LLVMValueRef LLVMBuildFDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak)
void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW)
LLVMValueRef LLVMBuildFreeze(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildFMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildZExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMBuildSExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMBuildSExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMBuildBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
void LLVMBuilderSetDefaultFPMathTag(LLVMBuilderRef Builder, LLVMMetadataRef FPMathTag)
Set the default floating-point math metadata for the given builder.
LLVMValueRef LLVMBuildExtractValue(LLVMBuilderRef B, LLVMValueRef AggVal, unsigned Index, const char *Name)
LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef B, LLVMRealPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
void LLVMSetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
LLVMValueRef LLVMBuildFPTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMAtomicOrdering LLVMGetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst)
LLVMOpcode LLVMGetCastOpcode(LLVMValueRef Src, LLVMBool SrcIsSigned, LLVMTypeRef DestTy, LLVMBool DestIsSigned)
LLVMAtomicRMWBinOp LLVMGetAtomicRMWBinOp(LLVMValueRef Inst)
void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW)
LLVMValueRef LLVMBuildSIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMBuildShl(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Builder, LLVMMetadataRef Loc)
Set location information used by debugging information.
int LLVMGetUndefMaskElem(void)
LLVMBool LLVMGetWeak(LLVMValueRef CmpXchgInst)
LLVMValueRef LLVMBuildFRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
LLVMValueRef LLVMBuildSelect(LLVMBuilderRef B, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, const char *Name)
LLVMValueRef LLVMBuildCatchPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
void LLVMSetIsDisjoint(LLVMValueRef Inst, LLVMBool IsDisjoint)
Sets the disjoint flag for the instruction.
LLVMValueRef LLVMBuildMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildExactSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
LLVMValueRef LLVMBuildIsNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PersFn, unsigned NumClauses, const char *Name)
LLVMValueRef LLVMBuildAggregateRet(LLVMBuilderRef B, LLVMValueRef *RetVals, unsigned N)
LLVMValueRef LLVMBuildAShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, const char *Name)
LLVMValueRef LLVMBuildCallWithOperandBundles(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name)
LLVMValueRef LLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering)
void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val)
LLVMValueRef LLVMGetArgOperand(LLVMValueRef Funclet, unsigned i)
LLVMValueRef LLVMBuildInsertValue(LLVMBuilderRef B, LLVMValueRef AggVal, LLVMValueRef EltVal, unsigned Index, const char *Name)
LLVMValueRef LLVMBuildAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
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.
LLVMValueRef LLVMBuildBr(LLVMBuilderRef B, LLVMBasicBlockRef Dest)
LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildSRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
void LLVMDisposeBuilder(LLVMBuilderRef Builder)
int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt)
Get the mask value at position Elt in the mask of a ShuffleVector instruction.
LLVMValueRef LLVMBuildFSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx)
LLVMMetadataRef LLVMGetCurrentDebugLocation2(LLVMBuilderRef Builder)
Get location information used by debugging information.
LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
LLVMValueRef LLVMBuildVAArg(LLVMBuilderRef B, LLVMValueRef List, LLVMTypeRef Ty, const char *Name)
LLVMBuilderRef LLVMCreateBuilderInContext(LLVMContextRef C)
LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, LLVMBool singleThread)
LLVMValueRef LLVMBuildICmp(LLVMBuilderRef B, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMGetParentCatchSwitch(LLVMValueRef CatchPad)
Get the parent catchswitch instruction of a catchpad instruction.
void LLVMSetAtomicSingleThread(LLVMValueRef AtomicInst, LLVMBool NewValue)
LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMBuildURem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
void LLVMSetAtomicRMWBinOp(LLVMValueRef Inst, LLVMAtomicRMWBinOp BinOp)
LLVMValueRef LLVMBuildCall2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal)
LLVMValueRef LLVMBuildOr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMBool LLVMGetNUW(LLVMValueRef ArithInst)
LLVMValueRef LLVMBuildAddrSpaceCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
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)
LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L)
Deprecated: Passing the NULL location will crash.
LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMBuildIntCast2(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, LLVMBool IsSigned, const char *Name)
LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
LLVMMetadataRef LLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder)
Get the dafult floating-point math metadata for a given builder.
LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
void LLVMSetParentCatchSwitch(LLVMValueRef CatchPad, LLVMValueRef CatchSwitch)
Set the parent catchswitch instruction of a catchpad instruction.
LLVMValueRef LLVMBuildCatchRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
LLVMValueRef LLVMBuildStructGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, unsigned Idx, const char *Name)
unsigned LLVMGetNumClauses(LLVMValueRef LandingPad)
LLVMBool LLVMGetNNeg(LLVMValueRef NonNegInst)
Gets if the instruction has the non-negative flag set.
LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildStore(LLVMBuilderRef B, LLVMValueRef Val, LLVMValueRef PointerVal)
LLVMValueRef LLVMBuildCatchSwitch(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMBasicBlockRef UnwindBB, unsigned NumHandlers, const char *Name)
LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Deprecated: This cast is always signed.
LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMBuildInBoundsGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers)
Obtain the basic blocks acting as handlers for a catchswitch instruction.
LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemAccessInst)
LLVMValueRef LLVMBuildUIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMBuildIntToPtr(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef B, LLVMValueRef If, LLVMBasicBlockRef Then, LLVMBasicBlockRef Else)
LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr, unsigned NumDests)
void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest)
LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
LLVMValueRef LLVMBuildXor(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildGlobalString(LLVMBuilderRef B, const char *Str, const char *Name)
LLVMBool LLVMGetExact(LLVMValueRef DivOrShrInst)
LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value)
LLVMValueRef LLVMBuildMemCpy(LLVMBuilderRef B, LLVMValueRef Dst, unsigned DstAlign, LLVMValueRef Src, unsigned SrcAlign, LLVMValueRef Size)
Creates and inserts a memcpy between the specified pointers.
LLVMValueRef LLVMBuildPtrDiff2(LLVMBuilderRef B, LLVMTypeRef ElemTy, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
void LLVMSetInstDebugLocation(LLVMBuilderRef Builder, LLVMValueRef Inst)
Attempts to set the debug location for the given instruction using the current debug location for the...
void LLVMAddMetadataToInst(LLVMBuilderRef Builder, LLVMValueRef Inst)
Adds the metadata registered with the given builder to the given instruction.
LLVMValueRef LLVMBuildSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef B)
LLVMValueRef LLVMBuildShuffleVector(LLVMBuilderRef B, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, const char *Name)
void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile)
LLVMValueRef LLVMBuildFree(LLVMBuilderRef B, LLVMValueRef PointerVal)
LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch)
LLVMValueRef LLVMBuildFPCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMBuilderRef LLVMCreateBuilder(void)
void LLVMSetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
LLVMValueRef LLVMBuildPhi(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
LLVMBool LLVMCanValueUseFastMathFlags(LLVMValueRef V)
Check if a given value can potentially have fast math flags.
void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal, LLVMBasicBlockRef Dest)
LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst)
LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn)
LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef B, LLVMValueRef V, LLVMBasicBlockRef Else, unsigned NumCases)
void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr)
LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMBool LLVMIsCleanup(LLVMValueRef LandingPad)
LLVMBool LLVMGetNSW(LLVMValueRef ArithInst)
LLVMValueRef LLVMBuildMemMove(LLVMBuilderRef B, LLVMValueRef Dst, unsigned DstAlign, LLVMValueRef Src, unsigned SrcAlign, LLVMValueRef Size)
Creates and inserts a memmove between the specified pointers.
LLVMValueRef LLVMBuildLShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
unsigned LLVMGetNumMaskElements(LLVMValueRef SVInst)
Get the number of elements in the mask of a ShuffleVector instruction.
LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef B)
LLVMValueRef LLVMBuildRet(LLVMBuilderRef B, LLVMValueRef V)
void LLVMAddHandler(LLVMValueRef CatchSwitch, LLVMBasicBlockRef Dest)
LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef Index, const char *Name)
void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr)
LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder)
Deprecated: Returning the NULL location will crash.
LLVMAtomicOrdering LLVMGetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst)
void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg)
Sets the non-negative flag for the instruction.
void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact)
LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder)
LLVMValueRef LLVMBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr, const char *Name)
void LLVMSetFastMathFlags(LLVMValueRef FPMathInst, LLVMFastMathFlags FMF)
Sets the flags for which fast-math-style optimizations are allowed for this value.
LLVMFastMathFlags LLVMGetFastMathFlags(LLVMValueRef FPMathInst)
Get the flags for which fast-math-style optimizations are allowed for this value.
LLVMValueRef LLVMBuildNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
LLVMBool LLVMGetVolatile(LLVMValueRef MemAccessInst)
LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
void LLVMPositionBuilder(LLVMBuilderRef Builder, LLVMBasicBlockRef Block, LLVMValueRef Instr)
void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block)
LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, const char *Name)
LLVMValueRef LLVMBuildCleanupRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf)
size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf)
LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange(const char *InputData, size_t InputDataLength, const char *BufferName, LLVMBool RequiresNullTerminator)
LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const char *Path, LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
const char * LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf)
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData, size_t InputDataLength, const char *BufferName)
LLVMModuleProviderRef LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M)
Changes the type of M so it can be passed to FunctionPassManagers and the JIT.
void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP)
Destroys the module M.
const char * LLVMGetModuleIdentifier(LLVMModuleRef M, size_t *Len)
Obtain the identifier of a module.
void LLVMSetDataLayout(LLVMModuleRef M, const char *DataLayoutStr)
Set the data layout for a module.
LLVMValueRef LLVMAddFunction(LLVMModuleRef M, const char *Name, LLVMTypeRef FunctionTy)
Add a function to a module under a specified name.
LLVMBool LLVMIsNewDbgInfoFormat(LLVMModuleRef M)
Soon to be deprecated.
LLVMNamedMDNodeRef LLVMGetPreviousNamedMetadata(LLVMNamedMDNodeRef NMD)
Decrement a NamedMDNode iterator to the previous NamedMDNode.
LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name)
Deprecated: Use LLVMGetTypeByName2 instead.
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.
void LLVMDumpModule(LLVMModuleRef M)
Dump a representation of a module to stderr.
void LLVMAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm, size_t Len)
Append inline assembly to a module.
LLVMValueRef LLVMGetFirstFunction(LLVMModuleRef M)
Obtain an iterator to the first Function in a Module.
const char * LLVMGetDebugLocFilename(LLVMValueRef Val, unsigned *Length)
Return the filename of the debug location for this value, which must be an llvm::Instruction,...
LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename, char **ErrorMessage)
Print a representation of a module to a file.
void LLVMDisposeModule(LLVMModuleRef M)
Destroy a module instance.
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.
const char * LLVMGetDebugLocDirectory(LLVMValueRef Val, unsigned *Length)
Return the directory of the debug location for this value, which must be an llvm::Instruction,...
const char * LLVMGetModuleInlineAsm(LLVMModuleRef M, size_t *Len)
Get inline assembly for a module.
const char * LLVMGetSourceFileName(LLVMModuleRef M, size_t *Len)
Obtain the module's original source file name.
const char * LLVMGetNamedMetadataName(LLVMNamedMDNodeRef NMD, size_t *NameLen)
Retrieve the name of a NamedMDNode.
LLVMContextRef LLVMGetModuleContext(LLVMModuleRef M)
Obtain the context to which this module is associated.
const char * LLVMGetInlineAsmConstraintString(LLVMValueRef InlineAsmVal, size_t *Len)
Get the raw constraint string for an inline assembly snippet.
LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID, LLVMContextRef C)
Create a new, empty module in a specific context.
LLVMMetadataRef LLVMModuleFlagEntriesGetMetadata(LLVMModuleFlagEntry *Entries, unsigned Index)
Returns the metadata for a module flag entry at a specific index.
const char * LLVMModuleFlagEntriesGetKey(LLVMModuleFlagEntry *Entries, unsigned Index, size_t *Len)
Returns the key for a module flag entry at a specific index.
LLVMValueRef LLVMGetLastFunction(LLVMModuleRef M)
Obtain an iterator to the last Function in a Module.
void LLVMSetTarget(LLVMModuleRef M, const char *Triple)
Set the target triple for a module.
const char * LLVMGetDataLayoutStr(LLVMModuleRef M)
Obtain the data layout for a module.
const char * LLVMGetInlineAsmAsmString(LLVMValueRef InlineAsmVal, size_t *Len)
Get the template string used for an inline assembly snippet.
LLVMModuleFlagBehavior LLVMModuleFlagEntriesGetFlagBehavior(LLVMModuleFlagEntry *Entries, unsigned Index)
Returns the flag behavior for a module flag entry at a specific index.
unsigned LLVMGetDebugLocColumn(LLVMValueRef Val)
Return the column number of the debug location for this value, which must be an llvm::Instruction.
unsigned LLVMGetDebugLocLine(LLVMValueRef Val)
Return the line number of the debug location for this value, which must be an llvm::Instruction,...
LLVMBool LLVMGetInlineAsmNeedsAlignedStack(LLVMValueRef InlineAsmVal)
Get if the inline asm snippet needs an aligned stack.
LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID)
Create a new, empty module in the global context.
LLVMModuleFlagEntry * LLVMCopyModuleFlagsMetadata(LLVMModuleRef M, size_t *Len)
Returns the module flags as an array of flag-key-value triples.
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.
void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm)
Deprecated: Use LLVMSetModuleInlineAsm2 instead.
LLVMBool LLVMGetInlineAsmHasSideEffects(LLVMValueRef InlineAsmVal)
Get if the inline asm snippet has side effects.
void LLVMDisposeModuleFlagsMetadata(LLVMModuleFlagEntry *Entries)
Destroys module flags metadata entries.
LLVMInlineAsmDialect LLVMGetInlineAsmDialect(LLVMValueRef InlineAsmVal)
Get the dialect used by the inline asm snippet.
unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char *Name)
Obtain the number of operands for named metadata in a module.
const char * LLVMGetTarget(LLVMModuleRef M)
Obtain the target triple for a module.
LLVMNamedMDNodeRef LLVMGetNextNamedMetadata(LLVMNamedMDNodeRef NMD)
Advance a NamedMDNode iterator to the next NamedMDNode.
void LLVMSetModuleInlineAsm2(LLVMModuleRef M, const char *Asm, size_t Len)
Set inline assembly for a module.
LLVMNamedMDNodeRef LLVMGetLastNamedMetadata(LLVMModuleRef M)
Obtain an iterator to the last NamedMDNode in a Module.
LLVMBool LLVMGetInlineAsmCanUnwind(LLVMValueRef InlineAsmVal)
Get if the inline asm snippet may unwind the stack.
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.
const char * LLVMGetDataLayout(LLVMModuleRef M)
LLVMValueRef LLVMGetNamedFunction(LLVMModuleRef M, const char *Name)
Obtain a Function value from a Module by its name.
void LLVMSetIsNewDbgInfoFormat(LLVMModuleRef M, LLVMBool UseNewFormat)
Soon to be deprecated.
LLVMNamedMDNodeRef LLVMGetNamedMetadata(LLVMModuleRef M, const char *Name, size_t NameLen)
Retrieve a NamedMDNode with the given name, returning NULL if no such node exists.
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.
LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn)
Decrement a Function iterator to the previous Function.
char * LLVMPrintModuleToString(LLVMModuleRef M)
Return a string representation of the module.
void LLVMGetNamedMetadataOperands(LLVMModuleRef M, const char *Name, LLVMValueRef *Dest)
Obtain the named metadata operands for a module.
LLVMValueRef LLVMGetNextFunction(LLVMValueRef Fn)
Advance a Function iterator to the next Function.
LLVMTypeRef LLVMGetInlineAsmFunctionType(LLVMValueRef InlineAsmVal)
Get the function type of the inline assembly snippet.
void LLVMSetModuleIdentifier(LLVMModuleRef M, const char *Ident, size_t Len)
Set the identifier of a module to a string Ident with length Len.
void LLVMAddNamedMetadataOperand(LLVMModuleRef M, const char *Name, LLVMValueRef Val)
Add an operand to named metadata.
LLVMNamedMDNodeRef LLVMGetFirstNamedMetadata(LLVMModuleRef M)
Obtain an iterator to the first NamedMDNode in a Module.
LLVMValueRef LLVMGetOperandBundleArgAtIndex(LLVMOperandBundleRef Bundle, unsigned Index)
Obtain the operand for an operand bundle at the given index.
unsigned LLVMGetNumOperandBundleArgs(LLVMOperandBundleRef Bundle)
Obtain the number of operands for an operand bundle.
LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, size_t TagLen, LLVMValueRef *Args, unsigned NumArgs)
Create a new operand bundle.
void LLVMDisposeOperandBundle(LLVMOperandBundleRef Bundle)
Destroy an operand bundle.
const char * LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len)
Obtain the tag of an operand bundle as a string.
LLVMBool LLVMRunPassManager(LLVMPassManagerRef PM, LLVMModuleRef M)
Initializes, executes on the provided module, and finalizes all of the passes scheduled in the pass m...
LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef P)
Deprecated: Use LLVMCreateFunctionPassManagerForModule instead.
LLVMPassManagerRef LLVMCreatePassManager()
Constructs a new whole-module pass pipeline.
void LLVMDisposePassManager(LLVMPassManagerRef PM)
Frees the memory of a pass pipeline.
LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM)
Finalizes all of the function passes scheduled in the function pass manager.
LLVMBool LLVMRunFunctionPassManager(LLVMPassManagerRef FPM, LLVMValueRef F)
Executes all of the function passes scheduled in the function pass manager on the provided function.
LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM)
Initializes all of the function passes scheduled in the function pass manager.
LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M)
Constructs a new function-by-function pass pipeline over the module provider.
LLVMBool LLVMIsMultithreaded()
Check whether LLVM is executing in thread-safe mode or not.
LLVMBool LLVMStartMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
void LLVMStopMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
LLVMTypeRef LLVMFP128Type(void)
LLVMTypeRef LLVMFP128TypeInContext(LLVMContextRef C)
Obtain a 128-bit floating point type (112-bit mantissa) from a context.
LLVMTypeRef LLVMDoubleTypeInContext(LLVMContextRef C)
Obtain a 64-bit floating point type from a context.
LLVMTypeRef LLVMX86FP80TypeInContext(LLVMContextRef C)
Obtain a 80-bit floating point type (X87) from a context.
LLVMTypeRef LLVMHalfTypeInContext(LLVMContextRef C)
Obtain a 16-bit floating point type from a context.
LLVMTypeRef LLVMBFloatTypeInContext(LLVMContextRef C)
Obtain a 16-bit brain floating point type from a context.
LLVMTypeRef LLVMBFloatType(void)
LLVMTypeRef LLVMFloatTypeInContext(LLVMContextRef C)
Obtain a 32-bit floating point type from a context.
LLVMTypeRef LLVMHalfType(void)
Obtain a floating point type from the global context.
LLVMTypeRef LLVMX86FP80Type(void)
LLVMTypeRef LLVMPPCFP128Type(void)
LLVMTypeRef LLVMFloatType(void)
LLVMTypeRef LLVMDoubleType(void)
LLVMTypeRef LLVMPPCFP128TypeInContext(LLVMContextRef C)
Obtain a 128-bit floating point type (two 64-bits) from a context.
LLVMBool LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy)
Returns whether a function type is variadic.
unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy)
Obtain the number of parameters this function accepts.
void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest)
Obtain the types of a function's parameters.
LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType, LLVMTypeRef *ParamTypes, unsigned ParamCount, LLVMBool IsVarArg)
Obtain a function type consisting of a specified signature.
LLVMTypeRef LLVMGetReturnType(LLVMTypeRef FunctionTy)
Obtain the Type this function Type returns.
LLVMTypeRef LLVMInt64Type(void)
LLVMTypeRef LLVMInt64TypeInContext(LLVMContextRef C)
LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C)
LLVMTypeRef LLVMIntTypeInContext(LLVMContextRef C, unsigned NumBits)
LLVMTypeRef LLVMInt1TypeInContext(LLVMContextRef C)
Obtain an integer type from a context with specified bit width.
LLVMTypeRef LLVMInt32Type(void)
LLVMTypeRef LLVMInt32TypeInContext(LLVMContextRef C)
LLVMTypeRef LLVMInt128TypeInContext(LLVMContextRef C)
LLVMTypeRef LLVMIntType(unsigned NumBits)
LLVMTypeRef LLVMInt8TypeInContext(LLVMContextRef C)
LLVMTypeRef LLVMInt8Type(void)
LLVMTypeRef LLVMInt1Type(void)
Obtain an integer type from the global context with a specified bit width.
LLVMTypeRef LLVMInt128Type(void)
unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy)
LLVMTypeRef LLVMInt16Type(void)
LLVMTypeRef LLVMX86MMXTypeInContext(LLVMContextRef C)
Create a X86 MMX type in a context.
LLVMTypeRef LLVMVoidType(void)
These are similar to the above functions except they operate on the global context.
LLVMTypeRef LLVMX86AMXTypeInContext(LLVMContextRef C)
Create a X86 AMX type in a context.
LLVMTypeRef LLVMMetadataTypeInContext(LLVMContextRef C)
Create a metadata type in a context.
LLVMTypeRef LLVMTokenTypeInContext(LLVMContextRef C)
Create a token type in a context.
LLVMTypeRef LLVMX86AMXType(void)
LLVMTypeRef LLVMLabelTypeInContext(LLVMContextRef C)
Create a label type in a context.
LLVMTypeRef LLVMTargetExtTypeInContext(LLVMContextRef C, const char *Name, LLVMTypeRef *TypeParams, unsigned TypeParamCount, unsigned *IntParams, unsigned IntParamCount)
Create a target extension type in LLVM context.
LLVMTypeRef LLVMX86MMXType(void)
LLVMTypeRef LLVMLabelType(void)
LLVMTypeRef LLVMVoidTypeInContext(LLVMContextRef C)
Create a void type in a context.
unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy)
Obtain the length of an array type.
LLVMTypeRef LLVMGetElementType(LLVMTypeRef WrappedTy)
Obtain the element type of an array or vector type.
unsigned LLVMGetPointerAddressSpace(LLVMTypeRef PointerTy)
Obtain the address space of a pointer type.
uint64_t LLVMGetArrayLength2(LLVMTypeRef ArrayTy)
Obtain the length of an array type.
LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace)
Create a pointer type that points to a defined type.
unsigned LLVMGetNumContainedTypes(LLVMTypeRef Tp)
Return the number of types in the derived type.
LLVMTypeRef LLVMVectorType(LLVMTypeRef ElementType, unsigned ElementCount)
Create a vector type that contains a defined type and has a specific number of elements.
LLVMBool LLVMPointerTypeIsOpaque(LLVMTypeRef Ty)
Determine whether a pointer is opaque.
LLVMTypeRef LLVMPointerTypeInContext(LLVMContextRef C, unsigned AddressSpace)
Create an opaque pointer type in a context.
LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount)
Create a fixed size array type that refers to a specific type.
LLVMTypeRef LLVMScalableVectorType(LLVMTypeRef ElementType, unsigned ElementCount)
Create a vector type that contains a defined type and has a scalable number of elements.
LLVMTypeRef LLVMArrayType2(LLVMTypeRef ElementType, uint64_t ElementCount)
Create a fixed size array type that refers to a specific type.
void LLVMGetSubtypes(LLVMTypeRef Tp, LLVMTypeRef *Arr)
Returns type's subtypes.
unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy)
Obtain the (possibly scalable) number of elements in a vector type.
void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Set the contents of a structure type.
LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy)
Determine whether a structure is packed.
LLVMTypeRef LLVMStructGetTypeAtIndex(LLVMTypeRef StructTy, unsigned i)
Get the type of the element at a given index in the structure.
LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Create a new structure type in the global context.
const char * LLVMGetStructName(LLVMTypeRef Ty)
Obtain the name of a structure.
void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest)
Get the elements within a structure.
LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy)
Determine whether a structure is opaque.
unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy)
Get the number of elements defined inside the structure.
LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name)
Create an empty structure in a context having a specified name.
LLVMBool LLVMIsLiteralStruct(LLVMTypeRef StructTy)
Determine whether a structure is literal.
LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Create a new structure type in a context.
LLVMBool LLVMTypeIsSized(LLVMTypeRef Ty)
Whether the type has a known size.
LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty)
Obtain the enumerated type of a Type instance.
char * LLVMPrintTypeToString(LLVMTypeRef Ty)
Return a string representation of the type.
void LLVMDumpType(LLVMTypeRef Ty)
Dump a representation of a type to stderr.
LLVMContextRef LLVMGetTypeContext(LLVMTypeRef Ty)
Obtain the context to which this type instance is associated.
LLVMTailCallKind
Tail call kind for LLVMSetTailCallKind and LLVMGetTailCallKind.
LLVMOpcode
External users depend on the following values being stable.
unsigned LLVMAttributeIndex
unsigned LLVMFastMathFlags
Flags to indicate what fast-math-style optimizations are allowed on operations.
@ LLVMDLLImportLinkage
Obsolete.
@ LLVMInternalLinkage
Rename collisions when linking (static functions)
@ LLVMLinkOnceAnyLinkage
Keep one copy of function when linking (inline)
@ LLVMExternalLinkage
Externally visible function.
@ LLVMExternalWeakLinkage
ExternalWeak linkage description.
@ LLVMLinkOnceODRLinkage
Same, but only replaced by something equivalent.
@ LLVMPrivateLinkage
Like Internal, but omit from symbol table.
@ LLVMDLLExportLinkage
Obsolete.
@ LLVMLinkerPrivateLinkage
Like Private, but linker removes.
@ LLVMWeakODRLinkage
Same, but only replaced by something equivalent.
@ LLVMGhostLinkage
Obsolete.
@ LLVMWeakAnyLinkage
Keep one copy of function when linking (weak)
@ LLVMAppendingLinkage
Special purpose, only applies to global arrays.
@ LLVMCommonLinkage
Tentative definitions.
@ LLVMLinkOnceODRAutoHideLinkage
Obsolete.
@ LLVMLinkerPrivateWeakLinkage
Like LinkerPrivate, but is weak.
@ LLVMAvailableExternallyLinkage
@ LLVMHalfTypeKind
16 bit floating point type
@ LLVMFP128TypeKind
128 bit floating point type (112-bit mantissa)
@ LLVMIntegerTypeKind
Arbitrary bit width integers.
@ LLVMPointerTypeKind
Pointers.
@ LLVMX86_FP80TypeKind
80 bit floating point type (X87)
@ LLVMX86_AMXTypeKind
X86 AMX.
@ LLVMMetadataTypeKind
Metadata.
@ LLVMScalableVectorTypeKind
Scalable SIMD vector type.
@ LLVMArrayTypeKind
Arrays.
@ LLVMBFloatTypeKind
16 bit brain floating point type
@ LLVMStructTypeKind
Structures.
@ LLVMLabelTypeKind
Labels.
@ LLVMDoubleTypeKind
64 bit floating point type
@ LLVMVoidTypeKind
type with no size
@ LLVMTokenTypeKind
Tokens.
@ LLVMFloatTypeKind
32 bit floating point type
@ LLVMFunctionTypeKind
Functions.
@ LLVMVectorTypeKind
Fixed width SIMD vector type.
@ LLVMPPC_FP128TypeKind
128 bit floating point type (two 64-bits)
@ LLVMTargetExtTypeKind
Target extension type.
@ LLVMX86_MMXTypeKind
X86 MMX.
@ LLVMInstructionValueKind
@ LLVMGlobalUnnamedAddr
Address of the GV is globally insignificant.
@ LLVMLocalUnnamedAddr
Address of the GV is locally insignificant.
@ LLVMNoUnnamedAddr
Address of the GV is significant.
@ LLVMModuleFlagBehaviorRequire
Adds a requirement that another module flag be present and have a specified value after linking is pe...
@ LLVMModuleFlagBehaviorWarning
Emits a warning if two values disagree.
@ LLVMModuleFlagBehaviorOverride
Uses the specified value, regardless of the behavior or value of the other module.
@ LLVMModuleFlagBehaviorAppendUnique
Appends the two values, which are required to be metadata nodes.
@ LLVMModuleFlagBehaviorAppend
Appends the two values, which are required to be metadata nodes.
@ LLVMModuleFlagBehaviorError
Emits an error if two values disagree, otherwise the resulting value is that of the operands.
@ LLVMAtomicRMWBinOpXor
Xor a value and return the old one.
@ LLVMAtomicRMWBinOpXchg
Set the new value and return the one old.
@ LLVMAtomicRMWBinOpSub
Subtract a value and return the old one.
@ LLVMAtomicRMWBinOpUMax
Sets the value if it's greater than the original using an unsigned comparison and return the old one.
@ LLVMAtomicRMWBinOpAnd
And a value and return the old one.
@ LLVMAtomicRMWBinOpUDecWrap
Decrements the value, wrapping back to the input value when decremented below zero.
@ LLVMAtomicRMWBinOpFMax
Sets the value if it's greater than the original using an floating point comparison and return the ol...
@ LLVMAtomicRMWBinOpMin
Sets the value if it's Smaller than the original using a signed comparison and return the old one.
@ LLVMAtomicRMWBinOpOr
OR a value and return the old one.
@ LLVMAtomicRMWBinOpFMin
Sets the value if it's smaller than the original using an floating point comparison and return the ol...
@ LLVMAtomicRMWBinOpMax
Sets the value if it's greater than the original using a signed comparison and return the old one.
@ LLVMAtomicRMWBinOpUIncWrap
Increments the value, wrapping back to zero when incremented above input value.
@ LLVMAtomicRMWBinOpFAdd
Add a floating point value and return the old one.
@ LLVMAtomicRMWBinOpFSub
Subtract a floating point value and return the old one.
@ LLVMAtomicRMWBinOpAdd
Add a value and return the old one.
@ LLVMAtomicRMWBinOpUMin
Sets the value if it's greater than the original using an unsigned comparison and return the old one.
@ LLVMAtomicRMWBinOpNand
Not-And a value and return the old one.
@ LLVMFastMathAllowReassoc
@ LLVMFastMathNoSignedZeros
@ LLVMFastMathAllowContract
@ LLVMFastMathAllowReciprocal
@ LLVMGeneralDynamicTLSModel
@ LLVMLocalDynamicTLSModel
@ LLVMInitialExecTLSModel
@ LLVMAtomicOrderingAcquireRelease
provides both an Acquire and a Release barrier (for fences and operations which both read and write m...
@ LLVMAtomicOrderingRelease
Release is similar to Acquire, but with a barrier of the sort necessary to release a lock.
@ LLVMAtomicOrderingAcquire
Acquire provides a barrier of the sort necessary to acquire a lock to access other memory with normal...
@ LLVMAtomicOrderingMonotonic
guarantees that if you take all the operations affecting a specific address, a consistent ordering ex...
@ LLVMAtomicOrderingSequentiallyConsistent
provides Acquire semantics for loads and Release semantics for stores.
@ LLVMAtomicOrderingNotAtomic
A load or store which is not atomic.
@ LLVMAtomicOrderingUnordered
Lowest level of atomicity, guarantees somewhat sane results, lock free.
@ LLVMInlineAsmDialectATT
@ LLVMInlineAsmDialectIntel
LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB)
Advance a basic block iterator.
void LLVMAppendExistingBasicBlock(LLVMValueRef Fn, LLVMBasicBlockRef BB)
Append the given basic block to the basic block list of the given function.
void LLVMDeleteBasicBlock(LLVMBasicBlockRef BBRef)
Remove a basic block from a function and delete it.
LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn)
Obtain the first basic block in a function.
LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val)
Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C, const char *Name)
Create a new basic block without inserting it into a function.
void LLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BBRef)
Remove a basic block from a function.
void LLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to before another one.
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB)
Convert a basic block instance to a value type.
void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder, LLVMBasicBlockRef BB)
Insert the given basic block after the insertion point of the given builder.
void LLVMGetBasicBlocks(LLVMValueRef FnRef, LLVMBasicBlockRef *BasicBlocksRefs)
Obtain all of the basic blocks in a function.
LLVMBasicBlockRef LLVMAppendBasicBlock(LLVMValueRef FnRef, const char *Name)
Append a basic block to the end of a function using the global context.
LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB)
Obtain the terminator instruction for a basic block.
unsigned LLVMCountBasicBlocks(LLVMValueRef FnRef)
Obtain the number of basic blocks in a function.
void LLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to after another one.
LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn)
Obtain the last basic block in a function.
LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C, LLVMValueRef FnRef, const char *Name)
Append a basic block to the end of a function.
LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB)
Obtain the function to which a basic block belongs.
LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB)
Obtain the first instruction in a basic block.
LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB)
Obtain the last instruction in a basic block.
LLVMBasicBlockRef LLVMInsertBasicBlockInContext(LLVMContextRef C, LLVMBasicBlockRef BBRef, const char *Name)
Insert a basic block in a function before another basic block.
LLVMBasicBlockRef LLVMInsertBasicBlock(LLVMBasicBlockRef BBRef, const char *Name)
Insert a basic block in a function using the global context.
LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn)
Obtain the basic block that corresponds to the entry point of a function.
LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val)
Determine whether an LLVMValueRef is itself a basic block.
const char * LLVMGetBasicBlockName(LLVMBasicBlockRef BB)
Obtain the string name of a basic block.
LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB)
Go backwards in a basic block iterator.
LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
Create a ConstantStruct in the global Context.
LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, unsigned Length)
Create a ConstantArray from values.
LLVMValueRef LLVMConstArray2(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, uint64_t Length)
Create a ConstantArray from values.
LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size)
Create a ConstantVector from values.
LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str, unsigned Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential and initialize it with a string.
LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy, LLVMValueRef *ConstantVals, unsigned Count)
Create a non-anonymous ConstantStruct from values.
LLVMBool LLVMIsConstantString(LLVMValueRef C)
Returns true if the specified constant is an array of i8.
LLVMValueRef LLVMGetAggregateElement(LLVMValueRef C, unsigned Idx)
Get element of a constant aggregate (struct, array or vector) at the specified index.
LLVMValueRef LLVMConstString(const char *Str, unsigned Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential with string content in the global context.
const char * LLVMGetAsString(LLVMValueRef C, size_t *Length)
Get the given constant data sequential as a string.
LLVMValueRef LLVMConstStringInContext2(LLVMContextRef C, const char *Str, size_t Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential and initialize it with a string.
LLVMValueRef LLVMConstStructInContext(LLVMContextRef C, LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
Create an anonymous ConstantStruct with the specified values.
LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty)
LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal)
LLVMValueRef LLVMGetBlockAddressFunction(LLVMValueRef BlockAddr)
Gets the function associated with a given BlockAddress constant value.
LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, LLVMValueRef IndexConstant)
LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant, LLVMValueRef ElementValueConstant, LLVMValueRef IndexConstant)
LLVMValueRef LLVMConstInBoundsGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
LLVMValueRef LLVMConstAddrSpaceCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
LLVMValueRef LLVMConstICmp(LLVMIntPredicate Predicate, LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMBasicBlockRef LLVMGetBlockAddressBasicBlock(LLVMValueRef BlockAddr)
Gets the basic block associated with a given BlockAddress constant value.
LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMAlignOf(LLVMTypeRef Ty)
LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString, const char *Constraints, LLVMBool HasSideEffects, LLVMBool IsAlignStack)
Deprecated: Use LLVMGetInlineAsm instead.
LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal)
LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMConstShl(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMConstFCmp(LLVMRealPredicate Predicate, LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMConstGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant, LLVMValueRef VectorBConstant, LLVMValueRef MaskConstant)
LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal)
LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB)
LLVMOpcode LLVMGetConstOpcode(LLVMValueRef ConstantVal)
LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
void LLVMGlobalSetMetadata(LLVMValueRef Global, unsigned Kind, LLVMMetadataRef MD)
Sets a metadata attachment, erasing the existing metadata attachment if it already exists for the giv...
unsigned LLVMValueMetadataEntriesGetKind(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the kind of a value metadata entry at a specific index.
void LLVMDisposeValueMetadataEntries(LLVMValueMetadataEntry *Entries)
Destroys value metadata entries.
void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz)
LLVMDLLStorageClass LLVMGetDLLStorageClass(LLVMValueRef Global)
void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes)
Set the preferred alignment of the value.
LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global)
const char * LLVMGetSection(LLVMValueRef Global)
LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global)
Returns the "value type" of a global value.
LLVMBool LLVMIsDeclaration(LLVMValueRef Global)
LLVMVisibility LLVMGetVisibility(LLVMValueRef Global)
void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class)
LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global)
Deprecated: Use LLVMGetUnnamedAddress instead.
LLVMLinkage LLVMGetLinkage(LLVMValueRef Global)
LLVMUnnamedAddr LLVMGetUnnamedAddress(LLVMValueRef Global)
LLVMMetadataRef LLVMValueMetadataEntriesGetMetadata(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the underlying metadata node of a value metadata entry at a specific index.
void LLVMSetUnnamedAddress(LLVMValueRef Global, LLVMUnnamedAddr UnnamedAddr)
void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage)
void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr)
Deprecated: Use LLVMSetUnnamedAddress instead.
void LLVMGlobalClearMetadata(LLVMValueRef Global)
Removes all metadata attachments from this value.
unsigned LLVMGetAlignment(LLVMValueRef V)
Obtain the preferred alignment of the value.
void LLVMSetSection(LLVMValueRef Global, const char *Section)
void LLVMGlobalEraseMetadata(LLVMValueRef Global, unsigned Kind)
Erases a metadata attachment of the given kind if it exists.
LLVMValueMetadataEntry * LLVMGlobalCopyAllMetadata(LLVMValueRef Value, size_t *NumEntries)
Retrieves an array of metadata entries representing the metadata attached to this value.
LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N, LLVMBool SignExtend)
Obtain a constant value for an integer type.
LLVMValueRef LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy, unsigned NumWords, const uint64_t Words[])
Obtain a constant value for an integer of arbitrary precision.
LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text)
Obtain a constant for a floating point value parsed from a string.
double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *LosesInfo)
Obtain the double value for an floating point constant value.
long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal)
Obtain the sign extended value for an integer constant value.
unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal)
Obtain the zero extended value for an integer constant value.
LLVMValueRef LLVMConstReal(LLVMTypeRef RealTy, double N)
Obtain a constant value referring to a double floating point value.
LLVMBool LLVMIsNull(LLVMValueRef Val)
Determine whether a value instance is null.
LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty)
Obtain a constant value referring to an undefined value of a type.
LLVMValueRef LLVMGetPoison(LLVMTypeRef Ty)
Obtain a constant value referring to a poison value of a type.
LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty)
Obtain a constant value referring to the instance of a type consisting of all ones.
LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty)
Obtain a constant that is a constant pointer pointing to NULL for a specified type.
LLVMValueRef LLVMConstNull(LLVMTypeRef Ty)
Obtain a constant value referring to the null instance of a type.
unsigned LLVMCountParams(LLVMValueRef FnRef)
Obtain the number of parameters in a function.
LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg)
Obtain the previous parameter to a function.
LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg)
Obtain the next parameter to a function.
LLVMValueRef LLVMGetParamParent(LLVMValueRef V)
Obtain the function to which this argument belongs.
LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn)
Obtain the first parameter to a function.
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align)
Set the alignment for a function parameter.
LLVMValueRef LLVMGetParam(LLVMValueRef FnRef, unsigned index)
Obtain the parameter at the specified index.
LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn)
Obtain the last parameter to a function.
void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs)
Obtain the parameters in a function.
void LLVMSetGC(LLVMValueRef Fn, const char *GC)
Define the garbage collector to use during code generation.
const char * LLVMGetGC(LLVMValueRef Fn)
Obtain the name of the garbage collector to use during code generation.
LLVMValueRef LLVMGetPrologueData(LLVMValueRef Fn)
Gets the prologue data associated with a function.
void LLVMRemoveEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
unsigned LLVMGetAttributeCountAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx)
LLVMBool LLVMHasPersonalityFn(LLVMValueRef Fn)
Check whether the given function has a personality function.
unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen)
Obtain the intrinsic ID number which matches the given function name.
const char * LLVMIntrinsicGetName(unsigned ID, size_t *NameLength)
Retrieves the name of an intrinsic.
unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn)
Obtain the calling function of a function.
LLVMValueRef LLVMGetPrefixData(LLVMValueRef Fn)
Gets the prefix data associated with a function.
void LLVMRemoveStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
void LLVMSetPrefixData(LLVMValueRef Fn, LLVMValueRef prefixData)
Sets the prefix data for the function.
LLVMAttributeRef LLVMGetStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn)
Obtain the personality function attached to the function.
void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn)
Set the personality function attached to the function.
LLVMBool LLVMIntrinsicIsOverloaded(unsigned ID)
Obtain if the intrinsic identified by the given ID is overloaded.
void LLVMAddAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Add an attribute to a function.
void LLVMDeleteFunction(LLVMValueRef Fn)
Remove a function from its containing module and deletes it.
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.
void LLVMSetPrologueData(LLVMValueRef Fn, LLVMValueRef prologueData)
Sets the prologue data for the function.
const char * LLVMIntrinsicCopyOverloadedName(unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount, size_t *NameLength)
Deprecated: Use LLVMIntrinsicCopyOverloadedName2 instead.
LLVMBool LLVMHasPrologueData(LLVMValueRef Fn)
Check if a given function has prologue data.
LLVMBool LLVMHasPrefixData(LLVMValueRef Fn)
Check if a given function has prefix data.
void LLVMGetAttributesAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC)
Set the calling convention of a function.
LLVMValueRef LLVMGetIntrinsicDeclaration(LLVMModuleRef Mod, unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount)
Create or insert the declaration of an intrinsic.
LLVMAttributeRef LLVMGetEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A, const char *V)
Add a target-dependent attribute to a function.
LLVMTypeRef LLVMIntrinsicGetType(LLVMContextRef Ctx, unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount)
Retrieves the type of an intrinsic.
unsigned LLVMGetIntrinsicID(LLVMValueRef Fn)
Obtain the ID number from a function instance.
LLVMValueKind LLVMGetValueKind(LLVMValueRef Val)
Obtain the enumerated type of a Value instance.
const char * LLVMGetValueName(LLVMValueRef Val)
Deprecated: Use LLVMGetValueName2 instead.
LLVMTypeRef LLVMTypeOf(LLVMValueRef Val)
Obtain the type of a value.
LLVMBool LLVMIsConstant(LLVMValueRef Ty)
Determine whether the specified value instance is constant.
void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal)
Replace all uses of a value with another one.
const char * LLVMGetValueName2(LLVMValueRef Val, size_t *Length)
Obtain the string name of a value.
char * LLVMPrintDbgRecordToString(LLVMDbgRecordRef Record)
Return a string representation of the DbgRecord.
void LLVMSetValueName(LLVMValueRef Val, const char *Name)
Deprecated: Use LLVMSetValueName2 instead.
void LLVMDumpValue(LLVMValueRef Val)
Dump a representation of a value to stderr.
LLVMBool LLVMIsUndef(LLVMValueRef Val)
Determine whether a value instance is undefined.
LLVMValueRef LLVMIsAMDNode(LLVMValueRef Val)
LLVMBool LLVMIsPoison(LLVMValueRef Val)
Determine whether a value instance is poisonous.
LLVMValueRef LLVMIsAMDString(LLVMValueRef Val)
void LLVMSetValueName2(LLVMValueRef Val, const char *Name, size_t NameLen)
Set the string name of a value.
LLVMValueRef LLVMIsAValueAsMetadata(LLVMValueRef Val)
char * LLVMPrintValueToString(LLVMValueRef Val)
Return a string representation of the value.
void LLVMEraseGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module and delete it.
void LLVMRemoveGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module.
LLVMValueRef LLVMGetNextGlobalIFunc(LLVMValueRef IFunc)
Advance a GlobalIFunc iterator to the next GlobalIFunc.
LLVMValueRef LLVMGetNamedGlobalIFunc(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalIFunc value from a Module by its name.
LLVMValueRef LLVMGetLastGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the last GlobalIFunc in a Module.
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.
void LLVMSetGlobalIFuncResolver(LLVMValueRef IFunc, LLVMValueRef Resolver)
Sets the resolver function associated with this indirect function.
LLVMValueRef LLVMGetFirstGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the first GlobalIFunc in a Module.
LLVMValueRef LLVMGetGlobalIFuncResolver(LLVMValueRef IFunc)
Retrieves the resolver function associated with this indirect function, or NULL if it doesn't not exi...
LLVMValueRef LLVMGetPreviousGlobalIFunc(LLVMValueRef IFunc)
Decrement a GlobalIFunc iterator to the previous GlobalIFunc.
LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca)
Obtain the type that is being allocated by the alloca instruction.
LLVMOperandBundleRef LLVMGetOperandBundleAtIndex(LLVMValueRef C, unsigned Index)
Obtain the operand bundle attached to this instruction at the given index.
LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr)
Obtain the pointer to the function invoked by this instruction.
void LLVMGetCallSiteAttributes(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
unsigned LLVMGetNumArgOperands(LLVMValueRef Instr)
Obtain the argument count for a call instruction.
void LLVMSetNormalDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the normal destination basic block.
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr)
Obtain the calling convention for a call instruction.
LLVMTypeRef LLVMGetCalledFunctionType(LLVMValueRef Instr)
Obtain the function type called by this instruction.
unsigned LLVMGetCallSiteAttributeCount(LLVMValueRef C, LLVMAttributeIndex Idx)
void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef A)
unsigned LLVMGetNumOperandBundles(LLVMValueRef C)
Obtain the number of operand bundles attached to this instruction.
LLVMBasicBlockRef LLVMGetCallBrIndirectDest(LLVMValueRef CallBr, unsigned Idx)
Get the indirect destination of a CallBr instruction at the given index.
void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC)
Set the calling convention for a call instruction.
LLVMAttributeRef LLVMGetCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
LLVMBasicBlockRef LLVMGetNormalDest(LLVMValueRef Invoke)
Return the normal destination basic block.
void LLVMRemoveCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
unsigned LLVMGetCallBrNumIndirectDests(LLVMValueRef CallBr)
Get the number of indirect destinations of a CallBr instruction.
void LLVMSetUnwindDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the unwind destination basic block.
void LLVMSetTailCall(LLVMValueRef Call, LLVMBool isTailCall)
Set whether a call instruction is a tail call.
LLVMBool LLVMIsTailCall(LLVMValueRef Call)
Obtain whether a call instruction is a tail call.
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, LLVMAttributeIndex Idx, unsigned align)
LLVMBasicBlockRef LLVMGetCallBrDefaultDest(LLVMValueRef CallBr)
Get the default destination of a CallBr instruction.
void LLVMRemoveCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
LLVMTailCallKind LLVMGetTailCallKind(LLVMValueRef Call)
Obtain a tail call kind of the call instruction.
void LLVMSetTailCallKind(LLVMValueRef Call, LLVMTailCallKind kind)
Set the call kind of the call instruction.
LLVMAttributeRef LLVMGetCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
LLVMBasicBlockRef LLVMGetUnwindDest(LLVMValueRef Invoke)
Return the unwind destination basic block.
LLVMTypeRef LLVMGetGEPSourceElementType(LLVMValueRef GEP)
Get the source element type of the given GEP operator.
LLVMBool LLVMIsInBounds(LLVMValueRef GEP)
Check whether the given GEP operator is inbounds.
void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds)
Set the given GEP instruction to be inbounds or not.
const unsigned * LLVMGetIndices(LLVMValueRef Inst)
Obtain the indices as an array.
unsigned LLVMGetNumIndices(LLVMValueRef Inst)
Obtain the number of indices.
void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues, LLVMBasicBlockRef *IncomingBlocks, unsigned Count)
Add an incoming value to the end of a PHI list.
LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMValueRef.
unsigned LLVMCountIncoming(LLVMValueRef PhiNode)
Obtain the number of incoming basic blocks to a PHI node.
LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
unsigned LLVMGetNumSuccessors(LLVMValueRef Term)
Return the number of successors that this terminator has.
LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef Switch)
Obtain the default destination basic block of a switch instruction.
void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block)
Update the specified successor to point at the provided block.
void LLVMSetCondition(LLVMValueRef Branch, LLVMValueRef Cond)
Set the condition of a branch instruction.
LLVMValueRef LLVMGetCondition(LLVMValueRef Branch)
Return the condition of a branch instruction.
LLVMBool LLVMIsConditional(LLVMValueRef Branch)
Return if a branch is conditional.
LLVMBasicBlockRef LLVMGetSuccessor(LLVMValueRef Term, unsigned i)
Return the specified successor.
LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst)
Create a copy of 'this' instruction that is identical in all ways except the following:
LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst)
Obtain the instruction that occurs after the one specified.
void LLVMDeleteInstruction(LLVMValueRef Inst)
Delete an instruction.
LLVMValueRef LLVMIsATerminatorInst(LLVMValueRef Inst)
Determine whether an instruction is a terminator.
LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst)
Obtain the code opcode for an individual instruction.
LLVMValueMetadataEntry * LLVMInstructionGetAllMetadataOtherThanDebugLoc(LLVMValueRef Value, size_t *NumEntries)
Returns the metadata associated with an instruction value, but filters out all the debug locations.
LLVMRealPredicate LLVMGetFCmpPredicate(LLVMValueRef Inst)
Obtain the float predicate of an instruction.
int LLVMHasMetadata(LLVMValueRef Inst)
Determine whether an instruction has any metadata attached.
void LLVMInstructionEraseFromParent(LLVMValueRef Inst)
Remove and delete an instruction.
void LLVMInstructionRemoveFromParent(LLVMValueRef Inst)
Remove an instruction.
LLVMValueRef LLVMGetMetadata(LLVMValueRef Inst, unsigned KindID)
Return metadata associated with an instruction value.
LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst)
Obtain the predicate of an instruction.
void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef Val)
Set metadata associated with an instruction value.
LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst)
Obtain the basic block to which an instruction belongs.
LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst)
Obtain the instruction that occurred before this one.
int LLVMGetNumOperands(LLVMValueRef Val)
Obtain the number of operands in a llvm::User value.
void LLVMSetOperand(LLVMValueRef Val, unsigned Index, LLVMValueRef Op)
Set an operand at a specific index in a llvm::User value.
LLVMUseRef LLVMGetOperandUse(LLVMValueRef Val, unsigned Index)
Obtain the use of an operand at a specific index in a llvm::User value.
LLVMValueRef LLVMGetOperand(LLVMValueRef Val, unsigned Index)
Obtain an operand at a specific index in a llvm::User value.
LLVMValueRef LLVMGetUser(LLVMUseRef U)
Obtain the user value for a user.
LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val)
Obtain the first use of a value.
LLVMUseRef LLVMGetNextUse(LLVMUseRef U)
Obtain the next use of a value.
LLVMValueRef LLVMGetUsedValue(LLVMUseRef U)
Obtain the value this use corresponds to.
#define LLVM_FOR_EACH_VALUE_SUBCLASS(macro)
void LLVMShutdown()
Deallocate and destroy all ManagedStatic variables.
void LLVMGetVersion(unsigned *Major, unsigned *Minor, unsigned *Patch)
Return the major, minor, and patch version of LLVM.
void LLVMDisposeMessage(char *Message)
char * LLVMCreateMessage(const char *Message)
struct LLVMOpaqueValue * LLVMValueRef
Represents an individual value in LLVM IR.
struct LLVMOpaqueAttributeRef * LLVMAttributeRef
Used to represent an attributes.
struct LLVMOpaqueNamedMDNode * LLVMNamedMDNodeRef
Represents an LLVM Named Metadata Node.
struct LLVMOpaquePassManager * LLVMPassManagerRef
struct LLVMOpaqueDbgRecord * LLVMDbgRecordRef
struct LLVMOpaqueDiagnosticInfo * LLVMDiagnosticInfoRef
struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef
LLVM uses a polymorphic type hierarchy which C cannot represent, therefore parameters must be passed ...
struct LLVMOpaqueContext * LLVMContextRef
The top-level container for all LLVM global data.
struct LLVMOpaqueBuilder * LLVMBuilderRef
Represents an LLVM basic block builder.
struct LLVMOpaqueUse * LLVMUseRef
Used to get the users and usees of a Value.
struct LLVMOpaqueBasicBlock * LLVMBasicBlockRef
Represents a basic block of instructions in LLVM IR.
struct LLVMOpaqueType * LLVMTypeRef
Each value in the LLVM IR has a type, an LLVMTypeRef.
struct LLVMOpaqueMetadata * LLVMMetadataRef
Represents an LLVM Metadata.
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
struct LLVMOpaqueModuleProvider * LLVMModuleProviderRef
Interface used to provide a module to JIT or interpreter.
struct LLVMOpaqueOperandBundle * LLVMOperandBundleRef
void LLVMAliasSetAliasee(LLVMValueRef Alias, LLVMValueRef Aliasee)
Set the target value of an alias.
LLVMValueRef LLVMGetLastGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the last GlobalAlias in a Module.
LLVMValueRef LLVMGetNextGlobalAlias(LLVMValueRef GA)
Advance a GlobalAlias iterator to the next GlobalAlias.
LLVMValueRef LLVMAliasGetAliasee(LLVMValueRef Alias)
Retrieve the target value of an alias.
LLVMValueRef LLVMGetPreviousGlobalAlias(LLVMValueRef GA)
Decrement a GlobalAlias iterator to the previous GlobalAlias.
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.
LLVMValueRef LLVMGetFirstGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the first GlobalAlias in a Module.
LLVMValueRef LLVMGetNamedGlobalAlias(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalAlias value from a Module by its name.
void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant)
void LLVMSetThreadLocalMode(LLVMValueRef GlobalVar, LLVMThreadLocalMode Mode)
LLVMThreadLocalMode LLVMGetThreadLocalMode(LLVMValueRef GlobalVar)
LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M)
LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar)
LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar)
LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name)
LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M)
void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit)
LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar)
void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal)
LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar)
void LLVMDeleteGlobal(LLVMValueRef GlobalVar)
LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar)
LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar)
LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name, unsigned AddressSpace)
void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal)
LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys=std::nullopt)
Return the function type for an intrinsic.
std::string getNameNoUnnamedTypes(ID Id, ArrayRef< Type * > Tys)
Return the LLVM name for an intrinsic.
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
bool isOverloaded(ID id)
Returns true if the intrinsic can be overloaded.
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=std::nullopt)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
@ SingleThread
Synchronized with respect to signal handlers executing in the same thread.
@ System
Synchronized with respect to all concurrently executing threads.
@ OF_TextWithCRLF
The file should be opened in text mode and use a carriage linefeed '\r '.
This is an optimization pass for GlobalISel generic memory operations.
constexpr bool llvm_is_multithreaded()
Returns true if LLVM is compiled with support for multi-threading, and false otherwise.
void initializeSafepointIRVerifierPass(PassRegistry &)
uint64_t divideCeil(uint64_t Numerator, uint64_t Denominator)
Returns the integer ceil(Numerator / Denominator).
void initializeVerifierLegacyPassPass(PassRegistry &)
OperandBundleDefT< Value * > OperandBundleDef
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
void initializeCore(PassRegistry &)
Initialize all passes linked into the Core library.
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc(size_t Sz)
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.
void initializeDominatorTreeWrapperPassPass(PassRegistry &)
void initializePrintModulePassWrapperPass(PassRegistry &)
void llvm_shutdown()
llvm_shutdown - Deallocate and destroy all ManagedStatic variables.
LLVMAttributeRef wrap(Attribute Attr)
void initializePrintFunctionPassWrapperPass(PassRegistry &)
LLVMModuleFlagBehavior Behavior
This struct is a compact representation of a valid (non-zero power of two) alignment.
void(*)(const DiagnosticInfo *DI, void *Context) DiagnosticHandlerTy
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.