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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15#ifndef LLVM_IR_INSTRUCTIONS_H

16#define LLVM_IR_INSTRUCTIONS_H

17

41#include

42#include

43#include

44#include

45#include

46

47namespace llvm {

48

59

60

61

62

63

64

66 Type *AllocatedType;

67

72 SwiftErrorField>(),

73 "Bitfields must be contiguous");

74

75protected:

76

78

80

81public:

84

87

91

92

93

95

96

97

100

101

105

106

110

111

112

113 LLVM_ABI std::optional

115

116

117

118 LLVM_ABI std::optional

120

121

123

124

126

127

128

132

134 setSubclassData(Log2(Align));

135 }

136

137

138

139

141

142

143

147

148

150 setSubclassData(V);

151 }

152

153

155

156 void setSwiftError(bool V) { setSubclassData(V); }

157

158

160 return (I->getOpcode() == Instruction::Alloca);

161 }

165

166private:

167

168

169 template

170 void setSubclassData(typename Bitfield::Type Value) {

172 }

173};

174

175

176

177

178

179

180

185 static_assert(

187 "Bitfields must be contiguous");

188

189 void AssertOK();

190

191protected:

192

194

196

197public:

208

209

211

212

213 void setVolatile(bool V) { setSubclassData(V); }

214

215

219

221 setSubclassData(Log2(Align));

222 }

223

224

228

229

231 setSubclassData(Ordering);

232 }

233

234

238

239

241 this->SSID = SSID;

242 }

243

244

245

251

253

259

264

265

269

270

272 return I->getOpcode() == Instruction::Load;

273 }

277

278private:

279

280

281 template

282 void setSubclassData(typename Bitfield::Type Value) {

284 }

285

286

287

288

290};

291

292

293

294

295

296

301 static_assert(

303 "Bitfields must be contiguous");

304

305 void AssertOK();

306

308

309protected:

310

312

314

315public:

325

326

327 void *operator new(size_t S) { return User::operator new(S, AllocMarker); }

328 void operator delete(void *Ptr) { User::operator delete(Ptr); }

329

330

332

333

334 void setVolatile(bool V) { setSubclassData(V); }

335

336

338

342

344 setSubclassData(Log2(Align));

345 }

346

347

351

352

353

355 setSubclassData(Ordering);

356 }

357

358

362

363

365 this->SSID = SSID;

366 }

367

368

369

375

377

383

386

391

392

396

397

399 return I->getOpcode() == Instruction::Store;

400 }

404

405private:

406

407

408 template

409 void setSubclassData(typename Bitfield::Type Value) {

411 }

412

413

414

415

417};

418

419template <>

422

424

425

426

427

428

429

432

434

436

437protected:

438

440

442

443public:

444

445

449

450

451 void *operator new(size_t S) { return User::operator new(S, AllocMarker); }

452 void operator delete(void *Ptr) { User::operator delete(Ptr); }

453

454

458

459

460

462 setSubclassData(Ordering);

463 }

464

465

469

470

472 this->SSID = SSID;

473 }

474

475

477 return I->getOpcode() == Instruction::Fence;

478 }

482

483private:

484

485

486 template

487 void setSubclassData(typename Bitfield::Type Value) {

489 }

490

491

492

493

495};

496

497

498

499

500

501

502

503

504

505

506

511

512 template

513 using AtomicOrderingBitfieldElement =

516

518

519protected:

520

522

524

525public:

530

531

532 void *operator new(size_t S) { return User::operator new(S, AllocMarker); }

533 void operator delete(void *Ptr) { User::operator delete(Ptr); }

534

543 static_assert(

546 "Bitfields must be contiguous");

547

548

549

553

555 setSubclassData(Log2(Align));

556 }

557

558

559

560

562

563

564

565 void setVolatile(bool V) { setSubclassData(V); }

566

567

569

570 void setWeak(bool IsWeak) { setSubclassData(IsWeak); }

571

572

574

579

586

587

591

592

595 "invalid CmpXchg success ordering");

596 setSubclassData(Ordering);

597 }

598

599

603

604

607 "invalid CmpXchg failure ordering");

608 setSubclassData(Ordering);

609 }

610

611

612

624

625

629

630

632 this->SSID = SSID;

633 }

634

638

641

644

645

649

650

651

652

653

654

655

656

659 switch (SuccessOrdering) {

660 default:

670 }

671 }

672

673

675 return I->getOpcode() == Instruction::AtomicCmpXchg;

676 }

680

681private:

682

683

684 template

685 void setSubclassData(typename Bitfield::Type Value) {

687 }

688

689

690

691

693};

694

695template <>

699

701

702

703

704

705

706

707

708

709

711protected:

712

714

716

717public:

718

719

720

721

723

725

727

729

731

733

735

737

739

741

743

745

746

748

749

751

752

753

755

756

757

759

760

761

763

764

765

767

768

769

771

772

773

775

776

777

779

780

781

783

787 };

788

789private:

790 template

791 using AtomicOrderingBitfieldElement =

794

795 template

796 using BinOpBitfieldElement =

798

799 constexpr static IntrusiveOperandsAllocMarker AllocMarker{2};

800

801public:

803 Align Alignment, AtomicOrdering Ordering,

805 InsertPosition InsertBefore = nullptr);

806

807

808 void *operator new(size_t S) { return User::operator new(S, AllocMarker); }

809 void operator delete(void *Ptr) { User::operator delete(Ptr); }

810

814 using OperationField = BinOpBitfieldElementAtomicOrderingField::NextBit;

818 "Bitfields must be contiguous");

819

821

823

825 switch (Op) {

832 return true;

833 default:

834 return false;

835 }

836 }

837

839 setSubclassData(Operation);

840 }

841

842

843

847

849 setSubclassData(Log2(Align));

850 }

851

852

853

855

856

857

858 void setVolatile(bool V) { setSubclassData(V); }

859

860

862

863

867

868

871 "atomicrmw instructions can only be atomic.");

873 "atomicrmw instructions cannot be unordered.");

874 setSubclassData(Ordering);

875 }

876

877

881

882

884 this->SSID = SSID;

885 }

886

890

893

894

898

902

903

905 return I->getOpcode() == Instruction::AtomicRMW;

906 }

910

911private:

914

915

916

917 template

918 void setSubclassData(typename Bitfield::Type Value) {

920 }

921

922

923

924

926};

927

928template <>

932

934

935

936

937

938

939

940

941

943 assert(Ty && "Invalid GetElementPtrInst indices for type!");

944 return Ty;

945}

946

947

948

949

951 Type *SourceElementType;

952 Type *ResultElementType;

953

954 GetElementPtrInst(const GetElementPtrInst &GEPI, AllocInfo AllocInfo);

955

956

957

958

959

960 inline GetElementPtrInst(Type *PointeeType, Value *Ptr,

963

965 const Twine &NameStr);

966

967protected:

968

970

972

973public:

976 const Twine &NameStr = "",

978 unsigned Values = 1 + unsigned(IdxList.size());

979 assert(PointeeType && "Must specify element type");

981 return new (AllocMarker) GetElementPtrInst(

982 PointeeType, Ptr, IdxList, AllocMarker, NameStr, InsertBefore);

983 }

984

987 const Twine &NameStr = "",

989 GetElementPtrInst *GEP =

990 Create(PointeeType, Ptr, IdxList, NameStr, InsertBefore);

991 GEP->setNoWrapFlags(NW);

992 return GEP;

993 }

994

995

996

999 const Twine &NameStr = "",

1002 NameStr, InsertBefore);

1003 }

1004

1005

1007

1009

1012

1014 return ResultElementType;

1015 }

1016

1017

1023

1024

1025

1026

1027

1028

1032

1033

1034

1035

1036

1037

1040

1045

1049

1053

1063

1064

1065

1069

1070

1074

1075

1076

1078

1080 if (Ty->isVectorTy())

1081 return Ty;

1082

1083 for (Value *Index : IdxList)

1085 ElementCount EltCount = IndexVTy->getElementCount();

1087 }

1088

1089 return Ty;

1090 }

1091

1095

1099

1100

1101

1102

1104

1105

1106

1107

1109

1110

1112

1113

1114

1115

1117

1118

1120

1121

1123

1124

1126

1127

1129

1130

1131

1132

1133

1134

1135

1136

1137

1143 APInt &ConstantOffset) const;

1144

1146 return (I->getOpcode() == Instruction::GetElementPtr);

1147 }

1151};

1152

1153template <>

1156

1157GetElementPtrInst::GetElementPtrInst(Type *PointeeType, Value *Ptr,

1162 InsertBefore),

1163 SourceElementType(PointeeType),

1164 ResultElementType(getIndexedType(PointeeType, IdxList)) {

1165 init(Ptr, IdxList, NameStr);

1166}

1167

1169

1170

1171

1172

1173

1174

1175

1176

1177

1179 void AssertOK() {

1181 "Invalid ICmp predicate value");

1183 "Both operands to ICmp instruction are not of the same type!");

1184

1187 "Invalid operand types for ICmp instruction");

1188 }

1189

1190 enum { SameSign = (1 << 0) };

1191

1192protected:

1193

1195

1196

1198

1199public:

1200

1202 Predicate pred,

1203 Value *LHS,

1204 Value *RHS,

1205 const Twine &NameStr = ""

1206 )

1208 RHS, NameStr, InsertBefore) {

1209#ifndef NDEBUG

1210 AssertOK();

1211#endif

1212 }

1213

1214

1226

1227

1231

1232

1233

1237

1238

1242

1243

1244

1248

1249

1253

1254

1255

1259

1260

1261

1265

1266

1267

1268

1269

1273

1274

1276

1277

1278

1279

1280

1284

1285

1287

1288

1289

1290

1291

1293

1294

1295

1296

1300

1301

1302

1303 LLVM_ABI static std::optional

1305

1309

1310

1311

1312

1314

1315

1316

1320

1321

1322

1326

1327

1328

1330

1331

1332

1334

1335

1336

1340

1341

1342

1346

1347

1348

1352

1353

1354

1358

1359

1360

1364

1365

1366

1370

1371

1372

1374

1375

1376

1377

1378

1379

1384

1385

1388

1389

1390

1391 LLVM_ABI static std::optional

1393

1394

1396 return I->getOpcode() == Instruction::ICmp;

1397 }

1401};

1402

1403

1404

1405

1406

1407

1408

1409

1410

1412 void AssertOK() {

1415 "Both operands to FCmp instruction are not of the same type!");

1416

1418 "Invalid operand types for FCmp instruction");

1419 }

1420

1421protected:

1422

1424

1425

1427

1428public:

1429

1440

1441

1443 Value *LHS,

1444 Value *RHS,

1445 const Twine &NameStr = "",

1448 RHS, NameStr, nullptr, FlagsSource) {

1449 AssertOK();

1450 }

1451

1452

1453

1458

1459

1460

1462

1463

1464

1469

1470

1471

1473

1474

1475

1477

1478

1479

1480

1481

1482

1487

1488

1489

1491

1492

1495

1496

1498 return I->getOpcode() == Instruction::FCmp;

1499 }

1503};

1504

1505

1506

1507

1508

1509

1510

1513

1514

1518

1522 : CallInst(Ty, Func, Args, {}, NameStr, AllocInfo, InsertBefore) {}

1523

1526

1530

1531

1532 static unsigned ComputeNumOperands(unsigned NumArgs,

1533 unsigned NumBundleInputs = 0) {

1534

1535

1536 return 1 + NumArgs + NumBundleInputs;

1537 }

1538

1539protected:

1540

1542

1544

1545public:

1549 return new (AllocMarker)

1550 CallInst(Ty, F, NameStr, AllocMarker, InsertBefore);

1551 }

1552

1554 const Twine &NameStr,

1557 return new (AllocMarker)

1558 CallInst(Ty, Func, Args, {}, NameStr, AllocMarker, InsertBefore);

1559 }

1560

1563 const Twine &NameStr = "",

1565 IntrusiveOperandsAndDescriptorAllocMarker AllocMarker{

1566 ComputeNumOperands(unsigned(Args.size()), CountBundleInputs(Bundles)),

1567 unsigned(Bundles.size() * sizeof(BundleOpInfo))};

1568

1569 return new (AllocMarker)

1570 CallInst(Ty, Func, Args, Bundles, NameStr, AllocMarker, InsertBefore);

1571 }

1572

1575 return Create(Func.getFunctionType(), Func.getCallee(), NameStr,

1576 InsertBefore);

1577 }

1578

1581 const Twine &NameStr = "",

1583 return Create(Func.getFunctionType(), Func.getCallee(), Args, Bundles,

1584 NameStr, InsertBefore);

1585 }

1586

1588 const Twine &NameStr,

1590 return Create(Func.getFunctionType(), Func.getCallee(), Args, NameStr,

1591 InsertBefore);

1592 }

1593

1594

1595

1596

1597

1598

1599

1603

1604

1612

1614 static_assert(

1616 "Bitfields must be contiguous");

1617

1621

1626

1628

1630

1632 setSubclassData(TCK);

1633 }

1634

1638

1639

1642

1643

1646 case Intrinsic:🪤

1647 case Intrinsic::ubsantrap:

1648 return hasFnAttr("trap-func-name");

1649 default:

1650 return false;

1651 }

1652 }

1653

1654

1656 return I->getOpcode() == Instruction::Call;

1657 }

1661

1662

1664

1665private:

1666

1667

1668 template

1669 void setSubclassData(typename Bitfield::Type Value) {

1671 }

1672};

1673

1678 InsertBefore) {

1681 init(Ty, Func, Args, Bundles, NameStr);

1682}

1683

1684

1685

1686

1687

1688

1689

1692

1695 : Instruction(S1->getType(), Instruction::Select, AllocMarker,

1696 InsertBefore) {

1697 init(C, S1, S2);

1699 }

1700

1706 }

1707

1708protected:

1709

1711

1713

1714public:

1716 const Twine &NameStr = "",

1719 SelectInst *Sel =

1720 new (AllocMarker) SelectInst(C, S1, S2, NameStr, InsertBefore);

1721 if (MDFrom)

1723 return Sel;

1724 }

1725

1732

1736

1737

1738

1740

1741

1742

1745

1746

1748

1752

1753

1755 return I->getOpcode() == Instruction::Select;

1756 }

1760};

1761

1762template <>

1765

1767

1768

1769

1770

1771

1772

1773

1774

1776protected:

1777

1779

1781

1782public:

1788

1792

1793

1795 return I->getOpcode() == VAArg;

1796 }

1800};

1801

1802

1803

1804

1805

1806

1807

1808

1811

1814

1815protected:

1816

1818

1820

1821public:

1823 const Twine &NameStr = "",

1825 return new (AllocMarker)

1826 ExtractElementInst(Vec, Idx, NameStr, InsertBefore);

1827 }

1828

1829

1830

1832

1837

1841

1842

1844

1845

1847 return I->getOpcode() == Instruction::ExtractElement;

1848 }

1852};

1853

1854template <>

1858

1860

1861

1862

1863

1864

1865

1866

1867

1870

1872 const Twine &NameStr = "",

1874

1875protected:

1876

1878

1880

1881public:

1883 const Twine &NameStr = "",

1885 return new (AllocMarker)

1886 InsertElementInst(Vec, NewElt, Idx, NameStr, InsertBefore);

1887 }

1888

1889

1890

1891 LLVM_ABI static bool isValidOperands(const Value *Vec, const Value *NewElt,

1892 const Value *Idx);

1893

1894

1895

1899

1900

1902

1903

1905 return I->getOpcode() == Instruction::InsertElement;

1906 }

1910};

1911

1912template <>

1916

1918

1919

1920

1921

1922

1924

1925

1926

1927

1928

1929

1930

1931

1932

1933

1934

1937

1939 Constant *ShuffleMaskForBitcode;

1940

1941protected:

1942

1944

1946

1947public:

1951 const Twine &NameStr = "",

1954 const Twine &NameStr = "",

1957 const Twine &NameStr = "",

1959

1960 void *operator new(size_t S) { return User::operator new(S, AllocMarker); }

1961 void operator delete(void *Ptr) { return User::operator delete(Ptr); }

1962

1963

1964

1966

1967

1968

1969 LLVM_ABI static bool isValidOperands(const Value *V1, const Value *V2,

1970 const Value *Mask);

1971 LLVM_ABI static bool isValidOperands(const Value *V1, const Value *V2,

1973

1974

1975

1979

1980

1982

1983

1984

1985 int getMaskValue(unsigned Elt) const { return ShuffleMask[Elt]; }

1986

1987

1988

1991

1992

1993

1995 Result.assign(ShuffleMask.begin(), ShuffleMask.end());

1996 }

1997

1998

1999

2000

2001

2003

2005 Type *ResultTy);

2006

2008

2010

2011

2012

2013

2014

2017 ->getElementCount()

2018 .getKnownMinValue();

2019 unsigned NumMaskElts = ShuffleMask.size();

2020 return NumSourceElts != NumMaskElts;

2021 }

2022

2023

2024

2025

2028 ->getElementCount()

2029 .getKnownMinValue();

2030 unsigned NumMaskElts = ShuffleMask.size();

2031 return NumSourceElts < NumMaskElts;

2032 }

2033

2034

2035

2036

2037

2038

2041 assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");

2045 }

2046

2047

2048

2049

2050

2055

2056

2057

2058

2059

2060

2063 assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");

2064

2065

2066

2068 return false;

2069

2073 }

2074

2075

2076

2077

2078

2080

2081

2083 return false;

2084

2086 }

2087

2088

2089

2090 LLVM_ABI bool isIdentityWithPadding() const;

2091

2092

2093

2094 LLVM_ABI bool isIdentityWithExtract() const;

2095

2096

2097

2098

2099 LLVM_ABI bool isConcat() const;

2100

2101

2102

2103

2104

2105

2106

2107

2108

2111 assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");

2114 return isSelectMask(MaskAsInts, NumSrcElts);

2115 }

2116

2117

2118

2119

2120

2121

2122

2123

2124

2128

2129

2130

2131

2132

2133

2136 assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");

2140 }

2141

2142

2143

2144

2145

2149

2150

2151

2152

2153

2154

2157 assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");

2161 }

2162

2163

2164

2165

2166

2167

2168

2173

2174

2175

2176

2177

2178

2179

2180

2181

2182

2183

2184

2185

2186

2187

2188

2189

2190

2191

2192

2193

2194

2195

2196

2197

2198

2199

2200

2201

2202

2203

2204

2205

2208 assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");

2212 }

2213

2214

2215

2216

2217

2218

2222

2223

2224

2225

2226

2227

2228

2230 int &Index);

2232 assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");

2235 return isSpliceMask(MaskAsInts, NumSrcElts, Index);

2236 }

2237

2238

2239

2240

2241

2244 isSpliceMask(ShuffleMask, ShuffleMask.size(), Index);

2245 }

2246

2247

2248

2249

2251 int NumSrcElts, int &Index);

2253 int &Index) {

2254 assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");

2255

2256

2258 return false;

2262 }

2263

2264

2266

2267

2269 return false;

2270

2271 int NumSrcElts =

2274 }

2275

2276

2277

2278

2279

2281 int &NumSubElts, int &Index);

2283 int &NumSubElts, int &Index) {

2284 assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");

2285

2286

2288 return false;

2292 }

2293

2294

2296

2297

2299 return false;

2300

2301 int NumSrcElts =

2304 }

2305

2306

2307

2308

2309

2311 int &ReplicationFactor, int &VF);

2313 int &VF) {

2314 assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");

2315

2316

2318 return false;

2322 }

2323

2324

2325 LLVM_ABI bool isReplicationMask(int &ReplicationFactor, int &VF) const;

2326

2327

2328

2329

2330

2331

2332

2333

2334

2335

2337

2338

2339

2340 LLVM_ABI bool isOneUseSingleSourceMask(int VF) const;

2341

2342

2343

2345 unsigned InVecNumElts) {

2346 for (int &Idx : Mask) {

2347 if (Idx == -1)

2348 continue;

2349 Idx = Idx < (int)InVecNumElts ? Idx + InVecNumElts : Idx - InVecNumElts;

2350 assert(Idx >= 0 && Idx < (int)InVecNumElts * 2 &&

2351 "shufflevector mask index out of range");

2352 }

2353 }

2354

2355

2356 LLVM_ABI bool isInterleave(unsigned Factor);

2357

2358

2359

2360

2361

2362

2363

2364

2365

2366

2367

2368

2369

2370

2371

2372

2373

2374

2375

2376

2378 isInterleaveMask(ArrayRef Mask, unsigned Factor, unsigned NumInputElts,

2381 unsigned NumInputElts) {

2383 return isInterleaveMask(Mask, Factor, NumInputElts, StartIndexes);

2384 }

2385

2386

2387

2388

2390 unsigned Factor,

2391 unsigned &Index);

2393 unsigned Unused;

2395 }

2396

2397

2398

2399

2400

2401

2402

2403

2404

2405

2406

2407

2409 unsigned EltSizeInBits,

2410 unsigned MinSubElts, unsigned MaxSubElts,

2411 unsigned &NumSubElts,

2412 unsigned &RotateAmt);

2413

2414

2416 return I->getOpcode() == Instruction::ShuffleVector;

2417 }

2421};

2422

2423template <>

2426

2428

2429

2430

2431

2432

2433

2434

2435

2438

2439 ExtractValueInst(const ExtractValueInst &EVI);

2440

2441

2442

2443

2444

2447

2449

2450protected:

2451

2453

2455

2456public:

2458 const Twine &NameStr = "",

2460 return new

2461 ExtractValueInst(Agg, Idxs, NameStr, InsertBefore);

2462 }

2463

2464

2465

2466

2467

2469

2471

2477

2487

2489 return Indices;

2490 }

2491

2493 return (unsigned)Indices.size();

2494 }

2495

2499

2500

2502 return I->getOpcode() == Instruction::ExtractValue;

2503 }

2507};

2508

2509ExtractValueInst::ExtractValueInst(Value *Agg, ArrayRef Idxs,

2510 const Twine &NameStr,

2511 InsertPosition InsertBefore)

2513 ExtractValue, Agg, InsertBefore) {

2514 init(Idxs, NameStr);

2515}

2516

2517

2518

2519

2520

2521

2522

2523

2526

2528

2529 InsertValueInst(const InsertValueInst &IVI);

2530

2531

2532

2533

2534

2537

2538

2539

2540 InsertValueInst(Value *Agg, Value *Val, unsigned Idx,

2541 const Twine &NameStr = "",

2543

2545 const Twine &NameStr);

2546

2547protected:

2548

2550

2552

2553public:

2554

2555 void *operator new(size_t S) { return User::operator new(S, AllocMarker); }

2556 void operator delete(void *Ptr) { User::operator delete(Ptr); }

2557

2560 const Twine &NameStr = "",

2562 return new InsertValueInst(Agg, Val, Idxs, NameStr, InsertBefore);

2563 }

2564

2565

2567

2569

2575

2585

2595

2597 return Indices;

2598 }

2599

2601 return (unsigned)Indices.size();

2602 }

2603

2607

2608

2610 return I->getOpcode() == Instruction::InsertValue;

2611 }

2615};

2616

2617template <>

2621

2622InsertValueInst::InsertValueInst(Value *Agg, Value *Val,

2625 : Instruction(Agg->getType(), InsertValue, AllocMarker, InsertBefore) {

2626 init(Agg, Val, Idxs, NameStr);

2627}

2628

2630

2631

2632

2633

2634

2635

2636

2637

2638

2641

2642

2643

2644 unsigned ReservedSpace;

2645

2646 PHINode(const PHINode &PN);

2647

2648 explicit PHINode(Type *Ty, unsigned NumReservedValues,

2649 const Twine &NameStr = "",

2651 : Instruction(Ty, Instruction::PHI, AllocMarker, InsertBefore),

2652 ReservedSpace(NumReservedValues) {

2653 assert(!Ty->isTokenTy() && "PHI nodes cannot have token type!");

2656 }

2657

2658protected:

2659

2661

2663

2664

2665

2666

2670

2671public:

2672

2673

2674 static PHINode *Create(Type *Ty, unsigned NumReservedValues,

2675 const Twine &NameStr = "",

2677 return new (AllocMarker)

2678 PHINode(Ty, NumReservedValues, NameStr, InsertBefore);

2679 }

2680

2681

2683

2684

2685

2686

2687

2688

2691

2695

2699

2703

2705

2707

2708

2709

2711

2712

2713

2718 assert(V && "PHI node got a null value!");

2720 "All operands to PHI node must be the same type as the PHI node!");

2722 }

2723

2727

2731

2732

2733

2737

2738

2739

2740

2742 assert(this == U.getUser() && "Iterator doesn't point to PHI's Uses?");

2744 }

2745

2746

2747

2748

2752

2756

2757

2758

2763

2764

2766 assert(New && Old && "PHI node got a null basic block!");

2770 }

2771

2772

2773

2776 growOperands();

2777

2781 }

2782

2783

2784

2785

2786

2787

2788

2789

2790

2791 LLVM_ABI Value *removeIncomingValue(unsigned Idx,

2792 bool DeletePHIIfEmpty = true);

2793

2796 assert(Idx >= 0 && "Invalid basic block argument to remove!");

2798 }

2799

2800

2801

2803 bool DeletePHIIfEmpty = true);

2804

2805

2806

2807

2809 for (unsigned i = 0, e = getNumOperands(); i != e; ++i)

2811 return i;

2812 return -1;

2813 }

2814

2817 assert(Idx >= 0 && "Invalid basic block argument!");

2819 }

2820

2821

2823 assert(BB && "PHI node got a null basic block!");

2824 bool Found = false;

2827 Found = true;

2829 }

2830 (void)Found;

2831 assert(Found && "Invalid basic block argument to set!");

2832 }

2833

2834

2835

2837

2838

2839

2840

2841 LLVM_ABI bool hasConstantOrUndefValue() const;

2842

2843

2844

2851

2852

2854 return I->getOpcode() == Instruction::PHI;

2855 }

2859

2860private:

2861 LLVM_ABI void growOperands();

2862};

2863

2865

2867

2868

2869

2870

2871

2872

2873

2874

2875

2876

2877

2878

2879

2882

2884

2885

2886

2887 unsigned ReservedSpace;

2888

2889 LandingPadInst(const LandingPadInst &LP);

2890

2891public:

2893

2894private:

2897

2898

2899 void *operator new(size_t S) { return User::operator new(S, AllocMarker); }

2900

2902 void init(unsigned NumReservedValues, const Twine &NameStr);

2903

2904protected:

2905

2907

2909

2910public:

2911 void operator delete(void *Ptr) { User::operator delete(Ptr); }

2912

2913

2914

2916 unsigned NumReservedClauses,

2917 const Twine &NameStr = "",

2919

2920

2922

2923

2924

2925

2927

2928

2930

2931

2933

2934

2935

2939

2940

2944

2945

2949

2950

2952

2953

2954

2956

2957

2959 return I->getOpcode() == Instruction::LandingPad;

2960 }

2964};

2965

2966template <>

2968

2970

2971

2972

2973

2974

2975

2976

2977

2978

2981

2982private:

2983

2984

2985

2986

2987

2988

2989

2990

2991

2992

2993

2994

2995

2999

3000protected:

3001

3003

3005

3006public:

3010 return new (AllocMarker) ReturnInst(C, retVal, AllocMarker, InsertBefore);

3011 }

3012

3015 return new (AllocMarker) ReturnInst(C, nullptr, AllocMarker, InsertAtEnd);

3016 }

3017

3018

3020

3021

3025

3027

3028

3030 return (I->getOpcode() == Instruction::Ret);

3031 }

3035

3036private:

3037 BasicBlock *getSuccessor(unsigned idx) const {

3039 }

3040

3041 void setSuccessor(unsigned idx, BasicBlock *B) {

3043 }

3044};

3045

3046template <>

3048

3050

3051

3052

3053

3054

3055

3056

3057

3059

3060

3061

3062

3064

3065

3066

3067

3068

3069

3070

3071

3072

3077

3078 void AssertOK();

3079

3080protected:

3081

3083

3085

3086public:

3087

3088

3089

3090

3093 std::random_access_iterator_tag, BasicBlock *,

3094 ptrdiff_t, BasicBlock *, BasicBlock *> {

3096

3099 };

3100

3101

3104 std::random_access_iterator_tag,

3105 const BasicBlock *, ptrdiff_t, const BasicBlock *,

3106 const BasicBlock *> {

3109

3112 };

3113

3117 return new (AllocMarker) BranchInst(IfTrue, AllocMarker, InsertBefore);

3118 }

3119

3124 return new (AllocMarker)

3125 BranchInst(IfTrue, IfFalse, Cond, AllocMarker, InsertBefore);

3126 }

3127

3128

3130

3133

3136 return Op<-3>();

3137 }

3138

3140 assert(isConditional() && "Cannot set condition of unconditional branch!");

3141 Op<-3>() = V;

3142 }

3143

3145

3150

3153 *(&Op<-1>() - idx) = NewSucc;

3154 }

3155

3156

3157

3158

3159

3160

3161 LLVM_ABI void swapSuccessors();

3162

3168

3174

3175

3177 return (I->getOpcode() == Instruction::Br);

3178 }

3182};

3183

3184template <>

3186

3188

3189

3190

3191

3192

3193

3194

3195

3198

3199 unsigned ReservedSpace;

3200

3201

3202

3203

3204

3205 SwitchInst(const SwitchInst &SI);

3206

3207

3208

3209

3210

3213

3214

3215 void *operator new(size_t S) { return User::operator new(S, AllocMarker); }

3216

3218 void growOperands();

3219

3220protected:

3221

3223

3225

3226public:

3227 void operator delete(void *Ptr) { User::operator delete(Ptr); }

3228

3229

3231

3233

3234

3235

3236

3237

3238

3239 template <typename SwitchInstT, typename ConstantIntT, typename BasicBlockT>

3241

3243 CaseHandleImpl<SwitchInstT, ConstantIntT, BasicBlockT>>;

3244

3245 protected:

3246

3248

3251

3254

3255 public:

3256

3259 "Index out the number of cases.");

3260 return reinterpret_cast<ConstantIntT *>(SI->getOperand(2 + Index * 2));

3261 }

3262

3263

3267 "Index out the number of cases.");

3269 }

3270

3271

3273

3274

3278 "Index out the number of cases.");

3280 }

3281

3283 assert(SI == RHS.SI && "Incompatible operators.");

3285 }

3286 };

3287

3290

3292 : public CaseHandleImpl<SwitchInst, ConstantInt, BasicBlock> {

3294

3295 public:

3297

3298

3301 "Index out the number of cases.");

3302 SI->setOperand(2 + Index*2, reinterpret_cast<Value*>(V));

3303 }

3304

3305

3309 };

3310

3311 template

3314 std::random_access_iterator_tag,

3315 const CaseHandleT> {

3316 using SwitchInstT = typename CaseHandleT::SwitchInstType;

3317

3318 CaseHandleT Case;

3319

3320 public:

3321

3322

3324

3325

3326

3328

3329

3330

3332 unsigned SuccessorIndex) {

3334 "Successor index # out of range!");

3335 return SuccessorIndex != 0 ? CaseIteratorImpl(SI, SuccessorIndex - 1)

3337 }

3338

3339

3340

3344

3346

3347

3348 assert(Case.Index + N >= 0 &&

3349 (unsigned)(Case.Index + N) <= Case.SI->getNumCases() &&

3350 "Case.Index out the number of cases.");

3351 Case.Index += N;

3352 return *this;

3353 }

3355

3356

3357 assert(Case.Index - N >= 0 &&

3358 (unsigned)(Case.Index - N) <= Case.SI->getNumCases() &&

3359 "Case.Index out the number of cases.");

3360 Case.Index -= N;

3361 return *this;

3362 }

3364 assert(Case.SI == RHS.Case.SI && "Incompatible operators.");

3365 return Case.Index - RHS.Case.Index;

3366 }

3368 return Case == RHS.Case;

3369 }

3371 assert(Case.SI == RHS.Case.SI && "Incompatible operators.");

3372 return Case.Index < RHS.Case.Index;

3373 }

3374 const CaseHandleT &operator*() const { return Case; }

3375 };

3376

3379

3381 unsigned NumCases,

3383 return new SwitchInst(Value, Default, NumCases, InsertBefore);

3384 }

3385

3386

3388

3389

3392

3396

3397

3398

3402

3406

3407

3408

3412

3413

3414

3416 return CaseIt(this, 0);

3417 }

3418

3419

3420

3424

3425

3426

3430

3431

3432

3436

3437

3441

3442

3446

3447

3448

3449

3450

3451

3458

3459

3460

3461

3462

3465 this,

3466 const_cast<const SwitchInst *>(this)->findCaseValue(C)->getCaseIndex());

3467 }

3471 });

3473 return I;

3474

3476 }

3477

3478

3479

3482 return nullptr;

3483

3485 for (auto Case : cases()) {

3486 if (Case.getCaseSuccessor() != BB)

3487 continue;

3488

3489 if (CI)

3490 return nullptr;

3491

3492 CI = Case.getCaseValue();

3493 }

3494

3495 return CI;

3496 }

3497

3498

3499

3500

3501

3503

3504

3505

3506

3507

3508

3509

3510

3511 LLVM_ABI CaseIt removeCase(CaseIt I);

3512

3522

3523

3525 return I->getOpcode() == Instruction::Switch;

3526 }

3530};

3531

3532

3533

3536 std::optional<SmallVector<uint32_t, 8>> Weights;

3537 bool Changed = false;

3538

3539protected:

3541

3542public:

3547

3549

3551 if (Changed && Weights.has_value() && Weights->size() >= 2)

3552 setBranchWeights(SI, Weights.value(), false);

3553 }

3554

3555

3556

3558

3559

3560

3561

3563

3564

3565

3567

3568

3569

3571

3574

3576 unsigned idx);

3577};

3578

3580

3582

3583

3584

3585

3586

3587

3588

3589

3592

3593 unsigned ReservedSpace;

3594

3595

3596

3597 IndirectBrInst(const IndirectBrInst &IBI);

3598

3599

3600

3601

3602

3605

3606

3607 void *operator new(size_t S) { return User::operator new(S, AllocMarker); }

3608

3609 void init(Value *Address, unsigned NumDests);

3610 void growOperands();

3611

3612protected:

3613

3615

3617

3618public:

3619 void operator delete(void *Ptr) { User::operator delete(Ptr); }

3620

3621

3622

3623

3624

3627 std::random_access_iterator_tag, BasicBlock *,

3628 ptrdiff_t, BasicBlock *, BasicBlock *> {

3630

3633 };

3634

3635

3638 std::random_access_iterator_tag,

3639 const BasicBlock *, ptrdiff_t, const BasicBlock *,

3640 const BasicBlock *> {

3643

3646 };

3647

3650 return new IndirectBrInst(Address, NumDests, InsertBefore);

3651 }

3652

3653

3655

3656

3660

3661

3662

3664

3665

3668

3669

3670

3672

3673

3674

3675 LLVM_ABI void removeDestination(unsigned i);

3676

3684

3689

3694

3695

3697 return I->getOpcode() == Instruction::IndirectBr;

3698 }

3702};

3703

3704template <>

3706

3708

3709

3710

3711

3712

3713

3714

3715

3717

3718

3719 static constexpr int NumExtraOperands = 2;

3720

3721

3722 static constexpr int NormalDestOpEndIdx = -3;

3723

3724

3725 static constexpr int UnwindDestOpEndIdx = -2;

3726

3728

3729

3730

3731

3736

3740

3741

3742 static unsigned ComputeNumOperands(unsigned NumArgs,

3743 size_t NumBundleInputs = 0) {

3744

3745

3746 return 1 + NumExtraOperands + NumArgs + unsigned(NumBundleInputs);

3747 }

3748

3749protected:

3750

3752

3754

3755public:

3758 const Twine &NameStr,

3761 ComputeNumOperands(unsigned(Args.size()))};

3762 return new (AllocMarker) InvokeInst(Ty, Func, IfNormal, IfException, Args,

3763 {}, AllocMarker, NameStr, InsertBefore);

3764 }

3765

3769 const Twine &NameStr = "",

3771 IntrusiveOperandsAndDescriptorAllocMarker AllocMarker{

3772 ComputeNumOperands(Args.size(), CountBundleInputs(Bundles)),

3773 unsigned(Bundles.size() * sizeof(BundleOpInfo))};

3774

3775 return new (AllocMarker)

3776 InvokeInst(Ty, Func, IfNormal, IfException, Args, Bundles, AllocMarker,

3777 NameStr, InsertBefore);

3778 }

3779

3782 const Twine &NameStr,

3784 return Create(Func.getFunctionType(), Func.getCallee(), IfNormal,

3785 IfException, Args, {}, NameStr, InsertBefore);

3786 }

3787

3791 const Twine &NameStr = "",

3793 return Create(Func.getFunctionType(), Func.getCallee(), IfNormal,

3794 IfException, Args, Bundles, NameStr, InsertBefore);

3795 }

3796

3797

3798

3799

3800

3801

3802

3803 LLVM_ABI static InvokeInst *Create(InvokeInst *II,

3805 InsertPosition InsertPt = nullptr);

3806

3807

3820

3821

3822

3824

3826 assert(i < 2 && "Successor # out of range for invoke!");

3828 }

3829

3831 assert(i < 2 && "Successor # out of range for invoke!");

3832 if (i == 0)

3834 else

3836 }

3837

3839

3840

3842

3843

3845 return (I->getOpcode() == Instruction::Invoke);

3846 }

3850

3851private:

3852

3853

3854 template

3855 void setSubclassData(typename Bitfield::Type Value) {

3857 }

3858};

3859

3865 InsertBefore) {

3866 init(Ty, Func, IfNormal, IfException, Args, Bundles, NameStr);

3867}

3868

3869

3870

3871

3872

3873

3874

3875

3876

3878

3879 unsigned NumIndirectDests;

3880

3882

3883

3884

3885

3891

3895 const Twine &NameStr);

3896

3897

3898 static unsigned ComputeNumOperands(int NumArgs, int NumIndirectDests,

3899 int NumBundleInputs = 0) {

3900

3901

3902 return unsigned(2 + NumIndirectDests + NumArgs + NumBundleInputs);

3903 }

3904

3905protected:

3906

3908

3910

3911public:

3918 ComputeNumOperands(Args.size(), IndirectDests.size())};

3919 return new (AllocMarker)

3920 CallBrInst(Ty, Func, DefaultDest, IndirectDests, Args, {}, AllocMarker,

3921 NameStr, InsertBefore);

3922 }

3923

3929 IntrusiveOperandsAndDescriptorAllocMarker AllocMarker{

3930 ComputeNumOperands(Args.size(), IndirectDests.size(),

3932 unsigned(Bundles.size() * sizeof(BundleOpInfo))};

3933

3934 return new (AllocMarker)

3935 CallBrInst(Ty, Func, DefaultDest, IndirectDests, Args, Bundles,

3936 AllocMarker, NameStr, InsertBefore);

3937 }

3938

3943 return Create(Func.getFunctionType(), Func.getCallee(), DefaultDest,

3944 IndirectDests, Args, NameStr, InsertBefore);

3945 }

3946

3951 const Twine &NameStr = "",

3953 return Create(Func.getFunctionType(), Func.getCallee(), DefaultDest,

3954 IndirectDests, Args, Bundles, NameStr, InsertBefore);

3955 }

3956

3957

3958

3959

3960

3961

3962

3965 InsertPosition InsertBefore = nullptr);

3966

3967

3968

3970

3971

3972

3977

3982

3983

3994 return IndirectDests;

3995 }

4002

4005 "Successor # out of range for callbr!");

4007 }

4008

4011 "Successor # out of range for callbr!");

4013 }

4014

4016

4017

4019 return (I->getOpcode() == Instruction::CallBr);

4020 }

4024

4025private:

4026

4027

4028 template

4029 void setSubclassData(typename Bitfield::Type Value) {

4031 }

4032};

4033

4040 InsertBefore) {

4041 init(Ty, Func, DefaultDest, IndirectDests, Args, Bundles, NameStr);

4042}

4043

4044

4045

4046

4047

4048

4049

4050

4053

4054 ResumeInst(const ResumeInst &RI);

4055

4058

4059protected:

4060

4062

4064

4065public:

4067 return new (AllocMarker) ResumeInst(Exn, InsertBefore);

4068 }

4069

4070

4072

4073

4075

4077

4078

4080 return I->getOpcode() == Instruction::Resume;

4081 }

4085

4086private:

4087 BasicBlock *getSuccessor(unsigned idx) const {

4089 }

4090

4091 void setSuccessor(unsigned idx, BasicBlock *NewSucc) {

4093 }

4094};

4095

4096template <>

4100

4102

4103

4104

4105

4108

4110

4111

4112

4113 unsigned ReservedSpace;

4114

4115

4116

4117

4118 CatchSwitchInst(const CatchSwitchInst &CSI);

4119

4120

4121

4122

4123

4125 unsigned NumHandlers, const Twine &NameStr,

4127

4128

4129 void *operator new(size_t S) { return User::operator new(S, AllocMarker); }

4130

4131 void init(Value *ParentPad, BasicBlock *UnwindDest, unsigned NumReserved);

4132 void growOperands(unsigned Size);

4133

4134protected:

4135

4137

4139

4140public:

4141 void operator delete(void *Ptr) { return User::operator delete(Ptr); }

4142

4144 unsigned NumHandlers,

4145 const Twine &NameStr = "",

4147 return new CatchSwitchInst(ParentPad, UnwindDest, NumHandlers, NameStr,

4148 InsertBefore);

4149 }

4150

4151

4153

4154

4157

4158

4164 return nullptr;

4165 }

4171

4172

4173

4179

4180private:

4182 static const BasicBlock *handler_helper(const Value *V) {

4184 }

4185

4186public:

4194

4195

4202

4203

4204

4211

4212

4213

4217

4218

4219

4223

4224

4228

4229

4233

4234

4235

4236

4237

4239

4240 LLVM_ABI void removeHandler(handler_iterator HI);

4241

4245 "Successor # out of range for catchswitch!");

4247 }

4250 "Successor # out of range for catchswitch!");

4252 }

4253

4254

4256 return I->getOpcode() == Instruction::CatchSwitch;

4257 }

4261};

4262

4263template <>

4265

4267

4268

4269

4270

4271class CleanupPadInst : public FuncletPadInst {

4272private:

4276 : FuncletPadInst(Instruction::CleanupPad, ParentPad, Args, AllocInfo,

4277 NameStr, InsertBefore) {}

4278

4279public:

4281 const Twine &NameStr = "",

4283 IntrusiveOperandsAllocMarker AllocMarker{unsigned(1 + Args.size())};

4284 return new (AllocMarker)

4285 CleanupPadInst(ParentPad, Args, AllocMarker, NameStr, InsertBefore);

4286 }

4287

4288

4290 return I->getOpcode() == Instruction::CleanupPad;

4291 }

4295};

4296

4297

4298

4299

4300class CatchPadInst : public FuncletPadInst {

4301private:

4305 : FuncletPadInst(Instruction::CatchPad, CatchSwitch, Args, AllocInfo,

4306 NameStr, InsertBefore) {}

4307

4308public:

4310 const Twine &NameStr = "",

4313 return new (AllocMarker)

4314 CatchPadInst(CatchSwitch, Args, AllocMarker, NameStr, InsertBefore);

4315 }

4316

4317

4322 assert(CatchSwitch);

4323 Op<-1>() = CatchSwitch;

4324 }

4325

4326

4328 return I->getOpcode() == Instruction::CatchPad;

4329 }

4333};

4334

4335

4336

4337

4338

4341

4342 CatchReturnInst(const CatchReturnInst &RI);

4345

4347

4348protected:

4349

4351

4353

4354public:

4359 return new (AllocMarker) CatchReturnInst(CatchPad, BB, InsertBefore);

4360 }

4361

4362

4364

4365

4369 Op<0>() = CatchPad;

4370 }

4371

4375 Op<1>() = NewSucc;

4376 }

4378

4379

4380

4384

4385

4387 return (I->getOpcode() == Instruction::CatchRet);

4388 }

4392

4393private:

4397 }

4398

4402 }

4403};

4404

4405template <>

4408

4410

4411

4412

4413

4414

4417

4418private:

4419 CleanupReturnInst(const CleanupReturnInst &RI, AllocInfo AllocInfo);

4423

4425

4426protected:

4427

4429

4431

4432public:

4437 unsigned Values = 1;

4438 if (UnwindBB)

4439 ++Values;

4441 return new (AllocMarker)

4442 CleanupReturnInst(CleanupPad, UnwindBB, AllocMarker, InsertBefore);

4443 }

4444

4445

4447

4450

4451

4457 Op<0>() = CleanupPad;

4458 }

4459

4461

4468 Op<1>() = NewDest;

4469 }

4470

4471

4473 return (I->getOpcode() == Instruction::CleanupRet);

4474 }

4478

4479private:

4480 BasicBlock *getSuccessor(unsigned Idx) const {

4482 return getUnwindDest();

4483 }

4484

4485 void setSuccessor(unsigned Idx, BasicBlock *B) {

4487 setUnwindDest(B);

4488 }

4489

4490

4491

4492 template

4493 void setSubclassData(typename Bitfield::Type Value) {

4495 }

4496};

4497

4498template <>

4501

4503

4504

4505

4506

4507

4508

4509

4510

4511

4512

4515

4516protected:

4517

4519

4521

4522public:

4525

4526

4527 void *operator new(size_t S) { return User::operator new(S, AllocMarker); }

4528 void operator delete(void *Ptr) { User::operator delete(Ptr); }

4529

4531

4532

4534 return I->getOpcode() == Instruction::Unreachable;

4535 }

4539

4540

4541 LLVM_ABI bool shouldLowerToTrap(bool TrapUnreachable,

4542 bool NoTrapAfterNoreturn) const;

4543

4544private:

4545 BasicBlock *getSuccessor(unsigned idx) const {

4547 }

4548

4549 void setSuccessor(unsigned idx, BasicBlock *B) {

4551 }

4552};

4553

4554

4555

4556

4557

4558

4560protected:

4561

4563

4564

4566

4567public:

4569

4570

4573 Type *Ty,

4574 const Twine &NameStr = "",

4576 nullptr

4577 );

4578

4579

4581 return I->getOpcode() == Trunc;

4582 }

4586

4595

4596

4597

4601

4602

4603

4607

4608

4610 unsigned NoWrapKind = 0;

4613

4616

4617 return NoWrapKind;

4618 }

4619};

4620

4621

4622

4623

4624

4625

4627protected:

4628

4630

4631

4633

4634public:

4635

4637 ZExtInst(Value *S,

4638 Type *Ty,

4639 const Twine &NameStr = "",

4641 nullptr

4642 );

4643

4644

4646 return I->getOpcode() == ZExt;

4647 }

4651};

4652

4653

4654

4655

4656

4657

4659protected:

4660

4662

4663

4665

4666public:

4667

4669 SExtInst(Value *S,

4670 Type *Ty,

4671 const Twine &NameStr = "",

4673 nullptr

4674 );

4675

4676

4678 return I->getOpcode() == SExt;

4679 }

4683};

4684

4685

4686

4687

4688

4689

4691protected:

4692

4694

4695

4697

4698public:

4701 Type *Ty,

4702 const Twine &NameStr = "",

4704 nullptr

4705 );

4706

4707

4709 return I->getOpcode() == FPTrunc;

4710 }

4714};

4715

4716

4717

4718

4719

4720

4722protected:

4723

4725

4726

4728

4729public:

4730

4733 Type *Ty,

4734 const Twine &NameStr = "",

4736 nullptr

4737 );

4738

4739

4741 return I->getOpcode() == FPExt;

4742 }

4746};

4747

4748

4749

4750

4751

4752

4754protected:

4755

4757

4758

4760

4761public:

4762

4765 Type *Ty,

4766 const Twine &NameStr = "",

4768 nullptr

4769 );

4770

4771

4773 return I->getOpcode() == UIToFP;

4774 }

4778};

4779

4780

4781

4782

4783

4784

4786protected:

4787

4789

4790

4792

4793public:

4794

4797 Type *Ty,

4798 const Twine &NameStr = "",

4800 nullptr

4801 );

4802

4803

4805 return I->getOpcode() == SIToFP;

4806 }

4810};

4811

4812

4813

4814

4815

4816

4818protected:

4819

4821

4822

4824

4825public:

4826

4829 Type *Ty,

4830 const Twine &NameStr = "",

4832 nullptr

4833 );

4834

4835

4837 return I->getOpcode() == FPToUI;

4838 }

4842};

4843

4844

4845

4846

4847

4848

4850protected:

4851

4853

4854

4856

4857public:

4858

4861 Type *Ty,

4862 const Twine &NameStr = "",

4864 nullptr

4865 );

4866

4867

4869 return I->getOpcode() == FPToSI;

4870 }

4874};

4875

4876

4877

4878

4879

4880

4882public:

4883

4885

4886

4889 Type *Ty,

4890 const Twine &NameStr = "",

4892 nullptr

4893 );

4894

4895

4897

4898

4902

4903

4905 return I->getOpcode() == IntToPtr;

4906 }

4910};

4911

4912

4913

4914

4915

4916

4918protected:

4919

4921

4922

4924

4925public:

4926

4929 Type *Ty,

4930 const Twine &NameStr = "",

4932 nullptr

4933 );

4934

4935

4937

4939

4941

4942

4946

4947

4949 return I->getOpcode() == PtrToInt;

4950 }

4954};

4955

4956

4957

4959protected:

4960

4962

4963

4965

4966public:

4967

4969 Type *Ty,

4970 const Twine &NameStr = "",

4972 nullptr

4973 );

4974

4975

4977

4979

4981

4982

4986

4987

4989 return I->getOpcode() == PtrToAddr;

4990 }

4994};

4995

4996

4997

4998

4999

5000

5002protected:

5003

5005

5006

5008

5009public:

5010

5013 Type *Ty,

5014 const Twine &NameStr = "",

5016 nullptr

5017 );

5018

5019

5021 return I->getOpcode() == BitCast;

5022 }

5026};

5027

5028

5029

5030

5031

5032

5033

5035protected:

5036

5038

5039

5041

5042public:

5043

5045 Value *S,

5046 Type *Ty,

5047 const Twine &NameStr = "",

5049 nullptr

5050 );

5051

5052

5054 return I->getOpcode() == AddrSpaceCast;

5055 }

5059

5060

5064

5065

5069

5070

5074

5075

5079

5080

5084};

5085

5086

5087

5088

5089

5090

5091

5094 return Load->getPointerOperand();

5096 return Store->getPointerOperand();

5097 return nullptr;

5098}

5100 return const_cast<Value *>(

5102}

5103

5104

5105

5108 return Ptr;

5110 return Gep->getPointerOperand();

5111 return nullptr;

5112}

5116

5117

5120 "Expected Load or Store instruction");

5122 return LI->getAlign();

5124}

5125

5126

5129 "Expected Load or Store instruction");

5131 LI->setAlignment(NewAlign);

5132 else

5134}

5135

5136

5137

5140 "Expected Load or Store instruction");

5142 return LI->getPointerAddressSpace();

5144}

5145

5146

5149 "Expected Load or Store instruction");

5151 return LI->getType();

5153}

5154

5155

5156

5158 if (I->isAtomic())

5159 return std::nullopt;

5161 return AI->getSyncScopeID();

5163 return AI->getSyncScopeID();

5165 return AI->getSyncScopeID();

5167 return AI->getSyncScopeID();

5169 return AI->getSyncScopeID();

5171}

5172

5173

5177 AI->setSyncScopeID(SSID);

5179 AI->setSyncScopeID(SSID);

5181 AI->setSyncScopeID(SSID);

5183 AI->setSyncScopeID(SSID);

5185 AI->setSyncScopeID(SSID);

5186 else

5188}

5189

5190

5191

5192

5193

5194

5195

5197protected:

5198

5200

5201

5203

5204public:

5207

5208

5210 return I->getOpcode() == Freeze;

5211 }

5215};

5216

5217}

5218

5219#endif

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

static bool isReverseMask(ArrayRef< int > M, EVT VT)

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

Atomic ordering constants.

static const Function * getParent(const Value *V)

This file implements methods to test, set and extract typed bits from packed unsigned integers.

static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")

This file provides various utilities for inspecting and working with the control flow graph in LLVM I...

This defines the Use class.

const size_t AbstractManglingParser< Derived, Alloc >::NumOps

This file implements a map that provides insertion order iteration.

uint64_t IntrinsicInst * II

#define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS)

Macro for generating out-of-class operand accessor definitions.

PowerPC Reduce CR logical Operation

This file contains the declarations for profiling metadata utility functions.

const SmallVectorImpl< MachineOperand > & Cond

This file defines the SmallVector class.

static SymbolRef::Type getType(const Symbol *Sym)

Class for arbitrary precision integers.

const Value * getPointerOperand() const

Gets the pointer operand.

Definition Instructions.h:5066

LLVM_ABI AddrSpaceCastInst * cloneImpl() const

Clone an identical AddrSpaceCastInst.

Value * getPointerOperand()

Gets the pointer operand.

Definition Instructions.h:5061

static bool classof(const Instruction *I)

Definition Instructions.h:5053

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:5037

static bool classof(const Value *V)

Definition Instructions.h:5056

unsigned getSrcAddressSpace() const

Returns the address space of the pointer operand.

Definition Instructions.h:5076

LLVM_ABI AddrSpaceCastInst(Value *S, Type *Ty, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Constructor with insert-before-instruction semantics.

unsigned getDestAddressSpace() const

Returns the address space of the result.

Definition Instructions.h:5081

static unsigned getPointerOperandIndex()

Gets the operand index of the pointer operand.

Definition Instructions.h:5071

LLVM_ABI std::optional< TypeSize > getAllocationSizeInBits(const DataLayout &DL) const

Get allocation size in bits.

static bool classof(const Value *V)

Definition Instructions.h:162

bool isSwiftError() const

Return true if this alloca is used as a swifterror argument to a call.

Definition Instructions.h:154

void setSwiftError(bool V)

Specify whether this alloca is used to represent a swifterror.

Definition Instructions.h:156

LLVM_ABI bool isStaticAlloca() const

Return true if this alloca is in the entry block of the function and is a constant size.

Align getAlign() const

Return the alignment of the memory that is being allocated by the instruction.

Definition Instructions.h:129

void setAllocatedType(Type *Ty)

for use only in special circumstances that need to generically transform a whole instruction (eg: IR ...

Definition Instructions.h:125

static bool classof(const Instruction *I)

Definition Instructions.h:159

PointerType * getType() const

Overload to return most specific pointer type.

Definition Instructions.h:102

void setUsedWithInAlloca(bool V)

Specify whether this alloca is used to represent the arguments to a call.

Definition Instructions.h:149

LLVM_ABI AllocaInst * cloneImpl() const

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:77

Type * getAllocatedType() const

Return the type that is being allocated by the instruction.

Definition Instructions.h:122

bool isUsedWithInAlloca() const

Return true if this alloca is used as an inalloca argument to a call.

Definition Instructions.h:144

Value * getArraySize()

Definition Instructions.h:99

unsigned getAddressSpace() const

Return the address space for the allocation.

Definition Instructions.h:107

LLVM_ABI std::optional< TypeSize > getAllocationSize(const DataLayout &DL) const

Get allocation size in bytes.

LLVM_ABI bool isArrayAllocation() const

Return true if there is an allocation size parameter to the allocation instruction that is not 1.

void setAlignment(Align Align)

Definition Instructions.h:133

const Value * getArraySize() const

Get the number of elements allocated.

Definition Instructions.h:98

LLVM_ABI AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize, const Twine &Name, InsertPosition InsertBefore)

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

size_t size() const

size - Get the array size.

An instruction that atomically checks whether a specified value is in a memory location,...

Definition Instructions.h:507

BoolBitfieldElementT< 0 > VolatileField

Definition Instructions.h:535

const Value * getCompareOperand() const

Definition Instructions.h:640

AlignmentBitfieldElementT< FailureOrderingField::NextBit > AlignmentField

Definition Instructions.h:541

Value * getNewValOperand()

Definition Instructions.h:642

void setSyncScopeID(SyncScope::ID SSID)

Sets the synchronization scope ID of this cmpxchg instruction.

Definition Instructions.h:631

AtomicOrdering getMergedOrdering() const

Returns a single ordering which is at least as strong as both the success and failure orderings for t...

Definition Instructions.h:613

void setWeak(bool IsWeak)

Definition Instructions.h:570

bool isVolatile() const

Return true if this is a cmpxchg from a volatile memory location.

Definition Instructions.h:561

unsigned getPointerAddressSpace() const

Returns the address space of the pointer operand.

Definition Instructions.h:646

BoolBitfieldElementT< VolatileField::NextBit > WeakField

Definition Instructions.h:536

Value * getCompareOperand()

Definition Instructions.h:639

void setFailureOrdering(AtomicOrdering Ordering)

Sets the failure ordering constraint of this cmpxchg instruction.

Definition Instructions.h:605

AtomicOrderingBitfieldElementT< SuccessOrderingField::NextBit > FailureOrderingField

Definition Instructions.h:539

static bool isValidFailureOrdering(AtomicOrdering Ordering)

Definition Instructions.h:580

AtomicOrderingBitfieldElementT< WeakField::NextBit > SuccessOrderingField

Definition Instructions.h:537

AtomicOrdering getFailureOrdering() const

Returns the failure ordering constraint of this cmpxchg instruction.

Definition Instructions.h:600

void setSuccessOrdering(AtomicOrdering Ordering)

Sets the success ordering constraint of this cmpxchg instruction.

Definition Instructions.h:593

Value * getPointerOperand()

Definition Instructions.h:635

static AtomicOrdering getStrongestFailureOrdering(AtomicOrdering SuccessOrdering)

Returns the strongest permitted ordering on failure, given the desired ordering on success.

Definition Instructions.h:658

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Transparently provide more efficient getOperand methods.

LLVM_ABI AtomicCmpXchgInst * cloneImpl() const

Align getAlign() const

Return the alignment of the memory that is being allocated by the instruction.

Definition Instructions.h:550

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:521

const Value * getPointerOperand() const

Definition Instructions.h:636

static bool classof(const Value *V)

Definition Instructions.h:677

bool isWeak() const

Return true if this cmpxchg may spuriously fail.

Definition Instructions.h:568

void setAlignment(Align Align)

Definition Instructions.h:554

void setVolatile(bool V)

Specify whether this is a volatile cmpxchg.

Definition Instructions.h:565

static bool isValidSuccessOrdering(AtomicOrdering Ordering)

Definition Instructions.h:575

AtomicOrdering getSuccessOrdering() const

Returns the success ordering constraint of this cmpxchg instruction.

Definition Instructions.h:588

static unsigned getPointerOperandIndex()

Definition Instructions.h:637

const Value * getNewValOperand() const

Definition Instructions.h:643

SyncScope::ID getSyncScopeID() const

Returns the synchronization scope ID of this cmpxchg instruction.

Definition Instructions.h:626

LLVM_ABI AtomicCmpXchgInst(Value *Ptr, Value *Cmp, Value *NewVal, Align Alignment, AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering, SyncScope::ID SSID, InsertPosition InsertBefore=nullptr)

static bool classof(const Instruction *I)

Definition Instructions.h:674

an instruction that atomically reads a memory location, combines it with another value,...

Definition Instructions.h:710

Align getAlign() const

Return the alignment of the memory that is being allocated by the instruction.

Definition Instructions.h:844

static bool isFPOperation(BinOp Op)

Definition Instructions.h:824

LLVM_ABI AtomicRMWInst * cloneImpl() const

static unsigned getPointerOperandIndex()

Definition Instructions.h:889

bool isVolatile() const

Return true if this is a RMW on a volatile memory location.

Definition Instructions.h:854

void setVolatile(bool V)

Specify whether this is a volatile RMW or not.

Definition Instructions.h:858

BinOpBitfieldElement< AtomicOrderingField::NextBit > OperationField

Definition Instructions.h:814

BinOp

This enumeration lists the possible modifications atomicrmw can make.

Definition Instructions.h:722

@ Add

*p = old + v

Definition Instructions.h:726

@ FAdd

*p = old + v

Definition Instructions.h:747

@ USubCond

Subtract only if no unsigned overflow.

Definition Instructions.h:778

@ FMinimum

*p = minimum(old, v) minimum matches the behavior of llvm.minimum.

Definition Instructions.h:766

@ Min

*p = old <signed v ? old : v

Definition Instructions.h:740

@ BAD_BINOP

Definition Instructions.h:786

@ LAST_BINOP

Definition Instructions.h:785

@ Or

*p = old | v

Definition Instructions.h:734

@ Sub

*p = old - v

Definition Instructions.h:728

@ And

*p = old & v

Definition Instructions.h:730

@ Xor

*p = old ^ v

Definition Instructions.h:736

@ USubSat

*p = usub.sat(old, v) usub.sat matches the behavior of llvm.usub.sat.

Definition Instructions.h:782

@ FMaximum

*p = maximum(old, v) maximum matches the behavior of llvm.maximum.

Definition Instructions.h:762

@ FSub

*p = old - v

Definition Instructions.h:750

@ UIncWrap

Increment one up to a maximum value.

Definition Instructions.h:770

@ Max

*p = old >signed v ? old : v

Definition Instructions.h:738

@ UMin

*p = old <unsigned v ? old : v

Definition Instructions.h:744

@ FMin

*p = minnum(old, v) minnum matches the behavior of llvm.minnum.

Definition Instructions.h:758

@ UMax

*p = old >unsigned v ? old : v

Definition Instructions.h:742

@ FMax

*p = maxnum(old, v) maxnum matches the behavior of llvm.maxnum.

Definition Instructions.h:754

@ UDecWrap

Decrement one until a minimum value or zero.

Definition Instructions.h:774

@ FIRST_BINOP

Definition Instructions.h:784

@ Xchg

*p = v

Definition Instructions.h:724

@ Nand

*p = ~(old & v)

Definition Instructions.h:732

void setSyncScopeID(SyncScope::ID SSID)

Sets the synchronization scope ID of this rmw instruction.

Definition Instructions.h:883

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Transparently provide more efficient getOperand methods.

Value * getPointerOperand()

Definition Instructions.h:887

void setOrdering(AtomicOrdering Ordering)

Sets the ordering constraint of this rmw instruction.

Definition Instructions.h:869

bool isFloatingPointOperation() const

Definition Instructions.h:899

static bool classof(const Instruction *I)

Definition Instructions.h:904

const Value * getPointerOperand() const

Definition Instructions.h:888

void setOperation(BinOp Operation)

Definition Instructions.h:838

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:713

static bool classof(const Value *V)

Definition Instructions.h:907

BinOp getOperation() const

Definition Instructions.h:820

const Value * getValOperand() const

Definition Instructions.h:892

LLVM_ABI AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val, Align Alignment, AtomicOrdering Ordering, SyncScope::ID SSID, InsertPosition InsertBefore=nullptr)

SyncScope::ID getSyncScopeID() const

Returns the synchronization scope ID of this rmw instruction.

Definition Instructions.h:878

void setAlignment(Align Align)

Definition Instructions.h:848

Value * getValOperand()

Definition Instructions.h:891

AtomicOrdering getOrdering() const

Returns the ordering constraint of this rmw instruction.

Definition Instructions.h:864

AlignmentBitfieldElementT< OperationField::NextBit > AlignmentField

Definition Instructions.h:815

BoolBitfieldElementT< 0 > VolatileField

Definition Instructions.h:811

unsigned getPointerAddressSpace() const

Returns the address space of the pointer operand.

Definition Instructions.h:895

AtomicOrderingBitfieldElementT< VolatileField::NextBit > AtomicOrderingField

Definition Instructions.h:812

LLVM Basic Block Representation.

static bool classof(const Instruction *I)

Definition Instructions.h:5020

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:5004

static bool classof(const Value *V)

Definition Instructions.h:5023

LLVM_ABI BitCastInst * cloneImpl() const

Clone an identical BitCastInst.

LLVM_ABI BitCastInst(Value *S, Type *Ty, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Constructor with insert-before-instruction semantics.

Conditional or Unconditional Branch instruction.

Definition Instructions.h:3058

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Transparently provide more efficient getOperand methods.

iterator_range< succ_op_iterator > successors()

Definition Instructions.h:3163

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

Definition Instructions.h:3120

void setCondition(Value *V)

Definition Instructions.h:3139

static bool classof(const Instruction *I)

Definition Instructions.h:3176

LLVM_ABI BranchInst * cloneImpl() const

bool isConditional() const

Definition Instructions.h:3132

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:3082

unsigned getNumSuccessors() const

Definition Instructions.h:3144

static bool classof(const Value *V)

Definition Instructions.h:3179

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

Definition Instructions.h:3114

BasicBlock * getSuccessor(unsigned i) const

Definition Instructions.h:3146

bool isUnconditional() const

Definition Instructions.h:3131

void setSuccessor(unsigned idx, BasicBlock *NewSucc)

Definition Instructions.h:3151

Value * getCondition() const

Definition Instructions.h:3134

iterator_range< const_succ_op_iterator > successors() const

Definition Instructions.h:3169

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

void addFnAttr(Attribute::AttrKind Kind)

Adds the attribute to the function.

bool hasFnAttr(Attribute::AttrKind Kind) const

Determine whether this call has the given attribute.

CallBase(AttributeList const &A, FunctionType *FT, ArgsTy &&... Args)

LLVM_ABI Intrinsic::ID getIntrinsicID() const

Returns the intrinsic ID of the intrinsic called or Intrinsic::not_intrinsic if the called function i...

static unsigned CountBundleInputs(ArrayRef< OperandBundleDef > Bundles)

Return the total number of values used in Bundles.

unsigned arg_size() const

unsigned getNumTotalBundleOperands() const

Return the total number operands (not operand bundles) used by every operand bundle in this OperandBu...

CallBr instruction, tracking function calls that may not return control but instead transfer it to a ...

Definition Instructions.h:3877

static bool classof(const Value *V)

Definition Instructions.h:4021

static CallBrInst * Create(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles={}, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Definition Instructions.h:3925

static bool classof(const Instruction *I)

Definition Instructions.h:4018

static CallBrInst * Create(FunctionCallee Func, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles={}, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Definition Instructions.h:3947

SmallVector< BasicBlock *, 16 > getIndirectDests() const

Definition Instructions.h:3990

static CallBrInst * Create(FunctionCallee Func, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args, const Twine &NameStr, InsertPosition InsertBefore=nullptr)

Definition Instructions.h:3939

void setSuccessor(unsigned i, BasicBlock *NewSucc)

Definition Instructions.h:4009

BasicBlock * getSuccessor(unsigned i) const

Definition Instructions.h:4003

Value * getIndirectDestLabelUse(unsigned i) const

Definition Instructions.h:3978

BasicBlock * getIndirectDest(unsigned i) const

Definition Instructions.h:3987

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:3907

void setDefaultDest(BasicBlock *B)

Definition Instructions.h:3996

unsigned getNumSuccessors() const

Definition Instructions.h:4015

void setIndirectDest(unsigned i, BasicBlock *B)

Definition Instructions.h:3999

Value * getIndirectDestLabel(unsigned i) const

getIndirectDestLabel - Return the i-th indirect dest label.

Definition Instructions.h:3973

BasicBlock * getDefaultDest() const

Definition Instructions.h:3984

unsigned getNumIndirectDests() const

Return the number of callbr indirect dest labels.

Definition Instructions.h:3969

static CallBrInst * Create(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args, const Twine &NameStr, InsertPosition InsertBefore=nullptr)

Definition Instructions.h:3912

LLVM_ABI CallBrInst * cloneImpl() const

This class represents a function call, abstracting a target machine's calling convention.

Definition Instructions.h:1511

bool isNoTailCall() const

Definition Instructions.h:1629

LLVM_ABI void updateProfWeight(uint64_t S, uint64_t T)

Updates profile metadata by scaling it by S / T.

static bool classof(const Value *V)

Definition Instructions.h:1658

bool isTailCall() const

Definition Instructions.h:1622

void setCanReturnTwice()

Definition Instructions.h:1641

void setTailCallKind(TailCallKind TCK)

Definition Instructions.h:1631

Bitfield::Element< TailCallKind, 0, 2, TCK_LAST > TailCallKindField

Definition Instructions.h:1613

static CallInst * Create(FunctionType *Ty, Value *Func, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles={}, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Definition Instructions.h:1561

static CallInst * Create(FunctionType *Ty, Value *Func, ArrayRef< Value * > Args, const Twine &NameStr, InsertPosition InsertBefore=nullptr)

Definition Instructions.h:1553

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:1541

bool canReturnTwice() const

Return true if the call can return twice.

Definition Instructions.h:1640

TailCallKind getTailCallKind() const

Definition Instructions.h:1618

LLVM_ABI CallInst * cloneImpl() const

static CallInst * Create(FunctionType *Ty, Value *F, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Definition Instructions.h:1546

void setTailCall(bool IsTc=true)

Definition Instructions.h:1635

bool isMustTailCall() const

Definition Instructions.h:1627

TailCallKind

Definition Instructions.h:1605

@ TCK_None

Definition Instructions.h:1606

@ TCK_MustTail

Definition Instructions.h:1608

@ TCK_Tail

Definition Instructions.h:1607

@ TCK_NoTail

Definition Instructions.h:1609

@ TCK_LAST

Definition Instructions.h:1610

static CallInst * Create(FunctionCallee Func, ArrayRef< Value * > Args, const Twine &NameStr, InsertPosition InsertBefore=nullptr)

Definition Instructions.h:1587

static bool classof(const Instruction *I)

Definition Instructions.h:1655

bool isNonContinuableTrap() const

Return true if the call is for a noreturn trap intrinsic.

Definition Instructions.h:1644

static CallInst * Create(FunctionCallee Func, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Definition Instructions.h:1573

static CallInst * Create(FunctionCallee Func, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles={}, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Definition Instructions.h:1579

CastInst(Type *Ty, unsigned iType, Value *S, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Constructor with insert-before-instruction semantics for subclasses.

Definition Instructions.h:4300

CatchSwitchInst * getCatchSwitch() const

Convenience accessors.

Definition Instructions.h:4318

void setCatchSwitch(Value *CatchSwitch)

Definition Instructions.h:4321

static bool classof(const Instruction *I)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Instructions.h:4327

static CatchPadInst * Create(Value *CatchSwitch, ArrayRef< Value * > Args, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Definition Instructions.h:4309

static bool classof(const Value *V)

Definition Instructions.h:4330

Definition Instructions.h:4339

static bool classof(const Instruction *I)

Definition Instructions.h:4386

BasicBlock * getSuccessor() const

Definition Instructions.h:4372

CatchPadInst * getCatchPad() const

Convenience accessors.

Definition Instructions.h:4366

void setSuccessor(BasicBlock *NewSucc)

Definition Instructions.h:4373

static bool classof(const Value *V)

Definition Instructions.h:4389

static CatchReturnInst * Create(Value *CatchPad, BasicBlock *BB, InsertPosition InsertBefore=nullptr)

Definition Instructions.h:4355

unsigned getNumSuccessors() const

Definition Instructions.h:4377

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:4350

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Provide fast operand accessors.

void setCatchPad(CatchPadInst *CatchPad)

Definition Instructions.h:4367

LLVM_ABI CatchReturnInst * cloneImpl() const

Value * getCatchSwitchParentPad() const

Get the parentPad of this catchret's catchpad's catchswitch.

Definition Instructions.h:4381

Definition Instructions.h:4106

void setUnwindDest(BasicBlock *UnwindDest)

Definition Instructions.h:4166

static bool classof(const Instruction *I)

Definition Instructions.h:4255

BasicBlock *(*)(Value *) DerefFnTy

Definition Instructions.h:4187

const BasicBlock *(*)(const Value *) ConstDerefFnTy

Definition Instructions.h:4190

unsigned getNumSuccessors() const

Definition Instructions.h:4242

const_handler_iterator handler_begin() const

Returns an iterator that points to the first handler in the CatchSwitchInst.

Definition Instructions.h:4205

mapped_iterator< const_op_iterator, ConstDerefFnTy > const_handler_iterator

Definition Instructions.h:4191

LLVM_ABI CatchSwitchInst * cloneImpl() const

mapped_iterator< op_iterator, DerefFnTy > handler_iterator

Definition Instructions.h:4188

unsigned getNumHandlers() const

return the number of 'handlers' in this catchswitch instruction, except the default handler

Definition Instructions.h:4174

iterator_range< handler_iterator > handler_range

Definition Instructions.h:4189

void setSuccessor(unsigned Idx, BasicBlock *NewSucc)

Definition Instructions.h:4248

Value * getParentPad() const

Definition Instructions.h:4155

iterator_range< const_handler_iterator > const_handler_range

Definition Instructions.h:4193

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:4136

void setParentPad(Value *ParentPad)

Definition Instructions.h:4156

bool unwindsToCaller() const

Definition Instructions.h:4160

static bool classof(const Value *V)

Definition Instructions.h:4258

handler_iterator handler_end()

Returns a read-only iterator that points one past the last handler in the CatchSwitchInst.

Definition Instructions.h:4214

BasicBlock * getUnwindDest() const

Definition Instructions.h:4161

BasicBlock * getSuccessor(unsigned Idx) const

Definition Instructions.h:4243

const_handler_iterator handler_end() const

Returns an iterator that points one past the last handler in the CatchSwitchInst.

Definition Instructions.h:4220

bool hasUnwindDest() const

Definition Instructions.h:4159

handler_iterator handler_begin()

Returns an iterator that points to the first handler in CatchSwitchInst.

Definition Instructions.h:4196

static CatchSwitchInst * Create(Value *ParentPad, BasicBlock *UnwindDest, unsigned NumHandlers, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Definition Instructions.h:4143

handler_range handlers()

iteration adapter for range-for loops.

Definition Instructions.h:4225

const_handler_range handlers() const

iteration adapter for range-for loops.

Definition Instructions.h:4230

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Provide fast operand accessors.

Definition Instructions.h:4271

static bool classof(const Value *V)

Definition Instructions.h:4292

static bool classof(const Instruction *I)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Instructions.h:4289

static CleanupPadInst * Create(Value *ParentPad, ArrayRef< Value * > Args={}, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Definition Instructions.h:4280

Definition Instructions.h:4415

static bool classof(const Instruction *I)

Definition Instructions.h:4472

CleanupPadInst * getCleanupPad() const

Convenience accessor.

Definition Instructions.h:4452

unsigned getNumSuccessors() const

Definition Instructions.h:4460

BasicBlock * getUnwindDest() const

Definition Instructions.h:4462

bool unwindsToCaller() const

Definition Instructions.h:4449

void setCleanupPad(CleanupPadInst *CleanupPad)

Definition Instructions.h:4455

static bool classof(const Value *V)

Definition Instructions.h:4475

void setUnwindDest(BasicBlock *NewDest)

Definition Instructions.h:4465

static CleanupReturnInst * Create(Value *CleanupPad, BasicBlock *UnwindBB=nullptr, InsertPosition InsertBefore=nullptr)

Definition Instructions.h:4433

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:4428

bool hasUnwindDest() const

Definition Instructions.h:4448

LLVM_ABI CleanupReturnInst * cloneImpl() const

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Provide fast operand accessors.

static Type * makeCmpResultType(Type *opnd_type)

Create a result type for fcmp/icmp.

void setPredicate(Predicate P)

Set the predicate for this instruction to the specified value.

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

@ ICMP_UGE

unsigned greater or equal

@ ICMP_UGT

unsigned greater than

@ ICMP_SGT

signed greater 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_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_FALSE

0 0 0 0 Always false (always folded)

@ FCMP_UNO

1 0 0 0 True if unordered: isnan(X) | isnan(Y)

static auto ICmpPredicates()

Returns the sequence of all ICmp predicates.

Predicate getSwappedPredicate() const

For example, EQ->EQ, SLE->SGE, ULT->UGT, OEQ->OEQ, ULE->UGE, OLT->OGT, etc.

static auto FCmpPredicates()

Returns the sequence of all FCmp predicates.

Predicate getNonStrictPredicate() const

For example, SGT -> SGE, SLT -> SLE, ULT -> ULE, UGT -> UGE.

bool isFPPredicate() const

Predicate getInversePredicate() const

For example, EQ -> NE, UGT -> ULE, SLT -> SGE, OEQ -> UNE, UGT -> OLE, OLT -> UGE,...

Predicate getPredicate() const

Return the predicate for this instruction.

static bool isIntPredicate(Predicate P)

LLVM_ABI CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred, Value *LHS, Value *RHS, const Twine &Name="", InsertPosition InsertBefore=nullptr, Instruction *FlagsSource=nullptr)

An abstraction over a floating-point predicate, and a pack of an integer predicate with samesign info...

This is the shared class of boolean and integer constants.

This is an important base class in LLVM.

A parsed version of the target data layout string in and methods for querying it.

bool isRelational() const

Definition Instructions.h:1476

FCmpInst(Predicate Pred, Value *LHS, Value *RHS, const Twine &NameStr="", Instruction *FlagsSource=nullptr)

Constructor with no-insertion semantics.

Definition Instructions.h:1442

bool isEquality() const

Definition Instructions.h:1461

static bool classof(const Value *V)

Definition Instructions.h:1500

bool isCommutative() const

Definition Instructions.h:1472

static bool isCommutative(Predicate Pred)

Definition Instructions.h:1465

static LLVM_ABI bool compare(const APFloat &LHS, const APFloat &RHS, FCmpInst::Predicate Pred)

Return result of LHS Pred RHS comparison.

static bool isEquality(Predicate Pred)

Definition Instructions.h:1454

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:1423

static bool classof(const Instruction *I)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Instructions.h:1497

static auto predicates()

Returns the sequence of all FCmp predicates.

Definition Instructions.h:1490

LLVM_ABI FCmpInst * cloneImpl() const

Clone an identical FCmpInst.

void swapOperands()

Exchange the two operands to this instruction in such a way that it does not modify the semantics of ...

Definition Instructions.h:1483

FCmpInst(InsertPosition InsertBefore, Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="")

Constructor with insertion semantics.

Definition Instructions.h:1430

static bool classof(const Value *V)

Definition Instructions.h:4743

LLVM_ABI FPExtInst * cloneImpl() const

Clone an identical FPExtInst.

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:4724

static bool classof(const Instruction *I)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Instructions.h:4740

LLVM_ABI FPExtInst(Value *S, Type *Ty, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Constructor with insert-before-instruction semantics.

static bool classof(const Value *V)

Definition Instructions.h:4871

LLVM_ABI FPToSIInst(Value *S, Type *Ty, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Constructor with insert-before-instruction semantics.

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:4852

LLVM_ABI FPToSIInst * cloneImpl() const

Clone an identical FPToSIInst.

static bool classof(const Instruction *I)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Instructions.h:4868

static bool classof(const Value *V)

Definition Instructions.h:4839

static bool classof(const Instruction *I)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Instructions.h:4836

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:4820

LLVM_ABI FPToUIInst * cloneImpl() const

Clone an identical FPToUIInst.

LLVM_ABI FPToUIInst(Value *S, Type *Ty, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Constructor with insert-before-instruction semantics.

static bool classof(const Instruction *I)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Instructions.h:4708

LLVM_ABI FPTruncInst(Value *S, Type *Ty, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Constructor with insert-before-instruction semantics.

static bool classof(const Value *V)

Definition Instructions.h:4711

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:4693

LLVM_ABI FPTruncInst * cloneImpl() const

Clone an identical FPTruncInst.

static bool classof(const Value *V)

Definition Instructions.h:479

LLVM_ABI FenceInst(LLVMContext &C, AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System, InsertPosition InsertBefore=nullptr)

SyncScope::ID getSyncScopeID() const

Returns the synchronization scope ID of this fence instruction.

Definition Instructions.h:466

void setSyncScopeID(SyncScope::ID SSID)

Sets the synchronization scope ID of this fence instruction.

Definition Instructions.h:471

LLVM_ABI FenceInst * cloneImpl() const

static bool classof(const Instruction *I)

Definition Instructions.h:476

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:439

void setOrdering(AtomicOrdering Ordering)

Sets the ordering constraint of this fence instruction.

Definition Instructions.h:461

AtomicOrdering getOrdering() const

Returns the ordering constraint of this fence instruction.

Definition Instructions.h:455

static bool classof(const Value *V)

Definition Instructions.h:5212

LLVM_ABI FreezeInst(Value *S, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:5199

LLVM_ABI FreezeInst * cloneImpl() const

Clone an identical FreezeInst.

static bool classof(const Instruction *I)

Definition Instructions.h:5209

friend class CatchPadInst

friend class Instruction

Iterator for Instructions in a `BasicBlock.

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()

an instruction for type-safe pointer arithmetic to access elements of arrays and structs

Definition Instructions.h:950

LLVM_ABI bool isInBounds() const

Determine whether the GEP has the inbounds flag.

LLVM_ABI bool hasNoUnsignedSignedWrap() const

Determine whether the GEP has the nusw flag.

static LLVM_ABI Type * getTypeAtIndex(Type *Ty, Value *Idx)

Return the type of the element at the given index of an indexable type.

Value * getPointerOperand()

Definition Instructions.h:1054

LLVM_ABI bool hasAllZeroIndices() const

Return true if all of the indices of this GEP are zeros.

static Type * getGEPReturnType(Value *Ptr, ArrayRef< Value * > IdxList)

Returns the pointer type returned by the GEP instruction, which may be a vector of pointers.

Definition Instructions.h:1077

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Transparently provide more efficient getOperand methods.

void setResultElementType(Type *Ty)

Definition Instructions.h:1011

LLVM_ABI bool hasNoUnsignedWrap() const

Determine whether the GEP has the nuw flag.

LLVM_ABI bool hasAllConstantIndices() const

Return true if all of the indices of this GEP are constant integers.

unsigned getAddressSpace() const

Returns the address space of this instruction's pointer type.

Definition Instructions.h:1018

iterator_range< const_op_iterator > indices() const

Definition Instructions.h:1050

Type * getResultElementType() const

Definition Instructions.h:1013

op_iterator idx_end()

Definition Instructions.h:1043

static bool classof(const Instruction *I)

Definition Instructions.h:1145

static bool classof(const Value *V)

Definition Instructions.h:1148

iterator_range< op_iterator > indices()

Definition Instructions.h:1046

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

Definition Instructions.h:974

LLVM_ABI void setIsInBounds(bool b=true)

Set or clear the inbounds flag on this GEP instruction.

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:969

void setSourceElementType(Type *Ty)

Definition Instructions.h:1010

static LLVM_ABI Type * getIndexedType(Type *Ty, ArrayRef< Value * > IdxList)

Returns the result type of a getelementptr with the given source element type and indexes.

Type * getSourceElementType() const

Definition Instructions.h:1008

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

Create an "inbounds" getelementptr.

Definition Instructions.h:998

Type * getPointerOperandType() const

Method to return the pointer operand as a PointerType.

Definition Instructions.h:1066

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

Definition Instructions.h:985

static unsigned getPointerOperandIndex()

Definition Instructions.h:1060

LLVM_ABI bool accumulateConstantOffset(const DataLayout &DL, APInt &Offset) const

Accumulate the constant address offset of this GEP if possible.

op_iterator idx_begin()

Definition Instructions.h:1041

const_op_iterator idx_begin() const

Definition Instructions.h:1042

LLVM_ABI GetElementPtrInst * cloneImpl() const

LLVM_ABI bool collectOffset(const DataLayout &DL, unsigned BitWidth, SmallMapVector< Value *, APInt, 4 > &VariableOffsets, APInt &ConstantOffset) const

LLVM_ABI void setNoWrapFlags(GEPNoWrapFlags NW)

Set nowrap flags for GEP instruction.

unsigned getNumIndices() const

Definition Instructions.h:1092

bool hasIndices() const

Definition Instructions.h:1096

LLVM_ABI GEPNoWrapFlags getNoWrapFlags() const

Get the nowrap flags for the GEP instruction.

const_op_iterator idx_end() const

Definition Instructions.h:1044

const Value * getPointerOperand() const

Definition Instructions.h:1057

unsigned getPointerAddressSpace() const

Returns the address space of the pointer operand.

Definition Instructions.h:1071

bool hasSameSign() const

An icmp instruction, which can be marked as "samesign", indicating that the two operands have the sam...

Definition Instructions.h:1313

static bool classof(const Value *V)

Definition Instructions.h:1398

void setSameSign(bool B=true)

Definition Instructions.h:1306

ICmpInst(InsertPosition InsertBefore, Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="")

Constructor with insertion semantics.

Definition Instructions.h:1201

static bool isCommutative(Predicate P)

Definition Instructions.h:1329

static CmpPredicate getSwappedCmpPredicate(CmpPredicate Pred)

Definition Instructions.h:1245

CmpPredicate getCmpPredicate() const

Definition Instructions.h:1228

bool isCommutative() const

Definition Instructions.h:1333

static bool isGE(Predicate P)

Return true if the predicate is SGE or UGE.

Definition Instructions.h:1361

CmpPredicate getSwappedCmpPredicate() const

Definition Instructions.h:1250

static bool isLT(Predicate P)

Return true if the predicate is SLT or ULT.

Definition Instructions.h:1355

LLVM_ABI ICmpInst * cloneImpl() const

Clone an identical ICmpInst.

CmpPredicate getInverseCmpPredicate() const

Definition Instructions.h:1239

Predicate getNonStrictCmpPredicate() const

For example, SGT -> SGE, SLT -> SLE, ULT -> ULE, UGT -> UGE.

Definition Instructions.h:1262

static bool isGT(Predicate P)

Return true if the predicate is SGT or UGT.

Definition Instructions.h:1349

static bool classof(const Instruction *I)

Definition Instructions.h:1395

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:1194

Predicate getFlippedSignednessPredicate() const

For example, SLT->ULT, ULT->SLT, SLE->ULE, ULE->SLE, EQ->EQ.

Definition Instructions.h:1297

static CmpPredicate getNonStrictCmpPredicate(CmpPredicate Pred)

Definition Instructions.h:1256

Predicate getSignedPredicate() const

For example, EQ->EQ, SLE->SLE, UGT->SGT, etc.

Definition Instructions.h:1270

static CmpPredicate getInverseCmpPredicate(CmpPredicate Pred)

Definition Instructions.h:1234

bool isEquality() const

Return true if this predicate is either EQ or NE.

Definition Instructions.h:1323

static LLVM_ABI Predicate getFlippedSignednessPredicate(Predicate Pred)

For example, SLT->ULT, ULT->SLT, SLE->ULE, ULE->SLE, EQ->EQ.

static bool isEquality(Predicate P)

Return true if this predicate is either EQ or NE.

Definition Instructions.h:1317

static bool isRelational(Predicate P)

Return true if the predicate is relational (not EQ or NE).

Definition Instructions.h:1343

void swapOperands()

Exchange the two operands to this instruction in such a way that it does not modify the semantics of ...

Definition Instructions.h:1380

static auto predicates()

Returns the sequence of all ICmp predicates.

Definition Instructions.h:1373

ICmpInst(Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="")

Constructor with no-insertion semantics.

Definition Instructions.h:1215

bool isRelational() const

Return true if the predicate is relational (not EQ or NE).

Definition Instructions.h:1337

Predicate getUnsignedPredicate() const

For example, EQ->EQ, SLE->ULE, UGT->UGT, etc.

Definition Instructions.h:1281

static bool isLE(Predicate P)

Return true if the predicate is SLE or ULE.

Definition Instructions.h:1367

Indirect Branch Instruction.

Definition Instructions.h:3590

static IndirectBrInst * Create(Value *Address, unsigned NumDests, InsertPosition InsertBefore=nullptr)

Definition Instructions.h:3648

BasicBlock * getDestination(unsigned i)

Return the specified destination.

Definition Instructions.h:3666

static bool classof(const Value *V)

Definition Instructions.h:3699

const Value * getAddress() const

Definition Instructions.h:3658

Value * getAddress()

Definition Instructions.h:3657

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:3614

static bool classof(const Instruction *I)

Definition Instructions.h:3696

BasicBlock * getSuccessor(unsigned i) const

Definition Instructions.h:3678

iterator_range< const_succ_op_iterator > successors() const

Definition Instructions.h:3690

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Provide fast operand accessors.

unsigned getNumDestinations() const

return the number of possible destinations in this indirectbr instruction.

Definition Instructions.h:3663

const BasicBlock * getDestination(unsigned i) const

Definition Instructions.h:3667

void setSuccessor(unsigned i, BasicBlock *NewSucc)

Definition Instructions.h:3681

void setAddress(Value *V)

Definition Instructions.h:3659

unsigned getNumSuccessors() const

Definition Instructions.h:3677

iterator_range< succ_op_iterator > successors()

Definition Instructions.h:3685

LLVM_ABI IndirectBrInst * cloneImpl() const

This instruction inserts a single (scalar) element into a VectorType value.

Definition Instructions.h:1868

LLVM_ABI InsertElementInst * cloneImpl() const

static bool classof(const Value *V)

Definition Instructions.h:1907

static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Definition Instructions.h:1882

VectorType * getType() const

Overload to return most specific vector type.

Definition Instructions.h:1896

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:1877

static bool classof(const Instruction *I)

Definition Instructions.h:1904

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Transparently provide more efficient getOperand methods.

This instruction inserts a struct field of array element value into an aggregate value.

Definition Instructions.h:2524

Value * getInsertedValueOperand()

Definition Instructions.h:2586

static bool classof(const Instruction *I)

Definition Instructions.h:2609

static unsigned getAggregateOperandIndex()

Definition Instructions.h:2582

Value * getAggregateOperand()

Definition Instructions.h:2576

const unsigned * idx_iterator

Definition Instructions.h:2568

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:2549

static bool classof(const Value *V)

Definition Instructions.h:2612

unsigned getNumIndices() const

Definition Instructions.h:2600

ArrayRef< unsigned > getIndices() const

Definition Instructions.h:2596

iterator_range< idx_iterator > indices() const

Definition Instructions.h:2572

static unsigned getInsertedValueOperandIndex()

Definition Instructions.h:2592

LLVM_ABI InsertValueInst * cloneImpl() const

idx_iterator idx_end() const

Definition Instructions.h:2571

static InsertValueInst * Create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Definition Instructions.h:2558

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Transparently provide more efficient getOperand methods.

const Value * getAggregateOperand() const

Definition Instructions.h:2579

bool hasIndices() const

Definition Instructions.h:2604

const Value * getInsertedValueOperand() const

Definition Instructions.h:2589

idx_iterator idx_begin() const

Definition Instructions.h:2570

BitfieldElement::Type getSubclassData() const

typename Bitfield::Element< unsigned, Offset, 6, Value::MaxAlignmentExponent > AlignmentBitfieldElementT

typename Bitfield::Element< AtomicOrdering, Offset, 3, AtomicOrdering::LAST > AtomicOrderingBitfieldElementT

typename Bitfield::Element< bool, Offset, 1 > BoolBitfieldElementT

LLVM_ABI bool isAtomic() const LLVM_READONLY

Return true if this instruction has an AtomicOrdering of unordered or higher.

unsigned getOpcode() const

Returns a member of one of the enums like Instruction::Add.

LLVM_ABI void copyMetadata(const Instruction &SrcInst, ArrayRef< unsigned > WL=ArrayRef< unsigned >())

Copy metadata from SrcInst to this instruction.

friend class BasicBlock

Various leaf nodes.

void setSubclassData(typename BitfieldElement::Type Value)

static bool classof(const Instruction *I)

Definition Instructions.h:4904

LLVM_ABI IntToPtrInst(Value *S, Type *Ty, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Constructor with insert-before-instruction semantics.

LLVM_ABI IntToPtrInst * cloneImpl() const

Clone an identical IntToPtrInst.

unsigned getAddressSpace() const

Returns the address space of this instruction's pointer type.

Definition Instructions.h:4899

static bool classof(const Value *V)

Definition Instructions.h:4907

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:4884

static bool classof(const Instruction *I)

Definition Instructions.h:3844

BasicBlock * getUnwindDest() const

Definition Instructions.h:3811

void setNormalDest(BasicBlock *B)

Definition Instructions.h:3814

LLVM_ABI InvokeInst * cloneImpl() const

static bool classof(const Value *V)

Definition Instructions.h:3847

static InvokeInst * Create(FunctionCallee Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, const Twine &NameStr, InsertPosition InsertBefore=nullptr)

Definition Instructions.h:3780

void setSuccessor(unsigned i, BasicBlock *NewSucc)

Definition Instructions.h:3830

static InvokeInst * Create(FunctionCallee Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles={}, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Definition Instructions.h:3788

BasicBlock * getSuccessor(unsigned i) const

Definition Instructions.h:3825

void setUnwindDest(BasicBlock *B)

Definition Instructions.h:3817

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:3751

BasicBlock * getNormalDest() const

Definition Instructions.h:3808

static InvokeInst * Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles={}, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Definition Instructions.h:3766

unsigned getNumSuccessors() const

Definition Instructions.h:3838

static InvokeInst * Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, const Twine &NameStr, InsertPosition InsertBefore=nullptr)

Definition Instructions.h:3756

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

Definition Instructions.h:2880

bool isCleanup() const

Return 'true' if this landingpad instruction is a cleanup.

Definition Instructions.h:2926

LLVM_ABI LandingPadInst * cloneImpl() const

unsigned getNumClauses() const

Get the number of clauses for this landing pad.

Definition Instructions.h:2951

ClauseType

Definition Instructions.h:2892

@ Catch

Definition Instructions.h:2892

@ Filter

Definition Instructions.h:2892

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Provide fast operand accessors.

bool isCatch(unsigned Idx) const

Return 'true' if the clause and index Idx is a catch clause.

Definition Instructions.h:2941

bool isFilter(unsigned Idx) const

Return 'true' if the clause and index Idx is a filter clause.

Definition Instructions.h:2946

Constant * getClause(unsigned Idx) const

Get the value of the clause at index Idx.

Definition Instructions.h:2936

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:2906

static bool classof(const Value *V)

Definition Instructions.h:2961

void setCleanup(bool V)

Indicate that this landingpad instruction is a cleanup.

Definition Instructions.h:2929

void reserveClauses(unsigned Size)

Grow the size of the operand list to accommodate the new number of clauses.

Definition Instructions.h:2955

static bool classof(const Instruction *I)

Definition Instructions.h:2958

unsigned getPointerAddressSpace() const

Returns the address space of the pointer operand.

Definition Instructions.h:266

const Value * getPointerOperand() const

Definition Instructions.h:261

void setAlignment(Align Align)

Definition Instructions.h:220

Value * getPointerOperand()

Definition Instructions.h:260

bool isVolatile() const

Return true if this is a load from a volatile memory location.

Definition Instructions.h:210

static bool classof(const Instruction *I)

Definition Instructions.h:271

void setOrdering(AtomicOrdering Ordering)

Sets the ordering constraint of this load instruction.

Definition Instructions.h:230

static bool classof(const Value *V)

Definition Instructions.h:274

void setSyncScopeID(SyncScope::ID SSID)

Sets the synchronization scope ID of this load instruction.

Definition Instructions.h:240

void setAtomic(AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System)

Sets the ordering constraint and the synchronization scope ID of this load instruction.

Definition Instructions.h:246

LLVM_ABI LoadInst * cloneImpl() const

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:193

AtomicOrdering getOrdering() const

Returns the ordering constraint of this load instruction.

Definition Instructions.h:225

Type * getPointerOperandType() const

Definition Instructions.h:263

static unsigned getPointerOperandIndex()

Definition Instructions.h:262

bool isUnordered() const

Definition Instructions.h:254

void setVolatile(bool V)

Specify whether this is a volatile load or not.

Definition Instructions.h:213

SyncScope::ID getSyncScopeID() const

Returns the synchronization scope ID of this load instruction.

Definition Instructions.h:235

bool isSimple() const

Definition Instructions.h:252

LLVM_ABI LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, InsertPosition InsertBefore)

Align getAlign() const

Return the alignment of the access that is being performed.

Definition Instructions.h:216

MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...

Definition Instructions.h:2639

BasicBlock * getIncomingBlock(Value::const_user_iterator I) const

Return incoming basic block corresponding to value use iterator.

Definition Instructions.h:2749

static bool classof(const Instruction *I)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Instructions.h:2853

void addIncoming(Value *V, BasicBlock *BB)

Add an incoming value to the end of the PHI list.

Definition Instructions.h:2774

bool isComplete() const

If the PHI node is complete which means all of its parent's predecessors have incoming value in this ...

Definition Instructions.h:2845

iterator_range< const_block_iterator > blocks() const

Definition Instructions.h:2700

op_range incoming_values()

Definition Instructions.h:2704

static bool classof(const Value *V)

Definition Instructions.h:2856

void allocHungoffUses(unsigned N)

Definition Instructions.h:2667

const_block_iterator block_begin() const

Definition Instructions.h:2692

void setIncomingValueForBlock(const BasicBlock *BB, Value *V)

Set every incoming value(s) for block BB to V.

Definition Instructions.h:2822

BasicBlock ** block_iterator

Definition Instructions.h:2689

void setIncomingBlock(unsigned i, BasicBlock *BB)

Definition Instructions.h:2753

LLVM_ABI Value * removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty=true)

Remove an incoming value.

BasicBlock *const * const_block_iterator

Definition Instructions.h:2690

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:2660

void setIncomingValue(unsigned i, Value *V)

Definition Instructions.h:2717

static unsigned getOperandNumForIncomingValue(unsigned i)

Definition Instructions.h:2724

void copyIncomingBlocks(iterator_range< const_block_iterator > BBRange, uint32_t ToIdx=0)

Copies the basic blocks from BBRange to the incoming basic block list of this PHINode,...

Definition Instructions.h:2759

const_block_iterator block_end() const

Definition Instructions.h:2696

Value * getIncomingValueForBlock(const BasicBlock *BB) const

Definition Instructions.h:2815

BasicBlock * getIncomingBlock(unsigned i) const

Return incoming basic block number i.

Definition Instructions.h:2734

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Provide fast operand accessors.

Value * getIncomingValue(unsigned i) const

Return incoming value number x.

Definition Instructions.h:2714

static unsigned getIncomingValueNumForOperand(unsigned i)

Definition Instructions.h:2728

const_op_range incoming_values() const

Definition Instructions.h:2706

Value * removeIncomingValue(const BasicBlock *BB, bool DeletePHIIfEmpty=true)

Definition Instructions.h:2794

LLVM_ABI PHINode * cloneImpl() const

void replaceIncomingBlockWith(const BasicBlock *Old, BasicBlock *New)

Replace every incoming basic block Old to basic block New.

Definition Instructions.h:2765

BasicBlock * getIncomingBlock(const Use &U) const

Return incoming basic block corresponding to an operand of the PHI.

Definition Instructions.h:2741

int getBasicBlockIndex(const BasicBlock *BB) const

Return the first index of the specified basic block in the value list for this PHI.

Definition Instructions.h:2808

unsigned getNumIncomingValues() const

Return the number of incoming edges.

Definition Instructions.h:2710

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

Definition Instructions.h:2674

Class to represent pointers.

unsigned getAddressSpace() const

Return the address space of the Pointer type.

PtrToAddrInst(Value *S, Type *Ty, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Constructor with insert-before-instruction semantics.

static unsigned getPointerOperandIndex()

Gets the operand index of the pointer operand.

Definition Instructions.h:4980

static bool classof(const Instruction *I)

Definition Instructions.h:4988

PtrToAddrInst * cloneImpl() const

Clone an identical PtrToAddrInst.

static bool classof(const Value *V)

Definition Instructions.h:4991

const Value * getPointerOperand() const

Gets the pointer operand.

Definition Instructions.h:4978

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:4961

Value * getPointerOperand()

Gets the pointer operand.

Definition Instructions.h:4976

unsigned getPointerAddressSpace() const

Returns the address space of the pointer operand.

Definition Instructions.h:4983

Value * getPointerOperand()

Gets the pointer operand.

Definition Instructions.h:4936

unsigned getPointerAddressSpace() const

Returns the address space of the pointer operand.

Definition Instructions.h:4943

static bool classof(const Value *V)

Definition Instructions.h:4951

const Value * getPointerOperand() const

Gets the pointer operand.

Definition Instructions.h:4938

static unsigned getPointerOperandIndex()

Gets the operand index of the pointer operand.

Definition Instructions.h:4940

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:4920

static bool classof(const Instruction *I)

Definition Instructions.h:4948

LLVM_ABI PtrToIntInst(Value *S, Type *Ty, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Constructor with insert-before-instruction semantics.

LLVM_ABI PtrToIntInst * cloneImpl() const

Clone an identical PtrToIntInst.

Resume the propagation of an exception.

Definition Instructions.h:4051

static ResumeInst * Create(Value *Exn, InsertPosition InsertBefore=nullptr)

Definition Instructions.h:4066

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Provide fast operand accessors.

Value * getValue() const

Convenience accessor.

Definition Instructions.h:4074

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:4061

static bool classof(const Value *V)

Definition Instructions.h:4082

unsigned getNumSuccessors() const

Definition Instructions.h:4076

LLVM_ABI ResumeInst * cloneImpl() const

static bool classof(const Instruction *I)

Definition Instructions.h:4079

Return a value (possibly void), from a function.

Definition Instructions.h:2979

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Provide fast operand accessors.

unsigned getNumSuccessors() const

Definition Instructions.h:3026

static bool classof(const Value *V)

Definition Instructions.h:3032

static bool classof(const Instruction *I)

Definition Instructions.h:3029

static ReturnInst * Create(LLVMContext &C, BasicBlock *InsertAtEnd)

Definition Instructions.h:3013

Value * getReturnValue() const

Convenience accessor. Returns null if there is no return value.

Definition Instructions.h:3022

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:3002

static ReturnInst * Create(LLVMContext &C, Value *retVal=nullptr, InsertPosition InsertBefore=nullptr)

Definition Instructions.h:3007

LLVM_ABI ReturnInst * cloneImpl() const

static bool classof(const Value *V)

Definition Instructions.h:4680

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:4661

static bool classof(const Instruction *I)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Instructions.h:4677

LLVM_ABI SExtInst * cloneImpl() const

Clone an identical SExtInst.

LLVM_ABI SExtInst(Value *S, Type *Ty, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Constructor with insert-before-instruction semantics.

LLVM_ABI SIToFPInst * cloneImpl() const

Clone an identical SIToFPInst.

LLVM_ABI SIToFPInst(Value *S, Type *Ty, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Constructor with insert-before-instruction semantics.

static bool classof(const Instruction *I)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Instructions.h:4804

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:4788

static bool classof(const Value *V)

Definition Instructions.h:4807

This class represents the LLVM 'select' instruction.

Definition Instructions.h:1690

void setFalseValue(Value *V)

Definition Instructions.h:1735

const Value * getFalseValue() const

Definition Instructions.h:1728

void setTrueValue(Value *V)

Definition Instructions.h:1734

OtherOps getOpcode() const

Definition Instructions.h:1749

Value * getCondition()

Definition Instructions.h:1729

Value * getTrueValue()

Definition Instructions.h:1730

void swapValues()

Swap the true and false values of the select instruction.

Definition Instructions.h:1739

Value * getFalseValue()

Definition Instructions.h:1731

const Value * getCondition() const

Definition Instructions.h:1726

LLVM_ABI SelectInst * cloneImpl() const

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:1710

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Transparently provide more efficient getOperand methods.

static LLVM_ABI const char * areInvalidOperands(Value *Cond, Value *True, Value *False)

Return a string if the specified operands are invalid for a select operation, otherwise return null.

static bool classof(const Value *V)

Definition Instructions.h:1757

void setCondition(Value *V)

Definition Instructions.h:1733

static SelectInst * Create(Value *C, Value *S1, Value *S2, const Twine &NameStr="", InsertPosition InsertBefore=nullptr, const Instruction *MDFrom=nullptr)

Definition Instructions.h:1715

const Value * getTrueValue() const

Definition Instructions.h:1727

static bool classof(const Instruction *I)

Definition Instructions.h:1754

This instruction constructs a fixed permutation of two input vectors.

Definition Instructions.h:1935

static bool classof(const Value *V)

Definition Instructions.h:2418

static bool isInterleaveMask(ArrayRef< int > Mask, unsigned Factor, unsigned NumInputElts)

Definition Instructions.h:2380

Constant * getShuffleMaskForBitcode() const

Return the mask for this instruction, for use in bitcode.

Definition Instructions.h:2002

bool isSingleSource() const

Return true if this shuffle chooses elements from exactly one source vector without changing the leng...

Definition Instructions.h:2051

static LLVM_ABI bool isZeroEltSplatMask(ArrayRef< int > Mask, int NumSrcElts)

Return true if this shuffle mask chooses all elements with the same value as the first element of exa...

bool changesLength() const

Return true if this shuffle returns a vector with a different number of elements than its source vect...

Definition Instructions.h:2015

bool isExtractSubvectorMask(int &Index) const

Return true if this shuffle mask is an extract subvector mask.

Definition Instructions.h:2265

ArrayRef< int > getShuffleMask() const

Definition Instructions.h:2009

static LLVM_ABI bool isSpliceMask(ArrayRef< int > Mask, int NumSrcElts, int &Index)

Return true if this shuffle mask is a splice mask, concatenating the two inputs together and then ext...

static bool isInsertSubvectorMask(const Constant *Mask, int NumSrcElts, int &NumSubElts, int &Index)

Definition Instructions.h:2282

static bool isSingleSourceMask(const Constant *Mask, int NumSrcElts)

Definition Instructions.h:2040

int getMaskValue(unsigned Elt) const

Return the shuffle mask value of this instruction for the given element index.

Definition Instructions.h:1985

LLVM_ABI ShuffleVectorInst(Value *V1, Value *Mask, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

void getShuffleMask(SmallVectorImpl< int > &Result) const

Return the mask for this instruction as a vector of integers.

Definition Instructions.h:1994

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Transparently provide more efficient getOperand methods.

static bool isDeInterleaveMaskOfFactor(ArrayRef< int > Mask, unsigned Factor)

Definition Instructions.h:2392

static LLVM_ABI bool isSelectMask(ArrayRef< int > Mask, int NumSrcElts)

Return true if this shuffle mask chooses elements from its source vectors without lane crossings.

VectorType * getType() const

Overload to return most specific vector type.

Definition Instructions.h:1976

bool isInsertSubvectorMask(int &NumSubElts, int &Index) const

Return true if this shuffle mask is an insert subvector mask.

Definition Instructions.h:2295

bool increasesLength() const

Return true if this shuffle returns a vector with a greater number of elements than its source vector...

Definition Instructions.h:2026

bool isZeroEltSplat() const

Return true if all elements of this shuffle are the same value as the first element of exactly one so...

Definition Instructions.h:2169

static bool isExtractSubvectorMask(const Constant *Mask, int NumSrcElts, int &Index)

Definition Instructions.h:2252

static LLVM_ABI bool isSingleSourceMask(ArrayRef< int > Mask, int NumSrcElts)

Return true if this shuffle mask chooses elements from exactly one source vector.

static LLVM_ABI void getShuffleMask(const Constant *Mask, SmallVectorImpl< int > &Result)

Convert the input shuffle mask operand to a vector of integers.

bool isSelect() const

Return true if this shuffle chooses elements from its source vectors without lane crossings and all o...

Definition Instructions.h:2125

static LLVM_ABI bool isDeInterleaveMaskOfFactor(ArrayRef< int > Mask, unsigned Factor, unsigned &Index)

Check if the mask is a DE-interleave mask of the given factor Factor like: <Index,...

LLVM_ABI ShuffleVectorInst * cloneImpl() const

static LLVM_ABI bool isIdentityMask(ArrayRef< int > Mask, int NumSrcElts)

Return true if this shuffle mask chooses elements from exactly one source vector without lane crossin...

static bool isSpliceMask(const Constant *Mask, int NumSrcElts, int &Index)

Definition Instructions.h:2231

static LLVM_ABI bool isExtractSubvectorMask(ArrayRef< int > Mask, int NumSrcElts, int &Index)

Return true if this shuffle mask is an extract subvector mask.

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:1943

bool isTranspose() const

Return true if this shuffle transposes the elements of its inputs without changing the length of the ...

Definition Instructions.h:2219

static void commuteShuffleMask(MutableArrayRef< int > Mask, unsigned InVecNumElts)

Change values in a shuffle permute mask assuming the two vector operands of length InVecNumElts have ...

Definition Instructions.h:2344

static LLVM_ABI bool isTransposeMask(ArrayRef< int > Mask, int NumSrcElts)

Return true if this shuffle mask is a transpose mask.

bool isSplice(int &Index) const

Return true if this shuffle splices two inputs without changing the length of the vectors.

Definition Instructions.h:2242

static bool isReverseMask(const Constant *Mask, int NumSrcElts)

Definition Instructions.h:2135

static LLVM_ABI bool isInsertSubvectorMask(ArrayRef< int > Mask, int NumSrcElts, int &NumSubElts, int &Index)

Return true if this shuffle mask is an insert subvector mask.

static bool isSelectMask(const Constant *Mask, int NumSrcElts)

Definition Instructions.h:2110

static bool classof(const Instruction *I)

Definition Instructions.h:2415

static bool isZeroEltSplatMask(const Constant *Mask, int NumSrcElts)

Definition Instructions.h:2156

bool isIdentity() const

Return true if this shuffle chooses elements from exactly one source vector without lane crossings an...

Definition Instructions.h:2079

static bool isReplicationMask(const Constant *Mask, int &ReplicationFactor, int &VF)

Definition Instructions.h:2312

static LLVM_ABI bool isReplicationMask(ArrayRef< int > Mask, int &ReplicationFactor, int &VF)

Return true if this shuffle mask replicates each of the VF elements in a vector ReplicationFactor tim...

static bool isIdentityMask(const Constant *Mask, int NumSrcElts)

Definition Instructions.h:2062

static bool isTransposeMask(const Constant *Mask, int NumSrcElts)

Definition Instructions.h:2207

static LLVM_ABI bool isInterleaveMask(ArrayRef< int > Mask, unsigned Factor, unsigned NumInputElts, SmallVectorImpl< unsigned > &StartIndexes)

Return true if the mask interleaves one or more input vectors together.

bool isReverse() const

Return true if this shuffle swaps the order of elements from exactly one source vector.

Definition Instructions.h:2146

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

void push_back(const T &Elt)

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

An instruction for storing to memory.

Definition Instructions.h:297

static bool classof(const Instruction *I)

Definition Instructions.h:398

AtomicOrdering getOrdering() const

Returns the ordering constraint of this store instruction.

Definition Instructions.h:348

const Value * getPointerOperand() const

Definition Instructions.h:388

Align getAlign() const

Definition Instructions.h:339

Type * getPointerOperandType() const

Definition Instructions.h:390

void setVolatile(bool V)

Specify whether this is a volatile store or not.

Definition Instructions.h:334

void setAlignment(Align Align)

Definition Instructions.h:343

bool isSimple() const

Definition Instructions.h:376

const Value * getValueOperand() const

Definition Instructions.h:385

void setOrdering(AtomicOrdering Ordering)

Sets the ordering constraint of this store instruction.

Definition Instructions.h:354

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:311

Value * getValueOperand()

Definition Instructions.h:384

static bool classof(const Value *V)

Definition Instructions.h:401

bool isUnordered() const

Definition Instructions.h:378

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Transparently provide more efficient getOperand methods.

void setSyncScopeID(SyncScope::ID SSID)

Sets the synchronization scope ID of this store instruction.

Definition Instructions.h:364

LLVM_ABI StoreInst * cloneImpl() const

LLVM_ABI StoreInst(Value *Val, Value *Ptr, InsertPosition InsertBefore)

unsigned getPointerAddressSpace() const

Returns the address space of the pointer operand.

Definition Instructions.h:393

static unsigned getPointerOperandIndex()

Definition Instructions.h:389

SyncScope::ID getSyncScopeID() const

Returns the synchronization scope ID of this store instruction.

Definition Instructions.h:359

bool isVolatile() const

Return true if this is a store to a volatile memory location.

Definition Instructions.h:331

Value * getPointerOperand()

Definition Instructions.h:387

void setAtomic(AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System)

Sets the ordering constraint and the synchronization scope ID of this store instruction.

Definition Instructions.h:370

StringRef - Represent a constant reference to a string, i.e.

LLVM_ABI void setSuccessorWeight(unsigned idx, CaseWeightOpt W)

LLVM_ABI Instruction::InstListType::iterator eraseFromParent()

Delegate the call to the underlying SwitchInst::eraseFromParent() and mark this object to not touch t...

LLVM_ABI void addCase(ConstantInt *OnVal, BasicBlock *Dest, CaseWeightOpt W)

Delegate the call to the underlying SwitchInst::addCase() and set the specified branch weight for the...

SwitchInst & operator*()

Definition Instructions.h:3545

SwitchInstProfUpdateWrapper(SwitchInst &SI)

Definition Instructions.h:3548

~SwitchInstProfUpdateWrapper()

Definition Instructions.h:3550

LLVM_ABI CaseWeightOpt getSuccessorWeight(unsigned idx)

LLVM_ABI void replaceDefaultDest(SwitchInst::CaseIt I)

Replace the default destination by given case.

std::optional< uint32_t > CaseWeightOpt

Definition Instructions.h:3543

SwitchInst * operator->()

Definition Instructions.h:3544

LLVM_ABI SwitchInst::CaseIt removeCase(SwitchInst::CaseIt I)

Delegate the call to the underlying SwitchInst::removeCase() and remove correspondent branch weight.

A handle to a particular switch case.

Definition Instructions.h:3240

unsigned getCaseIndex() const

Returns number of current case.

Definition Instructions.h:3272

ptrdiff_t Index

Definition Instructions.h:3250

unsigned getSuccessorIndex() const

Definition Instructions.h:3275

BasicBlockT * getCaseSuccessor() const

Resolves successor for current case.

Definition Instructions.h:3264

CaseHandleImpl(SwitchInstT *SI, ptrdiff_t Index)

Definition Instructions.h:3253

bool operator==(const CaseHandleImpl &RHS) const

Definition Instructions.h:3282

const SwitchInst * SI

Definition Instructions.h:3249

ConstantIntT * getCaseValue() const

Resolves case value for current case.

Definition Instructions.h:3257

SwitchInstT SwitchInstType

Definition Instructions.h:3247

CaseHandle(SwitchInst *SI, ptrdiff_t Index)

Definition Instructions.h:3296

void setValue(ConstantInt *V) const

Sets the new value for current case.

Definition Instructions.h:3299

void setSuccessor(BasicBlock *S) const

Sets the new successor for current case.

Definition Instructions.h:3306

Definition Instructions.h:3315

const CaseHandleT & operator*() const

Definition Instructions.h:3374

CaseIteratorImpl()=default

Default constructed iterator is in an invalid state until assigned to a case for a particular switch.

CaseIteratorImpl & operator-=(ptrdiff_t N)

Definition Instructions.h:3354

bool operator==(const CaseIteratorImpl &RHS) const

Definition Instructions.h:3367

CaseIteratorImpl & operator+=(ptrdiff_t N)

Definition Instructions.h:3345

ptrdiff_t operator-(const CaseIteratorImpl &RHS) const

Definition Instructions.h:3363

bool operator<(const CaseIteratorImpl &RHS) const

Definition Instructions.h:3370

CaseIteratorImpl(SwitchInstT *SI, unsigned CaseNum)

Initializes case iterator for given SwitchInst and for given case number.

Definition Instructions.h:3327

static CaseIteratorImpl fromSuccessorIndex(SwitchInstT *SI, unsigned SuccessorIndex)

Initializes case iterator for given SwitchInst and for given successor index.

Definition Instructions.h:3331

Multiway switch.

Definition Instructions.h:3196

BasicBlock * getDefaultDest() const

Definition Instructions.h:3393

CaseIteratorImpl< ConstCaseHandle > ConstCaseIt

Definition Instructions.h:3378

CaseIt case_end()

Returns a read/write iterator that points one past the last in the SwitchInst.

Definition Instructions.h:3427

LLVM_ABI SwitchInst * cloneImpl() const

BasicBlock * getSuccessor(unsigned idx) const

Definition Instructions.h:3514

ConstCaseIt findCaseValue(const ConstantInt *C) const

Definition Instructions.h:3468

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Provide fast operand accessors.

static SwitchInst * Create(Value *Value, BasicBlock *Default, unsigned NumCases, InsertPosition InsertBefore=nullptr)

Definition Instructions.h:3380

void setCondition(Value *V)

Definition Instructions.h:3391

bool defaultDestUnreachable() const

Returns true if the default branch must result in immediate undefined behavior, false otherwise.

Definition Instructions.h:3399

ConstCaseIt case_begin() const

Returns a read-only iterator that points to the first case in the SwitchInst.

Definition Instructions.h:3421

iterator_range< ConstCaseIt > cases() const

Constant iteration adapter for range-for loops.

Definition Instructions.h:3443

static const unsigned DefaultPseudoIndex

Definition Instructions.h:3230

CaseIteratorImpl< CaseHandle > CaseIt

Definition Instructions.h:3377

ConstantInt * findCaseDest(BasicBlock *BB)

Finds the unique case value for a given successor.

Definition Instructions.h:3480

void setSuccessor(unsigned idx, BasicBlock *NewSucc)

Definition Instructions.h:3518

CaseHandleImpl< const SwitchInst, const ConstantInt, const BasicBlock > ConstCaseHandle

Definition Instructions.h:3288

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:3222

static bool classof(const Value *V)

Definition Instructions.h:3527

unsigned getNumSuccessors() const

Definition Instructions.h:3513

CaseIt case_default()

Returns an iterator that points to the default case.

Definition Instructions.h:3452

void setDefaultDest(BasicBlock *DefaultCase)

Definition Instructions.h:3403

unsigned getNumCases() const

Return the number of 'cases' in this switch instruction, excluding the default case.

Definition Instructions.h:3409

CaseIt findCaseValue(const ConstantInt *C)

Search all of the case values for the specified constant.

Definition Instructions.h:3463

Value * getCondition() const

Definition Instructions.h:3390

ConstCaseIt case_default() const

Definition Instructions.h:3455

CaseIt case_begin()

Returns a read/write iterator that points to the first case in the SwitchInst.

Definition Instructions.h:3415

static bool classof(const Instruction *I)

Definition Instructions.h:3524

iterator_range< CaseIt > cases()

Iteration adapter for range-for loops.

Definition Instructions.h:3438

ConstCaseIt case_end() const

Returns a read-only iterator that points one past the last in the SwitchInst.

Definition Instructions.h:3433

void setHasNoSignedWrap(bool B)

Definition Instructions.h:4591

static bool classof(const Instruction *I)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Instructions.h:4580

LLVM_ABI TruncInst * cloneImpl() const

Clone an identical TruncInst.

void setHasNoUnsignedWrap(bool B)

Definition Instructions.h:4587

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:4562

unsigned getNoWrapKind() const

Returns the no-wrap kind of the operation.

Definition Instructions.h:4609

bool hasNoSignedWrap() const

Test whether this operation is known to never undergo signed overflow, aka the nsw property.

Definition Instructions.h:4604

@ NoUnsignedWrap

Definition Instructions.h:4568

@ NoSignedWrap

Definition Instructions.h:4568

@ AnyWrap

Definition Instructions.h:4568

static bool classof(const Value *V)

Definition Instructions.h:4583

LLVM_ABI TruncInst(Value *S, Type *Ty, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Constructor with insert-before-instruction semantics.

bool hasNoUnsignedWrap() const

Test whether this operation is known to never undergo unsigned overflow, aka the nuw property.

Definition Instructions.h:4598

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.

LLVM_ABI unsigned getPointerAddressSpace() const

Get the address space of this pointer or pointer vector type.

static bool classof(const Value *V)

Definition Instructions.h:4775

LLVM_ABI UIToFPInst(Value *S, Type *Ty, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Constructor with insert-before-instruction semantics.

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:4756

LLVM_ABI UIToFPInst * cloneImpl() const

Clone an identical UIToFPInst.

static bool classof(const Instruction *I)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Instructions.h:4772

UnaryInstruction(Type *Ty, unsigned iType, Value *V, InsertPosition InsertBefore=nullptr)

This function has undefined behavior.

Definition Instructions.h:4513

LLVM_ABI UnreachableInst(LLVMContext &C, InsertPosition InsertBefore=nullptr)

unsigned getNumSuccessors() const

Definition Instructions.h:4530

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:4518

static bool classof(const Value *V)

Definition Instructions.h:4536

static bool classof(const Instruction *I)

Definition Instructions.h:4533

LLVM_ABI UnreachableInst * cloneImpl() const

A Use represents the edge between a Value definition and its users.

iterator_range< const_op_iterator > const_op_range

const Use * getOperandList() const

const Use & getOperandUse(unsigned i) const

value_op_iterator value_op_end()

void setOperand(unsigned i, Value *Val)

const Use * const_op_iterator

void setNumHungOffUseOperands(unsigned NumOps)

Subclasses with hung off uses need to manage the operand count themselves.

iterator_range< op_iterator > op_range

LLVM_ABI void allocHungoffUses(unsigned N, bool IsPhi=false)

Allocate the array of Uses, followed by a pointer (with bottom bit set) to the User.

Value * getOperand(unsigned i) const

value_op_iterator value_op_begin()

unsigned getNumOperands() const

static bool classof(const Instruction *I)

Definition Instructions.h:1794

Value * getPointerOperand()

Definition Instructions.h:1789

VAArgInst(Value *List, Type *Ty, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Definition Instructions.h:1783

const Value * getPointerOperand() const

Definition Instructions.h:1790

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:1778

static bool classof(const Value *V)

Definition Instructions.h:1797

static unsigned getPointerOperandIndex()

Definition Instructions.h:1791

LLVM_ABI VAArgInst * cloneImpl() const

LLVM Value Representation.

Type * getType() const

All values are typed, get the type of this value.

user_iterator_impl< const User > const_user_iterator

unsigned char SubclassOptionalData

Hold subclass data that can be dropped.

LLVM_ABI void setName(const Twine &Name)

Change the name of the 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.

static bool classof(const Instruction *I)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Instructions.h:4645

LLVM_ABI ZExtInst(Value *S, Type *Ty, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Constructor with insert-before-instruction semantics.

friend class Instruction

Iterator for Instructions in a `BasicBlock.

Definition Instructions.h:4629

static bool classof(const Value *V)

Definition Instructions.h:4648

LLVM_ABI ZExtInst * cloneImpl() const

Clone an identical ZExtInst.

An efficient, type-erasing, non-owning reference to a callable.

typename base_list_type::iterator iterator

iterator_adaptor_base()=default

CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...

A range adaptor for a pair of iterators.

This provides a very simple, boring adaptor for a begin and end iterator into a range type.

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

constexpr char Args[]

Key for Kernel::Metadata::mArgs.

@ C

The default llvm calling convention, compatible with C.

@ System

Synchronized with respect to all concurrently executing threads.

This is an optimization pass for GlobalISel generic memory operations.

Type * checkGEPType(Type *Ty)

Definition Instructions.h:942

bool all_of(R &&range, UnaryPredicate P)

Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.

unsigned getLoadStoreAddressSpace(const Value *I)

A helper function that returns the address space of the pointer operand of load or store instruction.

Definition Instructions.h:5138

decltype(auto) dyn_cast(const From &Val)

dyn_cast - Return the argument parameter cast to the specified type.

const Value * getLoadStorePointerOperand(const Value *V)

A helper function that returns the pointer operand of a load or store instruction.

Definition Instructions.h:5092

iterator_range< T > make_range(T x, T y)

Convenience function for iterating over sub-ranges.

auto cast_or_null(const Y &Val)

void setAtomicSyncScopeID(Instruction *I, SyncScope::ID SSID)

A helper function that sets an atomic operation's sync scope.

Definition Instructions.h:5174

Align getLoadStoreAlignment(const Value *I)

A helper function that returns the alignment of load or store instruction.

Definition Instructions.h:5118

const Value * getPointerOperand(const Value *V)

A helper function that returns the pointer operand of a load, store or GEP instruction.

Definition Instructions.h:5106

LLVM_ABI void setBranchWeights(Instruction &I, ArrayRef< uint32_t > Weights, bool IsExpected, bool ElideAllZero=false)

Create a new branch_weights metadata node and add or overwrite a prof metadata reference to instructi...

decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)

std::optional< SyncScope::ID > getAtomicSyncScopeID(const Instruction *I)

A helper function that returns an atomic operation's sync scope; returns std::nullopt if it is not an...

Definition Instructions.h:5157

bool isa(const From &Val)

isa - Return true if the parameter to the template is an instance of one of the template type argu...

constexpr int PoisonMaskElem

Definition Instructions.h:1923

AtomicOrdering

Atomic ordering for LLVM's memory model.

DWARFExpression::Operation Op

ArrayRef(const T &OneElt) -> ArrayRef< T >

OutputIt copy(R &&Range, OutputIt Out)

constexpr unsigned BitWidth

decltype(auto) cast(const From &Val)

cast - Return the argument parameter cast to the specified type.

auto find_if(R &&Range, UnaryPredicate P)

Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.

auto predecessors(const MachineBasicBlock *BB)

Type * getLoadStoreType(const Value *I)

A helper function that returns the type of a load or store instruction.

Definition Instructions.h:5147

void setLoadStoreAlignment(Value *I, Align NewAlign)

A helper function that set the alignment of load or store instruction.

Definition Instructions.h:5127

unsigned Log2(Align A)

Returns the log2 of the alignment.

@ Default

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

This struct is a compact representation of a valid (non-zero power of two) alignment.

Summary of memprof metadata on allocations.

Describes an element of a Bitfield.

static constexpr bool areContiguous()

The const version of succ_op_iterator.

Definition Instructions.h:3106

const BasicBlock * operator->() const

Definition Instructions.h:3111

const_succ_op_iterator(const_value_op_iterator I)

Definition Instructions.h:3107

const BasicBlock * operator*() const

Definition Instructions.h:3110

Iterator type that casts an operand to a basic block.

Definition Instructions.h:3094

BasicBlock * operator->() const

Definition Instructions.h:3098

succ_op_iterator(value_op_iterator I)

Definition Instructions.h:3095

BasicBlock * operator*() const

Definition Instructions.h:3097

FixedNumOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...

HungoffOperandTraits - determine the allocation regime of the Use array when it is not a prefix to th...

The const version of succ_op_iterator.

Definition Instructions.h:3640

const BasicBlock * operator*() const

Definition Instructions.h:3644

const_succ_op_iterator(const_value_op_iterator I)

Definition Instructions.h:3641

const BasicBlock * operator->() const

Definition Instructions.h:3645

Iterator type that casts an operand to a basic block.

Definition Instructions.h:3628

BasicBlock * operator*() const

Definition Instructions.h:3631

succ_op_iterator(value_op_iterator I)

Definition Instructions.h:3629

BasicBlock * operator->() const

Definition Instructions.h:3632

Compile-time customization of User operands.

A MapVector that performs no allocations if smaller than a certain size.

Information about how a User object was allocated, to be passed into the User constructor.

Indicates this User has operands "hung off" in another allocation.

Indicates this User has operands co-allocated.

Iterator for directly iterating over the operand Values.

VariadicOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...