clang: lib/CodeGen/CodeGenModule.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H

14#define LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H

15

33#include "llvm/ADT/DenseMap.h"

34#include "llvm/ADT/MapVector.h"

35#include "llvm/ADT/SetVector.h"

36#include "llvm/ADT/SmallPtrSet.h"

37#include "llvm/ADT/StringMap.h"

38#include "llvm/IR/Module.h"

39#include "llvm/IR/ValueHandle.h"

40#include "llvm/Transforms/Utils/SanitizerStats.h"

41#include

42

43namespace llvm {

45class Constant;

46class ConstantInt;

48class GlobalValue;

49class DataLayout;

50class FunctionType;

51class LLVMContext;

52class IndexedInstrProfReader;

53

54namespace vfs {

55class FileSystem;

56}

57}

58

60class ASTContext;

61class AtomicType;

62class FunctionDecl;

63class IdentifierInfo;

64class ObjCImplementationDecl;

65class ObjCEncodeExpr;

66class BlockExpr;

67class CharUnits;

69class Expr;

70class Stmt;

71class StringLiteral;

72class NamedDecl;

73class PointerAuthSchema;

74class ValueDecl;

75class VarDecl;

76class LangOptions;

77class CodeGenOptions;

78class HeaderSearchOptions;

79class DiagnosticsEngine;

80class AnnotateAttr;

81class CXXDestructorDecl;

83class CoverageSourceInfo;

84class InitSegAttr;

85

86namespace CodeGen {

87

88class CodeGenFunction;

89class CodeGenTBAA;

90class CGCXXABI;

91class CGDebugInfo;

92class CGObjCRuntime;

93class CGOpenCLRuntime;

94class CGOpenMPRuntime;

95class CGCUDARuntime;

96class CGHLSLRuntime;

97class CoverageMappingModuleGen;

98class TargetCodeGenInfo;

99

104

105

106

107

108

109

110

111

112

113

114

115

117public:

118

120 private:

121 static constexpr uint32_t None = (1u << 31);

122 static constexpr uint32_t Mask = None - 1;

123

124 uint32_t Val;

125

126 public:

128

130 assert(!(InitVal & ~Mask));

131 Val = InitVal;

132 }

133

134 bool hasValue() const { return !(Val & None); }

135

136 operator uint32_t() const { return Val; }

137 };

138

141

142

144

145

147};

148

154

157 }

158

162 }

163};

164

167

168

170

171

173

174

176

177

179

180

181

183

184

186

187

189

190

191

193

194

196

197

199

200

202

203

205

206

208

209

211

212

214

215

217

218

219

221

222

224

225

227

228

230

231

233

234

236

237

238

240

241

243

244

246

247

249

250

251

253

254

256

257

259};

260

261

263 uint32_t VisitedInMainFile = 0;

264 uint32_t MissingInMainFile = 0;

265 uint32_t Visited = 0;

266 uint32_t Missing = 0;

267 uint32_t Mismatched = 0;

268

269public:

271

272

274 if (MainFile)

275 ++VisitedInMainFile;

277 }

278

280 if (MainFile)

281 ++MissingInMainFile;

282 ++Missing;

283 }

284

286

288

290};

291

292

294

295

296public:

299

300

301

302

304

309

310 void Profile(llvm::FoldingSetNodeID &id) const {

313 }

314 virtual void profileImpl(llvm::FoldingSetNodeID &id) const = 0;

315

316 virtual bool needsCopy() const { return true; }

318

321};

322

323

324

328

329public:

342 };

343

345

346private:

350 const HeaderSearchOptions &HeaderSearchOpts;

351 const PreprocessorOptions &PreprocessorOpts;

353 unsigned NumAutoVarInit = 0;

354 llvm::Module &TheModule;

357 std::unique_ptr ABI;

358 llvm::LLVMContext &VMContext;

359 std::string ModuleNameHash;

360 bool CXX20ModuleInits = false;

361 std::unique_ptr TBAA;

362

363 mutable std::unique_ptr TheTargetCodeGenInfo;

364

365

366

367

368 std::unique_ptr Types;

369

370

372

373 std::unique_ptr ObjCRuntime;

374 std::unique_ptr OpenCLRuntime;

375 std::unique_ptr OpenMPRuntime;

376 std::unique_ptr CUDARuntime;

377 std::unique_ptr HLSLRuntime;

378 std::unique_ptr DebugInfo;

379 std::unique_ptr ObjCData;

380 llvm::MDNode *NoObjCARCExceptionsMetadata = nullptr;

381 std::unique_ptrllvm::IndexedInstrProfReader PGOReader;

383 std::unique_ptrllvm::SanitizerStatReport SanStats;

385

386

387

388

390

391

392

393

394

395 llvm::DenseMap<StringRef, GlobalDecl> DeferredDecls;

396

397 llvm::StringSetllvm::BumpPtrAllocator DeferredResolversToEmit;

398

399

400

401 std::vector DeferredDeclsToEmit;

402 void addDeferredDeclToEmit(GlobalDecl GD) {

403 DeferredDeclsToEmit.emplace_back(GD);

404 addEmittedDeferredDecl(GD);

405 }

406

407

408 llvm::DenseMap<llvm::StringRef, GlobalDecl> EmittedDeferredDecls;

409

410 void addEmittedDeferredDecl(GlobalDecl GD) {

411

412 if (!Context.getLangOpts().IncrementalExtensions)

413 return;

414

415

416 auto L = llvm::GlobalValue::ExternalLinkage;

417 if (llvm::isa(GD.getDecl()))

419 else if (auto *VD = llvm::dyn_cast(GD.getDecl()))

421

422 if (llvm::GlobalValue::isInternalLinkage(L) ||

423 llvm::GlobalValue::isLinkOnceLinkage(L) ||

424 llvm::GlobalValue::isWeakLinkage(L)) {

426 }

427 }

428

429

430

431 std::vector Aliases;

432

433

434

435

436 std::vector MultiVersionFuncs;

437

438 llvm::MapVector<StringRef, llvm::TrackingVHllvm::Constant> Replacements;

439

440

441

442

444 GlobalValReplacements;

445

446

447

448 llvm::DenseMap<const VarDecl*, llvm::GlobalVariable*> InitializerConstants;

449

450

451

452

453 llvm::DenseSet DiagnosedConflictingDefinitions;

454

455

456 std::vector<const CXXRecordDecl*> DeferredVTables;

457

458

459 std::vector<const CXXRecordDecl *> OpportunisticVTables;

460

461

462

463

464 std::vectorllvm::WeakTrackingVH LLVMUsed;

465 std::vectorllvm::WeakTrackingVH LLVMCompilerUsed;

466

467

468

470

471

472

474

475

476 llvm::MapVector<GlobalDecl, StringRef> MangledDeclNames;

477 llvm::StringMap<GlobalDecl, llvm::BumpPtrAllocator> Manglings;

478

479

480 std::vectorllvm::Constant\* Annotations;

481

482

483

484 llvm::MapVector<StringRef, const ValueDecl *> DeferredAnnotations;

485

486

487 llvm::StringMapllvm::Constant\* AnnotationStrings;

488

489

490 llvm::DenseMap<unsigned, llvm::Constant *> AnnotationArgs;

491

492 llvm::StringMap<llvm::GlobalVariable *> CFConstantStringMap;

493

494 llvm::DenseMap<llvm::Constant *, llvm::GlobalVariable *> ConstantStringMap;

495 llvm::DenseMap<const UnnamedGlobalConstantDecl *, llvm::GlobalVariable *>

496 UnnamedGlobalConstantDeclMap;

497 llvm::DenseMap<const Decl*, llvm::Constant *> StaticLocalDeclMap;

498 llvm::DenseMap<const Decl*, llvm::GlobalVariable*> StaticLocalDeclGuardMap;

499 llvm::DenseMap<const Expr*, llvm::Constant *> MaterializedGlobalTemporaryMap;

500

501 llvm::DenseMap<QualType, llvm::Constant *> AtomicSetterHelperFnMap;

502 llvm::DenseMap<QualType, llvm::Constant *> AtomicGetterHelperFnMap;

503

504

505 llvm::DenseMap<QualType, llvm::Constant *> TypeDescriptorMap;

506

507

508

509 typedef llvm::MapVector<IdentifierInfo *,

510 llvm::GlobalValue *> StaticExternCMap;

511 StaticExternCMap StaticExternCValues;

512

513

514 std::vector<const VarDecl *> CXXThreadLocals;

515

516

517

518 std::vector<llvm::Function *> CXXThreadLocalInits;

519 std::vector<const VarDecl *> CXXThreadLocalInitVars;

520

521

522 std::vector<llvm::Function *> CXXGlobalInits;

523

524

525

526

527

528

529 llvm::DenseMap<const Decl*, unsigned> DelayedCXXInitPosition;

530

531 typedef std::pair<OrderGlobalInitsOrStermFinalizers, llvm::Function *>

532 GlobalInitData;

533

534

535

536

537

538

540 MustTailCallUndefinedGlobals;

541

542 struct GlobalInitPriorityCmp {

543 bool operator()(const GlobalInitData &LHS,

544 const GlobalInitData &RHS) const {

545 return LHS.first.priority < RHS.first.priority;

546 }

547 };

548

549

550

551 SmallVector<GlobalInitData, 8> PrioritizedCXXGlobalInits;

552

553

554

555

556 typedef std::tuple<llvm::FunctionType *, llvm::WeakTrackingVH,

557 llvm::Constant *>

558 CXXGlobalDtorsOrStermFinalizer_t;

559 SmallVector<CXXGlobalDtorsOrStermFinalizer_t, 8>

560 CXXGlobalDtorsOrStermFinalizers;

561

562 typedef std::pair<OrderGlobalInitsOrStermFinalizers, llvm::Function *>

563 StermFinalizerData;

564

565 struct StermFinalizerPriorityCmp {

566 bool operator()(const StermFinalizerData &LHS,

567 const StermFinalizerData &RHS) const {

568 return LHS.first.priority < RHS.first.priority;

569 }

570 };

571

572

573

574 SmallVector<StermFinalizerData, 8> PrioritizedCXXStermFinalizers;

575

576

577 llvm::SetVector<clang::Module *> ImportedModules;

578

579

580

582

583

584 SmallVector<llvm::MDNode *, 16> LinkerOptionsMetadata;

585

586

587 SmallVector<llvm::MDNode *, 16> ELFDependentLibraries;

588

589

590

591

592

593

594 llvm::WeakTrackingVH CFConstantStringClassRef;

595

596

597

598 QualType ObjCFastEnumerationStateType;

599

600

601

602

603 void createObjCRuntime();

604

605 void createOpenCLRuntime();

606 void createOpenMPRuntime();

607 void createCUDARuntime();

608 void createHLSLRuntime();

609

610 bool isTriviallyRecursive(const FunctionDecl *F);

611 bool shouldEmitFunction(GlobalDecl GD);

612

613

614 bool shouldEmitCUDAGlobalVar(const VarDecl *VD) const;

615 bool shouldOpportunisticallyEmitVTables();

616

617 llvm::DenseMap<const CompoundLiteralExpr *, llvm::GlobalVariable *>

618 EmittedCompoundLiterals;

619

620

621

622 llvm::DenseMap<const BlockExpr *, llvm::Constant *> EmittedGlobalBlocks;

623

624

625

626

627 llvm::Constant *NSConcreteGlobalBlock = nullptr;

628 llvm::Constant *NSConcreteStackBlock = nullptr;

629

630 llvm::FunctionCallee BlockObjectAssign = nullptr;

631 llvm::FunctionCallee BlockObjectDispose = nullptr;

632

633 llvm::Type *BlockDescriptorType = nullptr;

634 llvm::Type *GenericBlockLiteralType = nullptr;

635

636 struct {

638 } Block;

639

641

642

643

644

645 llvm::Function *LifetimeStartFn = nullptr;

646

647

648 llvm::Function *LifetimeEndFn = nullptr;

649

650 std::unique_ptr SanitizerMD;

651

652 llvm::MapVector<const Decl *, bool> DeferredEmptyCoverageMappingDecls;

653

654 std::unique_ptr CoverageMapping;

655

656

657

658

659 typedef llvm::DenseMap<QualType, llvm::Metadata *> MetadataTypeMap;

660 MetadataTypeMap MetadataIdMap;

661 MetadataTypeMap VirtualMetadataIdMap;

662 MetadataTypeMap GeneralizedMetadataIdMap;

663

664

665

666 std::pair<std::unique_ptr, const TopLevelStmtDecl *>

667 GlobalTopLevelStmtBlockInFlight;

668

669 llvm::DenseMap<GlobalDecl, uint16_t> PtrAuthDiscriminatorHashes;

670

671 llvm::DenseMap<const CXXRecordDecl *, std::optional>

672 VTablePtrAuthInfos;

673 std::optional

674 computeVTPointerAuthentication(const CXXRecordDecl *ThisClass);

675

676public:

683

685

687

688

690

691

693

694

698 }

699

700

702

704

705

707 assert(OpenCLRuntime != nullptr);

708 return *OpenCLRuntime;

709 }

710

711

713 assert(OpenMPRuntime != nullptr);

714 return *OpenMPRuntime;

715 }

716

717

719 assert(CUDARuntime != nullptr);

720 return *CUDARuntime;

721 }

722

723

725 assert(HLSLRuntime != nullptr);

726 return *HLSLRuntime;

727 }

728

730 assert(ObjCData != nullptr);

731 return *ObjCData;

732 }

733

734

735

737

739

741 llvm::IndexedInstrProfReader *getPGOReader() const { return PGOReader.get(); }

742

744 return CoverageMapping.get();

745 }

746

748 return StaticLocalDeclMap[D];

749 }

751 llvm::Constant *C) {

752 StaticLocalDeclMap[D] = C;

753 }

754

755 llvm::Constant *

757 llvm::GlobalValue::LinkageTypes Linkage);

758

760 return StaticLocalDeclGuardMap[D];

761 }

763 llvm::GlobalVariable *C) {

764 StaticLocalDeclGuardMap[D] = C;

765 }

766

769

772

774 return AtomicSetterHelperFnMap[Ty];

775 }

777 llvm::Constant *Fn) {

778 AtomicSetterHelperFnMap[Ty] = Fn;

779 }

780

782 return AtomicGetterHelperFnMap[Ty];

783 }

785 llvm::Constant *Fn) {

786 AtomicGetterHelperFnMap[Ty] = Fn;

787 }

788

790 return TypeDescriptorMap[Ty];

791 }

793 TypeDescriptorMap[Ty] = C;

794 }

795

797

799 if (!NoObjCARCExceptionsMetadata)

800 NoObjCARCExceptionsMetadata = llvm::MDNode::get(getLLVMContext(), {});

801 return NoObjCARCExceptionsMetadata;

802 }

803

807 return FS;

808 }

810 const { return HeaderSearchOpts; }

812 const { return PreprocessorOpts; }

814 llvm::Module &getModule() const { return TheModule; }

817 return TheModule.getDataLayout();

818 }

823

827

829

831

833

835

838 }

839

842 }

843

846 }

847

850

851

852

854

855

856

858

859

860

862

864

865

866

868

869

871

872

873

876

877

878

881

882

883

886

887

888

890 if (Base.getTBAAInfo().isMayAlias())

893 }

894

897

898

901

902

905

906

908

909

911

912 void setDSOLocal(llvm::GlobalValue *GV) const;

913

916 (D->getLinkageAndVisibility().getVisibility() ==

920 D->getLinkageAndVisibility().isVisibilityExplicit()));

921 }

924

925

928

930

931

932

934

935

937

939 switch (V) {

940 case DefaultVisibility: return llvm::GlobalValue::DefaultVisibility;

941 case HiddenVisibility: return llvm::GlobalValue::HiddenVisibility;

943 }

944 llvm_unreachable("unknown visibility!");

945 }

946

950

951

952

953

954

955 llvm::GlobalVariable *

957 llvm::GlobalValue::LinkageTypes Linkage,

958 llvm::Align Alignment);

959

961 llvm::FunctionType *ty, const Twine &name, const CGFunctionInfo &FI,

963 llvm::GlobalVariable::LinkageTypes Linkage =

964 llvm::GlobalVariable::InternalLinkage);

965

966

967

968

969

970

971

972

973

975

976

977

978

979

980

982

983

984

985

986

987

988

990 llvm::Type *Ty = nullptr,

993

994

995

997 bool ForVTable = false,

998 bool DontDefer = false,

1001

1002

1004

1005

1006

1007

1009 llvm::Type *Ty = nullptr);

1010

1011

1012

1013

1015

1016

1017

1018

1021

1023 llvm::Type *Ty = nullptr);

1024

1027

1029

1031

1033

1035

1039 llvm::Constant *StorageAddress,

1042

1043 llvm::Constant *

1045 llvm::Constant *StorageAddress,

1046 llvm::ConstantInt *OtherDiscriminator);

1047

1048 llvm::ConstantInt *

1051

1053 std::optional

1056 llvm::Value *StorageAddress);

1057

1058 std::optional

1060

1062

1063

1068 }

1069

1070

1072

1073

1075

1076

1079

1080

1083

1084

1085 llvm::Constant *GetAddrOfThunk(StringRef Name, llvm::Type *FnTy,

1087

1088

1090

1091

1093

1094

1095

1097

1098

1103 }

1104

1105

1109

1110

1111

1112

1116

1121

1122

1123

1124 llvm::Constant *

1128

1130

1131

1133

1134

1136

1137

1139

1140

1142

1143

1144

1146 return EmittedGlobalBlocks.lookup(BE);

1147 }

1148

1149

1150

1152

1153

1155

1156

1158

1159

1162 StringRef Name = ".str");

1163

1164

1167

1168

1169

1170

1171

1172

1175 const char *GlobalName = nullptr);

1176

1177

1178

1180

1181

1182

1183 llvm::GlobalVariable *

1185

1186

1187

1189 llvm::GlobalVariable *GV);

1190

1191

1192

1194 const Expr *Inner);

1195

1196

1197

1199

1200

1201

1202

1204

1205

1206 llvm::Constant *

1208 llvm::FunctionType *FnType = nullptr,

1209 bool DontDefer = false,

1212 DontDefer,

1213 IsForDefinition)

1214 .getCallee());

1215 }

1216

1219 llvm::FunctionType *FnType = nullptr, bool DontDefer = false,

1221

1222

1223

1225 unsigned BuiltinID);

1226

1228

1229

1231

1232

1233

1235

1236

1237

1239

1240

1241

1243

1244

1246

1247

1249

1250

1251

1252

1253 template

1255

1256

1258

1259

1261

1262

1264

1265

1266 void AddCXXDtorEntry(llvm::FunctionCallee DtorFn, llvm::Constant *Object) {

1267 CXXGlobalDtorsOrStermFinalizers.emplace_back(DtorFn.getFunctionType(),

1268 DtorFn.getCallee(), Object);

1269 }

1270

1271

1273 CXXGlobalDtorsOrStermFinalizers.emplace_back(DtorFn.getFunctionType(),

1274 DtorFn.getCallee(), nullptr);

1275 }

1276

1277

1281 }

1282

1286 PrioritizedCXXStermFinalizers.size());

1287 PrioritizedCXXStermFinalizers.push_back(

1288 std::make_pair(Key, StermFinalizer));

1289 }

1290

1291

1292

1293

1294

1295

1296

1297 llvm::FunctionCallee

1299 llvm::AttributeList ExtraAttrs = llvm::AttributeList(),

1300 bool Local = false, bool AssumeConvergent = false);

1301

1302

1303

1304

1305 llvm::FunctionCallee

1307 StringRef Name,

1308 llvm::AttributeList ExtraAttrs = llvm::AttributeList(),

1309 bool Local = false, bool AssumeConvergent = false);

1310

1311

1313 StringRef Name);

1314

1315

1316

1317

1322

1323

1324

1327

1328

1330

1332

1333

1334

1337

1338

1339

1340

1342

1343

1344

1346

1347

1349

1350

1352

1353

1355

1356

1357

1358

1359

1361 llvm::function_ref<void()> Fn);

1362

1363

1364

1365

1368

1369

1371 llvm::Function *F, bool IsThunk);

1372

1373

1374

1376

1377

1378

1380

1381

1383

1384

1386

1387

1388

1390

1391

1393

1394

1396

1397

1398

1399

1400

1401

1402

1403

1404

1405

1406

1409 llvm::AttributeList &Attrs, unsigned &CallingConv,

1410 bool AttrOnCallSite, bool IsThunk);

1411

1412

1413

1414

1416 llvm::AttributeList &Attrs);

1417

1418

1419

1421

1425

1427

1429

1431

1433

1434

1436

1437

1439

1440

1442

1443

1445

1448 }

1449

1450

1451

1453

1454

1456

1457

1458 llvm::GlobalValue::LinkageTypes

1460

1461

1462 llvm::GlobalValue::LinkageTypes

1464

1465

1467

1468

1470

1471

1473

1474

1476

1477

1479

1480

1481

1482

1483

1484

1485

1486

1488 const AnnotateAttr *AA,

1490

1491

1492

1494

1497

1500 StringRef Category = StringRef()) const;

1501

1502

1503

1504

1506 StringRef Category = StringRef()) const;

1507

1508

1509

1512

1513

1514

1518

1520 return SanitizerMD.get();

1521 }

1522

1524 DeferredVTables.push_back(RD);

1525 }

1526

1527

1528

1530

1532

1534

1535

1536

1537

1538

1540

1542

1544

1545

1546

1548

1549

1552

1553

1556

1557

1558

1560

1561

1562

1564

1565

1567

1568

1569

1570

1572

1573

1574

1575

1577

1578

1579

1580

1581

1582

1583

1584 llvm::GlobalObject::VCallVisibility

1586 llvm::DenseSet<const CXXRecordDecl *> &Visited);

1587

1588

1590 llvm::GlobalVariable *VTable,

1592

1594

1595

1597

1598

1600

1601

1602

1603

1605

1606

1607

1609

1610

1611

1612

1614

1615

1617 llvm::Function *F);

1618

1619

1621

1622

1624

1625

1626

1629

1630

1632

1633

1636

1637

1638

1639

1640

1641

1644

1645

1647

1648 llvm::SanitizerStatReport &getSanStats();

1649

1650 llvm::Value *

1652

1653

1654

1655

1656

1657

1658

1659

1660

1661

1662

1666

1667

1668

1669

1671

1675 bool forPointeeType = false);

1680

1681

1682

1683

1684

1685

1687 const Decl *D) const;

1688

1689

1690

1691

1693

1694

1695

1696

1698 const CUDALaunchBoundsAttr *A,

1699 int32_t *MaxThreadsVal = nullptr,

1700 int32_t *MinBlocksVal = nullptr,

1701 int32_t *MaxClusterRankVal = nullptr);

1702

1703

1704

1705

1706

1707

1709 llvm::Function *F, const AMDGPUFlatWorkGroupSizeAttr *A,

1710 const ReqdWorkGroupSizeAttr *ReqdWGS = nullptr,

1711 int32_t *MinThreadsVal = nullptr, int32_t *MaxThreadsVal = nullptr);

1712

1713

1715 const AMDGPUWavesPerEUAttr *A);

1716

1717 llvm::Constant *

1721

1722

1724 unsigned LexOrder = ~0U,

1725 llvm::Constant *AssociatedData = nullptr);

1727 bool IsDtorAttrFunc = false);

1728

1729

1730

1732

1733

1734 return getTriple().isSPIRVLogical();

1735 }

1736

1738 std::pair<const FunctionDecl *, SourceLocation> Global) {

1739 MustTailCallUndefinedGlobals.insert(Global);

1740 }

1741

1743

1744

1745

1746

1747

1748

1749

1750

1751

1752

1753

1754

1755

1756

1757

1758

1759

1760

1761

1762

1763

1764

1765

1766

1767

1768

1769

1770

1771

1772

1773

1774

1775

1776

1777

1778

1779

1780

1781

1782

1783

1784

1785

1786

1787

1788

1789

1791 }

1792

1793private:

1794 bool shouldDropDLLAttribute(const Decl *D, const llvm::GlobalValue *GV) const;

1795

1796 llvm::Constant *GetOrCreateLLVMFunction(

1797 StringRef MangledName, llvm::Type *Ty, GlobalDecl D, bool ForVTable,

1798 bool DontDefer = false, bool IsThunk = false,

1799 llvm::AttributeList ExtraAttrs = llvm::AttributeList(),

1801

1802

1803 void AddDeferredMultiVersionResolverToEmit(GlobalDecl GD);

1804

1805

1806

1807

1808

1809

1810 llvm::Constant *GetOrCreateMultiVersionResolver(GlobalDecl GD);

1811

1812

1813

1814

1815

1816

1818 StringRef &CurName);

1819

1820 bool GetCPUAndFeaturesAttributes(GlobalDecl GD,

1821 llvm::AttrBuilder &AttrBuilder,

1822 bool SetTargetFeatures = true);

1823 void setNonAliasAttributes(GlobalDecl GD, llvm::GlobalObject *GO);

1824

1825

1826 void SetFunctionAttributes(GlobalDecl GD, llvm::Function *F,

1827 bool IsIncompleteFunction, bool IsThunk);

1828

1829 void EmitGlobalDefinition(GlobalDecl D, llvm::GlobalValue *GV = nullptr);

1830

1831 void EmitGlobalFunctionDefinition(GlobalDecl GD, llvm::GlobalValue *GV);

1832 void EmitMultiVersionFunctionDefinition(GlobalDecl GD, llvm::GlobalValue *GV);

1833

1834 void EmitGlobalVarDefinition(const VarDecl *D, bool IsTentative = false);

1835 void EmitExternalVarDeclaration(const VarDecl *D);

1836 void EmitExternalFunctionDeclaration(const FunctionDecl *D);

1837 void EmitAliasDefinition(GlobalDecl GD);

1838 void emitIFuncDefinition(GlobalDecl GD);

1839 void emitCPUDispatchDefinition(GlobalDecl GD);

1842

1843

1844

1845 void EmitDeclContext(const DeclContext *DC);

1848

1849

1850 void EmitCXXThreadLocalInitFunc();

1851

1852

1853 void EmitCXXModuleInitFunc(clang::Module *Primary);

1854

1855

1856 void EmitCXXGlobalInitFunc();

1857

1858

1859 void EmitCXXGlobalCleanUpFunc();

1860

1861

1862

1863 void EmitCXXGlobalVarDeclInitFunc(const VarDecl *D,

1864 llvm::GlobalVariable *Addr,

1865 bool PerformInit);

1866

1867 void EmitPointerToInitFunc(const VarDecl *VD, llvm::GlobalVariable *Addr,

1868 llvm::Function *InitFunc, InitSegAttr *ISA);

1869

1870

1871

1872

1873 void EmitCtorList(CtorList &Fns, const char *GlobalName);

1874

1875

1876 void EmitDeferred();

1877

1878

1879

1880

1881

1882 void EmitVTablesOpportunistically();

1883

1884

1885 void applyReplacements();

1886

1887

1888 void applyGlobalValReplacements();

1889

1890 void checkAliases();

1891

1892 std::map<int, llvm::TinyPtrVector<llvm::Function *>> DtorsUsingAtExit;

1893

1894

1895

1896 void registerGlobalDtorsWithAtExit();

1897

1898

1899

1900

1901 void unregisterGlobalDtorsWithUnAtExit();

1902

1903

1904 void emitMultiVersionFunctions();

1905

1906

1907 void EmitDeferredVTables();

1908

1909

1910

1911 void emitAtAvailableLinkGuard();

1912

1913

1914 void emitLLVMUsed();

1915

1916

1917 void EmitModuleInitializers(clang::Module *Primary);

1918

1919

1920 void EmitModuleLinkOptions();

1921

1922

1923

1924

1925

1926

1927

1928

1929 bool CheckAndReplaceExternCIFuncs(llvm::GlobalValue *Elem,

1930 llvm::GlobalValue *CppFunc);

1931

1932

1933

1934 void EmitStaticExternCAliases();

1935

1936 void EmitDeclMetadata();

1937

1938

1939 void EmitVersionIdentMetadata();

1940

1941

1942 void EmitCommandLineMetadata();

1943

1944

1945

1946 void EmitBackendOptionsMetadata(const CodeGenOptions &CodeGenOpts);

1947

1948

1949 void EmitOpenCLMetadata();

1950

1951

1952

1953 void EmitCoverageFile();

1954

1955

1956

1957 bool MustBeEmitted(const ValueDecl *D);

1958

1959

1960

1961

1962

1963 bool MayBeEmittedEagerly(const ValueDecl *D);

1964

1965

1966

1967 void SimplifyPersonality();

1968

1969

1970

1971 void getTrivialDefaultFunctionAttributes(StringRef Name, bool HasOptnone,

1972 bool AttrOnCallSite,

1973 llvm::AttrBuilder &FuncAttrs);

1974

1975

1976

1977

1978 void getDefaultFunctionAttributes(StringRef Name, bool HasOptnone,

1979 bool AttrOnCallSite,

1980 llvm::AttrBuilder &FuncAttrs);

1981

1982 llvm::Metadata *CreateMetadataIdentifierImpl(QualType T, MetadataTypeMap &Map,

1983 StringRef Suffix);

1984};

1985

1986}

1987}

1988

1989#endif

Enums/classes describing ABI related information about constructors, destructors and thunks.

enum clang::sema::@1726::IndirectLocalPathEntry::EntryKind Kind

Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....

This file defines OpenMP nodes for declarative directives.

llvm::DenseSet< const void * > Visited

Defines the clang::LangOptions interface.

llvm::MachO::Target Target

llvm::MachO::Record Record

Defines a utilitiy for warning once when close to out of stack space.

__DEVICE__ void * memset(void *__a, int __b, size_t __c)

Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...

CharUnits getTypeSizeInChars(QualType T) const

Return the size of the specified (complete) type T, in characters.

Attr - This represents one attribute.

Represents a block literal declaration, which is like an unnamed FunctionDecl.

BlockExpr - Adaptor class for mixing a BlockDecl with expressions.

Represents a C++ destructor within a class.

Represents a C++ struct/union/class.

const CXXBaseSpecifier *const * path_const_iterator

CharUnits - This is an opaque type for sizes expressed in character units.

QuantityType getQuantity() const

getQuantity - Get the raw integer representation of this quantity.

CodeGenOptions - Track various options which control how the code is optimized and passed to the back...

ABIInfo - Target specific hooks for defining how a type should be passed or returned from functions.

Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this ...

A pair of helper functions for a __block variable.

virtual ~BlockByrefHelpers()

void Profile(llvm::FoldingSetNodeID &id) const

virtual void emitCopy(CodeGenFunction &CGF, Address dest, Address src)=0

BlockByrefHelpers(CharUnits alignment)

virtual bool needsCopy() const

llvm::Constant * CopyHelper

CharUnits Alignment

The alignment of the field.

virtual void emitDispose(CodeGenFunction &CGF, Address field)=0

BlockByrefHelpers(const BlockByrefHelpers &)=default

virtual bool needsDispose() const

llvm::Constant * DisposeHelper

virtual void profileImpl(llvm::FoldingSetNodeID &id) const =0

Implements C++ ABI-specific code generation functions.

Abstract information about a function or function prototype.

This class gathers all debug information during compilation and is responsible for emitting to llvm g...

CGFunctionInfo - Class to encapsulate the information about a function definition.

Implements runtime-specific code generation functions.

CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...

This class organizes the cross-function state that is used while generating LLVM code.

StringRef getBlockMangledName(GlobalDecl GD, const BlockDecl *BD)

llvm::FunctionCallee getBlockObjectAssign()

const PreprocessorOptions & getPreprocessorOpts() const

ConstantAddress GetAddrOfMSGuidDecl(const MSGuidDecl *GD)

Get the address of a GUID.

void AddCXXPrioritizedStermFinalizerEntry(llvm::Function *StermFinalizer, int Priority)

void setGVProperties(llvm::GlobalValue *GV, GlobalDecl GD) const

Set visibility, dllimport/dllexport and dso_local.

void AddCXXDtorEntry(llvm::FunctionCallee DtorFn, llvm::Constant *Object)

Add a destructor and object to add to the C++ global destructor function.

llvm::FoldingSet< BlockByrefHelpers > ByrefHelpersCache

void AddVTableTypeMetadata(llvm::GlobalVariable *VTable, CharUnits Offset, const CXXRecordDecl *RD)

Create and attach type metadata for the given vtable.

void UpdateCompletedType(const TagDecl *TD)

void handleCUDALaunchBoundsAttr(llvm::Function *F, const CUDALaunchBoundsAttr *A, int32_t *MaxThreadsVal=nullptr, int32_t *MinBlocksVal=nullptr, int32_t *MaxClusterRankVal=nullptr)

Emit the IR encoding to attach the CUDA launch bounds attribute to F.

llvm::MDNode * getTBAAAccessTagInfo(TBAAAccessInfo Info)

getTBAAAccessTagInfo - Get TBAA tag for a given memory access.

llvm::MDNode * getNoObjCARCExceptionsMetadata()

void AddCXXStermFinalizerToGlobalDtor(llvm::Function *StermFinalizer, int Priority)

Add an sterm finalizer to its own llvm.global_dtors entry.

llvm::GlobalVariable::ThreadLocalMode GetDefaultLLVMTLSModel() const

Get LLVM TLS mode from CodeGenOptions.

void EmitExplicitCastExprType(const ExplicitCastExpr *E, CodeGenFunction *CGF=nullptr)

Emit type info if type of an expression is a variably modified type.

void SetInternalFunctionAttributes(GlobalDecl GD, llvm::Function *F, const CGFunctionInfo &FI)

Set the attributes on the LLVM function for the given decl and function info.

void setDSOLocal(llvm::GlobalValue *GV) const

llvm::GlobalObject::VCallVisibility GetVCallVisibilityLevel(const CXXRecordDecl *RD, llvm::DenseSet< const CXXRecordDecl * > &Visited)

Returns the vcall visibility of the given type.

llvm::MDNode * getTBAAStructInfo(QualType QTy)

CGHLSLRuntime & getHLSLRuntime()

Return a reference to the configured HLSL runtime.

llvm::Constant * EmitAnnotationArgs(const AnnotateAttr *Attr)

Emit additional args of the annotation.

llvm::Module & getModule() const

llvm::FunctionCallee CreateRuntimeFunction(llvm::FunctionType *Ty, StringRef Name, llvm::AttributeList ExtraAttrs=llvm::AttributeList(), bool Local=false, bool AssumeConvergent=false)

Create or return a runtime function declaration with the specified type and name.

CGDebugInfo * getModuleDebugInfo()

ConstantAddress GetAddrOfConstantCompoundLiteral(const CompoundLiteralExpr *E)

Returns a pointer to a constant global variable for the given file-scope compound literal expression.

void setLLVMFunctionFEnvAttributes(const FunctionDecl *D, llvm::Function *F)

Set the LLVM function attributes that represent floating point environment.

bool NeedAllVtablesTypeId() const

Returns whether this module needs the "all-vtables" type identifier.

void addCompilerUsedGlobal(llvm::GlobalValue *GV)

Add a global to a list to be added to the llvm.compiler.used metadata.

CodeGenVTables & getVTables()

CtorList & getGlobalDtors()

llvm::ConstantInt * CreateCrossDsoCfiTypeId(llvm::Metadata *MD)

Generate a cross-DSO type identifier for MD.

void setStaticLocalDeclAddress(const VarDecl *D, llvm::Constant *C)

llvm::Constant * EmitNullConstantForBase(const CXXRecordDecl *Record)

Return a null constant appropriate for zero-initializing a base class with the given type.

llvm::Function * getLLVMLifetimeStartFn()

Lazily declare the @llvm.lifetime.start intrinsic.

CharUnits GetTargetTypeStoreSize(llvm::Type *Ty) const

Return the store size, in character units, of the given LLVM type.

void handleAMDGPUWavesPerEUAttr(llvm::Function *F, const AMDGPUWavesPerEUAttr *A)

Emit the IR encoding to attach the AMD GPU waves-per-eu attribute to F.

void AddCXXStermFinalizerEntry(llvm::FunctionCallee DtorFn)

Add an sterm finalizer to the C++ global cleanup function.

void setTypeDescriptorInMap(QualType Ty, llvm::Constant *C)

bool getExpressionLocationsEnabled() const

Return true if we should emit location information for expressions.

CharUnits getMinimumClassObjectSize(const CXXRecordDecl *CD)

Returns the minimum object size for an object of the given class type (or a class derived from it).

void addGlobalValReplacement(llvm::GlobalValue *GV, llvm::Constant *C)

llvm::Constant * getRawFunctionPointer(GlobalDecl GD, llvm::Type *Ty=nullptr)

Return a function pointer for a reference to the given function.

llvm::FunctionCallee getAddrAndTypeOfCXXStructor(GlobalDecl GD, const CGFunctionInfo *FnInfo=nullptr, llvm::FunctionType *FnType=nullptr, bool DontDefer=false, ForDefinition_t IsForDefinition=NotForDefinition)

llvm::Constant * GetAddrOfRTTIDescriptor(QualType Ty, bool ForEH=false)

Get the address of the RTTI descriptor for the given type.

llvm::Constant * GetAddrOfFunction(GlobalDecl GD, llvm::Type *Ty=nullptr, bool ForVTable=false, bool DontDefer=false, ForDefinition_t IsForDefinition=NotForDefinition)

Return the address of the given function.

Address createUnnamedGlobalFrom(const VarDecl &D, llvm::Constant *Constant, CharUnits Align)

void setGVPropertiesAux(llvm::GlobalValue *GV, const NamedDecl *D) const

llvm::Constant * getFunctionPointer(GlobalDecl GD, llvm::Type *Ty=nullptr)

Return the ABI-correct function pointer value for a reference to the given function.

const IntrusiveRefCntPtr< llvm::vfs::FileSystem > & getFileSystem() const

void setAddrOfGlobalBlock(const BlockExpr *BE, llvm::Constant *Addr)

Notes that BE's global block is available via Addr.

const ABIInfo & getABIInfo()

void setStaticLocalDeclGuardAddress(const VarDecl *D, llvm::GlobalVariable *C)

bool ReturnTypeUsesFPRet(QualType ResultType)

Return true iff the given type uses 'fpret' when used as a return type.

void EmitMainVoidAlias()

Emit an alias for "main" if it has no arguments (needed for wasm).

void DecorateInstructionWithInvariantGroup(llvm::Instruction *I, const CXXRecordDecl *RD)

Adds !invariant.barrier !tag to instruction.

llvm::Constant * getBuiltinLibFunction(const FunctionDecl *FD, unsigned BuiltinID)

Given a builtin id for a function like "__builtin_fabsf", return a Function* for "fabsf".

DiagnosticsEngine & getDiags() const

bool isInNoSanitizeList(SanitizerMask Kind, llvm::Function *Fn, SourceLocation Loc) const

void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)

Run some code with "sufficient" stack space.

llvm::Constant * getAddrOfCXXStructor(GlobalDecl GD, const CGFunctionInfo *FnInfo=nullptr, llvm::FunctionType *FnType=nullptr, bool DontDefer=false, ForDefinition_t IsForDefinition=NotForDefinition)

Return the address of the constructor/destructor of the given type.

bool isPaddedAtomicType(QualType type)

llvm::Constant * getNullPointer(llvm::PointerType *T, QualType QT)

Get target specific null pointer.

void ErrorUnsupported(const Stmt *S, const char *Type)

Print out an error that codegen doesn't support the specified stmt yet.

llvm::Constant * EmitAnnotateAttr(llvm::GlobalValue *GV, const AnnotateAttr *AA, SourceLocation L)

Generate the llvm::ConstantStruct which contains the annotation information for a given GlobalValue.

llvm::GlobalValue::LinkageTypes getLLVMLinkageForDeclarator(const DeclaratorDecl *D, GVALinkage Linkage)

Returns LLVM linkage for a declarator.

TBAAAccessInfo mergeTBAAInfoForMemoryTransfer(TBAAAccessInfo DestInfo, TBAAAccessInfo SrcInfo)

mergeTBAAInfoForMemoryTransfer - Get merged TBAA information for the purposes of memory transfer call...

llvm::Type * getBlockDescriptorType()

Fetches the type of a generic block descriptor.

llvm::Constant * GetAddrOfGlobalBlock(const BlockExpr *BE, StringRef Name)

Gets the address of a block which requires no captures.

llvm::Constant * getAtomicGetterHelperFnMap(QualType Ty)

CGPointerAuthInfo getMemberFunctionPointerAuthInfo(QualType FT)

const LangOptions & getLangOpts() const

CGCUDARuntime & getCUDARuntime()

Return a reference to the configured CUDA runtime.

int getUniqueBlockCount()

Fetches the global unique block count.

llvm::Constant * EmitAnnotationLineNo(SourceLocation L)

Emit the annotation line number.

QualType getObjCFastEnumerationStateType()

Retrieve the record type that describes the state of an Objective-C fast enumeration loop (for....

CtorList & getGlobalCtors()

CharUnits getNaturalTypeAlignment(QualType T, LValueBaseInfo *BaseInfo=nullptr, TBAAAccessInfo *TBAAInfo=nullptr, bool forPointeeType=false)

CodeGenTypes & getTypes()

bool shouldMapVisibilityToDLLExport(const NamedDecl *D) const

CGOpenCLRuntime & getOpenCLRuntime()

Return a reference to the configured OpenCL runtime.

const std::string & getModuleNameHash() const

const TargetInfo & getTarget() const

bool shouldEmitRTTI(bool ForEH=false)

void EmitGlobal(GlobalDecl D)

Emit code for a single global function or var decl.

llvm::GlobalVariable * getStaticLocalDeclGuardAddress(const VarDecl *D)

llvm::ConstantInt * getPointerAuthOtherDiscriminator(const PointerAuthSchema &Schema, GlobalDecl SchemaDecl, QualType SchemaType)

Given a pointer-authentication schema, return a concrete "other" discriminator for it.

llvm::Metadata * CreateMetadataIdentifierForType(QualType T)

Create a metadata identifier for the given type.

llvm::Constant * getTypeDescriptorFromMap(QualType Ty)

llvm::IndexedInstrProfReader * getPGOReader() const

void addUsedGlobal(llvm::GlobalValue *GV)

Add a global to a list to be added to the llvm.used metadata.

void handleAMDGPUFlatWorkGroupSizeAttr(llvm::Function *F, const AMDGPUFlatWorkGroupSizeAttr *A, const ReqdWorkGroupSizeAttr *ReqdWGS=nullptr, int32_t *MinThreadsVal=nullptr, int32_t *MaxThreadsVal=nullptr)

Emit the IR encoding to attach the AMD GPU flat-work-group-size attribute to F.

void AppendLinkerOptions(StringRef Opts)

Appends Opts to the "llvm.linker.options" metadata value.

bool hasObjCRuntime()

Return true iff an Objective-C runtime has been configured.

void EmitExternalDeclaration(const DeclaratorDecl *D)

void AddDependentLib(StringRef Lib)

Appends a dependent lib to the appropriate metadata value.

void Release()

Finalize LLVM code generation.

llvm::FunctionCallee IsOSVersionAtLeastFn

ProfileList::ExclusionType isFunctionBlockedByProfileList(llvm::Function *Fn, SourceLocation Loc) const

CGPointerAuthInfo getPointerAuthInfoForPointeeType(QualType type)

llvm::MDNode * getTBAABaseTypeInfo(QualType QTy)

getTBAABaseTypeInfo - Get metadata that describes the given base access type.

CGPointerAuthInfo EmitPointerAuthInfo(const RecordDecl *RD)

void EmitVTableTypeMetadata(const CXXRecordDecl *RD, llvm::GlobalVariable *VTable, const VTableLayout &VTLayout)

Emit type metadata for the given vtable using the given layout.

bool lookupRepresentativeDecl(StringRef MangledName, GlobalDecl &Result) const

void EmitOMPAllocateDecl(const OMPAllocateDecl *D)

Emit a code for the allocate directive.

void setGlobalVisibility(llvm::GlobalValue *GV, const NamedDecl *D) const

Set the visibility for the given LLVM GlobalValue.

CoverageMappingModuleGen * getCoverageMapping() const

llvm::Constant * GetNonVirtualBaseClassOffset(const CXXRecordDecl *ClassDecl, CastExpr::path_const_iterator PathBegin, CastExpr::path_const_iterator PathEnd)

Returns the offset from a derived class to a class.

bool TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D)

Try to emit a base destructor as an alias to its primary base-class destructor.

llvm::GlobalValue::LinkageTypes getLLVMLinkageVarDefinition(const VarDecl *VD)

Returns LLVM linkage for a declarator.

llvm::Constant * getMemberPointerConstant(const UnaryOperator *e)

bool HasHiddenLTOVisibility(const CXXRecordDecl *RD)

Returns whether the given record has hidden LTO visibility and therefore may participate in (single-m...

const llvm::DataLayout & getDataLayout() const

llvm::Constant * getNSConcreteGlobalBlock()

void addUndefinedGlobalForTailCall(std::pair< const FunctionDecl *, SourceLocation > Global)

CharUnits computeNonVirtualBaseClassOffset(const CXXRecordDecl *DerivedClass, CastExpr::path_const_iterator Start, CastExpr::path_const_iterator End)

ObjCEntrypoints & getObjCEntrypoints() const

TBAAAccessInfo getTBAAVTablePtrAccessInfo(llvm::Type *VTablePtrType)

getTBAAVTablePtrAccessInfo - Get the TBAA information that describes an access to a virtual table poi...

bool shouldEmitConvergenceTokens() const

CGCXXABI & getCXXABI() const

ConstantAddress GetWeakRefReference(const ValueDecl *VD)

Get a reference to the target of VD.

CGPointerAuthInfo getFunctionPointerAuthInfo(QualType T)

Return the abstract pointer authentication schema for a pointer to the given function type.

CharUnits getVBaseAlignment(CharUnits DerivedAlign, const CXXRecordDecl *Derived, const CXXRecordDecl *VBase)

Returns the assumed alignment of a virtual base of a class.

llvm::Constant * GetFunctionStart(const ValueDecl *Decl)

llvm::GlobalVariable * getAddrOfConstantCompoundLiteralIfEmitted(const CompoundLiteralExpr *E)

If it's been emitted already, returns the GlobalVariable corresponding to a compound literal.

static llvm::GlobalValue::VisibilityTypes GetLLVMVisibility(Visibility V)

void EmitTentativeDefinition(const VarDecl *D)

bool ReturnTypeUsesFP2Ret(QualType ResultType)

Return true iff the given type uses 'fp2ret' when used as a return type.

void EmitDeferredUnusedCoverageMappings()

Emit all the deferred coverage mappings for the uninstrumented functions.

void addUsedOrCompilerUsedGlobal(llvm::GlobalValue *GV)

Add a global to a list to be added to the llvm.compiler.used metadata.

CGOpenMPRuntime & getOpenMPRuntime()

Return a reference to the configured OpenMP runtime.

bool imbueXRayAttrs(llvm::Function *Fn, SourceLocation Loc, StringRef Category=StringRef()) const

Imbue XRay attributes to a function, applying the always/never attribute lists in the process.

llvm::Constant * getMemberFunctionPointer(const FunctionDecl *FD, llvm::Type *Ty=nullptr)

SanitizerMetadata * getSanitizerMetadata()

llvm::Metadata * CreateMetadataIdentifierGeneralized(QualType T)

Create a metadata identifier for the generalization of the given type.

void EmitGlobalAnnotations()

Emit all the global annotations.

llvm::Constant * getAddrOfGlobalBlockIfEmitted(const BlockExpr *BE)

Returns the address of a block which requires no caputres, or null if we've yet to emit the block for...

std::optional< PointerAuthQualifier > getVTablePointerAuthentication(const CXXRecordDecl *thisClass)

llvm::Function * codegenCXXStructor(GlobalDecl GD)

CharUnits getClassPointerAlignment(const CXXRecordDecl *CD)

Returns the assumed alignment of an opaque pointer to the given class.

const llvm::Triple & getTriple() const

void setAtomicSetterHelperFnMap(QualType Ty, llvm::Constant *Fn)

llvm::Constant * getOrCreateStaticVarDecl(const VarDecl &D, llvm::GlobalValue::LinkageTypes Linkage)

SmallVector< const CXXRecordDecl *, 0 > getMostBaseClasses(const CXXRecordDecl *RD)

Return a vector of most-base classes for RD.

void AddDeferredUnusedCoverageMapping(Decl *D)

Stored a deferred empty coverage mapping for an unused and thus uninstrumented top level declaration.

bool AlwaysHasLTOVisibilityPublic(const CXXRecordDecl *RD)

Returns whether the given record has public LTO visibility (regardless of -lto-whole-program-visibili...

void MaybeHandleStaticInExternC(const SomeDecl *D, llvm::GlobalValue *GV)

If the declaration has internal linkage but is inside an extern "C" linkage specification,...

void DecorateInstructionWithTBAA(llvm::Instruction *Inst, TBAAAccessInfo TBAAInfo)

DecorateInstructionWithTBAA - Decorate the instruction with a TBAA tag.

uint16_t getPointerAuthDeclDiscriminator(GlobalDecl GD)

Return the "other" decl-specific discriminator for the given decl.

llvm::Constant * getAtomicSetterHelperFnMap(QualType Ty)

TBAAAccessInfo getTBAAInfoForSubobject(LValue Base, QualType AccessType)

getTBAAInfoForSubobject - Get TBAA information for an access with a given base lvalue.

bool shouldUseTBAA() const

llvm::GlobalVariable::LinkageTypes getFunctionLinkage(GlobalDecl GD)

void AddGlobalDtor(llvm::Function *Dtor, int Priority=65535, bool IsDtorAttrFunc=false)

AddGlobalDtor - Add a function to the list that will be called when the module is unloaded.

bool ReturnSlotInterferesWithArgs(const CGFunctionInfo &FI)

Return true iff the given type uses an argument slot when 'sret' is used as a return type.

bool ReturnTypeHasInReg(const CGFunctionInfo &FI)

Return true iff the given type has inreg set.

void EmitVTable(CXXRecordDecl *Class)

This is a callback from Sema to tell us that a particular vtable is required to be emitted in this tr...

llvm::Constant * CreateRuntimeVariable(llvm::Type *Ty, StringRef Name)

Create a new runtime global variable with the specified type and name.

void AdjustMemoryAttribute(StringRef Name, CGCalleeInfo CalleeInfo, llvm::AttributeList &Attrs)

Adjust Memory attribute to ensure that the BE gets the right attribute.

void ConstructAttributeList(StringRef Name, const CGFunctionInfo &Info, CGCalleeInfo CalleeInfo, llvm::AttributeList &Attrs, unsigned &CallingConv, bool AttrOnCallSite, bool IsThunk)

Get the LLVM attributes and calling convention to use for a particular function type.

CharUnits getDynamicOffsetAlignment(CharUnits ActualAlign, const CXXRecordDecl *Class, CharUnits ExpectedTargetAlign)

Given a class pointer with an actual known alignment, and the expected alignment of an object at a dy...

llvm::Constant * GetOrCreateLLVMGlobal(StringRef MangledName, llvm::Type *Ty, LangAS AddrSpace, const VarDecl *D, ForDefinition_t IsForDefinition=NotForDefinition)

GetOrCreateLLVMGlobal - If the specified mangled name is not in the module, create and return an llvm...

TBAAAccessInfo getTBAAAccessInfo(QualType AccessType)

getTBAAAccessInfo - Get TBAA information that describes an access to an object of the given type.

void setFunctionLinkage(GlobalDecl GD, llvm::Function *F)

llvm::Constant * GetAddrOfGlobal(GlobalDecl GD, ForDefinition_t IsForDefinition=NotForDefinition)

ConstantAddress GetAddrOfConstantCFString(const StringLiteral *Literal)

Return a pointer to a constant CFString object for the given string.

InstrProfStats & getPGOStats()

ProfileList::ExclusionType isFunctionBlockedFromProfileInstr(llvm::Function *Fn, SourceLocation Loc) const

void AddGlobalAnnotations(const ValueDecl *D, llvm::GlobalValue *GV)

Add global annotations that are set on D, for the global GV.

void setTLSMode(llvm::GlobalValue *GV, const VarDecl &D) const

Set the TLS mode for the given LLVM GlobalValue for the thread-local variable declaration D.

ItaniumVTableContext & getItaniumVTableContext()

ConstantAddress GetAddrOfConstantStringFromLiteral(const StringLiteral *S, StringRef Name=".str")

Return a pointer to a constant array for the given string literal.

ASTContext & getContext() const

ConstantAddress GetAddrOfTemplateParamObject(const TemplateParamObjectDecl *TPO)

Get the address of a template parameter object.

void EmitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D)

Emit a code for threadprivate directive.

llvm::Constant * getNSConcreteStackBlock()

ConstantAddress GetAddrOfUnnamedGlobalConstantDecl(const UnnamedGlobalConstantDecl *GCD)

Get the address of a UnnamedGlobalConstant.

TBAAAccessInfo mergeTBAAInfoForCast(TBAAAccessInfo SourceInfo, TBAAAccessInfo TargetInfo)

mergeTBAAInfoForCast - Get merged TBAA information for the purposes of type casts.

llvm::Constant * GetAddrOfGlobalVar(const VarDecl *D, llvm::Type *Ty=nullptr, ForDefinition_t IsForDefinition=NotForDefinition)

Return the llvm::Constant for the address of the given global variable.

MicrosoftVTableContext & getMicrosoftVTableContext()

const HeaderSearchOptions & getHeaderSearchOpts() const

llvm::SanitizerStatReport & getSanStats()

llvm::Constant * EmitAnnotationString(StringRef Str)

Emit an annotation string.

llvm::Type * getVTableComponentType() const

void EmitOMPDeclareMapper(const OMPDeclareMapperDecl *D, CodeGenFunction *CGF=nullptr)

Emit a code for declare mapper construct.

llvm::Function * getLLVMLifetimeEndFn()

Lazily declare the @llvm.lifetime.end intrinsic.

bool supportsCOMDAT() const

void RefreshTypeCacheForClass(const CXXRecordDecl *Class)

llvm::MDNode * getTBAATypeInfo(QualType QTy)

getTBAATypeInfo - Get metadata used to describe accesses to objects of the given type.

void setAddrOfConstantCompoundLiteral(const CompoundLiteralExpr *CLE, llvm::GlobalVariable *GV)

Notes that CLE's GlobalVariable is GV.

void EmitOMPRequiresDecl(const OMPRequiresDecl *D)

Emit a code for requires directive.

void HandleCXXStaticMemberVarInstantiation(VarDecl *VD)

Tell the consumer that this variable has been instantiated.

bool ReturnTypeUsesSRet(const CGFunctionInfo &FI)

Return true iff the given type uses 'sret' when used as a return type.

const TargetCodeGenInfo & getTargetCodeGenInfo()

const CodeGenOptions & getCodeGenOpts() const

StringRef getMangledName(GlobalDecl GD)

llvm::Constant * GetConstantArrayFromStringLiteral(const StringLiteral *E)

Return a constant array for the given string.

void SetCommonAttributes(GlobalDecl GD, llvm::GlobalValue *GV)

Set attributes which are common to any form of a global definition (alias, Objective-C method,...

void addDefaultFunctionDefinitionAttributes(llvm::AttrBuilder &attrs)

Like the overload taking a Function &, but intended specifically for frontends that want to build on ...

std::optional< CharUnits > getOMPAllocateAlignment(const VarDecl *VD)

Return the alignment specified in an allocate directive, if present.

llvm::GlobalVariable * CreateOrReplaceCXXRuntimeVariable(StringRef Name, llvm::Type *Ty, llvm::GlobalValue::LinkageTypes Linkage, llvm::Align Alignment)

Will return a global variable of the given type.

llvm::FunctionCallee getTerminateFn()

Get the declaration of std::terminate for the platform.

CharUnits getNaturalPointeeTypeAlignment(QualType T, LValueBaseInfo *BaseInfo=nullptr, TBAAAccessInfo *TBAAInfo=nullptr)

llvm::FunctionCallee getBlockObjectDispose()

TBAAAccessInfo mergeTBAAInfoForConditionalOperator(TBAAAccessInfo InfoA, TBAAAccessInfo InfoB)

mergeTBAAInfoForConditionalOperator - Get merged TBAA information for the purposes of conditional ope...

llvm::LLVMContext & getLLVMContext()

llvm::GlobalValue * GetGlobalValue(StringRef Ref)

bool shouldZeroInitPadding() const

void GenKernelArgMetadata(llvm::Function *FN, const FunctionDecl *FD=nullptr, CodeGenFunction *CGF=nullptr)

OpenCL v1.2 s5.6.4.6 allows the compiler to store kernel argument information in the program executab...

void CreateFunctionTypeMetadataForIcall(const FunctionDecl *FD, llvm::Function *F)

Create and attach type metadata to the given function.

void setKCFIType(const FunctionDecl *FD, llvm::Function *F)

Set type metadata to the given function.

void setAtomicGetterHelperFnMap(QualType Ty, llvm::Constant *Fn)

void maybeSetTrivialComdat(const Decl &D, llvm::GlobalObject &GO)

void EmitOMPDeclareReduction(const OMPDeclareReductionDecl *D, CodeGenFunction *CGF=nullptr)

Emit a code for declare reduction construct.

const ItaniumVTableContext & getItaniumVTableContext() const

llvm::Function * getIntrinsic(unsigned IID, ArrayRef< llvm::Type * > Tys={})

void AddDetectMismatch(StringRef Name, StringRef Value)

Appends a detect mismatch command to the linker options.

void setDLLImportDLLExport(llvm::GlobalValue *GV, GlobalDecl D) const

CGObjCRuntime & getObjCRuntime()

Return a reference to the configured Objective-C runtime.

llvm::Value * createOpenCLIntToSamplerConversion(const Expr *E, CodeGenFunction &CGF)

ConstantAddress GetAddrOfGlobalTemporary(const MaterializeTemporaryExpr *E, const Expr *Inner)

Returns a pointer to a global variable representing a temporary with static or thread storage duratio...

llvm::Constant * EmitNullConstant(QualType T)

Return the result of value-initializing the given type, i.e.

LangAS GetGlobalConstantAddressSpace() const

Return the AST address space of constant literal, which is used to emit the constant literal as globa...

LangAS GetGlobalVarAddressSpace(const VarDecl *D)

Return the AST address space of the underlying global variable for D, as determined by its declaratio...

llvm::GlobalVariable::LinkageTypes getVTableLinkage(const CXXRecordDecl *RD)

Return the appropriate linkage for the vtable, VTT, and type information of the given class.

void SetLLVMFunctionAttributes(GlobalDecl GD, const CGFunctionInfo &Info, llvm::Function *F, bool IsThunk)

Set the LLVM function attributes (sext, zext, etc).

void addDeferredVTable(const CXXRecordDecl *RD)

llvm::Type * getGenericBlockLiteralType()

The type of a generic block literal.

CharUnits getMinimumObjectSize(QualType Ty)

Returns the minimum object size for an object of the given type.

void addReplacement(StringRef Name, llvm::Constant *C)

llvm::ConstantInt * CreateKCFITypeId(QualType T)

Generate a KCFI type identifier for T.

std::optional< CGPointerAuthInfo > getVTablePointerAuthInfo(CodeGenFunction *Context, const CXXRecordDecl *Record, llvm::Value *StorageAddress)

llvm::Constant * getConstantSignedPointer(llvm::Constant *Pointer, const PointerAuthSchema &Schema, llvm::Constant *StorageAddress, GlobalDecl SchemaDecl, QualType SchemaType)

Sign a constant pointer using the given scheme, producing a constant with the same IR type.

llvm::FunctionCallee IsPlatformVersionAtLeastFn

void AddGlobalCtor(llvm::Function *Ctor, int Priority=65535, unsigned LexOrder=~0U, llvm::Constant *AssociatedData=nullptr)

AddGlobalCtor - Add a function to the list that will be called before main() runs.

bool shouldSignPointer(const PointerAuthSchema &Schema)

Does a given PointerAuthScheme require us to sign a value.

void SetLLVMFunctionAttributesForDefinition(const Decl *D, llvm::Function *F)

Set the LLVM function attributes which only apply to a function definition.

llvm::Metadata * CreateMetadataIdentifierForVirtualMemPtrType(QualType T)

Create a metadata identifier that is intended to be used to check virtual calls via a member function...

llvm::Constant * getStaticLocalDeclAddress(const VarDecl *D)

bool MayDropFunctionReturn(const ASTContext &Context, QualType ReturnType) const

Whether this function's return type has no side effects, and thus may be trivially discarded if it is...

ConstantAddress GetAddrOfConstantStringFromObjCEncode(const ObjCEncodeExpr *)

Return a pointer to a constant array for the given ObjCEncodeExpr node.

const GlobalDecl getMangledNameDecl(StringRef)

void ClearUnusedCoverageMapping(const Decl *D)

Remove the deferred empty coverage mapping as this declaration is actually instrumented.

void EmitTopLevelDecl(Decl *D)

Emit code for a single top level declaration.

llvm::Function * CreateGlobalInitOrCleanUpFunction(llvm::FunctionType *ty, const Twine &name, const CGFunctionInfo &FI, SourceLocation Loc=SourceLocation(), bool TLS=false, llvm::GlobalVariable::LinkageTypes Linkage=llvm::GlobalVariable::InternalLinkage)

llvm::Constant * EmitAnnotationUnit(SourceLocation Loc)

Emit the annotation's translation unit.

CGPointerAuthInfo getPointerAuthInfoForType(QualType type)

ConstantAddress GetAddrOfConstantCString(const std::string &Str, const char *GlobalName=nullptr)

Returns a pointer to a character array containing the literal and a terminating '\0' character.

std::vector< Structor > CtorList

void printPostfixForExternalizedDecl(llvm::raw_ostream &OS, const Decl *D) const

Print the postfix for externalized static variable or kernels for single source offloading languages ...

llvm::Constant * GetAddrOfThunk(StringRef Name, llvm::Type *FnTy, GlobalDecl GD)

Get the address of the thunk for the given global decl.

void moveLazyEmissionStates(CodeGenModule *NewBuilder)

Move some lazily-emitted states to the NewBuilder.

llvm::ConstantInt * getSize(CharUnits numChars)

Emit the given number of characters as a value of type size_t.

void finalizeKCFITypes()

Emit KCFI type identifier constants and remove unused identifiers.

This class organizes the cross-module state that is used while lowering AST types to LLVM types.

ItaniumVTableContext & getItaniumVTableContext()

MicrosoftVTableContext & getMicrosoftVTableContext()

A specialization of Address that requires the address to be an LLVM Constant.

ValueOpt(unsigned InitVal)

The Counter with an optional additional Counter for branches.

CounterPair(unsigned Val)

May be None.

Organizes the cross-function state that is used while generating code coverage mapping data.

This class records statistics on instrumentation based profiling.

bool hasDiagnostics()

Whether or not the stats we've gathered indicate any potential problems.

void addMissing(bool MainFile)

Record that a function we've visited has no profile data.

void addMismatched(bool MainFile)

Record that a function we've visited has mismatched profile data.

void addVisited(bool MainFile)

Record that we've visited a function and whether or not that function was in the main source file.

void reportDiagnostics(DiagnosticsEngine &Diags, StringRef MainFile)

Report potential problems we've found to Diags.

LValue - This represents an lvalue references.

TargetCodeGenInfo - This class organizes various target-specific codegeneration issues,...

CompoundLiteralExpr - [C99 6.5.2.5].

Stores additional source code information like skipped ranges which is required by the coverage mappi...

DeclContext - This is used only as base class of specific decl types that can act as declaration cont...

Decl - This represents one declaration (or definition), e.g.

Represents a ValueDecl that came out of a declarator.

Concrete class used by the front-end to report problems and issues.

ExplicitCastExpr - An explicit cast written in the source code.

This represents one expression.

Represents a function declaration or definition.

FunctionType - C99 6.7.5.3 - Function Declarators.

GlobalDecl - represents a global declaration.

const Decl * getDecl() const

Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...

bool hasDefaultVisibilityExportMapping() const

bool isExplicitDefaultVisibilityExportMapping() const

bool isAllDefaultVisibilityExportMapping() const

Represents a linkage specification.

Represents a prvalue temporary that is written into memory so that a reference can bind to it.

Describes a module or submodule.

This represents a decl that may have a name.

This represents '#pragma omp allocate ...' directive.

This represents '#pragma omp declare mapper ...' directive.

This represents '#pragma omp declare reduction ...' directive.

This represents '#pragma omp requires...' directive.

This represents '#pragma omp threadprivate ...' directive.

ObjCEncodeExpr, used for @encode in Objective-C.

ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...

The basic abstraction for the target Objective-C runtime.

PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...

ExclusionType

Represents if an how something should be excluded from profiling.

A (possibly-)qualified type.

Represents a struct/union/class.

Encodes a location in the source.

Stmt - This represents one statement.

StringLiteral - This represents a string literal expression, e.g.

Represents the declaration of a struct/union/class/enum.

Exposes information about the current target.

A template parameter object.

A declaration that models statements at global scope.

The base class of the type hierarchy.

CXXRecordDecl * getAsCXXRecordDecl() const

Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...

UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...

An artificial decl, representing a global anonymous constant value which is uniquified by value withi...

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.

Defines the clang::TargetInfo interface.

@ Decl

The l-value was an access to a declared entity or something equivalently strong, like the address of ...

const internal::VariadicAllOfMatcher< Type > type

Matches Types in the clang AST.

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

GVALinkage

A more specific kind of linkage than enum Linkage.

Linkage

Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.

@ Module

Module linkage, which indicates that the entity can be referred to from other translation units withi...

@ Result

The result type of a method or function.

LangAS

Defines the address space values used by the address space qualifier of QualType.

const FunctionProtoType * T

CallingConv

CallingConv - Specifies the calling convention that a function uses.

@ Class

The "class" keyword introduces the elaborated-type-specifier.

Visibility

Describes the different kinds of visibility that a declaration may have.

@ HiddenVisibility

Objects with "hidden" visibility are not seen by the dynamic linker.

@ ProtectedVisibility

Objects with "protected" visibility are seen by the dynamic linker but always dynamically resolve to ...

@ DefaultVisibility

Objects with "default" visibility are seen by the dynamic linker and act like normal objects.

Diagnostic wrappers for TextAPI types for error reporting.

llvm::Constant * Initializer

Structor(int Priority, unsigned LexOrder, llvm::Constant *Initializer, llvm::Constant *AssociatedData)

llvm::Constant * AssociatedData

This structure provides a set of types that are commonly used during IR emission.

llvm::Function * objc_retainAutoreleasedReturnValue

id objc_retainAutoreleasedReturnValue(id);

llvm::Function * objc_retainAutoreleaseReturnValue

id objc_retainAutoreleaseReturnValue(id);

llvm::FunctionCallee objc_alloc

void objc_alloc(id);

llvm::Function * objc_retain

id objc_retain(id);

llvm::FunctionCallee objc_alloc_init

void objc_alloc_init(id);

llvm::Function * objc_autorelease

id objc_autorelease(id);

llvm::Function * objc_moveWeak

void objc_moveWeak(id *dest, id *src);

llvm::FunctionCallee objc_autoreleasePoolPopInvoke

void objc_autoreleasePoolPop(void*); Note this method is used when we are using exception handling

llvm::InlineAsm * retainAutoreleasedReturnValueMarker

A void(void) inline asm to use to mark that the return value of a call will be immediately retain.

llvm::Function * clang_arc_use

void clang.arc.use(...);

llvm::Function * objc_initWeak

id objc_initWeak(id*, id);

llvm::FunctionCallee objc_retainRuntimeFunction

id objc_retain(id); Note this is the runtime method not the intrinsic.

llvm::Function * objc_copyWeak

void objc_copyWeak(id *dest, id *src);

llvm::Function * objc_destroyWeak

void objc_destroyWeak(id*);

llvm::Function * objc_retainAutorelease

id objc_retainAutorelease(id);

llvm::Function * objc_autoreleasePoolPush

void *objc_autoreleasePoolPush(void);

llvm::Function * objc_retainBlock

id objc_retainBlock(id);

llvm::Function * objc_storeStrong

void objc_storeStrong(id*, id);

llvm::Function * objc_loadWeak

id objc_loadWeak(id*);

llvm::Function * clang_arc_noop_use

void clang.arc.noop.use(...);

llvm::Function * objc_loadWeakRetained

id objc_loadWeakRetained(id*);

llvm::Function * objc_release

void objc_release(id);

llvm::FunctionCallee objc_autoreleaseRuntimeFunction

id objc_autorelease(id); Note this is the runtime method not the intrinsic.

llvm::Function * objc_autoreleaseReturnValue

id objc_autoreleaseReturnValue(id);

llvm::FunctionCallee objc_releaseRuntimeFunction

void objc_release(id); Note this is the runtime method not the intrinsic.

llvm::FunctionCallee objc_allocWithZone

void objc_allocWithZone(id);

llvm::FunctionCallee objc_autoreleasePoolPop

void objc_autoreleasePoolPop(void*);

llvm::Function * objc_storeWeak

id objc_storeWeak(id*, id);

llvm::Function * objc_unsafeClaimAutoreleasedReturnValue

id objc_unsafeClaimAutoreleasedReturnValue(id);

bool operator<(const OrderGlobalInitsOrStermFinalizers &RHS) const

bool operator==(const OrderGlobalInitsOrStermFinalizers &RHS) const

OrderGlobalInitsOrStermFinalizers(unsigned int p, unsigned int l)

static TBAAAccessInfo getMayAliasInfo()