LLVM: include/llvm/ADT/APInt.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15#ifndef LLVM_ADT_APINT_H

16#define LLVM_ADT_APINT_H

17

21#include

22#include

23#include

24#include

25#include

26

27namespace llvm {

34

36template class ArrayRef;

37template <typename T, typename Enable> struct DenseMapInfo;

38

40

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78class [[nodiscard]] APInt {

79public:

81

82

84

85

87

93

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

112 bool implicitTrunc = false)

113 : BitWidth(numBits) {

114 if (!implicitTrunc) {

116 if (BitWidth == 0) {

118 "Value must be 0 or -1 for signed 0-bit APInt");

119 } else {

121 "Value is not an N-bit signed value");

122 }

123 } else {

124 if (BitWidth == 0) {

125 assert(val == 0 && "Value must be zero for unsigned 0-bit APInt");

126 } else {

128 "Value is not an N-bit unsigned value");

129 }

130 }

131 }

133 U.VAL = val;

134 if (implicitTrunc || isSigned)

136 } else {

138 }

139 }

140

141

142

143

144

145

146

147

149

150

151

152

153

154

155

156

157 [[deprecated("Use other constructors of APInt")]]

159

160

161

162

163

164

165

166

167

168

169

170

172

173

174 explicit APInt() { U.VAL = 0; }

175

176

177 APInt(const APInt &that) : BitWidth(that.BitWidth) {

179 U.VAL = that.U.VAL;

180 else

181 initSlowCase(that);

182 }

183

184

186 memcpy(&U, &that.U, sizeof(U));

187 that.BitWidth = 0;

188 }

189

190

193 delete[] U.pVal;

194 }

195

196

197

198

199

200

202

203

205

206

208

209

215

216

218

219

221 APInt API(numBits, 0);

222 API.setBit(numBits - 1);

223 return API;

224 }

225

226

227

228

229

233

234

238

239

241 APInt Res(numBits, 0);

243 return Res;

244 }

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259 static APInt getBitsSet(unsigned numBits, unsigned loBit, unsigned hiBit) {

260 APInt Res(numBits, 0);

261 Res.setBits(loBit, hiBit);

262 return Res;

263 }

264

265

266

267

268

269

270

272 unsigned hiBit) {

273 APInt Res(numBits, 0);

275 return Res;

276 }

277

278

279

280

281

282

283

284

285

286

288 APInt Res(numBits, 0);

290 return Res;

291 }

292

293

294

295

296

298 APInt Res(numBits, 0);

300 return Res;

301 }

302

303

304

305

306

308 APInt Res(numBits, 0);

310 return Res;

311 }

312

313

315

316

317

318

319

320

321

322

324

325

326

327

328

329

330 bool isNegative() const { return (*this)[BitWidth - 1]; }

331

332

333

334

336

337

338

339

340

341

342 bool isSignBitSet() const { return (*this)[BitWidth - 1]; }

343

344

345

346

347

348

350

351

352

353

354

355

356

358

359

360

361

363

364

365

366

368 return (*this)[BitNo] && popcount() == 1;

369 }

370

371

373 if (BitWidth == 0)

374 return true;

377 return countTrailingOnesSlowCase() == BitWidth;

378 }

379

380

383 return U.VAL == 0;

384 return countLeadingZerosSlowCase() == BitWidth;

385 }

386

387

388

389

392 return U.VAL == 1;

393 return countLeadingZerosSlowCase() == BitWidth - 1;

394 }

395

396

397

398

399

401

402

403

404

405

408 assert(BitWidth && "zero width values not allowed");

409 return U.VAL == ((WordType(1) << (BitWidth - 1)) - 1);

410 }

411 return isNegative() && countTrailingOnesSlowCase() == BitWidth - 1;

412 }

413

414

415

416

417

419

420

421

422

423

426 assert(BitWidth && "zero width values not allowed");

427 return U.VAL == (WordType(1) << (BitWidth - 1));

428 }

429 return isNegative() && countTrailingZerosSlowCase() == BitWidth - 1;

430 }

431

432

434

435

437

438

439

440

443 assert(BitWidth && "zero width values not allowed");

445 }

446 return countPopulationSlowCase() == 1;

447 }

448

449

451 assert(BitWidth && "zero width values not allowed");

453 return false;

454

457 return (LO + TZ) == BitWidth;

458 }

459

460

461

463

464

465

466

468

469

470

471

473

474

475

479

480

481

482

483

484

486

487

488

489 bool isMask(unsigned numBits) const {

490 assert(numBits != 0 && "numBits must be non-zero");

491 assert(numBits <= BitWidth && "numBits out of range");

494 unsigned Ones = countTrailingOnesSlowCase();

495 return (numBits == Ones) &&

496 ((Ones + countLeadingZerosSlowCase()) == BitWidth);

497 }

498

499

500

501

505 unsigned Ones = countTrailingOnesSlowCase();

506 return (Ones > 0) && ((Ones + countLeadingZerosSlowCase()) == BitWidth);

507 }

508

509

510

514 unsigned Ones = countPopulationSlowCase();

515 unsigned LeadZ = countLeadingZerosSlowCase();

516 return (Ones + LeadZ + countTrailingZerosSlowCase()) == BitWidth;

517 }

518

519

520

521

522

523 bool isShiftedMask(unsigned &MaskIdx, unsigned &MaskLen) const {

526 unsigned Ones = countPopulationSlowCase();

527 unsigned LeadZ = countLeadingZerosSlowCase();

528 unsigned TrailZ = countTrailingZerosSlowCase();

529 if ((Ones + LeadZ + TrailZ) != BitWidth)

530 return false;

531 MaskLen = Ones;

532 MaskIdx = TrailZ;

533 return true;

534 }

535

536

537

538

539

540

541

542 LLVM_ABI APInt getHiBits(unsigned numBits) const;

543

544

545

546

547

548

549

550 LLVM_ABI APInt getLoBits(unsigned numBits) const;

551

552

553

555 if (I1.getBitWidth() == I2.getBitWidth())

556 return I1 == I2;

557

559 return I1 == I2.zext(I1.getBitWidth());

560

562 }

563

564

566

567

568

569

572 return &U.VAL;

573 return &U.pVal[0];

574 }

575

576

577

578

579

580

581

582

584 APInt API(*this);

585 ++(*this);

586 return API;

587 }

588

589

590

591

593

594

595

596

598 APInt API(*this);

599 --(*this);

600 return API;

601 }

602

603

604

605

607

608

609

611

612

613

614

615

616

617

618

620

621

623 U.VAL = RHS.U.VAL;

624 BitWidth = RHS.BitWidth;

625 return *this;

626 }

627

628 assignSlowCase(RHS);

629 return *this;

630 }

631

632

634#ifdef EXPENSIVE_CHECKS

635

636 if (this == &that)

637 return *this;

638#endif

639 assert(this != &that && "Self-move not supported");

641 delete[] U.pVal;

642

643

644

645 memcpy(&U, &that.U, sizeof(U));

646

647 BitWidth = that.BitWidth;

648 that.BitWidth = 0;

649 return *this;

650 }

651

652

653

654

655

656

657

658

661 U.VAL = RHS;

663 }

666 return *this;

667 }

668

669

670

671

672

673

674

676 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");

678 U.VAL &= RHS.U.VAL;

679 else

680 andAssignSlowCase(RHS);

681 return *this;

682 }

683

684

685

686

687

688

691 U.VAL &= RHS;

692 return *this;

693 }

696 return *this;

697 }

698

699

700

701

702

703

704

706 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");

708 U.VAL |= RHS.U.VAL;

709 else

710 orAssignSlowCase(RHS);

711 return *this;

712 }

713

714

715

716

717

718

721 U.VAL |= RHS;

723 }

725 return *this;

726 }

727

728

729

730

731

732

733

735 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");

737 U.VAL ^= RHS.U.VAL;

738 else

739 xorAssignSlowCase(RHS);

740 return *this;

741 }

742

743

744

745

746

747

750 U.VAL ^= RHS;

752 }

754 return *this;

755 }

756

757

758

759

760

761

764

765

766

767

768

769

772

773

774

775

776

777

780

781

782

783

784

785

787 assert(ShiftAmt <= BitWidth && "Invalid shift amount");

789 if (ShiftAmt == BitWidth)

790 U.VAL = 0;

791 else

792 U.VAL <<= ShiftAmt;

794 }

795 shlSlowCase(ShiftAmt);

796 return *this;

797 }

798

799

800

801

802

803

805

806

807

808

809

810

811

812

814

815

816

817

819

820

821

822

824

825

826

827

830 R.ashrInPlace(ShiftAmt);

831 return R;

832 }

833

834

836 assert(ShiftAmt <= BitWidth && "Invalid shift amount");

838 int64_t SExtVAL = SignExtend64(U.VAL, BitWidth);

839 if (ShiftAmt == BitWidth)

841 else

842 U.VAL = SExtVAL >> ShiftAmt;

844 return;

845 }

846 ashrSlowCase(ShiftAmt);

847 }

848

849

850

851

854 R.lshrInPlace(shiftAmt);

855 return R;

856 }

857

858

860 assert(ShiftAmt <= BitWidth && "Invalid shift amount");

862 if (ShiftAmt == BitWidth)

863 U.VAL = 0;

864 else

865 U.VAL >>= ShiftAmt;

866 return;

867 }

868 lshrSlowCase(ShiftAmt);

869 }

870

871

872

873

876 R <<= shiftAmt;

877 return R;

878 }

879

880

882 return RelativeShift > 0 ? lshr(RelativeShift) : shl(-RelativeShift);

883 }

884

885

889

890

892 return RelativeShift > 0 ? ashr(RelativeShift) : shl(-RelativeShift);

893 }

894

895

899

900

902

903

905

906

907

908

911 R.ashrInPlace(ShiftAmt);

912 return R;

913 }

914

915

916 LLVM_ABI void ashrInPlace(const APInt &shiftAmt);

917

918

919

920

923 R.lshrInPlace(ShiftAmt);

924 return R;

925 }

926

927

928 LLVM_ABI void lshrInPlace(const APInt &ShiftAmt);

929

930

931

932

935 R <<= ShiftAmt;

936 return R;

937 }

938

939

941

942

944

945

946

947

949

953 return concatSlowCase(NewLSB);

954 }

955

956

957

958

959

960

961

962

965

966

967

968

969

970

973

974

975

976

977

978

979

980

983

984

985

986

987

988

989

991 LLVM_ABI int64_t srem(int64_t RHS) const;

992

993

994

995

996

997

998

999

1004

1008 int64_t &Remainder);

1009

1010

1019 LLVM_ABI APInt sshl_ov(unsigned Amt, bool &Overflow) const;

1021 LLVM_ABI APInt ushl_ov(unsigned Amt, bool &Overflow) const;

1022

1023

1024

1025

1026

1028

1029

1040

1041

1042

1043

1045 assert(bitPosition < getBitWidth() && "Bit position out of bounds!");

1046 return (maskBit(bitPosition) & getWord(bitPosition)) != 0;

1047 }

1048

1049

1050

1051

1052

1053

1054

1055

1056

1058 assert(BitWidth == RHS.BitWidth && "Comparison requires equal bit widths");

1060 return U.VAL == RHS.U.VAL;

1061 return equalSlowCase(RHS);

1062 }

1063

1064

1065

1066

1067

1068

1069

1073

1074

1075

1076

1077

1078

1079

1081

1082

1083

1084

1085

1086

1087

1089

1090

1091

1092

1093

1094

1095

1097

1098

1099

1100

1101

1102

1103

1105

1106

1107

1108

1109

1110

1111

1113

1114

1115

1116

1117

1118

1119

1124

1125

1126

1127

1128

1129

1130

1132

1133

1134

1135

1136

1137

1138

1144

1145

1146

1147

1148

1149

1150

1152

1153

1154

1155

1156

1157

1158

1160

1161

1162

1163

1164

1165

1166

1167 bool sle(const APInt &RHS) const { return compareSigned(RHS) <= 0; }

1168

1169

1170

1171

1172

1173

1174

1176

1177

1178

1179

1180

1181

1182

1184

1185

1186

1187

1188

1189

1190

1195

1196

1197

1198

1199

1200

1201

1203

1204

1205

1206

1207

1208

1209

1215

1216

1217

1218

1219

1220

1221

1223

1224

1225

1226

1227

1228

1229

1231

1232

1233

1234

1235

1236

1237

1239

1240

1241

1242

1243

1244

1245

1247

1248

1249

1251 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");

1253 return (U.VAL & RHS.U.VAL) != 0;

1254 return intersectsSlowCase(RHS);

1255 }

1256

1257

1259 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");

1261 return (U.VAL & ~RHS.U.VAL) == 0;

1262 return isSubsetOfSlowCase(RHS);

1263 }

1264

1265

1266

1267

1268

1269

1270

1271

1272

1274

1275

1276

1277

1278

1280

1281

1282

1283

1284

1285

1287

1288

1289

1290

1291

1292

1293

1295

1296

1297

1298

1299

1300

1302

1303

1304

1305

1306

1307 LLVM_ABI APInt sextOrTrunc(unsigned width) const;

1308

1309

1310

1311

1312

1313 LLVM_ABI APInt zextOrTrunc(unsigned width) const;

1314

1315

1316

1317

1318

1319

1323 else

1324

1326

1328 }

1329

1330

1332 assert(BitPosition < BitWidth && "BitPosition out of range");

1333 WordType Mask = maskBit(BitPosition);

1335 U.VAL |= Mask;

1336 else

1337 U.pVal[whichWord(BitPosition)] |= Mask;

1338 }

1339

1340

1342

1343

1344 void setBitVal(unsigned BitPosition, bool BitValue) {

1345 if (BitValue)

1346 setBit(BitPosition);

1347 else

1349 }

1350

1351

1352

1353

1354

1356 assert(hiBit <= BitWidth && "hiBit out of range");

1357 assert(loBit <= BitWidth && "loBit out of range");

1358 if (loBit < hiBit) {

1360 return;

1361 }

1364 }

1365

1366

1367

1368 void setBits(unsigned loBit, unsigned hiBit) {

1369 assert(hiBit <= BitWidth && "hiBit out of range");

1370 assert(loBit <= hiBit && "loBit greater than hiBit");

1371 if (loBit == hiBit)

1372 return;

1375 mask <<= loBit;

1377 U.VAL |= mask;

1378 else

1379 U.pVal[0] |= mask;

1380 } else {

1381 setBitsSlowCase(loBit, hiBit);

1382 }

1383 }

1384

1385

1387

1388

1390

1391

1393 return setBits(BitWidth - hiBits, BitWidth);

1394 }

1395

1396

1399 U.VAL = 0;

1400 else

1402 }

1403

1404

1405

1406

1408 assert(BitPosition < BitWidth && "BitPosition out of range");

1409 WordType Mask = ~maskBit(BitPosition);

1411 U.VAL &= Mask;

1412 else

1413 U.pVal[whichWord(BitPosition)] &= Mask;

1414 }

1415

1416

1417

1418 void clearBits(unsigned LoBit, unsigned HiBit) {

1419 assert(HiBit <= BitWidth && "HiBit out of range");

1420 assert(LoBit <= HiBit && "LoBit greater than HiBit");

1421 if (LoBit == HiBit)

1422 return;

1425 Mask = ~(Mask << LoBit);

1427 U.VAL &= Mask;

1428 else

1429 U.pVal[0] &= Mask;

1430 } else {

1431 clearBitsSlowCase(LoBit, HiBit);

1432 }

1433 }

1434

1435

1437 assert(loBits <= BitWidth && "More bits than bitwidth");

1439 *this &= Keep;

1440 }

1441

1442

1444 assert(hiBits <= BitWidth && "More bits than bitwidth");

1446 *this &= Keep;

1447 }

1448

1449

1451

1452

1457 } else {

1458 flipAllBitsSlowCase();

1459 }

1460 }

1461

1462

1463

1464

1465

1466 LLVM_ABI void flipBit(unsigned bitPosition);

1467

1468

1473

1474

1475 LLVM_ABI void insertBits(const APInt &SubBits, unsigned bitPosition);

1476 LLVM_ABI void insertBits(uint64_t SubBits, unsigned bitPosition,

1477 unsigned numBits);

1478

1479

1482 unsigned bitPosition) const;

1483

1484

1485

1486

1487

1488

1490

1491

1492

1493

1494

1495

1497

1498

1499

1500

1501

1502

1503

1507

1508

1509

1510

1511

1512

1514

1515

1516

1517

1518

1521 return numActiveBits ? whichWord(numActiveBits - 1) + 1 : 1;

1522 }

1523

1524

1525

1526

1527

1528

1529

1530

1531

1535

1536

1537

1538

1539

1540

1543 return U.VAL;

1545 return U.pVal[0];

1546 }

1547

1548

1549

1550

1551

1552

1555 : std::nullopt;

1556 };

1557

1558

1559

1560

1561

1562

1567 return int64_t(U.pVal[0]);

1568 }

1569

1570

1571

1572

1573

1574

1577 : std::nullopt;

1578 };

1579

1580

1581

1582

1583

1585

1586

1587

1588

1591

1592

1593

1594

1595

1596

1597

1598

1603 }

1604 return countLeadingZerosSlowCase();

1605 }

1606

1608

1609

1610

1611

1612

1613

1614

1615

1619 return 0;

1621 }

1622 return countLeadingOnesSlowCase();

1623 }

1624

1626

1627

1628

1632

1633

1634

1635

1636

1637

1638

1639

1643 return (TrailingZeros > BitWidth ? BitWidth : TrailingZeros);

1644 }

1645 return countTrailingZerosSlowCase();

1646 }

1647

1649

1650

1651

1652

1653

1654

1655

1656

1660 return countTrailingOnesSlowCase();

1661 }

1662

1664

1665

1666

1667

1668

1669

1670

1674 return countPopulationSlowCase();

1675 }

1676

1677

1678

1679

1681

1682

1683

1684

1686 bool Signed, bool formatAsCLiteral = false,

1687 bool UpperCase = true,

1688 bool InsertSeparators = false) const;

1689

1690

1691

1693 toString(Str, Radix, false, false);

1694 }

1695

1696

1697

1699 toString(Str, Radix, true, false);

1700 }

1701

1702

1704

1705

1706

1708

1709

1711

1712

1714

1715

1717

1718

1719

1720

1721

1722

1724

1725#ifdef HAS_IEE754_FLOAT128

1726 float128 bitsToQuad() const {

1727 __uint128_t ul = ((__uint128_t)U.pVal[1] << 64) + U.pVal[0];

1729 }

1730#endif

1731

1732

1733

1734

1735

1736

1740

1741

1742

1743

1744

1748

1749

1750

1751

1752

1756

1757

1758

1759

1760

1761

1763

1764

1766 APInt temp(*this);

1767 --temp;

1769 }

1770

1771

1772

1773

1774

1775

1776

1777

1778

1779

1780 LLVM_ABI unsigned nearestLogBase2() const;

1781

1782

1783

1789

1790

1792

1793

1794

1795

1798 return -(*this);

1799 return *this;

1800 }

1801

1802

1804

1805

1806

1807

1808

1809

1810

1811

1812

1813

1814

1815

1816

1817 LLVM_ABI static void tcSet(WordType *, WordType, unsigned);

1818

1819

1820 LLVM_ABI static void tcAssign(WordType *, const WordType *, unsigned);

1821

1822

1823 LLVM_ABI static bool tcIsZero(const WordType *, unsigned);

1824

1825

1826 LLVM_ABI static int tcExtractBit(const WordType *, unsigned bit);

1827

1828

1829

1830

1831

1832 LLVM_ABI static void tcExtract(WordType *, unsigned dstCount,

1833 const WordType *, unsigned srcBits,

1834 unsigned srcLSB);

1835

1836

1837 LLVM_ABI static void tcSetBit(WordType *, unsigned bit);

1838

1839

1840 LLVM_ABI static void tcClearBit(WordType *, unsigned bit);

1841

1842

1843

1844 LLVM_ABI static unsigned tcLSB(const WordType *, unsigned n);

1845 LLVM_ABI static unsigned tcMSB(const WordType *parts, unsigned n);

1846

1847

1848 LLVM_ABI static void tcNegate(WordType *, unsigned);

1849

1850

1851 LLVM_ABI static WordType tcAdd(WordType *, const WordType *, WordType carry,

1852 unsigned);

1853

1854 LLVM_ABI static WordType tcAddPart(WordType *, WordType, unsigned);

1855

1856

1857 LLVM_ABI static WordType tcSubtract(WordType *, const WordType *,

1858 WordType carry, unsigned);

1859

1860 LLVM_ABI static WordType tcSubtractPart(WordType *, WordType, unsigned);

1861

1862

1863

1864

1865

1866

1867

1868

1869

1870

1871

1872 LLVM_ABI static int tcMultiplyPart(WordType *dst, const WordType *src,

1873 WordType multiplier, WordType carry,

1874 unsigned srcParts, unsigned dstParts,

1875 bool add);

1876

1877

1878

1879

1880

1881 LLVM_ABI static int tcMultiply(WordType *, const WordType *, const WordType *,

1882 unsigned);

1883

1884

1885

1886 LLVM_ABI static void tcFullMultiply(WordType *, const WordType *,

1887 const WordType *, unsigned, unsigned);

1888

1889

1890

1891

1892

1893

1894

1895

1896

1897

1898 LLVM_ABI static int tcDivide(WordType *lhs, const WordType *rhs,

1899 WordType *remainder, WordType *scratch,

1900 unsigned parts);

1901

1902

1903

1904 LLVM_ABI static void tcShiftLeft(WordType *, unsigned Words, unsigned Count);

1905

1906

1907

1908 LLVM_ABI static void tcShiftRight(WordType *, unsigned Words, unsigned Count);

1909

1910

1911 LLVM_ABI static int tcCompare(const WordType *, const WordType *, unsigned);

1912

1913

1917

1918

1922

1923

1924

1926

1927#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)

1928

1930#endif

1931

1932

1934

1935private:

1936

1937

1938 union {

1939 uint64_t VAL;

1940 uint64_t *pVal;

1941 } U;

1942

1943 unsigned BitWidth = 1;

1944

1947

1948

1949 friend DynamicAPInt;

1950

1951

1952

1953

1954 APInt(uint64_t *val, unsigned bits) : BitWidth(bits) { U.pVal = val; }

1955

1956

1957

1958

1959 static unsigned whichWord(unsigned bitPosition) {

1960 return bitPosition / APINT_BITS_PER_WORD;

1961 }

1962

1963

1964 static unsigned whichBit(unsigned bitPosition) {

1965 return bitPosition % APINT_BITS_PER_WORD;

1966 }

1967

1968

1969

1970

1971

1972

1973

1974 static uint64_t maskBit(unsigned bitPosition) {

1975 return 1ULL << whichBit(bitPosition);

1976 }

1977

1978

1979

1980

1981

1982

1983

1985

1986 unsigned WordBits = ((BitWidth - 1) % APINT_BITS_PER_WORD) + 1;

1987

1988

1989 uint64_t mask = WORDTYPE_MAX >> (APINT_BITS_PER_WORD - WordBits);

1992

1993 if (isSingleWord())

1995 else

1996 U.pVal[getNumWords() - 1] &= mask;

1997 return *this;

1998 }

1999

2000

2001

2002 uint64_t getWord(unsigned bitPosition) const {

2003 return isSingleWord() ? U.VAL : U.pVal[whichWord(bitPosition)];

2004 }

2005

2006

2007

2008

2009 void reallocate(unsigned NewBitWidth);

2010

2011

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

2022

2023 void fromString(unsigned numBits, StringRef str, uint8_t radix);

2024

2025

2026

2027

2028

2029

2030

2031 static void divide(const WordType *LHS, unsigned lhsWords,

2032 const WordType *RHS, unsigned rhsWords, WordType *Quotient,

2033 WordType *Remainder);

2034

2035

2037

2038

2039 void initFromArray(ArrayRef<uint64_t> array);

2040

2041

2042 LLVM_ABI void initSlowCase(const APInt &that);

2043

2044

2045 LLVM_ABI void shlSlowCase(unsigned ShiftAmt);

2046

2047

2048 LLVM_ABI void lshrSlowCase(unsigned ShiftAmt);

2049

2050

2051 LLVM_ABI void ashrSlowCase(unsigned ShiftAmt);

2052

2053

2054 LLVM_ABI void assignSlowCase(const APInt &RHS);

2055

2056

2058

2059

2061

2062

2064

2065

2067

2068

2070

2071

2073

2074

2076

2077

2079

2080

2081 LLVM_ABI void setBitsSlowCase(unsigned loBit, unsigned hiBit);

2082

2083

2084 LLVM_ABI void clearBitsSlowCase(unsigned LoBit, unsigned HiBit);

2085

2086

2087 LLVM_ABI void flipAllBitsSlowCase();

2088

2089

2091

2092

2094

2095

2097

2098

2100

2101

2102

2104

2105

2106

2108

2109

2110};

2111

2113

2115

2116

2117

2118

2120 v.flipAllBits();

2121 return v;

2122}

2123

2125 a &= b;

2126 return a;

2127}

2128

2130 b &= a;

2131 return std::move(b);

2132}

2133

2135 a &= RHS;

2136 return a;

2137}

2138

2140 b &= LHS;

2141 return b;

2142}

2143

2145 a |= b;

2146 return a;

2147}

2148

2150 b |= a;

2151 return std::move(b);

2152}

2153

2155 a |= RHS;

2156 return a;

2157}

2158

2160 b |= LHS;

2161 return b;

2162}

2163

2165 a ^= b;

2166 return a;

2167}

2168

2170 b ^= a;

2171 return std::move(b);

2172}

2173

2175 a ^= RHS;

2176 return a;

2177}

2178

2180 b ^= LHS;

2181 return b;

2182}

2183

2185 I.print(OS, true);

2186 return OS;

2187}

2188

2190 v.negate();

2191 return v;

2192}

2193

2195 a += b;

2196 return a;

2197}

2198

2200 b += a;

2201 return std::move(b);

2202}

2203

2205 a += RHS;

2206 return a;

2207}

2208

2210 b += LHS;

2211 return b;

2212}

2213

2215 a -= b;

2216 return a;

2217}

2218

2220 b.negate();

2221 b += a;

2222 return std::move(b);

2223}

2224

2226 a -= RHS;

2227 return a;

2228}

2229

2231 b.negate();

2232 b += LHS;

2233 return b;

2234}

2235

2237 a *= RHS;

2238 return a;

2239}

2240

2242 b *= LHS;

2243 return b;

2244}

2245

2247

2248

2250 return A.slt(B) ? A : B;

2251}

2252

2253

2255 return A.sgt(B) ? A : B;

2256}

2257

2258

2260 return A.ult(B) ? A : B;

2261}

2262

2263

2265 return A.ugt(B) ? A : B;

2266}

2267

2268

2270 return A.sge(B) ? (A - B) : (B - A);

2271}

2272

2273

2275 return A.uge(B) ? (A - B) : (B - A);

2276}

2277

2278

2280

2281

2283

2284

2286

2287

2289

2290

2291

2293

2294

2295

2297

2298

2300

2301

2303

2304

2305

2307

2308

2309

2310

2311

2312

2313

2315

2316

2317

2318

2322

2323

2324

2325

2329

2330

2334

2335

2336

2337

2341

2342

2343

2344

2345LLVM_ABI APInt RoundDoubleToAPInt(double Double, unsigned width);

2346

2347

2348

2349

2353

2354

2356

2357

2359

2360

2361

2362

2363

2364

2365

2366

2367

2368

2369

2370

2371

2372

2373

2374

2375

2376

2377

2378

2379

2380

2381

2382

2383

2384

2385

2386

2387

2388

2389

2390

2391

2392

2393LLVM_ABI std::optional

2394SolveQuadraticEquationWrap(APInt A, APInt B, APInt C, unsigned RangeWidth);

2395

2396

2397

2398LLVM_ABI std::optional GetMostSignificantDifferentBit(const APInt &A,

2400

2401

2402

2403

2404

2405

2406

2407

2408

2409

2410

2411

2413 bool MatchAllBits = false);

2414

2415

2416

2417

2418

2419

2420

2421

2422

2423

2424

2425

2426

2428

2429

2430

2431

2432

2433

2434

2435

2436

2437

2438

2439

2440

2442

2443

2444

2445

2446

2447

2448

2449

2450

2452

2453

2454

2455

2457

2458

2459

2460

2461

2463

2464}

2465

2466

2467

2468LLVM_ABI hash_code hash_value(const APInt &Arg);

2469

2470

2471

2472LLVM_ABI void StoreIntToMemory(const APInt &IntVal, uint8_t *Dst,

2473 unsigned StoreBytes);

2474

2475

2476

2477LLVM_ABI void LoadIntFromMemory(APInt &IntVal, const uint8_t *Src,

2478 unsigned LoadBytes);

2479

2480

2483 APInt V(nullptr, 0);

2484 V.U.VAL = ~0ULL;

2485 return V;

2486 }

2487

2489 APInt V(nullptr, 0);

2490 V.U.VAL = ~1ULL;

2491 return V;

2492 }

2493

2495

2497 return LHS.getBitWidth() == RHS.getBitWidth() && LHS == RHS;

2498 }

2499};

2500

2501}

2502

2503#endif

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

static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)

static constexpr unsigned long long mask(BlockVerifier::State S)

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

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

raw_ostream & operator<<(raw_ostream &OS, const binary_le_impl< value_type > &BLE)

#define LLVM_UNLIKELY(EXPR)

#define LLVM_DUMP_METHOD

Mark debug helper function definitions like dump() that should not be stripped from debug builds.

static bool isSigned(unsigned int Opcode)

static KnownBits extractBits(unsigned BitWidth, const KnownBits &SrcOpKnown, const KnownBits &OffsetKnown, const KnownBits &WidthKnown)

static bool isZero(Value *V, const DataLayout &DL, DominatorTree *DT, AssumptionCache *AC)

static bool isAligned(const Value *Base, Align Alignment, const DataLayout &DL)

static bool isSplat(Value *V)

Return true if V is a splat of a value (which is used when multiplying a matrix with a scalar).

static const char * toString(MIToken::TokenKind TokenKind)

static uint64_t clearUnusedBits(uint64_t Val, unsigned Size)

static uint64_t umul_ov(uint64_t i, uint64_t j, bool &Overflow)

static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")

static unsigned getBitWidth(Type *Ty, const DataLayout &DL)

Returns the bitwidth of the given scalar or pointer type.

Class for arbitrary precision integers.

Definition APInt.h:78

std::optional< uint64_t > tryZExtValue() const

Get zero extended value if possible.

Definition APInt.h:1553

static APInt getAllOnes(unsigned numBits)

Return an APInt of a specified width with all bits set.

Definition APInt.h:235

bool slt(int64_t RHS) const

Signed less than comparison.

Definition APInt.h:1139

void clearBit(unsigned BitPosition)

Set a given bit to 0.

Definition APInt.h:1407

APInt relativeLShr(int RelativeShift) const

relative logical shift right

Definition APInt.h:881

bool isNegatedPowerOf2() const

Check if this APInt's negated value is a power of two greater than zero.

Definition APInt.h:450

LLVM_ABI APInt zext(unsigned width) const

Zero extend to a new width.

static APInt getSignMask(unsigned BitWidth)

Get the SignMask for a specific bit width.

Definition APInt.h:230

bool isMinSignedValue() const

Determine if this is the smallest signed value.

Definition APInt.h:424

APInt operator--(int)

Postfix decrement operator.

Definition APInt.h:597

uint64_t getZExtValue() const

Get zero extended value.

Definition APInt.h:1541

uint64_t * pVal

Used to store the >64 bits integer value.

Definition APInt.h:1940

friend class APSInt

Definition APInt.h:1946

void setHighBits(unsigned hiBits)

Set the top hiBits bits.

Definition APInt.h:1392

unsigned popcount() const

Count the number of bits set.

Definition APInt.h:1671

~APInt()

Destructor.

Definition APInt.h:191

void setBitsFrom(unsigned loBit)

Set the top bits starting from loBit.

Definition APInt.h:1386

APInt operator<<(const APInt &Bits) const

Left logical shift operator.

Definition APInt.h:823

bool isMask() const

Definition APInt.h:502

APInt operator<<(unsigned Bits) const

Left logical shift operator.

Definition APInt.h:818

unsigned getActiveBits() const

Compute the number of active bits in the value.

Definition APInt.h:1513

bool sgt(int64_t RHS) const

Signed greater than comparison.

Definition APInt.h:1210

static APInt getMaxValue(unsigned numBits)

Gets maximum unsigned value of APInt for specific bit width.

Definition APInt.h:207

void setBit(unsigned BitPosition)

Set the given bit to 1 whose position is given as "bitPosition".

Definition APInt.h:1331

bool operator[](unsigned bitPosition) const

Array-indexing support.

Definition APInt.h:1044

bool operator!=(const APInt &RHS) const

Inequality operator.

Definition APInt.h:1088

void toStringUnsigned(SmallVectorImpl< char > &Str, unsigned Radix=10) const

Considers the APInt to be unsigned and converts it into a string in the radix given.

Definition APInt.h:1692

APInt & operator&=(const APInt &RHS)

Bitwise AND assignment operator.

Definition APInt.h:675

APInt abs() const

Get the absolute value.

Definition APInt.h:1796

unsigned ceilLogBase2() const

Definition APInt.h:1765

Rounding

Definition APInt.h:88

@ TOWARD_ZERO

Definition APInt.h:90

@ DOWN

Definition APInt.h:89

@ UP

Definition APInt.h:91

unsigned countLeadingOnes() const

Definition APInt.h:1625

APInt relativeLShl(int RelativeShift) const

relative logical shift left

Definition APInt.h:886

APInt & operator=(const APInt &RHS)

Copy assignment operator.

Definition APInt.h:619

bool sgt(const APInt &RHS) const

Signed greater than comparison.

Definition APInt.h:1202

bool isAllOnes() const

Determine if all bits are set. This is true for zero-width values.

Definition APInt.h:372

APInt(unsigned numBits, uint64_t val, bool isSigned=false, bool implicitTrunc=false)

Create a new APInt of numBits width, initialized as val.

Definition APInt.h:111

APInt & operator^=(uint64_t RHS)

Bitwise XOR assignment operator.

Definition APInt.h:748

bool ugt(const APInt &RHS) const

Unsigned greater than comparison.

Definition APInt.h:1183

static APInt getBitsSet(unsigned numBits, unsigned loBit, unsigned hiBit)

Get a value with a block of bits set.

Definition APInt.h:259

bool isZero() const

Determine if this value is zero, i.e. all bits are clear.

Definition APInt.h:381

APInt & operator|=(uint64_t RHS)

Bitwise OR assignment operator.

Definition APInt.h:719

bool isSignMask() const

Check if the APInt's value is returned by getSignMask.

Definition APInt.h:467

static APInt floatToBits(float V)

Converts a float to APInt bits.

Definition APInt.h:1753

uint64_t WordType

Definition APInt.h:80

void setSignBit()

Set the sign bit to 1.

Definition APInt.h:1341

static constexpr unsigned APINT_WORD_SIZE

Byte size of a word.

Definition APInt.h:83

unsigned getBitWidth() const

Return the number of bits in the APInt.

Definition APInt.h:1489

bool sle(uint64_t RHS) const

Signed less or equal comparison.

Definition APInt.h:1175

bool ult(const APInt &RHS) const

Unsigned less than comparison.

Definition APInt.h:1112

bool uge(uint64_t RHS) const

Unsigned greater or equal comparison.

Definition APInt.h:1230

bool operator!() const

Logical negation operation on this APInt returns true if zero, like normal integers.

Definition APInt.h:610

static APInt getSignedMaxValue(unsigned numBits)

Gets maximum signed value of APInt for a specific bit width.

Definition APInt.h:210

APInt & operator=(uint64_t RHS)

Assignment operator.

Definition APInt.h:659

APInt relativeAShr(int RelativeShift) const

relative arithmetic shift right

Definition APInt.h:891

APInt(const APInt &that)

Copy Constructor.

Definition APInt.h:177

APInt & operator|=(const APInt &RHS)

Bitwise OR assignment operator.

Definition APInt.h:705

bool isSingleWord() const

Determine if this APInt just has one word to store value.

Definition APInt.h:323

bool operator==(uint64_t Val) const

Equality operator.

Definition APInt.h:1070

APInt operator++(int)

Postfix increment operator.

Definition APInt.h:583

unsigned getNumWords() const

Get the number of words.

Definition APInt.h:1496

bool isMinValue() const

Determine if this is the smallest unsigned value.

Definition APInt.h:418

APInt ashr(const APInt &ShiftAmt) const

Arithmetic right-shift function.

Definition APInt.h:909

APInt()

Default constructor that creates an APInt with a 1-bit zero value.

Definition APInt.h:174

static APInt getMinValue(unsigned numBits)

Gets minimum unsigned value of APInt for a specific bit width.

Definition APInt.h:217

APInt(APInt &&that)

Move Constructor.

Definition APInt.h:185

bool isNegative() const

Determine sign of this APInt.

Definition APInt.h:330

APInt concat(const APInt &NewLSB) const

Concatenate the bits from "NewLSB" onto the bottom of *this.

Definition APInt.h:948

bool intersects(const APInt &RHS) const

This operation tests if there are any pairs of corresponding bits between this APInt and RHS that are...

Definition APInt.h:1250

bool eq(const APInt &RHS) const

Equality comparison.

Definition APInt.h:1080

int32_t exactLogBase2() const

Definition APInt.h:1784

APInt & operator<<=(unsigned ShiftAmt)

Left-shift assignment function.

Definition APInt.h:786

double roundToDouble() const

Converts this unsigned APInt to a double value.

Definition APInt.h:1713

void clearAllBits()

Set every bit to 0.

Definition APInt.h:1397

APInt relativeAShl(int RelativeShift) const

relative arithmetic shift left

Definition APInt.h:896

void ashrInPlace(unsigned ShiftAmt)

Arithmetic right-shift this APInt by ShiftAmt in place.

Definition APInt.h:835

bool sle(const APInt &RHS) const

Signed less or equal comparison.

Definition APInt.h:1167

void negate()

Negate this APInt in place.

Definition APInt.h:1469

static WordType tcDecrement(WordType *dst, unsigned parts)

Decrement a bignum in-place. Return the borrow flag.

Definition APInt.h:1919

unsigned countr_zero() const

Count the number of trailing zero bits.

Definition APInt.h:1640

bool isSignedIntN(unsigned N) const

Check if this APInt has an N-bits signed integer value.

Definition APInt.h:436

unsigned getNumSignBits() const

Computes the number of leading bits of this APInt that are equal to its sign bit.

Definition APInt.h:1629

bool isOneBitSet(unsigned BitNo) const

Determine if this APInt Value only has the specified bit set.

Definition APInt.h:367

unsigned countl_zero() const

The APInt version of std::countl_zero.

Definition APInt.h:1599

bool operator==(const APInt &RHS) const

Equality operator.

Definition APInt.h:1057

APInt shl(const APInt &ShiftAmt) const

Left-shift function.

Definition APInt.h:933

static APInt getSignedMinValue(unsigned numBits)

Gets minimum signed value of APInt for a specific bit width.

Definition APInt.h:220

LLVM_ABI friend hash_code hash_value(const APInt &Arg)

Overload to compute a hash_code for an APInt value.

bool isShiftedMask(unsigned &MaskIdx, unsigned &MaskLen) const

Return true if this APInt value contains a non-empty sequence of ones with the remainder zero.

Definition APInt.h:523

static constexpr WordType WORDTYPE_MAX

Definition APInt.h:94

static LLVM_ABI WordType tcSubtractPart(WordType *, WordType, unsigned)

DST -= RHS. Returns the carry flag.

void setBitsWithWrap(unsigned loBit, unsigned hiBit)

Set the bits from loBit (inclusive) to hiBit (exclusive) to 1.

Definition APInt.h:1355

APInt lshr(const APInt &ShiftAmt) const

Logical right-shift function.

Definition APInt.h:921

bool isNonPositive() const

Determine if this APInt Value is non-positive (<= 0).

Definition APInt.h:362

unsigned countTrailingZeros() const

Definition APInt.h:1648

unsigned getSignificantBits() const

Get the minimum bit size for this signed APInt.

Definition APInt.h:1532

unsigned countLeadingZeros() const

Definition APInt.h:1607

bool isStrictlyPositive() const

Determine if this APInt Value is positive.

Definition APInt.h:357

void flipAllBits()

Toggle every bit to its opposite value.

Definition APInt.h:1453

static unsigned getNumWords(unsigned BitWidth)

Get the number of words.

Definition APInt.h:1504

bool needsCleanup() const

Returns whether this instance allocated memory.

Definition APInt.h:1933

unsigned countl_one() const

Count the number of leading one bits.

Definition APInt.h:1616

void clearLowBits(unsigned loBits)

Set bottom loBits bits to 0.

Definition APInt.h:1436

unsigned logBase2() const

Definition APInt.h:1762

static APInt getZeroWidth()

Return an APInt zero bits wide.

Definition APInt.h:204

double signedRoundToDouble() const

Converts this signed APInt to a double value.

Definition APInt.h:1716

bool isShiftedMask() const

Return true if this APInt value contains a non-empty sequence of ones with the remainder zero.

Definition APInt.h:511

float bitsToFloat() const

Converts APInt bits to a float.

Definition APInt.h:1737

static constexpr unsigned APINT_BITS_PER_WORD

Bits in a word.

Definition APInt.h:86

uint64_t getLimitedValue(uint64_t Limit=UINT64_MAX) const

If this value is smaller than the specified limit, return it, otherwise return the limit value.

Definition APInt.h:476

bool ule(uint64_t RHS) const

Unsigned less or equal comparison.

Definition APInt.h:1159

APInt ashr(unsigned ShiftAmt) const

Arithmetic right-shift function.

Definition APInt.h:828

void setAllBits()

Set every bit to 1.

Definition APInt.h:1320

uint64_t VAL

Used to store the <= 64 bits integer value.

Definition APInt.h:1939

bool ugt(uint64_t RHS) const

Unsigned greater than comparison.

Definition APInt.h:1191

bool sge(int64_t RHS) const

Signed greater or equal comparison.

Definition APInt.h:1246

bool getBoolValue() const

Convert APInt to a boolean value.

Definition APInt.h:472

static APInt doubleToBits(double V)

Converts a double to APInt bits.

Definition APInt.h:1745

bool isMask(unsigned numBits) const

Definition APInt.h:489

APInt & operator=(APInt &&that)

Move assignment operator.

Definition APInt.h:633

static WordType tcIncrement(WordType *dst, unsigned parts)

Increment a bignum in-place. Return the carry flag.

Definition APInt.h:1914

APInt & operator^=(const APInt &RHS)

Bitwise XOR assignment operator.

Definition APInt.h:734

bool isMaxSignedValue() const

Determine if this is the largest signed value.

Definition APInt.h:406

bool isNonNegative() const

Determine if this APInt Value is non-negative (>= 0)

Definition APInt.h:335

bool ule(const APInt &RHS) const

Unsigned less or equal comparison.

Definition APInt.h:1151

void setBits(unsigned loBit, unsigned hiBit)

Set the bits from loBit (inclusive) to hiBit (exclusive) to 1.

Definition APInt.h:1368

APInt shl(unsigned shiftAmt) const

Left-shift function.

Definition APInt.h:874

double bitsToDouble() const

Converts APInt bits to a double.

Definition APInt.h:1723

bool isSubsetOf(const APInt &RHS) const

This operation checks that all bits set in this APInt are also set in RHS.

Definition APInt.h:1258

bool isPowerOf2() const

Check if this APInt's value is a power of two greater than zero.

Definition APInt.h:441

unsigned getActiveWords() const

Compute the number of active words in the value of this APInt.

Definition APInt.h:1519

bool ne(const APInt &RHS) const

Inequality comparison.

Definition APInt.h:1104

static bool isSameValue(const APInt &I1, const APInt &I2)

Determine if two APInts have the same value, after zero-extending one of them (if needed!...

Definition APInt.h:554

static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)

Constructs an APInt value that has the bottom loBitsSet bits set.

Definition APInt.h:307

void clearBits(unsigned LoBit, unsigned HiBit)

Clear the bits from LoBit (inclusive) to HiBit (exclusive) to 0.

Definition APInt.h:1418

bool isSignBitSet() const

Determine if sign bit of this APInt is set.

Definition APInt.h:342

static LLVM_ABI WordType tcAddPart(WordType *, WordType, unsigned)

DST += RHS. Returns the carry flag.

const uint64_t * getRawData() const

This function returns a pointer to the internal storage of the APInt.

Definition APInt.h:570

bool slt(const APInt &RHS) const

Signed less than comparison.

Definition APInt.h:1131

static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)

Constructs an APInt value that has the top hiBitsSet bits set.

Definition APInt.h:297

static APInt getZero(unsigned numBits)

Get the '0' value for the specified bit-width.

Definition APInt.h:201

void setLowBits(unsigned loBits)

Set the bottom loBits bits.

Definition APInt.h:1389

bool isIntN(unsigned N) const

Check if this APInt has an N-bits unsigned integer value.

Definition APInt.h:433

unsigned countTrailingOnes() const

Definition APInt.h:1663

bool sge(const APInt &RHS) const

Signed greater or equal comparison.

Definition APInt.h:1238

std::optional< int64_t > trySExtValue() const

Get sign extended value if possible.

Definition APInt.h:1575

APInt & operator&=(uint64_t RHS)

Bitwise AND assignment operator.

Definition APInt.h:689

LLVM_ABI double roundToDouble(bool isSigned) const

Converts this APInt to a double value.

bool isOne() const

Determine if this is a value of 1.

Definition APInt.h:390

static APInt getBitsSetFrom(unsigned numBits, unsigned loBit)

Constructs an APInt value that has a contiguous range of bits set.

Definition APInt.h:287

static APInt getOneBitSet(unsigned numBits, unsigned BitNo)

Return an APInt with exactly one bit set in the result.

Definition APInt.h:240

void clearHighBits(unsigned hiBits)

Set top hiBits bits to 0.

Definition APInt.h:1443

int64_t getSExtValue() const

Get sign extended value.

Definition APInt.h:1563

void lshrInPlace(unsigned ShiftAmt)

Logical right-shift this APInt by ShiftAmt in place.

Definition APInt.h:859

APInt lshr(unsigned shiftAmt) const

Logical right-shift function.

Definition APInt.h:852

unsigned countr_one() const

Count the number of trailing one bits.

Definition APInt.h:1657

static APInt getBitsSetWithWrap(unsigned numBits, unsigned loBit, unsigned hiBit)

Wrap version of getBitsSet.

Definition APInt.h:271

bool isSignBitClear() const

Determine if sign bit of this APInt is clear.

Definition APInt.h:349

bool uge(const APInt &RHS) const

Unsigned greater or equal comparison.

Definition APInt.h:1222

void setBitVal(unsigned BitPosition, bool BitValue)

Set a given bit to a given value.

Definition APInt.h:1344

void clearSignBit()

Set the sign bit to 0.

Definition APInt.h:1450

bool isMaxValue() const

Determine if this is the largest unsigned value.

Definition APInt.h:400

void toStringSigned(SmallVectorImpl< char > &Str, unsigned Radix=10) const

Considers the APInt to be signed and converts it into a string in the radix given.

Definition APInt.h:1698

bool ult(uint64_t RHS) const

Unsigned less than comparison.

Definition APInt.h:1120

bool operator!=(uint64_t Val) const

Inequality operator.

Definition APInt.h:1096

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

This class provides support for dynamic arbitrary-precision arithmetic.

FoldingSetNodeID - This class is used to gather all the unique data bits of a node.

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

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

An opaque object representing a hash code.

This class implements an extremely fast bulk output stream that can only output to a stream.

LLVM_ABI std::error_code fromString(StringRef String, Metadata &HSAMetadata)

Converts String to HSAMetadata.

float RoundAPIntToFloat(const APInt &APIVal)

Converts the given APInt to a float value.

Definition APInt.h:2331

double RoundAPIntToDouble(const APInt &APIVal)

Converts the given APInt to a double value.

Definition APInt.h:2319

const APInt & smin(const APInt &A, const APInt &B)

Determine the smaller of two APInts considered to be signed.

Definition APInt.h:2249

const APInt & smax(const APInt &A, const APInt &B)

Determine the larger of two APInts considered to be signed.

Definition APInt.h:2254

const APInt & umin(const APInt &A, const APInt &B)

Determine the smaller of two APInts considered to be unsigned.

Definition APInt.h:2259

APInt RoundFloatToAPInt(float Float, unsigned width)

Converts a float value into a APInt.

Definition APInt.h:2350

LLVM_ABI APInt RoundDoubleToAPInt(double Double, unsigned width)

Converts the given double value into a APInt.

APInt abds(const APInt &A, const APInt &B)

Determine the absolute difference of two APInts considered to be signed.

Definition APInt.h:2269

double RoundSignedAPIntToDouble(const APInt &APIVal)

Converts the given APInt to a double value.

Definition APInt.h:2326

APInt abdu(const APInt &A, const APInt &B)

Determine the absolute difference of two APInts considered to be unsigned.

Definition APInt.h:2274

float RoundSignedAPIntToFloat(const APInt &APIVal)

Converts the given APInt to a float value.

Definition APInt.h:2338

const APInt & umax(const APInt &A, const APInt &B)

Determine the larger of two APInts considered to be unsigned.

Definition APInt.h:2264

@ C

The default llvm calling convention, compatible with C.

This is an optimization pass for GlobalISel generic memory operations.

void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)

constexpr T rotr(T V, int R)

APInt operator&(APInt a, const APInt &b)

Definition APInt.h:2124

APInt operator*(APInt a, uint64_t RHS)

Definition APInt.h:2236

int countr_one(T Value)

Count the number of ones from the least significant bit to the first zero bit.

bool operator!=(uint64_t V1, const APInt &V2)

Definition APInt.h:2114

LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt & operator+=(DynamicAPInt &A, int64_t B)

constexpr bool isUIntN(unsigned N, uint64_t x)

Checks if an unsigned integer fits into the given (dynamic) bit width.

LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt & operator-=(DynamicAPInt &A, int64_t B)

constexpr bool isPowerOf2_64(uint64_t Value)

Return true if the argument is a power of two > 0 (64 bit edition.)

APInt operator~(APInt v)

Unary bitwise complement operator.

Definition APInt.h:2119

constexpr int popcount(T Value) noexcept

Count the number of set bits in a value.

int countr_zero(T Val)

Count number of 0's from the least significant bit to the most stopping at the first 1.

constexpr bool isShiftedMask_64(uint64_t Value)

Return true if the argument contains a non-empty sequence of ones with the remainder zero (64 bit ver...

LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt & operator*=(DynamicAPInt &A, int64_t B)

int countl_zero(T Val)

Count number of 0's from the most significant bit to the least stopping at the first 1.

APInt operator^(APInt a, const APInt &b)

Definition APInt.h:2164

constexpr bool isMask_64(uint64_t Value)

Return true if the argument is a non-empty sequence of ones starting at the least significant bit wit...

FunctionAddr VTableAddr Count

int countl_one(T Value)

Count the number of ones from the most significant bit to the first zero bit.

LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key

To bit_cast(const From &from) noexcept

APInt operator-(APInt)

Definition APInt.h:2189

constexpr bool isIntN(unsigned N, int64_t x)

Checks if an signed integer fits into the given (dynamic) bit width.

constexpr T reverseBits(T Val)

Reverse the bits in Val.

constexpr int64_t SignExtend64(uint64_t x)

Sign-extend the number in the bottom B bits of X to a 64-bit integer.

APInt operator+(APInt a, const APInt &b)

Definition APInt.h:2194

APInt operator|(APInt a, const APInt &b)

Definition APInt.h:2144

constexpr T rotl(T V, int R)

@ Keep

No function return thunk.

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

static APInt getEmptyKey()

Definition APInt.h:2482

static APInt getTombstoneKey()

Definition APInt.h:2488

static bool isEqual(const APInt &LHS, const APInt &RHS)

Definition APInt.h:2496

static LLVM_ABI unsigned getHashValue(const APInt &Key)

An information struct used to provide DenseMap with the various necessary components for a given valu...