41 #include <system_error> 45 #define DEBUG_TYPE "ir" 66 return strdup(Message);
86 void *DiagnosticContext) {
87 unwrap(C)->setDiagnosticHandlerCallBack(
88 LLVM_EXTENSION reinterpret_cast<DiagnosticHandler::DiagnosticHandlerTy>(
95 unwrap(C)->getDiagnosticHandlerCallBack());
99 return unwrap(C)->getDiagnosticContext();
103 void *OpaqueHandle) {
106 unwrap(C)->setYieldCallback(YieldCallback, OpaqueHandle);
110 return unwrap(C)->shouldDiscardValueNames();
114 unwrap(C)->setDiscardValueNames(Discard);
130 #define GET_ATTR_KIND_FROM_NAME 131 #include "AttributesCompatFunc.inc" 134 return getAttrKindFromName(
StringRef(Name, SLen));
138 return Attribute::AttrKind::EndAttrKinds;
146 if (AttrKind == Attribute::AttrKind::ByVal) {
161 if (Attr.isEnumAttribute())
163 return Attr.getValueAsInt();
167 const char *K,
unsigned KLength,
168 const char *V,
unsigned VLength) {
189 return Attr.isEnumAttribute() || Attr.isIntAttribute();
197 std::string MsgStorage;
210 switch(
unwrap(DI)->getSeverity()) {
231 return wrap(
new Module(ModuleID, *GlobalContext));
244 auto &Str =
unwrap(M)->getModuleIdentifier();
254 auto &Str =
unwrap(M)->getSourceFileName();
265 return unwrap(M)->getDataLayoutStr().c_str();
273 unwrap(M)->setDataLayout(DataLayoutStr);
278 return unwrap(M)->getTargetTriple().c_str();
282 unwrap(M)->setTargetTriple(Triple);
299 return Module::ModFlagBehavior::Warning;
301 return Module::ModFlagBehavior::Require;
303 return Module::ModFlagBehavior::Override;
305 return Module::ModFlagBehavior::Append;
307 return Module::ModFlagBehavior::AppendUnique;
317 case Module::ModFlagBehavior::Warning:
319 case Module::ModFlagBehavior::Require:
321 case Module::ModFlagBehavior::Override:
323 case Module::ModFlagBehavior::Append:
325 case Module::ModFlagBehavior::AppendUnique:
334 unwrap(M)->getModuleFlagsMetadata(MFEs);
338 for (
unsigned i = 0; i < MFEs.
size(); ++i) {
339 const auto &ModuleFlag = MFEs[i];
341 Result[i].
Key = ModuleFlag.Key->getString().data();
342 Result[i].
KeyLen = ModuleFlag.Key->getString().size();
362 unsigned Index,
size_t *Len) {
377 const char *
Key,
size_t KeyLen) {
382 const char *
Key,
size_t KeyLen,
396 char **ErrorMessage) {
400 *ErrorMessage = strdup(EC.message().c_str());
404 unwrap(M)->print(dest,
nullptr);
409 std::string
E =
"Error printing to file: " + dest.
error().message();
410 *ErrorMessage = strdup(E.c_str());
421 unwrap(M)->print(os,
nullptr);
424 return strdup(buf.c_str());
441 auto &Str =
unwrap(M)->getModuleInlineAsm();
447 char *AsmString,
size_t AsmStringSize,
448 char *Constraints,
size_t ConstraintsSize,
463 HasSideEffects, IsAlignStack, AD));
519 return unwrap(Ty)->isSized();
537 os <<
"Printing <null> Type";
541 return strdup(buf.c_str());
591 return unwrap<IntegerType>(IntegerTy)->
getBitWidth();
650 return unwrap<FunctionType>(FunctionTy)->isVarArg();
654 return wrap(unwrap<FunctionType>(FunctionTy)->getReturnType());
658 return unwrap<FunctionType>(FunctionTy)->getNumParams();
679 ElementCount, Packed);
698 unwrap<StructType>(StructTy)->setBody(Tys, Packed != 0);
702 return unwrap<StructType>(StructTy)->getNumElements();
706 StructType *Ty = unwrap<StructType>(StructTy);
713 StructType *Ty = unwrap<StructType>(StructTy);
718 return unwrap<StructType>(StructTy)->isPacked();
722 return unwrap<StructType>(StructTy)->isOpaque();
726 return unwrap<StructType>(StructTy)->isLiteral();
737 for (
auto *
T :
unwrap(Tp)->subtypes()) {
756 auto *Ty = unwrap<Type>(WrappedTy);
757 if (
auto *PTy = dyn_cast<PointerType>(Ty))
758 return wrap(PTy->getElementType());
759 return wrap(cast<SequentialType>(Ty)->getElementType());
763 return unwrap(Tp)->getNumContainedTypes();
767 return unwrap<ArrayType>(ArrayTy)->getNumElements();
771 return unwrap<PointerType>(
PointerTy)->getAddressSpace();
775 return unwrap<VectorType>(VectorTy)->getNumElements();
809 switch(
unwrap(Val)->getValueID()) {
810 #define HANDLE_VALUE(Name) \ 811 case Value::Name##Val: \ 812 return LLVM##Name##ValueKind; 813 #include "llvm/IR/Value.def" 821 *Length = V->getName().size();
822 return V->getName().data();
830 return unwrap(Val)->getName().data();
834 unwrap(Val)->setName(Name);
848 os <<
"Printing <null> Value";
852 return strdup(buf.c_str());
860 return unwrap<Instruction>(Inst)->hasMetadata();
864 auto *
I = unwrap<Instruction>(Inst);
865 assert(
I &&
"Expected instruction");
866 if (
auto *MD =
I->getMetadata(KindID))
876 assert((isa<MDNode>(MD) || isa<ConstantAsMetadata>(MD)) &&
877 "Expected a metadata node or a canonicalized constant");
879 if (
MDNode *
N = dyn_cast<MDNode>(MD))
906 for (
unsigned i = 0; i < MVEs.
size(); ++i) {
907 const auto &ModuleFlag = MVEs[i];
908 Result[i].
Kind = ModuleFlag.first;
911 *NumEntries = MVEs.
size();
917 size_t *NumEntries) {
919 unwrap<Instruction>(
Value)->getAllMetadata(Entries);
925 #define LLVM_DEFINE_VALUE_CAST(name) \ 926 LLVMValueRef LLVMIsA##name(LLVMValueRef Val) { \ 927 return wrap(static_cast<Value*>(dyn_cast_or_null<name>(unwrap(Val)))); \ 933 if (
auto *MD = dyn_cast_or_null<MetadataAsValue>(
unwrap(Val)))
934 if (isa<MDNode>(MD->getMetadata()) ||
935 isa<ValueAsMetadata>(MD->getMetadata()))
941 if (
auto *MD = dyn_cast_or_null<MetadataAsValue>(
unwrap(Val)))
942 if (isa<MDString>(MD->getMetadata()))
978 if (
auto *
C = dyn_cast<ConstantAsMetadata>(Op))
979 return wrap(
C->getValue());
985 if (
auto *MD = dyn_cast<MetadataAsValue>(V)) {
986 if (
auto *L = dyn_cast<ValueAsMetadata>(MD->getMetadata())) {
987 assert(Index == 0 &&
"Function-local metadata can only have one operand");
988 return wrap(L->getValue());
991 cast<MDNode>(MD->getMetadata()), Index);
994 return wrap(cast<User>(V)->getOperand(Index));
999 return wrap(&cast<User>(V)->getOperandUse(Index));
1003 unwrap<User>(Val)->setOperand(Index,
unwrap(Op));
1008 if (isa<MetadataAsValue>(V))
1011 return cast<User>(V)->getNumOperands();
1029 return isa<Constant>(
unwrap(Ty));
1034 return C->isNullValue();
1039 return isa<UndefValue>(
unwrap(Val));
1078 else if (
auto *C = dyn_cast<Constant>(V))
1080 else if (
auto *MDV = dyn_cast<MetadataAsValue>(V)) {
1081 MD = MDV->getMetadata();
1082 assert(!isa<LocalAsMetadata>(MD) &&
"Unexpected function-local metadata " 1083 "outside of direct argument to call");
1087 "Expected only one operand to function-local metadata");
1106 if (
auto *
C = dyn_cast<Constant>(V))
1108 if (
auto *MAV = dyn_cast<MetadataAsValue>(V))
1109 return wrap(MAV->getMetadata());
1114 if (
const auto *MD = dyn_cast<MetadataAsValue>(
unwrap(V)))
1115 if (
const MDString *S = dyn_cast<MDString>(MD->getMetadata())) {
1116 *Length = S->getString().size();
1117 return S->getString().data();
1124 auto *MD = cast<MetadataAsValue>(
unwrap(V));
1125 if (isa<ValueAsMetadata>(MD->getMetadata()))
1127 return cast<MDNode>(MD->getMetadata())->getNumOperands();
1147 NamedMDNode *NamedNode = unwrap<NamedMDNode>(NMD);
1155 NamedMDNode *NamedNode = unwrap<NamedMDNode>(NMD);
1163 const char *
Name,
size_t NameLen) {
1168 const char *
Name,
size_t NameLen) {
1169 return wrap(
unwrap(M)->getOrInsertNamedMetadata({
Name, NameLen}));
1173 NamedMDNode *NamedNode = unwrap<NamedMDNode>(NMD);
1179 auto *MD = cast<MetadataAsValue>(
unwrap(V));
1180 if (
auto *MDV = dyn_cast<ValueAsMetadata>(MD->getMetadata())) {
1181 *Dest =
wrap(MDV->getValue());
1184 const auto *
N = cast<MDNode>(MD->getMetadata());
1185 const unsigned numOperands =
N->getNumOperands();
1187 for (
unsigned i = 0; i < numOperands; i++)
1193 return N->getNumOperands();
1219 if (!Length)
return nullptr;
1221 if (
const auto *
I = dyn_cast<Instruction>(
unwrap(Val))) {
1222 if (
const auto &DL =
I->getDebugLoc()) {
1223 S = DL->getDirectory();
1225 }
else if (
const auto *GV = dyn_cast<GlobalVariable>(
unwrap(Val))) {
1227 GV->getDebugInfo(GVEs);
1230 S = DGV->getDirectory();
1231 }
else if (
const auto *
F = dyn_cast<Function>(
unwrap(Val))) {
1233 S = DSP->getDirectory();
1235 assert(0 &&
"Expected Instruction, GlobalVariable or Function");
1243 if (!Length)
return nullptr;
1245 if (
const auto *
I = dyn_cast<Instruction>(
unwrap(Val))) {
1246 if (
const auto &DL =
I->getDebugLoc()) {
1247 S = DL->getFilename();
1249 }
else if (
const auto *GV = dyn_cast<GlobalVariable>(
unwrap(Val))) {
1251 GV->getDebugInfo(GVEs);
1254 S = DGV->getFilename();
1255 }
else if (
const auto *
F = dyn_cast<Function>(
unwrap(Val))) {
1257 S = DSP->getFilename();
1259 assert(0 &&
"Expected Instruction, GlobalVariable or Function");
1268 if (
const auto *
I = dyn_cast<Instruction>(
unwrap(Val))) {
1269 if (
const auto &DL =
I->getDebugLoc()) {
1272 }
else if (
const auto *GV = dyn_cast<GlobalVariable>(
unwrap(Val))) {
1274 GV->getDebugInfo(GVEs);
1278 }
else if (
const auto *
F = dyn_cast<Function>(
unwrap(Val))) {
1282 assert(0 &&
"Expected Instruction, GlobalVariable or Function");
1290 if (
const auto *
I = dyn_cast<Instruction>(
unwrap(Val)))
1291 if (
const auto &DL =
I->getDebugLoc())
1292 C = DL->getColumn();
1305 const uint64_t Words[]) {
1319 unsigned SLen, uint8_t Radix) {
1338 return unwrap<ConstantInt>(ConstantVal)->getZExtValue();
1342 return unwrap<ConstantInt>(ConstantVal)->getSExtValue();
1346 ConstantFP *cFP = unwrap<ConstantFP>(ConstantVal) ;
1349 if (Ty->isFloatTy()) {
1354 if (Ty->isDoubleTy()) {
1362 *LosesInfo = APFLosesInfo;
1374 DontNullTerminate == 0));
1384 return wrap(unwrap<ConstantDataSequential>(C)->getElementAsConstant(idx));
1388 return unwrap<ConstantDataSequential>(
C)->isString();
1392 StringRef Str = unwrap<ConstantDataSequential>(
C)->getAsString();
1393 *Length = Str.
size();
1406 Constant **Elements = unwrap<Constant>(ConstantVals, Count);
1420 Constant **Elements = unwrap<Constant>(ConstantVals, Count);
1428 unwrap<Constant>(ScalarConstantVals, Size), Size)));
1437 #define HANDLE_INST(num, opc, clas) case num: return LLVM##opc; 1438 #include "llvm/IR/Instruction.def" 1446 #define HANDLE_INST(num, opc, clas) case LLVM##opc: return num; 1447 #include "llvm/IR/Instruction.def" 1490 unwrap<Constant>(RHSConstant)));
1496 unwrap<Constant>(RHSConstant)));
1502 unwrap<Constant>(RHSConstant)));
1507 unwrap<Constant>(RHSConstant)));
1512 unwrap<Constant>(RHSConstant)));
1518 unwrap<Constant>(RHSConstant)));
1524 unwrap<Constant>(RHSConstant)));
1529 unwrap<Constant>(RHSConstant)));
1534 unwrap<Constant>(RHSConstant)));
1540 unwrap<Constant>(RHSConstant)));
1546 unwrap<Constant>(RHSConstant)));
1551 unwrap<Constant>(RHSConstant)));
1556 unwrap<Constant>(RHSConstant)));
1562 unwrap<Constant>(RHSConstant)));
1567 unwrap<Constant>(RHSConstant)));
1573 unwrap<Constant>(RHSConstant)));
1578 unwrap<Constant>(RHSConstant)));
1583 unwrap<Constant>(RHSConstant)));
1588 unwrap<Constant>(RHSConstant)));
1593 unwrap<Constant>(RHSConstant)));
1598 unwrap<Constant>(RHSConstant)));
1603 unwrap<Constant>(RHSConstant)));
1608 unwrap<Constant>(RHSConstant)));
1614 unwrap<Constant>(LHSConstant),
1615 unwrap<Constant>(RHSConstant)));
1621 unwrap<Constant>(LHSConstant),
1622 unwrap<Constant>(RHSConstant)));
1627 unwrap<Constant>(RHSConstant)));
1632 unwrap<Constant>(RHSConstant)));
1637 unwrap<Constant>(RHSConstant)));
1644 Constant *Val = unwrap<Constant>(ConstantVal);
1652 unsigned NumIndices) {
1655 Constant *Val = unwrap<Constant>(ConstantVal);
1754 unwrap(ToType), isSigned));
1766 unwrap<Constant>(ConstantIfTrue),
1767 unwrap<Constant>(ConstantIfFalse)));
1773 unwrap<Constant>(IndexConstant)));
1780 unwrap<Constant>(ElementValueConstant),
1781 unwrap<Constant>(IndexConstant)));
1788 unwrap<Constant>(VectorBConstant),
1789 unwrap<Constant>(MaskConstant)));
1800 unsigned *IdxList,
unsigned NumIdx) {
1802 unwrap<Constant>(ElementValueConstant),
1807 const char *Constraints,
1811 Constraints, HasSideEffects, IsAlignStack));
1825 return unwrap<GlobalValue>(Global)->isDeclaration();
1829 switch (unwrap<GlobalValue>(Global)->getLinkage()) {
1875 errs() <<
"LLVMSetLinkage(): LLVMLinkOnceODRAutoHideLinkage is no " 1876 "longer supported.");
1902 <<
"LLVMSetLinkage(): LLVMDLLImportLinkage is no longer supported.");
1907 <<
"LLVMSetLinkage(): LLVMDLLExportLinkage is no longer supported.");
1914 errs() <<
"LLVMSetLinkage(): LLVMGhostLinkage is no longer supported.");
1925 return unwrap<GlobalValue>(Global)->
getSection().data();
1929 unwrap<GlobalObject>(Global)->setSection(Section);
1934 unwrap<GlobalValue>(Global)->getVisibility());
1938 unwrap<GlobalValue>(Global)
1939 ->setVisibility(static_cast<GlobalValue::VisibilityTypes>(Viz));
1944 unwrap<GlobalValue>(Global)->getDLLStorageClass());
1948 unwrap<GlobalValue>(Global)->setDLLStorageClass(
1949 static_cast<GlobalValue::DLLStorageClassTypes>(Class));
1953 switch (unwrap<GlobalValue>(Global)->getUnnamedAddr()) {
1967 switch (UnnamedAddr) {
1978 return unwrap<GlobalValue>(Global)->hasGlobalUnnamedAddr();
1982 unwrap<GlobalValue>(Global)->setUnnamedAddr(
1988 return wrap(unwrap<GlobalValue>(Global)->getValueType());
1994 Value *
P = unwrap<Value>(V);
1996 return GV->getAlignment();
1997 if (
AllocaInst *AI = dyn_cast<AllocaInst>(P))
1998 return AI->getAlignment();
1999 if (
LoadInst *LI = dyn_cast<LoadInst>(P))
2000 return LI->getAlignment();
2002 return SI->getAlignment();
2005 "only GlobalValue, AllocaInst, LoadInst and StoreInst have alignment");
2009 Value *
P = unwrap<Value>(V);
2012 else if (
AllocaInst *AI = dyn_cast<AllocaInst>(P))
2014 else if (
LoadInst *LI = dyn_cast<LoadInst>(P))
2020 "only GlobalValue, AllocaInst, LoadInst and StoreInst have alignment");
2024 size_t *NumEntries) {
2027 Instr->getAllMetadata(Entries);
2029 unwrap<GlobalObject>(
Value)->getAllMetadata(Entries);
2055 unwrap<GlobalObject>(Global)->
setMetadata(Kind, unwrap<MDNode>(MD));
2059 unwrap<GlobalObject>(Global)->eraseMetadata(Kind);
2063 unwrap<GlobalObject>(Global)->clearMetadata();
2083 return wrap(
unwrap(M)->getNamedGlobal(Name));
2119 unwrap<GlobalVariable>(
GlobalVar)->eraseFromParent();
2131 ->setInitializer(unwrap<Constant>(ConstantVal));
2135 return unwrap<GlobalVariable>(
GlobalVar)->isThreadLocal();
2139 unwrap<GlobalVariable>(
GlobalVar)->setThreadLocal(IsThreadLocal != 0);
2147 unwrap<GlobalVariable>(
GlobalVar)->setConstant(IsConstant != 0);
2151 switch (unwrap<GlobalVariable>(GlobalVar)->getThreadLocalMode()) {
2190 return unwrap<GlobalVariable>(
GlobalVar)->isExternallyInitialized();
2194 unwrap<GlobalVariable>(
GlobalVar)->setExternallyInitialized(IsExtInit);
2201 auto *PTy = cast<PointerType>(
unwrap(Ty));
2204 unwrap<Constant>(Aliasee),
unwrap(M)));
2208 const char *
Name,
size_t NameLen) {
2245 return wrap(unwrap<GlobalAlias>(Alias)->getAliasee());
2249 unwrap<GlobalAlias>(Alias)->setAliasee(unwrap<Constant>(Aliasee));
2267 if (I == Mod->
end())
2275 if (I == Mod->
begin())
2281 Function *Func = unwrap<Function>(Fn);
2289 Function *Func = unwrap<Function>(Fn);
2297 unwrap<Function>(Fn)->eraseFromParent();
2301 return unwrap<Function>(Fn)->hasPersonalityFn();
2305 return wrap(unwrap<Function>(Fn)->getPersonalityFn());
2309 unwrap<Function>(Fn)->setPersonalityFn(unwrap<Constant>(PersonalityFn));
2314 return F->getIntrinsicID();
2319 assert(ID < llvm::Intrinsic::num_intrinsics &&
"Intrinsic ID out of range");
2326 size_t ParamCount) {
2335 *NameLength = Str.size();
2353 *NameLength = Str.length();
2354 return strdup(Str.c_str());
2367 return unwrap<Function>(Fn)->getCallingConv();
2371 return unwrap<Function>(Fn)->setCallingConv(
2372 static_cast<CallingConv::ID>(CC));
2377 return F->
hasGC()? F->
getGC().c_str() :
nullptr;
2390 unwrap<Function>(
F)->addAttribute(Idx,
unwrap(A));
2414 const char *K,
unsigned KLen) {
2424 const char *K,
unsigned KLen) {
2425 unwrap<Function>(
F)->removeAttribute(Idx,
StringRef(K, KLen));
2430 Function *Func = unwrap<Function>(Fn);
2440 return unwrap<Function>(FnRef)->arg_size();
2444 Function *Fn = unwrap<Function>(FnRef);
2447 *ParamRefs++ =
wrap(&*
I);
2451 Function *Fn = unwrap<Function>(FnRef);
2460 Function *Func = unwrap<Function>(Fn);
2468 Function *Func = unwrap<Function>(Fn);
2478 if (A->
getArgNo() + 1 >= Fn->arg_size())
2498 const char *
Name,
size_t NameLen,
2504 unwrap<Constant>(Resolver),
unwrap(M)));
2508 const char *
Name,
size_t NameLen) {
2545 return wrap(unwrap<GlobalIFunc>(IFunc)->getResolver());
2549 unwrap<GlobalIFunc>(IFunc)->setResolver(unwrap<Constant>(Resolver));
2553 unwrap<GlobalIFunc>(IFunc)->eraseFromParent();
2557 unwrap<GlobalIFunc>(IFunc)->removeFromParent();
2563 return wrap(static_cast<Value*>(
unwrap(BB)));
2567 return isa<BasicBlock>(
unwrap(Val));
2571 return wrap(unwrap<BasicBlock>(Val));
2575 return unwrap(BB)->getName().data();
2587 return unwrap<Function>(FnRef)->
size();
2591 Function *Fn = unwrap<Function>(FnRef);
2593 *BasicBlocksRefs++ =
wrap(&BB);
2597 return wrap(&unwrap<Function>(Fn)->getEntryBlock());
2601 Function *Func = unwrap<Function>(Fn);
2603 if (I == Func->
end())
2609 Function *Func = unwrap<Function>(Fn);
2611 if (I == Func->
begin())
2641 assert(CurBB &&
"current insertion point is invalid!");
2648 unwrap<Function>(Fn)->getBasicBlockList().push_back(
unwrap(BB));
2674 unwrap(BBRef)->eraseFromParent();
2678 unwrap(BBRef)->removeFromParent();
2698 if (I == Block->
end())
2706 if (I == Block->
begin())
2728 unwrap<Instruction>(Inst)->removeFromParent();
2732 unwrap<Instruction>(Inst)->eraseFromParent();
2739 if (CE->getOpcode() == Instruction::ICmp)
2748 if (CE->getOpcode() == Instruction::FCmp)
2772 return FPI->getNumArgOperands();
2774 return unwrap<CallBase>(Instr)->getNumArgOperands();
2780 return unwrap<CallBase>(Instr)->getCallingConv();
2784 return unwrap<CallBase>(Instr)->setCallingConv(
2785 static_cast<CallingConv::ID>(CC));
2790 auto *Call = unwrap<CallBase>(Instr);
2793 Call->addAttribute(index, AlignAttr);
2798 unwrap<CallBase>(
C)->addAttribute(Idx,
unwrap(A));
2803 auto *Call = unwrap<CallBase>(
C);
2804 auto AS = Call->getAttributes().getAttributes(Idx);
2805 return AS.getNumAttributes();
2810 auto *Call = unwrap<CallBase>(
C);
2811 auto AS = Call->getAttributes().getAttributes(Idx);
2825 const char *K,
unsigned KLen) {
2835 const char *K,
unsigned KLen) {
2836 unwrap<CallBase>(
C)->removeAttribute(Idx,
StringRef(K, KLen));
2840 return wrap(unwrap<CallBase>(Instr)->getCalledValue());
2844 return wrap(unwrap<CallBase>(Instr)->getFunctionType());
2850 return unwrap<CallInst>(Call)->isTailCall();
2854 unwrap<CallInst>(Call)->setTailCall(isTailCall);
2860 return wrap(unwrap<InvokeInst>(Invoke)->getNormalDest());
2865 return wrap(CRI->getUnwindDest());
2867 return wrap(CSI->getUnwindDest());
2869 return wrap(unwrap<InvokeInst>(Invoke)->getUnwindDest());
2873 unwrap<InvokeInst>(Invoke)->setNormalDest(
unwrap(B));
2878 return CRI->setUnwindDest(
unwrap(B));
2880 return CSI->setUnwindDest(
unwrap(B));
2882 unwrap<InvokeInst>(Invoke)->setUnwindDest(
unwrap(B));
2888 return unwrap<Instruction>(Term)->getNumSuccessors();
2892 return wrap(unwrap<Instruction>(Term)->getSuccessor(i));
2896 return unwrap<Instruction>(Term)->setSuccessor(i,
unwrap(block));
2902 return unwrap<BranchInst>(
Branch)->isConditional();
2906 return wrap(unwrap<BranchInst>(Branch)->getCondition());
2910 return unwrap<BranchInst>(
Branch)->setCondition(
unwrap(Cond));
2916 return wrap(unwrap<SwitchInst>(Switch)->getDefaultDest());
2922 return wrap(unwrap<AllocaInst>(Alloca)->getAllocatedType());
2928 return unwrap<GetElementPtrInst>(
GEP)->isInBounds();
2932 return unwrap<GetElementPtrInst>(
GEP)->setIsInBounds(InBounds);
2939 PHINode *PhiVal = unwrap<PHINode>(PhiNode);
2940 for (
unsigned I = 0;
I != Count; ++
I)
2945 return unwrap<PHINode>(PhiNode)->getNumIncomingValues();
2949 return wrap(unwrap<PHINode>(PhiNode)->getIncomingValue(Index));
2953 return wrap(unwrap<PHINode>(PhiNode)->getIncomingBlock(Index));
2960 if (
auto *
GEP = dyn_cast<GetElementPtrInst>(
I))
2961 return GEP->getNumIndices();
2962 if (
auto *EV = dyn_cast<ExtractValueInst>(
I))
2963 return EV->getNumIndices();
2964 if (
auto *IV = dyn_cast<InsertValueInst>(
I))
2965 return IV->getNumIndices();
2966 if (
auto *CE = dyn_cast<ConstantExpr>(
I))
2967 return CE->getIndices().size();
2969 "LLVMGetNumIndices applies only to extractvalue and insertvalue!");
2974 if (
auto *EV = dyn_cast<ExtractValueInst>(
I))
2975 return EV->getIndices().data();
2976 if (
auto *IV = dyn_cast<InsertValueInst>(
I))
2977 return IV->getIndices().data();
2978 if (
auto *CE = dyn_cast<ConstantExpr>(
I))
2979 return CE->getIndices().data();
2981 "LLVMGetIndices applies only to extractvalue and insertvalue!");
2998 auto I = Instr ? unwrap<Instruction>(Instr)->getIterator() : BB->
end();
2999 unwrap(Builder)->SetInsertPoint(BB,
I);
3009 unwrap(Builder)->SetInsertPoint(BB);
3013 return wrap(
unwrap(Builder)->GetInsertBlock());
3017 unwrap(Builder)->ClearInsertionPoint();
3021 unwrap(Builder)->Insert(unwrap<Instruction>(Instr));
3026 unwrap(Builder)->Insert(unwrap<Instruction>(Instr), Name);
3036 return wrap(
unwrap(Builder)->getCurrentDebugLocation().getAsMDNode());
3041 unwrap(Builder)->SetCurrentDebugLocation(
DebugLoc(unwrap<MDNode>(Loc)));
3048 L ? cast<MDNode>(unwrap<MetadataAsValue>(L)->getMetadata()) :
nullptr;
3055 Context,
unwrap(Builder)->getCurrentDebugLocation().getAsMDNode()));
3059 unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
3065 unwrap(Builder)->setDefaultFPMathTag(FPMathTag
3066 ? unwrap<MDNode>(FPMathTag)
3071 return wrap(
unwrap(Builder)->getDefaultFPMathTag());
3104 unsigned NumDests) {
3114 cast<FunctionType>(cast<PointerType>(V->
getType())->getElementType());
3137 unwrap(B)->GetInsertBlock()->getParent()->setPersonalityFn(
3138 cast<Function>(
unwrap(PersFn)));
3153 if (ParentPad ==
nullptr) {
3168 unsigned NumHandlers,
const char *
Name) {
3169 if (ParentPad ==
nullptr) {
3174 NumHandlers, Name));
3179 return wrap(
unwrap(B)->CreateCatchRet(unwrap<CatchPadInst>(CatchPad),
3185 return wrap(
unwrap(B)->CreateCleanupRet(unwrap<CleanupPadInst>(CatchPad),
3195 unwrap<SwitchInst>(Switch)->addCase(unwrap<ConstantInt>(OnVal),
unwrap(Dest));
3199 unwrap<IndirectBrInst>(IndirectBr)->addDestination(
unwrap(Dest));
3203 return unwrap<LandingPadInst>(LandingPad)->getNumClauses();
3207 return wrap(unwrap<LandingPadInst>(LandingPad)->getClause(Idx));
3211 unwrap<LandingPadInst>(LandingPad)->
3212 addClause(cast<Constant>(
unwrap(ClauseVal)));
3216 return unwrap<LandingPadInst>(LandingPad)->isCleanup();
3220 unwrap<LandingPadInst>(LandingPad)->setCleanup(Val);
3224 unwrap<CatchSwitchInst>(CatchSwitch)->addHandler(
unwrap(Dest));
3228 return unwrap<CatchSwitchInst>(CatchSwitch)->getNumHandlers();
3235 *Handlers++ =
wrap(*
I);
3239 return wrap(unwrap<CatchPadInst>(CatchPad)->getCatchSwitch());
3243 unwrap<CatchPadInst>(CatchPad)
3244 ->setCatchSwitch(unwrap<CatchSwitchInst>(CatchSwitch));
3250 return wrap(unwrap<FuncletPadInst>(Funclet)->getArgOperand(i));
3254 unwrap<FuncletPadInst>(Funclet)->setArgOperand(i,
unwrap(value));
3426 ITy,
unwrap(Ty), AllocSize,
3427 nullptr,
nullptr,
"");
3437 ITy,
unwrap(Ty), AllocSize,
3438 unwrap(Val),
nullptr,
"");
3591 return wrap(
unwrap(B)->CreateGEP(Ty, Val, IdxList, Name));
3596 unsigned NumIndices,
const char *
Name) {
3608 return wrap(
unwrap(B)->CreateInBoundsGEP(Ty, Val, IdxList, Name));
3613 unsigned NumIndices,
const char *
Name) {
3620 unsigned Idx,
const char *
Name) {
3624 return wrap(
unwrap(B)->CreateStructGEP(Ty, Val, Idx, Name));
3636 return wrap(
unwrap(B)->CreateGlobalString(Str, Name));
3641 return wrap(
unwrap(B)->CreateGlobalStringPtr(Str, Name));
3645 Value *
P = unwrap<Value>(MemAccessInst);
3646 if (
LoadInst *LI = dyn_cast<LoadInst>(P))
3647 return LI->isVolatile();
3649 return SI->isVolatile();
3651 return AI->isVolatile();
3656 Value *
P = unwrap<Value>(MemAccessInst);
3657 if (
LoadInst *LI = dyn_cast<LoadInst>(P))
3658 return LI->setVolatile(isVolatile);
3660 return SI->setVolatile(isVolatile);
3662 return AI->setVolatile(isVolatile);
3663 return cast<AtomicCmpXchgInst>(
P)->setVolatile(isVolatile);
3667 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->isWeak();
3671 return unwrap<AtomicCmpXchgInst>(CmpXchgInst)->setWeak(isWeak);
3675 Value *
P = unwrap<Value>(MemAccessInst);
3677 if (
LoadInst *LI = dyn_cast<LoadInst>(P))
3678 O = LI->getOrdering();
3680 O =
SI->getOrdering();
3682 O = cast<AtomicRMWInst>(
P)->getOrdering();
3687 Value *
P = unwrap<Value>(MemAccessInst);
3690 if (
LoadInst *LI = dyn_cast<LoadInst>(P))
3691 return LI->setOrdering(O);
3692 return cast<StoreInst>(
P)->setOrdering(O);
3822 return wrap(
unwrap(B)->CreateICmp(static_cast<ICmpInst::Predicate>(Op),
3829 return wrap(
unwrap(B)->CreateFCmp(static_cast<FCmpInst::Predicate>(Op),
3844 cast<FunctionType>(cast<PointerType>(V->
getType())->getElementType());
3946 Value *
P = unwrap<Value>(AtomicInst);
3950 return cast<AtomicCmpXchgInst>(
P)->getSyncScopeID() ==
3955 Value *
P = unwrap<Value>(AtomicInst);
3959 return I->setSyncScopeID(SSID);
3960 return cast<AtomicCmpXchgInst>(
P)->setSyncScopeID(SSID);
3964 Value *
P = unwrap<Value>(CmpXchgInst);
3970 Value *
P = unwrap<Value>(CmpXchgInst);
3973 return cast<AtomicCmpXchgInst>(
P)->setSuccessOrdering(O);
3977 Value *
P = unwrap<Value>(CmpXchgInst);
3983 Value *
P = unwrap<Value>(CmpXchgInst);
3986 return cast<AtomicCmpXchgInst>(
P)->setFailureOrdering(O);
4006 char **OutMessage) {
4009 if (std::error_code EC = MBOrErr.
getError()) {
4010 *OutMessage = strdup(EC.message().c_str());
4013 *OutMemBuf =
wrap(MBOrErr.
get().release());
4018 char **OutMessage) {
4020 if (std::error_code EC = MBOrErr.
getError()) {
4021 *OutMessage = strdup(EC.message().c_str());
4024 *OutMemBuf =
wrap(MBOrErr.
get().release());
4029 const char *InputData,
4030 size_t InputDataLength,
4031 const char *BufferName,
4036 RequiresNullTerminator).
release());
4040 const char *InputData,
4041 size_t InputDataLength,
4042 const char *BufferName) {
4050 return unwrap(MemBuf)->getBufferStart();
4054 return unwrap(MemBuf)->getBufferSize();
4079 reinterpret_cast<LLVMModuleRef>(P));
4083 return unwrap<legacy::PassManager>(PM)->run(*
unwrap(M));
4087 return unwrap<legacy::FunctionPassManager>(FPM)->doInitialization();
4091 return unwrap<legacy::FunctionPassManager>(FPM)->run(*unwrap<Function>(F));
4095 return unwrap<legacy::FunctionPassManager>(FPM)->doFinalization();
LLVMValueRef LLVMConstExactSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString, const char *Constraints, LLVMBool HasSideEffects, LLVMBool IsAlignStack)
Deprecated: Use LLVMGetInlineAsm instead.
Subtract a value and return the old one.
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
const char * LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf)
static Constant * getFPTrunc(Constant *C, Type *Ty, bool OnlyIfReduced=false)
void LLVMDisposeBuilder(LLVMBuilderRef Builder)
Adds a requirement that another module flag be present and have a specified value after linking is pe...
LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy, LLVMValueRef *ConstantVals, unsigned Count)
Create a non-anonymous ConstantStruct from values.
LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst)
Create a copy of 'this' instruction that is identical in all ways except the following: ...
LLVMRealPredicate LLVMGetFCmpPredicate(LLVMValueRef Inst)
Obtain the float predicate of an instruction.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
LLVMBasicBlockRef LLVMInsertBasicBlockInContext(LLVMContextRef C, LLVMBasicBlockRef BBRef, const char *Name)
Insert a basic block in a function before another basic block.
Represents either an error or a value T.
void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest)
Get the elements within a structure.
void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs)
Obtain the parameters in a function.
LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar)
LLVMValueRef LLVMBuildICmp(LLVMBuilderRef B, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Add a floating point value and return the old one.
static Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true)
This method constructs a CDS and initializes it with a text string.
void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers)
Obtain the basic blocks acting as handlers for a catchswitch instruction.
StringRef getKindAsString() const
Return the attribute's kind as a string.
static bool isConstant(const MachineInstr &MI)
static Type * getDoubleTy(LLVMContext &C)
void LLVMSetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
LLVMValueRef LLVMGetFirstGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the first GlobalIFunc in a Module.
static IntegerType * getInt1Ty(LLVMContext &C)
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
unsigned LLVMGetPointerAddressSpace(LLVMTypeRef PointerTy)
Obtain the address space of a pointer type.
static Constant * getFAdd(Constant *C1, Constant *C2)
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
Special purpose, only applies to global arrays.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
LLVMBool LLVMHasPersonalityFn(LLVMValueRef Fn)
Check whether the given function has a personality function.
*p = old <signed v ? old : v
LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMBuildZExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn)
Obtain the basic block that corresponds to the entry point of a function.
LLVMValueRef LLVMGetLastFunction(LLVMModuleRef M)
Obtain an iterator to the last Function in a Module.
LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
This class represents an incoming formal argument to a Function.
Not-And a value and return the old one.
LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, LLVMBool singleThread)
static AtomicOrdering mapFromLLVMOrdering(LLVMAtomicOrdering Ordering)
LLVMValueRef LLVMConstUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMGetLastGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the last GlobalIFunc in a Module.
Externally visible function.
LLVMBool LLVMTypeIsSized(LLVMTypeRef Ty)
Whether the type has a known size.
LLVMValueRef LLVMConstSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
void LLVMSetSection(LLVMValueRef Global, const char *Section)
MDNode * getOperand(unsigned i) const
void LLVMSetValueName2(LLVMValueRef Val, const char *Name, size_t NameLen)
Set the string name of a value.
unsigned LLVMAttributeIndex
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
This class represents lattice values for constants.
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData, size_t InputDataLength, const char *BufferName)
provides both an Acquire and a Release barrier (for fences and operations which both read and write m...
const char * LLVMGetAsString(LLVMValueRef C, size_t *Length)
Get the given constant data sequential as a string.
LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMValueRef.
LLVMTypeRef LLVMIntrinsicGetType(LLVMContextRef Ctx, unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount)
Retrieves the type of an intrinsic.
static Constant * getNSWAdd(Constant *C1, Constant *C2)
void initializePrintModulePassWrapperPass(PassRegistry &)
A Module instance is used to store all the information related to an LLVM module. ...
struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef
LLVM uses a polymorphic type hierarchy which C cannot represent, therefore parameters must be passed ...
static Constant * getGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant *> IdxList, bool InBounds=false, Optional< unsigned > InRangeIndex=None, Type *OnlyIfReducedTy=nullptr)
Getelementptr form.
static MDNode * extractMDNode(MetadataAsValue *MAV)
void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block)
Update the specified successor to point at the provided block.
LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name)
LLVMValueRef LLVMBuildAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMBuilderRef LLVMCreateBuilder(void)
LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg)
Obtain the next parameter to a function.
2: 32-bit floating point type
Same, but only replaced by something equivalent.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
LLVMMetadataRef LLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder)
Get the dafult floating-point math metadata for a given builder.
LLVMModuleFlagBehavior Behavior
LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
static LLVMAtomicOrdering mapToLLVMOrdering(AtomicOrdering Ordering)
static MDString * get(LLVMContext &Context, StringRef Str)
LLVMValueRef LLVMBuildStructGEP(LLVMBuilderRef B, LLVMValueRef Pointer, unsigned Idx, const char *Name)
LLVMAttributeRef LLVMGetEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name)
LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy)
Determine whether a structure is opaque.
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange(const char *InputData, size_t InputDataLength, const char *BufferName, LLVMBool RequiresNullTerminator)
LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn)
Obtain the first parameter to a function.
void initializeSafepointIRVerifierPass(PassRegistry &)
void(*)(LLVMContext *Context, void *OpaqueHandle) YieldCallbackTy
Defines the type of a yield callback.
LLVMValueRef LLVMGetNextGlobalAlias(LLVMValueRef GA)
Advance a GlobalAlias iterator to the next GlobalAlias.
LLVMValueRef LLVMBuildSExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee, const char *Name)
LLVMAttributeRef LLVMCreateStringAttribute(LLVMContextRef C, const char *K, unsigned KLength, const char *V, unsigned VLength)
Create a string attribute.
LLVMValueRef LLVMAlignOf(LLVMTypeRef Ty)
LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global)
Deprecated: Use LLVMGetUnnamedAddress instead.
Available for inspection, not emission.
void push_back(const T &Elt)
void LLVMStopMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
LLVMOpcode
External users depend on the following values being stable.
void LLVMRemoveGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module.
void LLVMSetValueName(LLVMValueRef Val, const char *Name)
Deprecated: Use LLVMSetValueName2 instead.
static Constant * getAddrSpaceCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
const char * LLVMGetNamedMetadataName(LLVMNamedMDNodeRef NMD, size_t *NameLen)
Retrieve the name of a NamedMDNode.
LLVMValueRef LLVMConstFPToUI(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Emits an error if two values disagree, otherwise the resulting value is that of the operands...
const char * LLVMGetGC(LLVMValueRef Fn)
Obtain the name of the garbage collector to use during code generation.
LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef P)
Deprecated: Use LLVMCreateFunctionPassManagerForModule instead.
LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name)
LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca)
Obtain the type that is being allocated by the alloca instruction.
LLVMTypeRef LLVMHalfType(void)
Obtain a floating point type from the global context.
static std::unique_ptr< MemoryBuffer > getMemBuffer(StringRef InputData, StringRef BufferName="", bool RequiresNullTerminator=true)
Open the specified memory range as a MemoryBuffer.
LLVMValueRef LLVMBuildRet(LLVMBuilderRef B, LLVMValueRef V)
LLVMAttributeRef LLVMCreateEnumAttribute(LLVMContextRef C, unsigned KindID, uint64_t Val)
Create an enum attribute.
LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB)
Advance a basic block iterator.
LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const char *Path, LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
A global registry used in conjunction with static constructors to make pluggable components (like tar...
char * LLVMCreateMessage(const char *Message)
LLVMPassManagerRef LLVMCreatePassManager()
Constructs a new whole-module pass pipeline.
void addOperand(MDNode *M)
LLVMTypeRef LLVMFP128Type(void)
named_metadata_iterator named_metadata_end()
LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx)
static Constant * getExactSDiv(Constant *C1, Constant *C2)
void setGC(std::string Str)
LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
static PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space...
#define LLVM_FOR_EACH_VALUE_SUBCLASS(macro)
unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy)
Obtain the number of elements in a vector type.
LLVMMetadataRef LLVMModuleFlagEntriesGetMetadata(LLVMModuleFlagEntry *Entries, unsigned Index)
Returns the metadata for a module flag entry at a specific index.
LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI)
Return an enum LLVMDiagnosticSeverity.
*p = old <unsigned v ? old : v
An efficient, type-erasing, non-owning reference to a callable.
static Constant * getIntToPtr(Constant *C, Type *Ty, bool OnlyIfReduced=false)
LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst)
float convertToFloat() const
static Constant * getExtractElement(Constant *Vec, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
const char * LLVMGetDataLayoutStr(LLVMModuleRef M)
Obtain the data layout for a module.
LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef B, LLVMValueRef If, LLVMBasicBlockRef Then, LLVMBasicBlockRef Else)
ifunc_iterator ifunc_end()
Like Internal, but omit from symbol table.
LLVMTypeRef LLVMX86MMXType(void)
*p = old >unsigned v ? old : v
Externally visible function.
LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
bool isOverloaded(ID id)
Returns true if the intrinsic can be overloaded.
LLVMContext & getContext() const
All values hold a context through their type.
bool isTerminator() const
LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
struct LLVMOpaquePassRegistry * LLVMPassRegistryRef
LLVMNamedMDNodeRef LLVMGetLastNamedMetadata(LLVMModuleRef M)
Obtain an iterator to the last NamedMDNode in a Module.
void LLVMAppendExistingBasicBlock(LLVMValueRef Fn, LLVMBasicBlockRef BB)
Append the given basic block to the basic block list of the given function.
unsigned LLVMGetNumArgOperands(LLVMValueRef Instr)
Obtain the argument count for a call instruction.
struct LLVMOpaqueBuilder * LLVMBuilderRef
Represents an LLVM basic block builder.
LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
unsigned LLVMGetLastEnumAttributeKind(void)
LLVMTypeRef LLVMX86FP80Type(void)
LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val)
Obtain the first use of a value.
void LLVMClearInsertionPosition(LLVMBuilderRef Builder)
LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar)
4: 80-bit floating point type (X87)
LLVMTypeRef LLVMVectorType(LLVMTypeRef ElementType, unsigned ElementCount)
Create a vector type that contains a defined type and has a specific number of elements.
LLVMValueRef LLVMConstAnd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char *Name, unsigned SLen)
LLVMPassRegistryRef LLVMGetGlobalPassRegistry(void)
Return the global pass registry, for use with initialization functions.
const MDOperand & getOperand(unsigned I) const
LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMBuildFRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
param_iterator param_end() const
An instruction for reading from memory.
LLVMValueRef LLVMConstSelect(LLVMValueRef ConstantCondition, LLVMValueRef ConstantIfTrue, LLVMValueRef ConstantIfFalse)
1: 16-bit floating point type
LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val)
Determine whether an LLVMValueRef is itself a basic block.
static IntegerType * getInt64Ty(LLVMContext &C)
LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Create a new structure type in a context.
an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.
Appends the two values, which are required to be metadata nodes.
LLVMBasicBlockRef LLVMInsertBasicBlock(LLVMBasicBlockRef BBRef, const char *Name)
Insert a basic block in a function using the global context.
int LLVMHasMetadata(LLVMValueRef Inst)
Determine whether an instruction has any metadata attached.
static Type * getMetadataTy(LLVMContext &C)
static Constant * getSub(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
const char * LLVMGetSection(LLVMValueRef Global)
static Instruction * CreateFree(Value *Source, Instruction *InsertBefore)
Generate the IR for a call to the builtin free function.
LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C)
LLVMTypeRef LLVMTokenTypeInContext(LLVMContextRef C)
Create a token type in a context.
LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, LLVMBool isSingleThread, const char *Name)
void initializeCore(PassRegistry &)
Initialize all passes linked into the TransformUtils library.
handler_iterator handler_begin()
Returns an iterator that points to the first handler in CatchSwitchInst.
Synchronized with respect to signal handlers executing in the same thread.
static IntegerType * getInt16Ty(LLVMContext &C)
LLVMAttributeRef LLVMGetStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
static Type * getX86_MMXTy(LLVMContext &C)
LLVMValueRef LLVMGetPreviousGlobalAlias(LLVMValueRef GA)
Decrement a GlobalAlias iterator to the previous GlobalAlias.
*p = old >signed v ? old : v
LLVMValueRef LLVMConstAddrSpaceCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Lowest level of atomicity, guarantees somewhat sane results, lock free.
Appends the two values, which are required to be metadata nodes.
std::error_code error() const
static Type * getX86_FP80Ty(LLVMContext &C)
void LLVMContextDispose(LLVMContextRef C)
Destroy a context instance.
static Constant * get(ArrayType *T, ArrayRef< Constant *> V)
128 bit floating point type (112-bit mantissa)
LLVMBool LLVMIntrinsicIsOverloaded(unsigned ID)
Obtain if the intrinsic identified by the given ID is overloaded.
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 LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant)
void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal)
void LLVMSetModuleIdentifier(LLVMModuleRef M, const char *Ident, size_t Len)
Set the identifier of a module to a string Ident with length Len.
static Constant * getInsertElement(Constant *Vec, Constant *Elt, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
ExternalWeak linkage description.
LLVMValueRef LLVMConstNull(LLVMTypeRef Ty)
Obtain a constant value referring to the null instance of a type.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
LLVMValueRef LLVMConstReal(LLVMTypeRef RealTy, double N)
Obtain a constant value referring to a double floating point value.
LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM)
Initializes all of the function passes scheduled in the function pass manager.
void LLVMRemoveCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
void LLVMSetOperand(LLVMValueRef Val, unsigned Index, LLVMValueRef Op)
Set an operand at a specific index in a llvm::User value.
iterator begin()
Instruction iterator methods.
long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal)
Obtain the sign extended value for an integer constant value.
static Constant * getAdd(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
unsigned LLVMGetDebugLocLine(LLVMValueRef Val)
Return the line number of the debug location for this value, which must be an llvm::Instruction, llvm::GlobalVariable, or llvm::Function.
static Constant * getFMul(Constant *C1, Constant *C2)
void(* LLVMYieldCallback)(LLVMContextRef, void *)
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index, unsigned align)
void initializeDominatorTreeWrapperPassPass(PassRegistry &)
LLVMTypeRef LLVMStructGetTypeAtIndex(LLVMTypeRef StructTy, unsigned i)
Get the type of the element at a given index in the structure.
LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst)
Obtain the code opcode for an individual instruction.
LLVMTypeRef LLVMFP128TypeInContext(LLVMContextRef C)
Obtain a 128-bit floating point type (112-bit mantissa) from a context.
void LLVMEraseGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module and delete it.
const char * LLVMGetStructName(LLVMTypeRef Ty)
Obtain the name of a structure.
LLVMValueRef LLVMBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
const char * LLVMGetDebugLocDirectory(LLVMValueRef Val, unsigned *Length)
Return the directory of the debug location for this value, which must be an llvm::Instruction, llvm::GlobalVariable, or llvm::Function.
LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn)
Obtain the last basic block in a function.
Same, but only replaced by something equivalent.
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB)
Convert a basic block instance to a value type.
LLVMValueRef LLVMGetParentCatchSwitch(LLVMValueRef CatchPad)
Get the parent catchswitch instruction of a catchpad instruction.
static Constant * getIntegerCast(Constant *C, Type *Ty, bool isSigned)
Create a ZExt, Bitcast or Trunc for integer -> integer casts.
LLVMTypeRef LLVMLabelTypeInContext(LLVMContextRef C)
Create a label type in a context.
LLVMTypeRef LLVMDoubleTypeInContext(LLVMContextRef C)
Obtain a 64-bit floating point type from a context.
static Type * getTokenTy(LLVMContext &C)
LLVMValueRef LLVMGetNamedGlobalAlias(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalAlias value from a Module by its name.
LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size)
Create a ConstantVector from values.
void LLVMBuilderSetDefaultFPMathTag(LLVMBuilderRef Builder, LLVMMetadataRef FPMathTag)
Set the default floating-point math metadata for the given builder.
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
Set the new value and return the one old.
LLVMValueRef LLVMBuildExactSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
bool isStringAttribute() const
Return true if the attribute is a string (target-dependent) attribute.
LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty)
struct LLVMOpaqueNamedMDNode * LLVMNamedMDNodeRef
Represents an LLVM Named Metadata Node.
LLVMBool LLVMIsNull(LLVMValueRef Val)
Determine whether a value instance is null.
Attribute unwrap(LLVMAttributeRef Attr)
static Type * getFloatTy(LLVMContext &C)
LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant, LLVMValueRef VectorBConstant, LLVMValueRef MaskConstant)
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef Switch)
Obtain the default destination basic block of a switch instruction.
LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text)
Obtain a constant for a floating point value parsed from a string.
LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
LLVMValueRef LLVMBuildFreeze(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
LLVMValueRef LLVMBuildAggregateRet(LLVMBuilderRef B, LLVMValueRef *RetVals, unsigned N)
Class to represent struct types.
Sets the value if it's greater than the original using an unsigned comparison and return the old one...
A Use represents the edge between a Value definition and its users.
static Attribute getWithAlignment(LLVMContext &Context, Align Alignment)
Return a uniquified Attribute object that has the specific alignment set.
static Constant * getLShr(Constant *C1, Constant *C2, bool isExact=false)
static Constant * getNUWNeg(Constant *C)
Address of the GV is globally insignificant.
Add a value and return the old one.
static Optional< unsigned > getOpcode(ArrayRef< VPValue *> Values)
Returns the opcode of Values or ~0 if they do not all agree.
void LLVMPositionBuilder(LLVMBuilderRef Builder, LLVMBasicBlockRef Block, LLVMValueRef Instr)
LLVMTypeRef LLVMInt8TypeInContext(LLVMContextRef C)
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn)
Obtain the calling function of a function.
LLVMValueRef LLVMBuildStructGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, unsigned Idx, const char *Name)
LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType, LLVMBool isSigned)
LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
static AtomicRMWInst::BinOp mapFromLLVMRMWBinOp(LLVMAtomicRMWBinOp BinOp)
void setThreadLocalMode(ThreadLocalMode Val)
void LLVMSetDataLayout(LLVMModuleRef M, const char *DataLayoutStr)
Set the data layout for a module.
LLVMValueRef LLVMConstFSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
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...
unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy)
This file contains the simple types necessary to represent the attributes associated with functions a...
LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar)
unsigned LLVMGetDebugLocColumn(LLVMValueRef Val)
Return the column number of the debug location for this value, which must be an llvm::Instruction.
static Constant * getSExt(Constant *C, Type *Ty, bool OnlyIfReduced=false)
LLVMValueRef LLVMConstAShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB)
Obtain the function to which a basic block belongs.
void LLVMSetCondition(LLVMValueRef Branch, LLVMValueRef Cond)
Set the condition of a branch instruction.
unsigned getNumOperands() const
LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn)
Obtain the last parameter to a function.
LLVMValueRef LLVMConstICmp(LLVMIntPredicate Predicate, LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty)
Obtain a constant value referring to an undefined value of a type.
Rename collisions when linking (static functions)
uint64_t LLVMGetEnumAttributeValue(LLVMAttributeRef A)
Get the enum attribute's value.
void LLVMGlobalSetMetadata(LLVMValueRef Global, unsigned Kind, LLVMMetadataRef MD)
Sets a metadata attachment, erasing the existing metadata attachment if it already exists for the giv...
LLVMValueRef LLVMGetInlineAsm(LLVMTypeRef Ty, char *AsmString, size_t AsmStringSize, char *Constraints, size_t ConstraintsSize, LLVMBool HasSideEffects, LLVMBool IsAlignStack, LLVMInlineAsmDialect Dialect)
Create the specified uniqued inline asm string.
LLVMBool LLVMIsCleanup(LLVMValueRef LandingPad)
void LLVMGetSubtypes(LLVMTypeRef Tp, LLVMTypeRef *Arr)
Returns type's subtypes.
LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const char Str[], unsigned SLen)
void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz)
static Type * getPPC_FP128Ty(LLVMContext &C)
void LLVMSetNormalDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the normal destination basic block.
LLVMValueRef LLVMConstSExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
void LLVMContextSetDiagnosticHandler(LLVMContextRef C, LLVMDiagnosticHandler Handler, void *DiagnosticContext)
Set the diagnostic handler for this context.
LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar)
LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
static StructType * get(LLVMContext &Context, ArrayRef< Type *> Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
LLVMBool LLVMIsStringAttribute(LLVMAttributeRef A)
LLVMValueRef LLVMGetIntrinsicDeclaration(LLVMModuleRef Mod, unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount)
Create or insert the declaration of an intrinsic.
Expected< const typename ELFT::Shdr * > getSection(typename ELFT::ShdrRange Sections, uint32_t Index)
SIMD 'packed' format, or other vector type.
LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB)
Obtain the first instruction in a basic block.
LLVMTypeRef LLVMFloatType(void)
AtomicOrdering
Atomic ordering for LLVM's memory model.
global_iterator global_begin()
void LLVMDisposeMessage(char *Message)
A load or store which is not atomic.
LLVMValueRef LLVMConstFPCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
LLVMValueRef LLVMBuildSRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
struct LLVMOpaqueType * LLVMTypeRef
Each value in the LLVM IR has a type, an LLVMTypeRef.
AttributeList getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst)
Obtain the instruction that occurred before this one.
void LLVMContextSetYieldCallback(LLVMContextRef C, LLVMYieldCallback Callback, void *OpaqueHandle)
Set the yield callback function for this context.
static Constant * getZExt(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Instruction * clone() const
Create a copy of 'this' instruction that is identical in all ways except the following: ...
void LLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to before another one.
static Constant * getSizeOf(Type *Ty)
getSizeOf constant expr - computes the (alloc) size of a type (in address-units, not bits) in a targe...
LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant, LLVMValueRef ElementValueConstant, LLVMValueRef IndexConstant)
void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest)
Obtain the types of a function's parameters.
A constant value that is initialized with an expression using other constant values.
Class to represent function types.
void LLVMGlobalEraseMetadata(LLVMValueRef Global, unsigned Kind)
Erases a metadata attachment of the given kind if it exists.
char * LLVMPrintModuleToString(LLVMModuleRef M)
Return a string representation of the module.
static Type * getLabelTy(LLVMContext &C)
Type * getType() const
All values are typed, get the type of this value.
void LLVMDisposeModuleFlagsMetadata(LLVMModuleFlagEntry *Entries)
Destroys module flags metadata entries.
void LLVMDisposeModule(LLVMModuleRef M)
Destroy a module instance.
LLVMValueRef LLVMBuildCatchSwitch(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMBasicBlockRef UnwindBB, unsigned NumHandlers, 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...
opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar)
LLVMValueRef LLVMConstStructInContext(LLVMContextRef C, LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
Create an anonymous ConstantStruct with the specified values.
static Constant * getFPCast(Constant *C, Type *Ty)
Create a FPExt, Bitcast or FPTrunc for fp -> fp casts.
LLVMBool LLVMIsTailCall(LLVMValueRef Call)
Obtain whether a call instruction is a tail call.
LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB)
void llvm_shutdown()
llvm_shutdown - Deallocate and destroy all ManagedStatic variables.
LLVMValueRef LLVMConstZExtOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
BinOp
This enumeration lists the possible modifications atomicrmw can make.
LLVMValueRef LLVMConstGEP(LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
struct LLVMOpaqueUse * LLVMUseRef
Used to get the users and usees of a Value.
LLVMValueRef LLVMConstInBoundsGEP(LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
Keep one copy of function when linking (inline)
static Constant * getAShr(Constant *C1, Constant *C2, bool isExact=false)
LLVMValueRef LLVMBuildOr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMIsATerminatorInst(LLVMValueRef Inst)
Determine whether an instruction is a terminator.
void LLVMDeleteFunction(LLVMValueRef Fn)
Remove a function from its containing module and deletes it.
void LLVMRemoveCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
struct LLVMOpaqueContext * LLVMContextRef
The top-level container for all LLVM global data.
LLVMValueRef LLVMBuildFDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMGetPreviousGlobalIFunc(LLVMValueRef IFunc)
Decrement a GlobalIFunc iterator to the previous GlobalIFunc.
LLVMValueRef LLVMConstFPToSI(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
OR a value and return the old one.
LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB)
Go backwards in a basic block iterator.
This instruction compares its operands according to the predicate given to the constructor.
static Constant * getSelect(Constant *C, Constant *V1, Constant *V2, Type *OnlyIfReducedTy=nullptr)
Select constant expr.
LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M)
void LLVMDumpModule(LLVMModuleRef M)
Dump a representation of a module to stderr.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
void LLVMDisposeValueMetadataEntries(LLVMValueMetadataEntry *Entries)
Destroys value metadata entries.
unsigned LLVMCountIncoming(LLVMValueRef PhiNode)
Obtain the number of incoming basic blocks to a PHI node.
LLVM_NODISCARD size_t size() const
size - Get the string size.
unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen)
Obtain the intrinsic ID number which matches the given function name.
LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Deprecated: This cast is always signed.
LLVMTypeRef LLVMFloatTypeInContext(LLVMContextRef C)
Obtain a 32-bit floating point type from a context.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal)
Obtain the zero extended value for an integer constant value.
const std::string & getGC() const
An instruction for storing to memory.
LLVMValueRef LLVMConstFMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB)
Obtain the last instruction in a basic block.
const char * LLVMModuleFlagEntriesGetKey(LLVMModuleFlagEntry *Entries, unsigned Index, size_t *Len)
Returns the key for a module flag entry at a specific index.
LLVMValueRef LLVMBuildSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
#define LLVM_EXTENSION
LLVM_EXTENSION - Support compilers where we have a keyword to suppress pedantic diagnostics.
LLVMUseRef LLVMGetNextUse(LLVMUseRef U)
Obtain the next use of a value.
static const fltSemantics & IEEEdouble() LLVM_READNONE
LLVMValueRef LLVMAddFunction(LLVMModuleRef M, const char *Name, LLVMTypeRef FunctionTy)
Add a function to a module under a specified name.
LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
static Constant * getUDiv(Constant *C1, Constant *C2, bool isExact=false)
static Constant * getNSWNeg(Constant *C)
Keep one copy of function when linking (weak)
unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy)
Obtain the number of parameters this function accepts.
static Function * getFunction(Constant *C)
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
struct LLVMOpaqueAttributeRef * LLVMAttributeRef
Used to represent an attributes.
Type::subtype_iterator element_iterator
static ManagedStatic< LLVMContext > GlobalContext
Function * getDeclaration(Module *M, ID id, ArrayRef< Type *> Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
The file should be opened in text mode on platforms that make this distinction.
static Constant * getFDiv(Constant *C1, Constant *C2)
LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name)
Create an empty structure in a context having a specified name.
LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N, LLVMBool SignExtend)
Obtain a constant value for an integer type.
static BinaryOperator * CreateAdd(Value *S1, Value *S2, const Twine &Name, Instruction *InsertBefore, Value *FlagsOp)
size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf)
LLVMValueRef LLVMBuildAnd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Class to represent pointers.
void LLVMSetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage)
unsigned LLVMGetIntrinsicID(LLVMValueRef Fn)
Obtain the ID number from a function instance.
void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A, const char *V)
Add a target-dependent attribute to a function.
LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst)
Obtain the basic block to which an instruction belongs.
LLVMTypeRef LLVMInt64TypeInContext(LLVMContextRef C)
void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value)
LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M)
const char * LLVMGetBasicBlockName(LLVMBasicBlockRef BB)
Obtain the string name of a basic block.
LLVMAttributeRef LLVMGetCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy)
Obtain the length of an array type.
use_iterator_impl< Use > use_iterator
void LLVMDisposePassManager(LLVMPassManagerRef PM)
Frees the memory of a pass pipeline.
LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const char Str[], unsigned SLen, uint8_t Radix)
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
LLVMValueRef LLVMBuildIsNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
static LLVMAtomicRMWBinOp mapToLLVMRMWBinOp(AtomicRMWInst::BinOp BinOp)
void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile)
AttributeSet getAttributes(unsigned Index) const
The attributes for the specified index are returned.
void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak)
LLVMTypeRef LLVMVoidTypeInContext(LLVMContextRef C)
Create a void type in a context.
11: Arbitrary bit width integers
PassManager manages ModulePassManagers.
static Constant * getBitCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static int map_from_llvmopcode(LLVMOpcode code)
static xmlAttrPtr getAttribute(xmlNodePtr Node, const unsigned char *AttributeName)
ExternalWeak linkage description.
void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr)
Deprecated: Use LLVMSetUnnamedAddress instead.
#define LLVM_DEFINE_VALUE_CAST(name)
LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal)
void LLVMSetTarget(LLVMModuleRef M, const char *Triple)
Set the target triple for a module.
static Constant * getInsertValue(Constant *Agg, Constant *Val, ArrayRef< unsigned > Idxs, Type *OnlyIfReducedTy=nullptr)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
Same, but only replaced by something equivalent.
static Constant * getFNeg(Constant *C)
LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn)
Obtain the first basic block in a function.
LLVMNamedMDNodeRef LLVMGetNamedMetadata(LLVMModuleRef M, const char *Name, size_t NameLen)
Retrieve a NamedMDNode with the given name, returning NULL if no such node exists.
LLVMTypeRef LLVMMetadataTypeInContext(LLVMContextRef C)
Create a metadata type in a context.
LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L)
Deprecated: Passing the NULL location will crash.
const unsigned * LLVMGetIndices(LLVMValueRef Inst)
Obtain the indices as an array.
static Constant * getFRem(Constant *C1, Constant *C2)
void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block)
void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Set the contents of a structure type.
LLVMValueRef LLVMBuildShl(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
static ErrorOr< std::unique_ptr< MemoryBuffer > > getSTDIN()
Read all of stdin into a file buffer, and return it.
static IntegerType * getInt128Ty(LLVMContext &C)
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
Acquire provides a barrier of the sort necessary to acquire a lock to access other memory with normal...
void LLVMSetAtomicRMWBinOp(LLVMValueRef Inst, LLVMAtomicRMWBinOp BinOp)
void addAttr(Attribute::AttrKind Kind)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, const char *Name)
static ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
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.
LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
LLVMTypeRef LLVMInt32Type(void)
alias_iterator alias_end()
static Intrinsic::ID lookupIntrinsicID(StringRef Name)
This does the actual lookup of an intrinsic ID which matches the given function name.
void LLVMGetAttributesAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
LLVMValueRef LLVMBuildPhi(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
LLVM Basic Block Representation.
LLVMValueRef LLVMIsAMDString(LLVMValueRef Val)
Sets the value if it's greater than the original using an unsigned comparison and return the old one...
LLVMValueRef LLVMGetMetadata(LLVMValueRef Inst, unsigned KindID)
Return metadata associated with an instruction value.
The instances of the Type class are immutable: once they are created, they are never changed...
void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal)
unsigned LLVMCountBasicBlocks(LLVMValueRef FnRef)
Obtain the number of basic blocks in a function.
This is an important class for using LLVM in a threaded context.
LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy)
Determine whether a structure is packed.
void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal)
Replace all uses of a value with another one.
LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMBool LLVMStartMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
LLVMDiagnosticHandler LLVMContextGetDiagnosticHandler(LLVMContextRef C)
Get the diagnostic handler of this context.
LLVMContextRef LLVMGetModuleContext(LLVMModuleRef M)
Obtain the context to which this module is associated.
LLVMValueRef LLVMConstFDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
static BlockAddress * get(Function *F, BasicBlock *BB)
Return a BlockAddress for the specified function and basic block.
LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, const char *Name)
static LLVMValueMetadataEntry * llvm_getMetadata(size_t *NumEntries, llvm::function_ref< void(MetadataEntries &)> AccessMD)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
ifunc_iterator ifunc_begin()
LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMGetNamedFunction(LLVMModuleRef M, const char *Name)
Obtain a Function value from a Module by its name.
LLVMValueRef LLVMConstFNeg(LLVMValueRef ConstantVal)
This file contains the declarations for the subclasses of Constant, which represent the different fla...
LLVMValueRef LLVMGetLastGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the last GlobalAlias in a Module.
unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy)
Get the number of elements defined inside the structure.
LLVMAtomicRMWBinOp LLVMGetAtomicRMWBinOp(LLVMValueRef Inst)
LLVMThreadLocalMode LLVMGetThreadLocalMode(LLVMValueRef GlobalVar)
LLVMValueRef LLVMBuildSIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
char * LLVMPrintValueToString(LLVMValueRef Val)
Return a string representation of the value.
LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef Index, const char *Name)
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
std::error_code getError() const
LLVMValueRef LLVMBuildFMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
static Constant * getAnd(Constant *C1, Constant *C2)
void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class)
ModFlagBehavior
This enumeration defines the supported behaviors of module flags.
ConstantFP - Floating Point Values [float, double].
LLVMTypeRef LLVMPPCFP128TypeInContext(LLVMContextRef C)
Obtain a 128-bit floating point type (two 64-bits) from a context.
80 bit floating point type (X87)
LLVMValueRef LLVMBuildPtrDiff(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
double convertToDouble() const
LLVMValueRef LLVMBuildInBoundsGEP(LLVMBuilderRef B, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
static Constant * getSExtOrBitCast(Constant *C, Type *Ty)
void LLVMSetUnnamedAddress(LLVMValueRef Global, LLVMUnnamedAddr UnnamedAddr)
LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
bool llvm_is_multithreaded()
Returns true if LLVM is compiled with support for multi-threading, and false otherwise.
unsigned getNumAttributes() const
Return the number of attributes in this set.
element_iterator element_end() const
LLVMValueRef LLVMConstExtractValue(LLVMValueRef AggConstant, unsigned *IdxList, unsigned NumIdx)
LLVMValueRef LLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest)
LLVMValueRef LLVMConstOr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
unsigned LLVMGetNumContainedTypes(LLVMTypeRef Tp)
Return the number of types in the derived type.
void LLVMInstructionEraseFromParent(LLVMValueRef Inst)
Remove and delete an instruction.
static Constant * getShuffleVector(Constant *V1, Constant *V2, Constant *Mask, Type *OnlyIfReducedTy=nullptr)
LLVMModuleFlagBehavior LLVMModuleFlagEntriesGetFlagBehavior(LLVMModuleFlagEntry *Entries, unsigned Index)
Returns the flag behavior for a module flag entry at a specific index.
LLVMNamedMDNodeRef LLVMGetPreviousNamedMetadata(LLVMNamedMDNodeRef NMD)
Decrement a NamedMDNode iterator to the previous NamedMDNode.
param_iterator param_begin() const
LLVMValueMetadataEntry * LLVMGlobalCopyAllMetadata(LLVMValueRef Value, size_t *NumEntries)
Retrieves an array of metadata entries representing the metadata attached to this value...
LLVMUseRef LLVMGetOperandUse(LLVMValueRef Val, unsigned Index)
Obtain the use of an operand at a specific index in a llvm::User value.
void LLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
Move a basic block to after another one.
LLVMValueRef LLVMGetUsedValue(LLVMUseRef U)
Obtain the value this use corresponds to.
void addAttribute(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
static Type * getVoidTy(LLVMContext &C)
LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount)
Create a fixed size array type that refers to a specific type.
LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef C, unsigned idx)
Get an element at specified index as a constant.
LLVMBool LLVMIsUndef(LLVMValueRef Val)
Determine whether a value instance is undefined.
char * LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI)
Return a string representation of the DiagnosticInfo.
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align)
Set the alignment for a function parameter.
LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn)
LLVMBool LLVMContextShouldDiscardValueNames(LLVMContextRef C)
Retrieve whether the given context is set to discard all value names.
LLVMValueRef LLVMConstString(const char *Str, unsigned Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential with string content in the global context.
This instruction compares its operands according to the predicate given to the constructor.
LLVMTypeRef LLVMIntTypeInContext(LLVMContextRef C, unsigned NumBits)
StringRef getName() const
Return the name for this struct type if it has an identity.
Attribute::AttrKind getKindAsEnum() const
Return the attribute's kind as an enum (Attribute::AttrKind).
LLVMBasicBlockRef LLVMGetSuccessor(LLVMValueRef Term, unsigned i)
Return the specified successor.
6: 128-bit floating point type (two 64-bits, PowerPC)
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
static FunctionType * get(Type *Result, ArrayRef< Type *> Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
static Constant * get(StructType *T, ArrayRef< Constant *> V)
LLVMValueRef LLVMConstSRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
static Attribute getWithByValType(LLVMContext &Context, Type *Ty)
void LLVMSetGlobalIFuncResolver(LLVMValueRef IFunc, LLVMValueRef Resolver)
Sets the resolver function associated with this indirect function.
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
void LLVMContextSetDiscardValueNames(LLVMContextRef C, LLVMBool Discard)
Set whether the given context discards all value names.
LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef B)
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...
LLVMValueRef LLVMBuildInvoke(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, const char *Name)
self_iterator getIterator()
void LLVMShutdown()
Deallocate and destroy all ManagedStatic variables.
LLVMTypeRef LLVMPPCFP128Type(void)
LLVMValueRef LLVMBuildInBoundsGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Class to represent integer types.
LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
And a value and return the old one.
LLVMBool LLVMIsEnumAttribute(LLVMAttributeRef A)
Check for the different types of attributes.
LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
LLVMValueRef LLVMBuildNot(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder)
const char * LLVMGetTarget(LLVMModuleRef M)
Obtain the target triple for a module.
const char * LLVMGetValueName2(LLVMValueRef Val, size_t *Length)
Obtain the string name of a value.
LLVMTypeRef LLVMInt16Type(void)
Sets the value if it's greater than the original using a signed comparison and return the old one...
static Constant * getNot(Constant *C)
unsigned LLVMGetEnumAttributeKind(LLVMAttributeRef A)
Get the unique id corresponding to the enum attribute passed as argument.
void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr)
void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn)
Set the personality function attached to the function.
static Constant * getAllOnesValue(Type *Ty)
LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name)
Obtain a Type from a module by its registered name.
LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn)
Obtain the personality function attached to the function.
LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char Str[], uint8_t Radix)
unsigned LLVMGetNumClauses(LLVMValueRef LandingPad)
LLVMOpcode LLVMGetConstOpcode(LLVMValueRef ConstantVal)
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr)
Obtain the calling convention for a call instruction.
void LLVMDumpValue(LLVMValueRef Val)
Dump a representation of a value to stderr.
LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
struct LLVMOpaqueModuleProvider * LLVMModuleProviderRef
Interface used to provide a module to JIT or interpreter.
void LLVMGetNamedMetadataOperands(LLVMModuleRef M, const char *Name, LLVMValueRef *Dest)
Obtain the named metadata operands for a module.
FunctionPassManager manages FunctionPasses.
LLVMValueRef LLVMConstUIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
int LLVMGetNumOperands(LLVMValueRef Val)
Obtain the number of operands in a llvm::User value.
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
const char * LLVMIntrinsicGetName(unsigned ID, size_t *NameLength)
Retrieves the name of an intrinsic.
void * LLVMContextGetDiagnosticContext(LLVMContextRef C)
Get the diagnostic context of this context.
unsigned LLVMGetCallSiteAttributeCount(LLVMValueRef C, LLVMAttributeIndex Idx)
LLVMValueRef LLVMBuildGEP(LLVMBuilderRef B, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name, unsigned AddressSpace)
struct LLVMOpaqueDiagnosticInfo * LLVMDiagnosticInfoRef
LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C, const char *Name)
Create a new basic block without inserting it into a function.
static wasm::ValType getType(const TargetRegisterClass *RC)
LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
const char * LLVMGetDataLayout(LLVMModuleRef M)
C setMetadata(LLVMContext::MD_range, MDNode::get(Context, LowAndHigh))
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Like Private, but linker removes.
LLVMValueRef LLVMGetParam(LLVMValueRef FnRef, unsigned index)
Obtain the parameter at the specified index.
This struct is a compact representation of a valid (non-zero power of two) alignment.
LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str, unsigned Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential and initialize it with a string.
LLVMValueRef LLVMConstURem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Triple - Helper class for working with autoconf configuration names.
void LLVMAddHandler(LLVMValueRef CatchSwitch, LLVMBasicBlockRef Dest)
LLVMNamedMDNodeRef LLVMGetNextNamedMetadata(LLVMNamedMDNodeRef NMD)
Advance a NamedMDNode iterator to the next NamedMDNode.
LLVMTypeRef LLVMVoidType(void)
These are similar to the above functions except they operate on the global context.
bool has_error() const
Return the value of the flag in this raw_fd_ostream indicating whether an output error has been encou...
LLVMValueRef LLVMBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
static Type * getFP128Ty(LLVMContext &C)
Synchronized with respect to all concurrently executing threads.
LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C, LLVMValueRef FnRef, const char *Name)
Append a basic block to the end of a function.
LLVMTypeRef LLVMGetElementType(LLVMTypeRef WrappedTy)
Obtain the type of elements within a sequential type.
LLVMValueRef LLVMBuildNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf)
LLVMValueRef LLVMBuildUIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC)
Set the calling convention of a function.
Like Internal, but omit from symbol table.
void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Builder, LLVMMetadataRef Loc)
Set location information used by debugging information.
void LLVMGetBasicBlocks(LLVMValueRef FnRef, LLVMBasicBlockRef *BasicBlocksRefs)
Obtain all of the basic blocks in a function.
const APFloat & getValueAPF() const
Sets the value if it's Smaller than the original using a signed comparison and return the old one...
global_iterator global_end()
static Constant * getFCmp(unsigned short pred, Constant *LHS, Constant *RHS, bool OnlyIfReduced=false)
LLVMContextRef LLVMGetTypeContext(LLVMTypeRef Ty)
Obtain the context to which this type instance is associated.
static Constant * getPointerCast(Constant *C, Type *Ty)
Create a BitCast, AddrSpaceCast, or a PtrToInt cast constant expression.
static Constant * getSIToFP(Constant *C, Type *Ty, bool OnlyIfReduced=false)
LLVMValueRef LLVMGetOperand(LLVMValueRef Val, unsigned Index)
Obtain an operand at a specific index in a llvm::User value.
LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
static Type * getHalfTy(LLVMContext &C)
unsigned LLVMCountParams(LLVMValueRef FnRef)
Obtain the number of parameters in a function.
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
LLVMModuleProviderRef LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M)
Changes the type of M so it can be passed to FunctionPassManagers and the JIT.
void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr)
LLVMValueRef LLVMBuildFPCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc(size_t Sz)
LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef B)
Iterator for intrusive lists based on ilist_node.
LLVMValueRef LLVMBuildGlobalString(LLVMBuilderRef B, const char *Str, const char *Name)
LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty)
Obtain a constant that is a constant pointer pointing to NULL for a specified type.
void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal)
LLVMVisibility LLVMGetVisibility(LLVMValueRef Global)
LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
void LLVMInitializeCore(LLVMPassRegistryRef R)
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
LLVMContextRef LLVMContextCreate()
Create a new context.
LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty)
Obtain the enumerated type of a Type instance.
const char * LLVMGetDebugLocFilename(LLVMValueRef Val, unsigned *Length)
Return the filename of the debug location for this value, which must be an llvm::Instruction, llvm::GlobalVariable, or llvm::Function.
LLVMTypeRef LLVMTypeOf(LLVMValueRef Val)
Obtain the type of a value.
LLVMValueRef LLVMGetFirstGlobalAlias(LLVMModuleRef M)
Obtain an iterator to the first GlobalAlias in a Module.
LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty)
Obtain a constant value referring to the instance of a type consisting of all ones.
16: SIMD 'packed' format, or other vector type
LLVMValueRef LLVMConstFPTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
static Constant * getSDiv(Constant *C1, Constant *C2, bool isExact=false)
This struct is a compact representation of a valid (power of two) or undefined (0) alignment...
LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr)
Obtain the pointer to the function invoked by this instruction.
const char * LLVMGetSourceFileName(LLVMModuleRef M, size_t *Len)
Obtain the module's original source file name.
LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant, LLVMValueRef ElementValueConstant, unsigned *IdxList, unsigned NumIdx)
LLVMValueRef LLVMBuildURem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMTypeRef LLVMLabelType(void)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Keep one copy of function when linking (inline)
Arbitrary bit width integers.
Module.h This file contains the declarations for the Module class.
LLVMValueRef LLVMGetCondition(LLVMValueRef Branch)
Return the condition of a branch instruction.
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type *> Tys=None)
Return the function type for an intrinsic.
static LLVMOpcode map_to_llvmopcode(int opcode)
Type::subtype_iterator param_iterator
LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef B, LLVMRealPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
static Constant * getNUWMul(Constant *C1, Constant *C2)
struct LLVMOpaqueBasicBlock * LLVMBasicBlockRef
Represents a basic block of instructions in LLVM IR.
LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst)
Obtain the instruction that occurs after the one specified.
void LLVMDeleteGlobal(LLVMValueRef GlobalVar)
void LLVMSetParentCatchSwitch(LLVMValueRef CatchPad, LLVMValueRef CatchSwitch)
Set the parent catchswitch instruction of a catchpad instruction.
Xor a value and return the old one.
alias_iterator alias_begin()
LLVMValueRef LLVMGetGlobalIFuncResolver(LLVMValueRef IFunc)
Retrieves the resolver function associated with this indirect function, or NULL if it doesn't not exi...
LLVMValueRef LLVMConstSExtOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
LLVMValueRef LLVMBuildXor(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
static Constant * getNSWSub(Constant *C1, Constant *C2)
Emits a warning if two values disagree.
static Constant * getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
LLVMBool LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy)
Returns whether a function type is variadic.
LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder)
Deprecated: Returning the NULL location will crash.
Uses the specified value, regardless of the behavior or value of the other module.
static Constant * get(Type *Ty, double V)
This returns a ConstantFP, or a vector containing a splat of a ConstantFP, for the specified value in...
unsigned LLVMValueMetadataEntriesGetKind(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the kind of a value metadata entry at a specific index.
unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char *Name)
Obtain the number of operands for named metadata in a module.
void LLVMSetAtomicSingleThread(LLVMValueRef AtomicInst, LLVMBool NewValue)
LLVMTypeRef LLVMDoubleType(void)
32 bit floating point type
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 LLVMBuildInsertValue(LLVMBuilderRef B, LLVMValueRef AggVal, LLVMValueRef EltVal, unsigned Index, const char *Name)
LLVMValueRef LLVMGetUser(LLVMUseRef U)
Obtain the user value for a user.
void setLinkage(LinkageTypes LT)
LLVMValueRef LLVMConstFPExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global)
Returns the "value type" of a global value.
The access may modify the value stored in memory.
provides Acquire semantics for loads and Release semantics for stores.
static Module::ModFlagBehavior map_to_llvmModFlagBehavior(LLVMModuleFlagBehavior Behavior)
struct LLVMOpaquePassManager * LLVMPassManagerRef
LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Create a new structure type in the global context.
LLVMValueRef LLVMBuildShuffleVector(LLVMBuilderRef B, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, const char *Name)
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.
double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *LosesInfo)
Obtain the double value for an floating point constant value.
LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str, const char *Name)
void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit)
Subtract a floating point value and return the old one.
Class for arbitrary precision integers.
LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
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...
LLVMValueRef LLVMIsAMDNode(LLVMValueRef Val)
Same, but only replaced by something equivalent.
StringRef getName() const
LLVMValueRef LLVMGetNextGlobalIFunc(LLVMValueRef IFunc)
Advance a GlobalIFunc iterator to the next GlobalIFunc.
LLVMAttributeRef LLVMGetCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
LLVMValueRef LLVMBuildFree(LLVMBuilderRef B, LLVMValueRef PointerVal)
LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType, LLVMTypeRef *ParamTypes, unsigned ParamCount, LLVMBool IsVarArg)
Obtain a function type consisting of a specified signature.
unsigned getArgNo() const
Return the index of this formal argument in its containing function.
LLVMValueRef LLVMBuildBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar)
void LLVMSetModuleInlineAsm2(LLVMModuleRef M, const char *Asm, size_t Len)
Set inline assembly for a module.
static Constant * getFPToUI(Constant *C, Type *Ty, bool OnlyIfReduced=false)
LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
static char getTypeID(Type *Ty)
LLVMBool LLVMRunPassManager(LLVMPassManagerRef PM, LLVMModuleRef M)
Initializes, executes on the provided module, and finalizes all of the passes scheduled in the pass m...
LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB)
Obtain the terminator instruction for a basic block.
LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
Create a ConstantStruct in the global Context.
static Constant * getZExtOrBitCast(Constant *C, Type *Ty)
LLVMBool LLVMIsConstantString(LLVMValueRef C)
Returns true if the specified constant is an array of i8.
element_iterator element_begin() const
LLVMValueRef LLVMConstFCmp(LLVMRealPredicate Predicate, LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMTypeRef LLVMX86MMXTypeInContext(LLVMContextRef C)
Create a X86 MMX type in a context.
LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMBool LLVMIsDeclaration(LLVMValueRef Global)
void LLVMAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm, size_t Len)
Append inline assembly to a module.
static Instruction * CreateMalloc(Instruction *InsertBefore, Type *IntPtrTy, Type *AllocTy, Value *AllocSize, Value *ArraySize=nullptr, Function *MallocF=nullptr, const Twine &Name="")
Generate the IR for a call to malloc:
LLVMValueRef LLVMAliasGetAliasee(LLVMValueRef Alias)
Retrieve the target value of an alias.
LLVMValueRef LLVMBuildFPExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Basic diagnostic printer that uses an underlying raw_ostream.
LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal)
void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues, LLVMBasicBlockRef *IncomingBlocks, unsigned Count)
Add an incoming value to the end of a PHI list.
static Constant * getFSub(Constant *C1, Constant *C2)
LLVMValueRef LLVMBuildExtractValue(LLVMBuilderRef B, LLVMValueRef AggVal, unsigned Index, const char *Name)
LLVMValueRef LLVMBuildAShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
static Constant * getTruncOrBitCast(Constant *C, Type *Ty)
void LLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BBRef)
Remove a basic block from a function.
LLVMValueRef LLVMConstFAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
static Constant * getNeg(Constant *C, bool HasNUW=false, bool HasNSW=false)
void(* LLVMDiagnosticHandler)(LLVMDiagnosticInfoRef, void *)
LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMBuildMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
void LLVMAddNamedMetadataOperand(LLVMModuleRef M, const char *Name, LLVMValueRef Val)
Add an operand to named metadata.
LLVMBool LLVMIsInBounds(LLVMValueRef GEP)
Check whether the given GEP instruction is inbounds.
LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg)
Obtain the previous parameter to a function.
LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID)
Create a new, empty module in the global context.
unsigned LLVMGetNumIndices(LLVMValueRef Inst)
Obtain the number of indices.
void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal, LLVMBasicBlockRef Dest)
static Constant * getNSWMul(Constant *C1, Constant *C2)
bool hasGC() const
hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm to use during code generatio...
LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
LLVMAttributeRef wrap(Attribute Attr)
A raw_ostream that writes to a file descriptor.
char * LLVMPrintTypeToString(LLVMTypeRef Ty)
Return a string representation of the type.
LLVMBool LLVMIsConditional(LLVMValueRef Branch)
Return if a branch is conditional.
void LLVMRemoveEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)
void setUnnamedAddr(UnnamedAddr Val)
const Function * getParent() const
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.
LLVMValueRef LLVMBuildMemMove(LLVMBuilderRef B, LLVMValueRef Dst, unsigned DstAlign, LLVMValueRef Src, unsigned SrcAlign, LLVMValueRef Size)
Creates and inserts a memmove between the specified pointers.
LLVMValueRef LLVMBuildIntToPtr(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
static IntegerType * getInt32Ty(LLVMContext &C)
LLVMValueRef LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy, unsigned NumWords, const uint64_t Words[])
Obtain a constant value for an integer of arbitrary precision.
LLVMTypeRef LLVMInt64Type(void)
16 bit floating point type
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...
LLVMTypeRef LLVMHalfTypeInContext(LLVMContextRef C)
Obtain a 16-bit floating point type from a context.
Linkage
Describes symbol linkage.
LLVMBasicBlockRef LLVMAppendBasicBlock(LLVMValueRef FnRef, const char *Name)
Append a basic block to the end of a function using the global context.
const char * LLVMGetStringAttributeValue(LLVMAttributeRef A, unsigned *Length)
Get the string attribute's value.
guarantees that if you take all the operations affecting a specific address, a consistent ordering ex...
StringRef getValueAsString() const
Return the attribute's value as a string.
LLVMTypeRef LLVMInt128TypeInContext(LLVMContextRef C)
LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal)
LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, LLVMBool singleThread)
LLVMUnnamedAddr LLVMGetUnnamedAddress(LLVMValueRef Global)
void LLVMDeleteBasicBlock(LLVMBasicBlockRef BBRef)
Remove a basic block from a function and delete it.
static VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
LLVMAtomicOrdering LLVMGetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst)
LLVMValueRef LLVMBuildLShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
unsigned LLVMGetNumSuccessors(LLVMValueRef Term)
Return the number of successors that this terminator has.
LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
unsigned LLVMGetMDKindID(const char *Name, unsigned SLen)
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant *> IdxList)
Create an "inbounds" getelementptr.
const Function * getParent() const
Return the enclosing method, or null if none.
LLVMBool LLVMIsConstant(LLVMValueRef Ty)
Determine whether the specified value instance is constant.
static Constant * getPtrToInt(Constant *C, Type *Ty, bool OnlyIfReduced=false)
LLVMBasicBlockRef LLVMGetUnwindDest(LLVMValueRef Invoke)
Return the unwind destination basic block.
LLVMValueRef LLVMBuildFSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
static Constant * getOr(Constant *C1, Constant *C2)
LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
void LLVMSetUnwindDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)
Set the unwind destination basic block.
LLVMTypeRef LLVMInt1TypeInContext(LLVMContextRef C)
Obtain an integer type from a context with specified bit width.
LLVMBool LLVMGetVolatile(LLVMValueRef MemAccessInst)
LLVMTypeRef LLVMInt1Type(void)
Obtain an integer type from the global context with a specified bit width.
LLVMBool LLVMIsLiteralStruct(LLVMTypeRef StructTy)
Determine whether a structure is literal.
void initializeVerifierLegacyPassPass(PassRegistry &)
void LLVMGetCallSiteAttributes(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)
LLVMTypeRef LLVMIntType(unsigned NumBits)
void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC)
Set the calling convention for a call instruction.
LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M)
Constructs a new function-by-function pass pipeline over the module provider.
LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID, LLVMContextRef C)
Create a new, empty module in a specific context.
LLVMMetadataRef LLVMValueMetadataEntriesGetMetadata(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the underlying metadata node of a value metadata entry at a specific index.
LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef B, LLVMValueRef V, LLVMBasicBlockRef Else, unsigned NumCases)
LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, unsigned Length)
Create a ConstantArray from values.
128 bit floating point type (two 64-bits)
static ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
void LLVMDumpType(LLVMTypeRef Ty)
Dump a representation of a type to stderr.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
const BasicBlockListType & getBasicBlockList() const
Get the underlying elements of the Function...
static Constant * getShl(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Keep one copy of named function when linking (weak)
static BinaryOperator * CreateNeg(Value *S1, const Twine &Name, Instruction *InsertBefore, Value *FlagsOp)
Rename collisions when linking (static functions).
LLVMTypeRef LLVMInt8Type(void)
void LLVMAliasSetAliasee(LLVMValueRef Alias, LLVMValueRef Aliasee)
Set the target value of an alias.
static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
Special purpose, only applies to global arrays.
LLVMBool LLVMGetWeak(LLVMValueRef CmpXchgInst)
static InlineAsm * get(FunctionType *Ty, StringRef AsmString, StringRef Constraints, bool hasSideEffects, bool isAlignStack=false, AsmDialect asmDialect=AD_ATT)
InlineAsm::get - Return the specified uniqued inline asm string.
LLVMValueRef LLVMConstSIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
LLVMValueRef LLVMBuildMemCpy(LLVMBuilderRef B, LLVMValueRef Dst, unsigned DstAlign, LLVMValueRef Src, unsigned SrcAlign, LLVMValueRef Size)
Creates and inserts a memcpy between the specified pointers.
LLVMValueRef LLVMConstLShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM)
Finalizes all of the function passes scheduled in the function pass manager.
void close()
Manually flush the stream and close the file.
LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst)
Obtain the predicate of an instruction.
void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val)
LLVMValueRef LLVMConstShl(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Like LinkerPrivate, but is weak.
LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal)
LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PersFn, unsigned NumClauses, const char *Name)
LLVMTypeRef LLVMGetCalledFunctionType(LLVMValueRef Instr)
Obtain the function type called by this instruction.
unsigned LLVMGetAttributeCountAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx)
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, int64_t FileSize=-1, bool RequiresNullTerminator=true, bool IsVolatile=false)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null.
static LLVMModuleFlagBehavior map_from_llvmModFlagBehavior(Module::ModFlagBehavior Behavior)
3: 64-bit floating point type
const char * LLVMIntrinsicCopyOverloadedName(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...
LLVMValueRef LLVMGetFirstFunction(LLVMModuleRef M)
Obtain an iterator to the first Function in a Module.
LLVMValueRef LLVMBuildCatchRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
LLVM_NODISCARD const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
static Intrinsic::ID llvm_map_to_intrinsic_id(unsigned ID)
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.
LLVMMetadataRef LLVMGetCurrentDebugLocation2(LLVMBuilderRef Builder)
Get location information used by debugging information.
LLVMValueRef LLVMBuildCall2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
struct LLVMOpaqueMetadata * LLVMMetadataRef
Represents an LLVM Metadata.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename, char **ErrorMessage)
Print a representation of a module to a file.
handler_iterator handler_end()
Returns a read-only iterator that points one past the last handler in the CatchSwitchInst.
LLVMValueRef LLVMBuildVAArg(LLVMBuilderRef B, LLVMValueRef List, LLVMTypeRef Ty, const char *Name)
void LLVMSetThreadLocalMode(LLVMValueRef GlobalVar, LLVMThreadLocalMode Mode)
static Constant * getSRem(Constant *C1, Constant *C2)
Release is similar to Acquire, but with a barrier of the sort necessary to release a lock...
LLVMBuilderRef LLVMCreateBuilderInContext(LLVMContextRef C)
LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemAccessInst)
void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef Val)
Set metadata associated with an instruction value.
LLVMValueRef LLVMGetParamParent(LLVMValueRef V)
Obtain the function to which this argument belongs.
A raw_ostream that writes to an std::string.
const char * LLVMGetValueName(LLVMValueRef Val)
Deprecated: Use LLVMGetValueName2 instead.
LLVMValueRef LLVMGetArgOperand(LLVMValueRef Funclet, unsigned i)
LLVMValueRef LLVMGetNamedGlobalIFunc(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalIFunc value from a Module by its name.
LLVMValueRef LLVMBuildSExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMBuildBr(LLVMBuilderRef B, LLVMBasicBlockRef Dest)
void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
Address of the GV is locally insignificant.
LLVMValueRef LLVMBuildCleanupRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
LLVMLinkage LLVMGetLinkage(LLVMValueRef Global)
bool hasInitializer() const
Definitions have initializers, declarations don't.
static Constant * getURem(Constant *C1, Constant *C2)
void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder, LLVMBasicBlockRef BB)
Insert the given basic block after the insertion point of the given builder.
static StructType * create(LLVMContext &Context, StringRef Name)
This creates an identified struct.
LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val)
Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn)
Decrement a Function iterator to the previous Function.
static const Function * getParent(const Value *V)
void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering)
LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr, unsigned NumDests)
void LLVMSetGC(LLVMValueRef Fn, const char *GC)
Define the garbage collector to use during code generation.
LLVMDLLStorageClass LLVMGetDLLStorageClass(LLVMValueRef Global)
static Constant * getUIToFP(Constant *C, Type *Ty, bool OnlyIfReduced=false)
LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
static Constant * getFPToSI(Constant *C, Type *Ty, bool OnlyIfReduced=false)
LLVMValueRef LLVMConstExactUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMBuildIntCast2(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, LLVMBool IsSigned, const char *Name)
static Constant * getAnon(ArrayRef< Constant *> V, bool Packed=false)
Return an anonymous struct that has the specified elements.
LLVMTypeRef LLVMGetReturnType(LLVMTypeRef FunctionTy)
Obtain the Type this function Type returns.
LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildStore(LLVMBuilderRef B, LLVMValueRef Val, LLVMValueRef PointerVal)
LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueMetadataEntry * LLVMInstructionGetAllMetadataOtherThanDebugLoc(LLVMValueRef Value, size_t *NumEntries)
Returns the metadata associated with an instruction value, but filters out all the debug locations...
const char * LLVMGetModuleIdentifier(LLVMModuleRef M, size_t *Len)
Obtain the identifier of a module.
static Constant * getExtractValue(Constant *Agg, ArrayRef< unsigned > Idxs, Type *OnlyIfReducedTy=nullptr)
LLVMValueRef LLVMConstZExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
StringRef - Represent a constant reference to a string, i.e.
LLVMBool LLVMIsMultithreaded()
Check whether LLVM is executing in thread-safe mode or not.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
LLVMContextRef LLVMGetGlobalContext()
Obtain the global context instance.
LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
LLVMTypeRef LLVMInt32TypeInContext(LLVMContextRef C)
LLVMAtomicOrdering LLVMGetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst)
void initializePrintFunctionPassWrapperPass(PassRegistry &)
static Constant * getExactUDiv(Constant *C1, Constant *C2)
LLVMBool LLVMRunFunctionPassManager(LLVMPassManagerRef FPM, LLVMValueRef F)
Executes all of the function passes scheduled in the function pass manager on the provided function...
static bool isVolatile(Instruction *Inst)
64 bit floating point type
9: MMX vectors (64 bits, X86 specific)
static Constant * getAlignOf(Type *Ty)
getAlignOf constant expr - computes the alignment of a type in a target independent way (Note: the re...
LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace)
Create a pointer type that points to a defined type.
static Constant * getMul(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
LLVMValueRef LLVMBuildLoad(LLVMBuilderRef B, LLVMValueRef PointerVal, const char *Name)
void LLVMInstructionRemoveFromParent(LLVMValueRef Inst)
Remove and delete an instruction.
LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, LLVMValueRef IndexConstant)
void LLVMSetTailCall(LLVMValueRef Call, LLVMBool isTailCall)
Set whether a call instruction is a tail call.
static Constant * getNUWSub(Constant *C1, Constant *C2)
static BinaryOperator * CreateMul(Value *S1, Value *S2, const Twine &Name, Instruction *InsertBefore, Value *FlagsOp)
void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm)
Deprecated: Use LLVMSetModuleInlineAsm2 instead.
iterator insertAfter(iterator where, pointer New)
LLVMValueRef LLVMBuildAddrSpaceCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMBasicBlockRef LLVMGetNormalDest(LLVMValueRef Invoke)
Return the normal destination basic block.
bool hasName() const
Return true if this is a named struct that has a non-empty name.
const char * LLVMGetModuleInlineAsm(LLVMModuleRef M, size_t *Len)
Get inline assembly for a module.
const char * LLVMGetStringAttributeKind(LLVMAttributeRef A, unsigned *Length)
Get the string attribute's kind.
static Constant * getFPExtend(Constant *C, Type *Ty, bool OnlyIfReduced=false)
LLVMValueRef LLVMConstFRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMModuleFlagEntry * LLVMCopyModuleFlagsMetadata(LLVMModuleRef M, size_t *Len)
Returns the module flags as an array of flag-key-value triples.
static Constant * getNUWAdd(Constant *C1, Constant *C2)
unsigned LLVMGetAlignment(LLVMValueRef V)
Obtain the preferred alignment of the value.
LLVMValueRef LLVMGetNextFunction(LLVMValueRef Fn)
Advance a Function iterator to the next Function.
void LLVMAddAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Add an attribute to a function.
static IntegerType * getInt8Ty(LLVMContext &C)
unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch)
void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP)
Destroys the module M.
void LLVMRemoveStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)
LLVMTypeRef LLVMInt128Type(void)
LLVMValueRef LLVMBuildSelect(LLVMBuilderRef B, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, const char *Name)
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 Constant * get(ArrayRef< Constant *> V)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Address of the GV is significant.
LLVMNamedMDNodeRef LLVMGetFirstNamedMetadata(LLVMModuleRef M)
Obtain an iterator to the first NamedMDNode in a Module.
LLVMTypeRef LLVMX86FP80TypeInContext(LLVMContextRef C)
Obtain a 80-bit floating point type (X87) from a context.
Type * getElementType() const
struct LLVMOpaqueValue * LLVMValueRef
Represents an individual value in LLVM IR.
named_metadata_iterator named_metadata_begin()
Module * getParent()
Get the module that holds this named metadata collection.
Type * getTypeAtIndex(const Value *V) const
Given an index value into the type, return the type of the element.
const BasicBlock * getParent() const
void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr, const char *Name)
an instruction to allocate memory on the stack
static Constant * getXor(Constant *C1, Constant *C2)
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results...
LLVMValueRef LLVMBuildFPTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
5: 128-bit floating point type (112-bit mantissa)
void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds)
Set the given GEP instruction to be inbounds or not.
static LLVMValueRef getMDNodeOperandImpl(LLVMContext &Context, const MDNode *N, unsigned Index)
void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes)
Set the preferred alignment of the value.
LLVMValueKind LLVMGetValueKind(LLVMValueRef Val)
Obtain the enumerated type of a Value instance.
LLVMValueRef LLVMBuildCatchPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
void LLVMGlobalClearMetadata(LLVMValueRef Global)
Removes all metadata attachments from this value.
LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global)