LLVM: include/llvm/IR/IRBuilder.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_IR_IRBUILDER_H

15#define LLVM_IR_IRBUILDER_H

16

45#include

46#include

47#include

48#include

49#include

50

51namespace llvm {

52

55

56

57

58

59

60

62public:

64

67 if (InsertPt.isValid())

68 I->insertInto(InsertPt.getNodeParent(), InsertPt);

69 I->setName(Name);

70 }

71};

72

73

74

76 std::function<void(Instruction *)> Callback;

77

78public:

80

82 : Callback(std::move(Callback)) {}

83

89};

90

91

92

94 std::optional FMF;

95

96public:

99 if (Source)

100 FMF = Source->getFastMathFlags();

101 }

104 return FMF.value_or(Default);

105 }

106

111};

112

113

115

116

117

119

120

122

123

124

125 void AddOrRemoveMetadataToCopy(unsigned Kind, MDNode *MD) {

126 assert(Kind != LLVMContext::MD_dbg &&

127 "MD_dbg metadata must be stored in StoredDL");

128

129 if (!MD) {

130 erase_if(MetadataToCopy, [Kind](const std::pair<unsigned, MDNode *> &KV) {

131 return KV.first == Kind;

132 });

133 return;

134 }

135

136 for (auto &KV : MetadataToCopy)

137 if (KV.first == Kind) {

138 KV.second = MD;

139 return;

140 }

141

142 MetadataToCopy.emplace_back(Kind, MD);

143 }

144

145protected:

151

154

158

160

161public:

169

170

171 template

172 InstTy *Insert(InstTy *I, const Twine &Name = "") const {

175 return I;

176 }

177

178

182

189

190

191

192

193

194

195

200

204

205

206

211

212

213

215 BB = I->getParent();

217 assert(InsertPt != BB->end() && "Can't read debug loc from end()");

219 }

220

221

222

224 BB = TheBB;

226 if (IP != TheBB->end())

228 }

229

230

231

233 BB = IP->getParent();

236 }

237

238

239

240

242 BB = &F->getEntryBlock();

243 InsertPt = BB->getFirstNonPHIOrDbgOrAlloca();

244 }

245

246

248

249

250 StoredDL = std::move(L);

251 }

252

253

255 AddOrRemoveMetadataToCopy(llvm::LLVMContext::MD_nosanitize,

257 }

258

259

260

261

264 for (unsigned K : MetadataKinds) {

265 if (K == LLVMContext::MD_dbg)

267 else

268 AddOrRemoveMetadataToCopy(K, Src->getMetadata(K));

269 }

270 }

271

272

274

275

276

278

279

281 for (const auto &KV : MetadataToCopy)

282 I->setMetadata(KV.first, KV.second);

284 }

285

286

287

289

290

294

295 public:

296

298

299

302

303

304 bool isSet() const { return (Block != nullptr); }

305

308 };

309

310

314

315

321

322

329

330

332

333

335

337

338

340

341

343

344

346

347

348

349

350

352

353

355

356

358#ifndef NDEBUG

359 std::optional ExceptStr =

361 assert(ExceptStr && "Garbage strict exception behavior!");

362#endif

364 }

365

366

368#ifndef NDEBUG

369 std::optional RoundingStr =

371 assert(RoundingStr && "Garbage strict rounding mode!");

372#endif

374 }

375

376

380

381

385

387 assert(BB && "Must have a basic block to set any function attributes!");

388

390 if (F->hasFnAttribute(Attribute::StrictFP)) {

391 F->addFnAttr(Attribute::StrictFP);

392 }

393 }

394

396 I->addFnAttr(Attribute::StrictFP);

397 }

398

402

403

404

405

406

407

408

414

415 public:

419

422

424 Builder.restoreIP(InsertPoint(Block, Point));

425 Builder.SetCurrentDebugLocation(DbgLoc);

426 }

427 };

428

429

430

435 bool IsFPConstrained;

438

439 public:

442 IsFPConstrained(B.IsFPConstrained),

443 DefaultConstrainedExcept(B.DefaultConstrainedExcept),

444 DefaultConstrainedRounding(B.DefaultConstrainedRounding) {}

445

448

450 Builder.FMF = FMF;

451 Builder.DefaultFPMathTag = FPMathTag;

452 Builder.IsFPConstrained = IsFPConstrained;

453 Builder.DefaultConstrainedExcept = DefaultConstrainedExcept;

454 Builder.DefaultConstrainedRounding = DefaultConstrainedRounding;

455 }

456 };

457

458

459

463

464 public:

466 : Builder(B), DefaultOperandBundles(B.DefaultOperandBundles) {}

467

470

472 Builder.DefaultOperandBundles = DefaultOperandBundles;

473 }

474 };

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

491 const Twine &Name = "",

494 bool AddNull = true);

495

496

498 return ConstantInt::get(getInt1Ty(), V);

499 }

500

501

505

506

510

511

513 return ConstantInt::get(getInt8Ty(), C);

514 }

515

516

520

521

525

526

530

531

532

536

537

539 return ConstantInt::get(Context, AI);

540 }

541

542

543

544

545

546

550

551

555

556

560

561

565

566

570

571

573

574

578

579

583

584

588

589

593

594

598

599

603

604

608

609

610

612 return DL.getIntPtrType(Context, AddrSpace);

613 }

614

615

616

618 return DL.getIndexType(Context, AddrSpace);

619 }

620

621

622

623

624

625

626

627

628

629

635

639

642 bool IsVolatile = false,

644

645

646

647

648

649

657

662 const Twine &Name = "");

663

664

665

666

667

668

672 const Twine &Name = "");

673

676

679 Align Alignment, uint32_t ElementSize,

680 const AAMDNodes &AAInfo = AAMDNodes());

681

682

683

684

685

686

689 bool isVolatile = false,

692 isVolatile, AAInfo);

693 }

694

698 bool isVolatile = false,

700

703 bool isVolatile = false,

706 SrcAlign, Size, isVolatile, AAInfo);

707 }

708

711 bool isVolatile = false,

714 SrcAlign, Size, isVolatile, AAInfo);

715 }

716

717

718

719

720

721

722

723

724

728

731 bool isVolatile = false,

734 isVolatile, AAInfo);

735 }

736

739 bool isVolatile = false,

742 SrcAlign, Size, isVolatile, AAInfo);

743 }

744

745

746

747

748

749

750

751

752

756

757private:

759

760public:

761

762

763

764

766

767

768

769

770

772

773

775

776

778

779

781

782

784

785

787

788

789

791

792

793

795

796

797

799

800

801

803

804

805

806

808

809

810

811

813

814

816

817

819

820

821

822

825

826

828

829

831 Value *Mask, Value *PassThru = nullptr,

832 const Twine &Name = "");

833

834

837

838

840 Value *Mask = nullptr,

841 Value *PassThru = nullptr,

842 const Twine &Name = "");

843

844

847 Value *Mask = nullptr);

848

849

852 Value *Mask = nullptr,

853 Value *PassThru = nullptr,

854 const Twine &Name = "");

855

856

859 Value *Mask = nullptr);

860

861

866

867

868

869

870

871

874

875

881

882

883

888

889

890

898

899

900

901

907

908

909

916

917

918

924 const Twine &Name = "");

925

926

927

928

935

936

937

939 const Twine &Name = "");

940

941

942

944 int DerivedOffset, Type *ResultType,

945 const Twine &Name = "");

946

947

948

950 const Twine &Name = "");

951

952

953

955 const Twine &Name = "");

956

957

961

962

963

964

966

967

968

969

971

972

974

975

976

979 const Twine &Name = "");

980

981

982

984 Value *RHS, FMFSource FMFSource = {},

985 const Twine &Name = "");

986

987

988

989

992 FMFSource FMFSource = {},

993 const Twine &Name = "");

994

995

996

997

1000 FMFSource FMFSource = {},

1001 const Twine &Name = "");

1002

1003

1004

1005

1010

1011

1013 const Twine &Name = "") {

1016 Intrinsic::experimental_constrained_minnum, LHS, RHS, FMFSource,

1017 Name);

1018 }

1019

1021 }

1022

1023

1025 const Twine &Name = "") {

1028 Intrinsic::experimental_constrained_maxnum, LHS, RHS, FMFSource,

1029 Name);

1030 }

1031

1033 }

1034

1035

1039

1040

1044

1045

1050

1051

1056

1057

1059 const Twine &Name = "") {

1061 Name);

1062 }

1063

1064

1066 const Twine &Name = "") {

1068 return CreateIntrinsic(Intrinsic::ldexp, {Src->getType(), Exp->getType()},

1069 {Src, Exp}, FMFSource, Name);

1070 }

1071

1072

1077 Intrinsic::experimental_constrained_fma, {Factor1->getType()},

1078 {Factor1, Factor2, Summand}, FMFSource, Name);

1079 }

1080

1082 {Factor1, Factor2, Summand}, FMFSource, Name);

1083 }

1084

1085

1087 const Twine &Name = "") {

1088 return CreateIntrinsic(Intrinsic::arithmetic_fence, DstType, Val, nullptr,

1089 Name);

1090 }

1091

1092

1094 const Twine &Name = "") {

1096 {DstType, SrcVec->getType()}, {SrcVec, Idx}, nullptr,

1097 Name);

1098 }

1099

1100

1102 const Twine &Name = "") {

1104 }

1105

1106

1108 Value *Idx, const Twine &Name = "") {

1110 {DstType, SubVec->getType()}, {SrcVec, SubVec, Idx},

1111 nullptr, Name);

1112 }

1113

1114

1119

1120

1124 {}, nullptr, Name);

1125 }

1126

1127

1130 nullptr, Name);

1131 }

1132

1133

1135 bool ZeroIsPoison = true,

1136 const Twine &Name = "") {

1137 return CreateIntrinsic(Intrinsic::experimental_cttz_elts,

1138 {ResTy, Mask->getType()},

1139 {Mask, getInt1(ZeroIsPoison)}, nullptr, Name);

1140 }

1141

1142private:

1143

1146 const Twine &Name = "");

1147

1148

1149

1150

1151

1152private:

1153

1154

1155

1156 template

1157 InstTy *addBranchMetadata(InstTy *I, MDNode *Weights, MDNode *Unpredictable) {

1158 if (Weights)

1159 I->setMetadata(LLVMContext::MD_prof, Weights);

1160 if (Unpredictable)

1161 I->setMetadata(LLVMContext::MD_unpredictable, Unpredictable);

1162 return I;

1163 }

1164

1165public:

1166

1170

1171

1175

1176

1177

1178

1179

1180

1181

1182

1185 for (unsigned i = 0; i != N; ++i)

1188 }

1189

1190

1194

1195

1196

1198 MDNode *BranchWeights = nullptr,

1199 MDNode *Unpredictable = nullptr) {

1201 BranchWeights, Unpredictable));

1202 }

1203

1204

1205

1209 if (MDSrc) {

1210 unsigned WL[4] = {LLVMContext::MD_prof, LLVMContext::MD_unpredictable,

1211 LLVMContext::MD_make_implicit, LLVMContext::MD_dbg};

1213 }

1215 }

1216

1217

1218

1219

1221 MDNode *BranchWeights = nullptr,

1222 MDNode *Unpredictable = nullptr) {

1224 BranchWeights, Unpredictable));

1225 }

1226

1227

1228

1229

1233

1234

1239 const Twine &Name = "") {

1241 InvokeInst::Create(Ty, Callee, NormalDest, UnwindDest, Args, OpBundles);

1245 }

1249 const Twine &Name = "") {

1255 }

1256

1260 const Twine &Name = "") {

1261 return CreateInvoke(Callee.getFunctionType(), Callee.getCallee(),

1262 NormalDest, UnwindDest, Args, OpBundles, Name);

1263 }

1264

1267 const Twine &Name = "") {

1268 return CreateInvoke(Callee.getFunctionType(), Callee.getCallee(),

1269 NormalDest, UnwindDest, Args, Name);

1270 }

1271

1272

1277 const Twine &Name = "") {

1279 Args), Name);

1280 }

1286 const Twine &Name = "") {

1289 OpBundles), Name);

1290 }

1291

1295 const Twine &Name = "") {

1296 return CreateCallBr(Callee.getFunctionType(), Callee.getCallee(),

1297 DefaultDest, IndirectDests, Args, Name);

1298 }

1303 const Twine &Name = "") {

1304 return CreateCallBr(Callee.getFunctionType(), Callee.getCallee(),

1305 DefaultDest, IndirectDests, Args, Name);

1306 }

1307

1311

1316

1318 unsigned NumHandlers,

1319 const Twine &Name = "") {

1321 Name);

1322 }

1323

1325 const Twine &Name = "") {

1327 }

1328

1331 const Twine &Name = "") {

1333 }

1334

1338

1342

1343

1344

1345

1346private:

1349 const Twine &Name,

1350 bool HasNUW, bool HasNSW) {

1354 return BO;

1355 }

1356

1357 Instruction *setFPAttrs(Instruction *I, MDNode *FPMD,

1358 FastMathFlags FMF) const {

1359 if (!FPMD)

1361 if (FPMD)

1362 I->setMetadata(LLVMContext::MD_fpmath, FPMD);

1363 I->setFastMathFlags(FMF);

1364 return I;

1365 }

1366

1367 Value *getConstrainedFPRounding(std::optional Rounding) {

1369

1370 if (Rounding)

1372

1373 std::optional RoundingStr =

1375 assert(RoundingStr && "Garbage strict rounding mode!");

1377

1379 }

1380

1381 Value *getConstrainedFPExcept(std::optionalfp::ExceptionBehavior Except) {

1384 assert(ExceptStr && "Garbage strict exception behavior!");

1386

1388 }

1389

1394 "Invalid constrained FP comparison predicate!");

1395

1398

1400 }

1401

1402public:

1404 bool HasNUW = false, bool HasNSW = false) {

1406 Folder.FoldNoWrapBinOp(Instruction::Add, LHS, RHS, HasNUW, HasNSW))

1407 return V;

1408 return CreateInsertNUWNSWBinOp(Instruction::Add, LHS, RHS, Name, HasNUW,

1409 HasNSW);

1410 }

1411

1415

1419

1421 bool HasNUW = false, bool HasNSW = false) {

1423 Folder.FoldNoWrapBinOp(Instruction::Sub, LHS, RHS, HasNUW, HasNSW))

1424 return V;

1425 return CreateInsertNUWNSWBinOp(Instruction::Sub, LHS, RHS, Name, HasNUW,

1426 HasNSW);

1427 }

1428

1432

1436

1438 bool HasNUW = false, bool HasNSW = false) {

1440 Folder.FoldNoWrapBinOp(Instruction::Mul, LHS, RHS, HasNUW, HasNSW))

1441 return V;

1442 return CreateInsertNUWNSWBinOp(Instruction::Mul, LHS, RHS, Name, HasNUW,

1443 HasNSW);

1444 }

1445

1449

1453

1455 bool isExact = false) {

1456 if (Value *V = Folder.FoldExactBinOp(Instruction::UDiv, LHS, RHS, isExact))

1457 return V;

1458 if (!isExact)

1459 return Insert(BinaryOperator::CreateUDiv(LHS, RHS), Name);

1460 return Insert(BinaryOperator::CreateExactUDiv(LHS, RHS), Name);

1461 }

1462

1466

1468 bool isExact = false) {

1469 if (Value *V = Folder.FoldExactBinOp(Instruction::SDiv, LHS, RHS, isExact))

1470 return V;

1471 if (!isExact)

1472 return Insert(BinaryOperator::CreateSDiv(LHS, RHS), Name);

1473 return Insert(BinaryOperator::CreateExactSDiv(LHS, RHS), Name);

1474 }

1475

1479

1482 return V;

1483 return Insert(BinaryOperator::CreateURem(LHS, RHS), Name);

1484 }

1485

1488 return V;

1489 return Insert(BinaryOperator::CreateSRem(LHS, RHS), Name);

1490 }

1491

1493 bool HasNUW = false, bool HasNSW = false) {

1495 Folder.FoldNoWrapBinOp(Instruction::Shl, LHS, RHS, HasNUW, HasNSW))

1496 return V;

1497 return CreateInsertNUWNSWBinOp(Instruction::Shl, LHS, RHS, Name,

1498 HasNUW, HasNSW);

1499 }

1500

1502 bool HasNUW = false, bool HasNSW = false) {

1504 HasNUW, HasNSW);

1505 }

1506

1508 bool HasNUW = false, bool HasNSW = false) {

1510 HasNUW, HasNSW);

1511 }

1512

1514 bool isExact = false) {

1515 if (Value *V = Folder.FoldExactBinOp(Instruction::LShr, LHS, RHS, isExact))

1516 return V;

1517 if (!isExact)

1518 return Insert(BinaryOperator::CreateLShr(LHS, RHS), Name);

1519 return Insert(BinaryOperator::CreateExactLShr(LHS, RHS), Name);

1520 }

1521

1523 bool isExact = false) {

1524 return CreateLShr(LHS, ConstantInt::get(LHS->getType(), RHS), Name,isExact);

1525 }

1526

1528 bool isExact = false) {

1529 return CreateLShr(LHS, ConstantInt::get(LHS->getType(), RHS), Name,isExact);

1530 }

1531

1533 bool isExact = false) {

1534 if (Value *V = Folder.FoldExactBinOp(Instruction::AShr, LHS, RHS, isExact))

1535 return V;

1536 if (!isExact)

1537 return Insert(BinaryOperator::CreateAShr(LHS, RHS), Name);

1538 return Insert(BinaryOperator::CreateExactAShr(LHS, RHS), Name);

1539 }

1540

1542 bool isExact = false) {

1543 return CreateAShr(LHS, ConstantInt::get(LHS->getType(), RHS), Name,isExact);

1544 }

1545

1547 bool isExact = false) {

1548 return CreateAShr(LHS, ConstantInt::get(LHS->getType(), RHS), Name,isExact);

1549 }

1550

1552 if (auto *V = Folder.FoldBinOp(Instruction::And, LHS, RHS))

1553 return V;

1554 return Insert(BinaryOperator::CreateAnd(LHS, RHS), Name);

1555 }

1556

1560

1564

1568 for (unsigned i = 1; i < Ops.size(); i++)

1570 return Accum;

1571 }

1572

1574 bool IsDisjoint = false) {

1575 if (auto *V = Folder.FoldBinOp(Instruction::Or, LHS, RHS))

1576 return V;

1579 : BinaryOperator::CreateOr(LHS, RHS),

1580 Name);

1581 }

1582

1586

1590

1594 for (unsigned i = 1; i < Ops.size(); i++)

1596 return Accum;

1597 }

1598

1601 return V;

1602 return Insert(BinaryOperator::CreateXor(LHS, RHS), Name);

1603 }

1604

1608

1612

1614 MDNode *FPMD = nullptr) {

1616 }

1617

1619 const Twine &Name = "", MDNode *FPMD = nullptr) {

1623

1626 return V;

1628 setFPAttrs(BinaryOperator::CreateFAdd(L, R), FPMD, FMFSource.get(FMF));

1630 }

1631

1633 MDNode *FPMD = nullptr) {

1635 }

1636

1638 const Twine &Name = "", MDNode *FPMD = nullptr) {

1642

1645 return V;

1647 setFPAttrs(BinaryOperator::CreateFSub(L, R), FPMD, FMFSource.get(FMF));

1649 }

1650

1652 MDNode *FPMD = nullptr) {

1654 }

1655

1657 const Twine &Name = "", MDNode *FPMD = nullptr) {

1661

1664 return V;

1666 setFPAttrs(BinaryOperator::CreateFMul(L, R), FPMD, FMFSource.get(FMF));

1668 }

1669

1671 MDNode *FPMD = nullptr) {

1673 }

1674

1676 const Twine &Name = "", MDNode *FPMD = nullptr) {

1680

1683 return V;

1685 setFPAttrs(BinaryOperator::CreateFDiv(L, R), FPMD, FMFSource.get(FMF));

1687 }

1688

1690 MDNode *FPMD = nullptr) {

1692 }

1693

1695 const Twine &Name = "", MDNode *FPMD = nullptr) {

1699

1702 return V;

1704 setFPAttrs(BinaryOperator::CreateFRem(L, R), FPMD, FMFSource.get(FMF));

1706 }

1707

1710 MDNode *FPMathTag = nullptr) {

1712 }

1713

1716 MDNode *FPMathTag = nullptr) {

1718 return V;

1722 return Insert(BinOp, Name);

1723 }

1724

1732

1737 Cond2, Name, MDFrom);

1738 }

1739

1741 const Twine &Name = "") {

1742 switch (Opc) {

1743 case Instruction::And:

1745 case Instruction::Or:

1747 default:

1748 break;

1749 }

1751 }

1752

1753

1757 for (unsigned i = 1; i < Ops.size(); i++)

1759 return Accum;

1760 }

1761

1762

1763

1764

1765

1766

1770 std::optional Rounding = std::nullopt,

1771 std::optionalfp::ExceptionBehavior Except = std::nullopt);

1772

1775 const Twine &Name = "", MDNode *FPMathTag = nullptr,

1776 std::optional Rounding = std::nullopt,

1777 std::optionalfp::ExceptionBehavior Except = std::nullopt);

1778

1780 Intrinsic::ID ID, Value *L, Value *R, FMFSource FMFSource = {},

1781 const Twine &Name = "", MDNode *FPMathTag = nullptr,

1782 std::optionalfp::ExceptionBehavior Except = std::nullopt);

1783

1788

1792

1794 MDNode *FPMathTag = nullptr) {

1796 }

1797

1799 MDNode *FPMathTag = nullptr) {

1800 if (Value *Res =

1802 return Res;

1804 setFPAttrs(UnaryOperator::CreateFNeg(V), FPMathTag, FMFSource.get(FMF)),

1805 Name);

1806 }

1807

1811

1814 MDNode *FPMathTag = nullptr) {

1816 return Res;

1819 setFPAttrs(UnOp, FPMathTag, FMF);

1820 return Insert(UnOp, Name);

1821 }

1822

1823

1824

1826 const Twine &Name = "",

1827 MDNode *FPMathTag = nullptr);

1828

1829

1830

1831

1832

1834 Value *ArraySize = nullptr, const Twine &Name = "") {

1836 Align AllocaAlign = DL.getPrefTypeAlign(Ty);

1837 return Insert(new AllocaInst(Ty, AddrSpace, ArraySize, AllocaAlign), Name);

1838 }

1839

1841 const Twine &Name = "") {

1843 Align AllocaAlign = DL.getPrefTypeAlign(Ty);

1844 unsigned AddrSpace = DL.getAllocaAddrSpace();

1845 return Insert(new AllocaInst(Ty, AddrSpace, ArraySize, AllocaAlign), Name);

1846 }

1847

1848

1849

1853

1857

1859 const Twine &Name = "") {

1861 }

1862

1866

1868 const char *Name) {

1870 }

1871

1873 const Twine &Name = "") {

1875 }

1876

1878 bool isVolatile, const Twine &Name = "") {

1881 Align = DL.getABITypeAlign(Ty);

1882 }

1884 }

1885

1887 bool isVolatile = false) {

1891 }

1893 }

1896 const Twine &Name = "") {

1898 }

1899

1908 }

1909

1911 FailureOrdering, SSID));

1912 }

1913

1925

1927 const Twine &Name = "",

1929 if (auto *V = Folder.FoldGEP(Ty, Ptr, IdxList, NW))

1930 return V;

1932 }

1933

1935 const Twine &Name = "") {

1937 }

1938

1940 const Twine &Name = "") {

1942

1944 return V;

1945

1947 }

1948

1950 const Twine &Name = "") {

1952

1954 return V;

1955

1957 }

1958

1960 const Twine &Name = "",

1962 Value *Idxs[] = {

1965 };

1966

1967 if (auto *V = Folder.FoldGEP(Ty, Ptr, Idxs, NWFlags))

1968 return V;

1969

1971 }

1972

1974 unsigned Idx1, const Twine &Name = "") {

1975 Value *Idxs[] = {

1978 };

1979

1981 return V;

1982

1984 }

1985

1987 const Twine &Name = "") {

1989

1991 return V;

1992

1994 }

1995

1997 const Twine &Name = "") {

1999

2001 return V;

2002

2004 }

2005

2007 const Twine &Name = "") {

2008 Value *Idxs[] = {

2011 };

2012

2014 return V;

2015

2017 }

2018

2021 Value *Idxs[] = {

2024 };

2025

2027 return V;

2028

2030 }

2031

2033 const Twine &Name = "") {

2037 }

2038

2043

2045 const Twine &Name = "") {

2048 }

2049

2050

2051

2052

2053

2054

2055 LLVM_DEPRECATED("Use CreateGlobalString instead", "CreateGlobalString")

2058 Module *M = nullptr, bool AddNull = true) {

2062 Constant *Indices[] = {Zero, Zero};

2064 Indices);

2065 }

2066

2067

2068

2069

2070

2072 bool IsNUW = false, bool IsNSW = false) {

2073 if (V->getType() == DestTy)

2074 return V;

2075 if (Value *Folded = Folder.FoldCast(Instruction::Trunc, V, DestTy))

2076 return Folded;

2078 if (IsNUW)

2079 I->setHasNoUnsignedWrap();

2080 if (IsNSW)

2081 I->setHasNoSignedWrap();

2083 }

2084

2086 bool IsNonNeg = false) {

2087 if (V->getType() == DestTy)

2088 return V;

2089 if (Value *Folded = Folder.FoldCast(Instruction::ZExt, V, DestTy))

2090 return Folded;

2092 if (IsNonNeg)

2093 I->setNonNeg();

2094 return I;

2095 }

2096

2098 return CreateCast(Instruction::SExt, V, DestTy, Name);

2099 }

2100

2101

2102

2104 const Twine &Name = "") {

2105 assert(V->getType()->isIntOrIntVectorTy() &&

2107 "Can only zero extend/truncate integers!");

2108 Type *VTy = V->getType();

2113 return V;

2114 }

2115

2116

2117

2119 const Twine &Name = "") {

2120 assert(V->getType()->isIntOrIntVectorTy() &&

2122 "Can only sign extend/truncate integers!");

2123 Type *VTy = V->getType();

2128 return V;

2129 }

2130

2134 V, DestTy, nullptr, Name);

2135 return CreateCast(Instruction::FPToUI, V, DestTy, Name);

2136 }

2137

2141 V, DestTy, nullptr, Name);

2142 return CreateCast(Instruction::FPToSI, V, DestTy, Name);

2143 }

2144

2146 bool IsNonNeg = false) {

2149 V, DestTy, nullptr, Name);

2150 if (Value *Folded = Folder.FoldCast(Instruction::UIToFP, V, DestTy))

2151 return Folded;

2153 if (IsNonNeg)

2154 I->setNonNeg();

2155 return I;

2156 }

2157

2161 V, DestTy, nullptr, Name);

2162 return CreateCast(Instruction::SIToFP, V, DestTy, Name);

2163 }

2164

2166 MDNode *FPMathTag = nullptr) {

2168 }

2169

2171 const Twine &Name = "", MDNode *FPMathTag = nullptr) {

2174 Intrinsic::experimental_constrained_fptrunc, V, DestTy, FMFSource,

2175 Name, FPMathTag);

2176 return CreateCast(Instruction::FPTrunc, V, DestTy, Name, FPMathTag,

2178 }

2179

2181 MDNode *FPMathTag = nullptr) {

2182 return CreateFPExtFMF(V, DestTy, {}, Name, FPMathTag);

2183 }

2184

2186 const Twine &Name = "", MDNode *FPMathTag = nullptr) {

2189 V, DestTy, FMFSource, Name, FPMathTag);

2190 return CreateCast(Instruction::FPExt, V, DestTy, Name, FPMathTag,

2192 }

2194 return CreateCast(Instruction::PtrToAddr, V,

2195 BB->getDataLayout().getAddressType(V->getType()), Name);

2196 }

2198 const Twine &Name = "") {

2199 return CreateCast(Instruction::PtrToInt, V, DestTy, Name);

2200 }

2201

2203 const Twine &Name = "") {

2204 return CreateCast(Instruction::IntToPtr, V, DestTy, Name);

2205 }

2206

2208 const Twine &Name = "") {

2209 return CreateCast(Instruction::BitCast, V, DestTy, Name);

2210 }

2211

2213 const Twine &Name = "") {

2214 return CreateCast(Instruction::AddrSpaceCast, V, DestTy, Name);

2215 }

2216

2220 ? Instruction::BitCast

2221 : Instruction::ZExt;

2222 return CreateCast(CastOp, V, DestTy, Name);

2223 }

2224

2228 ? Instruction::BitCast

2229 : Instruction::SExt;

2230 return CreateCast(CastOp, V, DestTy, Name);

2231 }

2232

2236 ? Instruction::BitCast

2237 : Instruction::Trunc;

2238 return CreateCast(CastOp, V, DestTy, Name);

2239 }

2240

2242 const Twine &Name = "", MDNode *FPMathTag = nullptr,

2244 if (V->getType() == DestTy)

2245 return V;

2247 return Folded;

2251 return Insert(Cast, Name);

2252 }

2253

2255 const Twine &Name = "") {

2256 if (V->getType() == DestTy)

2257 return V;

2259 return Insert(Folder.CreatePointerCast(VC, DestTy), Name);

2261 }

2262

2263

2264

2265

2267 const Twine &Name = "") {

2268 if (V->getType() == DestTy)

2269 return V;

2270

2272 return Insert(Folder.CreatePointerBitCastOrAddrSpaceCast(VC, DestTy),

2273 Name);

2274 }

2275

2277 Name);

2278 }

2279

2281 const Twine &Name = "") {

2284 ? Instruction::Trunc

2285 : (isSigned ? Instruction::SExt : Instruction::ZExt);

2286 return CreateCast(CastOp, V, DestTy, Name);

2287 }

2288

2290 const Twine &Name = "") {

2291 if (V->getType() == DestTy)

2292 return V;

2293 if (V->getType()->isPtrOrPtrVectorTy() && DestTy->isIntOrIntVectorTy())

2295 if (V->getType()->isIntOrIntVectorTy() && DestTy->isPtrOrPtrVectorTy())

2297

2299 }

2300

2302 MDNode *FPMathTag = nullptr) {

2305 ? Instruction::FPTrunc

2306 : Instruction::FPExt;

2307 return CreateCast(CastOp, V, DestTy, Name, FPMathTag);

2308 }

2309

2312 const Twine &Name = "", MDNode *FPMathTag = nullptr,

2313 std::optional Rounding = std::nullopt,

2314 std::optionalfp::ExceptionBehavior Except = std::nullopt);

2315

2316

2317

2318

2320

2321

2322

2323

2324

2325

2327

2328

2329

2330

2331

2335

2339

2343

2347

2351

2355

2359

2363

2367

2371

2373 MDNode *FPMathTag = nullptr) {

2375 }

2376

2378 MDNode *FPMathTag = nullptr) {

2380 }

2381

2383 MDNode *FPMathTag = nullptr) {

2385 }

2386

2388 MDNode *FPMathTag = nullptr) {

2390 }

2391

2393 MDNode *FPMathTag = nullptr) {

2395 }

2396

2398 MDNode *FPMathTag = nullptr) {

2400 }

2401

2403 MDNode *FPMathTag = nullptr) {

2405 }

2406

2408 MDNode *FPMathTag = nullptr) {

2410 }

2411

2413 MDNode *FPMathTag = nullptr) {

2415 }

2416

2418 MDNode *FPMathTag = nullptr) {

2420 }

2421

2423 MDNode *FPMathTag = nullptr) {

2425 }

2426

2428 MDNode *FPMathTag = nullptr) {

2430 }

2431

2433 MDNode *FPMathTag = nullptr) {

2435 }

2436

2438 MDNode *FPMathTag = nullptr) {

2440 }

2441

2443 const Twine &Name = "") {

2445 return V;

2447 }

2448

2449

2450

2451

2453 const Twine &Name = "", MDNode *FPMathTag = nullptr) {

2454 return CreateFCmpHelper(P, LHS, RHS, Name, FPMathTag, {}, false);

2455 }

2456

2457

2458

2459

2462 MDNode *FPMathTag = nullptr) {

2463 return CreateFCmpHelper(P, LHS, RHS, Name, FPMathTag, FMFSource, false);

2464 }

2465

2467 const Twine &Name = "", MDNode *FPMathTag = nullptr) {

2471 }

2472

2473

2474

2475

2477 const Twine &Name = "", MDNode *FPMathTag = nullptr) {

2478 return CreateFCmpHelper(P, LHS, RHS, Name, FPMathTag, {}, true);

2479 }

2480

2481private:

2482

2486

2487public:

2490 const Twine &Name = "",

2491 std::optionalfp::ExceptionBehavior Except = std::nullopt);

2492

2493

2494

2495

2496

2498 const Twine &Name = "") {

2501 setFPAttrs(Phi, nullptr , FMF);

2502 return Insert(Phi, Name);

2503 }

2504

2505private:

2509

2510public:

2513 MDNode *FPMathTag = nullptr) {

2518 setFPAttrs(CI, FPMathTag, FMF);

2519 return Insert(CI, Name);

2520 }

2521

2524 const Twine &Name = "", MDNode *FPMathTag = nullptr) {

2529 setFPAttrs(CI, FPMathTag, FMF);

2530 return Insert(CI, Name);

2531 }

2532

2534 const Twine &Name = "", MDNode *FPMathTag = nullptr) {

2535 return CreateCall(Callee.getFunctionType(), Callee.getCallee(), Args, Name,

2536 FPMathTag);

2537 }

2538

2541 const Twine &Name = "", MDNode *FPMathTag = nullptr) {

2542 return CreateCall(Callee.getFunctionType(), Callee.getCallee(), Args,

2543 OpBundles, Name, FPMathTag);

2544 }

2545

2548 std::optional Rounding = std::nullopt,

2549 std::optionalfp::ExceptionBehavior Except = std::nullopt);

2550

2554 const Twine &Name = "");

2555

2557 const Twine &Name = "",

2562

2566

2568 const Twine &Name = "") {

2569 if (Value *V = Folder.FoldExtractElement(Vec, Idx))

2570 return V;

2572 }

2573

2575 const Twine &Name = "") {

2577 }

2578

2580 const Twine &Name = "") {

2582 }

2583

2585 const Twine &Name = "") {

2587 }

2588

2590 const Twine &Name = "") {

2591 if (Value *V = Folder.FoldInsertElement(Vec, NewElt, Idx))

2592 return V;

2594 }

2595

2597 const Twine &Name = "") {

2599 }

2600

2602 const Twine &Name = "") {

2606 }

2607

2608

2610 const Twine &Name = "") {

2611 if (Value *V = Folder.FoldShuffleVector(V1, V2, Mask))

2612 return V;

2614 }

2615

2616

2617

2619 const Twine &Name = "") {

2621 }

2622

2624 const Twine &Name = "");

2625

2627 const Twine &Name = "") {

2628 if (auto *V = Folder.FoldExtractValue(Agg, Idxs))

2629 return V;

2631 }

2632

2634 const Twine &Name = "") {

2635 if (auto *V = Folder.FoldInsertValue(Agg, Val, Idxs))

2636 return V;

2638 }

2639

2641 const Twine &Name = "") {

2643 }

2644

2648

2649

2650

2651

2652

2653

2657

2658

2662

2663

2667

2668

2673

2674

2675

2676

2677

2678

2679

2681 const Twine &Name = "");

2682

2683

2684

2685

2687

2688

2689

2690

2692

2693

2695

2696

2697

2698

2699

2700

2701

2702

2704 const Twine &Name = "");

2705

2706

2707

2709 const Twine &Name = "");

2710

2711

2712

2714 const Twine &Name = "");

2715

2717 unsigned Dimension,

2718 unsigned LastIndex,

2720

2722 unsigned FieldIndex,

2724

2726 unsigned Index,

2727 unsigned FieldIndex,

2729

2731

2732private:

2733

2734

2735

2738 Value *OffsetValue);

2739

2740public:

2741

2742

2743

2744

2745

2746

2748 Value *PtrValue,

2749 unsigned Alignment,

2750 Value *OffsetValue = nullptr);

2751

2752

2753

2754

2755

2756

2757

2758

2759

2760

2762 Value *PtrValue,

2763 Value *Alignment,

2764 Value *OffsetValue = nullptr);

2765

2766

2767

2769 Value *SizeValue);

2770};

2771

2772

2773

2774

2775

2776

2777

2778

2779

2780

2781

2782

2783

2784

2785

2786template <typename FolderTy = ConstantFolder,

2787 typename InserterTy = IRBuilderDefaultInserter>

2789private:

2790 FolderTy Folder;

2791 InserterTy Inserter;

2792

2793public:

2795 MDNode *FPMathTag = nullptr,

2799

2804

2808

2810 MDNode *FPMathTag = nullptr,

2813 FPMathTag, OpBundles),

2816 }

2817

2821 FPMathTag, OpBundles) {

2823 }

2824

2831

2833 MDNode *FPMathTag = nullptr,

2836 FPMathTag, OpBundles),

2839 }

2840

2842 MDNode *FPMathTag = nullptr,

2845 FPMathTag, OpBundles) {

2847 }

2848

2849

2850

2852

2854 const InserterTy &getInserter() const { return Inserter; }

2855};

2856

2857template <typename FolderTy, typename InserterTy>

2861template

2866template

2871

2872

2873

2875

2876}

2877

2878#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

Atomic ordering constants.

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)

#define LLVM_DEPRECATED(MSG, FIX)

This file contains the declarations for the subclasses of Constant, which represent the different fla...

static bool isSigned(unsigned int Opcode)

This file contains the declarations of entities that describe floating point environment and related ...

const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]

uint64_t IntrinsicInst * II

const SmallVectorImpl< MachineOperand > & Cond

static const char PassName[]

Class for arbitrary precision integers.

an instruction to allocate memory on the stack

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

Value handle that asserts if the Value is deleted.

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.

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="")

Conditional or Unconditional Branch instruction.

static BranchInst * Create(BasicBlock *IfTrue, InsertPosition InsertBefore=nullptr)

Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...

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)

static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList)

Create an "inbounds" getelementptr.

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.

Definition IRBuilder.h:93

FMFSource(Instruction *Source)

Definition IRBuilder.h:98

FastMathFlags get(FastMathFlags Default) const

Definition IRBuilder.h:103

FMFSource(FastMathFlags FMF)

Definition IRBuilder.h:102

static FMFSource intersect(Value *A, Value *B)

Intersect the FMF from two instructions.

Definition IRBuilder.h:107

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)

static GetElementPtrInst * CreateInBounds(Type *PointeeType, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Create an "inbounds" getelementptr.

Type * getValueType() const

This instruction compares its operands according to the predicate given to the constructor.

~FastMathFlagGuard()

Definition IRBuilder.h:449

FastMathFlagGuard(const FastMathFlagGuard &)=delete

FastMathFlagGuard(IRBuilderBase &B)

Definition IRBuilder.h:440

FastMathFlagGuard & operator=(const FastMathFlagGuard &)=delete

InsertPointGuard(IRBuilderBase &B)

Definition IRBuilder.h:416

InsertPointGuard & operator=(const InsertPointGuard &)=delete

InsertPointGuard(const InsertPointGuard &)=delete

~InsertPointGuard()

Definition IRBuilder.h:423

InsertPoint - A saved insertion point.

Definition IRBuilder.h:291

InsertPoint(BasicBlock *InsertBlock, BasicBlock::iterator InsertPoint)

Creates a new insertion point at the given location.

Definition IRBuilder.h:300

BasicBlock * getBlock() const

Definition IRBuilder.h:306

InsertPoint()=default

Creates a new insertion point which doesn't point to anything.

bool isSet() const

Returns true if this insert point is set.

Definition IRBuilder.h:304

BasicBlock::iterator getPoint() const

Definition IRBuilder.h:307

OperandBundlesGuard(const OperandBundlesGuard &)=delete

OperandBundlesGuard(IRBuilderBase &B)

Definition IRBuilder.h:465

~OperandBundlesGuard()

Definition IRBuilder.h:471

OperandBundlesGuard & operator=(const OperandBundlesGuard &)=delete

Common base class shared among various IRBuilders.

Definition IRBuilder.h:114

Value * CreateExactSDiv(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:1476

Value * CreateZExtOrBitCast(Value *V, Type *DestTy, const Twine &Name="")

Definition IRBuilder.h:2217

Value * CreateFCmpONE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2397

Value * CreateLdexp(Value *Src, Value *Exp, FMFSource FMFSource={}, const Twine &Name="")

Create call to the ldexp intrinsic.

Definition IRBuilder.h:1065

ConstantInt * getInt1(bool V)

Get a constant value representing either true or false.

Definition IRBuilder.h:497

Value * CreateFCmpS(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2476

BasicBlock * BB

Definition IRBuilder.h:146

Value * CreateNUWMul(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:1450

CleanupPadInst * CreateCleanupPad(Value *ParentPad, ArrayRef< Value * > Args={}, const Twine &Name="")

Definition IRBuilder.h:1329

LLVM_ABI Value * CreatePtrDiff(Type *ElemTy, Value *LHS, Value *RHS, const Twine &Name="")

Return the i64 difference between two pointer values, dividing out the size of the pointed-to objects...

LLVM_ABI CallInst * CreateMulReduce(Value *Src)

Create a vector int mul reduction intrinsic of the source vector.

Value * CreateFSubFMF(Value *L, Value *R, FMFSource FMFSource, const Twine &Name="", MDNode *FPMD=nullptr)

Definition IRBuilder.h:1637

LLVM_ABI CallInst * CreateFAddReduce(Value *Acc, Value *Src)

Create a sequential vector fadd reduction intrinsic of the source vector.

Value * CreateICmpULT(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:2348

Value * CreateFPTruncFMF(Value *V, Type *DestTy, FMFSource FMFSource, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2170

Value * CreateConstGEP1_64(Type *Ty, Value *Ptr, uint64_t Idx0, const Twine &Name="")

Definition IRBuilder.h:1986

RoundingMode DefaultConstrainedRounding

Definition IRBuilder.h:157

LLVM_ABI Value * CreateLaunderInvariantGroup(Value *Ptr)

Create a launder.invariant.group intrinsic call.

CallInst * CreateExtractVector(Type *DstType, Value *SrcVec, Value *Idx, const Twine &Name="")

Create a call to the vector.extract intrinsic.

Definition IRBuilder.h:1093

Value * CreateFCmpUGE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2422

Value * CreateInsertElement(Type *VecTy, Value *NewElt, uint64_t Idx, const Twine &Name="")

Definition IRBuilder.h:2584

Value * CreateSRem(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:1486

LoadInst * CreateAlignedLoad(Type *Ty, Value *Ptr, MaybeAlign Align, const Twine &Name="")

Definition IRBuilder.h:1872

Value * CreateFSub(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)

Definition IRBuilder.h:1632

Value * CreateFCmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2452

CatchPadInst * CreateCatchPad(Value *ParentPad, ArrayRef< Value * > Args, const Twine &Name="")

Definition IRBuilder.h:1324

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="")

Definition IRBuilder.h:2579

void SetNoSanitizeMetadata()

Set nosanitize metadata.

Definition IRBuilder.h:254

Value * CreateLShr(Value *LHS, uint64_t RHS, const Twine &Name="", bool isExact=false)

Definition IRBuilder.h:1527

AtomicCmpXchgInst * CreateAtomicCmpXchg(Value *Ptr, Value *Cmp, Value *New, MaybeAlign Align, AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering, SyncScope::ID SSID=SyncScope::System)

Definition IRBuilder.h:1901

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="")

Definition IRBuilder.h:1939

AllocaInst * CreateAlloca(Type *Ty, unsigned AddrSpace, Value *ArraySize=nullptr, const Twine &Name="")

Definition IRBuilder.h:1833

void setDefaultOperandBundles(ArrayRef< OperandBundleDef > OpBundles)

Definition IRBuilder.h:399

CallInst * CreateStackSave(const Twine &Name="")

Create a call to llvm.stacksave.

Definition IRBuilder.h:1121

InvokeInst * CreateInvoke(FunctionCallee Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="")

Definition IRBuilder.h:1257

IntegerType * getInt1Ty()

Fetch the type representing a single bit.

Definition IRBuilder.h:547

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="")

Definition IRBuilder.h:2633

Value * CreateAnd(ArrayRef< Value * > Ops)

Definition IRBuilder.h:1565

IndirectBrInst * CreateIndirectBr(Value *Addr, unsigned NumDests=10)

Create an indirect branch instruction with the specified address operand, with an optional hint for t...

Definition IRBuilder.h:1230

BranchInst * CreateCondBr(Value *Cond, BasicBlock *True, BasicBlock *False, Instruction *MDSrc)

Create a conditional 'br Cond, TrueDest, FalseDest' instruction.

Definition IRBuilder.h:1206

Value * CreateAnd(Value *LHS, const APInt &RHS, const Twine &Name="")

Definition IRBuilder.h:1557

void setDefaultFPMathTag(MDNode *FPMathTag)

Set the floating point math metadata to be used.

Definition IRBuilder.h:342

LLVM_ABI Type * getCurrentFunctionReturnType() const

Get the return type of the current function that we're emitting into.

CallInst * CreateCall(FunctionCallee Callee, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2539

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)

Definition IRBuilder.h:1670

LLVM_ABI CallInst * CreateLifetimeStart(Value *Ptr)

Create a lifetime.start intrinsic.

CallInst * CreateInsertVector(Type *DstType, Value *SrcVec, Value *SubVec, Value *Idx, const Twine &Name="")

Create a call to the vector.insert intrinsic.

Definition IRBuilder.h:1107

Value * CreateLShr(Value *LHS, const APInt &RHS, const Twine &Name="", bool isExact=false)

Definition IRBuilder.h:1522

void clearFastMathFlags()

Clear the fast-math flags.

Definition IRBuilder.h:339

bool IsFPConstrained

Definition IRBuilder.h:155

Value * CreateSIToFP(Value *V, Type *DestTy, const Twine &Name="")

Definition IRBuilder.h:2158

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.

LoadInst * CreateLoad(Type *Ty, Value *Ptr, bool isVolatile, const Twine &Name="")

Definition IRBuilder.h:1858

Value * CreateLogicalOr(ArrayRef< Value * > Ops)

Definition IRBuilder.h:1754

Value * CreateExtractElement(Value *Vec, Value *Idx, const Twine &Name="")

Definition IRBuilder.h:2567

Value * CreateLogicalOp(Instruction::BinaryOps Opc, Value *Cond1, Value *Cond2, const Twine &Name="")

Definition IRBuilder.h:1740

IntegerType * getIntNTy(unsigned N)

Fetch the type representing an N-bit integer.

Definition IRBuilder.h:575

void setDefaultConstrainedExcept(fp::ExceptionBehavior NewExcept)

Set the exception handling to be used with constrained floating point.

Definition IRBuilder.h:357

Value * CreateICmpSGT(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:2356

LLVM_ABI CallInst * CreateLifetimeEnd(Value *Ptr)

Create a lifetime.end intrinsic.

LoadInst * CreateAlignedLoad(Type *Ty, Value *Ptr, MaybeAlign Align, const char *Name)

Definition IRBuilder.h:1867

Value * CreateFCmpORD(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2402

Type * getDoubleTy()

Fetch the type representing a 64-bit floating point value.

Definition IRBuilder.h:595

Value * CreateZExtOrTrunc(Value *V, Type *DestTy, const Twine &Name="")

Create a ZExt or Trunc from the integer value V to DestTy.

Definition IRBuilder.h:2103

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.

Definition IRBuilder.h:687

Value * CreateFAdd(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)

Definition IRBuilder.h:1613

UnreachableInst * CreateUnreachable()

Definition IRBuilder.h:1339

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)

LLVM_ABI CallInst * CreateAndReduce(Value *Src)

Create a vector int AND reduction intrinsic of the source vector.

Value * CreateFPTrunc(Value *V, Type *DestTy, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2165

LLVM_ABI Value * CreateVectorSplice(Value *V1, Value *V2, int64_t Imm, const Twine &Name="")

Return a vector splice intrinsic if using scalable vectors, otherwise return a shufflevector.

LLVM_ABI CallInst * CreateAssumption(Value *Cond, ArrayRef< OperandBundleDef > OpBundles={})

Create an assume intrinsic call that allows the optimizer to assume that the provided condition will ...

Value * CreatePointerCast(Value *V, Type *DestTy, const Twine &Name="")

Definition IRBuilder.h:2254

void setDefaultConstrainedRounding(RoundingMode NewRounding)

Set the rounding mode handling to be used with constrained floating point.

Definition IRBuilder.h:367

Value * CreatePtrToAddr(Value *V, const Twine &Name="")

Definition IRBuilder.h:2193

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)

Definition IRBuilder.h:1689

Value * CreateExtractValue(Value *Agg, ArrayRef< unsigned > Idxs, const Twine &Name="")

Definition IRBuilder.h:2626

Value * CreateAnd(Value *LHS, uint64_t RHS, const Twine &Name="")

Definition IRBuilder.h:1561

ConstantInt * getTrue()

Get the constant value for i1 true.

Definition IRBuilder.h:502

Value * Insert(Value *V, const Twine &Name="") const

Definition IRBuilder.h:183

LandingPadInst * CreateLandingPad(Type *Ty, unsigned NumClauses, const Twine &Name="")

Definition IRBuilder.h:2640

Value * CreateFPExtFMF(Value *V, Type *DestTy, FMFSource FMFSource, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2185

Value * CreateMaximum(Value *LHS, Value *RHS, const Twine &Name="")

Create call to the maximum intrinsic.

Definition IRBuilder.h:1041

LLVM_ABI Value * CreatePreserveStructAccessIndex(Type *ElTy, Value *Base, unsigned Index, unsigned FieldIndex, MDNode *DbgInfo)

LLVM_ABI 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.

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="")

Definition IRBuilder.h:2360

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)

LLVMContext & Context

Definition IRBuilder.h:148

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.

Definition IRBuilder.h:1235

RoundingMode getDefaultConstrainedRounding()

Get the rounding mode handling used with constrained floating point.

Definition IRBuilder.h:382

Value * CreateFPToUI(Value *V, Type *DestTy, const Twine &Name="")

Definition IRBuilder.h:2131

Value * CreateConstGEP2_64(Type *Ty, Value *Ptr, uint64_t Idx0, uint64_t Idx1, const Twine &Name="")

Definition IRBuilder.h:2006

Value * CreateFCmpUNE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2437

BasicBlock::iterator GetInsertPoint() const

Definition IRBuilder.h:202

Value * CreateStructGEP(Type *Ty, Value *Ptr, unsigned Idx, const Twine &Name="")

Definition IRBuilder.h:2032

FenceInst * CreateFence(AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System, const Twine &Name="")

Definition IRBuilder.h:1894

IntegerType * getIndexTy(const DataLayout &DL, unsigned AddrSpace)

Fetch the type of an integer that should be used to index GEP operations within AddressSpace.

Definition IRBuilder.h:617

CallBrInst * CreateCallBr(FunctionCallee Callee, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="")

Definition IRBuilder.h:1299

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.

Definition IRBuilder.h:377

Value * CreateSExt(Value *V, Type *DestTy, const Twine &Name="")

Definition IRBuilder.h:2097

Value * CreateSExtOrBitCast(Value *V, Type *DestTy, const Twine &Name="")

Definition IRBuilder.h:2225

Value * CreateFCmpUGT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2417

Value * CreateIntToPtr(Value *V, Type *DestTy, const Twine &Name="")

Definition IRBuilder.h:2202

LLVM_ABI CallInst * CreateAddReduce(Value *Src)

Create a vector int add reduction intrinsic of the source vector.

Value * CreateFreeze(Value *V, const Twine &Name="")

Definition IRBuilder.h:2645

BasicBlock::iterator InsertPt

Definition IRBuilder.h:147

CallBrInst * CreateCallBr(FunctionType *Ty, Value *Callee, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args={}, const Twine &Name="")

Create a callbr instruction.

Definition IRBuilder.h:1273

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)

Definition IRBuilder.h:1513

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...

Definition IRBuilder.h:611

IntegerType * getInt32Ty()

Fetch the type representing a 32-bit integer.

Definition IRBuilder.h:562

Value * CreateConstInBoundsGEP1_32(Type *Ty, Value *Ptr, unsigned Idx0, const Twine &Name="")

Definition IRBuilder.h:1949

LLVM_ABI Value * CreateAggregateCast(Value *V, Type *DestTy)

Cast between aggregate types that must have identical structure but may differ in their leaf types.

CallInst * CreateIntrinsic(Intrinsic::ID ID, ArrayRef< Value * > Args, FMFSource FMFSource={}, const Twine &Name="")

Create a call to non-overloaded intrinsic ID with Args.

Definition IRBuilder.h:1006

ConstantInt * getInt8(uint8_t C)

Get a constant 8-bit value.

Definition IRBuilder.h:512

Value * CreatePtrAdd(Value *Ptr, Value *Offset, const Twine &Name="", GEPNoWrapFlags NW=GEPNoWrapFlags::none())

Definition IRBuilder.h:2039

Value * CreateCast(Instruction::CastOps Op, Value *V, Type *DestTy, const Twine &Name="", MDNode *FPMathTag=nullptr, FMFSource FMFSource={})

Definition IRBuilder.h:2241

Value * CreateIsNotNeg(Value *Arg, const Twine &Name="")

Return a boolean value testing if Arg > -1.

Definition IRBuilder.h:2669

CatchReturnInst * CreateCatchRet(CatchPadInst *CatchPad, BasicBlock *BB)

Definition IRBuilder.h:1335

CleanupReturnInst * CreateCleanupRet(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB=nullptr)

Definition IRBuilder.h:1312

Value * CreateUIToFP(Value *V, Type *DestTy, const Twine &Name="", bool IsNonNeg=false)

Definition IRBuilder.h:2145

ReturnInst * CreateRet(Value *V)

Create a 'ret ' instruction.

Definition IRBuilder.h:1172

Value * CreateNSWAdd(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:1412

bool getIsFPConstrained()

Query for the use of constrained floating point math.

Definition IRBuilder.h:354

Value * CreateVScale(Type *Ty, const Twine &Name="")

Create a call to llvm.vscale.().

Definition IRBuilder.h:958

Value * CreateAShr(Value *LHS, uint64_t RHS, const Twine &Name="", bool isExact=false)

Definition IRBuilder.h:1546

BasicBlock * GetInsertBlock() const

Definition IRBuilder.h:201

Type * getHalfTy()

Fetch the type representing a 16-bit floating point value.

Definition IRBuilder.h:580

void setFastMathFlags(FastMathFlags NewFMF)

Set the fast-math flags to be used with generated fp-math operators.

Definition IRBuilder.h:345

Value * CreateFCmpOLT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2387

void SetCurrentDebugLocation(DebugLoc L)

Set location information used by debugging information.

Definition IRBuilder.h:247

void SetInsertPointPastAllocas(Function *F)

This specifies that created instructions should inserted at the beginning end of the specified functi...

Definition IRBuilder.h:241

IntegerType * getInt64Ty()

Fetch the type representing a 64-bit integer.

Definition IRBuilder.h:567

Value * CreateInBoundsGEP(Type *Ty, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name="")

Definition IRBuilder.h:1934

Value * CreateNSWMul(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:1446

InsertPoint saveAndClearIP()

Returns the current insert point, clearing it in the process.

Definition IRBuilder.h:316

Value * CreateOr(Value *LHS, const APInt &RHS, const Twine &Name="")

Definition IRBuilder.h:1583

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="")

Definition IRBuilder.h:2266

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.

Definition IRBuilder.h:2618

LLVM_ABI CallInst * CreateXorReduce(Value *Src)

Create a vector int XOR reduction intrinsic of the source vector.

Value * CreateAShr(Value *LHS, const APInt &RHS, const Twine &Name="", bool isExact=false)

Definition IRBuilder.h:1541

Value * CreateUDiv(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)

Definition IRBuilder.h:1454

Value * CreateFCmpULE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2432

FastMathFlags FMF

Definition IRBuilder.h:153

Value * CreateICmpNE(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:2336

Value * CreateNUWAdd(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:1416

IntegerType * getInt16Ty()

Fetch the type representing a 16-bit integer.

Definition IRBuilder.h:557

Value * CreateFCmpFMF(CmpInst::Predicate P, Value *LHS, Value *RHS, FMFSource FMFSource, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2460

Value * CreateGEP(Type *Ty, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name="", GEPNoWrapFlags NW=GEPNoWrapFlags::none())

Definition IRBuilder.h:1926

ConstantInt * getInt64(uint64_t C)

Get a constant 64-bit value.

Definition IRBuilder.h:527

CallInst * CreateMemMove(Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, uint64_t Size, bool isVolatile=false, const AAMDNodes &AAInfo=AAMDNodes())

Definition IRBuilder.h:729

CatchSwitchInst * CreateCatchSwitch(Value *ParentPad, BasicBlock *UnwindBB, unsigned NumHandlers, const Twine &Name="")

Definition IRBuilder.h:1317

Value * getAllOnesMask(ElementCount NumElts)

Return an all true boolean vector (mask) with NumElts lanes.

Definition IRBuilder.h:862

Value * CreateUnOp(Instruction::UnaryOps Opc, Value *V, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:1812

Value * CreateNeg(Value *V, const Twine &Name="", bool HasNSW=false)

Definition IRBuilder.h:1784

LoadInst * CreateLoad(Type *Ty, Value *Ptr, const Twine &Name="")

Definition IRBuilder.h:1854

LLVM_ABI CallInst * CreateOrReduce(Value *Src)

Create a vector int OR reduction intrinsic of the source vector.

LLVM_ABI CallInst * CreateMalloc(Type *IntPtrTy, Type *AllocTy, Value *AllocSize, Value *ArraySize, ArrayRef< OperandBundleDef > OpB, Function *MallocF=nullptr, const Twine &Name="")

InsertPoint saveIP() const

Returns the current insert point.

Definition IRBuilder.h:311

void CollectMetadataToCopy(Instruction *Src, ArrayRef< unsigned > MetadataKinds)

Collect metadata with IDs MetadataKinds from Src which should be added to all created instructions.

Definition IRBuilder.h:262

Value * CreateLogicalAnd(Value *Cond1, Value *Cond2, const Twine &Name="", Instruction *MDFrom=nullptr)

Definition IRBuilder.h:1725

LLVM_ABI CallInst * CreateFPMinReduce(Value *Src)

Create a vector float min reduction intrinsic of the source vector.

void SetInsertPoint(BasicBlock::iterator IP)

This specifies that created instructions should be inserted at the specified point,...

Definition IRBuilder.h:232

LLVM_ABI CallInst * CreateFPMaximumReduce(Value *Src)

Create a vector float maximum reduction intrinsic of the source vector.

Value * CreateInsertElement(Value *Vec, Value *NewElt, uint64_t Idx, const Twine &Name="")

Definition IRBuilder.h:2596

Value * CreateShl(Value *LHS, uint64_t RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)

Definition IRBuilder.h:1507

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.

Definition IRBuilder.h:2609

ReturnInst * CreateAggregateRet(Value *const *retVals, unsigned N)

Create a sequence of N insertvalue instructions, with one Value from the retVals array each,...

Definition IRBuilder.h:1183

LLVM_ABI Value * createIsFPClass(Value *FPNum, unsigned Test)

Value * CreateFCmpOLE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2392

LLVM_ABI CallInst * CreateIntrinsic(Intrinsic::ID ID, ArrayRef< Type * > Types, ArrayRef< Value * > Args, FMFSource FMFSource={}, const Twine &Name="")

Create a call to intrinsic ID with Args, mangled using Types.

LLVM_ABI CallInst * CreateFPMaxReduce(Value *Src)

Create a vector float max reduction intrinsic of the source vector.

Constant * CreateGlobalStringPtr(StringRef Str, const Twine &Name="", unsigned AddressSpace=0, Module *M=nullptr, bool AddNull=true)

Same as CreateGlobalString, but return a pointer with "i8*" type instead of a pointer to array of i8.

Definition IRBuilder.h:2056

ConstantInt * getInt32(uint32_t C)

Get a constant 32-bit value.

Definition IRBuilder.h:522

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.

Definition IRBuilder.h:1024

Value * CreateBitOrPointerCast(Value *V, Type *DestTy, const Twine &Name="")

Definition IRBuilder.h:2289

Value * CreateCmp(CmpInst::Predicate Pred, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2466

const IRBuilderDefaultInserter & Inserter

Definition IRBuilder.h:150

Value * CreateFPCast(Value *V, Type *DestTy, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2301

Value * CreateICmpSLE(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:2368

PHINode * CreatePHI(Type *Ty, unsigned NumReservedValues, const Twine &Name="")

Definition IRBuilder.h:2497

CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2522

Value * CreateNot(Value *V, const Twine &Name="")

Definition IRBuilder.h:1808

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...

Definition IRBuilder.h:1220

Value * CreateICmpEQ(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:2332

InstTy * Insert(InstTy *I, const Twine &Name="") const

Insert and return the specified instruction.

Definition IRBuilder.h:172

Value * CreateBinOpFMF(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, FMFSource FMFSource, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:1714

Value * CreateFCmpUEQ(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2412

void setIsFPConstrained(bool IsCon)

Enable/Disable use of constrained floating point math.

Definition IRBuilder.h:351

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.

Definition IRBuilder.h:1036

IntegerType * getInt128Ty()

Fetch the type representing a 128-bit integer.

Definition IRBuilder.h:572

Value * CreateCountTrailingZeroElems(Type *ResTy, Value *Mask, bool ZeroIsPoison=true, const Twine &Name="")

Create a call to llvm.experimental_cttz_elts.

Definition IRBuilder.h:1134

Value * CreateIsNeg(Value *Arg, const Twine &Name="")

Return a boolean value testing if Arg < 0.

Definition IRBuilder.h:2664

Constant * Insert(Constant *C, const Twine &="") const

No-op overload to handle constants.

Definition IRBuilder.h:179

Value * CreateSub(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)

Definition IRBuilder.h:1420

Value * CreateFMA(Value *Factor1, Value *Factor2, Value *Summand, FMFSource FMFSource={}, const Twine &Name="")

Create call to the fma intrinsic.

Definition IRBuilder.h:1073

Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")

Definition IRBuilder.h:2207

ConstantInt * getIntN(unsigned N, uint64_t C)

Get a constant N-bit value, zero extended or truncated from a 64-bit value.

Definition IRBuilder.h:533

BranchInst * CreateCondBr(Value *Cond, BasicBlock *True, BasicBlock *False, MDNode *BranchWeights=nullptr, MDNode *Unpredictable=nullptr)

Create a conditional 'br Cond, TrueDest, FalseDest' instruction.

Definition IRBuilder.h:1197

IRBuilderBase(LLVMContext &context, const IRBuilderFolder &Folder, const IRBuilderDefaultInserter &Inserter, MDNode *FPMathTag, ArrayRef< OperandBundleDef > OpBundles)

Definition IRBuilder.h:162

void AddMetadataToInst(Instruction *I) const

Add all entries in MetadataToCopy to I.

Definition IRBuilder.h:280

Value * CreateCopySign(Value *LHS, Value *RHS, FMFSource FMFSource={}, const Twine &Name="")

Create call to the copysign intrinsic.

Definition IRBuilder.h:1058

Value * CreateICmpUGT(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:2340

LLVM_ABI CallInst * CreateUnaryIntrinsic(Intrinsic::ID ID, Value *V, FMFSource FMFSource={}, const Twine &Name="")

Create a call to intrinsic ID with 1 operand which is mangled on its type.

LoadInst * CreateLoad(Type *Ty, Value *Ptr, const char *Name)

Provided to resolve 'CreateLoad(Ty, Ptr, "...")' correctly, instead of converting the string to 'bool...

Definition IRBuilder.h:1850

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...

Definition IRBuilder.h:651

Value * CreateShl(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)

Definition IRBuilder.h:1492

FastMathFlags getFastMathFlags() const

Get the flags to be applied to created floating point ops.

Definition IRBuilder.h:334

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.

Definition IRBuilder.h:630

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 * CreateZExt(Value *V, Type *DestTy, const Twine &Name="", bool IsNonNeg=false)

Definition IRBuilder.h:2085

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="")

Definition IRBuilder.h:2601

LLVMContext & getContext() const

Definition IRBuilder.h:203

Value * CreateFCmpOEQ(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2372

Value * CreateAnd(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:1551

FastMathFlags & getFastMathFlags()

Definition IRBuilder.h:336

ReturnInst * CreateRetVoid()

Create a 'ret void' instruction.

Definition IRBuilder.h:1167

Value * CreateMaximumNum(Value *LHS, Value *RHS, const Twine &Name="")

Create call to the maximum intrinsic.

Definition IRBuilder.h:1052

Value * CreateNSWSub(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:1429

Value * CreateConstInBoundsGEP2_32(Type *Ty, Value *Ptr, unsigned Idx0, unsigned Idx1, const Twine &Name="")

Definition IRBuilder.h:1973

Value * CreateConstInBoundsGEP2_64(Type *Ty, Value *Ptr, uint64_t Idx0, uint64_t Idx1, const Twine &Name="")

Definition IRBuilder.h:2019

Value * CreateMinNum(Value *LHS, Value *RHS, FMFSource FMFSource={}, const Twine &Name="")

Create call to the minnum intrinsic.

Definition IRBuilder.h:1012

InvokeInst * CreateInvoke(FunctionCallee Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > Args={}, const Twine &Name="")

Definition IRBuilder.h:1265

CallInst * CreateExtractVector(Type *DstType, Value *SrcVec, uint64_t Idx, const Twine &Name="")

Create a call to the vector.extract intrinsic.

Definition IRBuilder.h:1101

LLVM_ABI Value * CreatePreserveUnionAccessIndex(Value *Base, unsigned FieldIndex, MDNode *DbgInfo)

StoreInst * CreateStore(Value *Val, Value *Ptr, bool isVolatile=false)

Definition IRBuilder.h:1863

LLVM_ABI CallInst * CreateIntMaxReduce(Value *Src, bool IsSigned=false)

Create a vector integer max reduction intrinsic of the source vector.

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)

Definition IRBuilder.h:1403

Value * CreatePtrToInt(Value *V, Type *DestTy, const Twine &Name="")

Definition IRBuilder.h:2197

Value * CreateSDiv(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)

Definition IRBuilder.h:1467

ConstantInt * getFalse()

Get the constant value for i1 false.

Definition IRBuilder.h:507

VAArgInst * CreateVAArg(Value *List, Type *Ty, const Twine &Name="")

Definition IRBuilder.h:2563

Value * CreateExactUDiv(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:1463

Type * getFloatTy()

Fetch the type representing a 32-bit floating point value.

Definition IRBuilder.h:590

Value * CreateIsNotNull(Value *Arg, const Twine &Name="")

Return a boolean value testing if Arg != 0.

Definition IRBuilder.h:2659

void SetInsertPoint(BasicBlock *TheBB, BasicBlock::iterator IP)

This specifies that created instructions should be inserted at the specified point.

Definition IRBuilder.h:223

Instruction * CreateNoAliasScopeDeclaration(MDNode *ScopeTag)

Definition IRBuilder.h:877

CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value * > Args={}, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2511

Value * CreateShl(Value *LHS, const APInt &RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)

Definition IRBuilder.h:1501

AtomicRMWInst * CreateAtomicRMW(AtomicRMWInst::BinOp Op, Value *Ptr, Value *Val, MaybeAlign Align, AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System)

Definition IRBuilder.h:1914

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)

Definition IRBuilder.h:2071

PointerType * getPtrTy(unsigned AddrSpace=0)

Fetch the type representing a pointer.

Definition IRBuilder.h:605

Value * CreateBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:1708

BranchInst * CreateBr(BasicBlock *Dest)

Create an unconditional 'br label X' instruction.

Definition IRBuilder.h:1191

Value * CreateInsertElement(Value *Vec, Value *NewElt, Value *Idx, const Twine &Name="")

Definition IRBuilder.h:2589

Value * CreateConstInBoundsGEP1_64(Type *Ty, Value *Ptr, uint64_t Idx0, const Twine &Name="")

Definition IRBuilder.h:1996

fp::ExceptionBehavior DefaultConstrainedExcept

Definition IRBuilder.h:156

void ClearInsertionPoint()

Clear the insertion point: created instructions will not be inserted into a block.

Definition IRBuilder.h:196

CallBrInst * CreateCallBr(FunctionCallee Callee, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args={}, const Twine &Name="")

Definition IRBuilder.h:1292

Value * CreateICmpSLT(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:2364

ConstantInt * getInt16(uint16_t C)

Get a constant 16-bit value.

Definition IRBuilder.h:517

MDNode * DefaultFPMathTag

Definition IRBuilder.h:152

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

Definition IRBuilder.h:159

CallBrInst * CreateCallBr(FunctionType *Ty, Value *Callee, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > OpBundles, const Twine &Name="")

Definition IRBuilder.h:1281

LLVM_ABI CallInst * CreateDereferenceableAssumption(Value *PtrValue, Value *SizeValue)

Create an assume intrinsic call that represents an dereferencable assumption on the provided pointer.

Value * CreateICmpUGE(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:2344

MDNode * getDefaultFPMathTag() const

Get the floating point math metadata being used.

Definition IRBuilder.h:331

Value * CreateIntCast(Value *V, Type *DestTy, bool isSigned, const Twine &Name="")

Definition IRBuilder.h:2280

Value * CreateFCmpUNO(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2407

void restoreIP(InsertPoint IP)

Sets the current insert point to a previously-saved location.

Definition IRBuilder.h:323

Value * CreateIsNull(Value *Arg, const Twine &Name="")

Return a boolean value testing if Arg == 0.

Definition IRBuilder.h:2654

CallInst * CreateMemCpy(Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, Value *Size, bool isVolatile=false, const AAMDNodes &AAInfo=AAMDNodes())

Definition IRBuilder.h:701

Value * CreateFCmpOGT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2377

CallInst * CreateMemCpyInline(Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, Value *Size, bool isVolatile=false, const AAMDNodes &AAInfo=AAMDNodes())

Definition IRBuilder.h:709

CallInst * CreateStackRestore(Value *Ptr, const Twine &Name="")

Create a call to llvm.stackrestore.

Definition IRBuilder.h:1128

LLVM_ABI CallInst * CreateIntMinReduce(Value *Src, bool IsSigned=false)

Create a vector integer min reduction intrinsic of the source vector.

void SetInsertPoint(BasicBlock *TheBB)

This specifies that created instructions should be appended to the end of the specified block.

Definition IRBuilder.h:207

Type * getVoidTy()

Fetch the type representing void.

Definition IRBuilder.h:600

InvokeInst * CreateInvoke(FunctionType *Ty, Value *Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, ArrayRef< Value * > Args={}, const Twine &Name="")

Definition IRBuilder.h:1246

CallInst * CreateInsertVector(Type *DstType, Value *SrcVec, Value *SubVec, uint64_t Idx, const Twine &Name="")

Create a call to the vector.extract intrinsic.

Definition IRBuilder.h:1115

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)

Definition IRBuilder.h:1591

Value * CreateFAddFMF(Value *L, Value *R, FMFSource FMFSource, const Twine &Name="", MDNode *FPMD=nullptr)

Definition IRBuilder.h:1618

Value * CreateLogicalOr(Value *Cond1, Value *Cond2, const Twine &Name="", Instruction *MDFrom=nullptr)

Definition IRBuilder.h:1733

AllocaInst * CreateAlloca(Type *Ty, Value *ArraySize=nullptr, const Twine &Name="")

Definition IRBuilder.h:1840

Value * CreateConstGEP2_32(Type *Ty, Value *Ptr, unsigned Idx0, unsigned Idx1, const Twine &Name="", GEPNoWrapFlags NWFlags=GEPNoWrapFlags::none())

Definition IRBuilder.h:1959

Value * CreateExtractElement(Value *Vec, uint64_t Idx, const Twine &Name="")

Definition IRBuilder.h:2574

StoreInst * CreateAlignedStore(Value *Val, Value *Ptr, MaybeAlign Align, bool isVolatile=false)

Definition IRBuilder.h:1886

Value * CreateOr(Value *LHS, uint64_t RHS, const Twine &Name="")

Definition IRBuilder.h:1587

void setConstrainedFPCallAttr(CallBase *I)

Definition IRBuilder.h:395

Value * CreateMinimumNum(Value *LHS, Value *RHS, const Twine &Name="")

Create call to the minimumnum intrinsic.

Definition IRBuilder.h:1046

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.

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

Definition IRBuilder.h:149

Value * CreateInBoundsPtrAdd(Value *Ptr, Value *Offset, const Twine &Name="")

Definition IRBuilder.h:2044

Value * CreateIntCast(Value *, Type *, const char *)=delete

Value * CreateFPExt(Value *V, Type *DestTy, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2180

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)

Definition IRBuilder.h:1532

CallInst * CreateCall(FunctionCallee Callee, ArrayRef< Value * > Args={}, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2533

Value * CreateFNegFMF(Value *V, FMFSource FMFSource, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:1798

Value * CreateXor(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:1599

LLVM_ABI CallInst * CreateFMulReduce(Value *Acc, Value *Src)

Create a sequential vector fmul reduction intrinsic of the source vector.

Value * CreateTruncOrBitCast(Value *V, Type *DestTy, const Twine &Name="")

Definition IRBuilder.h:2233

Value * CreateICmpULE(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:2352

Value * CreateICmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:2442

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)

Definition IRBuilder.h:1651

LoadInst * CreateAlignedLoad(Type *Ty, Value *Ptr, MaybeAlign Align, bool isVolatile, const Twine &Name="")

Definition IRBuilder.h:1877

Value * CreateFNeg(Value *V, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:1793

void setConstrainedFPFunctionAttr()

Definition IRBuilder.h:386

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)

Definition IRBuilder.h:1573

void SetInsertPoint(Instruction *I)

This specifies that created instructions should be inserted before the specified instruction.

Definition IRBuilder.h:214

IntegerType * getInt8Ty()

Fetch the type representing an 8-bit integer.

Definition IRBuilder.h:552

ConstantInt * getInt(const APInt &AI)

Get a constant integer value.

Definition IRBuilder.h:538

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)

Definition IRBuilder.h:1675

Value * CreateURem(Value *LHS, Value *RHS, const Twine &Name="")

Definition IRBuilder.h:1480

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.

Definition IRBuilder.h:2118

ResumeInst * CreateResume(Value *Exn)

Definition IRBuilder.h:1308

Value * CreateAddrSpaceCast(Value *V, Type *DestTy, const Twine &Name="")

Definition IRBuilder.h:2212

Type * getBFloatTy()

Fetch the type representing a 16-bit brain floating point value.

Definition IRBuilder.h:585

Value * CreateFMulFMF(Value *L, Value *R, FMFSource FMFSource, const Twine &Name="", MDNode *FPMD=nullptr)

Definition IRBuilder.h:1656

Value * CreateXor(Value *LHS, const APInt &RHS, const Twine &Name="")

Definition IRBuilder.h:1605

LLVM_ABI CallInst * CreateInvariantStart(Value *Ptr, ConstantInt *Size=nullptr)

Create a call to invariant.start intrinsic.

Value * CreateMul(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)

Definition IRBuilder.h:1437

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)

Definition IRBuilder.h:1694

Value * CreateXor(Value *LHS, uint64_t RHS, const Twine &Name="")

Definition IRBuilder.h:1609

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="")

Definition IRBuilder.h:1789

LLVM_ABI Value * CreateElementCount(Type *Ty, ElementCount EC)

Create an expression which evaluates to the number of elements in EC at runtime.

LLVM_ABI CallInst * CreateFPMinimumReduce(Value *Src)

Create a vector float minimum reduction intrinsic of the source vector.

Value * CreateFCmpOGE(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2382

CallInst * CreateMemMove(Value *Dst, MaybeAlign DstAlign, Value *Src, MaybeAlign SrcAlign, Value *Size, bool isVolatile=false, const AAMDNodes &AAInfo=AAMDNodes())

Definition IRBuilder.h:737

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 Value * CreateStripInvariantGroup(Value *Ptr)

Create a strip.invariant.group intrinsic call.

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="")

Definition IRBuilder.h:1433

Value * CreateFCmpULT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)

Definition IRBuilder.h:2427

CallInst * CreateArithmeticFence(Value *Val, Type *DstType, const Twine &Name="")

Create a call to the arithmetic_fence intrinsic.

Definition IRBuilder.h:1086

Value * CreateFPToSI(Value *V, Type *DestTy, const Twine &Name="")

Definition IRBuilder.h:2138

IRBuilderCallbackInserter(std::function< void(Instruction *)> Callback)

Definition IRBuilder.h:81

~IRBuilderCallbackInserter() override

void InsertHelper(Instruction *I, const Twine &Name, BasicBlock::iterator InsertPt) const override

Definition IRBuilder.h:84

This provides the default implementation of the IRBuilder 'InsertHelper' method that is called whenev...

Definition IRBuilder.h:61

virtual void InsertHelper(Instruction *I, const Twine &Name, BasicBlock::iterator InsertPt) const

Definition IRBuilder.h:65

virtual ~IRBuilderDefaultInserter()

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...

Definition IRBuilder.h:2788

IRBuilder(LLVMContext &C, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles={})

Definition IRBuilder.h:2805

IRBuilder(const IRBuilder &)=delete

Avoid copying the full IRBuilder.

IRBuilder(LLVMContext &C, FolderTy Folder, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles={})

Definition IRBuilder.h:2800

IRBuilder(LLVMContext &C, FolderTy Folder, InserterTy Inserter, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles={})

Definition IRBuilder.h:2794

InserterTy & getInserter()

Definition IRBuilder.h:2853

IRBuilder(Instruction *IP, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles={})

Definition IRBuilder.h:2825

IRBuilder(BasicBlock *TheBB, FolderTy Folder, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles={})

Definition IRBuilder.h:2809

IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, FolderTy Folder, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles={})

Definition IRBuilder.h:2832

const InserterTy & getInserter() const

Definition IRBuilder.h:2854

IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles={})

Definition IRBuilder.h:2841

IRBuilder(BasicBlock *TheBB, MDNode *FPMathTag=nullptr, ArrayRef< OperandBundleDef > OpBundles={})

Definition IRBuilder.h:2818

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 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 MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)

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(Type *ElementType, unsigned AddressSpace)

This constructs a pointer to an object of the specified type 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.

StringRef - 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 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 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 IntegerType * getInt1Ty(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 Type * getBFloatTy(LLVMContext &C)

static LLVM_ABI Type * getHalfTy(LLVMContext &C)

This class represents a cast unsigned integer to floating point.

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.

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.

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.

unsigned ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

@ C

The default llvm calling convention, compatible with C.

@ 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.

FunctionAddr VTableAddr Value

decltype(auto) dyn_cast(const From &Val)

dyn_cast - 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...

LLVM_ABI std::optional< StringRef > convertExceptionBehaviorToStr(fp::ExceptionBehavior)

For any ExceptionBehavior enumerator, returns a string valid as input in constrained intrinsic except...

bool isa(const From &Val)

isa - 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.

IRBuilder(LLVMContext &, FolderTy, InserterTy, MDNode *, ArrayRef< OperandBundleDef >) -> IRBuilder< FolderTy, InserterTy >

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 - Return the argument parameter cast to the specified type.

void erase_if(Container &C, UnaryPredicate P)

Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...

@ Default

The result values are uniform if and only if all operands are uniform.

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.

This struct is a compact representation of a valid (power of two) or undefined (0) alignment.