aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.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/Frontend/CompilerInvocation.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/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 572c71e..cfc5c06 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -4674,6 +4674,51 @@ static bool isStrictlyPreprocessorAction(frontend::ActionKind Action) {
llvm_unreachable("invalid frontend action");
}
+static bool isCodeGenAction(frontend::ActionKind Action) {
+ switch (Action) {
+ case frontend::EmitAssembly:
+ case frontend::EmitBC:
+ case frontend::EmitCIR:
+ case frontend::EmitHTML:
+ case frontend::EmitLLVM:
+ case frontend::EmitLLVMOnly:
+ case frontend::EmitCodeGenOnly:
+ case frontend::EmitObj:
+ case frontend::GenerateModule:
+ case frontend::GenerateModuleInterface:
+ case frontend::GenerateReducedModuleInterface:
+ case frontend::GenerateHeaderUnit:
+ case frontend::GeneratePCH:
+ case frontend::GenerateInterfaceStubs:
+ return true;
+ case frontend::ASTDeclList:
+ case frontend::ASTDump:
+ case frontend::ASTPrint:
+ case frontend::ASTView:
+ case frontend::ExtractAPI:
+ case frontend::FixIt:
+ case frontend::ParseSyntaxOnly:
+ case frontend::ModuleFileInfo:
+ case frontend::VerifyPCH:
+ case frontend::PluginAction:
+ case frontend::RewriteObjC:
+ case frontend::RewriteTest:
+ case frontend::RunAnalysis:
+ case frontend::TemplightDump:
+ case frontend::DumpCompilerOptions:
+ case frontend::DumpRawTokens:
+ case frontend::DumpTokens:
+ case frontend::InitOnly:
+ case frontend::PrintPreamble:
+ case frontend::PrintPreprocessedInput:
+ case frontend::RewriteMacros:
+ case frontend::RunPreprocessorOnly:
+ case frontend::PrintDependencyDirectivesSourceMinimizerOutput:
+ return false;
+ }
+ llvm_unreachable("invalid frontend action");
+}
+
static void GeneratePreprocessorArgs(const PreprocessorOptions &Opts,
ArgumentConsumer Consumer,
const LangOptions &LangOpts,
@@ -5001,6 +5046,10 @@ bool CompilerInvocation::CreateFromArgsImpl(
Res.getTargetOpts().HostTriple = Res.getFrontendOpts().AuxTriple;
}
+ if (LangOpts.OpenACC && !Res.getFrontendOpts().UseClangIRPipeline &&
+ isCodeGenAction(Res.getFrontendOpts().ProgramAction))
+ Diags.Report(diag::warn_drv_openacc_without_cir);
+
// Set the triple of the host for OpenMP device compile.
if (LangOpts.OpenMPIsTargetDevice)
Res.getTargetOpts().HostTriple = Res.getFrontendOpts().AuxTriple;