5#include "mlir/Dialect/Ptr/IR/MemorySpaceInterfaces.h"
21 if (
const CXXRecordDecl *cxxrd = dyn_cast<CXXRecordDecl>(rd)) {
22 if (cxxrd->isDynamicClass())
25 for (
const auto &i : cxxrd->bases())
30 for (
const auto *i : rd->fields())
50class AMDGPUABIInfo :
public ABIInfo {
57 AMDGPUTargetCIRGenInfo(CIRGenTypes &cgt)
58 : TargetCIRGenInfo(std::make_unique<AMDGPUABIInfo>(cgt)) {}
60 bool supportsLibCall()
const override {
return false; }
62 void setTargetAttributes(
const clang::Decl *
decl, mlir::Operation *global,
63 CIRGenModule &cgm)
const override {
64 if (
auto func = mlir::dyn_cast<cir::FuncOp>(global)) {
66 func.setGlobalVisibility(cir::VisibilityKind::Protected);
67 func.setDSOLocal(
true);
70 }
else if (
auto gv = mlir::dyn_cast<cir::GlobalOp>(global)) {
72 gv.setGlobalVisibility(cir::VisibilityKind::Protected);
79 getGlobalVarAddressSpace(CIRGenModule &cgm,
80 const clang::VarDecl *
decl)
const override {
84 "Address space agnostic languages only");
85 LangAS defaultGlobalAS = LangAS::opencl_global;
87 return defaultGlobalAS;
89 LangAS addrSpace =
decl->getType().getAddressSpace();
90 if (addrSpace != LangAS::Default)
95 decl->hasConstantInitialization())
96 return LangAS::opencl_constant;
98 return defaultGlobalAS;
101 mlir::ptr::MemorySpaceAttrInterface
102 getCIRAllocaAddressSpace()
const override {
103 return cir::LangAddressSpaceAttr::get(
104 &getABIInfo().cgt.getMLIRContext(),
105 cir::LangAddressSpace::OffloadPrivate);
113class X8664ABIInfo :
public ABIInfo {
115 X8664ABIInfo(CIRGenTypes &cgt) : ABIInfo(cgt) {}
120 X8664TargetCIRGenInfo(CIRGenTypes &cgt)
121 : TargetCIRGenInfo(std::make_unique<X8664ABIInfo>(cgt)) {}
125std::unique_ptr<TargetCIRGenInfo>
127 return std::make_unique<AMDGPUTargetCIRGenInfo>(cgt);
130std::unique_ptr<TargetCIRGenInfo>
132 return std::make_unique<X8664TargetCIRGenInfo>(cgt);
151 "Address space agnostic languages only");
Provides definitions for the various language-specific address spaces.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
This class organizes the cross-function state that is used while generating CIR code.
clang::ASTContext & getASTContext() const
const clang::LangOptions & getLangOpts() const
This class organizes the cross-module state that is used while lowering AST types to CIR types.
TargetCIRGenInfo(std::unique_ptr< ABIInfo > info)
virtual clang::LangAS getGlobalVarAddressSpace(CIRGenModule &cgm, const clang::VarDecl *d) const
Get target favored AST address space of a global variable for languages other than OpenCL and CUDA.
virtual bool isNoProtoCallVariadic(const FunctionNoProtoType *fnType) const
Determine whether a call to an unprototyped functions under the given calling convention should use t...
Represents a C++ struct/union/class.
Represents a member of a struct/union/class.
bool isUnnamedBitField() const
Determines whether this is an unnamed bitfield.
bool isZeroLengthBitField() const
Is this a zero-length bit-field?
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
A (possibly-)qualified type.
LangAS getAddressSpace() const
Return the address space of this type.
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
Represents a variable declaration or definition.
void setAMDGPUTargetFunctionAttributes(const clang::Decl *decl, cir::FuncOp func, CIRGenModule &cgm)
Set AMDGPU-specific function attributes for HIP kernels.
std::unique_ptr< TargetCIRGenInfo > createAMDGPUTargetCIRGenInfo(CIRGenTypes &cgt)
std::unique_ptr< TargetCIRGenInfo > createX8664TargetCIRGenInfo(CIRGenTypes &cgt)
bool isEmptyFieldForLayout(const ASTContext &context, const FieldDecl *fd)
isEmptyFieldForLayout - Return true if the field is "empty", that is, either a zero-width bit-field o...
bool isEmptyRecordForLayout(const ASTContext &context, QualType t)
isEmptyRecordForLayout - Return true if a structure contains only empty base classes (per isEmptyReco...
bool requiresAMDGPUProtectedVisibility(const clang::Decl *d, cir::VisibilityKind visibility)
Check if AMDGPU protected visibility is required.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
The JSON file list parser is used to communicate input to InstallAPI.
LangAS
Defines the address space values used by the address space qualifier of QualType.