aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CIR/CodeGen/CIRGenModule.cpp
diff options
context:
space:
mode:
authorErich Keane <ekeane@nvidia.com>2025-04-08 10:06:28 -0700
committerGitHub <noreply@github.com>2025-04-08 10:06:28 -0700
commit231aa3070dcd91e10e9972d20f7557c0068c41e3 (patch)
tree843ca819e11788993ad1538ccfbd87219706bf0f /clang/lib/CIR/CodeGen/CIRGenModule.cpp
parentedcbd4a21179ca5e0fa9095d28a38fe10de66322 (diff)
downloadllvm-231aa3070dcd91e10e9972d20f7557c0068c41e3.zip
llvm-231aa3070dcd91e10e9972d20f7557c0068c41e3.tar.gz
llvm-231aa3070dcd91e10e9972d20f7557c0068c41e3.tar.bz2
[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.
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenModule.cpp')
-rw-r--r--clang/lib/CIR/CodeGen/CIRGenModule.cpp12
1 files changed, 12 insertions, 0 deletions
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<clang::OpenACCConstructDecl>(gd.getDecl())) {
+ emitGlobalOpenACCDecl(cd);
+ return;
+ }
+
const auto *global = cast<ValueDecl>(gd.getDecl());
if (const auto *fd = dyn_cast<FunctionDecl>(global)) {
@@ -423,6 +429,12 @@ void CIRGenModule::emitTopLevelDecl(Decl *decl) {
emitGlobal(vd);
break;
}
+ case Decl::OpenACCRoutine:
+ emitGlobalOpenACCDecl(cast<OpenACCRoutineDecl>(decl));
+ break;
+ case Decl::OpenACCDeclare:
+ emitGlobalOpenACCDecl(cast<OpenACCDeclareDecl>(decl));
+ break;
}
}