15 #ifndef LLVM_IR_IRBUILDER_H 16 #define LLVM_IR_IRBUILDER_H 74 std::function<void(Instruction *)> Callback;
78 : Callback(
std::move(Callback)) {}
105 : Context(context), DefaultFPMathTag(FPMathTag),
106 DefaultOperandBundles(OpBundles) {
107 ClearInsertionPoint();
129 InsertPt = BB->
end();
137 assert(InsertPt != BB->
end() &&
"Can't read debug loc from end()");
146 if (IP != TheBB->
end())
147 SetCurrentDebugLocation(IP->getDebugLoc());
165 Type *getCurrentFunctionReturnType()
const;
178 : Block(InsertBlock), Point(InsertPoint) {}
181 bool isSet()
const {
return (Block !=
nullptr); }
189 return InsertPoint(GetInsertBlock(), GetInsertPoint());
194 InsertPoint IP(GetInsertBlock(), GetInsertPoint());
195 ClearInsertionPoint();
204 ClearInsertionPoint();
236 : Builder(B), Block(B.GetInsertBlock()), Point(B.GetInsertPoint()),
237 DbgLoc(B.getCurrentDebugLocation()) {}
257 : Builder(B), FMF(B.FMF), FPMathTag(B.DefaultFPMathTag) {}
406 MDNode *ScopeTag =
nullptr,
407 MDNode *NoAliasTag =
nullptr) {
408 return CreateMemSet(Ptr, Val, getInt64(Size), Align,
isVolatile,
409 TBAATag, ScopeTag, NoAliasTag);
414 MDNode *ScopeTag =
nullptr,
415 MDNode *NoAliasTag =
nullptr);
424 uint64_t Size,
unsigned Align,
426 MDNode *TBAATag =
nullptr,
427 MDNode *ScopeTag =
nullptr,
428 MDNode *NoAliasTag =
nullptr) {
429 return CreateElementUnorderedAtomicMemSet(Ptr, Val, getInt64(Size), Align,
430 ElementSize, TBAATag, ScopeTag,
435 Value *Size,
unsigned Align,
437 MDNode *TBAATag =
nullptr,
438 MDNode *ScopeTag =
nullptr,
439 MDNode *NoAliasTag =
nullptr);
447 unsigned SrcAlign, uint64_t Size,
449 MDNode *TBAAStructTag =
nullptr,
450 MDNode *ScopeTag =
nullptr,
451 MDNode *NoAliasTag =
nullptr) {
452 return CreateMemCpy(Dst, DstAlign, Src, SrcAlign, getInt64(Size),
458 unsigned SrcAlign,
Value *Size,
460 MDNode *TBAAStructTag =
nullptr,
461 MDNode *ScopeTag =
nullptr,
462 MDNode *NoAliasTag =
nullptr);
473 Value *Dst,
unsigned DstAlign,
Value *Src,
unsigned SrcAlign,
475 MDNode *TBAAStructTag =
nullptr,
MDNode *ScopeTag =
nullptr,
476 MDNode *NoAliasTag =
nullptr) {
477 return CreateElementUnorderedAtomicMemCpy(
478 Dst, DstAlign, Src, SrcAlign, getInt64(Size), ElementSize, TBAATag,
479 TBAAStructTag, ScopeTag, NoAliasTag);
482 CallInst *CreateElementUnorderedAtomicMemCpy(
483 Value *Dst,
unsigned DstAlign,
Value *Src,
unsigned SrcAlign,
Value *Size,
485 MDNode *TBAAStructTag =
nullptr,
MDNode *ScopeTag =
nullptr,
486 MDNode *NoAliasTag =
nullptr);
497 MDNode *NoAliasTag =
nullptr) {
498 return CreateMemMove(Dst, DstAlign, Src, SrcAlign, getInt64(Size),
isVolatile,
499 TBAATag, ScopeTag, NoAliasTag);
504 MDNode *ScopeTag =
nullptr,
505 MDNode *NoAliasTag =
nullptr);
517 Value *Dst,
unsigned DstAlign,
Value *Src,
unsigned SrcAlign,
519 MDNode *TBAAStructTag =
nullptr,
MDNode *ScopeTag =
nullptr,
520 MDNode *NoAliasTag =
nullptr) {
521 return CreateElementUnorderedAtomicMemMove(
522 Dst, DstAlign, Src, SrcAlign, getInt64(Size), ElementSize, TBAATag,
523 TBAAStructTag, ScopeTag, NoAliasTag);
526 CallInst *CreateElementUnorderedAtomicMemMove(
527 Value *Dst,
unsigned DstAlign,
Value *Src,
unsigned SrcAlign,
Value *Size,
529 MDNode *TBAAStructTag =
nullptr,
MDNode *ScopeTag =
nullptr,
530 MDNode *NoAliasTag =
nullptr);
557 CallInst *CreateIntMaxReduce(
Value *Src,
bool IsSigned =
false);
561 CallInst *CreateIntMinReduce(
Value *Src,
bool IsSigned =
false);
596 Value *Mask =
nullptr,
597 Value *PassThru =
nullptr,
602 Value *Mask =
nullptr);
639 CreateGCStatepointInvoke(uint64_t ID,
uint32_t NumPatchBytes,
658 CreateGCStatepointInvoke(uint64_t ID,
uint32_t NumPatchBytes,
736 MDNode *FPMathTag =
nullptr,
747 :
IRBuilderBase(TheBB->getContext(), FPMathTag, OpBundles), Folder(F) {
748 SetInsertPoint(TheBB);
754 SetInsertPoint(TheBB);
764 MDNode *FPMathTag =
nullptr,
766 :
IRBuilderBase(TheBB->getContext(), FPMathTag, OpBundles), Folder(F) {
767 SetInsertPoint(TheBB, IP);
771 MDNode *FPMathTag =
nullptr,
774 SetInsertPoint(TheBB, IP);
781 template<
typename InstTy>
784 this->SetInstDebugLocation(I);
801 template <
typename InstTy>
802 InstTy *addBranchMetadata(InstTy *
I,
MDNode *Weights,
MDNode *Unpredictable) {
830 for (
unsigned i = 0; i !=
N; ++i)
831 V = CreateInsertValue(V, retVals[i], i,
"mrv");
843 MDNode *BranchWeights =
nullptr,
844 MDNode *Unpredictable =
nullptr) {
846 BranchWeights, Unpredictable));
866 MDNode *BranchWeights =
nullptr,
867 MDNode *Unpredictable =
nullptr) {
869 BranchWeights, Unpredictable));
905 unsigned NumHandlers,
937 bool HasNUW,
bool HasNSW) {
947 FPMD = DefaultFPMathTag;
955 Value *R,
const Twine &Name =
nullptr)
const {
958 return (LC && RC) ? Insert(Folder.CreateBinOp(Opc, LC, RC),
Name) :
nullptr;
963 bool HasNUW =
false,
bool HasNSW =
false) {
964 if (
auto *LC = dyn_cast<Constant>(LHS))
965 if (
auto *RC = dyn_cast<Constant>(RHS))
966 return Insert(Folder.CreateAdd(LC, RC, HasNUW, HasNSW),
Name);
972 return CreateAdd(LHS, RHS, Name,
false,
true);
976 return CreateAdd(LHS, RHS, Name,
true,
false);
980 bool HasNUW =
false,
bool HasNSW =
false) {
981 if (
auto *LC = dyn_cast<Constant>(LHS))
982 if (
auto *RC = dyn_cast<Constant>(RHS))
983 return Insert(Folder.CreateSub(LC, RC, HasNUW, HasNSW),
Name);
984 return CreateInsertNUWNSWBinOp(Instruction::Sub, LHS, RHS, Name,
989 return CreateSub(LHS, RHS, Name,
false,
true);
993 return CreateSub(LHS, RHS, Name,
true,
false);
997 bool HasNUW =
false,
bool HasNSW =
false) {
998 if (
auto *LC = dyn_cast<Constant>(LHS))
999 if (
auto *RC = dyn_cast<Constant>(RHS))
1000 return Insert(Folder.CreateMul(LC, RC, HasNUW, HasNSW),
Name);
1001 return CreateInsertNUWNSWBinOp(Instruction::Mul, LHS, RHS, Name,
1006 return CreateMul(LHS, RHS, Name,
false,
true);
1010 return CreateMul(LHS, RHS, Name,
true,
false);
1014 bool isExact =
false) {
1015 if (
auto *LC = dyn_cast<Constant>(LHS))
1016 if (
auto *RC = dyn_cast<Constant>(RHS))
1017 return Insert(Folder.CreateUDiv(LC, RC, isExact),
Name);
1019 return Insert(BinaryOperator::CreateUDiv(LHS, RHS), Name);
1020 return Insert(BinaryOperator::CreateExactUDiv(LHS, RHS), Name);
1024 return CreateUDiv(LHS, RHS, Name,
true);
1028 bool isExact =
false) {
1029 if (
auto *LC = dyn_cast<Constant>(LHS))
1030 if (
auto *RC = dyn_cast<Constant>(RHS))
1031 return Insert(Folder.CreateSDiv(LC, RC, isExact),
Name);
1033 return Insert(BinaryOperator::CreateSDiv(LHS, RHS), Name);
1034 return Insert(BinaryOperator::CreateExactSDiv(LHS, RHS), Name);
1038 return CreateSDiv(LHS, RHS, Name,
true);
1042 if (
Value *V = foldConstant(Instruction::URem, LHS, RHS, Name))
return V;
1043 return Insert(BinaryOperator::CreateURem(LHS, RHS), Name);
1047 if (
Value *V = foldConstant(Instruction::SRem, LHS, RHS, Name))
return V;
1048 return Insert(BinaryOperator::CreateSRem(LHS, RHS), Name);
1052 bool HasNUW =
false,
bool HasNSW =
false) {
1053 if (
auto *LC = dyn_cast<Constant>(LHS))
1054 if (
auto *RC = dyn_cast<Constant>(RHS))
1055 return Insert(Folder.CreateShl(LC, RC, HasNUW, HasNSW),
Name);
1056 return CreateInsertNUWNSWBinOp(Instruction::Shl, LHS, RHS, Name,
1061 bool HasNUW =
false,
bool HasNSW =
false) {
1067 bool HasNUW =
false,
bool HasNSW =
false) {
1073 bool isExact =
false) {
1074 if (
auto *LC = dyn_cast<Constant>(LHS))
1075 if (
auto *RC = dyn_cast<Constant>(RHS))
1076 return Insert(Folder.CreateLShr(LC, RC, isExact),
Name);
1078 return Insert(BinaryOperator::CreateLShr(LHS, RHS), Name);
1079 return Insert(BinaryOperator::CreateExactLShr(LHS, RHS), Name);
1083 bool isExact =
false) {
1088 bool isExact =
false) {
1093 bool isExact =
false) {
1094 if (
auto *LC = dyn_cast<Constant>(LHS))
1095 if (
auto *RC = dyn_cast<Constant>(RHS))
1096 return Insert(Folder.CreateAShr(LC, RC, isExact),
Name);
1098 return Insert(BinaryOperator::CreateAShr(LHS, RHS), Name);
1099 return Insert(BinaryOperator::CreateExactAShr(LHS, RHS), Name);
1103 bool isExact =
false) {
1108 bool isExact =
false) {
1113 if (
auto *RC = dyn_cast<Constant>(RHS)) {
1114 if (isa<ConstantInt>(RC) && cast<ConstantInt>(RC)->isMinusOne())
1116 if (
auto *LC = dyn_cast<Constant>(LHS))
1117 return Insert(Folder.CreateAnd(LC, RC),
Name);
1119 return Insert(BinaryOperator::CreateAnd(LHS, RHS), Name);
1131 if (
auto *RC = dyn_cast<Constant>(RHS)) {
1132 if (RC->isNullValue())
1134 if (
auto *LC = dyn_cast<Constant>(LHS))
1135 return Insert(Folder.CreateOr(LC, RC),
Name);
1137 return Insert(BinaryOperator::CreateOr(LHS, RHS), Name);
1149 if (
Value *V = foldConstant(Instruction::Xor, LHS, RHS, Name))
return V;
1150 return Insert(BinaryOperator::CreateXor(LHS, RHS), Name);
1162 MDNode *FPMD =
nullptr) {
1163 if (
Value *V = foldConstant(Instruction::FAdd, L, R, Name))
return V;
1164 Instruction *I = setFPAttrs(BinaryOperator::CreateFAdd(L, R), FPMD, FMF);
1165 return Insert(I, Name);
1171 const Twine &Name =
"") {
1172 if (
Value *V = foldConstant(Instruction::FAdd, L, R, Name))
return V;
1173 Instruction *I = setFPAttrs(BinaryOperator::CreateFAdd(L, R),
nullptr,
1175 return Insert(I, Name);
1179 MDNode *FPMD =
nullptr) {
1180 if (
Value *V = foldConstant(Instruction::FSub, L, R, Name))
return V;
1181 Instruction *I = setFPAttrs(BinaryOperator::CreateFSub(L, R), FPMD, FMF);
1182 return Insert(I, Name);
1188 const Twine &Name =
"") {
1189 if (
Value *V = foldConstant(Instruction::FSub, L, R, Name))
return V;
1190 Instruction *I = setFPAttrs(BinaryOperator::CreateFSub(L, R),
nullptr,
1192 return Insert(I, Name);
1196 MDNode *FPMD =
nullptr) {
1197 if (
Value *V = foldConstant(Instruction::FMul, L, R, Name))
return V;
1198 Instruction *I = setFPAttrs(BinaryOperator::CreateFMul(L, R), FPMD, FMF);
1199 return Insert(I, Name);
1205 const Twine &Name =
"") {
1206 if (
Value *V = foldConstant(Instruction::FMul, L, R, Name))
return V;
1207 Instruction *I = setFPAttrs(BinaryOperator::CreateFMul(L, R),
nullptr,
1209 return Insert(I, Name);
1213 MDNode *FPMD =
nullptr) {
1214 if (
Value *V = foldConstant(Instruction::FDiv, L, R, Name))
return V;
1215 Instruction *I = setFPAttrs(BinaryOperator::CreateFDiv(L, R), FPMD, FMF);
1216 return Insert(I, Name);
1222 const Twine &Name =
"") {
1223 if (
Value *V = foldConstant(Instruction::FDiv, L, R, Name))
return V;
1224 Instruction *I = setFPAttrs(BinaryOperator::CreateFDiv(L, R),
nullptr,
1226 return Insert(I, Name);
1230 MDNode *FPMD =
nullptr) {
1231 if (
Value *V = foldConstant(Instruction::FRem, L, R, Name))
return V;
1232 Instruction *I = setFPAttrs(BinaryOperator::CreateFRem(L, R), FPMD, FMF);
1233 return Insert(I, Name);
1239 const Twine &Name =
"") {
1240 if (
Value *V = foldConstant(Instruction::FRem, L, R, Name))
return V;
1241 Instruction *I = setFPAttrs(BinaryOperator::CreateFRem(L, R),
nullptr,
1243 return Insert(I, Name);
1248 MDNode *FPMathTag =
nullptr) {
1249 if (
Value *V = foldConstant(Opc, LHS, RHS, Name))
return V;
1251 if (isa<FPMathOperator>(BinOp))
1252 BinOp = setFPAttrs(BinOp, FPMathTag, FMF);
1253 return Insert(BinOp, Name);
1257 bool HasNUW =
false,
bool HasNSW =
false) {
1258 if (
auto *
VC = dyn_cast<Constant>(V))
1259 return Insert(Folder.CreateNeg(
VC, HasNUW, HasNSW),
Name);
1261 if (HasNUW) BO->setHasNoUnsignedWrap();
1262 if (HasNSW) BO->setHasNoSignedWrap();
1275 MDNode *FPMathTag =
nullptr) {
1276 if (
auto *
VC = dyn_cast<Constant>(V))
1277 return Insert(Folder.CreateFNeg(
VC),
Name);
1283 if (
auto *
VC = dyn_cast<Constant>(V))
1284 return Insert(Folder.CreateNot(
VC),
Name);
1293 Value *ArraySize =
nullptr,
const Twine &Name =
"") {
1294 return Insert(
new AllocaInst(Ty, AddrSpace, ArraySize), Name);
1298 const Twine &Name =
"") {
1299 const DataLayout &DL = BB->getParent()->getParent()->getDataLayout();
1306 return Insert(
new LoadInst(Ptr), Name);
1310 return Insert(
new LoadInst(Ptr), Name);
1314 return Insert(
new LoadInst(Ty, Ptr), Name);
1318 return Insert(
new LoadInst(Ptr,
nullptr, isVolatile), Name);
1329 LoadInst *LI = CreateLoad(Ptr, Name);
1334 const Twine &Name =
"") {
1335 LoadInst *LI = CreateLoad(Ptr, Name);
1340 const Twine &Name =
"") {
1341 LoadInst *LI = CreateLoad(Ptr, isVolatile, Name);
1355 const Twine &Name =
"") {
1365 FailureOrdering, SSID));
1371 return Insert(
new AtomicRMWInst(Op, Ptr, Val, Ordering, SSID));
1375 const Twine &Name =
"") {
1376 return CreateGEP(
nullptr, Ptr, IdxList, Name);
1380 const Twine &Name =
"") {
1381 if (
auto *PC = dyn_cast<Constant>(Ptr)) {
1384 for (i = 0, e = IdxList.
size(); i != e; ++i)
1385 if (!isa<Constant>(IdxList[i]))
1388 return Insert(Folder.CreateGetElementPtr(Ty, PC, IdxList),
Name);
1394 const Twine &Name =
"") {
1395 return CreateInBoundsGEP(
nullptr, Ptr, IdxList, Name);
1399 const Twine &Name =
"") {
1400 if (
auto *PC = dyn_cast<Constant>(Ptr)) {
1403 for (i = 0, e = IdxList.
size(); i != e; ++i)
1404 if (!isa<Constant>(IdxList[i]))
1407 return Insert(Folder.CreateInBoundsGetElementPtr(Ty, PC, IdxList),
1414 return CreateGEP(
nullptr, Ptr, Idx, Name);
1418 if (
auto *PC = dyn_cast<Constant>(Ptr))
1419 if (
auto *IC = dyn_cast<Constant>(Idx))
1420 return Insert(Folder.CreateGetElementPtr(Ty, PC, IC),
Name);
1425 const Twine &Name =
"") {
1426 if (
auto *PC = dyn_cast<Constant>(Ptr))
1427 if (
auto *IC = dyn_cast<Constant>(Idx))
1428 return Insert(Folder.CreateInBoundsGetElementPtr(Ty, PC, IC),
Name);
1433 return CreateConstGEP1_32(
nullptr, Ptr, Idx0, Name);
1437 const Twine &Name =
"") {
1440 if (
auto *PC = dyn_cast<Constant>(Ptr))
1441 return Insert(Folder.CreateGetElementPtr(Ty, PC, Idx),
Name);
1447 const Twine &Name =
"") {
1450 if (
auto *PC = dyn_cast<Constant>(Ptr))
1451 return Insert(Folder.CreateInBoundsGetElementPtr(Ty, PC, Idx),
Name);
1457 const Twine &Name =
"") {
1463 if (
auto *PC = dyn_cast<Constant>(Ptr))
1464 return Insert(Folder.CreateGetElementPtr(Ty, PC, Idxs),
Name);
1470 unsigned Idx1,
const Twine &Name =
"") {
1476 if (
auto *PC = dyn_cast<Constant>(Ptr))
1477 return Insert(Folder.CreateInBoundsGetElementPtr(Ty, PC, Idxs),
Name);
1485 if (
auto *PC = dyn_cast<Constant>(Ptr))
1486 return Insert(Folder.CreateGetElementPtr(
nullptr, PC, Idx),
Name);
1492 const Twine &Name =
"") {
1495 if (
auto *PC = dyn_cast<Constant>(Ptr))
1496 return Insert(Folder.CreateInBoundsGetElementPtr(
nullptr, PC, Idx),
Name);
1502 const Twine &Name =
"") {
1508 if (
auto *PC = dyn_cast<Constant>(Ptr))
1509 return Insert(Folder.CreateGetElementPtr(
nullptr, PC, Idxs),
Name);
1515 const Twine &Name =
"") {
1521 if (
auto *PC = dyn_cast<Constant>(Ptr))
1522 return Insert(Folder.CreateInBoundsGetElementPtr(
nullptr, PC, Idxs),
1529 const Twine &Name =
"") {
1530 return CreateConstInBoundsGEP2_32(Ty, Ptr, 0, Idx, Name);
1534 return CreateConstInBoundsGEP2_32(
nullptr, Ptr, 0, Idx, Name);
1543 Constant *Indices[] = {Zero, Zero};
1553 return CreateCast(Instruction::Trunc, V, DestTy, Name);
1557 return CreateCast(Instruction::ZExt, V, DestTy, Name);
1561 return CreateCast(Instruction::SExt, V, DestTy, Name);
1567 const Twine &Name =
"") {
1570 "Can only zero extend/truncate integers!");
1573 return CreateZExt(V, DestTy, Name);
1575 return CreateTrunc(V, DestTy, Name);
1582 const Twine &Name =
"") {
1585 "Can only sign extend/truncate integers!");
1588 return CreateSExt(V, DestTy, Name);
1590 return CreateTrunc(V, DestTy, Name);
1595 return CreateCast(Instruction::FPToUI, V, DestTy, Name);
1599 return CreateCast(Instruction::FPToSI, V, DestTy, Name);
1603 return CreateCast(Instruction::UIToFP, V, DestTy, Name);
1607 return CreateCast(Instruction::SIToFP, V, DestTy, Name);
1611 const Twine &Name =
"") {
1612 return CreateCast(Instruction::FPTrunc, V, DestTy, Name);
1616 return CreateCast(Instruction::FPExt, V, DestTy, Name);
1620 const Twine &Name =
"") {
1621 return CreateCast(Instruction::PtrToInt, V, DestTy, Name);
1625 const Twine &Name =
"") {
1626 return CreateCast(Instruction::IntToPtr, V, DestTy, Name);
1630 const Twine &Name =
"") {
1631 return CreateCast(Instruction::BitCast, V, DestTy, Name);
1635 const Twine &Name =
"") {
1636 return CreateCast(Instruction::AddrSpaceCast, V, DestTy, Name);
1640 const Twine &Name =
"") {
1643 if (
auto *
VC = dyn_cast<Constant>(V))
1644 return Insert(Folder.CreateZExtOrBitCast(
VC, DestTy),
Name);
1649 const Twine &Name =
"") {
1652 if (
auto *
VC = dyn_cast<Constant>(V))
1653 return Insert(Folder.CreateSExtOrBitCast(
VC, DestTy),
Name);
1658 const Twine &Name =
"") {
1661 if (
auto *
VC = dyn_cast<Constant>(V))
1662 return Insert(Folder.CreateTruncOrBitCast(
VC, DestTy),
Name);
1667 const Twine &Name =
"") {
1670 if (
auto *
VC = dyn_cast<Constant>(V))
1671 return Insert(Folder.CreateCast(Op,
VC, DestTy),
Name);
1676 const Twine &Name =
"") {
1679 if (
auto *
VC = dyn_cast<Constant>(V))
1680 return Insert(Folder.CreatePointerCast(
VC, DestTy),
Name);
1685 const Twine &Name =
"") {
1689 if (
auto *
VC = dyn_cast<Constant>(V)) {
1690 return Insert(Folder.CreatePointerBitCastOrAddrSpaceCast(
VC, DestTy),
1699 const Twine &Name =
"") {
1702 if (
auto *
VC = dyn_cast<Constant>(V))
1703 return Insert(Folder.CreateIntCast(
VC, DestTy, isSigned),
Name);
1708 const Twine &Name =
"") {
1712 return CreatePtrToInt(V, DestTy, Name);
1714 return CreateIntToPtr(V, DestTy, Name);
1716 return CreateBitCast(V, DestTy, Name);
1722 if (
auto *
VC = dyn_cast<Constant>(V))
1723 return Insert(Folder.CreateFPCast(
VC, DestTy),
Name);
1777 MDNode *FPMathTag =
nullptr) {
1782 MDNode *FPMathTag =
nullptr) {
1787 MDNode *FPMathTag =
nullptr) {
1792 MDNode *FPMathTag =
nullptr) {
1797 MDNode *FPMathTag =
nullptr) {
1802 MDNode *FPMathTag =
nullptr) {
1807 MDNode *FPMathTag =
nullptr) {
1812 MDNode *FPMathTag =
nullptr) {
1817 MDNode *FPMathTag =
nullptr) {
1822 MDNode *FPMathTag =
nullptr) {
1827 MDNode *FPMathTag =
nullptr) {
1832 MDNode *FPMathTag =
nullptr) {
1837 MDNode *FPMathTag =
nullptr) {
1842 MDNode *FPMathTag =
nullptr) {
1847 const Twine &Name =
"") {
1848 if (
auto *LC = dyn_cast<Constant>(LHS))
1849 if (
auto *RC = dyn_cast<Constant>(RHS))
1850 return Insert(Folder.CreateICmp(P, LC, RC),
Name);
1851 return Insert(
new ICmpInst(P, LHS, RHS), Name);
1855 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
1856 if (
auto *LC = dyn_cast<Constant>(LHS))
1857 if (
auto *RC = dyn_cast<Constant>(RHS))
1858 return Insert(Folder.CreateFCmp(P, LC, RC),
Name);
1859 return Insert(setFPAttrs(
new FCmpInst(P, LHS, RHS), FPMathTag, FMF), Name);
1867 const Twine &Name =
"") {
1872 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
1873 auto *PTy = cast<PointerType>(Callee->
getType());
1874 auto *FTy = cast<FunctionType>(PTy->getElementType());
1875 return CreateCall(FTy, Callee,
Args, Name, FPMathTag);
1880 MDNode *FPMathTag =
nullptr) {
1882 if (isa<FPMathOperator>(CI))
1883 CI = cast<CallInst>(setFPAttrs(CI, FPMathTag, FMF));
1884 return Insert(CI, Name);
1889 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
1891 if (isa<FPMathOperator>(CI))
1892 CI = cast<CallInst>(setFPAttrs(CI, FPMathTag, FMF));
1893 return Insert(CI, Name);
1897 const Twine &Name =
"",
MDNode *FPMathTag =
nullptr) {
1903 if (
auto *CC = dyn_cast<Constant>(C))
1904 if (
auto *TC = dyn_cast<Constant>(True))
1905 if (
auto *
FC = dyn_cast<Constant>(False))
1906 return Insert(Folder.CreateSelect(CC, TC,
FC),
Name);
1912 Sel = addBranchMetadata(Sel, Prof, Unpred);
1914 return Insert(Sel, Name);
1918 return Insert(
new VAArgInst(List, Ty), Name);
1922 const Twine &Name =
"") {
1923 if (
auto *
VC = dyn_cast<Constant>(Vec))
1924 if (
auto *IC = dyn_cast<Constant>(Idx))
1925 return Insert(Folder.CreateExtractElement(
VC, IC),
Name);
1930 const Twine &Name =
"") {
1931 return CreateExtractElement(Vec, getInt64(Idx), Name);
1935 const Twine &Name =
"") {
1936 if (
auto *
VC = dyn_cast<Constant>(Vec))
1937 if (
auto *
NC = dyn_cast<Constant>(NewElt))
1938 if (
auto *IC = dyn_cast<Constant>(Idx))
1939 return Insert(Folder.CreateInsertElement(
VC,
NC, IC),
Name);
1944 const Twine &Name =
"") {
1945 return CreateInsertElement(Vec, NewElt, getInt64(Idx), Name);
1949 const Twine &Name =
"") {
1950 if (
auto *V1C = dyn_cast<Constant>(V1))
1951 if (
auto *V2C = dyn_cast<Constant>(V2))
1952 if (
auto *MC = dyn_cast<Constant>(Mask))
1953 return Insert(Folder.CreateShuffleVector(V1C, V2C, MC),
Name);
1958 const Twine &Name =
"") {
1960 return CreateShuffleVector(V1, V2, Mask, Name);
1965 const Twine &Name =
"") {
1966 if (
auto *AggC = dyn_cast<Constant>(Agg))
1967 return Insert(Folder.CreateExtractValue(AggC, Idxs),
Name);
1973 const Twine &Name =
"") {
1974 if (
auto *AggC = dyn_cast<Constant>(Agg))
1975 if (
auto *ValC = dyn_cast<Constant>(Val))
1976 return Insert(Folder.CreateInsertValue(AggC, ValC, Idxs),
Name);
1981 const Twine &Name =
"") {
2009 "Pointer subtraction operand types must match!");
2010 auto *ArgType = cast<PointerType>(LHS->
getType());
2013 Value *Difference = CreateSub(LHS_int, RHS_int);
2014 return CreateExactSDiv(Difference,
2024 "launder.invariant.group only applies to pointers.");
2026 auto *PtrType = Ptr->
getType();
2027 auto *Int8PtrTy = getInt8PtrTy(PtrType->getPointerAddressSpace());
2028 if (PtrType != Int8PtrTy)
2029 Ptr = CreateBitCast(Ptr, Int8PtrTy);
2030 Module *M = BB->getParent()->getParent();
2032 M, Intrinsic::launder_invariant_group, {Int8PtrTy});
2037 "LaunderInvariantGroup should take and return the same type");
2039 CallInst *Fn = CreateCall(FnLaunderInvariantGroup, {Ptr});
2041 if (PtrType != Int8PtrTy)
2042 return CreateBitCast(Fn, PtrType);
2051 "strip.invariant.group only applies to pointers.");
2054 auto *PtrType = Ptr->
getType();
2055 auto *Int8PtrTy = getInt8PtrTy(PtrType->getPointerAddressSpace());
2056 if (PtrType != Int8PtrTy)
2057 Ptr = CreateBitCast(Ptr, Int8PtrTy);
2058 Module *M = BB->getParent()->getParent();
2060 M, Intrinsic::strip_invariant_group, {Int8PtrTy});
2065 "StripInvariantGroup should take and return the same type");
2067 CallInst *Fn = CreateCall(FnStripInvariantGroup, {Ptr});
2069 if (PtrType != Int8PtrTy)
2070 return CreateBitCast(Fn, PtrType);
2077 assert(NumElts > 0 &&
"Cannot splat to an empty vector!");
2080 Type *I32Ty = getInt32Ty();
2083 Name +
".splatinsert");
2087 return CreateShuffleVector(V, Undef, Zeros, Name +
".splat");
2093 const Twine &Name) {
2094 auto *IntTy = cast<IntegerType>(From->
getType());
2097 "Element extends past full value");
2098 uint64_t ShAmt = 8 *
Offset;
2104 V = CreateLShr(V, ShAmt, Name +
".shift");
2107 "Cannot extract to a larger integer!");
2108 if (ExtractedTy != IntTy) {
2109 V = CreateTrunc(V, ExtractedTy, Name +
".trunc");
2121 Value *OffsetValue) {
2122 Value *PtrIntValue = CreatePtrToInt(PtrValue, IntPtrTy,
"ptrint");
2125 bool IsOffsetZero =
false;
2126 if (
const auto *CI = dyn_cast<ConstantInt>(OffsetValue))
2127 IsOffsetZero = CI->isZero();
2129 if (!IsOffsetZero) {
2130 if (OffsetValue->
getType() != IntPtrTy)
2131 OffsetValue = CreateIntCast(OffsetValue, IntPtrTy,
true,
2133 PtrIntValue = CreateSub(PtrIntValue, OffsetValue,
"offsetptr");
2138 Value *MaskedPtr = CreateAnd(PtrIntValue, Mask,
"maskedptr");
2139 Value *InvCond = CreateICmpEQ(MaskedPtr, Zero,
"maskcond");
2140 return CreateAssumption(InvCond);
2152 Value *OffsetValue =
nullptr) {
2154 "trying to create an alignment assumption on a non-pointer?");
2155 auto *PtrTy = cast<PointerType>(PtrValue->
getType());
2156 Type *IntPtrTy = getIntPtrTy(DL, PtrTy->getAddressSpace());
2159 return CreateAlignmentAssumptionHelper(DL, PtrValue, Mask, IntPtrTy,
2174 Value *OffsetValue =
nullptr) {
2176 "trying to create an alignment assumption on a non-pointer?");
2177 auto *PtrTy = cast<PointerType>(PtrValue->
getType());
2178 Type *IntPtrTy = getIntPtrTy(DL, PtrTy->getAddressSpace());
2180 if (Alignment->
getType() != IntPtrTy)
2181 Alignment = CreateIntCast(Alignment, IntPtrTy,
true,
2186 Value *PositiveMask =
2188 Value *Mask = CreateSelect(IsPositive, PositiveMask,
2191 return CreateAlignmentAssumptionHelper(DL, PtrValue, Mask, IntPtrTy,
2201 #endif // LLVM_IR_IRBUILDER_H IntegerType * getInt16Ty()
Fetch the type representing a 16-bit integer.
Value * CreateInsertElement(Value *Vec, Value *NewElt, uint64_t Idx, const Twine &Name="")
Value * CreateNSWNeg(Value *V, const Twine &Name="")
Value * CreateConstInBoundsGEP1_32(Type *Ty, Value *Ptr, unsigned Idx0, const Twine &Name="")
Value * CreateInBoundsGEP(Value *Ptr, ArrayRef< Value *> IdxList, const Twine &Name="")
Common base class shared among various IRBuilders.
Return a value (possibly void), from a function.
Value * CreateAShr(Value *LHS, const APInt &RHS, const Twine &Name="", bool isExact=false)
Value * CreateInBoundsGEP(Type *Ty, Value *Ptr, Value *Idx, const Twine &Name="")
A parsed version of the target data layout string in and methods for querying it. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
static ConstantInt * getFalse(LLVMContext &Context)
BranchInst * CreateCondBr(Value *Cond, BasicBlock *True, BasicBlock *False, MDNode *BranchWeights=nullptr, MDNode *Unpredictable=nullptr)
Create a conditional 'br Cond, TrueDest, FalseDest' instruction.
Value * CreateICmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateConstGEP1_32(Value *Ptr, unsigned Idx0, const Twine &Name="")
void setFastMathFlags(FastMathFlags FMF)
Convenience function for setting multiple fast-math flags on this instruction, which must be an opera...
static Type * getDoubleTy(LLVMContext &C)
static IntegerType * getInt1Ty(LLVMContext &C)
IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, const T &F, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
Value * CreateBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateConstGEP1_32(Type *Ty, Value *Ptr, unsigned Idx0, const Twine &Name="")
FastMathFlags getFastMathFlags() const
Get the flags to be applied to created floating point ops.
LLVMContext & getContext() const
AllocaInst * CreateAlloca(Type *Ty, unsigned AddrSpace, Value *ArraySize=nullptr, const Twine &Name="")
static BinaryOperator * CreateNot(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Value * CreateICmpNE(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateIsNotNull(Value *Arg, const Twine &Name="")
Return an i1 value testing if Arg is not null.
Atomic ordering constants.
Value * CreateAddrSpaceCast(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateZExtOrTrunc(Value *V, Type *DestTy, const Twine &Name="")
Create a ZExt or Trunc from the integer value V to DestTy.
Compute iterated dominance frontiers using a linear time algorithm.
Value * CreateFPTrunc(Value *V, Type *DestTy, const Twine &Name="")
Type * getParamType(unsigned i) const
Parameter type accessors.
Value * CreateICmpULT(Value *LHS, Value *RHS, const Twine &Name="")
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value *> Args, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateXor(Value *LHS, Value *RHS, const Twine &Name="")
A Module instance is used to store all the information related to an LLVM module. ...
static ResumeInst * Create(Value *Exn, Instruction *InsertBefore=nullptr)
CallInst * CreateCall(Value *Callee, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="", MDNode *FPMathTag=nullptr)
An instruction for ordering other memory operations.
an instruction that atomically checks whether a specified value is in a memory location, and, if it is, stores a new value there.
CallInst * CreateElementUnorderedAtomicMemMove(Value *Dst, unsigned DstAlign, Value *Src, unsigned SrcAlign, uint64_t Size, uint32_t ElementSize, MDNode *TBAATag=nullptr, MDNode *TBAAStructTag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert an element unordered-atomic memmove between the specified pointers.
Value * CreateFCmpOLE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
bool isSet() const
Returns true if this insert point is set.
LoadInst * CreateLoad(Value *Ptr, bool isVolatile, const Twine &Name="")
Value * CreateShl(Value *LHS, uint64_t RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
static ConstantAggregateZero * get(Type *Ty)
Value * CreateNUWAdd(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateExtractInteger(const DataLayout &DL, Value *From, IntegerType *ExtractedTy, uint64_t Offset, const Twine &Name)
Return a value that has been extracted from a larger integer type.
static GetElementPtrInst * Create(Type *PointeeType, Value *Ptr, ArrayRef< Value *> IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Value * CreateICmpSLT(Value *LHS, Value *RHS, const Twine &Name="")
This class represents a function call, abstracting a target machine's calling convention.
void SetInsertPoint(BasicBlock *TheBB, BasicBlock::iterator IP)
This specifies that created instructions should be inserted at the specified point.
Value * CreateConstGEP2_32(Type *Ty, Value *Ptr, unsigned Idx0, unsigned Idx1, const Twine &Name="")
IRBuilder(BasicBlock *TheBB, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
0 1 0 0 True if ordered and less than
This instruction constructs a fixed permutation of two input vectors.
static SelectInst * Create(Value *C, Value *S1, Value *S2, const Twine &NameStr="", Instruction *InsertBefore=nullptr, Instruction *MDFrom=nullptr)
1 1 1 0 True if unordered or not equal
Value * CreateFRemFMF(Value *L, Value *R, Instruction *FMFSource, const Twine &Name="")
Copy fast-math-flags from an instruction rather than using the builder's default FMF.
struct LLVMOpaqueBuilder * LLVMBuilderRef
Represents an LLVM basic block builder.
Value * CreateSExt(Value *V, Type *DestTy, const Twine &Name="")
static CallInst * Create(Value *Func, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Value * CreateFCmpUGE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
CallInst * CreateMemSet(Value *Ptr, Value *Val, uint64_t Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert a memset to the specified pointer and the specified value.
An instruction for reading from memory.
Value * CreateFCmpUNO(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
static IntegerType * getInt64Ty(LLVMContext &C)
an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.
Value * CreateICmpULE(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateShuffleVector(Value *V1, Value *V2, ArrayRef< uint32_t > IntMask, const Twine &Name="")
static IntegerType * getInt16Ty(LLVMContext &C)
CallInst * CreateAlignmentAssumption(const DataLayout &DL, Value *PtrValue, Value *Alignment, Value *OffsetValue=nullptr)
Create an assume intrinsic call that represents an alignment assumption on the provided pointer...
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 * CreateLaunderInvariantGroup(Value *Ptr)
Create a launder.invariant.group intrinsic call.
Value * CreateNSWAdd(Value *LHS, Value *RHS, const Twine &Name="")
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
StoreInst * CreateAlignedStore(Value *Val, Value *Ptr, unsigned Align, bool isVolatile=false)
Value * CreateNot(Value *V, const Twine &Name="")
Value * CreateFCmpUGT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
static ReturnInst * Create(LLVMContext &C, Value *retVal=nullptr, Instruction *InsertBefore=nullptr)
IntegerType * getInt32Ty()
Fetch the type representing a 32-bit integer.
1 0 0 1 True if unordered or equal
Value * CreateOr(Value *LHS, uint64_t RHS, const Twine &Name="")
AllocaInst * CreateAlloca(Type *Ty, Value *ArraySize=nullptr, const Twine &Name="")
unsigned getAllocaAddrSpace() const
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
Value * CreateFRem(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
Value * CreateFPExt(Value *V, Type *DestTy, const Twine &Name="")
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
This class represents the LLVM 'select' instruction.
Value * CreatePtrDiff(Value *LHS, Value *RHS, const Twine &Name="")
Return the i64 difference between two pointer values, dividing out the size of the pointed-to objects...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Value * CreateAShr(Value *LHS, uint64_t RHS, const Twine &Name="", bool isExact=false)
IntegerType * getInt64Ty()
Fetch the type representing a 64-bit integer.
static Type * getFloatTy(LLVMContext &C)
LoadInst * CreateLoad(Value *Ptr, const Twine &Name="")
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
CleanupPadInst * CreateCleanupPad(Value *ParentPad, ArrayRef< Value *> Args=None, const Twine &Name="")
Value * CreateSExtOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
ReturnInst * CreateRet(Value *V)
Create a 'ret <val>' instruction.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
IntegerType * getIntPtrTy(const DataLayout &DL, unsigned AddrSpace=0)
Fetch the type representing a pointer to an integer value.
0 1 0 1 True if ordered and less than or equal
Value * CreateFAddFMF(Value *L, Value *R, Instruction *FMFSource, const Twine &Name="")
Copy fast-math-flags from an instruction rather than using the builder's default FMF.
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...
const DebugLoc & getCurrentDebugLocation() const
Get location information used by debugging information.
Value * CreateAdd(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
void setName(const Twine &Name)
Change the name of the value.
CallInst * CreateMemMove(Value *Dst, unsigned DstAlign, Value *Src, unsigned SrcAlign, uint64_t Size, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert a memmove between the specified pointers.
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.
AtomicOrdering
Atomic ordering for LLVM's memory model.
CatchReturnInst * CreateCatchRet(CatchPadInst *CatchPad, BasicBlock *BB)
StoreInst * CreateStore(Value *Val, Value *Ptr, bool isVolatile=false)
Value * CreateIntToPtr(Value *V, Type *DestTy, const Twine &Name="")
static Constant * getSizeOf(Type *Ty)
getSizeOf constant expr - computes the (alloc) size of a type (in address-units, not bits) in a targe...
Class to represent function types.
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
FastMathFlags getFastMathFlags() const
Convenience function for getting all the fast-math flags, which must be an operator which supports th...
Type * getType() const
All values are typed, get the type of this value.
Value * CreateSExtOrTrunc(Value *V, Type *DestTy, const Twine &Name="")
Create a SExt or Trunc from the integer value V to DestTy.
Value * CreateICmpUGT(Value *LHS, Value *RHS, const Twine &Name="")
BinOp
This enumeration lists the possible modifications atomicrmw can make.
BasicBlock * GetInsertBlock() const
void ClearInsertionPoint()
Clear the insertion point: created instructions will not be inserted into a block.
void SetInstDebugLocation(Instruction *I) const
If this builder has a current debug location, set it on the specified instruction.
This instruction compares its operands according to the predicate given to the constructor.
Value * CreateVectorSplat(unsigned NumElts, Value *V, const Twine &Name="")
Return a vector value that contains.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
ConstantFolder - Create constants with minimum, target independent, folding.
AtomicCmpXchgInst * CreateAtomicCmpXchg(Value *Ptr, Value *Cmp, Value *New, AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering, SyncScope::ID SSID=SyncScope::System)
Value * CreateSub(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Value * CreateSIToFP(Value *V, Type *DestTy, const Twine &Name="")
An instruction for storing to memory.
void SetCurrentDebugLocation(DebugLoc L)
Set location information used by debugging information.
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
Value * CreateZExt(Value *V, Type *DestTy, const Twine &Name="")
IRBuilder(LLVMContext &C, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
Value * CreateFCmpOEQ(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateZExtOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
amdgpu Simplify well known AMD library false Value * Callee
Function * getDeclaration(Module *M, ID id, ArrayRef< Type *> Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
static BinaryOperator * CreateAdd(Value *S1, Value *S2, const Twine &Name, Instruction *InsertBefore, Value *FlagsOp)
Value * CreateXor(Value *LHS, const APInt &RHS, const Twine &Name="")
void SetInsertPoint(BasicBlock *TheBB)
This specifies that created instructions should be appended to the end of the specified block...
ConstantInt * getIntN(unsigned N, uint64_t C)
Get a constant N-bit value, zero extended or truncated from a 64-bit value.
Class to represent pointers.
Type * getHalfTy()
Fetch the type representing a 16-bit floating point value.
CallInst * CreateMinNum(Value *LHS, Value *RHS, const Twine &Name="")
Create call to the minnum intrinsic.
Value * CreateFCmpUEQ(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateOr(Value *LHS, Value *RHS, const Twine &Name="")
IndirectBrInst * CreateIndirectBr(Value *Addr, unsigned NumDests=10)
Create an indirect branch instruction with the specified address operand, with an optional hint for t...
Value * CreateFCmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
InsertPoint saveAndClearIP()
Returns the current insert point, clearing it in the process.
LoadInst * CreateLoad(Value *Ptr, const char *Name)
Provided to resolve 'CreateLoad(Ptr, "...")' correctly, instead of converting the string to 'bool' fo...
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...
Type * getDoubleTy()
Fetch the type representing a 64-bit floating point value.
Type * getReturnType() const
Returns the type of the ret val.
void restoreIP(InsertPoint IP)
Sets the current insert point to a previously-saved location.
static IntegerType * getInt128Ty(LLVMContext &C)
The landingpad instruction holds all of the information necessary to generate correct exception handl...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
IntegerType * getInt128Ty()
Fetch the type representing a 128-bit integer.
Value * CreateFMul(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
Value * CreateAShr(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
InsertPoint(BasicBlock *InsertBlock, BasicBlock::iterator InsertPoint)
Creates a new insertion point at the given location.
IRBuilder(Instruction *IP, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
ConstantInt * getTrue()
Get the constant value for i1 true.
UnreachableInst * CreateUnreachable()
Conditional or Unconditional Branch instruction.
MDNode * getDefaultFPMathTag() const
Get the floating point math metadata being used.
size_t size() const
size - Get the array size.
This function has undefined behavior.
ConstantInt * getInt1(bool V)
Get a constant value representing either true or false.
Value * CreateExactSDiv(Value *LHS, Value *RHS, const Twine &Name="")
This is an important base class in LLVM.
InsertPoint saveIP() const
Returns the current insert point.
Resume the propagation of an exception.
Value * CreateShl(Value *LHS, const APInt &RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Value * CreateExactUDiv(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateSelect(Value *C, Value *True, Value *False, const Twine &Name="", Instruction *MDFrom=nullptr)
Indirect Branch Instruction.
Value * CreateNSWMul(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateFCmpOGT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateConstGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1, const Twine &Name="")
Value * CreateFPToUI(Value *V, Type *DestTy, const Twine &Name="")
CallInst * CreateMaxNum(Value *LHS, Value *RHS, const Twine &Name="")
Create call to the maxnum intrinsic.
LoadInst * CreateLoad(Type *Ty, Value *Ptr, const Twine &Name="")
static Type * getVoidTy(LLVMContext &C)
CatchSwitchInst * CreateCatchSwitch(Value *ParentPad, BasicBlock *UnwindBB, unsigned NumHandlers, const Twine &Name="")
Value * CreateFSubFMF(Value *L, Value *R, Instruction *FMFSource, const Twine &Name="")
Copy fast-math-flags from an instruction rather than using the builder's default FMF.
Value * CreateFDivFMF(Value *L, Value *R, Instruction *FMFSource, const Twine &Name="")
Copy fast-math-flags from an instruction rather than using the builder's default FMF.
VAArgInst * CreateVAArg(Value *List, Type *Ty, const Twine &Name="")
Value * CreateNeg(Value *V, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
This instruction compares its operands according to the predicate given to the constructor.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
IRBuilder(BasicBlock *TheBB, const T &F, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
Value * CreateICmpSGE(Value *LHS, Value *RHS, const Twine &Name="")
A specialization of it's base class for read-write access to a gc.statepoint.
0 1 1 1 True if ordered (no nans)
static CastInst * CreatePointerBitCastOrAddrSpaceCast(Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd)
Create a BitCast or an AddrSpaceCast cast instruction.
void clearFastMathFlags()
Clear the fast-math flags.
CallInst * CreateCall(Function *Callee, ArrayRef< Value *> Args, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateICmpEQ(Value *LHS, Value *RHS, const Twine &Name="")
self_iterator getIterator()
Class to represent integer types.
ConstantInt * getInt64(uint64_t C)
Get a constant 64-bit value.
static CastInst * CreatePointerCast(Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd)
Create a BitCast AddrSpaceCast, or a PtrToInt cast instruction.
IntegerType * getIntNTy(unsigned N)
Fetch the type representing an N-bit integer.
Value * CreateExtractElement(Value *Vec, Value *Idx, const Twine &Name="")
LoadInst * CreateAlignedLoad(Value *Ptr, unsigned Align, bool isVolatile, const Twine &Name="")
IRBuilderCallbackInserter(std::function< void(Instruction *)> Callback)
void setAlignment(unsigned Align)
Constant * Insert(Constant *C, const Twine &="") const
No-op overload to handle constants.
AtomicRMWInst * CreateAtomicRMW(AtomicRMWInst::BinOp Op, Value *Ptr, Value *Val, AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System)
NUW NUW NUW NUW Exact static Exact BinaryOperator * CreateNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Helper functions to construct and inspect unary operations (NEG and NOT) via binary operators SUB and...
InsertPointGuard(IRBuilderBase &B)
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
Value * CreateLShr(Value *LHS, const APInt &RHS, const Twine &Name="", bool isExact=false)
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
void SetInsertPoint(Instruction *I)
This specifies that created instructions should be inserted before the specified instruction.
const T & getFolder()
Get the constant folder being used.
Value * CreateExtractValue(Value *Agg, ArrayRef< unsigned > Idxs, const Twine &Name="")
static CastInst * CreateZExtOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a ZExt or BitCast cast instruction.
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.
1 1 0 1 True if unordered, less than, or equal
void setMetadata(unsigned KindID, MDNode *Node)
Set the metadata of the specified kind to the specified node.
Value * CreateMul(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
LLVM_READONLY APFloat maxnum(const APFloat &A, const APFloat &B)
Implements IEEE maxNum semantics.
Value * CreateTrunc(Value *V, Type *DestTy, const Twine &Name="")
static IndirectBrInst * Create(Value *Address, unsigned NumDests, Instruction *InsertBefore=nullptr)
static InvokeInst * Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
Value * CreateLShr(Value *LHS, uint64_t RHS, const Twine &Name="", bool isExact=false)
Value * CreateSRem(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateFCmpUNE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateUIToFP(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateFCmpOGE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateConstGEP1_64(Value *Ptr, uint64_t Idx0, const Twine &Name="")
This provides the default implementation of the IRBuilder 'InsertHelper' method that is called whenev...
PHINode * CreatePHI(Type *Ty, unsigned NumReservedValues, const Twine &Name="")
Value * CreateGEP(Value *Ptr, ArrayRef< Value *> IdxList, const Twine &Name="")
Value * CreateFCmpOLT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
0 0 1 0 True if ordered and greater than
static BinaryOperator * CreateFNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
static Type * getHalfTy(LLVMContext &C)
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
const InstListType & getInstList() const
Return the underlying instruction list container.
void setHasNoSignedWrap(bool b=true)
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag...
static CastInst * CreateIntegerCast(Value *S, Type *Ty, bool isSigned, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a ZExt, BitCast, or Trunc for int -> int casts.
This is the shared class of boolean and integer constants.
ResumeInst * CreateResume(Value *Exn)
InsertPoint - A saved insertion point.
static CleanupPadInst * Create(Value *ParentPad, ArrayRef< Value *> Args=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static CatchSwitchInst * Create(Value *ParentPad, BasicBlock *UnwindDest, unsigned NumHandlers, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static SwitchInst * Create(Value *Value, BasicBlock *Default, unsigned NumCases, Instruction *InsertBefore=nullptr)
Value * CreateIsNull(Value *Arg, const Twine &Name="")
Return an i1 value testing if Arg is null.
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type...
InvokeInst * CreateInvoke(Value *Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="")
Value * CreateIntCast(Value *V, Type *DestTy, bool isSigned, const Twine &Name="")
Value * CreateNUWNeg(Value *V, const Twine &Name="")
Value * CreateICmpUGE(Value *LHS, Value *RHS, const Twine &Name="")
CallInst * CreateElementUnorderedAtomicMemSet(Value *Ptr, Value *Val, uint64_t Size, unsigned Align, uint32_t ElementSize, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert an element unordered-atomic memset of the region of memory starting at the given po...
1 1 0 0 True if unordered or less than
Module.h This file contains the declarations for the Module class.
Value * CreateInsertElement(Value *Vec, Value *NewElt, Value *Idx, const Twine &Name="")
FastMathFlagGuard(IRBuilderBase &B)
IRBuilderBase(LLVMContext &context, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
Value * CreateFCmpORD(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
ConstantInt * getInt32(uint32_t C)
Get a constant 32-bit value.
static CastInst * CreateFPCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create an FPExt, BitCast, or FPTrunc for fp -> fp casts.
Value * CreateExtractElement(Value *Vec, uint64_t Idx, const Twine &Name="")
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
Value * CreateFCmpONE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateShuffleVector(Value *V1, Value *V2, Value *Mask, const Twine &Name="")
CallInst * CreateMemCpy(Value *Dst, unsigned DstAlign, Value *Src, unsigned SrcAlign, uint64_t Size, 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 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...
Value * CreateConstInBoundsGEP1_64(Value *Ptr, uint64_t Idx0, const Twine &Name="")
Value * CreateURem(Value *LHS, Value *RHS, const Twine &Name="")
static ConstantInt * getTrue(LLVMContext &Context)
Value handle that asserts if the Value is deleted.
Constant * 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...
ArrayRef< OperandBundleDef > DefaultOperandBundles
FunctionType * getFunctionType() const
Returns the FunctionType for me.
Value * CreateFPCast(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateAnd(Value *LHS, uint64_t RHS, const Twine &Name="")
Class for arbitrary precision integers.
BasicBlock::iterator getPoint() const
Value * CreateGEP(Value *Ptr, Value *Idx, const Twine &Name="")
Value * CreateSDiv(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
Value * CreateUDiv(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
Value * CreateNUWMul(Value *LHS, Value *RHS, const Twine &Name="")
static BinaryOperator * Create(BinaryOps Op, Value *S1, Value *S2, const Twine &Name=Twine(), Instruction *InsertBefore=nullptr)
Construct a binary instruction, given the opcode and the two operands.
Value * CreatePointerBitCastOrAddrSpaceCast(Value *V, Type *DestTy, const Twine &Name="")
InstListType::iterator iterator
Instruction iterators...
IntegerType * getInt8Ty()
Fetch the type representing an 8-bit integer.
Value * CreateShl(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Value * CreatePointerCast(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateConstInBoundsGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1, const Twine &Name="")
static CatchPadInst * Create(Value *CatchSwitch, ArrayRef< Value *> Args, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
amdgpu Simplify well known AMD library false Value Value * Arg
ConstantInt * getFalse()
Get the constant value for i1 false.
MDNode * DefaultFPMathTag
LoadInst * CreateAlignedLoad(Value *Ptr, unsigned Align, const Twine &Name="")
IntegerType * getInt1Ty()
Fetch the type representing a single bit.
Value * CreateBitOrPointerCast(Value *V, Type *DestTy, const Twine &Name="")
SwitchInst * CreateSwitch(Value *V, BasicBlock *Dest, unsigned NumCases=10, MDNode *BranchWeights=nullptr, MDNode *Unpredictable=nullptr)
Create a switch instruction with the specified value, default dest, and with a hint for the number of...
Value * CreateTruncOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateNUWSub(Value *LHS, Value *RHS, const Twine &Name="")
ReturnInst * CreateRetVoid()
Create a 'ret void' instruction.
static CastInst * Create(Instruction::CastOps, Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Provides a way to construct any of the CastInst subclasses using an opcode instead of the subclass's ...
Value * CreateFCmpULT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateGEP(Type *Ty, Value *Ptr, Value *Idx, const Twine &Name="")
Value * CreateGEP(Type *Ty, Value *Ptr, ArrayRef< Value *> IdxList, const Twine &Name="")
Provides an 'InsertHelper' that calls a user-provided callback after performing the default insertion...
iterator insert(iterator where, pointer New)
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
FenceInst * CreateFence(AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System, const Twine &Name="")
static IntegerType * getInt32Ty(LLVMContext &C)
Value * CreateXor(Value *LHS, uint64_t RHS, const Twine &Name="")
static CastInst * CreateTruncOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a Trunc or BitCast cast instruction.
CatchPadInst * CreateCatchPad(Value *ParentPad, ArrayRef< Value *> Args, const Twine &Name="")
unsigned greater or equal
static InsertValueInst * Create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static bool isSigned(Value *V)
Can the given value generate sign bits.
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant *> IdxList)
Create an "inbounds" getelementptr.
CleanupReturnInst * CreateCleanupRet(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB=nullptr)
Value * CreateFSub(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
Value * CreateInBoundsGEP(Type *Ty, Value *Ptr, ArrayRef< Value *> IdxList, const Twine &Name="")
0 1 1 0 True if ordered and operands are unequal
Value * CreateStripInvariantGroup(Value *Ptr)
Create a strip.invariant.group intrinsic call.
Value * CreateConstInBoundsGEP2_32(Type *Ty, Value *Ptr, unsigned Idx0, unsigned Idx1, const Twine &Name="")
Value * CreateFPToSI(Value *V, Type *DestTy, const Twine &Name="")
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Type * getValueType() const
void setDefaultFPMathTag(MDNode *FPMathTag)
Set the floating point math metadata to be used.
static BinaryOperator * CreateNeg(Value *S1, const Twine &Name, Instruction *InsertBefore, Value *FlagsOp)
Type * getFloatTy()
Fetch the type representing a 32-bit floating point value.
1 0 1 0 True if unordered or greater than
Value * CreateFAdd(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
void InsertHelper(Instruction *I, const Twine &Name, BasicBlock *BB, BasicBlock::iterator InsertPt) const
LandingPadInst * CreateLandingPad(Type *Ty, unsigned NumClauses, const Twine &Name="")
Value * CreateAnd(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreatePtrToInt(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateFDiv(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
InstTy * Insert(InstTy *I, const Twine &Name="") const
Insert and return the specified instruction.
void setHasNoUnsignedWrap(bool b=true)
Set or clear the nuw flag on this instruction, which must be an operator which supports this flag...
Synchronized with respect to all concurrently executing threads.
Value * CreateCast(Instruction::CastOps Op, Value *V, Type *DestTy, const Twine &Name="")
static CastInst * CreateSExtOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a SExt or BitCast cast instruction.
static GetElementPtrInst * CreateInBounds(Value *Ptr, ArrayRef< Value *> IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Create an "inbounds" getelementptr.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Value * CreateAnd(Value *LHS, const APInt &RHS, const Twine &Name="")
ReturnInst * CreateAggregateRet(Value *const *retVals, unsigned N)
Create a sequence of N insertvalue instructions, with one Value from the retVals array each...
Value * CreateFMulFMF(Value *L, Value *R, Instruction *FMFSource, const Twine &Name="")
Copy fast-math-flags from an instruction rather than using the builder's default FMF.
LoadInst * CreateAlignedLoad(Value *Ptr, unsigned Align, const char *Name)
Provided to resolve 'CreateAlignedLoad(Ptr, Align, "...")' correctly, instead of converting the strin...
static CatchReturnInst * Create(Value *CatchPad, BasicBlock *BB, Instruction *InsertBefore=nullptr)
0 0 0 1 True if ordered and equal
LLVM Value Representation.
void setAlignment(unsigned Align)
1 0 1 1 True if unordered, greater than, or equal
uint64_t getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
BranchInst * CreateCondBr(Value *Cond, BasicBlock *True, BasicBlock *False, Instruction *MDSrc)
Create a conditional 'br Cond, TrueDest, FalseDest' instruction.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
BranchInst * CreateBr(BasicBlock *Dest)
Create an unconditional 'br label X' instruction.
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
void copyMetadata(const Instruction &SrcInst, ArrayRef< unsigned > WL=ArrayRef< unsigned >())
Copy metadata from SrcInst to this instruction.
static CleanupReturnInst * Create(Value *CleanupPad, BasicBlock *UnwindBB=nullptr, Instruction *InsertBefore=nullptr)
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
void InsertHelper(Instruction *I, const Twine &Name, BasicBlock *BB, BasicBlock::iterator InsertPt) const
void setFastMathFlags(FastMathFlags NewFMF)
Set the fast-math flags to be used with generated fp-math operators.
BasicBlock::iterator GetInsertPoint() const
Value * CreateLShr(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
Value * CreateStructGEP(Type *Ty, Value *Ptr, unsigned Idx, const Twine &Name="")
ConstantInt * getInt8(uint8_t C)
Get a constant 8-bit value.
print Print MemDeps of function
Convenience struct for specifying and reasoning about fast-math flags.
StringRef - Represent a constant reference to a string, i.e.
Value * CreateNSWSub(Value *LHS, Value *RHS, const Twine &Name="")
static bool isVolatile(Instruction *Inst)
CallInst * CreateElementUnorderedAtomicMemCpy(Value *Dst, unsigned DstAlign, Value *Src, unsigned SrcAlign, uint64_t Size, uint32_t ElementSize, MDNode *TBAATag=nullptr, MDNode *TBAAStructTag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert an element unordered-atomic memcpy between the specified pointers.
IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
Value * CreateInsertValue(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &Name="")
static Constant * get(LLVMContext &Context, ArrayRef< uint8_t > Elts)
get() constructors - Return a constant with vector type with an element count and element type matchi...
IRBuilder(LLVMContext &C, const T &F, Inserter I=Inserter(), MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles=None)
ConstantInt * getInt(const APInt &AI)
Get a constant integer value.
static BinaryOperator * CreateMul(Value *S1, Value *S2, const Twine &Name, Instruction *InsertBefore, Value *FlagsOp)
BasicBlock * getBlock() const
InvokeInst * CreateInvoke(Value *Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value *> Args=None, const Twine &Name="")
Create an invoke instruction.
0 0 1 1 True if ordered and greater than or equal
Value * CreateICmpSLE(Value *LHS, Value *RHS, const Twine &Name="")
static IntegerType * getInt8Ty(LLVMContext &C)
BasicBlock::iterator InsertPt
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Value * CreateFNeg(Value *V, const Twine &Name="", MDNode *FPMathTag=nullptr)
LLVM_READONLY APFloat minnum(const APFloat &A, const APFloat &B)
Implements IEEE minNum semantics.
Value * CreateOr(Value *LHS, const APInt &RHS, const Twine &Name="")
const BasicBlock * getParent() const
an instruction to allocate memory on the stack
Value * CreateFCmpULE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
CallInst * CreateCall(Value *Callee, ArrayRef< Value *> Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateStructGEP(Value *Ptr, unsigned Idx, const Twine &Name="")