14#ifndef LLVM_IR_IRBUILDER_H
15#define LLVM_IR_IRBUILDER_H
66 if (InsertPt.isValid())
67 I->insertInto(InsertPt.getNodeParent(), InsertPt);
79 : Callback(
std::
move(Callback)) {}
91 std::optional<FastMathFlags> FMF;
97 FMF = Source->getFastMathFlags();
149 template<
typename InstTy>
186 assert(
BB &&
"Must have insertion point to get data layout");
187 return BB->getDataLayout();
193 assert(
BB &&
"Must have insertion point to get module");
194 return BB->getModule();
215 [[deprecated(
"Use the overload without BasicBlock argument instead")]]
223 BB = IP.getNodeParent();
233 BB = &
F->getEntryBlock();
248 StoredDL = std::move(L);
312 std::optional<StringRef> ExceptStr =
314 assert(ExceptStr &&
"Garbage strict exception behavior!");
322 std::optional<StringRef> RoundingStr =
324 assert(RoundingStr &&
"Garbage strict rounding mode!");
340 assert(
BB &&
"Must have a basic block to set any function attributes!");
343 if (!
F->hasFnAttribute(Attribute::StrictFP)) {
344 F->addFnAttr(Attribute::StrictFP);
349 I->addFnAttr(Attribute::StrictFP);
376 Builder.restoreIP(Point);
377 Builder.SetCurrentDebugLocation(DbgLoc);
387 bool IsFPConstrained;
394 IsFPConstrained(
B.IsFPConstrained),
395 DefaultConstrainedExcept(
B.DefaultConstrainedExcept),
396 DefaultConstrainedRounding(
B.DefaultConstrainedRounding) {}
403 Builder.DefaultFPMathTag = FPMathTag;
404 Builder.IsFPConstrained = IsFPConstrained;
405 Builder.DefaultConstrainedExcept = DefaultConstrainedExcept;
406 Builder.DefaultConstrainedRounding = DefaultConstrainedRounding;
418 : Builder(
B), DefaultOperandBundles(
B.DefaultOperandBundles) {}
424 Builder.DefaultOperandBundles = DefaultOperandBundles;
443 const Twine &Name =
"",
446 bool AddNull =
true);
490 return ConstantInt::get(
Context, AI);
581 return DL.getBytePtrType(
Context, AddrSpace);
587 return DL.getIntPtrType(
Context, AddrSpace);
593 return DL.getIndexType(
Context, AddrSpace);
617 bool IsVolatile =
false,
637 const Twine &Name =
"");
645 const Twine &Name =
"");
652 Align Alignment,
uint32_t ElementSize,
653 const AAMDNodes &AAInfo = AAMDNodes());
662 bool isVolatile =
false,
671 bool isVolatile =
false,
676 bool isVolatile =
false,
679 SrcAlign,
Size, isVolatile, AAInfo);
684 bool isVolatile =
false,
687 SrcAlign,
Size, isVolatile, AAInfo);
704 bool isVolatile =
false,
712 bool isVolatile =
false,
715 SrcAlign,
Size, isVolatile, AAInfo);
815 const Twine &Name =
"");
823 Value *Mask =
nullptr,
824 Value *PassThru =
nullptr,
825 const Twine &Name =
"");
830 Value *Mask =
nullptr);
835 Value *Mask =
nullptr,
836 Value *PassThru =
nullptr,
837 const Twine &Name =
"");
842 Value *Mask =
nullptr);
907 const Twine &Name =
"");
922 const Twine &Name =
"");
927 int DerivedOffset,
Type *ResultType,
928 const Twine &Name =
"");
933 const Twine &Name =
"");
938 const Twine &Name =
"");
966 const Twine &Name =
"");
971 Value *
RHS, FMFSource FMFSource = {},
972 const Twine &
Name =
"");
979 FMFSource FMFSource = {},
const Twine &
Name =
"",
988 FMFSource FMFSource = {},
989 const Twine &
Name =
"");
997 const Twine &Name =
"") {
1007 FMFSource FMFSource = {},
const Twine &
Name =
"",
1009 function_ref<void(CallInst *)> SetFn = [](CallInst *) {});
1016 FMFSource FMFSource = {},
const Twine &
Name =
"",
1017 function_ref<void(CallInst *)> SetFn = [](CallInst *) {});
1024 const Twine &Name =
"",
1031 const Twine &Name =
"") {
1037 const Twine &Name =
"") {
1049 const Twine &Name =
"") {
1083 const Twine &Name =
"") {
1090 const Twine &Name =
"") {
1092 return CreateIntrinsic(Intrinsic::ldexp, {Src->getType(), Exp->getType()},
1093 {Src, Exp}, FMFSource,
Name);
1101 Intrinsic::experimental_constrained_fma, {Factor1->
getType()},
1102 {Factor1, Factor2, Summand}, FMFSource,
Name);
1106 {Factor1, Factor2, Summand}, FMFSource,
Name);
1111 const Twine &Name =
"") {
1112 return CreateIntrinsic(Intrinsic::arithmetic_fence, DstType, Val,
nullptr,
1118 const Twine &Name =
"") {
1120 {DstType, SrcVec->
getType()}, {SrcVec, Idx},
nullptr,
1126 const Twine &Name =
"") {
1134 {DstType, SubVec->
getType()}, {SrcVec, SubVec, Idx},
1155 Intrinsic::stackrestore, {Ptr->
getType()}, {Ptr},
nullptr, Name);
1160 bool ZeroIsPoison =
true,
1161 const Twine &Name =
"") {
1163 {ResTy, Mask->getType()},
1164 {Mask,
getInt1(ZeroIsPoison)},
nullptr, Name);
1171 const Twine &Name =
"");
1181 template <
typename InstTy>
1182 InstTy *addBranchMetadata(InstTy *
I,
MDNode *Weights,
MDNode *Unpredictable) {
1184 I->setMetadata(LLVMContext::MD_prof, Weights);
1186 I->setMetadata(LLVMContext::MD_unpredictable, Unpredictable);
1209 for (
size_t i = 0,
N = RetVals.
size(); i !=
N; ++i)
1222 MDNode *BranchWeights =
nullptr,
1223 MDNode *Unpredictable =
nullptr) {
1225 BranchWeights, Unpredictable));
1234 unsigned WL[4] = {LLVMContext::MD_prof, LLVMContext::MD_unpredictable,
1235 LLVMContext::MD_make_implicit, LLVMContext::MD_dbg};
1245 MDNode *BranchWeights =
nullptr,
1246 MDNode *Unpredictable =
nullptr) {
1248 BranchWeights, Unpredictable));
1263 const Twine &Name =
"") {
1273 const Twine &Name =
"") {
1284 const Twine &Name =
"") {
1285 return CreateInvoke(Callee.getFunctionType(), Callee.getCallee(),
1286 NormalDest, UnwindDest, Args, OpBundles, Name);
1291 const Twine &Name =
"") {
1292 return CreateInvoke(Callee.getFunctionType(), Callee.getCallee(),
1293 NormalDest, UnwindDest, Args, Name);
1301 const Twine &Name =
"") {
1310 const Twine &Name =
"") {
1319 const Twine &Name =
"") {
1320 return CreateCallBr(Callee.getFunctionType(), Callee.getCallee(),
1321 DefaultDest, IndirectDests, Args, Name);
1327 const Twine &Name =
"") {
1328 return CreateCallBr(Callee.getFunctionType(), Callee.getCallee(),
1329 DefaultDest, IndirectDests, Args, Name);
1342 unsigned NumHandlers,
1343 const Twine &Name =
"") {
1349 const Twine &Name =
"") {
1355 const Twine &Name =
"") {
1374 bool HasNUW,
bool HasNSW) {
1381 Instruction *setFPAttrs(Instruction *
I, MDNode *FPMD,
1382 FastMathFlags
FMF)
const {
1386 I->setMetadata(LLVMContext::MD_fpmath, FPMD);
1387 I->setFastMathFlags(
FMF);
1391 Value *getConstrainedFPRounding(std::optional<RoundingMode> Rounding) {
1397 std::optional<StringRef> RoundingStr =
1399 assert(RoundingStr &&
"Garbage strict rounding mode!");
1405 Value *getConstrainedFPExcept(std::optional<fp::ExceptionBehavior> Except) {
1408 assert(ExceptStr &&
"Garbage strict exception behavior!");
1418 "Invalid constrained FP comparison predicate!");
1428 bool HasNUW =
false,
bool HasNSW =
false) {
1430 Folder.FoldNoWrapBinOp(Instruction::Add,
LHS,
RHS, HasNUW, HasNSW))
1432 return CreateInsertNUWNSWBinOp(Instruction::Add,
LHS,
RHS, Name, HasNUW,
1445 bool HasNUW =
false,
bool HasNSW =
false) {
1447 Folder.FoldNoWrapBinOp(Instruction::Sub,
LHS,
RHS, HasNUW, HasNSW))
1449 return CreateInsertNUWNSWBinOp(Instruction::Sub,
LHS,
RHS, Name, HasNUW,
1462 bool HasNUW =
false,
bool HasNSW =
false) {
1464 Folder.FoldNoWrapBinOp(Instruction::Mul,
LHS,
RHS, HasNUW, HasNSW))
1466 return CreateInsertNUWNSWBinOp(Instruction::Mul,
LHS,
RHS, Name, HasNUW,
1479 bool isExact =
false) {
1483 return Insert(BinaryOperator::CreateUDiv(
LHS,
RHS), Name);
1484 return Insert(BinaryOperator::CreateExactUDiv(
LHS,
RHS), Name);
1492 bool isExact =
false) {
1496 return Insert(BinaryOperator::CreateSDiv(
LHS,
RHS), Name);
1497 return Insert(BinaryOperator::CreateExactSDiv(
LHS,
RHS), Name);
1507 return Insert(BinaryOperator::CreateURem(
LHS,
RHS), Name);
1513 return Insert(BinaryOperator::CreateSRem(
LHS,
RHS), Name);
1517 bool HasNUW =
false,
bool HasNSW =
false) {
1519 Folder.FoldNoWrapBinOp(Instruction::Shl,
LHS,
RHS, HasNUW, HasNSW))
1521 return CreateInsertNUWNSWBinOp(Instruction::Shl,
LHS,
RHS, Name,
1526 bool HasNUW =
false,
bool HasNSW =
false) {
1532 bool HasNUW =
false,
bool HasNSW =
false) {
1538 bool isExact =
false) {
1542 return Insert(BinaryOperator::CreateLShr(
LHS,
RHS), Name);
1543 return Insert(BinaryOperator::CreateExactLShr(
LHS,
RHS), Name);
1547 bool isExact =
false) {
1552 bool isExact =
false) {
1557 bool isExact =
false) {
1561 return Insert(BinaryOperator::CreateAShr(
LHS,
RHS), Name);
1562 return Insert(BinaryOperator::CreateExactAShr(
LHS,
RHS), Name);
1566 bool isExact =
false) {
1571 bool isExact =
false) {
1576 if (
auto *V =
Folder.FoldBinOp(Instruction::And,
LHS,
RHS))
1578 return Insert(BinaryOperator::CreateAnd(
LHS,
RHS), Name);
1592 for (
unsigned i = 1; i <
Ops.size(); i++)
1598 bool IsDisjoint =
false) {
1599 if (
auto *V =
Folder.FoldBinOp(Instruction::Or,
LHS,
RHS))
1603 : BinaryOperator::CreateOr(
LHS,
RHS),
1618 for (
unsigned i = 1; i <
Ops.size(); i++)
1630 return Insert(BinaryOperator::CreateXor(
LHS,
RHS), Name);
1642 MDNode *FPMD =
nullptr) {
1656 setFPAttrs(BinaryOperator::CreateFAdd(L, R), FPMD,
FMFSource.
get(
FMF));
1661 MDNode *FPMD =
nullptr) {
1675 setFPAttrs(BinaryOperator::CreateFSub(L, R), FPMD,
FMFSource.
get(
FMF));
1680 MDNode *FPMD =
nullptr) {
1694 setFPAttrs(BinaryOperator::CreateFMul(L, R), FPMD,
FMFSource.
get(
FMF));
1699 MDNode *FPMD =
nullptr) {
1713 setFPAttrs(BinaryOperator::CreateFDiv(L, R), FPMD,
FMFSource.
get(
FMF));
1718 MDNode *FPMD =
nullptr) {
1732 setFPAttrs(BinaryOperator::CreateFRem(L, R), FPMD,
FMFSource.
get(
FMF));
1738 MDNode *FPMathTag =
nullptr) {
1744 MDNode *FPMathTag =
nullptr) {
1750 return Insert(BinOp, Name);
1754 bool IsNUW,
bool IsNSW,
const Twine &Name =
"") {
1762 return Insert(BinOp, Name);
1766 bool IsExact,
const Twine &Name =
"") {
1772 return Insert(BinOp, Name);
1787 Cond2, Name, MDFrom);
1791 const Twine &Name =
"",
1794 case Instruction::And:
1796 case Instruction::Or:
1808 for (
unsigned i = 1; i <
Ops.size(); i++)
1821 std::optional<RoundingMode> Rounding = std::nullopt,
1822 std::optional<fp::ExceptionBehavior> Except = std::nullopt);
1826 const Twine &Name =
"", MDNode *FPMathTag =
nullptr,
1827 std::optional<RoundingMode> Rounding = std::nullopt,
1828 std::optional<fp::ExceptionBehavior> Except = std::nullopt);
1831 Intrinsic::ID ID, Value *L, Value *R, FMFSource FMFSource = {},
1832 const Twine &
Name =
"", MDNode *FPMathTag =
nullptr,
1833 std::optional<fp::ExceptionBehavior> Except = std::nullopt);
1845 MDNode *FPMathTag =
nullptr) {
1850 MDNode *FPMathTag =
nullptr) {
1855 setFPAttrs(UnaryOperator::CreateFNeg(V), FPMathTag,
FMFSource.
get(
FMF)),
1865 MDNode *FPMathTag =
nullptr) {
1870 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
1876 return Insert(UnOp, Name);
1882 const Twine &Name =
"",
1883 MDNode *FPMathTag =
nullptr);
1890 Value *ArraySize =
nullptr,
const Twine &Name =
"") {
1892 Align AllocaAlign =
DL.getPrefTypeAlign(Ty);
1893 return Insert(
new AllocaInst(Ty, AddrSpace, ArraySize, AllocaAlign), Name);
1897 const Twine &Name =
"") {
1899 Align AllocaAlign =
DL.getPrefTypeAlign(Ty);
1900 unsigned AddrSpace =
DL.getAllocaAddrSpace();
1901 return Insert(
new AllocaInst(Ty, AddrSpace, ArraySize, AllocaAlign), Name);
1908 {PtrTy}, {}, {}, Name);
1924 const Twine &Name =
"") {
1930 const Twine &Name =
"") {
1949 const Twine &Name =
"") {
1954 bool isVolatile,
const Twine &Name =
"") {
1957 Align =
DL.getABITypeAlign(Ty);
1963 bool isVolatile =
false) {
1972 const Twine &Name =
"") {
1987 FailureOrdering, SSID));
1994 bool Elementwise =
false) {
2006 const Twine &Name =
"") {
2008 Args.push_back(PtrBase);
2012 Intrinsic::structured_gep, {PtrBase->
getType()}, Args, {}, Name, {},
2014 Output->addParamAttr(
2021 const Twine &Name =
"",
2029 const Twine &Name =
"") {
2034 const Twine &Name =
"") {
2040 const Twine &Name =
"") {
2046 const Twine &Name =
"",
2052 return CreateGEP(Ty, Ptr, Idxs, Name, NWFlags);
2056 unsigned Idx1,
const Twine &Name =
"") {
2065 const Twine &Name =
"") {
2071 const Twine &Name =
"") {
2077 const Twine &Name =
"") {
2095 const Twine &Name =
"") {
2107 const Twine &Name =
"") {
2117 bool IsNUW =
false,
bool IsNSW =
false) {
2118 if (V->getType() == DestTy)
2120 if (
Value *Folded =
Folder.FoldCast(Instruction::Trunc, V, DestTy))
2124 I->setHasNoUnsignedWrap();
2126 I->setHasNoSignedWrap();
2131 bool IsNonNeg =
false) {
2132 if (V->getType() == DestTy)
2134 if (
Value *Folded =
Folder.FoldCast(Instruction::ZExt, V, DestTy))
2143 return CreateCast(Instruction::SExt, V, DestTy, Name);
2149 const Twine &Name =
"") {
2150 assert(V->getType()->isIntOrIntVectorTy() &&
2152 "Can only zero extend/truncate integers!");
2153 Type *VTy = V->getType();
2164 const Twine &Name =
"") {
2165 assert(V->getType()->isIntOrIntVectorTy() &&
2167 "Can only sign extend/truncate integers!");
2168 Type *VTy = V->getType();
2179 V, DestTy,
nullptr, Name);
2180 return CreateCast(Instruction::FPToUI, V, DestTy, Name);
2186 V, DestTy,
nullptr, Name);
2187 return CreateCast(Instruction::FPToSI, V, DestTy, Name);
2191 bool IsNonNeg =
false,
MDNode *FPMathTag =
nullptr) {
2194 V, DestTy,
nullptr, Name);
2195 Value *Val =
CreateCast(Instruction::UIToFP, V, DestTy, Name, FPMathTag);
2203 MDNode *FPMathTag =
nullptr) {
2206 V, DestTy,
nullptr, Name);
2207 return CreateCast(Instruction::SIToFP, V, DestTy, Name, FPMathTag);
2211 MDNode *FPMathTag =
nullptr) {
2216 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
2219 Intrinsic::experimental_constrained_fptrunc, V, DestTy,
FMFSource,
2221 return CreateCast(Instruction::FPTrunc, V, DestTy, Name, FPMathTag,
2226 MDNode *FPMathTag =
nullptr) {
2231 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
2235 return CreateCast(Instruction::FPExt, V, DestTy, Name, FPMathTag,
2243 const Twine &Name =
"") {
2244 return CreateCast(Instruction::PtrToInt, V, DestTy, Name);
2248 const Twine &Name =
"") {
2249 return CreateCast(Instruction::IntToPtr, V, DestTy, Name);
2253 const Twine &Name =
"") {
2254 return CreateCast(Instruction::BitCast, V, DestTy, Name);
2258 bool IsNonNull =
false) {
2259 if (V->getType() == DestTy)
2261 if (
Value *Folded =
Folder.FoldCast(Instruction::AddrSpaceCast, V, DestTy))
2272 ? Instruction::BitCast
2273 : Instruction::ZExt;
2280 ? Instruction::BitCast
2281 : Instruction::SExt;
2288 ? Instruction::BitCast
2289 : Instruction::Trunc;
2294 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr,
2296 if (V->getType() == DestTy)
2303 return Insert(Cast, Name);
2307 const Twine &Name =
"") {
2308 if (V->getType() == DestTy)
2311 return Insert(
Folder.CreatePointerCast(VC, DestTy), Name);
2319 const Twine &Name =
"") {
2320 if (V->getType() == DestTy)
2324 return Insert(
Folder.CreatePointerBitCastOrAddrSpaceCast(VC, DestTy),
2333 const Twine &Name =
"") {
2336 ? Instruction::Trunc
2337 : (
isSigned ? Instruction::SExt : Instruction::ZExt);
2342 const Twine &Name =
"") {
2343 if (V->getType() == DestTy)
2354 MDNode *FPMathTag =
nullptr) {
2357 ? Instruction::FPTrunc
2358 : Instruction::FPExt;
2359 return CreateCast(CastOp, V, DestTy, Name, FPMathTag);
2364 const Twine &Name =
"", MDNode *FPMathTag =
nullptr,
2365 std::optional<RoundingMode> Rounding = std::nullopt,
2366 std::optional<fp::ExceptionBehavior> Except = std::nullopt);
2432 MDNode *FPMathTag =
nullptr) {
2437 MDNode *FPMathTag =
nullptr) {
2442 MDNode *FPMathTag =
nullptr) {
2447 MDNode *FPMathTag =
nullptr) {
2452 MDNode *FPMathTag =
nullptr) {
2457 MDNode *FPMathTag =
nullptr) {
2462 MDNode *FPMathTag =
nullptr) {
2467 MDNode *FPMathTag =
nullptr) {
2472 MDNode *FPMathTag =
nullptr) {
2477 MDNode *FPMathTag =
nullptr) {
2482 MDNode *FPMathTag =
nullptr) {
2487 MDNode *FPMathTag =
nullptr) {
2492 MDNode *FPMathTag =
nullptr) {
2497 MDNode *FPMathTag =
nullptr) {
2502 const Twine &Name =
"") {
2512 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
2513 return CreateFCmpHelper(
P,
LHS,
RHS, Name, FPMathTag, {},
false);
2521 MDNode *FPMathTag =
nullptr) {
2526 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
2536 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
2537 return CreateFCmpHelper(
P,
LHS,
RHS, Name, FPMathTag, {},
true);
2549 const Twine &Name =
"",
2550 std::optional<fp::ExceptionBehavior> Except = std::nullopt);
2557 const Twine &Name =
"") {
2560 setFPAttrs(Phi,
nullptr ,
FMF);
2561 return Insert(Phi, Name);
2572 MDNode *FPMathTag =
nullptr) {
2577 setFPAttrs(CI, FPMathTag,
FMF);
2583 MDNode *FPMathTag =
nullptr) {
2590 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
2595 setFPAttrs(CI, FPMathTag,
FMF);
2602 MDNode *FPMathTag =
nullptr) {
2612 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
2613 return CreateCall(Callee.getFunctionType(), Callee.getCallee(), Args, Name,
2619 MDNode *FPMathTag =
nullptr) {
2620 return CreateCall(Callee.getFunctionType(), Callee.getCallee(), Args,
2626 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
2627 return CreateCall(Callee.getFunctionType(), Callee.getCallee(), Args,
2628 OpBundles, Name, FPMathTag);
2634 MDNode *FPMathTag =
nullptr) {
2635 return CreateCall(Callee.getFunctionType(), Callee.getCallee(), Args,
2641 std::optional<RoundingMode> Rounding = std::nullopt,
2642 std::optional<fp::ExceptionBehavior> Except = std::nullopt);
2647 const Twine &Name =
"");
2653 const Twine &Name =
"");
2656 const Twine &Name =
"",
2667 const Twine &Name =
"") {
2668 if (
Value *V =
Folder.FoldExtractElement(Vec, Idx))
2674 const Twine &Name =
"") {
2679 const Twine &Name =
"") {
2684 const Twine &Name =
"") {
2689 const Twine &Name =
"") {
2690 if (
Value *V =
Folder.FoldInsertElement(Vec, NewElt, Idx))
2696 const Twine &Name =
"") {
2701 const Twine &Name =
"") {
2709 const Twine &Name =
"") {
2718 const Twine &Name =
"") {
2723 const Twine &Name =
"");
2726 const Twine &Name =
"") {
2727 if (
auto *V =
Folder.FoldExtractValue(Agg, Idxs))
2733 const Twine &Name =
"") {
2734 if (
auto *V =
Folder.FoldInsertValue(Agg, Val, Idxs))
2740 const Twine &Name =
"") {
2749 const Twine &Name =
"") {
2756 const Twine &Name =
"") {
2790 bool IsNUW =
false);
2800 const Twine &Name =
"");
2814 const Twine &Name =
"");
2817 const Twine &Name =
"") {
2825 const Twine &Name =
"");
2828 const Twine &Name =
"") {
2835 const Twine &Name =
"");
2840 const Twine &Name =
"");
2848 unsigned FieldIndex,
2853 unsigned FieldIndex,
2864 Value *OffsetValue);
2876 Value *OffsetValue =
nullptr);
2890 Value *OffsetValue =
nullptr);
2916template <
typename FolderTy = ConstantFolder,
2917 typename InserterTy = IRBuilderDefaultInserter>
2921 InserterTy Inserter;
2926 static_cast<const IRBuilder *
>(&IRB)->Inserter.InsertHelper(
I, Name,
2933 :
IRBuilderBase(
C, this->Folder, CallInsertHelper), Folder(Folder),
2934 Inserter(Inserter) {}
2937 :
IRBuilderBase(
C, this->Folder, CallInsertHelper), Folder(Folder) {}
2944 Folder(Folder), Inserter(Inserter) {}
2969 [[deprecated(
"Use the overload without BasicBlock argument instead")]]
2976 [[deprecated(
"Use the overload without BasicBlock argument instead")]]
2985 Folder(Folder), Inserter(Inserter) {
3010template <
typename FolderTy,
typename InserterTy>
3014template <
typename FolderTy,
typename InserterTy>
3016template <
typename FolderTy>
3019template <
typename FolderTy>
3023template <
typename FolderTy>
3026template <
typename FolderTy,
typename InserterTy>
3029template <
typename FolderTy>
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Atomic ordering constants.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static bool isSigned(unsigned Opcode)
This file contains the declarations of entities that describe floating point environment and related ...
Module.h This file contains the declarations for the Module class.
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
uint64_t IntrinsicInst * II
const SmallVectorImpl< MachineOperand > & Cond
static unsigned getFastMathFlags(const MachineInstr &I, const SPIRVSubtarget &ST)
BaseType
A given derived pointer can have multiple base pointers through phi/selects.
static const char PassName[]
Class for arbitrary precision integers.
This class represents a conversion between pointers from one address space to another.
an instruction to allocate memory on the stack
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
An instruction that atomically checks whether a specified value is in a memory location,...
an instruction that atomically reads a memory location, combines it with another value,...
BinOp
This enumeration lists the possible modifications atomicrmw can make.
static LLVM_ABI Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
LLVM Basic Block Representation.
InstListType::iterator iterator
Instruction iterators...
static LLVM_ABI BinaryOperator * Create(BinaryOps Op, Value *S1, Value *S2, const Twine &Name=Twine(), InsertPosition InsertBefore=nullptr)
Construct a binary instruction, given the opcode and the two operands.
static BinaryOperator * CreateDisjoint(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name="")
static BitInsertInst * Create(Value *Base, Value *Val, Value *Offset, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
Class to represent byte types.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
void addRetAttr(Attribute::AttrKind Kind)
Adds the attribute to the return value.
CallBr instruction, tracking function calls that may not return control but instead transfer it to a ...
static CallBrInst * Create(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args, const Twine &NameStr, InsertPosition InsertBefore=nullptr)
This class represents a function call, abstracting a target machine's calling convention.
static CallInst * Create(FunctionType *Ty, Value *F, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
static LLVM_ABI CastInst * CreatePointerBitCastOrAddrSpaceCast(Value *S, Type *Ty, const Twine &Name="", InsertPosition InsertBefore=nullptr)
Create a BitCast or an AddrSpaceCast cast instruction.
static LLVM_ABI CastInst * CreatePointerCast(Value *S, Type *Ty, const Twine &Name="", InsertPosition InsertBefore=nullptr)
Create a BitCast, AddrSpaceCast or a PtrToInt cast instruction.
static LLVM_ABI CastInst * Create(Instruction::CastOps, Value *S, Type *Ty, const Twine &Name="", InsertPosition InsertBefore=nullptr)
Provides a way to construct any of the CastInst subclasses using an opcode instead of the subclass's ...
static CatchPadInst * Create(Value *CatchSwitch, ArrayRef< Value * > Args, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
static CatchReturnInst * Create(Value *CatchPad, BasicBlock *BB, InsertPosition InsertBefore=nullptr)
static CatchSwitchInst * Create(Value *ParentPad, BasicBlock *UnwindDest, unsigned NumHandlers, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
static CleanupPadInst * Create(Value *ParentPad, ArrayRef< Value * > Args={}, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
static CleanupReturnInst * Create(Value *CleanupPad, BasicBlock *UnwindBB=nullptr, InsertPosition InsertBefore=nullptr)
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
@ FCMP_OEQ
0 0 0 1 True if ordered and equal
@ FCMP_TRUE
1 1 1 1 Always true (always folded)
@ ICMP_SLT
signed less than
@ ICMP_SLE
signed less or equal
@ FCMP_OLT
0 1 0 0 True if ordered and less than
@ FCMP_ULE
1 1 0 1 True if unordered, less than, or equal
@ FCMP_OGT
0 0 1 0 True if ordered and greater than
@ FCMP_OGE
0 0 1 1 True if ordered and greater than or equal
@ ICMP_UGE
unsigned greater or equal
@ ICMP_UGT
unsigned greater than
@ ICMP_SGT
signed greater than
@ FCMP_ULT
1 1 0 0 True if unordered or less than
@ FCMP_ONE
0 1 1 0 True if ordered and operands are unequal
@ FCMP_UEQ
1 0 0 1 True if unordered or equal
@ ICMP_ULT
unsigned less than
@ FCMP_UGT
1 0 1 0 True if unordered or greater than
@ FCMP_OLE
0 1 0 1 True if ordered and less than or equal
@ FCMP_ORD
0 1 1 1 True if ordered (no nans)
@ ICMP_SGE
signed greater or equal
@ FCMP_UNE
1 1 1 0 True if unordered or not equal
@ ICMP_ULE
unsigned less or equal
@ FCMP_UGE
1 0 1 1 True if unordered, greater than, or equal
@ FCMP_FALSE
0 0 0 0 Always false (always folded)
@ FCMP_UNO
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
bool isFPPredicate() const
static LLVM_ABI StringRef getPredicateName(Predicate P)
Conditional Branch instruction.
static CondBrInst * Create(Value *Cond, BasicBlock *IfTrue, BasicBlock *IfFalse, InsertPosition InsertBefore=nullptr)
This is the shared class of boolean and integer constants.
static LLVM_ABI ConstantInt * getTrue(LLVMContext &Context)
static LLVM_ABI ConstantInt * getFalse(LLVMContext &Context)
This is an important base class in LLVM.
static LLVM_ABI Constant * getAllOnesValue(Type *Ty)
static LLVM_ABI Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
A parsed version of the target data layout string in and methods for querying it.
This provides a helper for copying FMF from an instruction or setting specified flags.
FMFSource(Instruction *Source)
FastMathFlags get(FastMathFlags Default) const
FMFSource(FastMathFlags FMF)
static FMFSource intersect(Value *A, Value *B)
Intersect the FMF from two instructions.
Convenience struct for specifying and reasoning about fast-math flags.
An instruction for ordering other memory operations.
This class represents a freeze function that returns random concrete value if an operand is either a ...
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
Class to represent function types.
Represents flags for the getelementptr instruction/expression.
static GEPNoWrapFlags inBounds()
static GEPNoWrapFlags noUnsignedWrap()
static GEPNoWrapFlags none()
static GetElementPtrInst * Create(Type *PointeeType, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
This instruction compares its operands according to the predicate given to the constructor.
FastMathFlagGuard(const FastMathFlagGuard &)=delete
FastMathFlagGuard(IRBuilderBase &B)
FastMathFlagGuard & operator=(const FastMathFlagGuard &)=delete
InsertPointGuard(IRBuilderBase &B)
InsertPointGuard & operator=(const InsertPointGuard &)=delete
InsertPointGuard(const InsertPointGuard &)=delete
OperandBundlesGuard(const OperandBundlesGuard &)=delete
OperandBundlesGuard(IRBuilderBase &B)
OperandBundlesGuard & operator=(const OperandBundlesGuard &)=delete
Value * CreateExactSDiv(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateZExtOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateFCmpONE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateLdexp(Value *Src, Value *Exp, FMFSource FMFSource={}, const Twine &Name="")
Create call to the ldexp intrinsic.
void SetCurrentDebugLocation(DebugLoc &&L)
Set location information used by debugging information.
ConstantInt * getInt1(bool V)
Get a constant value representing either true or false.
Value * CreateExtractVector(Type *DstType, Value *SrcVec, uint64_t Idx, const Twine &Name="")
Create a call to the vector.extract intrinsic.
Value * CreateFCmpS(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
LLVM_ABI CallInst * CreateIntrinsicWithoutFolding(Intrinsic::ID ID, ArrayRef< Type * > OverloadTypes, ArrayRef< Value * > Args, FMFSource FMFSource={}, const Twine &Name="", ArrayRef< OperandBundleDef > OpBundles={})
Create a call to intrinsic ID with Args, mangled using OverloadTypes.
Value * CreateNUWMul(Value *LHS, Value *RHS, const Twine &Name="")
CleanupPadInst * CreateCleanupPad(Value *ParentPad, ArrayRef< Value * > Args={}, const Twine &Name="")
LLVM_ABI Value * CreateAndReduce(Value *Src)
Create a vector int AND reduction intrinsic of the source vector.
Value * CreateFSubFMF(Value *L, Value *R, FMFSource FMFSource, const Twine &Name="", MDNode *FPMD=nullptr)
Value * CreateICmpULT(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateFPTruncFMF(Value *V, Type *DestTy, FMFSource FMFSource, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateConstGEP1_64(Type *Ty, Value *Ptr, uint64_t Idx0, const Twine &Name="")
IRBuilderBase(LLVMContext &context, const IRBuilderFolder &Folder, InsertFn InsertCB)
LLVM_ABI Value * CreateXorReduce(Value *Src)
Create a vector int XOR reduction intrinsic of the source vector.
Value * CreateAddrSpaceCast(Value *V, Type *DestTy, const Twine &Name="", bool IsNonNull=false)
RoundingMode DefaultConstrainedRounding
LLVM_ABI Value * CreateLaunderInvariantGroup(Value *Ptr)
Create a launder.invariant.group intrinsic call.
LLVM_ABI Value * CreateSelectFMFWithUnknownProfile(Value *C, Value *True, Value *False, FMFSource FMFSource, StringRef PassName, const Twine &Name="")
Value * CreateFCmpUGE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
CallInst * CreateStructuredAlloca(Type *BaseType, const Twine &Name="")
Value * CreateInsertElement(Type *VecTy, Value *NewElt, uint64_t Idx, const Twine &Name="")
Value * CreateSRem(Value *LHS, Value *RHS, const Twine &Name="")
LoadInst * CreateAlignedLoad(Type *Ty, Value *Ptr, MaybeAlign Align, const Twine &Name="")
const DataLayout & getDataLayout() const
Get data layout.
LoadInst * CreateLoad(Type *Ty, Value *Ptr, const LoadStoreInstProperties &Props, const Twine &Name="")
Value * CreateFSub(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
LLVM_ABI Value * CreateFPMinReduce(Value *Src)
Create a vector float min reduction intrinsic of the source vector.
Value * CreateFCmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
CatchPadInst * CreateCatchPad(Value *ParentPad, ArrayRef< Value * > Args, const Twine &Name="")
LLVM_ABI CallInst * CreateConstrainedFPUnroundedBinOp(Intrinsic::ID ID, Value *L, Value *R, FMFSource FMFSource={}, const Twine &Name="", MDNode *FPMathTag=nullptr, std::optional< fp::ExceptionBehavior > Except=std::nullopt)
Value * CreateInsertElement(Type *VecTy, Value *NewElt, Value *Idx, const Twine &Name="")
Value * CreateVectorSpliceLeft(Value *V1, Value *V2, uint32_t Offset, const Twine &Name="")
Value * CreateLShr(Value *LHS, uint64_t RHS, const Twine &Name="", bool isExact=false)
AtomicCmpXchgInst * CreateAtomicCmpXchg(Value *Ptr, Value *Cmp, Value *New, MaybeAlign Align, AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering, SyncScope::ID SSID=SyncScope::System)
LLVM_ABI CallInst * CreateThreadLocalAddress(Value *Ptr)
Create a call to llvm.threadlocal.address intrinsic.
Value * CreateConstGEP1_32(Type *Ty, Value *Ptr, unsigned Idx0, const Twine &Name="")
AllocaInst * CreateAlloca(Type *Ty, unsigned AddrSpace, Value *ArraySize=nullptr, const Twine &Name="")
void setDefaultOperandBundles(ArrayRef< OperandBundleDef > OpBundles)
Value * CreateBitExtract(Type *Ty, Value *Src, Value *Offset, const Twine &Name="")
CallInst * CreateStackSave(const Twine &Name="")
Create a call to llvm.stacksave.
InvokeInst * CreateInvoke(FunctionCallee Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="")
IntegerType * getInt1Ty()
Fetch the type representing a single bit.
LLVM_ABI CallInst * CreateMaskedCompressStore(Value *Val, Value *Ptr, MaybeAlign Align, Value *Mask=nullptr)
Create a call to Masked Compress Store intrinsic.
Value * CreateInsertValue(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &Name="")
Value * CreateAnd(ArrayRef< Value * > Ops)
IndirectBrInst * CreateIndirectBr(Value *Addr, unsigned NumDests=10)
Create an indirect branch instruction with the specified address operand, with an optional hint for t...
Value * CreateAnd(Value *LHS, const APInt &RHS, const Twine &Name="")
void setDefaultFPMathTag(MDNode *FPMathTag)
Set the floating point math metadata to be used.
LLVM_ABI Value * CreateAllocationSize(Type *DestTy, AllocaInst *AI)
Get allocation size of an alloca as a runtime Value* (handles both static and dynamic allocas and vsc...
LLVM_ABI Type * getCurrentFunctionReturnType() const
Get the return type of the current function that we're emitting into.
ByteType * getByteNTy(unsigned N)
Fetch the type representing an N-bit byte.
CallInst * CreateCall(FunctionCallee Callee, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="", MDNode *FPMathTag=nullptr)
LLVM_ABI CallInst * CreateGCGetPointerBase(Value *DerivedPtr, const Twine &Name="")
Create a call to the experimental.gc.pointer.base intrinsic to get the base pointer for the specified...
Value * CreateFDiv(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
LLVM_ABI CallInst * CreateLifetimeStart(Value *Ptr)
Create a lifetime.start intrinsic.
Value * CreateLShr(Value *LHS, const APInt &RHS, const Twine &Name="", bool isExact=false)
void clearFastMathFlags()
Clear the fast-math flags.
LLVM_ABI CallInst * CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes, FunctionCallee ActualCallee, ArrayRef< Value * > CallArgs, std::optional< ArrayRef< Value * > > DeoptArgs, ArrayRef< Value * > GCArgs, const Twine &Name="")
Create a call to the experimental.gc.statepoint intrinsic to start a new statepoint sequence.
LLVM_ABI CallInst * CreateNonnullAssumption(Value *PtrValue)
Create an assume intrinsic call that represents a nonnull assumption on the provided pointer.
LoadInst * CreateLoad(Type *Ty, Value *Ptr, bool isVolatile, const Twine &Name="")
Value * CreateLogicalOr(ArrayRef< Value * > Ops)
Value * CreateExtractElement(Value *Vec, Value *Idx, const Twine &Name="")
LLVM_ABI Value * CreateFPMaximumNumReduce(Value *Src)
Create a vector float maximum reduction intrinsic of the source vector.
IntegerType * getIntNTy(unsigned N)
Fetch the type representing an N-bit integer.
LLVM_ABI Value * CreateFPMaximumReduce(Value *Src)
Create a vector float maximum reduction intrinsic of the source vector.
void setDefaultConstrainedExcept(fp::ExceptionBehavior NewExcept)
Set the exception handling to be used with constrained floating point.
Value * CreateICmpSGT(Value *LHS, Value *RHS, const Twine &Name="")
LLVM_ABI Value * CreateVectorSpliceRight(Value *V1, Value *V2, Value *Offset, const Twine &Name="")
Create a vector.splice.right intrinsic call, or a shufflevector that produces the same result if the ...
LLVM_ABI CallInst * CreateLifetimeEnd(Value *Ptr)
Create a lifetime.end intrinsic.
LoadInst * CreateAlignedLoad(Type *Ty, Value *Ptr, MaybeAlign Align, const char *Name)
Value * CreateFCmpORD(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateStructuredGEP(Type *BaseType, Value *PtrBase, ArrayRef< Value * > Indices, const Twine &Name="")
Type * getDoubleTy()
Fetch the type representing a 64-bit floating point value.
Value * CreateNoWrapBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, bool IsNUW, bool IsNSW, const Twine &Name="")
Value * CreateZExtOrTrunc(Value *V, Type *DestTy, const Twine &Name="")
Create a ZExt or Trunc from the integer value V to DestTy.
CallInst * CreateMemCpy(Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, uint64_t Size, bool isVolatile=false, const AAMDNodes &AAInfo=AAMDNodes())
Create and insert a memcpy between the specified pointers.
CondBrInst * CreateCondBr(Value *Cond, BasicBlock *True, BasicBlock *False, MDNode *BranchWeights=nullptr, MDNode *Unpredictable=nullptr)
Create a conditional 'br Cond, TrueDest, FalseDest' instruction.
Value * CreateFAdd(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
UnreachableInst * CreateUnreachable()
Value * CreateBitInsert(Value *Base, Value *Val, Value *Offset, const Twine &Name="")
LLVM_ABI CallInst * CreateConstrainedFPCmp(Intrinsic::ID ID, CmpInst::Predicate P, Value *L, Value *R, const Twine &Name="", std::optional< fp::ExceptionBehavior > Except=std::nullopt)
LLVM_ABI Value * CreateSelectFMF(Value *C, Value *True, Value *False, FMFSource FMFSource, const Twine &Name="", Instruction *MDFrom=nullptr)
Value * CreateFPTrunc(Value *V, Type *DestTy, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreatePointerCast(Value *V, Type *DestTy, const Twine &Name="")
LLVM_ABI Value * CreateIntMaxReduce(Value *Src, bool IsSigned=false)
Create a vector integer max reduction intrinsic of the source vector.
void setDefaultConstrainedRounding(RoundingMode NewRounding)
Set the rounding mode handling to be used with constrained floating point.
Value * CreatePtrToAddr(Value *V, const Twine &Name="")
LLVM_ABI Value * CreateVectorSplat(unsigned NumElts, Value *V, const Twine &Name="")
Return a vector value that contains.
Value * CreateFRem(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
Value * CreateExtractValue(Value *Agg, ArrayRef< unsigned > Idxs, const Twine &Name="")
Value * CreateAnd(Value *LHS, uint64_t RHS, const Twine &Name="")
ConstantInt * getTrue()
Get the constant value for i1 true.
StoreInst * CreateStore(Value *Val, Value *Ptr, const LoadStoreInstProperties &Props)
Value * Insert(Value *V, const Twine &Name="") const
LandingPadInst * CreateLandingPad(Type *Ty, unsigned NumClauses, const Twine &Name="")
Value * CreateFPExtFMF(Value *V, Type *DestTy, FMFSource FMFSource, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateMaximum(Value *LHS, Value *RHS, const Twine &Name="")
Create call to the maximum intrinsic.
LLVM_ABI Value * CreatePreserveStructAccessIndex(Type *ElTy, Value *Base, unsigned Index, unsigned FieldIndex, MDNode *DbgInfo)
LLVM_ABI CallInst * CreateMaskedLoad(Type *Ty, Value *Ptr, Align Alignment, Value *Mask, Value *PassThru=nullptr, const Twine &Name="")
Create a call to Masked Load intrinsic.
Value * CreateICmpSGE(Value *LHS, Value *RHS, const Twine &Name="")
LLVM_ABI CallInst * CreateConstrainedFPCall(Function *Callee, ArrayRef< Value * > Args, const Twine &Name="", std::optional< RoundingMode > Rounding=std::nullopt, std::optional< fp::ExceptionBehavior > Except=std::nullopt)
LLVM_ABI Value * CreateFPMinimumNumReduce(Value *Src)
Create a vector float minimum reduction intrinsic of the source vector.
LLVM_ABI Value * CreateSelect(Value *C, Value *True, Value *False, const Twine &Name="", Instruction *MDFrom=nullptr)
InvokeInst * CreateInvoke(FunctionType *Ty, Value *Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="")
Create an invoke instruction.
LLVM_ABI CallInst * CreateMalloc(Type *IntPtrTy, Value *AllocSize, Value *ArraySize, ArrayRef< OperandBundleDef > OpB, Function *MallocF=nullptr, const Twine &Name="")
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, FMFSource FMFSource, const Twine &Name="", MDNode *FPMathTag=nullptr)
RoundingMode getDefaultConstrainedRounding()
Get the rounding mode handling used with constrained floating point.
LLVM_ABI Value * CreateIntMinReduce(Value *Src, bool IsSigned=false)
Create a vector integer min reduction intrinsic of the source vector.
Value * CreateFPToUI(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateVectorSpliceRight(Value *V1, Value *V2, uint32_t Offset, const Twine &Name="")
Value * CreateConstGEP2_64(Type *Ty, Value *Ptr, uint64_t Idx0, uint64_t Idx1, const Twine &Name="")
Value * CreateFCmpUNE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
BasicBlock::iterator GetInsertPoint() const
Value * CreateStructGEP(Type *Ty, Value *Ptr, unsigned Idx, const Twine &Name="")
FenceInst * CreateFence(AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System, const Twine &Name="")
IntegerType * getIndexTy(const DataLayout &DL, unsigned AddrSpace)
Fetch the type of an integer that should be used to index GEP operations within AddressSpace.
CallBrInst * CreateCallBr(FunctionCallee Callee, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="")
LLVM_ABI CallInst * CreateGCGetPointerOffset(Value *DerivedPtr, const Twine &Name="")
Create a call to the experimental.gc.get.pointer.offset intrinsic to get the offset of the specified ...
fp::ExceptionBehavior getDefaultConstrainedExcept()
Get the exception handling used with constrained floating point.
Value * CreateSExt(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateSExtOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateFCmpUGT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateIntToPtr(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateFreeze(Value *V, const Twine &Name="")
CallInst * CreateCall(FunctionCallee Callee, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, FMFSource FMFSource, const Twine &Name="", MDNode *FPMathTag=nullptr)
void SetCurrentDebugLocation(const DebugLoc &L)
Set location information used by debugging information.
BasicBlock::iterator InsertPt
ReturnInst * CreateAggregateRet(ArrayRef< Value * > RetVals)
Create a sequence of N insertvalue instructions, with one Value from the RetVals array each,...
CallBrInst * CreateCallBr(FunctionType *Ty, Value *Callee, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args={}, const Twine &Name="")
Create a callbr instruction.
LLVM_ABI CallInst * CreateConstrainedFPBinOp(Intrinsic::ID ID, Value *L, Value *R, FMFSource FMFSource={}, const Twine &Name="", MDNode *FPMathTag=nullptr, std::optional< RoundingMode > Rounding=std::nullopt, std::optional< fp::ExceptionBehavior > Except=std::nullopt)
Value * CreateLShr(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
IntegerType * getIntPtrTy(const DataLayout &DL, unsigned AddrSpace=0)
Fetch the type of an integer with size at least as big as that of a pointer in the given address spac...
IntegerType * getInt32Ty()
Fetch the type representing a 32-bit integer.
Value * CreateExtractVector(Type *DstType, Value *SrcVec, Value *Idx, const Twine &Name="")
Create a call to the vector.extract intrinsic.
Value * CreateConstInBoundsGEP1_32(Type *Ty, Value *Ptr, unsigned Idx0, const Twine &Name="")
LLVM_ABI Value * CreateAggregateCast(Value *V, Type *DestTy)
Cast between aggregate types that must have identical structure but may differ in their leaf types.
ConstantInt * getInt8(uint8_t C)
Get a constant 8-bit value.
Value * CreatePtrAdd(Value *Ptr, Value *Offset, const Twine &Name="", GEPNoWrapFlags NW=GEPNoWrapFlags::none())
Value * CreateCast(Instruction::CastOps Op, Value *V, Type *DestTy, const Twine &Name="", MDNode *FPMathTag=nullptr, FMFSource FMFSource={})
Value * CreateIsNotNeg(Value *Arg, const Twine &Name="")
Return a boolean value testing if Arg > -1.
CatchReturnInst * CreateCatchRet(CatchPadInst *CatchPad, BasicBlock *BB)
CleanupReturnInst * CreateCleanupRet(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB=nullptr)
ReturnInst * CreateRet(Value *V)
Create a 'ret <val>' instruction.
LLVM_ABI CallInst * CreateAssumption(Value *Cond)
Create an assume intrinsic call that allows the optimizer to assume that the provided condition will ...
Value * CreateNSWAdd(Value *LHS, Value *RHS, const Twine &Name="")
bool getIsFPConstrained()
Query for the use of constrained floating point math.
Value * CreateUIToFP(Value *V, Type *DestTy, const Twine &Name="", bool IsNonNeg=false, MDNode *FPMathTag=nullptr)
Value * CreateVScale(Type *Ty, const Twine &Name="")
Create a call to llvm.vscale.<Ty>().
Value * CreateAShr(Value *LHS, uint64_t RHS, const Twine &Name="", bool isExact=false)
BasicBlock * GetInsertBlock() const
Type * getHalfTy()
Fetch the type representing a 16-bit floating point value.
void setFastMathFlags(FastMathFlags NewFMF)
Set the fast-math flags to be used with generated fp-math operators.
Value * CreateFCmpOLT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
void SetInsertPointPastAllocas(Function *F)
This specifies that created instructions should inserted at the beginning end of the specified functi...
IntegerType * getInt64Ty()
Fetch the type representing a 64-bit integer.
Value * CreateInBoundsGEP(Type *Ty, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name="")
Value * CreateNSWMul(Value *LHS, Value *RHS, const Twine &Name="")
InsertPoint saveAndClearIP()
Returns the current insert point, clearing it in the process.
Value * CreateOr(Value *LHS, const APInt &RHS, const Twine &Name="")
LLVM_ABI CallInst * CreateElementUnorderedAtomicMemMove(Value *Dst, Align DstAlign, Value *Src, Align SrcAlign, Value *Size, uint32_t ElementSize, const AAMDNodes &AAInfo=AAMDNodes())
Create and insert an element unordered-atomic memmove between the specified pointers.
Value * CreatePointerBitCastOrAddrSpaceCast(Value *V, Type *DestTy, const Twine &Name="")
Module * getModule() const
Get the module.
LLVM_ABI Value * CreateVectorReverse(Value *V, const Twine &Name="")
Return a vector value that contains the vector V reversed.
Value * CreateShuffleVector(Value *V, ArrayRef< int > Mask, const Twine &Name="")
Create a unary shuffle.
Value * CreateAShr(Value *LHS, const APInt &RHS, const Twine &Name="", bool isExact=false)
Value * CreateUDiv(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
Value * CreateFAbs(Value *V, FMFSource FMFSource={}, const Twine &Name="")
Create call to the fabs intrinsic.
Value * CreateFCmpULE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
LLVM_ABI Value * CreateMulReduce(Value *Src)
Create a vector int mul reduction intrinsic of the source vector.
LLVM_ABI Value * CreateBitPreservingCastChain(const DataLayout &DL, Value *V, Type *NewTy)
Create a chain of casts to convert V to NewTy, preserving the bit pattern of V.
Value * CreateICmpNE(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateNUWAdd(Value *LHS, Value *RHS, const Twine &Name="")
IntegerType * getInt16Ty()
Fetch the type representing a 16-bit integer.
Value * CreateFCmpFMF(CmpInst::Predicate P, Value *LHS, Value *RHS, FMFSource FMFSource, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateGEP(Type *Ty, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name="", GEPNoWrapFlags NW=GEPNoWrapFlags::none())
ConstantInt * getInt64(uint64_t C)
Get a constant 64-bit value.
CallInst * CreateMemMove(Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, uint64_t Size, bool isVolatile=false, const AAMDNodes &AAInfo=AAMDNodes())
CatchSwitchInst * CreateCatchSwitch(Value *ParentPad, BasicBlock *UnwindBB, unsigned NumHandlers, const Twine &Name="")
LLVM_ABI Value * CreateVectorSpliceLeft(Value *V1, Value *V2, Value *Offset, const Twine &Name="")
Create a vector.splice.left intrinsic call, or a shufflevector that produces the same result if the r...
Value * getAllOnesMask(ElementCount NumElts)
Return an all true boolean vector (mask) with NumElts lanes.
LLVM_ABI Value * CreateFPMaxReduce(Value *Src)
Create a vector float max reduction intrinsic of the source vector.
Value * CreateUnOp(Instruction::UnaryOps Opc, Value *V, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateNeg(Value *V, const Twine &Name="", bool HasNSW=false)
LoadInst * CreateLoad(Type *Ty, Value *Ptr, const Twine &Name="")
UncondBrInst * CreateBr(BasicBlock *Dest)
Create an unconditional 'br label X' instruction.
InsertPoint saveIP() const
Returns the current insert point.
Value * CreateArithmeticFence(Value *Val, Type *DstType, const Twine &Name="")
Create a call to the arithmetic_fence intrinsic.
Value * CreateLogicalAnd(Value *Cond1, Value *Cond2, const Twine &Name="", Instruction *MDFrom=nullptr)
void SetInsertPoint(BasicBlock::iterator IP)
This specifies that created instructions should be inserted at the specified point.
Value * CreateInsertElement(Value *Vec, Value *NewElt, uint64_t Idx, const Twine &Name="")
Value * CreateShl(Value *LHS, uint64_t RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
LLVM_ABI Value * CreateBinaryIntrinsic(Intrinsic::ID ID, Value *LHS, Value *RHS, FMFSource FMFSource={}, const Twine &Name="")
Create a call to intrinsic ID with 2 operands which is mangled on the first type.
Value * CreateShuffleVector(Value *V1, Value *V2, ArrayRef< int > Mask, const Twine &Name="")
See class ShuffleVectorInst for a description of the mask representation.
LLVM_ABI Value * createIsFPClass(Value *FPNum, unsigned Test)
LLVM_ABI Value * CreateOrReduce(Value *Src)
Create a vector int OR reduction intrinsic of the source vector.
Value * CreateFCmpOLE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
ConstantInt * getInt32(uint32_t C)
Get a constant 32-bit value.
LLVM_ABI CallInst * CreateFree(Value *Source, ArrayRef< OperandBundleDef > Bundles={})
Generate the IR for a call to the builtin free function.
Value * CreateMaxNum(Value *LHS, Value *RHS, FMFSource FMFSource={}, const Twine &Name="")
Create call to the maxnum intrinsic.
Value * CreateBitOrPointerCast(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateCmp(CmpInst::Predicate Pred, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateLogicalOp(Instruction::BinaryOps Opc, Value *Cond1, Value *Cond2, const Twine &Name="", Instruction *MDFrom=nullptr)
Value * CreateFPCast(Value *V, Type *DestTy, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateICmpSLE(Value *LHS, Value *RHS, const Twine &Name="")
PHINode * CreatePHI(Type *Ty, unsigned NumReservedValues, const Twine &Name="")
LLVM_ABI Value * CreateAddReduce(Value *Src)
Create a vector int add reduction intrinsic of the source vector.
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="", MDNode *FPMathTag=nullptr)
CondBrInst * CreateCondBr(Value *Cond, BasicBlock *True, BasicBlock *False, Instruction *MDSrc)
Create a conditional 'br Cond, TrueDest, FalseDest' instruction.
Value * CreateNot(Value *V, 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 * CreateICmpEQ(Value *LHS, Value *RHS, const Twine &Name="")
BasicBlock::iterator InsertPoint
InsertPoint - A saved insertion point.
InstTy * Insert(InstTy *I, const Twine &Name="") const
Insert and return the specified instruction.
Value * CreateBinOpFMF(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, FMFSource FMFSource, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateFCmpUEQ(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
LLVM_ABI Value * CreateFPMinimumReduce(Value *Src)
Create a vector float minimum reduction intrinsic of the source vector.
void setIsFPConstrained(bool IsCon)
Enable/Disable use of constrained floating point math.
LLVM_ABI DebugLoc getCurrentDebugLocation() const
Get location information used by debugging information.
Value * CreateMinimum(Value *LHS, Value *RHS, const Twine &Name="")
Create call to the minimum intrinsic.
IntegerType * getInt128Ty()
Fetch the type representing a 128-bit integer.
Value * CreateCountTrailingZeroElems(Type *ResTy, Value *Mask, bool ZeroIsPoison=true, const Twine &Name="")
Create a call to llvm.experimental_cttz_elts.
Value * CreateIsNeg(Value *Arg, const Twine &Name="")
Return a boolean value testing if Arg < 0.
Constant * Insert(Constant *C, const Twine &="") const
No-op overload to handle constants.
Value * CreateSub(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Value * CreateFMA(Value *Factor1, Value *Factor2, Value *Summand, FMFSource FMFSource={}, const Twine &Name="")
Create call to the fma intrinsic.
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
ByteType * getByte128Ty()
Fetch the type representing a 128-bit byte.
ConstantInt * getIntN(unsigned N, uint64_t C)
Get a constant N-bit value, zero extended from a 64-bit value.
Value * CreateDisjointOr(Value *LHS, Value *RHS, const Twine &Name="")
ByteType * getByte16Ty()
Fetch the type representing a 16-bit byte.
Value * CreateCopySign(Value *LHS, Value *RHS, FMFSource FMFSource={}, const Twine &Name="")
Create call to the copysign intrinsic.
LLVM_ABI Value * CreatePtrDiff(Value *LHS, Value *RHS, const Twine &Name="", bool IsNUW=false)
Return the difference between two pointer values.
Value * CreateICmpUGT(Value *LHS, Value *RHS, const Twine &Name="")
LoadInst * CreateLoad(Type *Ty, Value *Ptr, const char *Name)
Provided to resolve 'CreateLoad(Ty, Ptr, "...")' correctly, instead of converting the string to 'bool...
Value * CreateUnOpFMF(Instruction::UnaryOps Opc, Value *V, FMFSource FMFSource, const Twine &Name="", MDNode *FPMathTag=nullptr)
CallInst * CreateElementUnorderedAtomicMemSet(Value *Ptr, Value *Val, uint64_t Size, Align Alignment, uint32_t ElementSize, const AAMDNodes &AAInfo=AAMDNodes())
Create and insert an element unordered-atomic memset of the region of memory starting at the given po...
Value * CreateShl(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
FastMathFlags getFastMathFlags() const
Get the flags to be applied to created floating point ops.
CallInst * CreateMemSet(Value *Ptr, Value *Val, uint64_t Size, MaybeAlign Align, bool isVolatile=false, const AAMDNodes &AAInfo=AAMDNodes())
Create and insert a memset to the specified pointer and the specified value.
LLVM_ABI Value * CreateNAryOp(unsigned Opc, ArrayRef< Value * > Ops, const Twine &Name="", MDNode *FPMathTag=nullptr)
Create either a UnaryOperator or BinaryOperator depending on Opc.
Value * CreateIntrinsic(Intrinsic::ID ID, ArrayRef< Value * > Args, FMFSource FMFSource={}, const Twine &Name="", function_ref< void(CallInst *)> SetFn=[](CallInst *) {})
Variant to create a possibly constant-folded intrinsic.
Value * CreateZExt(Value *V, Type *DestTy, const Twine &Name="", bool IsNonNeg=false)
LLVM_ABI CallInst * CreateConstrainedFPIntrinsic(Intrinsic::ID ID, ArrayRef< Type * > Types, ArrayRef< Value * > Args, FMFSource FMFSource, const Twine &Name, MDNode *FPMathTag=nullptr, std::optional< RoundingMode > Rounding=std::nullopt, std::optional< fp::ExceptionBehavior > Except=std::nullopt)
This function is like CreateIntrinsic for constrained fp intrinsics.
Value * CreateShuffleVector(Value *V1, Value *V2, Value *Mask, const Twine &Name="")
LLVMContext & getContext() const
Value * CreateFCmpOEQ(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateAnd(Value *LHS, Value *RHS, const Twine &Name="")
FastMathFlags & getFastMathFlags()
ReturnInst * CreateRetVoid()
Create a 'ret void' instruction.
ByteType * getByte32Ty()
Fetch the type representing a 32-bit byte.
LLVM_ABI Value * CreateIntrinsic(Intrinsic::ID ID, ArrayRef< Type * > OverloadTypes, ArrayRef< Value * > Args, FMFSource FMFSource={}, const Twine &Name="", ArrayRef< OperandBundleDef > OpBundles={}, function_ref< void(CallInst *)> SetFn=[](CallInst *) {})
Variant to create a possibly constant-folded intrinsic.
Value * CreateMaximumNum(Value *LHS, Value *RHS, const Twine &Name="")
Create call to the maximum intrinsic.
Value * CreateNSWSub(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateConstInBoundsGEP2_32(Type *Ty, Value *Ptr, unsigned Idx0, unsigned Idx1, const Twine &Name="")
Value * CreateConstInBoundsGEP2_64(Type *Ty, Value *Ptr, uint64_t Idx0, uint64_t Idx1, const Twine &Name="")
Value * CreateMinNum(Value *LHS, Value *RHS, FMFSource FMFSource={}, const Twine &Name="")
Create call to the minnum intrinsic.
InvokeInst * CreateInvoke(FunctionCallee Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > Args={}, const Twine &Name="")
LLVM_ABI Value * CreatePreserveUnionAccessIndex(Value *Base, unsigned FieldIndex, MDNode *DbgInfo)
StoreInst * CreateStore(Value *Val, Value *Ptr, bool isVolatile=false)
LLVM_ABI Value * CreateSelectWithUnknownProfile(Value *C, Value *True, Value *False, StringRef PassName, const Twine &Name="")
LLVM_ABI CallInst * CreateMaskedStore(Value *Val, Value *Ptr, Align Alignment, Value *Mask)
Create a call to Masked Store intrinsic.
Value * CreateAdd(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Value * CreateExactBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, bool IsExact, const Twine &Name="")
Value * CreatePtrToInt(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateSDiv(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
ConstantInt * getFalse()
Get the constant value for i1 false.
VAArgInst * CreateVAArg(Value *List, Type *Ty, const Twine &Name="")
Value * CreateExactUDiv(Value *LHS, Value *RHS, const Twine &Name="")
Type * getFloatTy()
Fetch the type representing a 32-bit floating point value.
Value * CreateIsNotNull(Value *Arg, const Twine &Name="")
Return a boolean value testing if Arg != 0.
void SetInsertPoint(BasicBlock *TheBB, BasicBlock::iterator IP)
This specifies that created instructions should be inserted at the specified point.
Instruction * CreateNoAliasScopeDeclaration(MDNode *ScopeTag)
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value * > Args={}, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateShl(Value *LHS, const APInt &RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
ByteType * getBytePtrTy(const DataLayout &DL, unsigned AddrSpace=0)
Fetch the type of a byte with size at least as big as that of a pointer in the given address space.
LLVM_ABI 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 ...
Value * CreateTrunc(Value *V, Type *DestTy, const Twine &Name="", bool IsNUW=false, bool IsNSW=false)
PointerType * getPtrTy(unsigned AddrSpace=0)
Fetch the type representing a pointer.
LLVM_ABI CallInst * CreateAlignmentAssumption(const DataLayout &DL, Value *PtrValue, uint64_t Alignment, Value *OffsetValue=nullptr)
Create an assume intrinsic call that represents an alignment assumption on the provided pointer.
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="")
Value * CreateConstInBoundsGEP1_64(Type *Ty, Value *Ptr, uint64_t Idx0, const Twine &Name="")
fp::ExceptionBehavior DefaultConstrainedExcept
void ClearInsertionPoint()
Clear the insertion point: created instructions will not be inserted into a block.
CallBrInst * CreateCallBr(FunctionCallee Callee, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args={}, const Twine &Name="")
ByteType * getByte8Ty()
Fetch the type representing an 8-bit byte.
Value * CreateICmpSLT(Value *LHS, Value *RHS, const Twine &Name="")
ConstantInt * getInt16(uint16_t C)
Get a constant 16-bit value.
MDNode * DefaultFPMathTag
LLVM_ABI Value * CreateTypeSize(Type *Ty, TypeSize Size)
Create an expression which evaluates to the number of units in Size at runtime.
ArrayRef< OperandBundleDef > DefaultOperandBundles
CallBrInst * CreateCallBr(FunctionType *Ty, Value *Callee, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="")
LLVM_ABI CallInst * CreateDereferenceableAssumption(Value *PtrValue, Value *SizeValue)
Create an assume intrinsic call that represents a dereferencable assumption on the provided pointer.
CallInst * CreateIntrinsicWithoutFolding(Intrinsic::ID ID, ArrayRef< Value * > Args, FMFSource FMFSource={}, const Twine &Name="")
Create a call to non-overloaded intrinsic ID with Args.
Value * CreateICmpUGE(Value *LHS, Value *RHS, const Twine &Name="")
MDNode * getDefaultFPMathTag() const
Get the floating point math metadata being used.
Value * CreateIntCast(Value *V, Type *DestTy, bool isSigned, const Twine &Name="")
Value * CreateFCmpUNO(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
void restoreIP(InsertPoint IP)
Sets the current insert point to a previously-saved location.
Value * CreateIsNull(Value *Arg, const Twine &Name="")
Return a boolean value testing if Arg == 0.
CallInst * CreateMemCpy(Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, Value *Size, bool isVolatile=false, const AAMDNodes &AAInfo=AAMDNodes())
Value * CreateFCmpOGT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
CallInst * CreateMemCpyInline(Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, Value *Size, bool isVolatile=false, const AAMDNodes &AAInfo=AAMDNodes())
CallInst * CreateStackRestore(Value *Ptr, const Twine &Name="")
Create a call to llvm.stackrestore.
void SetInsertPoint(BasicBlock *TheBB)
This specifies that created instructions should be appended to the end of the specified block.
Type * getVoidTy()
Fetch the type representing void.
InvokeInst * CreateInvoke(FunctionType *Ty, Value *Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > Args={}, const Twine &Name="")
LLVM_ABI CallInst * CreateElementUnorderedAtomicMemCpy(Value *Dst, Align DstAlign, Value *Src, Align SrcAlign, Value *Size, uint32_t ElementSize, const AAMDNodes &AAInfo=AAMDNodes())
Create and insert an element unordered-atomic memcpy between the specified pointers.
Value * CreateOr(ArrayRef< Value * > Ops)
Value * CreateFAddFMF(Value *L, Value *R, FMFSource FMFSource, const Twine &Name="", MDNode *FPMD=nullptr)
Value * CreateLogicalOr(Value *Cond1, Value *Cond2, const Twine &Name="", Instruction *MDFrom=nullptr)
AllocaInst * CreateAlloca(Type *Ty, Value *ArraySize=nullptr, const Twine &Name="")
Value * CreateConstGEP2_32(Type *Ty, Value *Ptr, unsigned Idx0, unsigned Idx1, const Twine &Name="", GEPNoWrapFlags NWFlags=GEPNoWrapFlags::none())
Value * CreateExtractElement(Value *Vec, uint64_t Idx, const Twine &Name="")
StoreInst * CreateAlignedStore(Value *Val, Value *Ptr, MaybeAlign Align, bool isVolatile=false)
Value * CreateOr(Value *LHS, uint64_t RHS, const Twine &Name="")
void setConstrainedFPCallAttr(CallBase *I)
Value * CreateMinimumNum(Value *LHS, Value *RHS, const Twine &Name="")
Create call to the minimumnum intrinsic.
LLVM_ABI Value * CreateFAddReduce(Value *Acc, Value *Src)
Create a sequential vector fadd reduction intrinsic of the source vector.
LLVM_ABI InvokeInst * CreateGCStatepointInvoke(uint64_t ID, uint32_t NumPatchBytes, FunctionCallee ActualInvokee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > InvokeArgs, std::optional< ArrayRef< Value * > > DeoptArgs, ArrayRef< Value * > GCArgs, const Twine &Name="")
Create an invoke to the experimental.gc.statepoint intrinsic to start a new statepoint sequence.
ByteType * getByte64Ty()
Fetch the type representing a 64-bit byte.
LLVM_ABI CallInst * CreateMaskedExpandLoad(Type *Ty, Value *Ptr, MaybeAlign Align, Value *Mask=nullptr, Value *PassThru=nullptr, const Twine &Name="")
Create a call to Masked Expand Load intrinsic.
const IRBuilderFolder & Folder
Value * CreateInBoundsPtrAdd(Value *Ptr, Value *Offset, const Twine &Name="")
Value * CreateIntCast(Value *, Type *, const char *)=delete
Value * CreateFPExt(Value *V, Type *DestTy, const Twine &Name="", MDNode *FPMathTag=nullptr)
LLVM_ABI CallInst * CreateMemTransferInst(Intrinsic::ID IntrID, Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, Value *Size, bool isVolatile=false, const AAMDNodes &AAInfo=AAMDNodes())
LLVM_ABI Value * CreateVectorInterleave(ArrayRef< Value * > Ops, const Twine &Name="")
Value * CreateAShr(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
CallInst * CreateCall(FunctionCallee Callee, ArrayRef< Value * > Args={}, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateFNegFMF(Value *V, FMFSource FMFSource, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateXor(Value *LHS, Value *RHS, const Twine &Name="")
CallInst * CreateCall(FunctionCallee Callee, ArrayRef< Value * > Args, FMFSource FMFSource, const Twine &Name="", MDNode *FPMathTag=nullptr)
IRBuilderBase(const IRBuilderBase &)=delete
Value * CreateTruncOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateICmpULE(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateSIToFP(Value *V, Type *DestTy, const Twine &Name="", MDNode *FPMathTag=nullptr)
LLVM_ABI Value * CreateFMulReduce(Value *Acc, Value *Src)
Create a sequential vector fmul reduction intrinsic of the source vector.
Value * CreateICmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="")
LLVM_ABI CallInst * CreateMemSetInline(Value *Dst, MaybeAlign DstAlign, Value *Val, Value *Size, bool IsVolatile=false, const AAMDNodes &AAInfo=AAMDNodes())
Value * CreateFMul(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
LoadInst * CreateAlignedLoad(Type *Ty, Value *Ptr, MaybeAlign Align, bool isVolatile, const Twine &Name="")
Value * CreateFNeg(Value *V, const Twine &Name="", MDNode *FPMathTag=nullptr)
void setConstrainedFPFunctionAttr()
LLVM_ABI void SetInstDebugLocation(Instruction *I) const
If this builder has a current debug location, set it on the specified instruction.
Value * CreateOr(Value *LHS, Value *RHS, const Twine &Name="", bool IsDisjoint=false)
void SetInsertPoint(Instruction *I)
This specifies that created instructions should be inserted before the specified instruction.
IntegerType * getInt8Ty()
Fetch the type representing an 8-bit integer.
ConstantInt * getInt(const APInt &AI)
Get a constant integer value.
LLVM_ABI 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...
Value * CreateFDivFMF(Value *L, Value *R, FMFSource FMFSource, const Twine &Name="", MDNode *FPMD=nullptr)
Value * CreateURem(Value *LHS, Value *RHS, const Twine &Name="")
LLVM_ABI Value * CreateStepVector(Type *DstType, const Twine &Name="")
Creates a vector of type DstType with the linear sequence <0, 1, ...>
LLVM_ABI Value * CreatePreserveArrayAccessIndex(Type *ElTy, Value *Base, unsigned Dimension, unsigned LastIndex, MDNode *DbgInfo)
Value * CreateSExtOrTrunc(Value *V, Type *DestTy, const Twine &Name="")
Create a SExt or Trunc from the integer value V to DestTy.
ResumeInst * CreateResume(Value *Exn)
Value * CreateInsertVector(Type *DstType, Value *SrcVec, Value *SubVec, Value *Idx, const Twine &Name="")
Create a call to the vector.insert intrinsic.
Type * getBFloatTy()
Fetch the type representing a 16-bit brain floating point value.
Value * CreateFMulFMF(Value *L, Value *R, FMFSource FMFSource, const Twine &Name="", MDNode *FPMD=nullptr)
Value * CreateXor(Value *LHS, const APInt &RHS, const Twine &Name="")
LLVM_ABI CallInst * CreateInvariantStart(Value *Ptr, ConstantInt *Size=nullptr)
Create a call to invariant.start intrinsic.
void(*)(const IRBuilderBase &, Instruction *, const Twine &, BasicBlock::iterator) InsertFn
Value * CreateMul(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Value * CreateInsertVector(Type *DstType, Value *SrcVec, Value *SubVec, uint64_t Idx, const Twine &Name="")
Create a call to the vector.extract intrinsic.
LLVM_ABI Instruction * CreateNoAliasScopeDeclaration(Value *Scope)
Create a llvm.experimental.noalias.scope.decl intrinsic call.
LLVM_ABI CallInst * CreateMaskedScatter(Value *Val, Value *Ptrs, Align Alignment, Value *Mask=nullptr)
Create a call to Masked Scatter intrinsic.
Value * CreateFRemFMF(Value *L, Value *R, FMFSource FMFSource, const Twine &Name="", MDNode *FPMD=nullptr)
Value * CreateXor(Value *LHS, uint64_t RHS, const Twine &Name="")
LLVM_ABI Value * CreateUnaryIntrinsic(Intrinsic::ID ID, Value *Op, FMFSource FMFSource={}, const Twine &Name="")
Create a call to intrinsic ID with 1 operand which is mangled on its type.
AtomicRMWInst * CreateAtomicRMW(AtomicRMWInst::BinOp Op, Value *Ptr, Value *Val, MaybeAlign Align, AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System, bool Elementwise=false)
LLVM_ABI GlobalVariable * CreateGlobalString(StringRef Str, const Twine &Name="", unsigned AddressSpace=0, Module *M=nullptr, bool AddNull=true)
Make a new global variable with initializer type i8*.
Value * CreateNSWNeg(Value *V, const Twine &Name="")
LLVM_ABI Value * CreateElementCount(Type *Ty, ElementCount EC)
Create an expression which evaluates to the number of elements in EC at runtime.
Value * CreateFCmpOGE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
CallInst * CreateMemMove(Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, Value *Size, bool isVolatile=false, const AAMDNodes &AAInfo=AAMDNodes())
LLVM_ABI CallInst * CreateConstrainedFPCast(Intrinsic::ID ID, Value *V, Type *DestTy, FMFSource FMFSource={}, const Twine &Name="", MDNode *FPMathTag=nullptr, std::optional< RoundingMode > Rounding=std::nullopt, std::optional< fp::ExceptionBehavior > Except=std::nullopt)
LLVM_ABI CallInst * CreateMaskedGather(Type *Ty, Value *Ptrs, Align Alignment, Value *Mask=nullptr, Value *PassThru=nullptr, const Twine &Name="")
Create a call to Masked Gather intrinsic.
Value * CreateNUWSub(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateFCmpULT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateFPToSI(Value *V, Type *DestTy, const Twine &Name="")
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value * > Args, FMFSource FMFSource, const Twine &Name="", MDNode *FPMathTag=nullptr)
void InsertHelper(Instruction *I, const Twine &Name, BasicBlock::iterator InsertPt) const
IRBuilderCallbackInserter(std::function< void(Instruction *)> Callback)
This provides the default implementation of the IRBuilder 'InsertHelper' method that is called whenev...
void InsertHelper(Instruction *I, const Twine &Name, BasicBlock::iterator InsertPt) const
IRBuilderFolder - Interface for constant folding in IRBuilder.
virtual Value * FoldCast(Instruction::CastOps Op, Value *V, Type *DestTy) const =0
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
IRBuilder(const IRBuilder &)=delete
Avoid copying the full IRBuilder.
IRBuilder(BasicBlock *TheBB)
IRBuilder(Instruction *IP)
IRBuilder(BasicBlock *TheBB, FolderTy Folder)
IRBuilder(LLVMContext &C, FolderTy Folder)
InserterTy & getInserter()
IRBuilder(LLVMContext &C, FolderTy Folder, InserterTy Inserter)
IRBuilder(Module &M, FolderTy Folder)
IRBuilder(LLVMContext &C)
IRBuilder(BasicBlock::iterator IP, FolderTy Folder, InserterTy Inserter)
IRBuilder(Module &M, FolderTy Folder, InserterTy Inserter)
IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, FolderTy Folder)
IRBuilder(BasicBlock::iterator IP, FolderTy Folder)
IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP)
IRBuilder(BasicBlock::iterator IP)
const InserterTy & getInserter() const
Indirect Branch Instruction.
static IndirectBrInst * Create(Value *Address, unsigned NumDests, InsertPosition InsertBefore=nullptr)
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
static InsertValueInst * Create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
LLVM_ABI void setHasNoUnsignedWrap(bool b=true)
Set or clear the nuw flag on this instruction, which must be an operator which supports this flag.
LLVM_ABI void setHasNoSignedWrap(bool b=true)
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag.
LLVM_ABI void setIsExact(bool b=true)
Set or clear the exact flag on this instruction, which must be an operator which supports this flag.
LLVM_ABI void copyMetadata(const Instruction &SrcInst, ArrayRef< unsigned > WL=ArrayRef< unsigned >())
Copy metadata from SrcInst to this instruction.
Class to represent integer types.
static InvokeInst * Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, const Twine &NameStr, InsertPosition InsertBefore=nullptr)
This is an important class for using LLVM in a threaded context.
The landingpad instruction holds all of the information necessary to generate correct exception handl...
static LLVM_ABI LandingPadInst * Create(Type *RetTy, unsigned NumReservedClauses, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
Constructors - NumReservedClauses is a hint for the number of incoming clauses that this landingpad w...
An instruction for reading from memory.
static LLVM_ABI MDString * get(LLVMContext &Context, StringRef Str)
A Module instance is used to store all the information related to an LLVM module.
static PHINode * Create(Type *Ty, unsigned NumReservedValues, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
Constructors - NumReservedValues is a hint for the number of incoming edges that this phi node will h...
Class to represent pointers.
static LLVM_ABI PointerType * get(LLVMContext &C, unsigned AddressSpace)
This constructs an opaque pointer to an object in a numbered address space.
static LLVM_ABI PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
Resume the propagation of an exception.
static ResumeInst * Create(Value *Exn, InsertPosition InsertBefore=nullptr)
Return a value (possibly void), from a function.
static ReturnInst * Create(LLVMContext &C, Value *retVal=nullptr, InsertPosition InsertBefore=nullptr)
This instruction constructs a fixed permutation of two input vectors.
ArrayRef< int > getShuffleMask() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An instruction for storing to memory.
Represent a constant reference to a string, i.e.
static SwitchInst * Create(Value *Value, BasicBlock *Default, unsigned NumCases, InsertPosition InsertBefore=nullptr)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI ByteType * getByte16Ty(LLVMContext &C)
static LLVM_ABI IntegerType * getInt64Ty(LLVMContext &C)
static LLVM_ABI IntegerType * getInt128Ty(LLVMContext &C)
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
static LLVM_ABI ByteType * getByte32Ty(LLVMContext &C)
static LLVM_ABI Type * getVoidTy(LLVMContext &C)
static LLVM_ABI IntegerType * getInt8Ty(LLVMContext &C)
static LLVM_ABI IntegerType * getInt16Ty(LLVMContext &C)
LLVM_ABI unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
static LLVM_ABI ByteType * getByte8Ty(LLVMContext &C)
static LLVM_ABI IntegerType * getInt1Ty(LLVMContext &C)
static LLVM_ABI ByteType * getByte128Ty(LLVMContext &C)
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
static LLVM_ABI IntegerType * getIntNTy(LLVMContext &C, unsigned N)
static LLVM_ABI Type * getDoubleTy(LLVMContext &C)
static LLVM_ABI Type * getFloatTy(LLVMContext &C)
static LLVM_ABI ByteType * getByteNTy(LLVMContext &C, unsigned N)
static LLVM_ABI ByteType * getByte64Ty(LLVMContext &C)
static LLVM_ABI Type * getBFloatTy(LLVMContext &C)
static LLVM_ABI Type * getHalfTy(LLVMContext &C)
static LLVM_ABI UnaryOperator * Create(UnaryOps Op, Value *S, const Twine &Name=Twine(), InsertPosition InsertBefore=nullptr)
Construct a unary instruction, given the opcode and an operand.
Unconditional Branch instruction.
static UncondBrInst * Create(BasicBlock *Target, InsertPosition InsertBefore=nullptr)
This function has undefined behavior.
A Use represents the edge between a Value definition and its users.
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
Base class of all SIMD vector types.
static LLVM_ABI VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
This class represents zero extension of integer types.
An efficient, type-erasing, non-owning reference to a callable.
struct LLVMOpaqueBuilder * LLVMBuilderRef
Represents an LLVM basic block builder.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Rounding
Possible values of current rounding mode, which is specified in bits 23:22 of FPCR.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
@ System
Synchronized with respect to all concurrently executing threads.
ExceptionBehavior
Exception behavior used for floating point operations.
@ ebStrict
This corresponds to "fpexcept.strict".
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI std::optional< StringRef > convertRoundingModeToStr(RoundingMode)
For any RoundingMode enumerator, returns a string valid as input in constrained intrinsic rounding mo...
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
LLVM_ABI std::optional< StringRef > convertExceptionBehaviorToStr(fp::ExceptionBehavior)
For any ExceptionBehavior enumerator, returns a string valid as input in constrained intrinsic except...
IRBuilder(LLVMContext &, FolderTy, InserterTy) -> IRBuilder< FolderTy, InserterTy >
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
AtomicOrdering
Atomic ordering for LLVM's memory model.
DWARFExpression::Operation Op
RoundingMode
Rounding mode.
@ Dynamic
Denotes mode unknown at compile time.
ArrayRef(const T &OneElt) -> ArrayRef< T >
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Implement std::hash so that hash_code can be used in STL containers.
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
This struct is a compact representation of a valid (non-zero power of two) alignment.
A structure representing the properties of a load or store instruction.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.