41 #include <system_error>
45 #define DEBUG_TYPE "ir"
66 return strdup(Message);
86 void *DiagnosticContext) {
87 unwrap(C)->setDiagnosticHandler(
88 LLVM_EXTENSION reinterpret_cast<LLVMContext::DiagnosticHandlerTy>(Handler),
96 unwrap(C)->setYieldCallback(YieldCallback, OpaqueHandle);
113 std::string MsgStorage;
126 switch(
unwrap(DI)->getSeverity()) {
164 return unwrap(M)->getDataLayoutStr().c_str();
168 unwrap(M)->setDataLayout(Triple);
173 return unwrap(M)->getTargetTriple().c_str();
177 unwrap(M)->setTargetTriple(Triple);
185 char **ErrorMessage) {
189 *ErrorMessage = strdup(EC.message().c_str());
193 unwrap(M)->print(dest,
nullptr);
198 *ErrorMessage = strdup(
"Error printing to file");
209 unwrap(M)->print(os,
nullptr);
212 return strdup(buf.c_str());
271 return unwrap(Ty)->isSized();
279 return unwrap(Ty)->dump();
289 os <<
"Printing <null> Type";
293 return strdup(buf.c_str());
343 return unwrap<IntegerType>(IntegerTy)->
getBitWidth();
402 return unwrap<FunctionType>(FunctionTy)->isVarArg();
406 return wrap(unwrap<FunctionType>(FunctionTy)->getReturnType());
410 return unwrap<FunctionType>(FunctionTy)->getNumParams();
423 unsigned ElementCount,
LLVMBool Packed) {
429 unsigned ElementCount,
LLVMBool Packed) {
431 ElementCount, Packed);
448 unsigned ElementCount,
LLVMBool Packed) {
450 unwrap<StructType>(StructTy)->setBody(Tys, Packed != 0);
454 return unwrap<StructType>(StructTy)->getNumElements();
458 StructType *Ty = unwrap<StructType>(StructTy);
465 StructType *Ty = unwrap<StructType>(StructTy);
470 return unwrap<StructType>(StructTy)->isPacked();
474 return unwrap<StructType>(StructTy)->isOpaque();
496 return wrap(unwrap<SequentialType>(Ty)->getElementType());
500 return unwrap<ArrayType>(ArrayTy)->getNumElements();
504 return unwrap<PointerType>(
PointerTy)->getAddressSpace();
508 return unwrap<VectorType>(VectorTy)->getNumElements();
536 return unwrap(Val)->getName().data();
540 unwrap(Val)->setName(Name);
554 os <<
"Printing <null> Value";
558 return strdup(buf.c_str());
566 return unwrap<Instruction>(Inst)->hasMetadata();
570 auto *
I = unwrap<Instruction>(Inst);
571 assert(
I &&
"Expected instruction");
572 if (
auto *MD =
I->getMetadata(KindID))
582 assert((isa<MDNode>(MD) || isa<ConstantAsMetadata>(MD)) &&
583 "Expected a metadata node or a canonicalized constant");
585 if (
MDNode *
N = dyn_cast<MDNode>(MD))
594 unwrap<Instruction>(Inst)->setMetadata(KindID, N);
599 #define LLVM_DEFINE_VALUE_CAST(name) \
600 LLVMValueRef LLVMIsA##name(LLVMValueRef Val) { \
601 return wrap(static_cast<Value*>(dyn_cast_or_null<name>(unwrap(Val)))); \
607 if (
auto *MD = dyn_cast_or_null<MetadataAsValue>(
unwrap(Val)))
608 if (isa<MDNode>(MD->getMetadata()) ||
609 isa<ValueAsMetadata>(MD->getMetadata()))
615 if (
auto *MD = dyn_cast_or_null<MetadataAsValue>(
unwrap(Val)))
616 if (isa<MDString>(MD->getMetadata()))
652 if (
auto *C = dyn_cast<ConstantAsMetadata>(Op))
653 return wrap(C->getValue());
659 if (
auto *MD = dyn_cast<MetadataAsValue>(V)) {
660 if (
auto *L = dyn_cast<ValueAsMetadata>(MD->getMetadata())) {
661 assert(Index == 0 &&
"Function-local metadata can only have one operand");
662 return wrap(L->getValue());
665 cast<MDNode>(MD->getMetadata()), Index);
668 return wrap(cast<User>(V)->getOperand(Index));
673 return wrap(&cast<User>(V)->getOperandUse(Index));
677 unwrap<User>(Val)->setOperand(Index,
unwrap(Op));
682 if (isa<MetadataAsValue>(V))
685 return cast<User>(V)->getNumOperands();
703 return isa<Constant>(
unwrap(Ty));
708 return C->isNullValue();
713 return isa<UndefValue>(
unwrap(Val));
743 else if (
auto *C = dyn_cast<Constant>(V))
745 else if (
auto *MDV = dyn_cast<MetadataAsValue>(V)) {
746 MD = MDV->getMetadata();
747 assert(!isa<LocalAsMetadata>(MD) &&
"Unexpected function-local metadata "
748 "outside of direct argument to call");
752 "Expected only one operand to function-local metadata");
766 if (
const auto *MD = dyn_cast<MetadataAsValue>(
unwrap(V)))
767 if (
const MDString *S = dyn_cast<MDString>(MD->getMetadata())) {
768 *Len = S->getString().size();
769 return S->getString().data();
777 auto *MD = cast<MetadataAsValue>(
unwrap(V));
778 if (isa<ValueAsMetadata>(MD->getMetadata()))
780 return cast<MDNode>(MD->getMetadata())->getNumOperands();
785 auto *MD = cast<MetadataAsValue>(
unwrap(V));
786 if (
auto *MDV = dyn_cast<ValueAsMetadata>(MD->getMetadata())) {
787 *Dest =
wrap(MDV->getValue());
790 const auto *
N = cast<MDNode>(MD->getMetadata());
791 const unsigned numOperands =
N->getNumOperands();
793 for (
unsigned i = 0; i < numOperands; i++)
800 return N->getNumOperands();
835 const uint64_t Words[]) {
849 unsigned SLen, uint8_t Radix) {
868 return unwrap<ConstantInt>(ConstantVal)->getZExtValue();
872 return unwrap<ConstantInt>(ConstantVal)->getSExtValue();
876 ConstantFP *cFP = unwrap<ConstantFP>(ConstantVal) ;
879 if (Ty->isFloatTy()) {
884 if (Ty->isDoubleTy()) {
892 *LosesInfo = APFLosesInfo;
904 DontNullTerminate == 0));
909 Constant **Elements = unwrap<Constant>(ConstantVals, Count);
921 return wrap(static_cast<ConstantDataSequential*>(
unwrap(c))->getElementAsConstant(idx));
930 *Length = str.
size();
949 Constant **Elements = unwrap<Constant>(ConstantVals, Count);
957 unwrap<Constant>(ScalarConstantVals, Size), Size)));
966 #define HANDLE_INST(num, opc, clas) case num: return LLVM##opc;
967 #include "llvm/IR/Instruction.def"
975 #define HANDLE_INST(num, opc, clas) case LLVM##opc: return num;
976 #include "llvm/IR/Instruction.def"
1019 unwrap<Constant>(RHSConstant)));
1025 unwrap<Constant>(RHSConstant)));
1031 unwrap<Constant>(RHSConstant)));
1036 unwrap<Constant>(RHSConstant)));
1041 unwrap<Constant>(RHSConstant)));
1047 unwrap<Constant>(RHSConstant)));
1053 unwrap<Constant>(RHSConstant)));
1058 unwrap<Constant>(RHSConstant)));
1063 unwrap<Constant>(RHSConstant)));
1069 unwrap<Constant>(RHSConstant)));
1075 unwrap<Constant>(RHSConstant)));
1080 unwrap<Constant>(RHSConstant)));
1085 unwrap<Constant>(RHSConstant)));
1090 unwrap<Constant>(RHSConstant)));
1096 unwrap<Constant>(RHSConstant)));
1101 unwrap<Constant>(RHSConstant)));
1106 unwrap<Constant>(RHSConstant)));
1111 unwrap<Constant>(RHSConstant)));
1116 unwrap<Constant>(RHSConstant)));
1121 unwrap<Constant>(RHSConstant)));
1126 unwrap<Constant>(RHSConstant)));
1131 unwrap<Constant>(RHSConstant)));
1137 unwrap<Constant>(LHSConstant),
1138 unwrap<Constant>(RHSConstant)));
1144 unwrap<Constant>(LHSConstant),
1145 unwrap<Constant>(RHSConstant)));
1150 unwrap<Constant>(RHSConstant)));
1155 unwrap<Constant>(RHSConstant)));
1160 unwrap<Constant>(RHSConstant)));
1168 nullptr, unwrap<Constant>(ConstantVal), IdxList));
1173 unsigned NumIndices) {
1174 Constant* Val = unwrap<Constant>(ConstantVal);
1273 unwrap(ToType), isSigned));
1285 unwrap<Constant>(ConstantIfTrue),
1286 unwrap<Constant>(ConstantIfFalse)));
1292 unwrap<Constant>(IndexConstant)));
1299 unwrap<Constant>(ElementValueConstant),
1300 unwrap<Constant>(IndexConstant)));
1307 unwrap<Constant>(VectorBConstant),
1308 unwrap<Constant>(MaskConstant)));
1319 unsigned *IdxList,
unsigned NumIdx) {
1321 unwrap<Constant>(ElementValueConstant),
1326 const char *Constraints,
1330 Constraints, HasSideEffects, IsAlignStack));
1344 return unwrap<GlobalValue>(Global)->isDeclaration();
1348 switch (unwrap<GlobalValue>(Global)->getLinkage()) {
1393 DEBUG(
errs() <<
"LLVMSetLinkage(): LLVMLinkOnceODRAutoHideLinkage is no "
1394 "longer supported.");
1419 <<
"LLVMSetLinkage(): LLVMDLLImportLinkage is no longer supported.");
1423 <<
"LLVMSetLinkage(): LLVMDLLExportLinkage is no longer supported.");
1430 <<
"LLVMSetLinkage(): LLVMGhostLinkage is no longer supported.");
1439 return unwrap<GlobalValue>(Global)->getSection();
1443 unwrap<GlobalObject>(Global)->setSection(Section);
1448 unwrap<GlobalValue>(Global)->getVisibility());
1452 unwrap<GlobalValue>(Global)
1453 ->setVisibility(static_cast<GlobalValue::VisibilityTypes>(Viz));
1458 unwrap<GlobalValue>(Global)->getDLLStorageClass());
1462 unwrap<GlobalValue>(Global)->setDLLStorageClass(
1463 static_cast<GlobalValue::DLLStorageClassTypes>(Class));
1467 return unwrap<GlobalValue>(Global)->hasUnnamedAddr();
1471 unwrap<GlobalValue>(Global)->setUnnamedAddr(HasUnnamedAddr);
1477 Value *
P = unwrap<Value>(V);
1479 return GV->getAlignment();
1480 if (
AllocaInst *AI = dyn_cast<AllocaInst>(P))
1481 return AI->getAlignment();
1482 if (
LoadInst *LI = dyn_cast<LoadInst>(P))
1483 return LI->getAlignment();
1485 return SI->getAlignment();
1488 "only GlobalValue, AllocaInst, LoadInst and StoreInst have alignment");
1492 Value *
P = unwrap<Value>(V);
1494 GV->setAlignment(Bytes);
1495 else if (
AllocaInst *AI = dyn_cast<AllocaInst>(P))
1496 AI->setAlignment(Bytes);
1497 else if (
LoadInst *LI = dyn_cast<LoadInst>(P))
1498 LI->setAlignment(Bytes);
1500 SI->setAlignment(Bytes);
1503 "only GlobalValue, AllocaInst, LoadInst and StoreInst have alignment");
1523 return wrap(
unwrap(M)->getNamedGlobal(Name));
1559 unwrap<GlobalVariable>(
GlobalVar)->eraseFromParent();
1571 ->setInitializer(unwrap<Constant>(ConstantVal));
1575 return unwrap<GlobalVariable>(
GlobalVar)->isThreadLocal();
1579 unwrap<GlobalVariable>(
GlobalVar)->setThreadLocal(IsThreadLocal != 0);
1583 return unwrap<GlobalVariable>(
GlobalVar)->isConstant();
1587 unwrap<GlobalVariable>(
GlobalVar)->setConstant(IsConstant != 0);
1591 switch (unwrap<GlobalVariable>(GlobalVar)->getThreadLocalMode()) {
1630 return unwrap<GlobalVariable>(
GlobalVar)->isExternallyInitialized();
1634 unwrap<GlobalVariable>(
GlobalVar)->setExternallyInitialized(IsExtInit);
1641 auto *PTy = cast<PointerType>(
unwrap(Ty));
1643 unwrap<Constant>(Aliasee),
unwrap(M)));
1661 if (I == Mod->
end())
1669 if (I == Mod->
begin())
1691 unwrap<Function>(Fn)->eraseFromParent();
1695 return wrap(unwrap<Function>(Fn)->getPersonalityFn());
1699 unwrap<Function>(Fn)->setPersonalityFn(unwrap<Constant>(PersonalityFn));
1704 return F->getIntrinsicID();
1709 return unwrap<Function>(Fn)->getCallingConv();
1713 return unwrap<Function>(Fn)->setCallingConv(
1714 static_cast<CallingConv::ID>(CC));
1775 return unwrap<Function>(FnRef)->arg_size();
1779 Function *Fn = unwrap<Function>(FnRef);
1782 *ParamRefs++ =
wrap(
I);
1857 return wrap(static_cast<Value*>(
unwrap(BB)));
1861 return isa<BasicBlock>(
unwrap(Val));
1865 return wrap(unwrap<BasicBlock>(Val));
1877 return unwrap<Function>(FnRef)->
size();
1881 Function *Fn = unwrap<Function>(FnRef);
1883 *BasicBlocksRefs++ =
wrap(
I);
1887 return wrap(&unwrap<Function>(Fn)->getEntryBlock());
1893 if (I == Func->
end())
1901 if (I == Func->
begin())
1945 unwrap(BBRef)->eraseFromParent();
1949 unwrap(BBRef)->removeFromParent();
1969 if (I == Block->
end())
1977 if (I == Block->
begin())
1999 unwrap<Instruction>(Inst)->eraseFromParent();
2006 if (CE->getOpcode() == Instruction::ICmp)
2015 if (CE->getOpcode() == Instruction::FCmp)
2028 return wrap(C->clone());
2036 if (
CallInst *CI = dyn_cast<CallInst>(V))
2037 return CI->getCallingConv();
2038 if (
InvokeInst *II = dyn_cast<InvokeInst>(V))
2039 return II->getCallingConv();
2040 llvm_unreachable(
"LLVMGetInstructionCallConv applies only to call and invoke!");
2045 if (
CallInst *CI = dyn_cast<CallInst>(V))
2046 return CI->setCallingConv(static_cast<CallingConv::ID>(CC));
2047 else if (
InvokeInst *II = dyn_cast<InvokeInst>(V))
2048 return II->setCallingConv(static_cast<CallingConv::ID>(CC));
2049 llvm_unreachable(
"LLVMSetInstructionCallConv applies only to call and invoke!");
2058 AttributeSet::get(Call->getContext(),
2068 AttributeSet::get(Call->getContext(),
2079 AttributeSet::get(Call->getContext(),
2086 return unwrap<CallInst>(
Call)->isTailCall();
2090 unwrap<CallInst>(
Call)->setTailCall(isTailCall);
2096 return unwrap<TerminatorInst>(Term)->getNumSuccessors();
2100 return wrap(unwrap<TerminatorInst>(Term)->getSuccessor(i));
2104 return unwrap<TerminatorInst>(Term)->setSuccessor(i,
unwrap(block));
2110 return unwrap<BranchInst>(
Branch)->isConditional();
2114 return wrap(unwrap<BranchInst>(Branch)->getCondition());
2118 return unwrap<BranchInst>(
Branch)->setCondition(
unwrap(Cond));
2124 return wrap(unwrap<SwitchInst>(Switch)->getDefaultDest());
2131 PHINode *PhiVal = unwrap<PHINode>(PhiNode);
2132 for (
unsigned I = 0;
I != Count; ++
I)
2137 return unwrap<PHINode>(PhiNode)->getNumIncomingValues();
2141 return wrap(unwrap<PHINode>(PhiNode)->getIncomingValue(Index));
2145 return wrap(unwrap<PHINode>(PhiNode)->getIncomingBlock(Index));
2163 unwrap(Builder)->SetInsertPoint(BB, I);
2173 unwrap(Builder)->SetInsertPoint(BB);
2177 return wrap(
unwrap(Builder)->GetInsertBlock());
2181 unwrap(Builder)->ClearInsertionPoint();
2185 unwrap(Builder)->Insert(unwrap<Instruction>(Instr));
2190 unwrap(Builder)->Insert(unwrap<Instruction>(Instr), Name);
2201 L ? cast<MDNode>(unwrap<MetadataAsValue>(L)->getMetadata()) :
nullptr;
2208 Context,
unwrap(Builder)->getCurrentDebugLocation().getAsMDNode()));
2212 unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
2246 unsigned NumDests) {
2260 unsigned NumClauses,
const char *
Name) {
2274 unwrap<SwitchInst>(Switch)->addCase(unwrap<ConstantInt>(OnVal),
unwrap(Dest));
2278 unwrap<IndirectBrInst>(IndirectBr)->addDestination(
unwrap(Dest));
2282 unwrap<LandingPadInst>(LandingPad)->
2283 addClause(cast<Constant>(
unwrap(ClauseVal)));
2287 unwrap<LandingPadInst>(LandingPad)->setCleanup(Val);
2454 ITy,
unwrap(Ty), AllocSize,
2455 nullptr,
nullptr,
"");
2465 ITy,
unwrap(Ty), AllocSize,
2466 unwrap(Val),
nullptr,
"");
2523 return wrap(
unwrap(B)->CreateGEP(
nullptr,
unwrap(Pointer), IdxList, Name));
2531 unwrap(B)->CreateInBoundsGEP(
nullptr,
unwrap(Pointer), IdxList, Name));
2535 unsigned Idx,
const char *
Name) {
2536 return wrap(
unwrap(B)->CreateStructGEP(
nullptr,
unwrap(Pointer), Idx, Name));
2541 return wrap(
unwrap(B)->CreateGlobalString(Str, Name));
2546 return wrap(
unwrap(B)->CreateGlobalStringPtr(Str, Name));
2550 Value *
P = unwrap<Value>(MemAccessInst);
2551 if (
LoadInst *LI = dyn_cast<LoadInst>(P))
2552 return LI->isVolatile();
2557 Value *
P = unwrap<Value>(MemAccessInst);
2558 if (
LoadInst *LI = dyn_cast<LoadInst>(P))
2559 return LI->setVolatile(isVolatile);
2560 return cast<StoreInst>(
P)->setVolatile(isVolatile);
2675 return wrap(
unwrap(B)->CreateICmp(static_cast<ICmpInst::Predicate>(Op),
2682 return wrap(
unwrap(B)->CreateFCmp(static_cast<FCmpInst::Predicate>(Op),
2733 unsigned Index,
const char *
Name) {
2799 char **OutMessage) {
2802 if (std::error_code EC = MBOrErr.
getError()) {
2803 *OutMessage = strdup(EC.message().c_str());
2806 *OutMemBuf =
wrap(MBOrErr.
get().release());
2811 char **OutMessage) {
2813 if (std::error_code EC = MBOrErr.
getError()) {
2814 *OutMessage = strdup(EC.message().c_str());
2817 *OutMemBuf =
wrap(MBOrErr.
get().release());
2822 const char *InputData,
2823 size_t InputDataLength,
2824 const char *BufferName,
2829 RequiresNullTerminator).release());
2833 const char *InputData,
2834 size_t InputDataLength,
2835 const char *BufferName) {
2843 return unwrap(MemBuf)->getBufferStart();
2847 return unwrap(MemBuf)->getBufferSize();
2872 reinterpret_cast<LLVMModuleRef>(P));
2876 return unwrap<legacy::PassManager>(PM)->run(*
unwrap(M));
2880 return unwrap<legacy::FunctionPassManager>(FPM)->doInitialization();
2884 return unwrap<legacy::FunctionPassManager>(FPM)->run(*unwrap<Function>(F));
2888 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)
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 (if unknown returns 0).
const char * LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf)
static Constant * getFPTrunc(Constant *C, Type *Ty, bool OnlyIfReduced=false)
void LLVMDisposeBuilder(LLVMBuilderRef Builder)
void push_back(const T &Elt)
LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy, LLVMValueRef *ConstantVals, unsigned Count)
Create a non-anonymous ConstantStruct from values.
use_iterator_impl< Use > use_iterator
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.
std::error_code getError() const
struct LLVMOpaqueType * LLVMTypeRef
Each value in the LLVM IR has a type, an LLVMTypeRef.
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)
static Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true)
getString - This method constructs a CDS and initializes it with a text string.
static Type * getDoubleTy(LLVMContext &C)
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
static IntegerType * getInt1Ty(LLVMContext &C)
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)
addIncoming - 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...
static MDNode * extractMDNode(MetadataAsValue *MAV)
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this 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)
static LLVMValueRef getMDNodeOperandImpl(LLVMContext &Context, const MDNode *N, unsigned Index)
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)
LLVM Argument representation.
Not-And a value and return the old one.
LLVMValueRef LLVMConstUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
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)
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align)
Set the alignment for a function parameter.
size_t size() const
size - Get the string size.
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...
LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMValueRef.
static Constant * getNSWAdd(Constant *C1, Constant *C2)
static const fltSemantics IEEEdouble
void initializePrintModulePassWrapperPass(PassRegistry &)
A Module instance is used to store all the information related to an LLVM module. ...
struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef
Used to pass regions of memory through LLVM interfaces.
void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block)
Update the specified successor to point at the provided block.
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.
LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
static MDString * get(LLVMContext &Context, StringRef Str)
LLVMValueRef LLVMBuildStructGEP(LLVMBuilderRef B, LLVMValueRef Pointer, unsigned Idx, const char *Name)
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)
static Constant * getAnon(ArrayRef< Constant * > V, bool Packed=false)
getAnon - Return an anonymous struct that has the specified elements.
LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn)
Obtain the first parameter to a function.
LLVMValueRef LLVMBuildSExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee, const char *Name)
LLVMValueRef LLVMAlignOf(LLVMTypeRef Ty)
LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global)
Available for inspection, not emission.
void LLVMStopMultithreaded()
Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...
LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const char Str[], unsigned SLen)
void LLVMSetValueName(LLVMValueRef Val, const char *Name)
Set the string name of a value.
static Constant * getAddrSpaceCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
LLVMValueRef LLVMConstFPToUI(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Type::subtype_iterator param_iterator
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)
void LLVMAddAttribute(LLVMValueRef Arg, LLVMAttribute PA)
Add an attribute to a function argument.
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)
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.
const char * getGC() const
void addOperand(MDNode *M)
LLVMTypeRef LLVMFP128Type(void)
CallInst - This class represents a function call, abstracting a target machine's calling convention...
static Constant * getExactSDiv(Constant *C1, Constant *C2)
LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
static PointerType * get(Type *ElementType, unsigned AddressSpace)
PointerType::get - This constructs a pointer to an object of the specified type in a numbered address...
#define LLVM_FOR_EACH_VALUE_SUBCLASS(macro)
unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy)
Obtain the number of elements in a vector type.
void(* LLVMDiagnosticHandler)(LLVMDiagnosticInfoRef, void *)
LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI)
Return an enum LLVMDiagnosticSeverity.
*p = old <unsigned v ? old : v
static Constant * getIntToPtr(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static Constant * getGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList, bool InBounds=false, Type *OnlyIfReducedTy=nullptr)
Getelementptr form.
static Constant * getExtractElement(Constant *Vec, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef B, LLVMValueRef If, LLVMBasicBlockRef Then, LLVMBasicBlockRef Else)
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)
LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
void setAttributes(const AttributeSet &PAL)
const Function * getParent() const
Return the enclosing method, or null if none.
LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
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.
LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMBuildFRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LoadInst - 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)
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val)
Determine whether an LLVMValueRef is itself a basic block.
static IntegerType * getInt64Ty(LLVMContext &C)
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys=None)
Return the function type for an intrinsic.
LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Create a new structure type in a context.
AttrBuilder & addAttribute(Attribute::AttrKind Val)
Add an attribute to the builder.
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 Constant * getSub(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
const char * LLVMGetSection(LLVMValueRef Global)
static Instruction * CreateFree(Value *Source, Instruction *InsertBefore)
CreateFree - Generate the IR for a call to the builtin free function.
LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C)
LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, LLVMBool isSingleThread, const char *Name)
void initializeCore(PassRegistry &)
initializeCore - Initialize all passes linked into the TransformUtils library.
static IntegerType * getInt16Ty(LLVMContext &C)
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
static Type * getX86_MMXTy(LLVMContext &C)
LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char Str[], uint8_t Radix)
*p = old >signed v ? old : v
void LLVMGetNamedMetadataOperands(LLVMModuleRef M, const char *name, LLVMValueRef *Dest)
Obtain the named metadata operands for a module.
LLVMValueRef LLVMConstAddrSpaceCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Lowest level of atomicity, guarantees somewhat sane results, lock free.
void LLVMRemoveFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA)
Remove an attribute from a function.
static Type * getX86_FP80Ty(LLVMContext &C)
void LLVMContextDispose(LLVMContextRef C)
Destroy a context instance.
128 bit floating point type (112-bit mantissa)
void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant)
void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal)
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.
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)
LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM)
Initializes all of the function passes scheduled in the function pass manager.
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)
static Constant * getFMul(Constant *C1, Constant *C2)
void addAttr(AttributeSet AS)
Add a Attribute to an argument.
element_iterator element_end() const
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.
const char * LLVMGetStructName(LLVMTypeRef Ty)
Obtain the name of a structure.
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.
void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA)
Add an attribute to a function.
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.
LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size)
Create a ConstantVector from values.
bool has_error() const
Return the value of the flag in this raw_fd_ostream indicating whether an output error has been encou...
Set the new value and return the one old.
LLVMValueRef LLVMBuildExactSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
void(* LLVMYieldCallback)(LLVMContextRef, void *)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Type::subtype_iterator element_iterator
LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty)
LLVMBool LLVMIsNull(LLVMValueRef Val)
Determine whether a value instance is null.
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 LLVMBuildAggregateRet(LLVMBuilderRef B, LLVMValueRef *RetVals, unsigned N)
StructType - Class to represent struct types.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
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 Constant * getLShr(Constant *C1, Constant *C2, bool isExact=false)
param_iterator param_end() const
static Constant * getNUWNeg(Constant *C)
LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const char Str[], unsigned SLen, uint8_t Radix)
Add a value and return the old one.
void LLVMPositionBuilder(LLVMBuilderRef Builder, LLVMBasicBlockRef Block, LLVMValueRef Instr)
LLVMTypeRef LLVMInt8TypeInContext(LLVMContextRef C)
unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn)
Obtain the calling function of a function.
LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType, LLVMBool isSigned)
LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
static Constant * get(ArrayRef< Constant * > V)
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
void setThreadLocalMode(ThreadLocalMode Val)
LLVMValueRef LLVMConstFSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy)
This file contains the simple types necessary to represent the attributes associated with functions a...
LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar)
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.
LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn)
Obtain the last parameter to a function.
LLVMValueRef LLVMConstICmp(LLVMIntPredicate Predicate, LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
element_iterator element_begin() const
LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty)
Obtain a constant value referring to an undefined value of a type.
Rename collisions when linking (static functions)
void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz)
void LLVMAddNamedMetadataOperand(LLVMModuleRef M, const char *name, LLVMValueRef Val)
Add an operand to named metadata.
static Type * getPPC_FP128Ty(LLVMContext &C)
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)
LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef c, unsigned idx)
Get an element at specified index as a constant.
void removeAttr(AttributeSet AS)
Remove a Attribute from an argument.
SIMD 'packed' format, or other vector type.
LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB)
Obtain the first instruction in a basic block.
LLVMTypeRef LLVMFloatType(void)
Number of individual test Apply this number of consecutive mutations to each input If
global_iterator global_begin()
void LLVMDisposeMessage(char *Message)
A load or store which is not atomic.
LLVMValueRef LLVMConstFPCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
struct LLVMOpaqueModuleProvider * LLVMModuleProviderRef
Interface used to provide a module to JIT or interpreter.
LLVMValueRef LLVMBuildSRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst)
Obtain the instruction that occurred before this one.
LLVMTargetDataRef wrap(const DataLayout *P)
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)
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.
ConstantExpr - a constant value that is initialized with an expression using other constant values...
FunctionType - Class to represent function types.
char * LLVMPrintModuleToString(LLVMModuleRef M)
Return a string representation of the module.
static Type * getLabelTy(LLVMContext &C)
void LLVMDisposeModule(LLVMModuleRef M)
Destroy a module instance.
void LLVMSetInstDebugLocation(LLVMBuilderRef Builder, LLVMValueRef Inst)
LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar)
LLVMContext & getContext() const
getContext - Return the LLVMContext in which this type was uniqued.
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)
ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integ...
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.
const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
LLVMValueRef LLVMConstGEP(LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
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)
void LLVMDeleteFunction(LLVMValueRef Fn)
Remove a function from its containing module and deletes it.
LLVMValueRef LLVMBuildFDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
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.
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
FunctionType::get - This static method is the primary way of constructing a FunctionType.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
unsigned LLVMCountIncoming(LLVMValueRef PhiNode)
Obtain the number of incoming basic blocks to a PHI node.
double convertToDouble() const
LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMTypeRef LLVMFloatTypeInContext(LLVMContextRef C)
Obtain a 32-bit floating point type from a context.
unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal)
Obtain the zero extended value for an integer constant value.
static int map_from_llvmopcode(LLVMOpcode code)
StoreInst - an instruction for storing to memory.
LLVMValueRef LLVMConstFMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB)
Obtain the last instruction in a basic block.
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.
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.
LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
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)
void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage)
void initializePrintBasicBlockPassPass(PassRegistry &)
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 fuction.
LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst)
Obtain the basic block to which an instruction belongs.
LLVMTypeRef LLVMInt64TypeInContext(LLVMContextRef C)
LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M)
LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy)
Obtain the length of an array type.
void LLVMDisposePassManager(LLVMPassManagerRef PM)
Frees the memory of a pass pipeline.
LLVMValueRef LLVMBuildIsNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)
void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile)
LLVMTypeRef LLVMVoidTypeInContext(LLVMContextRef C)
Create a void type in a context.
10: Arbitrary bit width integers
PassManager manages ModulePassManagers.
static Constant * getBitCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
#define LLVM_DEFINE_VALUE_CAST(name)
ExternalWeak linkage description.
void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr)
A self-contained host- and target-independent arbitrary-precision floating-point software implementat...
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)
Same, but only replaced by something equivalent.
static Constant * getFNeg(Constant *C)
LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn)
Obtain the first basic block in a function.
LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L)
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)
Acquire provides a barrier of the sort necessary to acquire a lock to access other memory with normal...
DataLayout * unwrap(LLVMTargetDataRef P)
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList)
Create an "inbounds" getelementptr.
LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, const char *Name)
static ConstantPointerNull * get(PointerType *T)
get() - Static factory methods - Return objects of the specified value
LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)
LLVMTypeRef LLVMInt32Type(void)
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.
const Function * getParent() const
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...
static GlobalAlias * create(PointerType *Ty, 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...
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)
get - Return a BlockAddress for the specified function and basic block.
This is an important base class in LLVM.
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...
unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy)
Get the number of elements defined inside the structure.
param_iterator param_begin() const
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)
LLVMValueRef LLVMBuildFMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
static Constant * getAnd(Constant *C1, Constant *C2)
void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class)
static Constant * get(ArrayType *T, ArrayRef< Constant * > V)
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)
LLVMValueRef LLVMBuildInBoundsGEP(LLVMBuilderRef B, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
static Constant * getSExtOrBitCast(Constant *C, Type *Ty)
LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
bool llvm_is_multithreaded()
Returns true if LLVM is compiled with support for multi-threading, and false otherwise.
LLVMValueRef LLVMConstExtractValue(LLVMValueRef AggConstant, unsigned *IdxList, unsigned NumIdx)
void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest)
LLVMValueRef LLVMConstOr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
void LLVMInstructionEraseFromParent(LLVMValueRef Inst)
Remove and delete an instruction.
static Constant * getShuffleVector(Constant *V1, Constant *V2, Constant *Mask, Type *OnlyIfReducedTy=nullptr)
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index, unsigned align)
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.
static Type * getVoidTy(LLVMContext &C)
LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount)
Create a fixed size array type that refers to a specific type.
LLVMBool LLVMIsUndef(LLVMValueRef Val)
Determine whether a value instance is undefined.
char * LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI)
Return a string representation of the DiagnosticInfo.
LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn)
Type * getTypeAtIndex(const Value *V)
getTypeAtIndex - Given an index value into the type, return the type of the element.
struct LLVMOpaqueContext * LLVMContextRef
The top-level container for all LLVM global data.
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)
MDNode * getOperand(unsigned i) const
opStatus convert(const fltSemantics &, roundingMode, bool *)
APFloat::convert - convert a value of one floating point type to another.
LLVMBasicBlockRef LLVMGetSuccessor(LLVMValueRef Term, unsigned i)
Return the specified successor.
6: 128-bit floating point type (two 64-bits, PowerPC)
LLVMValueRef LLVMConstSRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
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)
void LLVMShutdown()
Deallocate and destroy all ManagedStatic variables.
LLVMTypeRef LLVMPPCFP128Type(void)
Class to represent integer types.
LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
And a value and return the old one.
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.
static Constant * get(StructType *T, ArrayRef< Constant * > V)
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)
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)
Get the all ones value.
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.
LLVMOpcode LLVMGetConstOpcode(LLVMValueRef ConstantVal)
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)
FunctionPassManager manages FunctionPasses and BasicBlockPassManagers.
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)
get() - Static factory methods - Return an 'undef' object of the specified type.
LLVMValueRef LLVMBuildGEP(LLVMBuilderRef B, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name, unsigned AddressSpace)
LLVMContext & getContext() const
All values hold a context through their type.
LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
const char * LLVMGetDataLayout(LLVMModuleRef M)
Obtain the data layout for a module.
Like Private, but linker removes.
LLVMValueRef LLVMGetParam(LLVMValueRef FnRef, unsigned index)
Obtain the parameter at the specified index.
struct LLVMOpaqueValue * LLVMValueRef
Represents an individual value in LLVM IR.
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.
LLVMTypeRef LLVMVoidType(void)
These are similar to the above functions except they operate on the global context.
LLVMValueRef LLVMBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
static Type * getFP128Ty(LLVMContext &C)
LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C, LLVMValueRef FnRef, const char *Name)
Append a basic block to the end of a function.
LLVMTypeRef LLVMGetElementType(LLVMTypeRef Ty)
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 LLVMGetBasicBlocks(LLVMValueRef FnRef, LLVMBasicBlockRef *BasicBlocksRefs)
Obtain all of the basic blocks in a function.
Sets the value if it's Smaller than the original using a signed comparison and return the old one...
static AtomicOrdering mapFromLLVMOrdering(LLVMAtomicOrdering Ordering)
global_iterator global_end()
unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char *name)
Obtain the number of operands for named metadata in a module.
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.
const MDOperand & getOperand(unsigned I) const
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)
LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef B)
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)
LLVMContextRef LLVMContextCreate()
Create a new context.
struct LLVMOpaquePassRegistry * LLVMPassRegistryRef
LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty)
Obtain the enumerated type of a Type instance.
LLVMTypeRef LLVMTypeOf(LLVMValueRef Val)
Obtain the type of a value.
LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty)
Obtain a constant value referring to the instance of a type consisting of all ones.
15: SIMD 'packed' format, or other vector type
LLVMValueRef LLVMConstFPTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
static StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
StructType::get - This static method is the primary way to create a literal StructType.
static Constant * getSDiv(Constant *C1, Constant *C2, bool isExact=false)
struct LLVMOpaqueBasicBlock * LLVMBasicBlockRef
Represents a basic block of instructions in LLVM IR.
LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant, LLVMValueRef ElementValueConstant, unsigned *IdxList, unsigned NumIdx)
LLVMValueRef LLVMBuildURem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
bool hasName() const
hasName - Return true if this is a named struct that has a non-empty 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.
Type * getType() const
All values are typed, get the type of this value.
LLVMValueRef LLVMGetCondition(LLVMValueRef Branch)
Return the condition of a branch instruction.
LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef B, LLVMRealPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
static Constant * getNUWMul(Constant *C1, Constant *C2)
LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst)
Obtain the instruction that occurs after the one specified.
void LLVMDeleteGlobal(LLVMValueRef GlobalVar)
Xor a value and return the old one.
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)
void LLVMRemoveInstrAttribute(LLVMValueRef Instr, unsigned index, LLVMAttribute PA)
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)
static Constant * get(Type *Ty, double V)
get() - This returns a ConstantFP, or a vector containing a splat of a ConstantFP, for the specified value in the specified type.
LLVMTypeRef LLVMDoubleType(void)
void LLVMSetDataLayout(LLVMModuleRef M, const char *Triple)
Set the data layout for a module.
32 bit floating point type
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)
provides Acquire semantics for loads and Release semantics for stores.
AttributeSet getAttributes() const
Return the attribute list for this Function.
static LLVMOpcode map_to_llvmopcode(int opcode)
AttributeSet removeAttributes(LLVMContext &C, unsigned Index, AttributeSet Attrs) const
Remove the specified attributes at the specified index from this attribute list.
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)
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)
bool hasInitializer() const
Definitions have initializers, declarations don't.
Class for arbitrary precision integers.
void LLVMRemoveAttribute(LLVMValueRef Arg, LLVMAttribute PA)
Remove an attribute from a function argument.
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.
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.
StringRef getName() const
getName - Return the name for this struct type if it has an identity.
LLVMValueRef LLVMBuildBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar)
static Constant * getFPToUI(Constant *C, Type *Ty, bool OnlyIfReduced=false)
bool hasGC() const
hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm to use during code generatio...
LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
static char getTypeID(Type *Ty)
void setGC(const char *Str)
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.
The file should be opened in text mode on platforms that make this distinction.
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.
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)
static Instruction * CreateMalloc(Instruction *InsertBefore, Type *IntPtrTy, Type *AllocTy, Value *AllocSize, Value *ArraySize=nullptr, Function *MallocF=nullptr, const Twine &Name="")
CreateMalloc - Generate the IR for a call to malloc:
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.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
LLVMValueRef LLVMConstFAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
static Constant * getNeg(Constant *C, bool HasNUW=false, bool HasNSW=false)
LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMValueRef LLVMBuildMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
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.
void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal, LLVMBasicBlockRef Dest)
static Constant * getNSWMul(Constant *C1, Constant *C2)
LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
struct LLVMOpaquePassManager * LLVMPassManagerRef
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.
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
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, int64_t FileSize=-1, bool RequiresNullTerminator=true, bool IsVolatileSize=false)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null.
LLVMTypeRef LLVMHalfTypeInContext(LLVMContextRef C)
Obtain a 16-bit floating point type from a context.
LLVMBasicBlockRef LLVMAppendBasicBlock(LLVMValueRef FnRef, const char *Name)
Append a basic block to the end of a function using the global context.
guarantees that if you take all the operations affecting a specific address, a consistent ordering ex...
LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal)
LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, LLVMBool singleThread)
void LLVMDeleteBasicBlock(LLVMBasicBlockRef BBRef)
Remove a basic block from a function and delete it.
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)
LLVMBool LLVMIsConstant(LLVMValueRef Ty)
Determine whether the specified constant instance is constant.
static Constant * getPtrToInt(Constant *C, Type *Ty, bool OnlyIfReduced=false)
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.
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.
void initializeVerifierLegacyPassPass(PassRegistry &)
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.
LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef B, LLVMValueRef V, LLVMBasicBlockRef Else, unsigned NumCases)
LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, unsigned Length)
Create a ConstantArray from values.
float convertToFloat() const
128 bit floating point type (two 64-bits)
struct LLVMOpaqueUse * LLVMUseRef
Used to get the users and usees of a Value.
static ArrayType * get(Type *ElementType, uint64_t NumElements)
ArrayType::get - This static method is the primary way to construct an ArrayType. ...
void LLVMDumpType(LLVMTypeRef Ty)
Dump a representation of a type to stderr.
const AttributeSet & getAttributes() const
getAttributes/setAttributes - get or set the parameter attributes of the call.
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)
Special purpose, only applies to global arrays.
LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, unsigned NumClauses, const char *Name)
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)
const char * LLVMGetAsString(LLVMValueRef c, size_t *Length)
Get the given constant data sequential as a string.
void setAttributes(AttributeSet attrs)
Set the attribute list for this Function.
LLVMValueRef LLVMConstLShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM)
Finalizes all of the function passes scheduled in 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)
LLVMTypeRef LLVMInt128TypeInContext(LLVMContextRef C)
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Like LinkerPrivate, but is weak.
LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal)
const APFloat & getValueAPF() const
3: 64-bit floating point type
LLVMValueRef LLVMGetFirstFunction(LLVMModuleRef M)
Obtain an iterator to the first Function in a Module.
LLVMAttribute LLVMGetAttribute(LLVMValueRef Arg)
Get an attribute from a function argument.
LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename, char **ErrorMessage)
Print a representation of a module to a file.
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)
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)
Obtain the string name of a value.
LLVMValueRef LLVMBuildSExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMValueRef LLVMBuildBr(LLVMBuilderRef B, LLVMBasicBlockRef Dest)
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
uint64_t Raw(unsigned Index) const
LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)
LLVMLinkage LLVMGetLinkage(LLVMValueRef Global)
static Constant * getURem(Constant *C1, Constant *C2)
unsigned getArgNo() const
Return the index of this formal argument in its containing function.
static VectorType * get(Type *ElementType, unsigned NumElements)
VectorType::get - This static method is the primary way to construct an VectorType.
static StructType * create(LLVMContext &Context, StringRef Name)
StructType::create - This creates an identified struct.
LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val)
Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn)
Decrement a Function iterator to the previous Function.
static const Function * getParent(const Value *V)
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)
LLVMTypeRef LLVMGetReturnType(LLVMTypeRef FunctionTy)
Obtain the Type this function Type returns.
unsigned getNumOperands() const
LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
LLVMValueRef LLVMBuildStore(LLVMBuilderRef B, LLVMValueRef Val, LLVMValueRef PointerVal)
InvokeInst - Invoke instruction.
struct LLVMOpaqueDiagnosticInfo * LLVMDiagnosticInfoRef
LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
void(* YieldCallbackTy)(LLVMContext *Context, void *OpaqueHandle)
Defines the type of a yield callback.
struct LLVMOpaqueBuilder * LLVMBuilderRef
Represents an LLVM basic block builder.
static Constant * getExtractValue(Constant *Agg, ArrayRef< unsigned > Idxs, Type *OnlyIfReducedTy=nullptr)
LLVMValueRef LLVMConstZExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
LLVMTypeRef LLVMInt128Type(void)
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...
AttrBuilder & addAlignmentAttr(unsigned Align)
This turns an int alignment (which must be a power of 2) into the form used internally in Attribute...
LLVMContextRef LLVMGetGlobalContext()
Obtain the global context instance.
LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, const Twine &N="", Module *M=nullptr)
LLVMTypeRef LLVMInt32TypeInContext(LLVMContextRef C)
void initializePrintFunctionPassWrapperPass(PassRegistry &)
LLVMBool LLVMRunFunctionPassManager(LLVMPassManagerRef FPM, LLVMValueRef F)
Executes all of the function passes scheduled in the function pass manager on the provided function...
void addAttributes(unsigned i, AttributeSet attrs)
adds the attributes to the list of attributes.
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 LLVMAddInstrAttribute(LLVMValueRef Instr, unsigned index, LLVMAttribute PA)
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)
Set inline assembly for a module.
LLVMValueRef LLVMBuildAddrSpaceCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
AttributeSet addAttributes(LLVMContext &C, unsigned Index, AttributeSet Attrs) const
Add attributes to the attribute set at the given index.
static Constant * getFPExtend(Constant *C, Type *Ty, bool OnlyIfReduced=false)
LLVMValueRef LLVMConstFRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
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.
static IntegerType * getInt8Ty(LLVMContext &C)
void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP)
Destroys the module M.
LLVMValueRef LLVMBuildSelect(LLVMBuilderRef B, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, const char *Name)
const BasicBlock * getParent() const
LLVMContext & getGlobalContext()
getGlobalContext - Returns a global context.
LLVMTypeRef LLVMX86FP80TypeInContext(LLVMContextRef C)
Obtain a 80-bit floating point type (X87) from a context.
LLVMAttribute LLVMGetFunctionAttr(LLVMValueRef Fn)
Obtain an attribute from a function.
void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr, const char *Name)
AllocaInst - an instruction to allocate memory on the stack.
static Constant * getXor(Constant *C1, Constant *C2)
LLVMValueRef LLVMBuildFPTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
5: 128-bit floating point type (112-bit mantissa)
void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes)
Set the preferred alignment of the value.
LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global)