15 #ifndef LLVM_IR_IRBUILDER_H
16 #define LLVM_IR_IRBUILDER_H
40 template <
bool preserveNames = true>
95 assert(I !=
BB->
end() &&
"Can't read debug loc from end()");
104 if (IP != TheBB->
end())
136 : Block(InsertBlock), Point(InsertPoint) {}
139 bool isSet()
const {
return (Block !=
nullptr); }
367 MDNode *ScopeTag =
nullptr,
368 MDNode *NoAliasTag =
nullptr) {
370 TBAATag, ScopeTag, NoAliasTag);
375 MDNode *ScopeTag =
nullptr,
376 MDNode *NoAliasTag =
nullptr);
385 MDNode *TBAAStructTag =
nullptr,
386 MDNode *ScopeTag =
nullptr,
387 MDNode *NoAliasTag =
nullptr) {
389 TBAAStructTag, ScopeTag, NoAliasTag);
394 MDNode *TBAAStructTag =
nullptr,
395 MDNode *ScopeTag =
nullptr,
396 MDNode *NoAliasTag =
nullptr);
406 MDNode *ScopeTag =
nullptr,
407 MDNode *NoAliasTag =
nullptr) {
409 TBAATag, ScopeTag, NoAliasTag);
414 MDNode *ScopeTag =
nullptr,
415 MDNode *NoAliasTag =
nullptr);
515 template<
bool preserveNames =
true,
typename T = ConstantFolder,
516 typename Inserter = IRBuilderDefaultInserter<preserveNames> >
521 MDNode *FPMathTag =
nullptr)
545 MDNode *FPMathTag =
nullptr)
551 MDNode *FPMathTag =
nullptr)
564 template<
typename InstTy>
583 template <
typename InstTy>
584 InstTy *addBranchWeights(InstTy *
I,
MDNode *Weights) {
610 for (
unsigned i = 0; i !=
N; ++i)
623 MDNode *BranchWeights =
nullptr) {
632 MDNode *BranchWeights =
nullptr) {
659 Value *Args[] = { Arg1, Arg2, Arg3 };
686 bool HasNUW,
bool HasNSW) {
693 Instruction *AddFPMathAttributes(Instruction *I,
695 FastMathFlags
FMF)
const {
700 I->setFastMathFlags(FMF);
705 bool HasNUW =
false,
bool HasNSW =
false) {
706 if (
Constant *LC = dyn_cast<Constant>(LHS))
707 if (
Constant *RC = dyn_cast<Constant>(RHS))
708 return Insert(Folder.CreateAdd(LC, RC, HasNUW, HasNSW),
Name);
709 return CreateInsertNUWNSWBinOp(Instruction::Add, LHS, RHS, Name,
713 return CreateAdd(LHS, RHS, Name,
false,
true);
716 return CreateAdd(LHS, RHS, Name,
true,
false);
719 MDNode *FPMathTag =
nullptr) {
720 if (
Constant *LC = dyn_cast<Constant>(LHS))
721 if (
Constant *RC = dyn_cast<Constant>(RHS))
722 return Insert(Folder.CreateFAdd(LC, RC),
Name);
723 return Insert(AddFPMathAttributes(BinaryOperator::CreateFAdd(LHS, RHS),
724 FPMathTag, FMF), Name);
727 bool HasNUW =
false,
bool HasNSW =
false) {
728 if (
Constant *LC = dyn_cast<Constant>(LHS))
729 if (
Constant *RC = dyn_cast<Constant>(RHS))
730 return Insert(Folder.CreateSub(LC, RC, HasNUW, HasNSW),
Name);
731 return CreateInsertNUWNSWBinOp(Instruction::Sub, LHS, RHS, Name,
735 return CreateSub(LHS, RHS, Name,
false,
true);
738 return CreateSub(LHS, RHS, Name,
true,
false);
741 MDNode *FPMathTag =
nullptr) {
742 if (
Constant *LC = dyn_cast<Constant>(LHS))
743 if (
Constant *RC = dyn_cast<Constant>(RHS))
744 return Insert(Folder.CreateFSub(LC, RC),
Name);
745 return Insert(AddFPMathAttributes(BinaryOperator::CreateFSub(LHS, RHS),
746 FPMathTag, FMF), Name);
749 bool HasNUW =
false,
bool HasNSW =
false) {
750 if (
Constant *LC = dyn_cast<Constant>(LHS))
751 if (
Constant *RC = dyn_cast<Constant>(RHS))
752 return Insert(Folder.CreateMul(LC, RC, HasNUW, HasNSW),
Name);
753 return CreateInsertNUWNSWBinOp(Instruction::Mul, LHS, RHS, Name,
757 return CreateMul(LHS, RHS, Name,
false,
true);
760 return CreateMul(LHS, RHS, Name,
true,
false);
763 MDNode *FPMathTag =
nullptr) {
764 if (
Constant *LC = dyn_cast<Constant>(LHS))
765 if (
Constant *RC = dyn_cast<Constant>(RHS))
766 return Insert(Folder.CreateFMul(LC, RC),
Name);
767 return Insert(AddFPMathAttributes(BinaryOperator::CreateFMul(LHS, RHS),
768 FPMathTag, FMF), Name);
771 bool isExact =
false) {
772 if (
Constant *LC = dyn_cast<Constant>(LHS))
773 if (
Constant *RC = dyn_cast<Constant>(RHS))
774 return Insert(Folder.CreateUDiv(LC, RC, isExact),
Name);
776 return Insert(BinaryOperator::CreateUDiv(LHS, RHS), Name);
777 return Insert(BinaryOperator::CreateExactUDiv(LHS, RHS), Name);
783 bool isExact =
false) {
784 if (
Constant *LC = dyn_cast<Constant>(LHS))
785 if (
Constant *RC = dyn_cast<Constant>(RHS))
786 return Insert(Folder.CreateSDiv(LC, RC, isExact),
Name);
788 return Insert(BinaryOperator::CreateSDiv(LHS, RHS), Name);
789 return Insert(BinaryOperator::CreateExactSDiv(LHS, RHS), Name);
795 MDNode *FPMathTag =
nullptr) {
796 if (
Constant *LC = dyn_cast<Constant>(LHS))
797 if (
Constant *RC = dyn_cast<Constant>(RHS))
798 return Insert(Folder.CreateFDiv(LC, RC),
Name);
799 return Insert(AddFPMathAttributes(BinaryOperator::CreateFDiv(LHS, RHS),
800 FPMathTag, FMF), Name);
803 if (
Constant *LC = dyn_cast<Constant>(LHS))
804 if (
Constant *RC = dyn_cast<Constant>(RHS))
805 return Insert(Folder.CreateURem(LC, RC),
Name);
806 return Insert(BinaryOperator::CreateURem(LHS, RHS), Name);
809 if (
Constant *LC = dyn_cast<Constant>(LHS))
810 if (
Constant *RC = dyn_cast<Constant>(RHS))
811 return Insert(Folder.CreateSRem(LC, RC),
Name);
812 return Insert(BinaryOperator::CreateSRem(LHS, RHS), Name);
815 MDNode *FPMathTag =
nullptr) {
816 if (
Constant *LC = dyn_cast<Constant>(LHS))
817 if (
Constant *RC = dyn_cast<Constant>(RHS))
818 return Insert(Folder.CreateFRem(LC, RC),
Name);
819 return Insert(AddFPMathAttributes(BinaryOperator::CreateFRem(LHS, RHS),
820 FPMathTag, FMF), Name);
824 bool HasNUW =
false,
bool HasNSW =
false) {
825 if (
Constant *LC = dyn_cast<Constant>(LHS))
826 if (
Constant *RC = dyn_cast<Constant>(RHS))
827 return Insert(Folder.CreateShl(LC, RC, HasNUW, HasNSW),
Name);
828 return CreateInsertNUWNSWBinOp(Instruction::Shl, LHS, RHS, Name,
832 bool HasNUW =
false,
bool HasNSW =
false) {
837 bool HasNUW =
false,
bool HasNSW =
false) {
843 bool isExact =
false) {
844 if (
Constant *LC = dyn_cast<Constant>(LHS))
845 if (
Constant *RC = dyn_cast<Constant>(RHS))
846 return Insert(Folder.CreateLShr(LC, RC, isExact),
Name);
848 return Insert(BinaryOperator::CreateLShr(LHS, RHS), Name);
849 return Insert(BinaryOperator::CreateExactLShr(LHS, RHS), Name);
852 bool isExact =
false) {
856 bool isExact =
false) {
861 bool isExact =
false) {
862 if (
Constant *LC = dyn_cast<Constant>(LHS))
863 if (
Constant *RC = dyn_cast<Constant>(RHS))
864 return Insert(Folder.CreateAShr(LC, RC, isExact),
Name);
866 return Insert(BinaryOperator::CreateAShr(LHS, RHS), Name);
867 return Insert(BinaryOperator::CreateExactAShr(LHS, RHS), Name);
870 bool isExact =
false) {
874 bool isExact =
false) {
879 if (
Constant *RC = dyn_cast<Constant>(RHS)) {
880 if (isa<ConstantInt>(RC) && cast<ConstantInt>(RC)->isAllOnesValue())
882 if (
Constant *LC = dyn_cast<Constant>(LHS))
883 return Insert(Folder.CreateAnd(LC, RC),
Name);
885 return Insert(BinaryOperator::CreateAnd(LHS, RHS), Name);
895 if (
Constant *RC = dyn_cast<Constant>(RHS)) {
896 if (RC->isNullValue())
898 if (
Constant *LC = dyn_cast<Constant>(LHS))
901 return Insert(BinaryOperator::CreateOr(LHS, RHS), Name);
911 if (
Constant *LC = dyn_cast<Constant>(LHS))
912 if (
Constant *RC = dyn_cast<Constant>(RHS))
913 return Insert(Folder.CreateXor(LC, RC),
Name);
914 return Insert(BinaryOperator::CreateXor(LHS, RHS), Name);
925 MDNode *FPMathTag =
nullptr) {
926 if (
Constant *LC = dyn_cast<Constant>(LHS))
927 if (
Constant *RC = dyn_cast<Constant>(RHS))
928 return Insert(Folder.CreateBinOp(Opc, LC, RC),
Name);
930 if (isa<FPMathOperator>(BinOp))
931 BinOp = AddFPMathAttributes(BinOp, FPMathTag, FMF);
932 return Insert(BinOp, Name);
936 bool HasNUW =
false,
bool HasNSW =
false) {
938 return Insert(Folder.CreateNeg(
VC, HasNUW, HasNSW),
Name);
940 if (HasNUW) BO->setHasNoUnsignedWrap();
941 if (HasNSW) BO->setHasNoSignedWrap();
951 MDNode *FPMathTag =
nullptr) {
955 FPMathTag, FMF), Name);
968 const Twine &Name =
"") {
997 const Twine &Name =
"") {
1003 const Twine &Name =
"") {
1016 const Twine &Name =
"") {
1025 FailureOrdering, SynchScope));
1033 const Twine &Name =
"") {
1034 return CreateGEP(
nullptr, Ptr, IdxList, Name);
1037 const Twine &Name =
"") {
1038 if (
Constant *PC = dyn_cast<Constant>(Ptr)) {
1041 for (i = 0, e = IdxList.
size(); i != e; ++i)
1042 if (!isa<Constant>(IdxList[i]))
1045 return Insert(Folder.CreateGetElementPtr(Ty, PC, IdxList),
Name);
1050 const Twine &Name =
"") {
1054 const Twine &Name =
"") {
1055 if (
Constant *PC = dyn_cast<Constant>(Ptr)) {
1058 for (i = 0, e = IdxList.
size(); i != e; ++i)
1059 if (!isa<Constant>(IdxList[i]))
1062 return Insert(Folder.CreateInBoundsGetElementPtr(Ty, PC, IdxList),
1068 return CreateGEP(
nullptr, Ptr, Idx, Name);
1071 if (
Constant *PC = dyn_cast<Constant>(Ptr))
1072 if (
Constant *IC = dyn_cast<Constant>(Idx))
1073 return Insert(Folder.CreateGetElementPtr(Ty, PC, IC),
Name);
1077 const Twine &Name =
"") {
1078 if (
Constant *PC = dyn_cast<Constant>(Ptr))
1079 if (
Constant *IC = dyn_cast<Constant>(Idx))
1080 return Insert(Folder.CreateInBoundsGetElementPtr(Ty, PC, IC),
Name);
1087 const Twine &Name =
"") {
1090 if (
Constant *PC = dyn_cast<Constant>(Ptr))
1091 return Insert(Folder.CreateGetElementPtr(Ty, PC, Idx),
Name);
1096 const Twine &Name =
"") {
1099 if (
Constant *PC = dyn_cast<Constant>(Ptr))
1100 return Insert(Folder.CreateInBoundsGetElementPtr(Ty, PC, Idx),
Name);
1105 const Twine &Name =
"") {
1111 if (
Constant *PC = dyn_cast<Constant>(Ptr))
1112 return Insert(Folder.CreateGetElementPtr(Ty, PC, Idxs),
Name);
1117 unsigned Idx1,
const Twine &Name =
"") {
1123 if (
Constant *PC = dyn_cast<Constant>(Ptr))
1124 return Insert(Folder.CreateInBoundsGetElementPtr(Ty, PC, Idxs),
Name);
1131 if (
Constant *PC = dyn_cast<Constant>(Ptr))
1132 return Insert(Folder.CreateGetElementPtr(
nullptr, PC, Idx),
Name);
1137 const Twine &Name =
"") {
1140 if (
Constant *PC = dyn_cast<Constant>(Ptr))
1141 return Insert(Folder.CreateInBoundsGetElementPtr(
nullptr, PC, Idx),
Name);
1146 const Twine &Name =
"") {
1152 if (
Constant *PC = dyn_cast<Constant>(Ptr))
1153 return Insert(Folder.CreateGetElementPtr(
nullptr, PC, Idxs),
Name);
1158 const Twine &Name =
"") {
1164 if (
Constant *PC = dyn_cast<Constant>(Ptr))
1165 return Insert(Folder.CreateInBoundsGetElementPtr(
nullptr, PC, Idxs),
1171 const Twine &Name =
"") {
1181 Value *Args[] = { zero, zero };
1190 return CreateCast(Instruction::Trunc, V, DestTy, Name);
1193 return CreateCast(Instruction::ZExt, V, DestTy, Name);
1196 return CreateCast(Instruction::SExt, V, DestTy, Name);
1201 const Twine &Name =
"") {
1204 "Can only zero extend/truncate integers!");
1215 const Twine &Name =
"") {
1218 "Can only sign extend/truncate integers!");
1227 return CreateCast(Instruction::FPToUI, V, DestTy, Name);
1230 return CreateCast(Instruction::FPToSI, V, DestTy, Name);
1233 return CreateCast(Instruction::UIToFP, V, DestTy, Name);
1236 return CreateCast(Instruction::SIToFP, V, DestTy, Name);
1239 const Twine &Name =
"") {
1240 return CreateCast(Instruction::FPTrunc, V, DestTy, Name);
1243 return CreateCast(Instruction::FPExt, V, DestTy, Name);
1246 const Twine &Name =
"") {
1247 return CreateCast(Instruction::PtrToInt, V, DestTy, Name);
1250 const Twine &Name =
"") {
1251 return CreateCast(Instruction::IntToPtr, V, DestTy, Name);
1254 const Twine &Name =
"") {
1255 return CreateCast(Instruction::BitCast, V, DestTy, Name);
1258 const Twine &Name =
"") {
1259 return CreateCast(Instruction::AddrSpaceCast, V, DestTy, Name);
1262 const Twine &Name =
"") {
1266 return Insert(Folder.CreateZExtOrBitCast(
VC, DestTy),
Name);
1270 const Twine &Name =
"") {
1274 return Insert(Folder.CreateSExtOrBitCast(
VC, DestTy),
Name);
1278 const Twine &Name =
"") {
1282 return Insert(Folder.CreateTruncOrBitCast(
VC, DestTy),
Name);
1286 const Twine &Name =
"") {
1290 return Insert(Folder.CreateCast(Op,
VC, DestTy),
Name);
1294 const Twine &Name =
"") {
1298 return Insert(Folder.CreatePointerCast(
VC, DestTy),
Name);
1303 const Twine &Name =
"") {
1308 return Insert(Folder.CreatePointerBitCastOrAddrSpaceCast(
VC, DestTy),
1317 const Twine &Name =
"") {
1321 return Insert(Folder.CreateIntCast(
VC, DestTy, isSigned),
Name);
1326 const Twine &Name =
"") {
1386 MDNode *FPMathTag =
nullptr) {
1390 MDNode *FPMathTag =
nullptr) {
1394 MDNode *FPMathTag =
nullptr) {
1398 MDNode *FPMathTag =
nullptr) {
1402 MDNode *FPMathTag =
nullptr) {
1406 MDNode *FPMathTag =
nullptr) {
1410 MDNode *FPMathTag =
nullptr) {
1414 MDNode *FPMathTag =
nullptr) {
1418 MDNode *FPMathTag =
nullptr) {
1422 MDNode *FPMathTag =
nullptr) {
1426 MDNode *FPMathTag =
nullptr) {
1430 MDNode *FPMathTag =
nullptr) {
1434 MDNode *FPMathTag =
nullptr) {
1438 MDNode *FPMathTag =
nullptr) {
1443 const Twine &Name =
"") {
1444 if (
Constant *LC = dyn_cast<Constant>(LHS))
1445 if (
Constant *RC = dyn_cast<Constant>(RHS))
1446 return Insert(Folder.CreateICmp(P, LC, RC),
Name);
1450 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
1451 if (
Constant *LC = dyn_cast<Constant>(LHS))
1452 if (
Constant *RC = dyn_cast<Constant>(RHS))
1453 return Insert(Folder.CreateFCmp(P, LC, RC),
Name);
1455 FPMathTag, FMF), Name);
1463 const Twine &Name =
"") {
1468 const Twine &Name =
"") {
1478 const Twine &Name =
"") {
1483 const Twine &Name =
"") {
1484 if (
Constant *CC = dyn_cast<Constant>(C))
1485 if (
Constant *TC = dyn_cast<Constant>(True))
1486 if (
Constant *
FC = dyn_cast<Constant>(False))
1496 const Twine &Name =
"") {
1498 if (
Constant *IC = dyn_cast<Constant>(Idx))
1499 return Insert(Folder.CreateExtractElement(
VC, IC),
Name);
1504 const Twine &Name =
"") {
1509 const Twine &Name =
"") {
1511 if (
Constant *
NC = dyn_cast<Constant>(NewElt))
1512 if (
Constant *IC = dyn_cast<Constant>(Idx))
1518 const Twine &Name =
"") {
1523 const Twine &Name =
"") {
1524 if (
Constant *V1C = dyn_cast<Constant>(V1))
1525 if (
Constant *V2C = dyn_cast<Constant>(V2))
1526 if (
Constant *MC = dyn_cast<Constant>(Mask))
1527 return Insert(Folder.CreateShuffleVector(V1C, V2C, MC),
Name);
1532 const Twine &Name =
"") {
1533 size_t MaskSize = IntMask.
size();
1535 for (
size_t i = 0; i != MaskSize; ++i)
1543 const Twine &Name =
"") {
1544 if (
Constant *AggC = dyn_cast<Constant>(Agg))
1545 return Insert(Folder.CreateExtractValue(AggC, Idxs),
Name);
1551 const Twine &Name =
"") {
1552 if (
Constant *AggC = dyn_cast<Constant>(Agg))
1553 if (
Constant *ValC = dyn_cast<Constant>(Val))
1554 return Insert(Folder.CreateInsertValue(AggC, ValC, Idxs),
Name);
1559 const Twine &Name =
"") {
1587 "Pointer subtraction operand types must match!");
1600 assert(NumElts > 0 &&
"Cannot splat to an empty vector!");
1606 Name +
".splatinsert");
1616 const Twine &Name) {
1620 "Element extends past full value");
1621 uint64_t ShAmt = 8 * Offset;
1630 "Cannot extract to a larger integer!");
1631 if (ExtractedTy != IntTy) {
1645 Value *OffsetValue =
nullptr) {
1646 assert(isa<PointerType>(PtrValue->
getType()) &&
1647 "trying to create an alignment assumption on a non-pointer?");
1654 Alignment > 0 ? Alignment - 1 : 0);
1656 bool IsOffsetZero =
false;
1657 if (
ConstantInt *CI = dyn_cast<ConstantInt>(OffsetValue))
1658 IsOffsetZero = CI->isZero();
1660 if (!IsOffsetZero) {
1661 if (OffsetValue->getType() != IntPtrTy)
1664 PtrIntValue =
CreateSub(PtrIntValue, OffsetValue,
"offsetptr");
IntegerType * getInt16Ty()
Fetch the type representing a 16-bit integer.
Value * CreateLShr(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
Common base class shared among various IRBuilders.
Value * CreateGEP(Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name="")
Value * CreateNUWNeg(Value *V, const Twine &Name="")
ReturnInst - Return a value (possibly void), from a function.
LoadInst * CreateLoad(Value *Ptr, const Twine &Name="")
A parsed version of the target data layout string in and methods for querying it. ...
static ConstantInt * getFalse(LLVMContext &Context)
IRBuilder(BasicBlock *TheBB, const T &F, MDNode *FPMathTag=nullptr)
AllocaInst * CreateAlloca(Type *Ty, Value *ArraySize=nullptr, const Twine &Name="")
void setHasNoSignedWrap(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 Type * getDoubleTy(LLVMContext &C)
static IntegerType * getInt1Ty(LLVMContext &C)
Value * CreateSIToFP(Value *V, Type *DestTy, const Twine &Name="")
BasicBlock::iterator GetInsertPoint() const
LoadInst * CreateLoad(Value *Ptr, const char *Name)
LoadInst * CreateLoad(Type *Ty, Value *Ptr, const Twine &Name="")
static BinaryOperator * CreateNot(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Value * CreateInsertElement(Value *Vec, Value *NewElt, uint64_t Idx, const Twine &Name="")
IRBuilder(LLVMContext &C, MDNode *FPMathTag=nullptr)
Value * CreateExtractElement(Value *Vec, uint64_t Idx, const Twine &Name="")
Value * CreateICmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="")
CallInst * CreateCall(Function *Callee, ArrayRef< Value * > Args, const Twine &Name="")
Value * CreateFCmpUEQ(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateSExtOrTrunc(Value *V, Type *DestTy, const Twine &Name="")
Create a SExt or Trunc from the integer value V to DestTy.
Value * CreateICmpSLE(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 * CreateIntCast(Value *V, Type *DestTy, bool isSigned, const Twine &Name="")
VAArgInst * CreateVAArg(Value *List, Type *Ty, const Twine &Name="")
static ResumeInst * Create(Value *Exn, Instruction *InsertBefore=nullptr)
FenceInst - an instruction for ordering other memory operations.
Value * CreateNSWSub(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateICmpSLT(Value *LHS, Value *RHS, const Twine &Name="")
AtomicCmpXchgInst - an instruction that atomically checks whether a specified value is in a memory lo...
Value * CreateFCmpULT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateFCmpOLT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
ReturnInst * CreateAggregateRet(Value *const *retVals, unsigned N)
Create a sequence of N insertvalue instructions, with one Value from the retVals array each...
static ConstantAggregateZero * get(Type *Ty)
IRBuilder(Instruction *IP, MDNode *FPMathTag=nullptr)
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
CallInst - This class represents a function call, abstracting a target machine's calling convention...
Value * CreateSRem(Value *LHS, Value *RHS, const Twine &Name="")
void SetInsertPoint(BasicBlock *TheBB, BasicBlock::iterator IP)
This specifies that created instructions should be inserted at the specified point.
SwitchInst * CreateSwitch(Value *V, BasicBlock *Dest, unsigned NumCases=10, MDNode *BranchWeights=nullptr)
Create a switch instruction with the specified value, default dest, and with a hint for the number of...
Value * CreatePointerCast(Value *V, Type *DestTy, const Twine &Name="")
AtomicCmpXchgInst * CreateAtomicCmpXchg(Value *Ptr, Value *Cmp, Value *New, AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering, SynchronizationScope SynchScope=CrossThread)
Value * CreateExactSDiv(Value *LHS, Value *RHS, const Twine &Name="")
0 1 0 0 True if ordered and less than
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...
ShuffleVectorInst - This instruction constructs a fixed permutation of two input vectors.
Value * CreateICmpULT(Value *LHS, Value *RHS, const Twine &Name="")
1 1 1 0 True if unordered or not equal
Value * CreateFPCast(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateNUWMul(Value *LHS, Value *RHS, const Twine &Name="")
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.
LoadInst - an instruction for reading from memory.
Value * CreateGEP(Value *Ptr, Value *Idx, const Twine &Name="")
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
static IntegerType * getInt64Ty(LLVMContext &C)
AtomicRMWInst - an instruction that atomically reads a memory location, combines it with another valu...
Value * CreateICmpEQ(Value *LHS, Value *RHS, const Twine &Name="")
BranchInst * CreateCondBr(Value *Cond, BasicBlock *True, BasicBlock *False, MDNode *BranchWeights=nullptr)
Create a conditional 'br Cond, TrueDest, FalseDest' instruction.
static IntegerType * getInt16Ty(LLVMContext &C)
Value * CreateShuffleVector(Value *V1, Value *V2, Value *Mask, const Twine &Name="")
Value * CreateOr(Value *LHS, const APInt &RHS, const Twine &Name="")
LoadInst * CreateAlignedLoad(Value *Ptr, unsigned Align, bool isVolatile, const Twine &Name="")
Value * CreateInBoundsGEP(Type *Ty, Value *Ptr, Value *Idx, const Twine &Name="")
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 * CreateSub(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
InstTy * Insert(InstTy *I, const Twine &Name="") const
Insert and return the specified instruction.
Value * CreateBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateInsertElement(Value *Vec, Value *NewElt, Value *Idx, const Twine &Name="")
static Constant * getNullValue(Type *Ty)
Value * CreateNSWAdd(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateICmpULE(Value *LHS, Value *RHS, const Twine &Name="")
static ReturnInst * Create(LLVMContext &C, Value *retVal=nullptr, Instruction *InsertBefore=nullptr)
IntegerType * getInt32Ty()
Fetch the type representing a 32-bit integer.
Value * CreateGEP(Type *Ty, Value *Ptr, Value *Idx, const Twine &Name="")
1 0 0 1 True if unordered or equal
Value * CreateExtractValue(Value *Agg, ArrayRef< unsigned > Idxs, const Twine &Name="")
PHINode * CreatePHI(Type *Ty, unsigned NumReservedValues, const Twine &Name="")
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Value * CreateXor(Value *LHS, Value *RHS, const Twine &Name="")
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static CallInst * Create(Value *Func, ArrayRef< Value * > Args, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
IntegerType * getInt64Ty()
Fetch the type representing a 64-bit integer.
static Type * getFloatTy(LLVMContext &C)
Value * CreateAShr(Value *LHS, uint64_t RHS, const Twine &Name="", bool isExact=false)
Value * CreateIntToPtr(Value *V, Type *DestTy, const Twine &Name="")
void setHasNoUnsignedWrap(bool b=true)
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag...
llvm::BasicBlock * getBlock() const
static Constant * get(ArrayRef< Constant * > V)
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
Value * CreateConstGEP1_64(Value *Ptr, uint64_t Idx0, const Twine &Name="")
Value * CreateConstInBoundsGEP1_32(Type *Ty, Value *Ptr, unsigned Idx0, const Twine &Name="")
void setName(const Twine &Name)
Change the name of the value.
Value * CreateNSWMul(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateICmpSGT(Value *LHS, Value *RHS, const Twine &Name="")
ConstantInt * getInt16(uint16_t C)
Get a constant 16-bit value.
Type * getVoidTy()
Fetch the type representing void.
static Constant * getSizeOf(Type *Ty)
getSizeOf constant expr - computes the (alloc) size of a type (in address-units, not bits) in a targe...
FunctionType - Class to represent function types.
Value * CreateFCmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
static GetElementPtrInst * CreateInBounds(Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Create an "inbounds" getelementptr.
Value * CreateAnd(Value *LHS, Value *RHS, const Twine &Name="")
InvokeInst * CreateInvoke3(Value *Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, Value *Arg1, Value *Arg2, Value *Arg3, const Twine &Name="")
static SelectInst * Create(Value *C, Value *S1, Value *S2, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Value * CreateOr(Value *LHS, Value *RHS, const Twine &Name="")
void SetFastMathFlags(FastMathFlags NewFMF)
Set the fast-math flags to be used with generated fp-math operators.
BinOp
This enumeration lists the possible modifications atomicrmw can make.
InsertPoint saveIP() const
Returns the current insert point.
UnreachableInst * CreateUnreachable()
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.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
StoreInst - an instruction for storing to memory.
void SetCurrentDebugLocation(DebugLoc L)
Set location information used by debugging information.
Value * CreateFCmpOGE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
MDNode * getDefaultFPMathTag() const
Get the floating point math metadata being used.
Value * CreateConstGEP1_32(Value *Ptr, unsigned Idx0, const Twine &Name="")
Value * CreateAShr(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
Value * CreateShl(Value *LHS, const APInt &RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
StoreInst * CreateStore(Value *Val, Value *Ptr, bool isVolatile=false)
size_t size() const
size - Get the array size.
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.
PointerType - Class to represent pointers.
Value * CreateNSWNeg(Value *V, const Twine &Name="")
Type * getHalfTy()
Fetch the type representing a 16-bit floating point value.
LoadInst * CreateLoad(Value *Ptr, bool isVolatile, const Twine &Name="")
Value * CreateLShr(Value *LHS, const APInt &RHS, const Twine &Name="", bool isExact=false)
InsertPoint saveAndClearIP()
Returns the current insert point, clearing it in the process.
Type * getDoubleTy()
Fetch the type representing a 64-bit floating point value.
Value * CreateNUWSub(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreatePointerBitCastOrAddrSpaceCast(Value *V, Type *DestTy, const Twine &Name="")
bool isIntOrIntVectorTy() const
isIntOrIntVectorTy - Return true if this is an integer type or a vector of integer types...
void restoreIP(InsertPoint IP)
Sets the current insert point to a previously-saved location.
static IntegerType * getInt128Ty(LLVMContext &C)
LandingPadInst - The landingpad instruction holds all of the information necessary to generate correc...
IntegerType * getInt128Ty()
Fetch the type representing a 128-bit integer.
void setDebugLoc(DebugLoc Loc)
setDebugLoc - Set the debug location information for this instruction.
InvokeInst * CreateInvoke(Value *Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, Value *Arg1, const Twine &Name="")
Value * CreateConstInBoundsGEP1_64(Value *Ptr, uint64_t Idx0, const Twine &Name="")
Value * CreateShl(Value *LHS, uint64_t RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Value * CreateICmpSGE(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateConstGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1, const Twine &Name="")
InsertPoint(BasicBlock *InsertBlock, BasicBlock::iterator InsertPoint)
Creates a new insertion point at the given location.
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
Value * CreateFRem(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
This is an important class for using LLVM in a threaded context.
ConstantInt * getTrue()
Get the constant value for i1 true.
BranchInst - Conditional or Unconditional Branch instruction.
Value * CreateNot(Value *V, const Twine &Name="")
Value * CreateFCmpOLE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateAdd(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
UnreachableInst - 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 * CreatePtrToInt(Value *V, Type *DestTy, const Twine &Name="")
This is an important base class in LLVM.
Value * CreateAShr(Value *LHS, const APInt &RHS, const Twine &Name="", bool isExact=false)
Value * CreateFPToSI(Value *V, Type *DestTy, const Twine &Name="")
ResumeInst - Resume the propagation of an exception.
IndirectBrInst - Indirect Branch Instruction.
ReturnInst * CreateRet(Value *V)
Create a 'ret <val>' instruction.
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...
LoadInst * CreateAlignedLoad(Value *Ptr, unsigned Align, 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...
Value * CreateFCmpORD(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
const DebugLoc & getDebugLoc() const
getDebugLoc - Return the debug location for this node as a DebugLoc.
Value * CreateFCmpUGE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateConstGEP2_32(Type *Ty, Value *Ptr, unsigned Idx0, unsigned Idx1, const Twine &Name="")
static Type * getVoidTy(LLVMContext &C)
Value * CreateFCmpUGT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateConstInBoundsGEP2_32(Type *Ty, Value *Ptr, unsigned Idx0, unsigned Idx1, const Twine &Name="")
const InstListType & getInstList() const
Return the underlying instruction list container.
This instruction compares its operands according to the predicate given to the constructor.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
iterator insert(iterator where, NodeTy *New)
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...
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 * CreateUIToFP(Value *V, Type *DestTy, const Twine &Name="")
Class to represent integer types.
Value * CreateOr(Value *LHS, uint64_t RHS, const Twine &Name="")
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 * CreateAnd(Value *LHS, uint64_t RHS, const Twine &Name="")
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...
IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, MDNode *FPMathTag=nullptr)
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...
InsertPointGuard(IRBuilderBase &B)
bool isPointerTy() const
isPointerTy - True if this is an instance of PointerType.
Value * CreateInBoundsGEP(Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name="")
static UndefValue * get(Type *T)
get() - Static factory methods - Return an 'undef' object of the specified type.
VAArgInst - This class represents the va_arg llvm instruction, which returns an argument of the speci...
void SetInsertPoint(Instruction *I)
This specifies that created instructions should be inserted before the specified instruction.
LLVMContext & getContext() const
IndirectBrInst * CreateIndirectBr(Value *Addr, unsigned NumDests=10)
Create an indirect branch instruction with the specified address operand, with an optional hint for t...
CallInst * CreateCall(Value *Callee, ArrayRef< Value * > Args=None, const Twine &Name="")
static CastInst * CreateZExtOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a ZExt or BitCast cast instruction.
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.
StoreInst * CreateAlignedStore(Value *Val, Value *Ptr, unsigned Align, bool isVolatile=false)
LoadInst * CreateAlignedLoad(Value *Ptr, unsigned Align, const char *Name)
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
static IndirectBrInst * Create(Value *Address, unsigned NumDests, Instruction *InsertBefore=nullptr)
Value * CreateFPToUI(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateXor(Value *LHS, const APInt &RHS, const Twine &Name="")
Value * CreateGEP(Type *Ty, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name="")
Value * CreateFCmpONE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
This provides the default implementation of the IRBuilder 'InsertHelper' method that is called whenev...
Value * CreateFDiv(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
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...
0 0 1 0 True if ordered and greater than
bool isNamePreserving() const
Return true if this builder is configured to actually add the requested names to IR created through i...
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)
static InvokeInst * Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
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.
Value * CreateNUWAdd(Value *LHS, Value *RHS, const Twine &Name="")
This is the shared class of boolean and integer constants.
InsertPoint - A saved insertion point.
Value * CreateExtractElement(Value *Vec, Value *Idx, const Twine &Name="")
Value * CreateZExt(Value *V, Type *DestTy, const Twine &Name="")
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)
unsigned getScalarSizeInBits() const LLVM_READONLY
getScalarSizeInBits - If this is a vector type, return the getPrimitiveSizeInBits value for the eleme...
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
1 1 0 0 True if unordered or less than
Type * getType() const
All values are typed, get the type of this value.
FastMathFlagGuard(IRBuilderBase &B)
CallInst * CreateMaskedLoad(Value *Ptr, unsigned Align, Value *Mask, Value *PassThru=0, const Twine &Name="")
Create a call to Masked Load intrinsic.
Value * CreateICmpUGE(Value *LHS, Value *RHS, const Twine &Name="")
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.
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
BasicBlock * GetInsertBlock() const
Value * CreateConstGEP1_32(Type *Ty, Value *Ptr, unsigned Idx0, const Twine &Name="")
Value * CreateMul(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=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.
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...
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(NoStrictAlign), cl::values(clEnumValN(StrictAlign,"aarch64-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"aarch64-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
static ConstantInt * getTrue(LLVMContext &Context)
Value handle that asserts if the Value is deleted.
Value * CreateZExtOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateURem(Value *LHS, Value *RHS, const Twine &Name="")
Class for arbitrary precision integers.
Value * CreateSDiv(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
bool isIntegerTy() const
isIntegerTy - True if this is an instance of IntegerType.
Value * CreateUDiv(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
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 * CreateSelect(Value *C, Value *True, Value *False, const Twine &Name="")
IntegerType * getInt8Ty()
Fetch the type representing an 8-bit integer.
Value * CreateStructGEP(Type *Ty, Value *Ptr, unsigned Idx, const Twine &Name="")
Value * CreateVectorSplat(unsigned NumElts, Value *V, const Twine &Name="")
Return a vector value that contains.
Value * CreateTruncOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
void InsertHelper(Instruction *I, const Twine &Name, BasicBlock *BB, BasicBlock::iterator InsertPt) const
Value * CreateFAdd(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
void clear()
Set all the flags to false.
Value * CreateInsertValue(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &Name="")
Value * CreateFCmpULE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
ConstantInt * getFalse()
Get the constant value for i1 false.
MDNode * DefaultFPMathTag
IntegerType * getInt1Ty()
Fetch the type representing a single bit.
Value * CreateShl(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Value * CreateIsNotNull(Value *Arg, const Twine &Name="")
Return an i1 value testing if Arg is not null.
Value * CreateConstInBoundsGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1, const Twine &Name="")
IRBuilder(BasicBlock *TheBB, MDNode *FPMathTag=nullptr)
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 ...
Constant * Insert(Constant *C, const Twine &="") const
No-op overload to handle constants.
Value * CreateZExtOrTrunc(Value *V, Type *DestTy, const Twine &Name="")
Create a ZExt or Trunc from the integer value V to DestTy.
Value * CreateInBoundsGEP(Type *Ty, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name="")
Value * CreateAnd(Value *LHS, const APInt &RHS, const Twine &Name="")
Value * CreateAddrSpaceCast(Value *V, Type *DestTy, const Twine &Name="")
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)
CallInst * CreateCall(llvm::FunctionType *FTy, Value *Callee, ArrayRef< Value * > Args, const Twine &Name="")
static CastInst * CreateTruncOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a Trunc or BitCast cast instruction.
AtomicRMWInst * CreateAtomicRMW(AtomicRMWInst::BinOp Op, Value *Ptr, Value *Val, AtomicOrdering Ordering, SynchronizationScope SynchScope=CrossThread)
unsigned greater or equal
Value * CreateShuffleVector(Value *V1, Value *V2, ArrayRef< int > IntMask, const Twine &Name="")
Value * CreateSExt(Value *V, Type *DestTy, const Twine &Name="")
IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, const T &F, MDNode *FPMathTag=nullptr)
static InsertValueInst * Create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
IRBuilderBase(LLVMContext &context, MDNode *FPMathTag=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
Value * CreateFCmpOGT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
0 1 1 0 True if ordered and operands are unequal
const T & getFolder()
Get the constant folder being used.
FenceInst * CreateFence(AtomicOrdering Ordering, SynchronizationScope SynchScope=CrossThread, const Twine &Name="")
Value * CreateICmpNE(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateXor(Value *LHS, uint64_t RHS, const Twine &Name="")
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...
Value * CreateExactUDiv(Value *LHS, Value *RHS, const Twine &Name="")
1 0 1 0 True if unordered or greater than
InvokeInst * CreateInvoke(Value *Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > Args, const Twine &Name="")
Create an invoke instruction.
SwitchInst - Multiway switch.
Value * CreateFMul(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
static CastInst * CreateSExtOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a SExt or BitCast cast instruction.
IRBuilder(LLVMContext &C, const T &F, const Inserter &I=Inserter(), MDNode *FPMathTag=nullptr)
Value * CreateNeg(Value *V, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Value * CreateIsNull(Value *Arg, const Twine &Name="")
Return an i1 value testing if Arg is null.
llvm::BasicBlock::iterator getPoint() const
0 0 0 1 True if ordered and equal
Value * CreateTrunc(Value *V, Type *DestTy, const Twine &Name="")
LLVM Value Representation.
void setAlignment(unsigned Align)
1 0 1 1 True if unordered, greater than, or equal
Value * CreateFCmpOEQ(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
static VectorType * get(Type *ElementType, unsigned NumElements)
VectorType::get - This static method is the primary way to construct an VectorType.
ReturnInst * CreateRetVoid()
Create a 'ret void' instruction.
FastMathFlags getFastMathFlags() const
Get the flags to be applied to created floating point ops.
bool isSet() const
Returns true if this insert point is set.
BranchInst * CreateBr(BasicBlock *Dest)
Create an unconditional 'br label X' instruction.
InvokeInst - Invoke instruction.
InsertPoint()
Creates a new insertion point which doesn't point to anything.
ConstantInt * getInt8(uint8_t C)
Get a constant 8-bit value.
CallInst * CreateLifetimeStart(Value *Ptr, ConstantInt *Size=nullptr)
Create a lifetime.start intrinsic.
struct LLVMOpaqueBuilder * LLVMBuilderRef
Represents an LLVM basic block builder.
Convenience struct for specifying and reasoning about fast-math flags.
StringRef - Represent a constant reference to a string, i.e.
Value * CreateBitOrPointerCast(Value *V, Type *DestTy, const Twine &Name="")
static bool isVolatile(Instruction *Inst)
InvokeInst * CreateInvoke(Value *Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, const Twine &Name="")
Value * CreateFPExt(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateFCmpUNO(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
ConstantInt * getInt(const APInt &AI)
Get a constant integer value.
Value * CreateFCmpUNE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateFPTrunc(Value *V, Type *DestTy, const Twine &Name="")
LandingPadInst * CreateLandingPad(Type *Ty, unsigned NumClauses, const Twine &Name="")
0 0 1 1 True if ordered and greater than or equal
Value * CreateICmpUGT(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateLShr(Value *LHS, uint64_t RHS, const Twine &Name="", bool isExact=false)
Value * CreateFNeg(Value *V, const Twine &Name="", MDNode *FPMathTag=nullptr)
ResumeInst * CreateResume(Value *Exn)
static IntegerType * getInt8Ty(LLVMContext &C)
BasicBlock::iterator InsertPt
const BasicBlock * getParent() const
Value * CreateFSub(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateSExtOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
AllocaInst - 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.
void SetDefaultFPMathTag(MDNode *FPMathTag)
Set the floating point math metadata to be used.