clang: include/clang/Analysis/Analyses/ThreadSafetyTIL.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46#ifndef LLVM_CLANG_ANALYSIS_ANALYSES_THREADSAFETYTIL_H

47#define LLVM_CLANG_ANALYSIS_ANALYSES_THREADSAFETYTIL_H

48

52#include "llvm/ADT/ArrayRef.h"

53#include "llvm/ADT/StringRef.h"

54#include "llvm/Support/Casting.h"

55#include "llvm/Support/Compiler.h"

56#include "llvm/Support/raw_ostream.h"

57#include

58#include

59#include

60#include

61#include

62#include

63#include

64#include

65

67

71

74

76

77

79#define TIL_OPCODE_DEF(X) COP_##X,

80#include "ThreadSafetyOps.def"

81#undef TIL_OPCODE_DEF

82};

83

84

90

91

111

112

115

116

118

119

121

122

124

125

127

128

130};

131

140

141

143

144

146

147

148

149

150

151

152

163

173

176

177 inline static SizeType getSizeType(unsigned nbytes);

178

179 template

181

185

186

188};

189

191 switch (nbytes) {

192 case 1: return ST_8;

193 case 2: return ST_16;

194 case 4: return ST_32;

195 case 8: return ST_64;

196 case 16: return ST_128;

197 default: return ST_0;

198 }

199}

200

201template<>

205

206template<>

210

211template<>

215

216template<>

220

221template<>

225

226template<>

230

231template<>

235

236template<>

240

241template<>

245

246template<>

250

251template<>

255

256template<>

260

261template<>

265

266template<>

270

271template<>

275

276

278public:

280

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

298 return ::operator new(S, R);

299 }

300

301

302 void *operator new(size_t) = delete;

303

304

305

306

307 void operator delete(void *) = delete;

308

309

310

312

313

314

316

317

319

320protected:

324

330};

331

332

334

337 return Op == COP_Variable || Op == COP_Literal || Op == COP_LiteralPtr;

338}

339

340}

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

357public:

359

361

362

364

365

367 };

368

370 : SExpr(COP_Variable), Name(s), Definition(D) {

372 }

373

375 : SExpr(COP_Variable), Name(Cvd ? Cvd->getName() : "_x"),

376 Definition(D), Cvdecl(Cvd) {

378 }

379

381 : SExpr(Vd), Name(Vd.Name), Definition(D), Cvdecl(Vd.Cvdecl) {

383 }

384

386

387

389

390

391 StringRef name() const { return Name; }

392

393

395

396

397

398

401

402 void setName(StringRef S) { Name = S; }

406

407 template

408 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

409

410 return Vs.reduceVariableRef(this);

411 }

412

413 template

415 return Cmp.compareVariableRefs(this, E);

416 }

417

418private:

423

424

425 StringRef Name;

426

427

428 SExpr *Definition;

429

430

431 const ValueDecl *Cvdecl = nullptr;

432};

433

434

435

437public:

443

446

448

449

451

452

454

455

457 switch (Status) {

459 return force();

461 return nullptr;

463 return Result;

464 }

465 }

466

467 template

468 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

469 assert(Result && "Cannot traverse Future that has not been forced.");

470 return Vs.traverse(Result, Ctx);

471 }

472

473 template

475 if (!Result || !E->Result)

476 return Cmp.comparePointers(this, E);

477 return Cmp.compare(Result, E->Result);

478 }

479

480private:

482

485};

486

487

489public:

492

493

494

496

498

499 template

500 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

501 return Vs.reduceUndefined(*this);

502 }

503

504 template

506 return Cmp.trueResult();

507 }

508

509private:

510 const Stmt *Cstmt;

511};

512

513

515public:

518

520

521 template typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

522 return Vs.reduceWildcard(*this);

523 }

524

525 template

527 return Cmp.trueResult();

528 }

529};

530

531template class LiteralT;

532

533

535public:

537 : SExpr(COP_Literal), ValType(ValueType::getValueType()), Cexpr(C) {}

540

542

543

545

547

549 return *static_cast<const LiteralT*>(this);

550 }

554

555 template typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx);

556

557 template

559

560 return Cmp.trueResult();

561 }

562

563private:

565 const Expr *Cexpr = nullptr;

566};

567

568

569template

571public:

574

575

576

578

581

582private:

583 T Val;

584};

585

586template

588 if (Cexpr)

589 return Vs.reduceLiteral(*this);

590

591 switch (ValType.Base) {

593 break;

595 return Vs.reduceLiteralT(as());

597 switch (ValType.Size) {

599 if (ValType.Signed)

600 return Vs.reduceLiteralT(as<int8_t>());

601 else

604 if (ValType.Signed)

606 else

609 if (ValType.Signed)

611 else

614 if (ValType.Signed)

616 else

618 default:

619 break;

620 }

621 }

623 switch (ValType.Size) {

625 return Vs.reduceLiteralT(as());

627 return Vs.reduceLiteralT(as());

628 default:

629 break;

630 }

631 }

635 return Vs.reduceLiteralT(as<void*>());

637 break;

638 }

639 return Vs.reduceLiteral(*this);

640}

641

642

643

645public:

648

650

651

654

655 template

656 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

657 return Vs.reduceLiteralPtr(*this);

658 }

659

660 template

662 if (!Cvdecl || !E->Cvdecl)

663 return Cmp.comparePointers(this, E);

664 return Cmp.comparePointers(Cvdecl, E->Cvdecl);

665 }

666

667private:

669};

670

671

672

673

675public:

677 : SExpr(COP_Function), VarDecl(Vd), Body(Bd) {

679 }

680

682 : SExpr(F), VarDecl(Vd), Body(Bd) {

684 }

685

687

690

693

694 template

695 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

696

697 auto E0 = Vs.traverse(VarDecl->Definition, Vs.typeCtx(Ctx));

698

699 Variable *Nvd = Vs.enterScope(*VarDecl, E0);

700 auto E1 = Vs.traverse(Body, Vs.declCtx(Ctx));

701 Vs.exitScope(*VarDecl);

702 return Vs.reduceFunction(*this, Nvd, E1);

703 }

704

705 template

707 typename C::CType Ct =

708 Cmp.compare(VarDecl->definition(), E->VarDecl->definition());

709 if (Cmp.notTrue(Ct))

710 return Ct;

712 Ct = Cmp.compare(body(), E->body());

713 Cmp.leaveScope();

714 return Ct;

715 }

716

717private:

720};

721

722

723

724

726public:

728 : SExpr(COP_SFunction), VarDecl(Vd), Body(B) {

729 assert(Vd->Definition == nullptr);

731 Vd->Definition = this;

732 }

733

735 : SExpr(F), VarDecl(Vd), Body(B) {

736 assert(Vd->Definition == nullptr);

738 Vd->Definition = this;

739 }

740

742

745

748

749 template

750 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

751

752

753

754 Variable *Nvd = Vs.enterScope(*VarDecl, nullptr);

755 auto E1 = Vs.traverse(Body, Vs.declCtx(Ctx));

756 Vs.exitScope(*VarDecl);

757

758 return Vs.reduceSFunction(*this, Nvd, E1);

759 }

760

761 template

764 typename C::CType Ct = Cmp.compare(body(), E->body());

765 Cmp.leaveScope();

766 return Ct;

767 }

768

769private:

772};

773

774

776public:

779 : SExpr(C), ReturnType(T), Body(B) {}

780

782

785

788

789 template

790 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

791 auto Nt = Vs.traverse(ReturnType, Vs.typeCtx(Ctx));

792 auto Nb = Vs.traverse(Body, Vs.lazyCtx(Ctx));

793 return Vs.reduceCode(*this, Nt, Nb);

794 }

795

796 template

799 if (Cmp.notTrue(Ct))

800 return Ct;

801 return Cmp.compare(body(), E->body());

802 }

803

804private:

805 SExpr* ReturnType;

807};

808

809

811public:

814 : SExpr(C), Range(R), Body(B) {}

815

817

820

823

824 template

825 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

826 auto Nr = Vs.traverse(Range, Vs.typeCtx(Ctx));

827 auto Nb = Vs.traverse(Body, Vs.lazyCtx(Ctx));

828 return Vs.reduceField(*this, Nr, Nb);

829 }

830

831 template

833 typename C::CType Ct = Cmp.compare(range(), E->range());

834 if (Cmp.notTrue(Ct))

835 return Ct;

836 return Cmp.compare(body(), E->body());

837 }

838

839private:

842};

843

844

845

846

847

848

850public:

853 : SExpr(A), Fun(F), Arg(Ar) {}

854

856

859

862

863 template

864 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

865 auto Nf = Vs.traverse(Fun, Vs.subExprCtx(Ctx));

866 auto Na = Vs.traverse(Arg, Vs.subExprCtx(Ctx));

867 return Vs.reduceApply(*this, Nf, Na);

868 }

869

870 template

872 typename C::CType Ct = Cmp.compare(fun(), E->fun());

873 if (Cmp.notTrue(Ct))

874 return Ct;

875 return Cmp.compare(arg(), E->arg());

876 }

877

878private:

881};

882

883

885public:

888 : SExpr(A), Sfun(Sf), Arg(Ar) {}

889

891

894

895 SExpr *arg() { return Arg ? Arg : Sfun; }

896 const SExpr *arg() const { return Arg ? Arg : Sfun; }

897

899

900 template

901 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

902 auto Nf = Vs.traverse(Sfun, Vs.subExprCtx(Ctx));

903 typename V::R_SExpr Na = Arg ? Vs.traverse(Arg, Vs.subExprCtx(Ctx))

904 : nullptr;

905 return Vs.reduceSApply(*this, Nf, Na);

906 }

907

908 template

910 typename C::CType Ct = Cmp.compare(sfun(), E->sfun());

911 if (Cmp.notTrue(Ct) || (arg() && !E->arg()))

912 return Ct;

913 return Cmp.compare(arg(), E->arg());

914 }

915

916private:

919};

920

921

923public:

925 : SExpr(COP_Project), Rec(R), Cvdecl(Cvd) {

926 assert(Cvd && "ValueDecl must not be null");

927 }

928

930

933

935

937

939 if (b) Flags |= 0x01;

940 else Flags &= 0xFFFE;

941 }

942

944 if (Cvdecl->getDeclName().isIdentifier())

945 return Cvdecl->getName();

946 if (!SlotName) {

947 SlotName = "";

948 llvm::raw_string_ostream OS(*SlotName);

949 Cvdecl->printName(OS);

950 }

951 return *SlotName;

952 }

953

954 template

955 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

956 auto Nr = Vs.traverse(Rec, Vs.subExprCtx(Ctx));

957 return Vs.reduceProject(*this, Nr);

958 }

959

960 template

962 typename C::CType Ct = Cmp.compare(record(), E->record());

963 if (Cmp.notTrue(Ct))

964 return Ct;

965 return Cmp.comparePointers(Cvdecl, E->Cvdecl);

966 }

967

968private:

970 mutable std::optionalstd::string SlotName;

972};

973

974

976public:

978 : SExpr(COP_Call), Target(T), Cexpr(Ce) {}

980

982

985

987

988 template

989 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

990 auto Nt = Vs.traverse(Target, Vs.subExprCtx(Ctx));

991 return Vs.reduceCall(*this, Nt);

992 }

993

994 template

998

999private:

1002};

1003

1004

1006public:

1011

1014

1016

1018

1021

1022 template

1023 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

1024 auto Nd = Vs.traverse(Dtype, Vs.declCtx(Ctx));

1025 return Vs.reduceAlloc(*this, Nd);

1026 }

1027

1028 template

1030 typename C::CType Ct = Cmp.compareIntegers(kind(), E->kind());

1031 if (Cmp.notTrue(Ct))

1032 return Ct;

1034 }

1035

1036private:

1038};

1039

1040

1042public:

1045

1047

1050

1051 template

1052 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

1053 auto Np = Vs.traverse(Ptr, Vs.subExprCtx(Ctx));

1054 return Vs.reduceLoad(*this, Np);

1055 }

1056

1057 template

1061

1062private:

1064};

1065

1066

1067

1069public:

1072

1074

1077

1080

1081 template

1082 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

1083 auto Np = Vs.traverse(Dest, Vs.subExprCtx(Ctx));

1084 auto Nv = Vs.traverse(Source, Vs.subExprCtx(Ctx));

1085 return Vs.reduceStore(*this, Np, Nv);

1086 }

1087

1088 template

1091 if (Cmp.notTrue(Ct))

1092 return Ct;

1094 }

1095

1096private:

1099};

1100

1101

1102

1104public:

1107 : SExpr(E), Array(A), Index(N) {}

1108

1110

1113

1116

1117 template

1118 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

1119 auto Na = Vs.traverse(Array, Vs.subExprCtx(Ctx));

1120 auto Ni = Vs.traverse(Index, Vs.subExprCtx(Ctx));

1121 return Vs.reduceArrayIndex(*this, Na, Ni);

1122 }

1123

1124 template

1126 typename C::CType Ct = Cmp.compare(array(), E->array());

1127 if (Cmp.notTrue(Ct))

1128 return Ct;

1129 return Cmp.compare(index(), E->index());

1130 }

1131

1132private:

1135};

1136

1137

1138

1139

1141public:

1144 : SExpr(E), Array(A), Index(N) {}

1145

1147

1150

1153

1154 template

1155 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

1156 auto Na = Vs.traverse(Array, Vs.subExprCtx(Ctx));

1157 auto Ni = Vs.traverse(Index, Vs.subExprCtx(Ctx));

1158 return Vs.reduceArrayAdd(*this, Na, Ni);

1159 }

1160

1161 template

1163 typename C::CType Ct = Cmp.compare(array(), E->array());

1164 if (Cmp.notTrue(Ct))

1165 return Ct;

1166 return Cmp.compare(index(), E->index());

1167 }

1168

1169private:

1172};

1173

1174

1175

1177public:

1181

1183

1185

1189

1192

1193 template

1194 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

1195 auto Ne = Vs.traverse(Expr0, Vs.subExprCtx(Ctx));

1196 return Vs.reduceUnaryOp(*this, Ne);

1197 }

1198

1199 template

1201 typename C::CType Ct =

1203 if (Cmp.notTrue(Ct))

1204 return Ct;

1205 return Cmp.compare(expr(), E->expr());

1206 }

1207

1208private:

1210};

1211

1212

1213

1215public:

1217 : SExpr(COP_BinaryOp), Expr0(E0), Expr1(E1) {

1219 }

1220

1222 : SExpr(B), Expr0(E0), Expr1(E1) {

1224 }

1225

1227

1231

1234

1237

1238 template

1239 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

1240 auto Ne0 = Vs.traverse(Expr0, Vs.subExprCtx(Ctx));

1241 auto Ne1 = Vs.traverse(Expr1, Vs.subExprCtx(Ctx));

1242 return Vs.reduceBinaryOp(*this, Ne0, Ne1);

1243 }

1244

1245 template

1247 typename C::CType Ct =

1249 if (Cmp.notTrue(Ct))

1250 return Ct;

1251 Ct = Cmp.compare(expr0(), E->expr0());

1252 if (Cmp.notTrue(Ct))

1253 return Ct;

1254 return Cmp.compare(expr1(), E->expr1());

1255 }

1256

1257private:

1260};

1261

1262

1263

1264

1266public:

1269

1271

1275

1278

1279 template

1280 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

1281 auto Ne = Vs.traverse(Expr0, Vs.subExprCtx(Ctx));

1282 return Vs.reduceCast(*this, Ne);

1283 }

1284

1285 template

1287 typename C::CType Ct =

1289 if (Cmp.notTrue(Ct))

1290 return Ct;

1291 return Cmp.compare(expr(), E->expr());

1292 }

1293

1294private:

1296};

1297

1298class SCFG;

1299

1300

1301

1302

1304public:

1306

1307

1308

1309

1315

1319

1321

1324

1327

1328

1330

1331

1333

1334 template

1335 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

1336 typename V::template Container<typename V::R_SExpr>

1337 Nvs(Vs, Values.size());

1338

1339 for (const auto *Val : Values)

1340 Nvs.push_back( Vs.traverse(Val, Vs.subExprCtx(Ctx)) );

1341 return Vs.reducePhi(*this, Nvs);

1342 }

1343

1344 template

1346

1347 return Cmp.comparePointers(this, E);

1348 }

1349

1350private:

1352 const ValueDecl* Cvdecl = nullptr;

1353};

1354

1355

1357protected:

1360

1361public:

1363 return E->opcode() >= COP_Goto && E->opcode() <= COP_Return;

1364 }

1365

1366

1368};

1369

1370

1371

1372

1373

1374

1376public:

1378 : Terminator(COP_Goto), TargetBlock(B), Index(I) {}

1380 : Terminator(COP_Goto), TargetBlock(B), Index(I) {}

1381

1383

1386

1387

1388 unsigned index() const { return Index; }

1389

1390

1392

1393 template

1394 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

1395 BasicBlock *Ntb = Vs.reduceBasicBlockRef(TargetBlock);

1396 return Vs.reduceGoto(*this, Ntb);

1397 }

1398

1399 template

1401

1402 return Cmp.comparePointers(this, E);

1403 }

1404

1405private:

1407 unsigned Index;

1408};

1409

1410

1411

1412

1414public:

1416 : Terminator(COP_Branch), Condition(C) {

1417 Branches[0] = T;

1418 Branches[1] = E;

1419 }

1420

1423 Branches[0] = T;

1424 Branches[1] = E;

1425 }

1426

1428

1431

1434

1437

1438

1440

1441 template

1442 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

1443 auto Nc = Vs.traverse(Condition, Vs.subExprCtx(Ctx));

1444 BasicBlock *Ntb = Vs.reduceBasicBlockRef(Branches[0]);

1445 BasicBlock *Nte = Vs.reduceBasicBlockRef(Branches[1]);

1446 return Vs.reduceBranch(*this, Nc, Ntb, Nte);

1447 }

1448

1449 template

1451

1452 return Cmp.comparePointers(this, E);

1453 }

1454

1455private:

1458};

1459

1460

1461

1463public:

1466

1468

1469

1471

1474

1475 template

1476 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

1477 auto Ne = Vs.traverse(Retval, Vs.subExprCtx(Ctx));

1478 return Vs.reduceReturn(*this, Ne);

1479 }

1480

1481 template

1483 return Cmp.compare(Retval, E->Retval);

1484 }

1485

1486private:

1488};

1489

1492 case COP_Goto: return cast(this)->successors();

1493 case COP_Branch: return cast(this)->successors();

1494 case COP_Return: return cast(this)->successors();

1495 default:

1496 return {};

1497 }

1498}

1499

1500

1501

1502

1503

1504

1506public:

1509

1510

1511

1512

1513

1516

1517

1519

1520

1522

1524

1529

1534 };

1535

1537 : SExpr(COP_BasicBlock), Arena(A), BlockID(0), Visited(false) {}

1540 : SExpr(COP_BasicBlock), Arena(A), BlockID(0), Visited(false),

1541 Args(std::move(As)), Instrs(std::move(Is)), TermInstr(T) {}

1542

1544

1545

1547

1548

1551

1552 const SCFG* cfg() const { return CFGPtr; }

1554

1557

1560

1563

1564

1565

1566

1569

1572

1575

1577

1579 return DominatorNode.isParentOfOrEqual(Other.DominatorNode);

1580 }

1581

1583 return PostDominatorNode.isParentOfOrEqual(Other.PostDominatorNode);

1584 }

1585

1586

1588 Args.reserveCheck(1, Arena);

1589 Args.push_back(V);

1590 }

1591

1592

1594 Instrs.reserveCheck(1, Arena);

1595 Instrs.push_back(V);

1596 }

1597

1598

1599

1601

1602

1604

1605

1607

1608

1610

1611

1613 auto I = llvm::find(Predecessors, BB);

1614 return std::distance(Predecessors.cbegin(), I);

1615 }

1616

1617 template

1618 typename V::R_BasicBlock traverse(V &Vs, typename V::R_Ctx Ctx) {

1619 typename V::template Container<SExpr*> Nas(Vs, Args.size());

1620 typename V::template Container<SExpr*> Nis(Vs, Instrs.size());

1621

1622

1623 Vs.enterBasicBlock(*this);

1624

1625 for (const auto *E : Args) {

1626 auto Ne = Vs.traverse(E, Vs.subExprCtx(Ctx));

1627 Nas.push_back(Ne);

1628 }

1629 for (const auto *E : Instrs) {

1630 auto Ne = Vs.traverse(E, Vs.subExprCtx(Ctx));

1631 Nis.push_back(Ne);

1632 }

1633 auto Nt = Vs.traverse(TermInstr, Ctx);

1634

1635

1636 Vs.exitBasicBlock(*this);

1637

1638 return Vs.reduceBasicBlock(*this, Nas, Nis, Nt);

1639 }

1640

1641 template

1643

1644 return Cmp.comparePointers(this, E);

1645 }

1646

1647private:

1649

1650

1651 unsigned renumberInstrs(unsigned id);

1652

1655 void computeDominator();

1656 void computePostDominator();

1657

1658

1660

1661

1662 SCFG *CFGPtr = nullptr;

1663

1664

1665 unsigned BlockID : 31;

1666

1667

1668 LLVM_PREFERRED_TYPE(bool)

1669 unsigned Visited : 1;

1670

1671

1673

1674

1676

1677

1679

1680

1682

1683

1685

1686

1688};

1689

1690

1691

1692

1694public:

1698

1700 : SExpr(COP_SCFG), Arena(A), Blocks(A, Nblocks) {

1703 auto *V = new (A) Phi();

1704 Exit->addArgument(V);

1705 Exit->setTerminator(new (A) Return(V));

1706 add(Entry);

1707 add(Exit);

1708 }

1709

1711 : SExpr(COP_SCFG), Arena(Cfg.Arena), Blocks(std::move(Ba)) {

1712

1713 }

1714

1716

1717

1718 bool valid() const { return Entry && Exit && Blocks.size() > 0; }

1719

1720

1721

1722

1723 bool normal() const { return Normal; }

1724

1727

1730

1733

1738

1739

1740

1741 size_t numBlocks() const { return Blocks.size(); }

1742

1743

1744

1745

1747

1749 assert(BB->CFGPtr == nullptr);

1750 BB->CFGPtr = this;

1751 Blocks.reserveCheck(1, Arena);

1752 Blocks.push_back(BB);

1753 }

1754

1757

1759

1760 template

1761 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

1762 Vs.enterCFG(*this);

1763 typename V::template Container<BasicBlock *> Bbs(Vs, Blocks.size());

1764

1765 for (const auto *B : Blocks) {

1766 Bbs.push_back( B->traverse(Vs, Vs.subExprCtx(Ctx)) );

1767 }

1768 Vs.exitCFG(*this);

1769 return Vs.reduceSCFG(*this, Bbs);

1770 }

1771

1772 template

1774

1775 return Cmp.comparePointers(this, E);

1776 }

1777

1778private:

1779

1780 void renumberInstrs();

1781

1786 unsigned NumInstructions = 0;

1787 bool Normal = false;

1788};

1789

1790

1791

1793public:

1796

1798

1799 StringRef name() const { return Name; }

1800

1801 template

1802 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

1803 return Vs.reduceIdentifier(*this);

1804 }

1805

1806 template

1808 return Cmp.compareStrings(name(), E->name());

1809 }

1810

1811private:

1812 StringRef Name;

1813};

1814

1815

1816

1818public:

1820 : SExpr(COP_IfThenElse), Condition(C), ThenExpr(T), ElseExpr(E) {}

1822 : SExpr(I), Condition(C), ThenExpr(T), ElseExpr(E) {}

1823

1825

1828

1831

1834

1835 template

1836 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

1837 auto Nc = Vs.traverse(Condition, Vs.subExprCtx(Ctx));

1838 auto Nt = Vs.traverse(ThenExpr, Vs.subExprCtx(Ctx));

1839 auto Ne = Vs.traverse(ElseExpr, Vs.subExprCtx(Ctx));

1840 return Vs.reduceIfThenElse(*this, Nc, Nt, Ne);

1841 }

1842

1843 template

1846 if (Cmp.notTrue(Ct))

1847 return Ct;

1849 if (Cmp.notTrue(Ct))

1850 return Ct;

1852 }

1853

1854private:

1856 SExpr* ThenExpr;

1857 SExpr* ElseExpr;

1858};

1859

1860

1861

1863public:

1867

1871

1873

1876

1879

1880 template

1881 typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {

1882

1883 auto E0 = Vs.traverse(VarDecl->Definition, Vs.subExprCtx(Ctx));

1884

1885 Variable *Nvd = Vs.enterScope(*VarDecl, E0);

1886 auto E1 = Vs.traverse(Body, Ctx);

1887 Vs.exitScope(*VarDecl);

1888 return Vs.reduceLet(*this, Nvd, E1);

1889 }

1890

1891 template

1893 typename C::CType Ct =

1894 Cmp.compare(VarDecl->definition(), E->VarDecl->definition());

1895 if (Cmp.notTrue(Ct))

1896 return Ct;

1898 Ct = Cmp.compare(body(), E->body());

1899 Cmp.leaveScope();

1900 return Ct;

1901 }

1902

1903private:

1906};

1907

1911

1912}

1913}

1914

1915}

1916

1917#endif

Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.

__device__ __2f16 float __ockl_bool s

__SIZE_TYPE__ size_t

The unsigned integer type of the result of the sizeof operator.

CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).

This represents one expression.

Stmt - This represents one statement.

Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...

Represents a variable declaration or definition.

AllocKind

Definition ThreadSafetyTIL.h:1007

@ AK_Stack

Definition ThreadSafetyTIL.h:1008

@ AK_Heap

Definition ThreadSafetyTIL.h:1009

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:1023

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1015

AllocKind kind() const

Definition ThreadSafetyTIL.h:1017

Alloc(const Alloc &A, SExpr *Dt)

Definition ThreadSafetyTIL.h:1013

C::CType compare(const Alloc *E, C &Cmp) const

Definition ThreadSafetyTIL.h:1029

Alloc(SExpr *D, AllocKind K)

Definition ThreadSafetyTIL.h:1012

SExpr * dataType()

Definition ThreadSafetyTIL.h:1019

const SExpr * dataType() const

Definition ThreadSafetyTIL.h:1020

const SExpr * arg() const

Definition ThreadSafetyTIL.h:861

SExpr * arg()

Definition ThreadSafetyTIL.h:860

Apply(const Apply &A, SExpr *F, SExpr *Ar)

Definition ThreadSafetyTIL.h:852

Apply(SExpr *F, SExpr *A)

Definition ThreadSafetyTIL.h:851

SExpr * fun()

Definition ThreadSafetyTIL.h:857

const SExpr * fun() const

Definition ThreadSafetyTIL.h:858

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:864

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:855

C::CType compare(const Apply *E, C &Cmp) const

Definition ThreadSafetyTIL.h:871

const SExpr * array() const

Definition ThreadSafetyTIL.h:1149

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:1155

SExpr * index()

Definition ThreadSafetyTIL.h:1151

ArrayAdd(SExpr *A, SExpr *N)

Definition ThreadSafetyTIL.h:1142

ArrayAdd(const ArrayAdd &E, SExpr *A, SExpr *N)

Definition ThreadSafetyTIL.h:1143

C::CType compare(const ArrayAdd *E, C &Cmp) const

Definition ThreadSafetyTIL.h:1162

const SExpr * index() const

Definition ThreadSafetyTIL.h:1152

SExpr * array()

Definition ThreadSafetyTIL.h:1148

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1146

ArrayIndex(const ArrayIndex &E, SExpr *A, SExpr *N)

Definition ThreadSafetyTIL.h:1106

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1109

ArrayIndex(SExpr *A, SExpr *N)

Definition ThreadSafetyTIL.h:1105

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:1118

SExpr * array()

Definition ThreadSafetyTIL.h:1111

C::CType compare(const ArrayIndex *E, C &Cmp) const

Definition ThreadSafetyTIL.h:1125

const SExpr * array() const

Definition ThreadSafetyTIL.h:1112

const SExpr * index() const

Definition ThreadSafetyTIL.h:1115

SExpr * index()

Definition ThreadSafetyTIL.h:1114

A basic block is part of an SCFG.

Definition ThreadSafetyTIL.h:1505

unsigned addPredecessor(BasicBlock *Pred)

BasicBlock(BasicBlock &B, MemRegionRef A, InstrArray &&As, InstrArray &&Is, Terminator *T)

Definition ThreadSafetyTIL.h:1538

int blockID() const

Returns the block ID. Every block has a unique ID in the CFG.

Definition ThreadSafetyTIL.h:1546

friend class SCFG

Definition ThreadSafetyTIL.h:1648

const InstrArray & arguments() const

Definition ThreadSafetyTIL.h:1558

const InstrArray & instructions() const

Definition ThreadSafetyTIL.h:1562

bool Dominates(const BasicBlock &Other)

Definition ThreadSafetyTIL.h:1578

void reserveInstructions(unsigned Nins)

Definition ThreadSafetyTIL.h:1606

SimpleArray< BasicBlock * > BlockArray

Definition ThreadSafetyTIL.h:1508

const Terminator * terminator() const

Definition ThreadSafetyTIL.h:1573

const BlockArray & predecessors() const

Definition ThreadSafetyTIL.h:1568

size_t numSuccessors() const

Definition ThreadSafetyTIL.h:1550

InstrArray & arguments()

Definition ThreadSafetyTIL.h:1559

ArrayRef< BasicBlock * > successors() const

Definition ThreadSafetyTIL.h:1571

void reserveArguments(unsigned Nargs)

Definition ThreadSafetyTIL.h:1603

C::CType compare(const BasicBlock *E, C &Cmp) const

Definition ThreadSafetyTIL.h:1642

ArrayRef< BasicBlock * > successors()

Definition ThreadSafetyTIL.h:1570

BasicBlock * parent()

Definition ThreadSafetyTIL.h:1556

void addArgument(Phi *V)

Add a new argument.

Definition ThreadSafetyTIL.h:1587

Terminator * terminator()

Definition ThreadSafetyTIL.h:1574

size_t numPredecessors() const

Returns the number of predecessors.

Definition ThreadSafetyTIL.h:1549

bool PostDominates(const BasicBlock &Other)

Definition ThreadSafetyTIL.h:1582

BasicBlock(MemRegionRef A)

Definition ThreadSafetyTIL.h:1536

V::R_BasicBlock traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:1618

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1543

InstrArray & instructions()

Definition ThreadSafetyTIL.h:1561

void reservePredecessors(unsigned NumPreds)

SCFG * cfg()

Definition ThreadSafetyTIL.h:1553

const SCFG * cfg() const

Definition ThreadSafetyTIL.h:1552

unsigned findPredecessorIndex(const BasicBlock *BB) const

Return the index of BB, or Predecessors.size if BB is not a predecessor.

Definition ThreadSafetyTIL.h:1612

void setTerminator(Terminator *E)

Definition ThreadSafetyTIL.h:1576

BlockArray & predecessors()

Returns a list of predecessors.

Definition ThreadSafetyTIL.h:1567

SimpleArray< SExpr * > InstrArray

Definition ThreadSafetyTIL.h:1507

const BasicBlock * parent() const

Definition ThreadSafetyTIL.h:1555

void addInstruction(SExpr *V)

Add a new instruction.

Definition ThreadSafetyTIL.h:1593

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:1239

BinaryOp(TIL_BinaryOpcode Op, SExpr *E0, SExpr *E1)

Definition ThreadSafetyTIL.h:1216

const SExpr * expr0() const

Definition ThreadSafetyTIL.h:1233

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1226

BinaryOp(const BinaryOp &B, SExpr *E0, SExpr *E1)

Definition ThreadSafetyTIL.h:1221

SExpr * expr0()

Definition ThreadSafetyTIL.h:1232

SExpr * expr1()

Definition ThreadSafetyTIL.h:1235

TIL_BinaryOpcode binaryOpcode() const

Definition ThreadSafetyTIL.h:1228

C::CType compare(const BinaryOp *E, C &Cmp) const

Definition ThreadSafetyTIL.h:1246

const SExpr * expr1() const

Definition ThreadSafetyTIL.h:1236

const SExpr * condition() const

Definition ThreadSafetyTIL.h:1429

Branch(SExpr *C, BasicBlock *T, BasicBlock *E)

Definition ThreadSafetyTIL.h:1415

BasicBlock * elseBlock()

Definition ThreadSafetyTIL.h:1436

const BasicBlock * elseBlock() const

Definition ThreadSafetyTIL.h:1435

C::CType compare(const Branch *E, C &Cmp) const

Definition ThreadSafetyTIL.h:1450

BasicBlock * thenBlock()

Definition ThreadSafetyTIL.h:1433

Branch(const Branch &Br, SExpr *C, BasicBlock *T, BasicBlock *E)

Definition ThreadSafetyTIL.h:1421

SExpr * condition()

Definition ThreadSafetyTIL.h:1430

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1427

ArrayRef< BasicBlock * > successors() const

Return the list of basic blocks that this terminator can branch to.

Definition ThreadSafetyTIL.h:1439

const BasicBlock * thenBlock() const

Definition ThreadSafetyTIL.h:1432

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:1442

const SExpr * target() const

Definition ThreadSafetyTIL.h:984

SExpr * target()

Definition ThreadSafetyTIL.h:983

Call(const Call &C, SExpr *T)

Definition ThreadSafetyTIL.h:979

Call(SExpr *T, const CallExpr *Ce=nullptr)

Definition ThreadSafetyTIL.h:977

C::CType compare(const Call *E, C &Cmp) const

Definition ThreadSafetyTIL.h:995

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:981

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:989

const CallExpr * clangCallExpr() const

Definition ThreadSafetyTIL.h:986

C::CType compare(const Cast *E, C &Cmp) const

Definition ThreadSafetyTIL.h:1286

const SExpr * expr() const

Definition ThreadSafetyTIL.h:1277

Cast(TIL_CastOpcode Op, SExpr *E)

Definition ThreadSafetyTIL.h:1267

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1270

SExpr * expr()

Definition ThreadSafetyTIL.h:1276

Cast(const Cast &C, SExpr *E)

Definition ThreadSafetyTIL.h:1268

TIL_CastOpcode castOpcode() const

Definition ThreadSafetyTIL.h:1272

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:1280

Code(SExpr *T, SExpr *B)

Definition ThreadSafetyTIL.h:777

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:790

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:781

const SExpr * returnType() const

Definition ThreadSafetyTIL.h:784

C::CType compare(const Code *E, C &Cmp) const

Definition ThreadSafetyTIL.h:797

SExpr * body()

Definition ThreadSafetyTIL.h:786

const SExpr * body() const

Definition ThreadSafetyTIL.h:787

SExpr * returnType()

Definition ThreadSafetyTIL.h:783

Code(const Code &C, SExpr *T, SExpr *B)

Definition ThreadSafetyTIL.h:778

const SExpr * range() const

Definition ThreadSafetyTIL.h:819

SExpr * body()

Definition ThreadSafetyTIL.h:821

const SExpr * body() const

Definition ThreadSafetyTIL.h:822

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:816

SExpr * range()

Definition ThreadSafetyTIL.h:818

Field(SExpr *R, SExpr *B)

Definition ThreadSafetyTIL.h:812

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:825

C::CType compare(const Field *E, C &Cmp) const

Definition ThreadSafetyTIL.h:832

Field(const Field &C, SExpr *R, SExpr *B)

Definition ThreadSafetyTIL.h:813

const SExpr * body() const

Definition ThreadSafetyTIL.h:692

Function(const Function &F, Variable *Vd, SExpr *Bd)

Definition ThreadSafetyTIL.h:681

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:695

const Variable * variableDecl() const

Definition ThreadSafetyTIL.h:689

C::CType compare(const Function *E, C &Cmp) const

Definition ThreadSafetyTIL.h:706

SExpr * body()

Definition ThreadSafetyTIL.h:691

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:686

Variable * variableDecl()

Definition ThreadSafetyTIL.h:688

Function(Variable *Vd, SExpr *Bd)

Definition ThreadSafetyTIL.h:676

SExpr * result()

Definition ThreadSafetyTIL.h:456

FutureStatus

Definition ThreadSafetyTIL.h:438

@ FS_done

Definition ThreadSafetyTIL.h:441

@ FS_evaluating

Definition ThreadSafetyTIL.h:440

@ FS_pending

Definition ThreadSafetyTIL.h:439

C::CType compare(const Future *E, C &Cmp) const

Definition ThreadSafetyTIL.h:474

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:447

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:468

SExpr * maybeGetResult() const

Definition ThreadSafetyTIL.h:453

virtual SExpr * compute()

Definition ThreadSafetyTIL.h:450

Future()

Definition ThreadSafetyTIL.h:444

BasicBlock * targetBlock()

Definition ThreadSafetyTIL.h:1385

ArrayRef< BasicBlock * > successors() const

Return the list of basic blocks that this terminator can branch to.

Definition ThreadSafetyTIL.h:1391

Goto(const Goto &G, BasicBlock *B, unsigned I)

Definition ThreadSafetyTIL.h:1379

C::CType compare(const Goto *E, C &Cmp) const

Definition ThreadSafetyTIL.h:1400

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:1394

Goto(BasicBlock *B, unsigned I)

Definition ThreadSafetyTIL.h:1377

unsigned index() const

Returns the index into the.

Definition ThreadSafetyTIL.h:1388

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1382

const BasicBlock * targetBlock() const

Definition ThreadSafetyTIL.h:1384

Identifier(StringRef Id)

Definition ThreadSafetyTIL.h:1794

C::CType compare(const Identifier *E, C &Cmp) const

Definition ThreadSafetyTIL.h:1807

Identifier(const Identifier &)=default

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1797

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:1802

StringRef name() const

Definition ThreadSafetyTIL.h:1799

const SExpr * condition() const

Definition ThreadSafetyTIL.h:1827

IfThenElse(const IfThenElse &I, SExpr *C, SExpr *T, SExpr *E)

Definition ThreadSafetyTIL.h:1821

SExpr * elseExpr()

Definition ThreadSafetyTIL.h:1832

const SExpr * thenExpr() const

Definition ThreadSafetyTIL.h:1830

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:1836

SExpr * condition()

Definition ThreadSafetyTIL.h:1826

C::CType compare(const IfThenElse *E, C &Cmp) const

Definition ThreadSafetyTIL.h:1844

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1824

const SExpr * elseExpr() const

Definition ThreadSafetyTIL.h:1833

IfThenElse(SExpr *C, SExpr *T, SExpr *E)

Definition ThreadSafetyTIL.h:1819

SExpr * thenExpr()

Definition ThreadSafetyTIL.h:1829

Let(const Let &L, Variable *Vd, SExpr *Bd)

Definition ThreadSafetyTIL.h:1868

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:1881

const Variable * variableDecl() const

Definition ThreadSafetyTIL.h:1875

SExpr * body()

Definition ThreadSafetyTIL.h:1877

C::CType compare(const Let *E, C &Cmp) const

Definition ThreadSafetyTIL.h:1892

Let(Variable *Vd, SExpr *Bd)

Definition ThreadSafetyTIL.h:1864

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1872

const SExpr * body() const

Definition ThreadSafetyTIL.h:1878

Variable * variableDecl()

Definition ThreadSafetyTIL.h:1874

const ValueDecl * clangDecl() const

Definition ThreadSafetyTIL.h:652

C::CType compare(const LiteralPtr *E, C &Cmp) const

Definition ThreadSafetyTIL.h:661

LiteralPtr(const LiteralPtr &)=default

void setClangDecl(const ValueDecl *VD)

Definition ThreadSafetyTIL.h:653

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:656

LiteralPtr(const ValueDecl *D)

Definition ThreadSafetyTIL.h:646

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:649

Definition ThreadSafetyTIL.h:570

LiteralT(T Dat)

Definition ThreadSafetyTIL.h:572

T value() const

Definition ThreadSafetyTIL.h:579

LiteralT & operator=(const LiteralT< T > &)=delete

LiteralT(const LiteralT< T > &L)

Definition ThreadSafetyTIL.h:573

T & value()

Definition ThreadSafetyTIL.h:580

Literal(const Literal &)=default

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:541

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:587

const LiteralT< T > & as() const

Definition ThreadSafetyTIL.h:548

ValueType valueType() const

Definition ThreadSafetyTIL.h:546

LiteralT< T > & as()

Definition ThreadSafetyTIL.h:551

Literal(ValueType VT)

Definition ThreadSafetyTIL.h:538

Literal(const Expr *C)

Definition ThreadSafetyTIL.h:536

C::CType compare(const Literal *E, C &Cmp) const

Definition ThreadSafetyTIL.h:558

const Expr * clangExpr() const

Definition ThreadSafetyTIL.h:544

const SExpr * pointer() const

Definition ThreadSafetyTIL.h:1049

Load(SExpr *P)

Definition ThreadSafetyTIL.h:1043

C::CType compare(const Load *E, C &Cmp) const

Definition ThreadSafetyTIL.h:1058

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1046

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:1052

Load(const Load &L, SExpr *P)

Definition ThreadSafetyTIL.h:1044

SExpr * pointer()

Definition ThreadSafetyTIL.h:1048

Phi Node, for code in SSA form.

Definition ThreadSafetyTIL.h:1303

Status

Definition ThreadSafetyTIL.h:1310

@ PH_SingleVal

Definition ThreadSafetyTIL.h:1312

@ PH_MultiVal

Definition ThreadSafetyTIL.h:1311

@ PH_Incomplete

Definition ThreadSafetyTIL.h:1313

SimpleArray< SExpr * > ValArray

Definition ThreadSafetyTIL.h:1305

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1320

Phi()

Definition ThreadSafetyTIL.h:1316

C::CType compare(const Phi *E, C &Cmp) const

Definition ThreadSafetyTIL.h:1345

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:1335

void setStatus(Status s)

Definition ThreadSafetyTIL.h:1326

Status status() const

Definition ThreadSafetyTIL.h:1325

const ValueDecl * clangDecl() const

Return the clang declaration of the variable for this Phi node, if any.

Definition ThreadSafetyTIL.h:1329

void setClangDecl(const ValueDecl *Cvd)

Set the clang variable associated with this Phi node.

Definition ThreadSafetyTIL.h:1332

ValArray & values()

Definition ThreadSafetyTIL.h:1323

Phi(MemRegionRef A, unsigned Nvals)

Definition ThreadSafetyTIL.h:1317

Phi(const Phi &P, ValArray &&Vs)

Definition ThreadSafetyTIL.h:1318

const ValArray & values() const

Definition ThreadSafetyTIL.h:1322

SExpr * record()

Definition ThreadSafetyTIL.h:931

const ValueDecl * clangDecl() const

Definition ThreadSafetyTIL.h:934

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:955

const SExpr * record() const

Definition ThreadSafetyTIL.h:932

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:929

C::CType compare(const Project *E, C &Cmp) const

Definition ThreadSafetyTIL.h:961

Project(SExpr *R, const ValueDecl *Cvd)

Definition ThreadSafetyTIL.h:924

void setArrow(bool b)

Definition ThreadSafetyTIL.h:938

StringRef slotName() const

Definition ThreadSafetyTIL.h:943

bool isArrow() const

Definition ThreadSafetyTIL.h:936

Return from the enclosing function, passing the return value to the caller.

Definition ThreadSafetyTIL.h:1462

Return(const Return &R, SExpr *Rval)

Definition ThreadSafetyTIL.h:1465

const SExpr * returnValue() const

Definition ThreadSafetyTIL.h:1473

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:1476

Return(SExpr *Rval)

Definition ThreadSafetyTIL.h:1464

SExpr * returnValue()

Definition ThreadSafetyTIL.h:1472

ArrayRef< BasicBlock * > successors() const

Return an empty list.

Definition ThreadSafetyTIL.h:1470

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1467

C::CType compare(const Return *E, C &Cmp) const

Definition ThreadSafetyTIL.h:1482

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:901

const SExpr * sfun() const

Definition ThreadSafetyTIL.h:893

SExpr * arg()

Definition ThreadSafetyTIL.h:895

SExpr * sfun()

Definition ThreadSafetyTIL.h:892

bool isDelegation() const

Definition ThreadSafetyTIL.h:898

SApply(SExpr *Sf, SExpr *A=nullptr)

Definition ThreadSafetyTIL.h:886

const SExpr * arg() const

Definition ThreadSafetyTIL.h:896

C::CType compare(const SApply *E, C &Cmp) const

Definition ThreadSafetyTIL.h:909

SApply(SApply &A, SExpr *Sf, SExpr *Ar=nullptr)

Definition ThreadSafetyTIL.h:887

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:890

An SCFG is a control-flow graph.

Definition ThreadSafetyTIL.h:1693

void setEntry(BasicBlock *BB)

Definition ThreadSafetyTIL.h:1755

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:1761

const BasicBlock * entry() const

Definition ThreadSafetyTIL.h:1734

void add(BasicBlock *BB)

Definition ThreadSafetyTIL.h:1748

BlockArray::iterator iterator

Definition ThreadSafetyTIL.h:1696

void setExit(BasicBlock *BB)

Definition ThreadSafetyTIL.h:1756

C::CType compare(const SCFG *E, C &Cmp) const

Definition ThreadSafetyTIL.h:1773

bool normal() const

Return true if this CFG has been normalized.

Definition ThreadSafetyTIL.h:1723

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1715

SCFG(MemRegionRef A, unsigned Nblocks)

Definition ThreadSafetyTIL.h:1699

const_iterator begin() const

Definition ThreadSafetyTIL.h:1728

const_iterator end() const

Definition ThreadSafetyTIL.h:1729

const_iterator cend() const

Definition ThreadSafetyTIL.h:1732

const BasicBlock * exit() const

Definition ThreadSafetyTIL.h:1736

BlockArray::const_iterator const_iterator

Definition ThreadSafetyTIL.h:1697

BasicBlock * exit()

Definition ThreadSafetyTIL.h:1737

BasicBlock * entry()

Definition ThreadSafetyTIL.h:1735

const_iterator cbegin() const

Definition ThreadSafetyTIL.h:1731

unsigned numInstructions()

Return the total number of instructions in the CFG.

Definition ThreadSafetyTIL.h:1746

size_t numBlocks() const

Return the number of blocks in the CFG.

Definition ThreadSafetyTIL.h:1741

bool valid() const

Return true if this CFG is valid.

Definition ThreadSafetyTIL.h:1718

SimpleArray< BasicBlock * > BlockArray

Definition ThreadSafetyTIL.h:1695

iterator begin()

Definition ThreadSafetyTIL.h:1725

iterator end()

Definition ThreadSafetyTIL.h:1726

Base class for AST nodes in the typed intermediate language.

Definition ThreadSafetyTIL.h:277

BasicBlock * Block

Definition ThreadSafetyTIL.h:329

SExpr(TIL_Opcode Op)

Definition ThreadSafetyTIL.h:321

unsigned char Reserved

Definition ThreadSafetyTIL.h:326

unsigned short Flags

Definition ThreadSafetyTIL.h:327

SExpr(const SExpr &E)

Definition ThreadSafetyTIL.h:322

BasicBlock * block() const

Returns the block, if this is an instruction in a basic block, otherwise returns null.

Definition ThreadSafetyTIL.h:315

void setID(BasicBlock *B, unsigned id)

Set the basic block and instruction ID for this expression.

Definition ThreadSafetyTIL.h:318

SExpr & operator=(const SExpr &)=delete

unsigned SExprID

Definition ThreadSafetyTIL.h:328

TIL_Opcode opcode() const

Definition ThreadSafetyTIL.h:281

const TIL_Opcode Opcode

Definition ThreadSafetyTIL.h:325

unsigned id() const

Returns the instruction ID for this expression.

Definition ThreadSafetyTIL.h:311

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:741

Variable * variableDecl()

Definition ThreadSafetyTIL.h:743

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:750

SFunction(Variable *Vd, SExpr *B)

Definition ThreadSafetyTIL.h:727

SFunction(const SFunction &F, Variable *Vd, SExpr *B)

Definition ThreadSafetyTIL.h:734

SExpr * body()

Definition ThreadSafetyTIL.h:746

const Variable * variableDecl() const

Definition ThreadSafetyTIL.h:744

const SExpr * body() const

Definition ThreadSafetyTIL.h:747

C::CType compare(const SFunction *E, C &Cmp) const

Definition ThreadSafetyTIL.h:762

const BasicBlock ** const_iterator

Store(SExpr *P, SExpr *V)

Definition ThreadSafetyTIL.h:1070

C::CType compare(const Store *E, C &Cmp) const

Definition ThreadSafetyTIL.h:1089

const SExpr * destination() const

Definition ThreadSafetyTIL.h:1076

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:1082

SExpr * source()

Definition ThreadSafetyTIL.h:1078

SExpr * destination()

Definition ThreadSafetyTIL.h:1075

Store(const Store &S, SExpr *P, SExpr *V)

Definition ThreadSafetyTIL.h:1071

const SExpr * source() const

Definition ThreadSafetyTIL.h:1079

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1073

Base class for basic block terminators: Branch, Goto, and Return.

Definition ThreadSafetyTIL.h:1356

ArrayRef< BasicBlock * > successors() const

Return the list of basic blocks that this terminator can branch to.

Definition ThreadSafetyTIL.h:1490

Terminator(const SExpr &E)

Definition ThreadSafetyTIL.h:1359

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1362

Terminator(TIL_Opcode Op)

Definition ThreadSafetyTIL.h:1358

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:1184

const SExpr * expr() const

Definition ThreadSafetyTIL.h:1191

UnaryOp(const UnaryOp &U, SExpr *E)

Definition ThreadSafetyTIL.h:1182

TIL_UnaryOpcode unaryOpcode() const

Definition ThreadSafetyTIL.h:1186

C::CType compare(const UnaryOp *E, C &Cmp) const

Definition ThreadSafetyTIL.h:1200

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:1194

SExpr * expr()

Definition ThreadSafetyTIL.h:1190

UnaryOp(TIL_UnaryOpcode Op, SExpr *E)

Definition ThreadSafetyTIL.h:1178

C::CType compare(const Undefined *E, C &Cmp) const

Definition ThreadSafetyTIL.h:505

Undefined & operator=(const Undefined &)=delete

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:500

Undefined(const Stmt *S=nullptr)

Definition ThreadSafetyTIL.h:490

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:497

Undefined(const Undefined &U)

Definition ThreadSafetyTIL.h:491

A named variable, e.g.

Definition ThreadSafetyTIL.h:356

friend class SFunction

Definition ThreadSafetyTIL.h:422

Variable(SExpr *D, const ValueDecl *Cvd=nullptr)

Definition ThreadSafetyTIL.h:374

void setName(StringRef S)

Definition ThreadSafetyTIL.h:402

Variable(const Variable &Vd, SExpr *D)

Definition ThreadSafetyTIL.h:380

C::CType compare(const Variable *E, C &Cmp) const

Definition ThreadSafetyTIL.h:414

void setDefinition(SExpr *E)

Definition ThreadSafetyTIL.h:404

StringRef name() const

Return the name of the variable, if any.

Definition ThreadSafetyTIL.h:391

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:385

Variable(StringRef s, SExpr *D=nullptr)

Definition ThreadSafetyTIL.h:369

SExpr * definition()

Return the definition of the variable.

Definition ThreadSafetyTIL.h:399

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:408

friend class Function

Definition ThreadSafetyTIL.h:420

const SExpr * definition() const

Definition ThreadSafetyTIL.h:400

const ValueDecl * clangDecl() const

Return the clang declaration for this variable, if any.

Definition ThreadSafetyTIL.h:394

void setClangDecl(const ValueDecl *VD)

Definition ThreadSafetyTIL.h:405

VariableKind

Definition ThreadSafetyTIL.h:358

@ VK_Let

Let-variable.

Definition ThreadSafetyTIL.h:360

@ VK_SFun

SFunction (self) parameter.

Definition ThreadSafetyTIL.h:366

@ VK_Fun

Function parameter.

Definition ThreadSafetyTIL.h:363

void setKind(VariableKind K)

Definition ThreadSafetyTIL.h:403

friend class Let

Definition ThreadSafetyTIL.h:421

friend class BasicBlock

Definition ThreadSafetyTIL.h:419

VariableKind kind() const

Return the kind of variable (let, function param, or self)

Definition ThreadSafetyTIL.h:388

V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx)

Definition ThreadSafetyTIL.h:521

static bool classof(const SExpr *E)

Definition ThreadSafetyTIL.h:519

C::CType compare(const Wildcard *E, C &Cmp) const

Definition ThreadSafetyTIL.h:526

Wildcard(const Wildcard &)=default

Wildcard()

Definition ThreadSafetyTIL.h:516

Definition ThreadSafetyTIL.h:333

bool isTrivial(const SExpr *E)

Definition ThreadSafetyTIL.h:335

Definition ThreadSafetyTIL.h:73

TIL_UnaryOpcode

Opcode for unary arithmetic operations.

Definition ThreadSafetyTIL.h:85

@ UOP_BitNot

Definition ThreadSafetyTIL.h:87

@ UOP_Minus

Definition ThreadSafetyTIL.h:86

@ UOP_LogicNot

Definition ThreadSafetyTIL.h:88

const TIL_Opcode COP_Min

Definition ThreadSafetyTIL.h:132

void simplifyIncompleteArg(til::Phi *Ph)

const TIL_Opcode COP_Max

Definition ThreadSafetyTIL.h:133

const TIL_BinaryOpcode BOP_Min

Definition ThreadSafetyTIL.h:136

const TIL_UnaryOpcode UOP_Min

Definition ThreadSafetyTIL.h:134

StringRef getBinaryOpcodeString(TIL_BinaryOpcode Op)

Return the name of a binary opcode.

StringRef getUnaryOpcodeString(TIL_UnaryOpcode Op)

Return the name of a unary opcode.

TIL_CastOpcode

Opcode for cast operations.

Definition ThreadSafetyTIL.h:113

@ CAST_toInt

Definition ThreadSafetyTIL.h:126

@ CAST_extendNum

Definition ThreadSafetyTIL.h:117

@ CAST_objToPtr

Definition ThreadSafetyTIL.h:129

@ CAST_truncNum

Definition ThreadSafetyTIL.h:120

@ CAST_none

Definition ThreadSafetyTIL.h:114

@ CAST_toFloat

Definition ThreadSafetyTIL.h:123

const TIL_CastOpcode CAST_Max

Definition ThreadSafetyTIL.h:139

TIL_BinaryOpcode

Opcode for binary arithmetic operations.

Definition ThreadSafetyTIL.h:92

@ BOP_Leq

Definition ThreadSafetyTIL.h:106

@ BOP_Add

Definition ThreadSafetyTIL.h:93

@ BOP_Mul

Definition ThreadSafetyTIL.h:95

@ BOP_Shr

Definition ThreadSafetyTIL.h:99

@ BOP_Cmp

Definition ThreadSafetyTIL.h:107

@ BOP_Rem

Definition ThreadSafetyTIL.h:97

@ BOP_Div

Definition ThreadSafetyTIL.h:96

@ BOP_Eq

Definition ThreadSafetyTIL.h:103

@ BOP_LogicOr

Definition ThreadSafetyTIL.h:109

@ BOP_Neq

Definition ThreadSafetyTIL.h:104

@ BOP_BitXor

Definition ThreadSafetyTIL.h:101

@ BOP_Sub

Definition ThreadSafetyTIL.h:94

@ BOP_Lt

Definition ThreadSafetyTIL.h:105

@ BOP_BitAnd

Definition ThreadSafetyTIL.h:100

@ BOP_LogicAnd

Definition ThreadSafetyTIL.h:108

@ BOP_Shl

Definition ThreadSafetyTIL.h:98

@ BOP_BitOr

Definition ThreadSafetyTIL.h:102

SExpr * simplifyToCanonicalVal(SExpr *E)

const TIL_BinaryOpcode BOP_Max

Definition ThreadSafetyTIL.h:137

const TIL_CastOpcode CAST_Min

Definition ThreadSafetyTIL.h:138

const TIL_UnaryOpcode UOP_Max

Definition ThreadSafetyTIL.h:135

const SExpr * getCanonicalVal(const SExpr *E)

TIL_Opcode

Enum for the different distinct classes of SExpr.

Definition ThreadSafetyTIL.h:78

The JSON file list parser is used to communicate input to InstallAPI.

@ Result

The result type of a method or function.

const FunctionProtoType * T

U cast(CodeGen::Address addr)

@ Other

Other implicit parameter.

Definition ThreadSafetyTIL.h:1514

BasicBlock * Parent

Definition ThreadSafetyTIL.h:1521

bool isParentOf(const TopologyNode &OtherNode)

Definition ThreadSafetyTIL.h:1525

int SizeOfSubTree

Definition ThreadSafetyTIL.h:1518

bool isParentOfOrEqual(const TopologyNode &OtherNode)

Definition ThreadSafetyTIL.h:1530

int NodeID

Definition ThreadSafetyTIL.h:1515

ValueTypes are data types that can actually be held in registers.

Definition ThreadSafetyTIL.h:153

ValueType(BaseType B, SizeType Sz, bool S, unsigned char VS)

Definition ThreadSafetyTIL.h:174

BaseType Base

Definition ThreadSafetyTIL.h:182

SizeType

Definition ThreadSafetyTIL.h:164

@ ST_64

Definition ThreadSafetyTIL.h:170

@ ST_8

Definition ThreadSafetyTIL.h:167

@ ST_128

Definition ThreadSafetyTIL.h:171

@ ST_16

Definition ThreadSafetyTIL.h:168

@ ST_32

Definition ThreadSafetyTIL.h:169

@ ST_1

Definition ThreadSafetyTIL.h:166

@ ST_0

Definition ThreadSafetyTIL.h:165

static ValueType getValueType()

unsigned char VectSize

Definition ThreadSafetyTIL.h:187

static SizeType getSizeType(unsigned nbytes)

Definition ThreadSafetyTIL.h:190

bool Signed

Definition ThreadSafetyTIL.h:184

BaseType

Definition ThreadSafetyTIL.h:154

@ BT_ValueRef

Definition ThreadSafetyTIL.h:161

@ BT_String

Definition ThreadSafetyTIL.h:159

@ BT_Void

Definition ThreadSafetyTIL.h:155

@ BT_Bool

Definition ThreadSafetyTIL.h:156

@ BT_Int

Definition ThreadSafetyTIL.h:157

@ BT_Pointer

Definition ThreadSafetyTIL.h:160

@ BT_Float

Definition ThreadSafetyTIL.h:158

SizeType Size

Definition ThreadSafetyTIL.h:183