From 231aa3070dcd91e10e9972d20f7557c0068c41e3 Mon Sep 17 00:00:00 2001 From: Erich Keane Date: Tue, 8 Apr 2025 10:06:28 -0700 Subject: [OpenACC][CIR] Basic infrastructure for OpenACC lowering (#134717) This is the first of a few patches that will do infrastructure work to enable the OpenACC lowering via the OpenACC dialect. At the moment this just gets the various function calls that will end up generating OpenACC, plus some tests to validate that we're doing the diagnostics in OpenACC specific locations. Additionally, this adds Stmt and Decl files for CIRGen. --- clang/lib/CIR/CodeGen/CIRGenModule.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'clang/lib/CIR/CodeGen/CIRGenModule.cpp') diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp index d3b3b06..f0e9b03 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp @@ -16,6 +16,7 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/DeclBase.h" +#include "clang/AST/DeclOpenACC.h" #include "clang/AST/GlobalDecl.h" #include "clang/Basic/SourceManager.h" #include "clang/CIR/Dialect/IR/CIRDialect.h" @@ -91,6 +92,11 @@ mlir::Location CIRGenModule::getLoc(SourceRange cRange) { } void CIRGenModule::emitGlobal(clang::GlobalDecl gd) { + if (const auto *cd = dyn_cast(gd.getDecl())) { + emitGlobalOpenACCDecl(cd); + return; + } + const auto *global = cast(gd.getDecl()); if (const auto *fd = dyn_cast(global)) { @@ -423,6 +429,12 @@ void CIRGenModule::emitTopLevelDecl(Decl *decl) { emitGlobal(vd); break; } + case Decl::OpenACCRoutine: + emitGlobalOpenACCDecl(cast(decl)); + break; + case Decl::OpenACCDeclare: + emitGlobalOpenACCDecl(cast(decl)); + break; } } -- cgit v1.1