15 #ifndef LLVM_IR_IRBUILDER_H
16 #define LLVM_IR_IRBUILDER_H
74 std::function<void(Instruction *)> Callback;
78 : Callback(Callback) {}
146 if (IP != TheBB->
end())
178 : Block(InsertBlock), Point(InsertPoint) {}
181 bool isSet()
const {
return (Block !=
nullptr); }
406 MDNode *ScopeTag =
nullptr,
407 MDNode *NoAliasTag =
nullptr) {
409 TBAATag, ScopeTag, NoAliasTag);
414 MDNode *ScopeTag =
nullptr,
415 MDNode *NoAliasTag =
nullptr);
424 MDNode *TBAAStructTag =
nullptr,
425 MDNode *ScopeTag =
nullptr,
426 MDNode *NoAliasTag =
nullptr) {
428 TBAAStructTag, ScopeTag, NoAliasTag);
433 MDNode *TBAAStructTag =
nullptr,
434 MDNode *ScopeTag =
nullptr,
435 MDNode *NoAliasTag =
nullptr);
445 MDNode *ScopeTag =
nullptr,
446 MDNode *NoAliasTag =
nullptr) {
448 TBAATag, ScopeTag, NoAliasTag);
453 MDNode *ScopeTag =
nullptr,
454 MDNode *NoAliasTag =
nullptr);
482 Value *PassThru =
nullptr,
586 template <
typename T = ConstantFolder,
587 typename Inserter = IRBuilderDefaultInserter>
593 MDNode *FPMathTag =
nullptr,
621 MDNode *FPMathTag =
nullptr,
628 MDNode *FPMathTag =
nullptr,
638 template<
typename InstTy>
658 template <
typename InstTy>
659 InstTy *addBranchMetadata(InstTy *
I,
MDNode *Weights,
MDNode *Unpredictable) {
687 for (
unsigned i = 0;
i !=
N; ++
i)
700 MDNode *BranchWeights =
nullptr,
701 MDNode *Unpredictable =
nullptr) {
703 BranchWeights, Unpredictable));
723 MDNode *BranchWeights =
nullptr,
724 MDNode *Unpredictable =
nullptr) {
726 BranchWeights, Unpredictable));
762 unsigned NumHandlers,
794 bool HasNUW,
bool HasNSW) {
801 Instruction *AddFPMathAttributes(Instruction *I,
803 FastMathFlags
FMF)
const {
808 I->setFastMathFlags(FMF);
814 bool HasNUW =
false,
bool HasNSW =
false) {
815 if (
Constant *LC = dyn_cast<Constant>(LHS))
816 if (
Constant *RC = dyn_cast<Constant>(RHS))
817 return Insert(Folder.CreateAdd(LC, RC, HasNUW, HasNSW),
Name);
822 return CreateAdd(LHS, RHS, Name,
false,
true);
825 return CreateAdd(LHS, RHS, Name,
true,
false);
828 MDNode *FPMathTag =
nullptr) {
829 if (
Constant *LC = dyn_cast<Constant>(LHS))
830 if (
Constant *RC = dyn_cast<Constant>(RHS))
831 return Insert(Folder.CreateFAdd(LC, RC),
Name);
832 return Insert(AddFPMathAttributes(BinaryOperator::CreateFAdd(LHS, RHS),
833 FPMathTag, FMF), Name);
836 bool HasNUW =
false,
bool HasNSW =
false) {
837 if (
Constant *LC = dyn_cast<Constant>(LHS))
838 if (
Constant *RC = dyn_cast<Constant>(RHS))
839 return Insert(Folder.CreateSub(LC, RC, HasNUW, HasNSW),
Name);
840 return CreateInsertNUWNSWBinOp(Instruction::Sub, LHS, RHS, Name,
844 return CreateSub(LHS, RHS, Name,
false,
true);
847 return CreateSub(LHS, RHS, Name,
true,
false);
850 MDNode *FPMathTag =
nullptr) {
851 if (
Constant *LC = dyn_cast<Constant>(LHS))
852 if (
Constant *RC = dyn_cast<Constant>(RHS))
853 return Insert(Folder.CreateFSub(LC, RC),
Name);
854 return Insert(AddFPMathAttributes(BinaryOperator::CreateFSub(LHS, RHS),
855 FPMathTag, FMF), Name);
858 bool HasNUW =
false,
bool HasNSW =
false) {
859 if (
Constant *LC = dyn_cast<Constant>(LHS))
860 if (
Constant *RC = dyn_cast<Constant>(RHS))
861 return Insert(Folder.CreateMul(LC, RC, HasNUW, HasNSW),
Name);
862 return CreateInsertNUWNSWBinOp(Instruction::Mul, LHS, RHS, Name,
866 return CreateMul(LHS, RHS, Name,
false,
true);
869 return CreateMul(LHS, RHS, Name,
true,
false);
872 MDNode *FPMathTag =
nullptr) {
873 if (
Constant *LC = dyn_cast<Constant>(LHS))
874 if (
Constant *RC = dyn_cast<Constant>(RHS))
875 return Insert(Folder.CreateFMul(LC, RC),
Name);
876 return Insert(AddFPMathAttributes(BinaryOperator::CreateFMul(LHS, RHS),
877 FPMathTag, FMF), Name);
880 bool isExact =
false) {
881 if (
Constant *LC = dyn_cast<Constant>(LHS))
882 if (
Constant *RC = dyn_cast<Constant>(RHS))
883 return Insert(Folder.CreateUDiv(LC, RC, isExact),
Name);
885 return Insert(BinaryOperator::CreateUDiv(LHS, RHS), Name);
886 return Insert(BinaryOperator::CreateExactUDiv(LHS, RHS), Name);
892 bool isExact =
false) {
893 if (
Constant *LC = dyn_cast<Constant>(LHS))
894 if (
Constant *RC = dyn_cast<Constant>(RHS))
895 return Insert(Folder.CreateSDiv(LC, RC, isExact),
Name);
897 return Insert(BinaryOperator::CreateSDiv(LHS, RHS), Name);
898 return Insert(BinaryOperator::CreateExactSDiv(LHS, RHS), Name);
904 MDNode *FPMathTag =
nullptr) {
905 if (
Constant *LC = dyn_cast<Constant>(LHS))
906 if (
Constant *RC = dyn_cast<Constant>(RHS))
907 return Insert(Folder.CreateFDiv(LC, RC),
Name);
908 return Insert(AddFPMathAttributes(BinaryOperator::CreateFDiv(LHS, RHS),
909 FPMathTag, FMF), Name);
912 if (
Constant *LC = dyn_cast<Constant>(LHS))
913 if (
Constant *RC = dyn_cast<Constant>(RHS))
914 return Insert(Folder.CreateURem(LC, RC),
Name);
915 return Insert(BinaryOperator::CreateURem(LHS, RHS), Name);
918 if (
Constant *LC = dyn_cast<Constant>(LHS))
919 if (
Constant *RC = dyn_cast<Constant>(RHS))
920 return Insert(Folder.CreateSRem(LC, RC),
Name);
921 return Insert(BinaryOperator::CreateSRem(LHS, RHS), Name);
924 MDNode *FPMathTag =
nullptr) {
925 if (
Constant *LC = dyn_cast<Constant>(LHS))
926 if (
Constant *RC = dyn_cast<Constant>(RHS))
927 return Insert(Folder.CreateFRem(LC, RC),
Name);
928 return Insert(AddFPMathAttributes(BinaryOperator::CreateFRem(LHS, RHS),
929 FPMathTag, FMF), Name);
933 bool HasNUW =
false,
bool HasNSW =
false) {
934 if (
Constant *LC = dyn_cast<Constant>(LHS))
935 if (
Constant *RC = dyn_cast<Constant>(RHS))
936 return Insert(Folder.CreateShl(LC, RC, HasNUW, HasNSW),
Name);
937 return CreateInsertNUWNSWBinOp(Instruction::Shl, LHS, RHS, Name,
941 bool HasNUW =
false,
bool HasNSW =
false) {
946 bool HasNUW =
false,
bool HasNSW =
false) {
952 bool isExact =
false) {
953 if (
Constant *LC = dyn_cast<Constant>(LHS))
954 if (
Constant *RC = dyn_cast<Constant>(RHS))
955 return Insert(Folder.CreateLShr(LC, RC, isExact),
Name);
957 return Insert(BinaryOperator::CreateLShr(LHS, RHS), Name);
958 return Insert(BinaryOperator::CreateExactLShr(LHS, RHS), Name);
961 bool isExact =
false) {
965 bool isExact =
false) {
970 bool isExact =
false) {
971 if (
Constant *LC = dyn_cast<Constant>(LHS))
972 if (
Constant *RC = dyn_cast<Constant>(RHS))
973 return Insert(Folder.CreateAShr(LC, RC, isExact),
Name);
975 return Insert(BinaryOperator::CreateAShr(LHS, RHS), Name);
976 return Insert(BinaryOperator::CreateExactAShr(LHS, RHS), Name);
979 bool isExact =
false) {
983 bool isExact =
false) {
988 if (
Constant *RC = dyn_cast<Constant>(RHS)) {
989 if (isa<ConstantInt>(RC) && cast<ConstantInt>(RC)->isAllOnesValue())
991 if (
Constant *LC = dyn_cast<Constant>(LHS))
992 return Insert(Folder.CreateAnd(LC, RC),
Name);
994 return Insert(BinaryOperator::CreateAnd(LHS, RHS), Name);
1004 if (
Constant *RC = dyn_cast<Constant>(RHS)) {
1005 if (RC->isNullValue())
1007 if (
Constant *LC = dyn_cast<Constant>(LHS))
1008 return Insert(Folder.CreateOr(LC, RC),
Name);
1010 return Insert(BinaryOperator::CreateOr(LHS, RHS), Name);
1020 if (
Constant *LC = dyn_cast<Constant>(LHS))
1021 if (
Constant *RC = dyn_cast<Constant>(RHS))
1022 return Insert(Folder.CreateXor(LC, RC),
Name);
1023 return Insert(BinaryOperator::CreateXor(LHS, RHS), Name);
1034 MDNode *FPMathTag =
nullptr) {
1035 if (
Constant *LC = dyn_cast<Constant>(LHS))
1036 if (
Constant *RC = dyn_cast<Constant>(RHS))
1037 return Insert(Folder.CreateBinOp(Opc, LC, RC),
Name);
1039 if (isa<FPMathOperator>(BinOp))
1040 BinOp = AddFPMathAttributes(BinOp, FPMathTag, FMF);
1041 return Insert(BinOp, Name);
1045 bool HasNUW =
false,
bool HasNSW =
false) {
1047 return Insert(Folder.CreateNeg(
VC, HasNUW, HasNSW),
Name);
1049 if (HasNUW) BO->setHasNoUnsignedWrap();
1050 if (HasNSW) BO->setHasNoSignedWrap();
1060 MDNode *FPMathTag =
nullptr) {
1064 FPMathTag, FMF), Name);
1077 const Twine &Name =
"") {
1106 const Twine &Name =
"") {
1112 const Twine &Name =
"") {
1125 const Twine &Name =
"") {
1134 FailureOrdering, SynchScope));
1142 const Twine &Name =
"") {
1143 return CreateGEP(
nullptr, Ptr, IdxList, Name);
1146 const Twine &Name =
"") {
1147 if (
Constant *
PC = dyn_cast<Constant>(Ptr)) {
1150 for (i = 0, e = IdxList.
size(); i != e; ++
i)
1151 if (!isa<Constant>(IdxList[i]))
1154 return Insert(Folder.CreateGetElementPtr(Ty,
PC, IdxList),
Name);
1159 const Twine &Name =
"") {
1163 const Twine &Name =
"") {
1164 if (
Constant *
PC = dyn_cast<Constant>(Ptr)) {
1167 for (i = 0, e = IdxList.
size(); i != e; ++
i)
1168 if (!isa<Constant>(IdxList[i]))
1171 return Insert(Folder.CreateInBoundsGetElementPtr(Ty,
PC, IdxList),
1177 return CreateGEP(
nullptr, Ptr, Idx, Name);
1181 if (
Constant *IC = dyn_cast<Constant>(Idx))
1182 return Insert(Folder.CreateGetElementPtr(Ty,
PC, IC),
Name);
1186 const Twine &Name =
"") {
1188 if (
Constant *IC = dyn_cast<Constant>(Idx))
1189 return Insert(Folder.CreateInBoundsGetElementPtr(Ty,
PC, IC),
Name);
1196 const Twine &Name =
"") {
1200 return Insert(Folder.CreateGetElementPtr(Ty,
PC, Idx),
Name);
1205 const Twine &Name =
"") {
1209 return Insert(Folder.CreateInBoundsGetElementPtr(Ty,
PC, Idx),
Name);
1214 const Twine &Name =
"") {
1221 return Insert(Folder.CreateGetElementPtr(Ty,
PC, Idxs),
Name);
1226 unsigned Idx1,
const Twine &Name =
"") {
1233 return Insert(Folder.CreateInBoundsGetElementPtr(Ty,
PC, Idxs),
Name);
1241 return Insert(Folder.CreateGetElementPtr(
nullptr,
PC, Idx),
Name);
1246 const Twine &Name =
"") {
1250 return Insert(Folder.CreateInBoundsGetElementPtr(
nullptr,
PC, Idx),
Name);
1255 const Twine &Name =
"") {
1262 return Insert(Folder.CreateGetElementPtr(
nullptr,
PC, Idxs),
Name);
1267 const Twine &Name =
"") {
1274 return Insert(Folder.CreateInBoundsGetElementPtr(
nullptr,
PC, Idxs),
1280 const Twine &Name =
"") {
1299 return CreateCast(Instruction::Trunc, V, DestTy, Name);
1302 return CreateCast(Instruction::ZExt, V, DestTy, Name);
1305 return CreateCast(Instruction::SExt, V, DestTy, Name);
1310 const Twine &Name =
"") {
1313 "Can only zero extend/truncate integers!");
1324 const Twine &Name =
"") {
1327 "Can only sign extend/truncate integers!");
1336 return CreateCast(Instruction::FPToUI, V, DestTy, Name);
1339 return CreateCast(Instruction::FPToSI, V, DestTy, Name);
1342 return CreateCast(Instruction::UIToFP, V, DestTy, Name);
1345 return CreateCast(Instruction::SIToFP, V, DestTy, Name);
1348 const Twine &Name =
"") {
1349 return CreateCast(Instruction::FPTrunc, V, DestTy, Name);
1352 return CreateCast(Instruction::FPExt, V, DestTy, Name);
1355 const Twine &Name =
"") {
1356 return CreateCast(Instruction::PtrToInt, V, DestTy, Name);
1359 const Twine &Name =
"") {
1360 return CreateCast(Instruction::IntToPtr, V, DestTy, Name);
1363 const Twine &Name =
"") {
1364 return CreateCast(Instruction::BitCast, V, DestTy, Name);
1367 const Twine &Name =
"") {
1368 return CreateCast(Instruction::AddrSpaceCast, V, DestTy, Name);
1371 const Twine &Name =
"") {
1375 return Insert(Folder.CreateZExtOrBitCast(
VC, DestTy),
Name);
1379 const Twine &Name =
"") {
1383 return Insert(Folder.CreateSExtOrBitCast(
VC, DestTy),
Name);
1387 const Twine &Name =
"") {
1391 return Insert(Folder.CreateTruncOrBitCast(
VC, DestTy),
Name);
1395 const Twine &Name =
"") {
1399 return Insert(Folder.CreateCast(Op,
VC, DestTy),
Name);
1403 const Twine &Name =
"") {
1407 return Insert(Folder.CreatePointerCast(
VC, DestTy),
Name);
1412 const Twine &Name =
"") {
1417 return Insert(Folder.CreatePointerBitCastOrAddrSpaceCast(
VC, DestTy),
1426 const Twine &Name =
"") {
1430 return Insert(Folder.CreateIntCast(
VC, DestTy, isSigned),
Name);
1435 const Twine &Name =
"") {
1498 MDNode *FPMathTag =
nullptr) {
1502 MDNode *FPMathTag =
nullptr) {
1506 MDNode *FPMathTag =
nullptr) {
1510 MDNode *FPMathTag =
nullptr) {
1514 MDNode *FPMathTag =
nullptr) {
1518 MDNode *FPMathTag =
nullptr) {
1522 MDNode *FPMathTag =
nullptr) {
1526 MDNode *FPMathTag =
nullptr) {
1530 MDNode *FPMathTag =
nullptr) {
1534 MDNode *FPMathTag =
nullptr) {
1538 MDNode *FPMathTag =
nullptr) {
1542 MDNode *FPMathTag =
nullptr) {
1546 MDNode *FPMathTag =
nullptr) {
1550 MDNode *FPMathTag =
nullptr) {
1555 const Twine &Name =
"") {
1556 if (
Constant *LC = dyn_cast<Constant>(LHS))
1557 if (
Constant *RC = dyn_cast<Constant>(RHS))
1558 return Insert(Folder.CreateICmp(P, LC, RC),
Name);
1562 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
1563 if (
Constant *LC = dyn_cast<Constant>(LHS))
1564 if (
Constant *RC = dyn_cast<Constant>(RHS))
1565 return Insert(Folder.CreateFCmp(P, LC, RC),
Name);
1567 FPMathTag, FMF), Name);
1575 const Twine &Name =
"") {
1580 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
1588 MDNode *FPMathTag =
nullptr) {
1590 if (isa<FPMathOperator>(CI))
1591 CI = cast<CallInst>(AddFPMathAttributes(CI, FPMathTag, FMF));
1597 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
1599 if (isa<FPMathOperator>(CI))
1600 CI = cast<CallInst>(AddFPMathAttributes(CI, FPMathTag, FMF));
1605 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
1611 if (
Constant *CC = dyn_cast<Constant>(C))
1612 if (
Constant *TC = dyn_cast<Constant>(True))
1613 if (
Constant *
FC = dyn_cast<Constant>(False))
1620 Sel = addBranchMetadata(Sel, Prof, Unpred);
1622 return Insert(Sel, Name);
1630 const Twine &Name =
"") {
1632 if (
Constant *IC = dyn_cast<Constant>(Idx))
1633 return Insert(Folder.CreateExtractElement(
VC, IC),
Name);
1638 const Twine &Name =
"") {
1643 const Twine &Name =
"") {
1645 if (
Constant *
NC = dyn_cast<Constant>(NewElt))
1646 if (
Constant *IC = dyn_cast<Constant>(Idx))
1652 const Twine &Name =
"") {
1657 const Twine &Name =
"") {
1658 if (
Constant *V1C = dyn_cast<Constant>(V1))
1659 if (
Constant *V2C = dyn_cast<Constant>(V2))
1660 if (
Constant *MC = dyn_cast<Constant>(Mask))
1661 return Insert(Folder.CreateShuffleVector(V1C, V2C, MC),
Name);
1666 const Twine &Name =
"") {
1673 const Twine &Name =
"") {
1674 if (
Constant *AggC = dyn_cast<Constant>(Agg))
1675 return Insert(Folder.CreateExtractValue(AggC, Idxs),
Name);
1681 const Twine &Name =
"") {
1682 if (
Constant *AggC = dyn_cast<Constant>(Agg))
1683 if (
Constant *ValC = dyn_cast<Constant>(Val))
1684 return Insert(Folder.CreateInsertValue(AggC, ValC, Idxs),
Name);
1689 const Twine &Name =
"") {
1717 "Pointer subtraction operand types must match!");
1734 Intrinsic::invariant_group_barrier);
1737 assert(ArgumentAndReturnType ==
1739 "InvariantGroupBarrier should take and return the same type");
1742 bool PtrTypeConversionNeeded = PtrType != ArgumentAndReturnType;
1743 if (PtrTypeConversionNeeded)
1748 if (PtrTypeConversionNeeded)
1756 assert(NumElts > 0 &&
"Cannot splat to an empty vector!");
1762 Name +
".splatinsert");
1772 const Twine &Name) {
1776 "Element extends past full value");
1777 uint64_t ShAmt = 8 *
Offset;
1786 "Cannot extract to a larger integer!");
1787 if (ExtractedTy != IntTy) {
1801 Value *OffsetValue =
nullptr) {
1803 "trying to create an alignment assumption on a non-pointer?");
1810 Alignment > 0 ? Alignment - 1 : 0);
1812 bool IsOffsetZero =
false;
1813 if (
ConstantInt *CI = dyn_cast<ConstantInt>(OffsetValue))
1814 IsOffsetZero = CI->isZero();
1816 if (!IsOffsetZero) {
1817 if (OffsetValue->getType() != IntPtrTy)
1820 PtrIntValue =
CreateSub(PtrIntValue, OffsetValue,
"offsetptr");
1837 #endif // LLVM_IR_IRBUILDER_H
IntegerType * getInt16Ty()
Fetch the type representing a 16-bit integer.
Value * CreateInsertElement(Value *Vec, Value *NewElt, uint64_t Idx, const Twine &Name="")
Value * CreateNSWNeg(Value *V, const Twine &Name="")
Value * CreateConstInBoundsGEP1_32(Type *Ty, Value *Ptr, unsigned Idx0, const Twine &Name="")
Common base class shared among various IRBuilders.
Return a value (possibly void), from a function.
Value * CreateAShr(Value *LHS, const APInt &RHS, const Twine &Name="", bool isExact=false)
Value * CreateInBoundsGEP(Type *Ty, Value *Ptr, Value *Idx, const Twine &Name="")
A parsed version of the target data layout string in and methods for querying it. ...
static ConstantInt * getFalse(LLVMContext &Context)
BranchInst * CreateCondBr(Value *Cond, BasicBlock *True, BasicBlock *False, MDNode *BranchWeights=nullptr, MDNode *Unpredictable=nullptr)
Create a conditional 'br Cond, TrueDest, FalseDest' instruction.
Value * CreateICmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateConstGEP1_32(Value *Ptr, unsigned Idx0, const Twine &Name="")
static Type * getDoubleTy(LLVMContext &C)
static IntegerType * getInt1Ty(LLVMContext &C)
BasicBlock::iterator GetInsertPoint() const
IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, const T &F, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
Value * CreateBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateConstGEP1_32(Type *Ty, Value *Ptr, unsigned Idx0, const Twine &Name="")
CallInst * CreateInvariantStart(Value *Ptr, ConstantInt *Size=nullptr)
Create a call to invariant.start intrinsic.
static BinaryOperator * CreateNot(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Value * CreateICmpNE(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateIsNotNull(Value *Arg, const Twine &Name="")
Return an i1 value testing if Arg is not null.
Atomic ordering constants.
Value * CreateAddrSpaceCast(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateZExtOrTrunc(Value *V, Type *DestTy, const Twine &Name="")
Create a ZExt or Trunc from the integer value V to DestTy.
Value * CreateFPTrunc(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateICmpULT(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateXor(Value *LHS, Value *RHS, const Twine &Name="")
A Module instance is used to store all the information related to an LLVM module. ...
static ResumeInst * Create(Value *Exn, Instruction *InsertBefore=nullptr)
An instruction for ordering other memory operations.
an instruction that atomically checks whether a specified value is in a memory location, and, if it is, stores a new value there.
Value * CreateFCmpOLE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
LoadInst * CreateLoad(Value *Ptr, bool isVolatile, const Twine &Name="")
Value * CreateShl(Value *LHS, uint64_t RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
static ConstantAggregateZero * get(Type *Ty)
Value * CreateNUWAdd(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateExtractInteger(const DataLayout &DL, Value *From, IntegerType *ExtractedTy, uint64_t Offset, const Twine &Name)
Return a value that has been extracted from a larger integer type.
Value * CreateICmpSLT(Value *LHS, Value *RHS, const Twine &Name="")
CallInst * CreateGCRelocate(Instruction *Statepoint, int BaseOffset, int DerivedOffset, Type *ResultType, const Twine &Name="")
Create a call to the experimental.gc.relocate intrinsics to project the relocated value of one pointe...
Type * getValueType() const
This class represents a function call, abstracting a target machine's calling convention.
void SetInsertPoint(BasicBlock *TheBB, BasicBlock::iterator IP)
This specifies that created instructions should be inserted at the specified point.
Value * CreateConstGEP2_32(Type *Ty, Value *Ptr, unsigned Idx0, unsigned Idx1, const Twine &Name="")
BasicBlock * getBlock() const
IRBuilder(BasicBlock *TheBB, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
0 1 0 0 True if ordered and less than
FastMathFlagGuard & operator=(const FastMathFlagGuard &)=delete
InvokeInst * CreateGCStatepointInvoke(uint64_t ID, uint32_t NumPatchBytes, Value *ActualInvokee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > InvokeArgs, ArrayRef< Value * > DeoptArgs, ArrayRef< Value * > GCArgs, const Twine &Name="")
brief Create an invoke to the experimental.gc.statepoint intrinsic to start a new statepoint sequence...
This instruction constructs a fixed permutation of two input vectors.
static SelectInst * Create(Value *C, Value *S1, Value *S2, const Twine &NameStr="", Instruction *InsertBefore=nullptr, Instruction *MDFrom=nullptr)
Constant * Insert(Constant *C, const Twine &="") const
No-op overload to handle constants.
static CleanupPadInst * Create(Value *ParentPad, ArrayRef< Value * > Args=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
1 1 1 0 True if unordered or not equal
void InsertHelper(Instruction *I, const Twine &Name, BasicBlock *BB, BasicBlock::iterator InsertPt) const
Type * getReturnType() const
Returns the type of the ret val.
InvokeInst * CreateInvoke(Value *Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > Args=None, const Twine &Name="")
Create an invoke instruction.
struct LLVMOpaqueBuilder * LLVMBuilderRef
Represents an LLVM basic block builder.
const Function * getParent() const
Return the enclosing method, or null if none.
Value * CreateSExt(Value *V, Type *DestTy, const Twine &Name="")
CatchPadInst * CreateCatchPad(Value *ParentPad, ArrayRef< Value * > Args, const Twine &Name="")
Value * CreateFCmpUGE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
CallInst * CreateMemSet(Value *Ptr, Value *Val, uint64_t Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert a memset to the specified pointer and the specified value.
unsigned getAddressSpace() const
Return the address space of the Pointer type.
An instruction for reading from memory.
Value * CreateFCmpUNO(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
static IntegerType * getInt64Ty(LLVMContext &C)
Maximum length of the test input libFuzzer tries to guess a good value based on the corpus and reports it always prefer smaller inputs during the corpus shuffle When libFuzzer itself reports a bug this exit code will be used If indicates the maximal total time in seconds to run the fuzzer minimizes the provided crash input Use with etc Experimental Use value profile to guide fuzzing Number of simultaneous worker processes to run the jobs If zero
an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.
Value * CreateICmpULE(Value *LHS, Value *RHS, const Twine &Name="")
Type * getElementType() const
Value * CreateShuffleVector(Value *V1, Value *V2, ArrayRef< uint32_t > IntMask, const Twine &Name="")
static IntegerType * getInt16Ty(LLVMContext &C)
static LandingPadInst * Create(Type *RetTy, unsigned NumReservedClauses, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructors - NumReservedClauses is a hint for the number of incoming clauses that this landingpad w...
Value * CreateNSWAdd(Value *LHS, Value *RHS, const Twine &Name="")
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
StoreInst * CreateAlignedStore(Value *Val, Value *Ptr, unsigned Align, bool isVolatile=false)
Value * CreateNot(Value *V, const Twine &Name="")
Value * CreateFCmpUGT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
static ReturnInst * Create(LLVMContext &C, Value *retVal=nullptr, Instruction *InsertBefore=nullptr)
IntegerType * getInt32Ty()
Fetch the type representing a 32-bit integer.
1 0 0 1 True if unordered or equal
Value * CreateFSub(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateOr(Value *LHS, uint64_t RHS, const Twine &Name="")
AllocaInst * CreateAlloca(Type *Ty, Value *ArraySize=nullptr, const Twine &Name="")
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
Value * CreateFPExt(Value *V, Type *DestTy, const Twine &Name="")
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
This class represents the LLVM 'select' instruction.
Value * CreatePtrDiff(Value *LHS, Value *RHS, const Twine &Name="")
Return the i64 difference between two pointer values, dividing out the size of the pointed-to objects...
struct fuzzer::@269 Flags
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Value * CreateAShr(Value *LHS, uint64_t RHS, const Twine &Name="", bool isExact=false)
IntegerType * getInt64Ty()
Fetch the type representing a 64-bit integer.
static Type * getFloatTy(LLVMContext &C)
LoadInst * CreateLoad(Value *Ptr, const Twine &Name="")
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
CallInst * CreateCall(Function *Callee, ArrayRef< Value * > Args, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateSExtOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
ReturnInst * CreateRet(Value *V)
Create a 'ret <val>' instruction.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
IntegerType * getIntPtrTy(const DataLayout &DL, unsigned AddrSpace=0)
Fetch the type representing a pointer to an integer value.
0 1 0 1 True if ordered and less than or equal
CallInst * CreateAlignmentAssumption(const DataLayout &DL, Value *PtrValue, unsigned Alignment, Value *OffsetValue=nullptr)
Create an assume intrinsic call that represents an alignment assumption on the provided pointer...
Value * CreateAdd(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
void setName(const Twine &Name)
Change the name of the value.
Value * CreateICmpSGT(Value *LHS, Value *RHS, const Twine &Name="")
ConstantInt * getInt16(uint16_t C)
Get a constant 16-bit value.
CallInst * CreateMaskedGather(Value *Ptrs, unsigned Align, Value *Mask=nullptr, Value *PassThru=nullptr, const Twine &Name="")
Create a call to Masked Gather intrinsic.
Type * getVoidTy()
Fetch the type representing void.
AtomicOrdering
Atomic ordering for LLVM's memory model.
CatchReturnInst * CreateCatchRet(CatchPadInst *CatchPad, BasicBlock *BB)
StoreInst * CreateStore(Value *Val, Value *Ptr, bool isVolatile=false)
Value * CreateIntToPtr(Value *V, Type *DestTy, const Twine &Name="")
static Constant * getSizeOf(Type *Ty)
getSizeOf constant expr - computes the (alloc) size of a type (in address-units, not bits) in a targe...
Class to represent function types.
static GetElementPtrInst * CreateInBounds(Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Create an "inbounds" getelementptr.
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateSExtOrTrunc(Value *V, Type *DestTy, const Twine &Name="")
Create a SExt or Trunc from the integer value V to DestTy.
Value * CreateICmpUGT(Value *LHS, Value *RHS, const Twine &Name="")
BinOp
This enumeration lists the possible modifications atomicrmw can make.
InsertPoint saveIP() const
Returns the current insert point.
BasicBlock::iterator getPoint() const
Value * CreateGlobalStringPtr(StringRef Str, const Twine &Name="", unsigned AddressSpace=0)
Same as CreateGlobalString, but return a pointer with "i8*" type instead of a pointer to array of i8...
void ClearInsertionPoint()
Clear the insertion point: created instructions will not be inserted into a block.
This instruction compares its operands according to the predicate given to the constructor.
CallInst * CreateMemMove(Value *Dst, Value *Src, uint64_t Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert a memmove between the specified pointers.
Value * CreateVectorSplat(unsigned NumElts, Value *V, const Twine &Name="")
Return a vector value that contains.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
InstTy * Insert(InstTy *I, const Twine &Name="") const
Insert and return the specified instruction.
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
Value * CreateSub(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Value * CreateSIToFP(Value *V, Type *DestTy, const Twine &Name="")
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
An instruction for storing to memory.
void SetCurrentDebugLocation(DebugLoc L)
Set location information used by debugging information.
MDNode * getDefaultFPMathTag() const
Get the floating point math metadata being used.
Value * CreateZExt(Value *V, Type *DestTy, const Twine &Name="")
IRBuilder(LLVMContext &C, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
Value * CreateInBoundsGEP(Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name="")
Value * CreateFCmpOEQ(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateZExtOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
Type * getScalarType() const LLVM_READONLY
If this is a vector type, return the element type, otherwise return 'this'.
size_t size() const
size - Get the array size.
Value * CreateXor(Value *LHS, const APInt &RHS, const Twine &Name="")
void SetInsertPoint(BasicBlock *TheBB)
This specifies that created instructions should be appended to the end of the specified block...
ConstantInt * getIntN(unsigned N, uint64_t C)
Get a constant N-bit value, zero extended or truncated from a 64-bit value.
Class to represent pointers.
Type * getHalfTy()
Fetch the type representing a 16-bit floating point value.
Value * CreateFCmpUEQ(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateOr(Value *LHS, Value *RHS, const Twine &Name="")
IndirectBrInst * CreateIndirectBr(Value *Addr, unsigned NumDests=10)
Create an indirect branch instruction with the specified address operand, with an optional hint for t...
Value * CreateFCmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
InsertPoint saveAndClearIP()
Returns the current insert point, clearing it in the process.
LoadInst * CreateLoad(Value *Ptr, const char *Name)
Type * getDoubleTy()
Fetch the type representing a 64-bit floating point value.
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
Type * getParamType(unsigned i) const
Parameter type accessors.
void restoreIP(InsertPoint IP)
Sets the current insert point to a previously-saved location.
static IntegerType * getInt128Ty(LLVMContext &C)
The landingpad instruction holds all of the information necessary to generate correct exception handl...
IntegerType * getInt128Ty()
Fetch the type representing a 128-bit integer.
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
InsertPointGuard & operator=(const InsertPointGuard &)=delete
Value * CreateAShr(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
InsertPoint()=default
Creates a new insertion point which doesn't point to anything.
InsertPoint(BasicBlock *InsertBlock, BasicBlock::iterator InsertPoint)
Creates a new insertion point at the given location.
IRBuilder(Instruction *IP, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
FenceInst * CreateFence(AtomicOrdering Ordering, SynchronizationScope SynchScope=CrossThread, const Twine &Name="")
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
ConstantInt * getTrue()
Get the constant value for i1 true.
UnreachableInst * CreateUnreachable()
Conditional or Unconditional Branch instruction.
CleanupPadInst * CreateCleanupPad(Value *ParentPad, ArrayRef< Value * > Args=None, const Twine &Name="")
This function has undefined behavior.
ConstantInt * getInt1(bool V)
Get a constant value representing either true or false.
Type * getCurrentFunctionReturnType() const
Get the return type of the current function that we're emitting into.
Value * CreateExactSDiv(Value *LHS, Value *RHS, const Twine &Name="")
This is an important base class in LLVM.
Resume the propagation of an exception.
Value * CreateShl(Value *LHS, const APInt &RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Value * CreateExactUDiv(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateSelect(Value *C, Value *True, Value *False, const Twine &Name="", Instruction *MDFrom=nullptr)
Indirect Branch Instruction.
Value * CreateNSWMul(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateFCmpOGT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
InvokeInst * CreateInvoke(Value *Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="")
Value * CreateConstGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1, const Twine &Name="")
CallInst * CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes, Value *ActualCallee, ArrayRef< Value * > CallArgs, ArrayRef< Value * > DeoptArgs, ArrayRef< Value * > GCArgs, const Twine &Name="")
Create a call to the experimental.gc.statepoint intrinsic to start a new statepoint sequence...
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
Value * CreateFPToUI(Value *V, Type *DestTy, const Twine &Name="")
LoadInst * CreateLoad(Type *Ty, Value *Ptr, const Twine &Name="")
static Type * getVoidTy(LLVMContext &C)
CatchSwitchInst * CreateCatchSwitch(Value *ParentPad, BasicBlock *UnwindBB, unsigned NumHandlers, const Twine &Name="")
const InstListType & getInstList() const
Return the underlying instruction list container.
VAArgInst * CreateVAArg(Value *List, Type *Ty, const Twine &Name="")
Value * CreateNeg(Value *V, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
This instruction compares its operands according to the predicate given to the constructor.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
IRBuilder(BasicBlock *TheBB, const T &F, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
Value * CreateFRem(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value * > Args, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateICmpSGE(Value *LHS, Value *RHS, const Twine &Name="")
A specialization of it's base class for read-write access to a gc.statepoint.
0 1 1 1 True if ordered (no nans)
static CastInst * CreatePointerBitCastOrAddrSpaceCast(Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd)
Create a BitCast or an AddrSpaceCast cast instruction.
void clearFastMathFlags()
Clear the fast-math flags.
Value * CreateICmpEQ(Value *LHS, Value *RHS, const Twine &Name="")
self_iterator getIterator()
Class to represent integer types.
ConstantInt * getInt64(uint64_t C)
Get a constant 64-bit value.
static CastInst * CreatePointerCast(Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd)
Create a BitCast AddrSpaceCast, or a PtrToInt cast instruction.
IntegerType * getIntNTy(unsigned N)
Fetch the type representing an N-bit integer.
Value * CreateExtractElement(Value *Vec, Value *Idx, const Twine &Name="")
LoadInst * CreateAlignedLoad(Value *Ptr, unsigned Align, bool isVolatile, const Twine &Name="")
IRBuilderCallbackInserter(std::function< void(Instruction *)> Callback)
void setAlignment(unsigned Align)
NUW NUW NUW NUW Exact static Exact BinaryOperator * CreateNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Helper functions to construct and inspect unary operations (NEG and NOT) via binary operators SUB and...
InsertPointGuard(IRBuilderBase &B)
bool isPointerTy() const
True if this is an instance of PointerType.
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
Value * CreateLShr(Value *LHS, const APInt &RHS, const Twine &Name="", bool isExact=false)
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
void SetInsertPoint(Instruction *I)
This specifies that created instructions should be inserted before the specified instruction.
const T & getFolder()
Get the constant folder being used.
LLVMContext & getContext() const
Value * CreateExtractValue(Value *Agg, ArrayRef< unsigned > Idxs, const Twine &Name="")
static CastInst * CreateZExtOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a ZExt or BitCast cast instruction.
Value * CreateInvariantGroupBarrier(Value *Ptr)
Create an invariant.group.barrier intrinsic call, that stops optimizer to propagate equality using in...
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
PointerType * getInt8PtrTy(unsigned AddrSpace=0)
Fetch the type representing a pointer to an 8-bit integer value.
static GetElementPtrInst * Create(Type *PointeeType, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
1 1 0 1 True if unordered, less than, or equal
Value * CreateMul(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Value * CreateTrunc(Value *V, Type *DestTy, const Twine &Name="")
static IndirectBrInst * Create(Value *Address, unsigned NumDests, Instruction *InsertBefore=nullptr)
Value * CreateLShr(Value *LHS, uint64_t RHS, const Twine &Name="", bool isExact=false)
Value * CreateSRem(Value *LHS, Value *RHS, const Twine &Name="")
AtomicCmpXchgInst * CreateAtomicCmpXchg(Value *Ptr, Value *Cmp, Value *New, AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering, SynchronizationScope SynchScope=CrossThread)
static CatchPadInst * Create(Value *CatchSwitch, ArrayRef< Value * > Args, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Value * CreateFCmpUNE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateUIToFP(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateFCmpOGE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateConstGEP1_64(Value *Ptr, uint64_t Idx0, const Twine &Name="")
static InvokeInst * Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
This provides the default implementation of the IRBuilder 'InsertHelper' method that is called whenev...
PHINode * CreatePHI(Type *Ty, unsigned NumReservedValues, const Twine &Name="")
IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space...
Value * CreateFCmpOLT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
0 0 1 0 True if ordered and greater than
CallInst * CreateLifetimeEnd(Value *Ptr, ConstantInt *Size=nullptr)
Create a lifetime.end intrinsic.
static BinaryOperator * CreateFNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
static Type * getHalfTy(LLVMContext &C)
void setHasNoSignedWrap(bool b=true)
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag...
static CastInst * CreateIntegerCast(Value *S, Type *Ty, bool isSigned, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a ZExt, BitCast, or Trunc for int -> int casts.
Iterator for intrusive lists based on ilist_node.
Value * CreateFAdd(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
This is the shared class of boolean and integer constants.
ResumeInst * CreateResume(Value *Exn)
InsertPoint - A saved insertion point.
static CatchSwitchInst * Create(Value *ParentPad, BasicBlock *UnwindDest, unsigned NumHandlers, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
GlobalVariable * CreateGlobalString(StringRef Str, const Twine &Name="", unsigned AddressSpace=0)
Make a new global variable with initializer type i8*.
CallInst * CreateAssumption(Value *Cond)
Create an assume intrinsic call that allows the optimizer to assume that the provided condition will ...
static SwitchInst * Create(Value *Value, BasicBlock *Default, unsigned NumCases, Instruction *InsertBefore=nullptr)
Value * CreateIsNull(Value *Arg, const Twine &Name="")
Return an i1 value testing if Arg is null.
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type...
Value * CreateIntCast(Value *V, Type *DestTy, bool isSigned, const Twine &Name="")
Value * CreateNUWNeg(Value *V, const Twine &Name="")
static CallInst * Create(Value *Func, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Value * CreateICmpUGE(Value *LHS, Value *RHS, const Twine &Name="")
1 1 0 0 True if unordered or less than
Type * getType() const
All values are typed, get the type of this value.
Value * CreateInsertElement(Value *Vec, Value *NewElt, Value *Idx, const Twine &Name="")
FastMathFlagGuard(IRBuilderBase &B)
IRBuilderBase(LLVMContext &context, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
Value * CreateFCmpORD(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
CallInst * CreateMaskedStore(Value *Val, Value *Ptr, unsigned Align, Value *Mask)
Create a call to Masked Store intrinsic.
ConstantInt * getInt32(uint32_t C)
Get a constant 32-bit value.
static CastInst * CreateFPCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create an FPExt, BitCast, or FPTrunc for fp -> fp casts.
Value * CreateExtractElement(Value *Vec, uint64_t Idx, const Twine &Name="")
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
BasicBlock * GetInsertBlock() const
Value * CreateFCmpONE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateShuffleVector(Value *V1, Value *V2, Value *Mask, const Twine &Name="")
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.
static BranchInst * Create(BasicBlock *IfTrue, Instruction *InsertBefore=nullptr)
static PHINode * Create(Type *Ty, unsigned NumReservedValues, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructors - NumReservedValues is a hint for the number of incoming edges that this phi node will h...
CallInst * CreateMaskedLoad(Value *Ptr, unsigned Align, Value *Mask, Value *PassThru=nullptr, const Twine &Name="")
Create a call to Masked Load intrinsic.
Value * CreateConstInBoundsGEP1_64(Value *Ptr, uint64_t Idx0, const Twine &Name="")
Value * CreateURem(Value *LHS, Value *RHS, const Twine &Name="")
static ConstantInt * getTrue(LLVMContext &Context)
Value handle that asserts if the Value is deleted.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
ArrayRef< OperandBundleDef > DefaultOperandBundles
Value * CreateFPCast(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateAnd(Value *LHS, uint64_t RHS, const Twine &Name="")
Value * CreateGEP(Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name="")
Class for arbitrary precision integers.
Value * CreateGEP(Value *Ptr, Value *Idx, const Twine &Name="")
Value * CreateSDiv(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
Value * CreateUDiv(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
Value * CreateNUWMul(Value *LHS, Value *RHS, const Twine &Name="")
bool isIntegerTy() const
True if this is an instance of IntegerType.
const DebugLoc & getCurrentDebugLocation() const
Get location information used by debugging information.
static BinaryOperator * Create(BinaryOps Op, Value *S1, Value *S2, const Twine &Name=Twine(), Instruction *InsertBefore=nullptr)
Construct a binary instruction, given the opcode and the two operands.
Value * CreatePointerBitCastOrAddrSpaceCast(Value *V, Type *DestTy, const Twine &Name="")
IntegerType * getInt8Ty()
Fetch the type representing an 8-bit integer.
Value * CreateShl(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Value * CreatePointerCast(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateConstInBoundsGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1, const Twine &Name="")
void clear()
Set all the flags to false.
ConstantInt * getFalse()
Get the constant value for i1 false.
MDNode * DefaultFPMathTag
LoadInst * CreateAlignedLoad(Value *Ptr, unsigned Align, const Twine &Name="")
IntegerType * getInt1Ty()
Fetch the type representing a single bit.
Value * CreateBitOrPointerCast(Value *V, Type *DestTy, const Twine &Name="")
SwitchInst * CreateSwitch(Value *V, BasicBlock *Dest, unsigned NumCases=10, MDNode *BranchWeights=nullptr, MDNode *Unpredictable=nullptr)
Create a switch instruction with the specified value, default dest, and with a hint for the number of...
Value * CreateTruncOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateNUWSub(Value *LHS, Value *RHS, const Twine &Name="")
ReturnInst * CreateRetVoid()
Create a 'ret void' instruction.
static CastInst * Create(Instruction::CastOps, Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Provides a way to construct any of the CastInst subclasses using an opcode instead of the subclass's ...
Value * CreateFCmpULT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateGEP(Type *Ty, Value *Ptr, Value *Idx, const Twine &Name="")
Provides an 'InsertHelper' that calls a user-provided callback after performing the default insertion...
iterator insert(iterator where, pointer New)
CallInst * CreateMemCpy(Value *Dst, Value *Src, uint64_t Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *TBAAStructTag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert a memcpy between the specified pointers.
static IntegerType * getInt32Ty(LLVMContext &C)
Value * CreateInBoundsGEP(Type *Ty, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name="")
Value * CreateXor(Value *LHS, uint64_t RHS, const Twine &Name="")
static CastInst * CreateTruncOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a Trunc or BitCast cast instruction.
unsigned greater or equal
static InsertValueInst * Create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
CleanupReturnInst * CreateCleanupRet(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB=nullptr)
CallInst * CreateGCResult(Instruction *Statepoint, Type *ResultType, const Twine &Name="")
Create a call to the experimental.gc.result intrinsic to extract the result from a call wrapped in a ...
FunctionType * getFunctionType() const
Returns the FunctionType for me.
CallInst * CreateCall(Value *Callee, ArrayRef< Value * > Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)
0 1 1 0 True if ordered and operands are unequal
Value * CreateConstInBoundsGEP2_32(Type *Ty, Value *Ptr, unsigned Idx0, unsigned Idx1, const Twine &Name="")
Value * CreateFPToSI(Value *V, Type *DestTy, const Twine &Name="")
void setDefaultFPMathTag(MDNode *FPMathTag)
Set the floating point math metadata to be used.
Type * getFloatTy()
Fetch the type representing a 32-bit floating point value.
uint64_t getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
1 0 1 0 True if unordered or greater than
LandingPadInst * CreateLandingPad(Type *Ty, unsigned NumClauses, const Twine &Name="")
Value * CreateAnd(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreatePtrToInt(Value *V, Type *DestTy, const Twine &Name="")
void InsertHelper(Instruction *I, const Twine &Name, BasicBlock *BB, BasicBlock::iterator InsertPt) const
void setHasNoUnsignedWrap(bool b=true)
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag...
Value * CreateCast(Instruction::CastOps Op, Value *V, Type *DestTy, const Twine &Name="")
static CastInst * CreateSExtOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a SExt or BitCast cast instruction.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Value * CreateAnd(Value *LHS, const APInt &RHS, const Twine &Name="")
CallInst * CreateMaskedScatter(Value *Val, Value *Ptrs, unsigned Align, Value *Mask=nullptr)
Create a call to Masked Scatter intrinsic.
ReturnInst * CreateAggregateRet(Value *const *retVals, unsigned N)
Create a sequence of N insertvalue instructions, with one Value from the retVals array each...
LoadInst * CreateAlignedLoad(Value *Ptr, unsigned Align, const char *Name)
static CatchReturnInst * Create(Value *CatchPad, BasicBlock *BB, Instruction *InsertBefore=nullptr)
0 0 0 1 True if ordered and equal
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
void setAlignment(unsigned Align)
1 0 1 1 True if unordered, greater than, or equal
BranchInst * CreateCondBr(Value *Cond, BasicBlock *True, BasicBlock *False, Instruction *MDSrc)
Create a conditional 'br Cond, TrueDest, FalseDest' instruction.
BranchInst * CreateBr(BasicBlock *Dest)
Create an unconditional 'br label X' instruction.
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
void copyMetadata(const Instruction &SrcInst, ArrayRef< unsigned > WL=ArrayRef< unsigned >())
Copy metadata from SrcInst to this instruction.
static CleanupReturnInst * Create(Value *CleanupPad, BasicBlock *UnwindBB=nullptr, Instruction *InsertBefore=nullptr)
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.
void setFastMathFlags(FastMathFlags NewFMF)
Set the fast-math flags to be used with generated fp-math operators.
FastMathFlags getFastMathFlags() const
Get the flags to be applied to created floating point ops.
Value * CreateLShr(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
bool isSet() const
Returns true if this insert point is set.
Value * CreateStructGEP(Type *Ty, Value *Ptr, unsigned Idx, const Twine &Name="")
Value * CreateFDiv(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
ConstantInt * getInt8(uint8_t C)
Get a constant 8-bit value.
print Print MemDeps of function
CallInst * CreateLifetimeStart(Value *Ptr, ConstantInt *Size=nullptr)
Create a lifetime.start intrinsic.
Convenience struct for specifying and reasoning about fast-math flags.
StringRef - Represent a constant reference to a string, i.e.
Value * CreateNSWSub(Value *LHS, Value *RHS, const Twine &Name="")
static bool isVolatile(Instruction *Inst)
IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
Value * CreateInsertValue(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &Name="")
static Constant * get(LLVMContext &Context, ArrayRef< uint8_t > Elts)
get() constructors - Return a constant with vector type with an element count and element type matchi...
IRBuilder(LLVMContext &C, const T &F, Inserter I=Inserter(), MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
ConstantInt * getInt(const APInt &AI)
Get a constant integer value.
Value * CreateFMul(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
CallInst * CreateCall(Value *Callee, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="", MDNode *FPMathTag=nullptr)
0 0 1 1 True if ordered and greater than or equal
AtomicRMWInst * CreateAtomicRMW(AtomicRMWInst::BinOp Op, Value *Ptr, Value *Val, AtomicOrdering Ordering, SynchronizationScope SynchScope=CrossThread)
Value * CreateGEP(Type *Ty, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name="")
Value * CreateICmpSLE(Value *LHS, Value *RHS, const Twine &Name="")
static IntegerType * getInt8Ty(LLVMContext &C)
BasicBlock::iterator InsertPt
const BasicBlock * getParent() const
InstListType::iterator iterator
Instruction iterators...
Value * CreateFNeg(Value *V, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateOr(Value *LHS, const APInt &RHS, const Twine &Name="")
an instruction to allocate memory on the stack
void SetInstDebugLocation(Instruction *I) const
If this builder has a current debug location, set it on the specified instruction.
Value * CreateFCmpULE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)