15#include "mlir/Dialect/OpenACC/OpenACC.h"
16#include "mlir/IR/MLIRContext.h"
17#include "mlir/Target/LLVMIR/Import.h"
23#include "llvm/IR/DataLayout.h"
28void CIRGenerator::anchor() {}
33 : diags(diags), fs(
std::move(vfs)), codeGenOpts{cgo},
34 handlingTopLevelDecls{0} {}
41 mlir::MLIRContext *mlirContext = mod.getContext();
42 mlir::DataLayoutSpecInterface dlSpec =
43 mlir::translateDataLayout(dl, mlirContext);
44 mod->setAttr(mlir::DLTIDialect::kDataLayoutAttrName, dlSpec);
50 this->astContext = &astContext;
52 mlirContext = std::make_unique<mlir::MLIRContext>();
55 mlirContext->getOrLoadDialect<mlir::acc::OpenACCDialect>();
58 mlir::DialectRegistry registry;
62 cgm = std::make_unique<clang::CIRGen::CIRGenModule>(
63 *
mlirContext.get(), astContext, codeGenOpts, diags);
64 mlir::ModuleOp mod =
cgm->getModule();
65 llvm::DataLayout layout =
78 HandlingTopLevelDeclRAII handlingDecl(*
this);
109 deferredInlineMemberFuncDefs.push_back(d);
118 if (deferredInlineMemberFuncDefs.empty())
126 HandlingTopLevelDeclRAII handlingDecls(*
this);
127 for (
unsigned i = 0; i != deferredInlineMemberFuncDefs.size(); ++i)
128 cgm->emitTopLevelDecl(deferredInlineMemberFuncDefs[i]);
129 deferredInlineMemberFuncDefs.clear();
142 HandlingTopLevelDeclRAII handlingDecl(*
this,
false);
144 cgm->updateCompletedType(d);
166 cgm->handleCXXStaticMemberVarInstantiation(
D);
173 cgm->emitTentativeDefinition(d);
static void setMLIRDataLayout(mlir::ModuleOp &mod, const llvm::DataLayout &dl)
void HandleTagDeclDefinition(clang::TagDecl *d) override
HandleTagDeclDefinition - This callback is invoked each time a TagDecl to (e.g.
CIRGenerator(clang::DiagnosticsEngine &diags, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > fs, const clang::CodeGenOptions &cgo)
mlir::ModuleOp getModule() const
std::unique_ptr< clang::CIRGen::CIRGenModule > cgm
void HandleTranslationUnit(clang::ASTContext &astContext) override
HandleTranslationUnit - This method is called when the ASTs for entire translation unit have been par...
bool verifyModule() const
void HandleVTable(clang::CXXRecordDecl *rd) override
Callback involved at the end of a translation unit to notify the consumer that a vtable for the given...
bool HandleTopLevelDecl(clang::DeclGroupRef group) override
HandleTopLevelDecl - Handle the specified top-level declaration.
void CompleteTentativeDefinition(clang::VarDecl *d) override
CompleteTentativeDefinition - Callback invoked at the end of a translation unit to notify the consume...
void HandleTagDeclRequiredDefinition(const clang::TagDecl *D) override
This callback is invoked the first time each TagDecl is required to be complete.
void HandleInlineFunctionDefinition(clang::FunctionDecl *d) override
This callback is invoked each time an inline (method or friend) function definition in a class is com...
void HandleCXXStaticMemberVarInstantiation(clang::VarDecl *D) override
HandleCXXStaticMemberVarInstantiation - Tell the consumer that this.
std::unique_ptr< mlir::MLIRContext > mlirContext
void Initialize(clang::ASTContext &astContext) override
Initialize - This is called to initialize the consumer, providing the ASTContext.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const LangOptions & getLangOpts() const
const TargetInfo & getTargetInfo() const
Represents a C++ struct/union/class.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
Decl - This represents one declaration (or definition), e.g.
Concrete class used by the front-end to report problems and issues.
bool hasErrorOccurred() const
bool hasUnrecoverableErrorOccurred() const
Determine whether any kind of unrecoverable error has occurred.
Represents a function declaration or definition.
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
Represents the declaration of a struct/union/class/enum.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
const char * getDataLayoutString() const
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
Represents a variable declaration or definition.
void registerOpenACCExtensions(mlir::DialectRegistry ®istry)
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
The JSON file list parser is used to communicate input to InstallAPI.
Diagnostic wrappers for TextAPI types for error reporting.
static bool coverageMapping()
static bool cleanupAfterErrorDiags()
static bool generateDebugInfo()