29#include "mlir/IR/BuiltinOps.h"
30#include "mlir/IR/Location.h"
31#include "mlir/IR/MLIRContext.h"
32#include "mlir/IR/Verifier.h"
39 case TargetCXXABI::GenericItanium:
40 case TargetCXXABI::GenericAArch64:
41 case TargetCXXABI::AppleARM64:
44 case TargetCXXABI::Fuchsia:
45 case TargetCXXABI::GenericARM:
46 case TargetCXXABI::iOS:
47 case TargetCXXABI::WatchOS:
48 case TargetCXXABI::GenericMIPS:
49 case TargetCXXABI::WebAssembly:
50 case TargetCXXABI::XL:
51 case TargetCXXABI::Microsoft:
52 cgm.
errorNYI(
"C++ ABI kind not yet implemented");
56 llvm_unreachable(
"invalid C++ ABI kind");
59CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext,
63 : builder(mlirContext, *this), astContext(astContext),
64 langOpts(astContext.
getLangOpts()), codeGenOpts(cgo),
65 theModule{
mlir::ModuleOp::create(
mlir::UnknownLoc::get(&mlirContext))},
66 diags(diags), target(astContext.getTargetInfo()),
67 abi(
createCXXABI(*this)), genTypes(*this), vtables(*this) {
96 const unsigned charSize = astContext.getTargetInfo().getCharWidth();
100 const unsigned sizeTypeSize =
101 astContext.getTypeSize(astContext.getSignedSizeType());
102 SizeAlignInBytes = astContext.toCharUnitsFromBits(sizeTypeSize).getQuantity();
109 std::optional<cir::SourceLanguage> sourceLanguage = getCIRSourceLanguage();
112 cir::CIRDialect::getSourceLanguageAttrName(),
113 cir::SourceLanguageAttr::get(&mlirContext, *sourceLanguage));
114 theModule->setAttr(cir::CIRDialect::getTripleAttrName(),
115 builder.getStringAttr(
getTriple().str()));
117 if (cgo.OptimizationLevel > 0 || cgo.OptimizeSize > 0)
118 theModule->setAttr(cir::CIRDialect::getOptInfoAttrName(),
119 cir::OptInfoAttr::get(&mlirContext,
120 cgo.OptimizationLevel,
125 FileID mainFileId = astContext.getSourceManager().getMainFileID();
127 *astContext.getSourceManager().getFileEntryForID(mainFileId);
130 theModule.setSymName(path);
131 theModule->setLoc(mlir::FileLineColLoc::get(&mlirContext, path,
147 auto &layout = astContext.getASTRecordLayout(rd);
152 return layout.getAlignment();
155 return layout.getNonVirtualAlignment();
169 if (
unsigned align = tt->getDecl()->getMaxAlignment()) {
172 return astContext.toCharUnitsFromBits(align);
178 t = astContext.getBaseElementType(t);
200 alignment = astContext.getTypeAlignInChars(t);
205 if (
unsigned maxAlign = astContext.getLangOpts().MaxTypeAlign) {
207 !astContext.isAlignmentRequired(t))
214 if (theTargetCIRGenInfo)
215 return *theTargetCIRGenInfo;
218 switch (triple.getArch()) {
225 case llvm::Triple::x86_64: {
226 switch (triple.getOS()) {
233 case llvm::Triple::Linux:
235 return *theTargetCIRGenInfo;
242 assert(cLoc.
isValid() &&
"expected valid source location");
246 return mlir::FileLineColLoc::get(builder.getStringAttr(filename),
251 assert(cRange.
isValid() &&
"expected a valid source range");
254 mlir::Attribute metadata;
255 return mlir::FusedLoc::get({begin, end}, metadata, builder.getContext());
264 false, isForDefinition);
298 assert(op &&
"expected a valid global op");
306 mlir::Operation *globalValueOp = op;
307 if (
auto gv = dyn_cast<cir::GetGlobalOp>(op))
309 mlir::SymbolTable::lookupSymbolIn(
getModule(), gv.getNameAttr());
311 if (
auto cirGlobalValue =
312 dyn_cast<cir::CIRGlobalValueInterface>(globalValueOp))
313 if (!cirGlobalValue.isDeclaration())
338 std::vector<GlobalDecl> curDeclsToEmit;
355 if (
const auto *cd = dyn_cast<clang::OpenACCConstructDecl>(gd.
getDecl())) {
362 if (
const auto *fd = dyn_cast<FunctionDecl>(global)) {
365 if (fd->hasAttr<AnnotateAttr>())
366 errorNYI(fd->getSourceRange(),
"deferredAnnotations");
367 if (!fd->doesThisDeclarationHaveABody()) {
368 if (!fd->doesDeclarationForceExternallyVisibleDefinition())
372 "function declaration that forces code gen");
377 assert(vd->isFileVarDecl() &&
"Cannot emit local var decl as global.");
379 !astContext.isMSStaticDataMemberInlineDefinition(vd)) {
383 if (astContext.getInlineVariableDefinitionKind(vd) ==
422 mlir::Operation *op) {
426 cir::FuncOp funcOp = dyn_cast_if_present<cir::FuncOp>(op);
427 if (!funcOp || funcOp.getFunctionType() != funcType) {
433 if (!funcOp.isDeclaration())
445 mlir::OpBuilder::InsertionGuard guard(builder);
450 setNonAliasAttributes(gd, funcOp);
453 if (funcDecl->getAttr<ConstructorAttr>())
454 errorNYI(funcDecl->getSourceRange(),
"constructor attribute");
455 if (funcDecl->getAttr<DestructorAttr>())
456 errorNYI(funcDecl->getSourceRange(),
"destructor attribute");
458 if (funcDecl->getAttr<AnnotateAttr>())
459 errorNYI(funcDecl->getSourceRange(),
"deferredAnnotations");
477 return mlir::SymbolTable::lookupSymbolIn(theModule, name);
481 mlir::Location loc, StringRef name,
482 mlir::Type t,
bool isConstant,
483 mlir::Operation *insertPoint) {
488 mlir::OpBuilder::InsertionGuard guard(builder);
494 builder.setInsertionPoint(insertPoint);
500 builder.setInsertionPointToStart(cgm.
getModule().getBody());
503 g = builder.create<cir::GlobalOp>(loc, name, t, isConstant);
509 mlir::SymbolTable::setSymbolVisibility(
510 g, mlir::SymbolTable::Visibility::Private);
517 if (isa_and_nonnull<NamedDecl>(d))
523void CIRGenModule::setNonAliasAttributes(
GlobalDecl gd, mlir::Operation *op) {
534std::optional<cir::SourceLanguage> CIRGenModule::getCIRSourceLanguage()
const {
536 using CIRLang = cir::SourceLanguage;
541 if (opts.C99 || opts.C11 || opts.C17 || opts.C23 || opts.C2y ||
542 opts.LangStd == ClangStd::lang_c89 ||
543 opts.LangStd == ClangStd::lang_gnu89)
548 errorNYI(
"CIR does not yet support the given source language");
560 gv.
setLinkage(cir::GlobalLinkageKind::ExternalWeakLinkage);
579 LangAS langAS,
const VarDecl *d,
596 if (entry.getSymType() == ty)
605 if (isForDefinition && !entry.isDeclaration()) {
614 if (!isForDefinition)
624 entry.getOperation());
639 if (langOpts.OpenMP && !langOpts.OpenMPSimd)
642 gv.setAlignmentAttr(
getSize(astContext.getDeclAlign(d)));
654 if (astContext.isMSStaticDataMemberInlineDefinition(d))
661 if (
getTriple().getArch() == llvm::Triple::xcore)
671 "external const declaration with initializer");
706 mlir::Type ptrTy = builder.getPointerTo(g.getSymType());
717 cir::PointerType ptrTy = builder.getPointerTo(globalOp.getSymType());
718 return builder.getGlobalViewAttr(ptrTy, globalOp);
731 bool isDefinitionAvailableExternally =
736 if (isDefinitionAvailableExternally &&
744 mlir::Attribute init;
745 bool needsGlobalCtor =
false;
746 bool needsGlobalDtor =
747 !isDefinitionAvailableExternally &&
752 std::optional<ConstantEmitter> emitter;
756 if (vd->
hasAttr<LoaderUninitializedAttr>()) {
759 }
else if (!initExpr) {
772 emitter.emplace(*
this);
773 mlir::Attribute initializer = emitter->tryEmitForInitializer(*initDecl);
783 if (!isDefinitionAvailableExternally)
784 needsGlobalCtor =
true;
798 if (mlir::isa<mlir::SymbolRefAttr>(init)) {
802 assert(mlir::isa<mlir::TypedAttr>(init) &&
"This should have a type");
803 auto typedInitAttr = mlir::cast<mlir::TypedAttr>(init);
804 initType = typedInitAttr.getType();
806 assert(!mlir::isa<mlir::NoneType>(initType) &&
"Should have a type by now");
812 if (!gv || gv.getSymType() != initType) {
819 if (vd->
hasAttr<AnnotateAttr>()) {
830 emitter->finalize(gv);
836 cir::GlobalLinkageKind linkage =
840 gv.setLinkage(linkage);
844 if (linkage == cir::GlobalLinkageKind::CommonLinkage)
847 setNonAliasAttributes(vd, gv);
854 if (needsGlobalCtor || needsGlobalDtor)
859 mlir::Operation *op) {
861 if (
const auto *fd = dyn_cast<FunctionDecl>(
decl)) {
865 if (
const auto *method = dyn_cast<CXXMethodDecl>(
decl)) {
869 abi->emitCXXStructor(gd);
870 else if (fd->isMultiVersion())
871 errorNYI(method->getSourceRange(),
"multiversion functions");
875 if (method->isVirtual())
881 if (fd->isMultiVersion())
882 errorNYI(fd->getSourceRange(),
"multiversion functions");
887 if (
const auto *vd = dyn_cast<VarDecl>(
decl))
890 llvm_unreachable(
"Invalid argument to CIRGenModule::emitGlobalDefinition");
904 astContext.getAsConstantArrayType(e->
getType());
905 uint64_t finalSize = cat->getZExtSize();
906 str.resize(finalSize);
908 mlir::Type eltTy =
convertType(cat->getElementType());
909 return builder.getString(str, eltTy, finalSize);
913 "getConstantArrayFromStringLiteral: wide characters");
914 return mlir::Attribute();
925 if (d.
hasAttr<SelectAnyAttr>())
929 if (
auto *vd = dyn_cast<VarDecl>(&d))
944 llvm_unreachable(
"No such linkage");
950 if (
auto globalOp = dyn_cast_or_null<cir::GlobalOp>(op)) {
951 globalOp.setComdat(
true);
954 funcOp.setComdat(
true);
960 genTypes.updateCompletedType(td);
964 replacements[name] = op;
967void CIRGenModule::replacePointerTypeArgs(cir::FuncOp oldF, cir::FuncOp newF) {
968 std::optional<mlir::SymbolTable::UseRange> optionalUseRange =
969 oldF.getSymbolUses(theModule);
970 if (!optionalUseRange)
973 for (
const mlir::SymbolTable::SymbolUse &u : *optionalUseRange) {
975 auto call = mlir::dyn_cast<cir::CallOp>(u.getUser());
979 for (
const auto [argOp, fnArgType] :
980 llvm::zip(call.getArgs(), newF.getFunctionType().getInputs())) {
981 if (argOp.getType() == fnArgType)
987 errorNYI(call.getLoc(),
"replace call with mismatched types");
992void CIRGenModule::applyReplacements() {
993 for (
auto &i : replacements) {
994 StringRef mangledName = i.first();
995 mlir::Operation *replacement = i.second;
1001 auto newF = dyn_cast<cir::FuncOp>(replacement);
1004 errorNYI(replacement->getLoc(),
"replacement is not a function");
1010 replacePointerTypeArgs(oldF, newF);
1013 if (oldF.replaceAllSymbolUses(newF.getSymNameAttr(), theModule).failed())
1014 llvm_unreachable(
"internal error, cannot RAUW symbol");
1016 newF->moveBefore(oldF);
1023 mlir::Location loc, StringRef name, mlir::Type ty,
1025 auto gv = mlir::dyn_cast_or_null<cir::GlobalOp>(
1026 mlir::SymbolTable::lookupSymbolIn(theModule, name));
1030 if (gv.getSymType() == ty)
1036 assert(gv.isDeclaration() &&
"Declaration has wrong type!");
1038 errorNYI(loc,
"createOrReplaceCXXRuntimeVariable: declaration exists with "
1049 mlir::SymbolTable::setSymbolVisibility(gv,
1053 !gv.hasAvailableExternallyLinkage()) {
1057 gv.setAlignmentAttr(
getSize(alignment));
1068 if ((noCommon || vd->
hasAttr<NoCommonAttr>()) && !vd->
hasAttr<CommonAttr>())
1079 if (vd->
hasAttr<SectionAttr>())
1085 if (vd->
hasAttr<PragmaClangBSSSectionAttr>() ||
1086 vd->
hasAttr<PragmaClangDataSectionAttr>() ||
1087 vd->
hasAttr<PragmaClangRelroSectionAttr>() ||
1088 vd->
hasAttr<PragmaClangRodataSectionAttr>())
1096 if (vd->
hasAttr<WeakImportAttr>())
1106 if (vd->
hasAttr<AlignedAttr>())
1113 for (
const FieldDecl *fd : rd->fields()) {
1114 if (fd->isBitField())
1116 if (fd->hasAttr<AlignedAttr>())
1141 return cir::GlobalLinkageKind::InternalLinkage;
1143 if (dd->
hasAttr<WeakAttr>()) {
1144 if (isConstantVariable)
1145 return cir::GlobalLinkageKind::WeakODRLinkage;
1146 return cir::GlobalLinkageKind::WeakAnyLinkage;
1151 return cir::GlobalLinkageKind::LinkOnceAnyLinkage;
1156 return cir::GlobalLinkageKind::AvailableExternallyLinkage;
1170 return !astContext.getLangOpts().AppleKext
1171 ? cir::GlobalLinkageKind::LinkOnceODRLinkage
1172 : cir::GlobalLinkageKind::InternalLinkage;
1186 return cir::GlobalLinkageKind::ExternalLinkage;
1189 return dd->
hasAttr<CUDAGlobalAttr>()
1190 ? cir::GlobalLinkageKind::ExternalLinkage
1191 : cir::GlobalLinkageKind::InternalLinkage;
1192 return cir::GlobalLinkageKind::WeakODRLinkage;
1201 return cir::GlobalLinkageKind::CommonLinkage;
1208 if (dd->
hasAttr<SelectAnyAttr>())
1209 return cir::GlobalLinkageKind::WeakODRLinkage;
1213 return cir::GlobalLinkageKind::ExternalLinkage;
1225 mlir::Operation *old, cir::FuncOp newFn) {
1227 auto oldFn = mlir::dyn_cast<cir::FuncOp>(old);
1235 if (oldFn->getAttrs().size() <= 1)
1237 "replaceUsesOfNonProtoTypeWithRealFunction: Attribute forwarding");
1240 newFn.setNoProto(oldFn.getNoProto());
1243 std::optional<mlir::SymbolTable::UseRange> symUses =
1244 oldFn.getSymbolUses(oldFn->getParentOp());
1245 for (
const mlir::SymbolTable::SymbolUse &use : symUses.value()) {
1246 mlir::OpBuilder::InsertionGuard guard(builder);
1248 if (
auto noProtoCallOp = mlir::dyn_cast<cir::CallOp>(use.getUser())) {
1249 builder.setInsertionPoint(noProtoCallOp);
1252 cir::CallOp realCallOp = builder.createCallOp(
1253 noProtoCallOp.getLoc(), newFn, noProtoCallOp.getOperands());
1256 noProtoCallOp.replaceAllUsesWith(realCallOp);
1257 noProtoCallOp.erase();
1258 }
else if (
auto getGlobalOp =
1259 mlir::dyn_cast<cir::GetGlobalOp>(use.getUser())) {
1261 getGlobalOp.getAddr().setType(
1262 cir::PointerType::get(newFn.getFunctionType()));
1265 "replaceUsesOfNonProtoTypeWithRealFunction: unexpected use");
1270cir::GlobalLinkageKind
1272 assert(!isConstant &&
"constant variables NYI");
1273 GVALinkage linkage = astContext.GetGVALinkageForVariable(vd);
1280 GVALinkage linkage = astContext.GetGVALinkageForFunction(d);
1282 if (
const auto *dtor = dyn_cast<CXXDestructorDecl>(d))
1291 StringRef globalName,
CharUnits alignment) {
1297 cgm, loc, globalName,
c.getType(), !cgm.
getLangOpts().WritableStrings);
1300 gv.setAlignmentAttr(cgm.
getSize(alignment));
1302 cir::GlobalLinkageKindAttr::get(cgm.
getBuilder().getContext(), lt));
1306 if (gv.isWeakForLinker()) {
1307 assert(cgm.
supportsCOMDAT() &&
"Only COFF uses weak string literals");
1310 cgm.
setDSOLocal(
static_cast<mlir::Operation *
>(gv));
1331 std::string result =
1334 assert(!mlir::SymbolTable::lookupSymbolIn(theModule, result));
1342 astContext.getAlignOfGlobalVarInChars(
s->getType(),
nullptr);
1348 "getGlobalForStringLiteral: Writable strings");
1354 if (
getCXXABI().getMangleContext().shouldMangleStringLiteral(
s) &&
1357 "getGlobalForStringLiteral: mangle string literals");
1363 mlir::Location loc =
getLoc(
s->getSourceRange());
1364 auto typedC = llvm::cast<mlir::TypedAttr>(
c);
1367 *
this, uniqueName, alignment);
1380 auto arrayTy = mlir::dyn_cast<cir::ArrayType>(gv.getSymType());
1381 assert(arrayTy &&
"String literal must be array");
1385 return builder.getGlobalViewAttr(ptrTy, gv);
1394 "emitExplicitCastExprType");
1404 if (
auto *oid = dyn_cast<ObjCImplDecl>(
decl))
1405 errorNYI(oid->getSourceRange(),
"emitDeclConext: ObjCImplDecl");
1415 if (
decl->isTemplated())
1418 switch (
decl->getKind()) {
1421 decl->getDeclKindName());
1424 case Decl::CXXConversion:
1425 case Decl::CXXMethod:
1426 case Decl::Function: {
1429 if (!fd->isConsteval())
1435 case Decl::Decomposition:
1436 case Decl::VarTemplateSpecialization: {
1439 errorNYI(
decl->getSourceRange(),
"global variable decompositions");
1445 case Decl::OpenACCRoutine:
1448 case Decl::OpenACCDeclare:
1453 case Decl::UsingDirective:
1454 case Decl::UsingEnum:
1455 case Decl::NamespaceAlias:
1457 case Decl::TypeAlias:
1463 case Decl::ClassTemplate:
1465 case Decl::CXXDeductionGuide:
1467 case Decl::FunctionTemplate:
1468 case Decl::StaticAssert:
1469 case Decl::TypeAliasTemplate:
1470 case Decl::UsingShadow:
1471 case Decl::VarTemplate:
1472 case Decl::VarTemplatePartialSpecialization:
1475 case Decl::CXXConstructor:
1478 case Decl::CXXDestructor:
1483 case Decl::LinkageSpec:
1484 case Decl::Namespace:
1488 case Decl::ClassTemplateSpecialization:
1489 case Decl::CXXRecord:
1494 case Decl::FileScopeAsm:
1496 if (langOpts.CUDA && langOpts.CUDAIsDevice)
1499 if (langOpts.OpenMPIsTargetDevice)
1502 if (langOpts.SYCLIsDevice)
1505 std::string line = file_asm->getAsmString();
1506 globalScopeAsm.push_back(builder.getStringAttr(line));
1513 op.setInitialValueAttr(value);
1527 md->getParent()->getNumVBases() == 0)
1529 "getAddrAndTypeOfCXXStructor: MS ABI complete destructor");
1540 false, isForDefinition);
1542 return {fnType, fn};
1546 mlir::Type funcType,
bool forVTable,
1550 "consteval function should never be emitted");
1560 if (
const auto *dd = dyn_cast<CXXDestructorDecl>(gd.
getDecl())) {
1563 dd->getParent()->getNumVBases() == 0)
1565 "getAddrOfFunction: MS ABI complete destructor");
1571 false, isForDefinition);
1579 llvm::raw_svector_ostream
out(buffer);
1588 assert(ii &&
"Attempt to mangle unnamed decl.");
1590 const auto *fd = dyn_cast<FunctionDecl>(nd);
1594 }
else if (fd && fd->hasAttr<CUDAGlobalAttr>() &&
1610 if (
const auto *fd = dyn_cast<FunctionDecl>(nd)) {
1611 if (fd->isMultiVersion()) {
1613 "getMangledName: multi-version functions");
1618 "getMangledName: GPU relocatable device code");
1621 return std::string(
out.str());
1629 if (
const auto *cd = dyn_cast<CXXConstructorDecl>(canonicalGd.
getDecl())) {
1632 "getMangledName: C++ constructor without variants");
1641 auto result = manglings.insert(std::make_pair(mangledName, gd));
1642 return mangledDeclNames[canonicalGd] = result.first->first();
1646 assert(!d->
getInit() &&
"Cannot emit definite definitions here!");
1654 if (gv && !mlir::cast<cir::GlobalOp>(gv).isDeclaration())
1670 if (langOpts.EmitAllDecls)
1673 const auto *vd = dyn_cast<VarDecl>(global);
1675 ((codeGenOpts.KeepPersistentStorageVariables &&
1676 (vd->getStorageDuration() ==
SD_Static ||
1677 vd->getStorageDuration() ==
SD_Thread)) ||
1678 (codeGenOpts.KeepStaticConsts && vd->getStorageDuration() ==
SD_Static &&
1679 vd->getType().isConstQualified())))
1692 if (langOpts.OpenMP >= 50 && !langOpts.OpenMPSimd) {
1693 std::optional<OMPDeclareTargetDeclAttr *> activeAttr =
1694 OMPDeclareTargetDeclAttr::getActiveAttr(global);
1695 if (!activeAttr || (*activeAttr)->getLevel() != (
unsigned)-1)
1699 const auto *fd = dyn_cast<FunctionDecl>(global);
1706 if (fd->hasAttr<TargetVersionAttr>() && !fd->isMultiVersion())
1708 if (langOpts.SYCLIsDevice) {
1709 errorNYI(fd->getSourceRange(),
"mayBeEmittedEagerly: SYCL");
1713 const auto *vd = dyn_cast<VarDecl>(global);
1715 if (astContext.getInlineVariableDefinitionKind(vd) ==
1723 if (langOpts.OpenMP && langOpts.OpenMPUseTLS &&
1724 astContext.getTargetInfo().isTLSSupported() &&
isa<VarDecl>(global) &&
1726 !OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(global))
1729 assert((fd || vd) &&
1730 "Only FunctionDecl and VarDecl should hit this path so far.");
1735 cir::CIRGlobalValueInterface gv) {
1736 if (gv.hasLocalLinkage())
1739 if (!gv.hasDefaultVisibility() && !gv.hasExternalWeakLinkage())
1747 const llvm::Triple &tt = cgm.
getTriple();
1749 if (tt.isOSCygMing()) {
1758 cgm.
errorNYI(
"shouldAssumeDSOLocal: MinGW");
1764 if (tt.isOSBinFormatCOFF() && gv.hasExternalWeakLinkage())
1772 if (tt.isOSBinFormatCOFF() || (tt.isOSWindows() && tt.isOSBinFormatMachO()))
1776 if (!tt.isOSBinFormatELF())
1781 if (rm != llvm::Reloc::Static && !lOpts.PIE) {
1789 return !(lOpts.SemanticInterposition || lOpts.HalfNoSemanticInterposition);
1793 if (!gv.isDeclarationForLinker())
1799 if (rm == llvm::Reloc::PIC_ && gv.hasExternalWeakLinkage())
1806 if (cgOpts.DirectAccessExternalData) {
1812 if (
auto globalOp = dyn_cast<cir::GlobalOp>(gv.getOperation())) {
1845 if (
auto globalValue = dyn_cast<cir::CIRGlobalValueInterface>(op))
1864 bool isIncompleteFunction,
1884 StringRef mangledName, mlir::Type funcType,
GlobalDecl gd,
bool forVTable,
1886 mlir::ArrayAttr extraAttrs) {
1895 if (
const auto *fd = cast_or_null<FunctionDecl>(d)) {
1897 if (
getLangOpts().OpenMPIsTargetDevice && fd->isDefined() && !dontDefer &&
1900 "getOrCreateCIRFunction: OpenMP target function");
1904 if (fd->isMultiVersion())
1905 errorNYI(fd->getSourceRange(),
"getOrCreateCIRFunction: multi-version");
1911 assert(mlir::isa<cir::FuncOp>(entry));
1916 if (d && !d->
hasAttr<DLLImportAttr>() && !d->
hasAttr<DLLExportAttr>()) {
1924 if (isForDefinition && fn && !fn.isDeclaration()) {
1927 if (fn && fn.getFunctionType() == funcType) {
1931 if (!isForDefinition) {
1939 auto *funcDecl = llvm::cast_or_null<FunctionDecl>(gd.
getDecl());
1940 bool invalidLoc = !funcDecl ||
1941 funcDecl->getSourceRange().getBegin().isInvalid() ||
1942 funcDecl->getSourceRange().getEnd().isInvalid();
1944 invalidLoc ? theModule->getLoc() :
getLoc(funcDecl->getSourceRange()),
1945 mangledName, mlir::cast<cir::FuncType>(funcType), funcDecl);
1956 auto symbolOp = mlir::cast<mlir::SymbolOpInterface>(entry);
1964 if (symbolOp.getSymbolUses(symbolOp->getParentOp()))
1978 assert(funcOp.getFunctionType() == funcType);
1985 if (isa_and_nonnull<CXXDestructorDecl>(d) &&
2015 fd = fd->getPreviousDecl()) {
2017 if (fd->doesThisDeclarationHaveABody()) {
2030 cir::FuncType funcType,
2034 mlir::OpBuilder::InsertionGuard guard(builder);
2042 builder.setInsertionPoint(cgf->
curFn);
2044 func = builder.create<cir::FuncOp>(loc, name, funcType);
2049 func.setNoProto(
true);
2051 assert(func.isDeclaration() &&
"expected empty body");
2055 func.setLinkageAttr(cir::GlobalLinkageKindAttr::get(
2057 mlir::SymbolTable::setSymbolVisibility(
2058 func, mlir::SymbolTable::Visibility::Private);
2063 theModule.push_back(func);
2068mlir::SymbolTable::Visibility
2072 if (op.isDeclaration())
2073 return mlir::SymbolTable::Visibility::Private;
2077mlir::SymbolTable::Visibility
2080 case cir::GlobalLinkageKind::InternalLinkage:
2081 case cir::GlobalLinkageKind::PrivateLinkage:
2082 return mlir::SymbolTable::Visibility::Private;
2083 case cir::GlobalLinkageKind::ExternalLinkage:
2084 case cir::GlobalLinkageKind::ExternalWeakLinkage:
2085 case cir::GlobalLinkageKind::LinkOnceODRLinkage:
2086 case cir::GlobalLinkageKind::AvailableExternallyLinkage:
2087 case cir::GlobalLinkageKind::CommonLinkage:
2088 case cir::GlobalLinkageKind::WeakAnyLinkage:
2089 case cir::GlobalLinkageKind::WeakODRLinkage:
2090 return mlir::SymbolTable::Visibility::Public;
2092 llvm::errs() <<
"visibility not implemented for '"
2093 << stringifyGlobalLinkageKind(glk) <<
"'\n";
2094 assert(0 &&
"not implemented");
2097 llvm_unreachable(
"linkage should be handled above!");
2101 clang::VisibilityAttr::VisibilityType visibility) {
2102 switch (visibility) {
2103 case clang::VisibilityAttr::VisibilityType::Default:
2104 return cir::VisibilityKind::Default;
2105 case clang::VisibilityAttr::VisibilityType::Hidden:
2106 return cir::VisibilityKind::Hidden;
2107 case clang::VisibilityAttr::VisibilityType::Protected:
2108 return cir::VisibilityKind::Protected;
2110 llvm_unreachable(
"unexpected visibility value");
2115 const clang::VisibilityAttr *va =
decl->getAttr<clang::VisibilityAttr>();
2116 cir::VisibilityAttr cirVisibility =
2119 cirVisibility = cir::VisibilityAttr::get(
2123 return cirVisibility;
2128 applyReplacements();
2130 theModule->setAttr(cir::CIRDialect::getModuleLevelAsmAttrName(),
2131 builder.getArrayAttr(globalScopeAsm));
2139 cir::FuncOp aliasee,
2140 cir::GlobalLinkageKind linkage) {
2142 auto *aliasFD = dyn_cast<FunctionDecl>(aliasGD.
getDecl());
2143 assert(aliasFD &&
"expected FunctionDecl");
2154 mangledName, fnType, aliasFD);
2155 alias.setAliasee(aliasee.getName());
2156 alias.setLinkage(linkage);
2160 mlir::SymbolTable::setSymbolVisibility(
2161 alias, mlir::SymbolTable::Visibility::Private);
2168 errorNYI(aliasFD->getSourceRange(),
"emitAliasForGlobal: previous uses");
2178 return genTypes.convertType(
type);
2185 return mlir::verify(theModule).succeeded();
2194 return builder.getConstNullPtrAttr(builder.getUInt8PtrTy());
2197 langOpts.ObjCRuntime.isGNUFamily()) {
2198 errorNYI(loc,
"getAddrOfRTTIDescriptor: Objc PtrType & Objc RT GUN");
2208 llvm::iterator_range<CastExpr::path_const_iterator> path) {
2215 assert(!base->isVirtual() &&
"Should not see virtual bases here!");
2220 const auto *baseDecl = base->getType()->castAsCXXRecordDecl();
2232 llvm::StringRef feature) {
2233 unsigned diagID = diags.getCustomDiagID(
2235 return diags.Report(loc, diagID) << feature;
2239 llvm::StringRef feature) {
Defines the clang::ASTContext interface.
static bool shouldAssumeDSOLocal(const CIRGenModule &cgm, cir::CIRGlobalValueInterface gv)
static bool shouldBeInCOMDAT(CIRGenModule &cgm, const Decl &d)
static std::string getMangledNameImpl(CIRGenModule &cgm, GlobalDecl gd, const NamedDecl *nd)
static cir::GlobalOp generateStringLiteral(mlir::Location loc, mlir::TypedAttr c, cir::GlobalLinkageKind lt, CIRGenModule &cgm, StringRef globalName, CharUnits alignment)
static CIRGenCXXABI * createCXXABI(CIRGenModule &cgm)
static bool isVarDeclStrongDefinition(const ASTContext &astContext, CIRGenModule &cgm, const VarDecl *vd, bool noCommon)
static void setLinkageForGV(cir::GlobalOp &gv, const NamedDecl *nd)
This file defines OpenACC nodes for declarative directives.
Defines the SourceManager interface.
__device__ __2f16 float __ockl_bool s
__device__ __2f16 float c
cir::PointerType getPointerTo(mlir::Type ty)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
@ Strong
Strong definition.
@ WeakUnknown
Weak for now, might become strong later in this TU.
bool DeclMustBeEmitted(const Decl *D)
Determines if the decl can be CodeGen'ed or deserialized from PCH lazily, only when used; this is onl...
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const
bool isAlignmentRequired(const Type *T) const
Determine if the alignment the type has was required using an alignment attribute.
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
GVALinkage GetGVALinkageForVariable(const VarDecl *VD) const
unsigned getTypeAlignIfKnown(QualType T, bool NeedsPreferredAlignment=false) const
Return the alignment of a type, in bits, or 0 if the type is incomplete and we cannot determine the a...
const TargetInfo & getTargetInfo() const
TargetCXXABI::Kind getCXXABIKind() const
Return the C++ ABI kind that should be used.
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
Implements C++ ABI-specific code generation functions.
virtual mlir::Attribute getAddrOfRTTIDescriptor(mlir::Location loc, QualType ty)=0
virtual void emitCXXConstructors(const clang::CXXConstructorDecl *d)=0
Emit constructor variants required by this ABI.
virtual void emitCXXDestructors(const clang::CXXDestructorDecl *d)=0
Emit dtor variants required by this ABI.
clang::MangleContext & getMangleContext()
Gets the mangle context.
virtual cir::GlobalLinkageKind getCXXDestructorLinkage(GVALinkage linkage, const CXXDestructorDecl *dtor, CXXDtorType dt) const
cir::FuncOp generateCode(clang::GlobalDecl gd, cir::FuncOp fn, cir::FuncType funcType)
void emitVariablyModifiedType(QualType ty)
mlir::Operation * curFn
The current function or global initializer that is generated code for.
This class organizes the cross-function state that is used while generating CIR code.
void replaceUsesOfNonProtoTypeWithRealFunction(mlir::Operation *old, cir::FuncOp newFn)
This function is called when we implement a function with no prototype, e.g.
llvm::StringRef getMangledName(clang::GlobalDecl gd)
CharUnits computeNonVirtualBaseClassOffset(const CXXRecordDecl *derivedClass, llvm::iterator_range< CastExpr::path_const_iterator > path)
void setGlobalVisibility(mlir::Operation *op, const NamedDecl *d) const
Set the visibility for the given global.
DiagnosticBuilder errorNYI(SourceLocation, llvm::StringRef)
Helpers to emit "not yet implemented" error diagnostics.
void emitDeferred()
Emit any needed decls for which code generation was deferred.
clang::ASTContext & getASTContext() const
cir::FuncOp getAddrOfCXXStructor(clang::GlobalDecl gd, const CIRGenFunctionInfo *fnInfo=nullptr, cir::FuncType fnType=nullptr, bool dontDefer=false, ForDefinition_t isForDefinition=NotForDefinition)
void emitTopLevelDecl(clang::Decl *decl)
void addReplacement(llvm::StringRef name, mlir::Operation *op)
mlir::Type convertType(clang::QualType type)
bool shouldEmitRTTI(bool forEH=false)
cir::GlobalOp getGlobalForStringLiteral(const StringLiteral *s, llvm::StringRef name=".str")
Return a global symbol reference to a constant array for the given string literal.
bool mustBeEmitted(const clang::ValueDecl *d)
Determine whether the definition must be emitted; if this returns false, the definition can be emitte...
mlir::IntegerAttr getSize(CharUnits size)
CIRGenBuilderTy & getBuilder()
void setDSOLocal(mlir::Operation *op) const
std::string getUniqueGlobalName(const std::string &baseName)
std::pair< cir::FuncType, cir::FuncOp > getAddrAndTypeOfCXXStructor(clang::GlobalDecl gd, const CIRGenFunctionInfo *fnInfo=nullptr, cir::FuncType fnType=nullptr, bool dontDefer=false, ForDefinition_t isForDefinition=NotForDefinition)
void setGVProperties(mlir::Operation *op, const NamedDecl *d) const
Set visibility, dllimport/dllexport and dso_local.
cir::GlobalOp getOrCreateCIRGlobal(llvm::StringRef mangledName, mlir::Type ty, LangAS langAS, const VarDecl *d, ForDefinition_t isForDefinition)
If the specified mangled name is not in the module, create and return an mlir::GlobalOp value.
clang::CharUnits getClassPointerAlignment(const clang::CXXRecordDecl *rd)
Return the best known alignment for an unknown pointer to a particular class.
void handleCXXStaticMemberVarInstantiation(VarDecl *vd)
Tell the consumer that this variable has been instantiated.
void emitGlobalDefinition(clang::GlobalDecl gd, mlir::Operation *op=nullptr)
mlir::Attribute getAddrOfRTTIDescriptor(mlir::Location loc, QualType ty, bool forEH=false)
Get the address of the RTTI descriptor for the given type.
clang::CharUnits getNaturalTypeAlignment(clang::QualType t, LValueBaseInfo *baseInfo)
FIXME: this could likely be a common helper and not necessarily related with codegen.
void setFunctionAttributes(GlobalDecl gd, cir::FuncOp f, bool isIncompleteFunction, bool isThunk)
Set function attributes for a function declaration.
static mlir::SymbolTable::Visibility getMLIRVisibilityFromCIRLinkage(cir::GlobalLinkageKind GLK)
const clang::TargetInfo & getTarget() const
const llvm::Triple & getTriple() const
static mlir::SymbolTable::Visibility getMLIRVisibility(Visibility v)
void emitTentativeDefinition(const VarDecl *d)
cir::GlobalOp createOrReplaceCXXRuntimeVariable(mlir::Location loc, llvm::StringRef name, mlir::Type ty, cir::GlobalLinkageKind linkage, clang::CharUnits alignment)
Will return a global variable of the given type.
void emitGlobalDecl(const clang::GlobalDecl &d)
Helper for emitDeferred to apply actual codegen.
cir::FuncOp getOrCreateCIRFunction(llvm::StringRef mangledName, mlir::Type funcType, clang::GlobalDecl gd, bool forVTable, bool dontDefer=false, bool isThunk=false, ForDefinition_t isForDefinition=NotForDefinition, mlir::ArrayAttr extraAttrs={})
void emitGlobalVarDefinition(const clang::VarDecl *vd, bool isTentative=false)
cir::FuncOp getAddrOfFunction(clang::GlobalDecl gd, mlir::Type funcType=nullptr, bool forVTable=false, bool dontDefer=false, ForDefinition_t isForDefinition=NotForDefinition)
Return the address of the given function.
void emitAliasForGlobal(llvm::StringRef mangledName, mlir::Operation *op, GlobalDecl aliasGD, cir::FuncOp aliasee, cir::GlobalLinkageKind linkage)
void emitGlobalOpenACCDecl(const clang::OpenACCConstructDecl *cd)
bool verifyModule() const
void emitExplicitCastExprType(const ExplicitCastExpr *e, CIRGenFunction *cgf=nullptr)
Emit type info if type of an expression is a variably modified type.
std::map< llvm::StringRef, clang::GlobalDecl > deferredDecls
This contains all the decls which have definitions but which are deferred for emission and therefore ...
mlir::Value getAddrOfGlobalVar(const VarDecl *d, mlir::Type ty={}, ForDefinition_t isForDefinition=NotForDefinition)
Return the mlir::Value for the address of the given global variable.
static void setInitializer(cir::GlobalOp &op, mlir::Attribute value)
cir::GlobalViewAttr getAddrOfGlobalVarAttr(const VarDecl *d)
Return the mlir::GlobalViewAttr for the address of the given global.
cir::GlobalLinkageKind getFunctionLinkage(GlobalDecl gd)
void updateCompletedType(const clang::TagDecl *td)
const clang::CodeGenOptions & getCodeGenOpts() const
const clang::LangOptions & getLangOpts() const
void addDeferredDeclToEmit(clang::GlobalDecl GD)
cir::FuncOp createCIRFunction(mlir::Location loc, llvm::StringRef name, cir::FuncType funcType, const clang::FunctionDecl *funcDecl)
const TargetCIRGenInfo & getTargetCIRGenInfo()
void emitCXXGlobalVarDeclInitFunc(const VarDecl *vd, cir::GlobalOp addr, bool performInit)
void setGVPropertiesAux(mlir::Operation *op, const NamedDecl *d) const
mlir::Location getLoc(clang::SourceLocation cLoc)
Helpers to convert the presumed location of Clang's SourceLocation to an MLIR Location.
mlir::Operation * lastGlobalOp
static cir::VisibilityKind getGlobalVisibilityKindFromClangVisibility(clang::VisibilityAttr::VisibilityType visibility)
llvm::StringMap< unsigned > cgGlobalNames
mlir::Operation * getGlobalValue(llvm::StringRef ref)
mlir::ModuleOp getModule() const
bool supportsCOMDAT() const
cir::GlobalLinkageKind getCIRLinkageForDeclarator(const DeclaratorDecl *dd, GVALinkage linkage, bool isConstantVariable)
mlir::MLIRContext & getMLIRContext()
mlir::Operation * getAddrOfGlobal(clang::GlobalDecl gd, ForDefinition_t isForDefinition=NotForDefinition)
static cir::GlobalOp createGlobalOp(CIRGenModule &cgm, mlir::Location loc, llvm::StringRef name, mlir::Type t, bool isConstant=false, mlir::Operation *insertPoint=nullptr)
void maybeSetTrivialComdat(const clang::Decl &d, mlir::Operation *op)
CIRGenCXXABI & getCXXABI() const
cir::GlobalViewAttr getAddrOfConstantStringFromLiteral(const StringLiteral *s, llvm::StringRef name=".str")
Return a global symbol reference to a constant array for the given string literal.
void emitDeclContext(const DeclContext *dc)
void emitGlobal(clang::GlobalDecl gd)
Emit code for a single global function or variable declaration.
bool mayBeEmittedEagerly(const clang::ValueDecl *d)
Determine whether the definition can be emitted eagerly, or should be delayed until the end of the tr...
cir::GlobalLinkageKind getCIRLinkageVarDefinition(const VarDecl *vd, bool isConstant)
void emitGlobalFunctionDefinition(clang::GlobalDecl gd, mlir::Operation *op)
CIRGenVTables & getVTables()
void setFunctionLinkage(GlobalDecl gd, cir::FuncOp f)
std::vector< clang::GlobalDecl > deferredDeclsToEmit
mlir::Attribute getConstantArrayFromStringLiteral(const StringLiteral *e)
Return a constant array for the given string.
cir::VisibilityAttr getGlobalVisibilityAttrFromDecl(const Decl *decl)
void setCommonAttributes(GlobalDecl gd, mlir::Operation *op)
Set attributes which are common to any form of a global definition (alias, Objective-C method,...
const CIRGenFunctionInfo & arrangeGlobalDeclaration(GlobalDecl gd)
const CIRGenFunctionInfo & arrangeCXXMethodDeclaration(const clang::CXXMethodDecl *md)
C++ methods have some special rules and also have implicit parameters.
const CIRGenFunctionInfo & arrangeCXXStructorDeclaration(clang::GlobalDecl gd)
cir::FuncType getFunctionType(const CIRGenFunctionInfo &info)
Get the CIR function type for.
mlir::Type convertTypeForMem(clang::QualType, bool forBitField=false)
Convert type T into an mlir::Type.
void emitThunks(GlobalDecl gd)
Emit the associated thunks for the given global decl.
Represents a base class of a C++ class.
Represents a C++ struct/union/class.
bool isEffectivelyFinal() const
Determine whether it's impossible for a class to be derived from this class.
bool hasDefinition() const
CharUnits - This is an opaque type for sizes expressed in character units.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
static CharUnits One()
One - Construct a CharUnits quantity of one.
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
llvm::Reloc::Model RelocationModel
The name of the relocation model to use.
Represents the canonical version of C arrays with a specified constant size.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
Decl - This represents one declaration (or definition), e.g.
bool isWeakImported() const
Determine whether this is a weak-imported symbol.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
static DeclContext * castToDeclContext(const Decl *)
const char * getDeclKindName() const
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
Represents a ValueDecl that came out of a declarator.
SourceLocation getBeginLoc() const LLVM_READONLY
A little helper class used to produce diagnostics.
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 member of a struct/union/class.
Cached information about one file (either on disk or in the virtual file system).
StringRef tryGetRealPathName() const
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Represents a function declaration or definition.
bool hasPrototype() const
Whether this function has a prototype, either because one was explicitly written or because it was "i...
FunctionType - C99 6.7.5.3 - Function Declarators.
CallingConv getCallConv() const
GlobalDecl - represents a global declaration.
GlobalDecl getCanonicalDecl() const
KernelReferenceKind getKernelReferenceKind() const
GlobalDecl getWithDecl(const Decl *D)
CXXDtorType getDtorType() const
const Decl * getDecl() const
One of these records is kept for each identifier that is lexed.
StringRef getName() const
Return the actual identifier string.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
void setLinkage(Linkage L)
Linkage getLinkage() const
MangleContext - Context for tracking state which persists across multiple calls to the C++ name mangl...
bool shouldMangleDeclName(const NamedDecl *D)
void mangleName(GlobalDecl GD, raw_ostream &)
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
LinkageInfo getLinkageAndVisibility() const
Determines the linkage and visibility of this entity.
Represents an unpacked "presumed" location which can be presented to the user.
unsigned getColumn() const
Return the presumed column number of this location.
const char * getFilename() const
Return the presumed filename of this location.
unsigned getLine() const
Return the presumed line number of this location.
A (possibly-)qualified type.
LangAS getAddressSpace() const
Return the address space of this type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
bool isConstQualified() const
Determine whether this type is const-qualified.
bool isConstantStorage(const ASTContext &Ctx, bool ExcludeCtor, bool ExcludeDtor)
bool hasUnaligned() const
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
This class handles loading and caching of source files into memory.
PresumedLoc getPresumedLoc(SourceLocation Loc, bool UseLineDirectives=true) const
Returns the "presumed" location of a SourceLocation specifies.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
StringLiteral - This represents a string literal expression, e.g.
StringRef getString() const
unsigned getCharByteWidth() const
Represents the declaration of a struct/union/class/enum.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
bool isPointerType() const
bool isReferenceType() const
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isObjCObjectPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
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.
TLSKind getTLSKind() const
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool hasFlexibleArrayInit(const ASTContext &Ctx) const
Whether this variable has a flexible array member initialized with one or more elements.
bool hasGlobalStorage() const
Returns true for all variables that do not have local storage.
bool hasConstantInitialization() const
Determine whether this variable has constant initialization.
VarDecl * getDefinition(ASTContext &)
Get the real (not just tentative) definition for this declaration.
QualType::DestructionKind needsDestruction(const ASTContext &Ctx) const
Would the destruction of this variable have any effect, and if so, what kind?
const Expr * getInit() const
bool hasExternalStorage() const
Returns true if a variable has extern or private_extern storage.
@ Definition
This declaration is definitely a definition.
DefinitionKind hasDefinition(ASTContext &) const
Check whether this variable is defined in this translation unit.
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
const Expr * getAnyInitializer() const
Get the initializer for this variable, no matter which declaration it is attached to.
static LLVM_ATTRIBUTE_UNUSED bool isWeakForLinker(GlobalLinkageKind linkage)
Whether the definition of this global may be replaced at link time.
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
@ Type
The l-value was considered opaque, so the alignment was determined from a type.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
CIRGenCXXABI * CreateCIRGenItaniumCXXABI(CIRGenModule &cgm)
Creates and Itanium-family ABI.
std::unique_ptr< TargetCIRGenInfo > createX8664TargetCIRGenInfo(CIRGenTypes &cgt)
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
GVALinkage
A more specific kind of linkage than enum Linkage.
@ GVA_AvailableExternally
@ SD_Thread
Thread storage duration.
@ SD_Static
Static storage duration.
@ Dtor_Complete
Complete object dtor.
LangAS
Defines the address space values used by the address space qualifier of QualType.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
U cast(CodeGen::Address addr)
bool isExternallyVisible(Linkage L)
static bool alignCXXRecordDecl()
static bool weakRefReference()
static bool opGlobalSection()
static bool opGlobalConstant()
static bool addressSpace()
static bool opGlobalUnnamedAddr()
static bool opGlobalThreadLocal()
static bool sourceLanguageCases()
static bool cxxRecordStaticMembers()
static bool opFuncAstDeclAttr()
static bool opGlobalUsedOrCompilerUsed()
static bool moduleNameHash()
static bool opGlobalVisibility()
static bool setFunctionAttributes()
static bool setDLLStorageClass()
static bool opFuncParameterAttributes()
static bool targetCIRGenInfoArch()
static bool opFuncExtraAttrs()
static bool opFuncSection()
static bool opFuncAttributesForDefinition()
static bool opGlobalDLLImportExport()
static bool opGlobalPartition()
static bool opGlobalWeakRef()
static bool setTargetAttributes()
static bool deferredCXXGlobalInit()
static bool opFuncOperandBundles()
static bool defaultVisibility()
static bool opFuncExceptions()
static bool deferredVtables()
static bool cudaSupport()
static bool opFuncMaybeHandleStaticInExternC()
static bool generateDebugInfo()
static bool targetCIRGenInfoOS()
static bool opFuncCPUAndFeaturesAttributes()
static bool maybeHandleStaticInExternC()
static bool setLLVMFunctionFEnvAttributes()
cir::PointerType VoidPtrTy
void* in address space 0
unsigned char PointerAlignInBytes
unsigned char SizeAlignInBytes
The alignment of size_t.
cir::PointerType UInt8PtrTy
mlir::Type UCharTy
ClangIR char.
LangStandard - Information about the properties of a particular language standard.