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,
134 auto &layout = astContext.getASTRecordLayout(rd);
139 return layout.getAlignment();
142 return layout.getNonVirtualAlignment();
156 if (
unsigned align = tt->getDecl()->getMaxAlignment()) {
159 return astContext.toCharUnitsFromBits(align);
165 t = astContext.getBaseElementType(t);
187 alignment = astContext.getTypeAlignInChars(t);
192 if (
unsigned maxAlign = astContext.getLangOpts().MaxTypeAlign) {
194 !astContext.isAlignmentRequired(t))
201 if (theTargetCIRGenInfo)
202 return *theTargetCIRGenInfo;
205 switch (triple.getArch()) {
212 case llvm::Triple::x86_64: {
213 switch (triple.getOS()) {
220 case llvm::Triple::Linux:
222 return *theTargetCIRGenInfo;
229 assert(cLoc.
isValid() &&
"expected valid source location");
233 return mlir::FileLineColLoc::get(builder.getStringAttr(filename),
238 assert(cRange.
isValid() &&
"expected a valid source range");
241 mlir::Attribute metadata;
242 return mlir::FusedLoc::get({begin, end}, metadata, builder.getContext());
251 false, isForDefinition);
285 assert(op &&
"expected a valid global op");
293 mlir::Operation *globalValueOp = op;
294 if (
auto gv = dyn_cast<cir::GetGlobalOp>(op))
296 mlir::SymbolTable::lookupSymbolIn(
getModule(), gv.getNameAttr());
298 if (
auto cirGlobalValue =
299 dyn_cast<cir::CIRGlobalValueInterface>(globalValueOp))
300 if (!cirGlobalValue.isDeclaration())
325 std::vector<GlobalDecl> curDeclsToEmit;
342 if (
const auto *cd = dyn_cast<clang::OpenACCConstructDecl>(gd.
getDecl())) {
349 if (
const auto *fd = dyn_cast<FunctionDecl>(global)) {
352 if (fd->hasAttr<AnnotateAttr>())
353 errorNYI(fd->getSourceRange(),
"deferredAnnotations");
354 if (!fd->doesThisDeclarationHaveABody()) {
355 if (!fd->doesDeclarationForceExternallyVisibleDefinition())
359 "function declaration that forces code gen");
364 assert(vd->isFileVarDecl() &&
"Cannot emit local var decl as global.");
366 !astContext.isMSStaticDataMemberInlineDefinition(vd)) {
370 if (astContext.getInlineVariableDefinitionKind(vd) ==
409 mlir::Operation *op) {
413 cir::FuncOp funcOp = dyn_cast_if_present<cir::FuncOp>(op);
414 if (!funcOp || funcOp.getFunctionType() != funcType) {
420 if (!funcOp.isDeclaration())
432 mlir::OpBuilder::InsertionGuard guard(builder);
437 setNonAliasAttributes(gd, funcOp);
440 if (funcDecl->getAttr<ConstructorAttr>())
441 errorNYI(funcDecl->getSourceRange(),
"constructor attribute");
442 if (funcDecl->getAttr<DestructorAttr>())
443 errorNYI(funcDecl->getSourceRange(),
"destructor attribute");
445 if (funcDecl->getAttr<AnnotateAttr>())
446 errorNYI(funcDecl->getSourceRange(),
"deferredAnnotations");
464 return mlir::SymbolTable::lookupSymbolIn(theModule, name);
468 mlir::Location loc, StringRef name,
469 mlir::Type t,
bool isConstant,
470 mlir::Operation *insertPoint) {
475 mlir::OpBuilder::InsertionGuard guard(builder);
481 builder.setInsertionPoint(insertPoint);
487 builder.setInsertionPointToStart(cgm.
getModule().getBody());
490 g = builder.create<cir::GlobalOp>(loc, name, t, isConstant);
496 mlir::SymbolTable::setSymbolVisibility(
497 g, mlir::SymbolTable::Visibility::Private);
504 if (isa_and_nonnull<NamedDecl>(d))
510void CIRGenModule::setNonAliasAttributes(
GlobalDecl gd, mlir::Operation *op) {
521std::optional<cir::SourceLanguage> CIRGenModule::getCIRSourceLanguage()
const {
523 using CIRLang = cir::SourceLanguage;
528 if (opts.C99 || opts.C11 || opts.C17 || opts.C23 || opts.C2y ||
529 opts.LangStd == ClangStd::lang_c89 ||
530 opts.LangStd == ClangStd::lang_gnu89)
535 errorNYI(
"CIR does not yet support the given source language");
547 gv.
setLinkage(cir::GlobalLinkageKind::ExternalWeakLinkage);
566 LangAS langAS,
const VarDecl *d,
583 if (entry.getSymType() == ty)
592 if (isForDefinition && !entry.isDeclaration()) {
601 if (!isForDefinition)
611 entry.getOperation());
626 if (langOpts.OpenMP && !langOpts.OpenMPSimd)
629 gv.setAlignmentAttr(
getSize(astContext.getDeclAlign(d)));
641 if (astContext.isMSStaticDataMemberInlineDefinition(d))
648 if (
getTriple().getArch() == llvm::Triple::xcore)
658 "external const declaration with initializer");
693 mlir::Type ptrTy = builder.getPointerTo(g.getSymType());
704 cir::PointerType ptrTy = builder.getPointerTo(globalOp.getSymType());
705 return builder.getGlobalViewAttr(ptrTy, globalOp);
718 bool isDefinitionAvailableExternally =
724 if (isDefinitionAvailableExternally &&
732 mlir::Attribute init;
736 std::optional<ConstantEmitter> emitter;
740 if (vd->
hasAttr<LoaderUninitializedAttr>()) {
743 }
else if (!initExpr) {
756 emitter.emplace(*
this);
757 mlir::Attribute initializer = emitter->tryEmitForInitializer(*initDecl);
783 if (mlir::isa<mlir::SymbolRefAttr>(init)) {
787 assert(mlir::isa<mlir::TypedAttr>(init) &&
"This should have a type");
788 auto typedInitAttr = mlir::cast<mlir::TypedAttr>(init);
789 initType = typedInitAttr.getType();
791 assert(!mlir::isa<mlir::NoneType>(initType) &&
"Should have a type by now");
797 if (!gv || gv.getSymType() != initType) {
804 if (vd->
hasAttr<AnnotateAttr>()) {
815 emitter->finalize(gv);
818 cir::GlobalLinkageKind linkage =
822 gv.setLinkage(linkage);
826 if (linkage == cir::GlobalLinkageKind::CommonLinkage)
829 setNonAliasAttributes(vd, gv);
837 mlir::Operation *op) {
839 if (
const auto *fd = dyn_cast<FunctionDecl>(
decl)) {
843 if (
const auto *method = dyn_cast<CXXMethodDecl>(
decl)) {
847 abi->emitCXXStructor(gd);
848 else if (fd->isMultiVersion())
849 errorNYI(method->getSourceRange(),
"multiversion functions");
853 if (method->isVirtual())
859 if (fd->isMultiVersion())
860 errorNYI(fd->getSourceRange(),
"multiversion functions");
865 if (
const auto *vd = dyn_cast<VarDecl>(
decl))
868 llvm_unreachable(
"Invalid argument to CIRGenModule::emitGlobalDefinition");
882 astContext.getAsConstantArrayType(e->
getType());
883 uint64_t finalSize = cat->getZExtSize();
884 str.resize(finalSize);
886 mlir::Type eltTy =
convertType(cat->getElementType());
887 return builder.getString(str, eltTy, finalSize);
891 "getConstantArrayFromStringLiteral: wide characters");
892 return mlir::Attribute();
903 if (d.
hasAttr<SelectAnyAttr>())
907 if (
auto *vd = dyn_cast<VarDecl>(&d))
922 llvm_unreachable(
"No such linkage");
928 if (
auto globalOp = dyn_cast_or_null<cir::GlobalOp>(op)) {
929 globalOp.setComdat(
true);
932 funcOp.setComdat(
true);
938 genTypes.updateCompletedType(td);
942 replacements[name] = op;
945void CIRGenModule::replacePointerTypeArgs(cir::FuncOp oldF, cir::FuncOp newF) {
946 std::optional<mlir::SymbolTable::UseRange> optionalUseRange =
947 oldF.getSymbolUses(theModule);
948 if (!optionalUseRange)
951 for (
const mlir::SymbolTable::SymbolUse &u : *optionalUseRange) {
953 auto call = mlir::dyn_cast<cir::CallOp>(u.getUser());
957 for (
const auto [argOp, fnArgType] :
958 llvm::zip(call.getArgs(), newF.getFunctionType().getInputs())) {
959 if (argOp.getType() == fnArgType)
965 errorNYI(call.getLoc(),
"replace call with mismatched types");
970void CIRGenModule::applyReplacements() {
971 for (
auto &i : replacements) {
972 StringRef mangledName = i.first();
973 mlir::Operation *replacement = i.second;
979 auto newF = dyn_cast<cir::FuncOp>(replacement);
982 errorNYI(replacement->getLoc(),
"replacement is not a function");
988 replacePointerTypeArgs(oldF, newF);
991 if (oldF.replaceAllSymbolUses(newF.getSymNameAttr(), theModule).failed())
992 llvm_unreachable(
"internal error, cannot RAUW symbol");
994 newF->moveBefore(oldF);
1001 mlir::Location loc, StringRef name, mlir::Type ty,
1003 auto gv = mlir::dyn_cast_or_null<cir::GlobalOp>(
1004 mlir::SymbolTable::lookupSymbolIn(theModule, name));
1008 if (gv.getSymType() == ty)
1014 assert(gv.isDeclaration() &&
"Declaration has wrong type!");
1016 errorNYI(loc,
"createOrReplaceCXXRuntimeVariable: declaration exists with "
1027 mlir::SymbolTable::setSymbolVisibility(gv,
1031 !gv.hasAvailableExternallyLinkage()) {
1035 gv.setAlignmentAttr(
getSize(alignment));
1046 if ((noCommon || vd->
hasAttr<NoCommonAttr>()) && !vd->
hasAttr<CommonAttr>())
1057 if (vd->
hasAttr<SectionAttr>())
1063 if (vd->
hasAttr<PragmaClangBSSSectionAttr>() ||
1064 vd->
hasAttr<PragmaClangDataSectionAttr>() ||
1065 vd->
hasAttr<PragmaClangRelroSectionAttr>() ||
1066 vd->
hasAttr<PragmaClangRodataSectionAttr>())
1074 if (vd->
hasAttr<WeakImportAttr>())
1084 if (vd->
hasAttr<AlignedAttr>())
1091 for (
const FieldDecl *fd : rd->fields()) {
1092 if (fd->isBitField())
1094 if (fd->hasAttr<AlignedAttr>())
1119 return cir::GlobalLinkageKind::InternalLinkage;
1121 if (dd->
hasAttr<WeakAttr>()) {
1122 if (isConstantVariable)
1123 return cir::GlobalLinkageKind::WeakODRLinkage;
1124 return cir::GlobalLinkageKind::WeakAnyLinkage;
1129 return cir::GlobalLinkageKind::LinkOnceAnyLinkage;
1134 return cir::GlobalLinkageKind::AvailableExternallyLinkage;
1148 return !astContext.getLangOpts().AppleKext
1149 ? cir::GlobalLinkageKind::LinkOnceODRLinkage
1150 : cir::GlobalLinkageKind::InternalLinkage;
1164 return cir::GlobalLinkageKind::ExternalLinkage;
1167 return dd->
hasAttr<CUDAGlobalAttr>()
1168 ? cir::GlobalLinkageKind::ExternalLinkage
1169 : cir::GlobalLinkageKind::InternalLinkage;
1170 return cir::GlobalLinkageKind::WeakODRLinkage;
1179 return cir::GlobalLinkageKind::CommonLinkage;
1186 if (dd->
hasAttr<SelectAnyAttr>())
1187 return cir::GlobalLinkageKind::WeakODRLinkage;
1191 return cir::GlobalLinkageKind::ExternalLinkage;
1203 mlir::Operation *old, cir::FuncOp newFn) {
1205 auto oldFn = mlir::dyn_cast<cir::FuncOp>(old);
1213 if (oldFn->getAttrs().size() <= 1)
1215 "replaceUsesOfNonProtoTypeWithRealFunction: Attribute forwarding");
1218 newFn.setNoProto(oldFn.getNoProto());
1221 std::optional<mlir::SymbolTable::UseRange> symUses =
1222 oldFn.getSymbolUses(oldFn->getParentOp());
1223 for (
const mlir::SymbolTable::SymbolUse &use : symUses.value()) {
1224 mlir::OpBuilder::InsertionGuard guard(builder);
1226 if (
auto noProtoCallOp = mlir::dyn_cast<cir::CallOp>(use.getUser())) {
1227 builder.setInsertionPoint(noProtoCallOp);
1230 cir::CallOp realCallOp = builder.createCallOp(
1231 noProtoCallOp.getLoc(), newFn, noProtoCallOp.getOperands());
1234 noProtoCallOp.replaceAllUsesWith(realCallOp);
1235 noProtoCallOp.erase();
1236 }
else if (
auto getGlobalOp =
1237 mlir::dyn_cast<cir::GetGlobalOp>(use.getUser())) {
1239 getGlobalOp.getAddr().setType(
1240 cir::PointerType::get(newFn.getFunctionType()));
1243 "replaceUsesOfNonProtoTypeWithRealFunction: unexpected use");
1248cir::GlobalLinkageKind
1250 assert(!isConstant &&
"constant variables NYI");
1251 GVALinkage linkage = astContext.GetGVALinkageForVariable(vd);
1258 GVALinkage linkage = astContext.GetGVALinkageForFunction(d);
1260 if (
const auto *dtor = dyn_cast<CXXDestructorDecl>(d))
1269 StringRef globalName,
CharUnits alignment) {
1275 cgm, loc, globalName,
c.getType(), !cgm.
getLangOpts().WritableStrings);
1278 gv.setAlignmentAttr(cgm.
getSize(alignment));
1280 cir::GlobalLinkageKindAttr::get(cgm.
getBuilder().getContext(), lt));
1284 if (gv.isWeakForLinker()) {
1285 assert(cgm.
supportsCOMDAT() &&
"Only COFF uses weak string literals");
1288 cgm.
setDSOLocal(
static_cast<mlir::Operation *
>(gv));
1309 std::string result =
1312 assert(!mlir::SymbolTable::lookupSymbolIn(theModule, result));
1320 astContext.getAlignOfGlobalVarInChars(
s->getType(),
nullptr);
1326 "getGlobalForStringLiteral: Writable strings");
1332 if (
getCXXABI().getMangleContext().shouldMangleStringLiteral(
s) &&
1335 "getGlobalForStringLiteral: mangle string literals");
1341 mlir::Location loc =
getLoc(
s->getSourceRange());
1342 auto typedC = llvm::cast<mlir::TypedAttr>(
c);
1345 *
this, uniqueName, alignment);
1358 auto arrayTy = mlir::dyn_cast<cir::ArrayType>(gv.getSymType());
1359 assert(arrayTy &&
"String literal must be array");
1363 return builder.getGlobalViewAttr(ptrTy, gv);
1372 "emitExplicitCastExprType");
1382 if (
auto *oid = dyn_cast<ObjCImplDecl>(
decl))
1383 errorNYI(oid->getSourceRange(),
"emitDeclConext: ObjCImplDecl");
1393 if (
decl->isTemplated())
1396 switch (
decl->getKind()) {
1399 decl->getDeclKindName());
1402 case Decl::CXXConversion:
1403 case Decl::CXXMethod:
1404 case Decl::Function: {
1407 if (!fd->isConsteval())
1413 case Decl::Decomposition:
1414 case Decl::VarTemplateSpecialization: {
1417 errorNYI(
decl->getSourceRange(),
"global variable decompositions");
1423 case Decl::OpenACCRoutine:
1426 case Decl::OpenACCDeclare:
1431 case Decl::UsingDirective:
1432 case Decl::UsingEnum:
1433 case Decl::NamespaceAlias:
1435 case Decl::TypeAlias:
1441 case Decl::ClassTemplate:
1443 case Decl::CXXDeductionGuide:
1445 case Decl::FunctionTemplate:
1446 case Decl::StaticAssert:
1447 case Decl::TypeAliasTemplate:
1448 case Decl::UsingShadow:
1449 case Decl::VarTemplate:
1450 case Decl::VarTemplatePartialSpecialization:
1453 case Decl::CXXConstructor:
1456 case Decl::CXXDestructor:
1461 case Decl::LinkageSpec:
1462 case Decl::Namespace:
1466 case Decl::ClassTemplateSpecialization:
1467 case Decl::CXXRecord:
1472 case Decl::FileScopeAsm:
1474 if (langOpts.CUDA && langOpts.CUDAIsDevice)
1477 if (langOpts.OpenMPIsTargetDevice)
1480 if (langOpts.SYCLIsDevice)
1483 std::string line = file_asm->getAsmString();
1484 globalScopeAsm.push_back(builder.getStringAttr(line));
1491 op.setInitialValueAttr(value);
1505 md->getParent()->getNumVBases() == 0)
1507 "getAddrAndTypeOfCXXStructor: MS ABI complete destructor");
1518 false, isForDefinition);
1520 return {fnType, fn};
1524 mlir::Type funcType,
bool forVTable,
1528 "consteval function should never be emitted");
1538 if (
const auto *dd = dyn_cast<CXXDestructorDecl>(gd.
getDecl())) {
1541 dd->getParent()->getNumVBases() == 0)
1543 "getAddrOfFunction: MS ABI complete destructor");
1549 false, isForDefinition);
1557 llvm::raw_svector_ostream
out(buffer);
1566 assert(ii &&
"Attempt to mangle unnamed decl.");
1568 const auto *fd = dyn_cast<FunctionDecl>(nd);
1572 }
else if (fd && fd->hasAttr<CUDAGlobalAttr>() &&
1588 if (
const auto *fd = dyn_cast<FunctionDecl>(nd)) {
1589 if (fd->isMultiVersion()) {
1591 "getMangledName: multi-version functions");
1596 "getMangledName: GPU relocatable device code");
1599 return std::string(
out.str());
1607 if (
const auto *cd = dyn_cast<CXXConstructorDecl>(canonicalGd.
getDecl())) {
1610 "getMangledName: C++ constructor without variants");
1619 auto result = manglings.insert(std::make_pair(mangledName, gd));
1620 return mangledDeclNames[canonicalGd] = result.first->first();
1624 assert(!d->
getInit() &&
"Cannot emit definite definitions here!");
1632 if (gv && !mlir::cast<cir::GlobalOp>(gv).isDeclaration())
1648 if (langOpts.EmitAllDecls)
1651 const auto *vd = dyn_cast<VarDecl>(global);
1653 ((codeGenOpts.KeepPersistentStorageVariables &&
1654 (vd->getStorageDuration() ==
SD_Static ||
1655 vd->getStorageDuration() ==
SD_Thread)) ||
1656 (codeGenOpts.KeepStaticConsts && vd->getStorageDuration() ==
SD_Static &&
1657 vd->getType().isConstQualified())))
1670 if (langOpts.OpenMP >= 50 && !langOpts.OpenMPSimd) {
1671 std::optional<OMPDeclareTargetDeclAttr *> activeAttr =
1672 OMPDeclareTargetDeclAttr::getActiveAttr(global);
1673 if (!activeAttr || (*activeAttr)->getLevel() != (
unsigned)-1)
1677 const auto *fd = dyn_cast<FunctionDecl>(global);
1684 if (fd->hasAttr<TargetVersionAttr>() && !fd->isMultiVersion())
1686 if (langOpts.SYCLIsDevice) {
1687 errorNYI(fd->getSourceRange(),
"mayBeEmittedEagerly: SYCL");
1691 const auto *vd = dyn_cast<VarDecl>(global);
1693 if (astContext.getInlineVariableDefinitionKind(vd) ==
1701 if (langOpts.OpenMP && langOpts.OpenMPUseTLS &&
1702 astContext.getTargetInfo().isTLSSupported() &&
isa<VarDecl>(global) &&
1704 !OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(global))
1707 assert((fd || vd) &&
1708 "Only FunctionDecl and VarDecl should hit this path so far.");
1713 cir::CIRGlobalValueInterface gv) {
1714 if (gv.hasLocalLinkage())
1717 if (!gv.hasDefaultVisibility() && !gv.hasExternalWeakLinkage())
1725 const llvm::Triple &tt = cgm.
getTriple();
1727 if (tt.isOSCygMing()) {
1736 cgm.
errorNYI(
"shouldAssumeDSOLocal: MinGW");
1742 if (tt.isOSBinFormatCOFF() && gv.hasExternalWeakLinkage())
1750 if (tt.isOSBinFormatCOFF() || (tt.isOSWindows() && tt.isOSBinFormatMachO()))
1754 if (!tt.isOSBinFormatELF())
1759 if (rm != llvm::Reloc::Static && !lOpts.PIE) {
1767 return !(lOpts.SemanticInterposition || lOpts.HalfNoSemanticInterposition);
1771 if (!gv.isDeclarationForLinker())
1777 if (rm == llvm::Reloc::PIC_ && gv.hasExternalWeakLinkage())
1784 if (cgOpts.DirectAccessExternalData) {
1790 if (
auto globalOp = dyn_cast<cir::GlobalOp>(gv.getOperation())) {
1823 if (
auto globalValue = dyn_cast<cir::CIRGlobalValueInterface>(op))
1842 bool isIncompleteFunction,
1862 StringRef mangledName, mlir::Type funcType,
GlobalDecl gd,
bool forVTable,
1864 mlir::ArrayAttr extraAttrs) {
1873 if (
const auto *fd = cast_or_null<FunctionDecl>(d)) {
1875 if (
getLangOpts().OpenMPIsTargetDevice && fd->isDefined() && !dontDefer &&
1878 "getOrCreateCIRFunction: OpenMP target function");
1882 if (fd->isMultiVersion())
1883 errorNYI(fd->getSourceRange(),
"getOrCreateCIRFunction: multi-version");
1889 assert(mlir::isa<cir::FuncOp>(entry));
1894 if (d && !d->
hasAttr<DLLImportAttr>() && !d->
hasAttr<DLLExportAttr>()) {
1902 if (isForDefinition && fn && !fn.isDeclaration()) {
1905 if (fn && fn.getFunctionType() == funcType) {
1909 if (!isForDefinition) {
1917 auto *funcDecl = llvm::cast_or_null<FunctionDecl>(gd.
getDecl());
1918 bool invalidLoc = !funcDecl ||
1919 funcDecl->getSourceRange().getBegin().isInvalid() ||
1920 funcDecl->getSourceRange().getEnd().isInvalid();
1922 invalidLoc ? theModule->getLoc() :
getLoc(funcDecl->getSourceRange()),
1923 mangledName, mlir::cast<cir::FuncType>(funcType), funcDecl);
1934 auto symbolOp = mlir::cast<mlir::SymbolOpInterface>(entry);
1942 if (symbolOp.getSymbolUses(symbolOp->getParentOp()))
1956 assert(funcOp.getFunctionType() == funcType);
1963 if (isa_and_nonnull<CXXDestructorDecl>(d) &&
1993 fd = fd->getPreviousDecl()) {
1995 if (fd->doesThisDeclarationHaveABody()) {
2008 cir::FuncType funcType,
2012 mlir::OpBuilder::InsertionGuard guard(builder);
2020 builder.setInsertionPoint(cgf->
curFn);
2022 func = builder.create<cir::FuncOp>(loc, name, funcType);
2027 func.setNoProto(
true);
2029 assert(func.isDeclaration() &&
"expected empty body");
2033 func.setLinkageAttr(cir::GlobalLinkageKindAttr::get(
2035 mlir::SymbolTable::setSymbolVisibility(
2036 func, mlir::SymbolTable::Visibility::Private);
2041 theModule.push_back(func);
2046mlir::SymbolTable::Visibility
2050 if (op.isDeclaration())
2051 return mlir::SymbolTable::Visibility::Private;
2055mlir::SymbolTable::Visibility
2058 case cir::GlobalLinkageKind::InternalLinkage:
2059 case cir::GlobalLinkageKind::PrivateLinkage:
2060 return mlir::SymbolTable::Visibility::Private;
2061 case cir::GlobalLinkageKind::ExternalLinkage:
2062 case cir::GlobalLinkageKind::ExternalWeakLinkage:
2063 case cir::GlobalLinkageKind::LinkOnceODRLinkage:
2064 case cir::GlobalLinkageKind::AvailableExternallyLinkage:
2065 case cir::GlobalLinkageKind::CommonLinkage:
2066 case cir::GlobalLinkageKind::WeakAnyLinkage:
2067 case cir::GlobalLinkageKind::WeakODRLinkage:
2068 return mlir::SymbolTable::Visibility::Public;
2070 llvm::errs() <<
"visibility not implemented for '"
2071 << stringifyGlobalLinkageKind(glk) <<
"'\n";
2072 assert(0 &&
"not implemented");
2075 llvm_unreachable(
"linkage should be handled above!");
2079 clang::VisibilityAttr::VisibilityType visibility) {
2080 switch (visibility) {
2081 case clang::VisibilityAttr::VisibilityType::Default:
2082 return cir::VisibilityKind::Default;
2083 case clang::VisibilityAttr::VisibilityType::Hidden:
2084 return cir::VisibilityKind::Hidden;
2085 case clang::VisibilityAttr::VisibilityType::Protected:
2086 return cir::VisibilityKind::Protected;
2088 llvm_unreachable(
"unexpected visibility value");
2093 const clang::VisibilityAttr *va =
decl->getAttr<clang::VisibilityAttr>();
2094 cir::VisibilityAttr cirVisibility =
2097 cirVisibility = cir::VisibilityAttr::get(
2101 return cirVisibility;
2106 applyReplacements();
2108 theModule->setAttr(cir::CIRDialect::getModuleLevelAsmAttrName(),
2109 builder.getArrayAttr(globalScopeAsm));
2117 cir::FuncOp aliasee,
2118 cir::GlobalLinkageKind linkage) {
2120 auto *aliasFD = dyn_cast<FunctionDecl>(aliasGD.
getDecl());
2121 assert(aliasFD &&
"expected FunctionDecl");
2132 mangledName, fnType, aliasFD);
2133 alias.setAliasee(aliasee.getName());
2134 alias.setLinkage(linkage);
2138 mlir::SymbolTable::setSymbolVisibility(
2139 alias, mlir::SymbolTable::Visibility::Private);
2146 errorNYI(aliasFD->getSourceRange(),
"emitAliasForGlobal: previous uses");
2156 return genTypes.convertType(
type);
2163 return mlir::verify(theModule).succeeded();
2172 return builder.getConstNullPtrAttr(builder.getUInt8PtrTy());
2174 errorNYI(loc,
"getAddrOfRTTIDescriptor");
2175 return mlir::Attribute();
2181 llvm::iterator_range<CastExpr::path_const_iterator> path) {
2188 assert(!base->isVirtual() &&
"Should not see virtual bases here!");
2193 const auto *baseDecl = base->getType()->castAsCXXRecordDecl();
2205 llvm::StringRef feature) {
2206 unsigned diagID = diags.getCustomDiagID(
2208 return diags.Report(loc, diagID) << feature;
2212 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 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)
cir::FuncOp curFn
The function for which code is currently being generated.
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
static mlir::SymbolTable::Visibility getMLIRVisibility(cir::GlobalOp op)
const llvm::Triple & getTriple() const
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 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.
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,...
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 needsGlobalCtorDtor()
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.