Skip to content

Commit 011d38b

Browse files
committed
[OpenACC] Update OpenACC macro, remove override macro
As we are now Sema-complete for OpenACC 3.4 (and thus have a conforming implementation, in all modes), we can now set the _OPENACC macro correctly. Additionally, we remove the temporary 'override' functionality, which was intended to allow people to experiment with this. We aren't having a deprecation period as OpenACC support is still considered experimental.
1 parent d97c224 commit 011d38b

File tree

7 files changed

+6
-65
lines changed

7 files changed

+6
-65
lines changed

clang/include/clang/Basic/LangOptions.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -633,11 +633,6 @@ class LangOptions : public LangOptionsBase {
633633
// received as a result of a standard operator new (-fcheck-new)
634634
bool CheckNew = false;
635635

636-
// In OpenACC mode, contains a user provided override for the _OPENACC macro.
637-
// This exists so that we can override the macro value and test our incomplete
638-
// implementation on real-world examples.
639-
std::string OpenACCMacroOverride;
640-
641636
/// The HLSL root signature version for dxil.
642637
llvm::dxbc::RootSignatureVersion HLSLRootSigVer =
643638
llvm::dxbc::RootSignatureVersion::V1_1;

clang/include/clang/Driver/Options.td

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,19 +1422,6 @@ def fno_hip_emit_relocatable : Flag<["-"], "fno-hip-emit-relocatable">,
14221422
HelpText<"Do not override toolchain to compile HIP source to relocatable">;
14231423
}
14241424

1425-
// Clang specific/exclusive options for OpenACC.
1426-
def openacc_macro_override
1427-
: Separate<["-"], "fexperimental-openacc-macro-override">,
1428-
Visibility<[ClangOption, CC1Option]>,
1429-
Group<f_Group>,
1430-
HelpText<"Overrides the _OPENACC macro value for experimental testing "
1431-
"during OpenACC support development">;
1432-
def openacc_macro_override_EQ
1433-
: Joined<["-"], "fexperimental-openacc-macro-override=">,
1434-
Alias<openacc_macro_override>;
1435-
1436-
// End Clang specific/exclusive options for OpenACC.
1437-
14381425
def libomptarget_amdgpu_bc_path_EQ : Joined<["--"], "libomptarget-amdgpu-bc-path=">, Group<i_Group>,
14391426
HelpText<"Path to libomptarget-amdgcn bitcode library">;
14401427
def libomptarget_amdgcn_bc_path_EQ : Joined<["--"], "libomptarget-amdgcn-bc-path=">, Group<i_Group>,

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3846,15 +3846,6 @@ static void RenderOpenACCOptions(const Driver &D, const ArgList &Args,
38463846
return;
38473847

38483848
CmdArgs.push_back("-fopenacc");
3849-
3850-
if (Arg *A = Args.getLastArg(options::OPT_openacc_macro_override)) {
3851-
StringRef Value = A->getValue();
3852-
int Version;
3853-
if (!Value.getAsInteger(10, Version))
3854-
A->renderAsInput(Args, CmdArgs);
3855-
else
3856-
D.Diag(diag::err_drv_clang_unsupported) << Value;
3857-
}
38583849
}
38593850

38603851
static void RenderBuiltinOptions(const ToolChain &TC, const llvm::Triple &T,

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3913,12 +3913,8 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions &Opts,
39133913
if (Opts.OpenMPCUDAMode)
39143914
GenerateArg(Consumer, OPT_fopenmp_cuda_mode);
39153915

3916-
if (Opts.OpenACC) {
3916+
if (Opts.OpenACC)
39173917
GenerateArg(Consumer, OPT_fopenacc);
3918-
if (!Opts.OpenACCMacroOverride.empty())
3919-
GenerateArg(Consumer, OPT_openacc_macro_override,
3920-
Opts.OpenACCMacroOverride);
3921-
}
39223918

39233919
// The arguments used to set Optimize, OptimizeSize and NoInlineDefine are
39243920
// generated from CodeGenOptions.
@@ -4424,13 +4420,9 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
44244420
Args.hasArg(options::OPT_fopenmp_cuda_mode);
44254421

44264422
// OpenACC Configuration.
4427-
if (Args.hasArg(options::OPT_fopenacc)) {
4423+
if (Args.hasArg(options::OPT_fopenacc))
44284424
Opts.OpenACC = true;
44294425

4430-
if (Arg *A = Args.getLastArg(options::OPT_openacc_macro_override))
4431-
Opts.OpenACCMacroOverride = A->getValue();
4432-
}
4433-
44344426
if (Arg *A = Args.getLastArg(OPT_ffp_contract)) {
44354427
StringRef Val = A->getValue();
44364428
if (Val == "fast")

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -639,16 +639,8 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
639639
}
640640
}
641641

642-
if (LangOpts.OpenACC) {
643-
// FIXME: When we have full support for OpenACC, we should set this to the
644-
// version we support. Until then, set as '1' by default, but provide a
645-
// temporary mechanism for users to override this so real-world examples can
646-
// be tested against.
647-
if (!LangOpts.OpenACCMacroOverride.empty())
648-
Builder.defineMacro("_OPENACC", LangOpts.OpenACCMacroOverride);
649-
else
650-
Builder.defineMacro("_OPENACC", "1");
651-
}
642+
if (LangOpts.OpenACC)
643+
Builder.defineMacro("_OPENACC", "202506");
652644
}
653645

654646
/// Initialize the predefined C++ language feature test macros defined in

clang/test/Driver/openacc.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,2 @@
11
// RUN: %clang -S -### -fopenacc %s 2>&1 | FileCheck %s --check-prefix=CHECK-DRIVER
22
// CHECK-DRIVER: "-cc1" {{.*}} "-fopenacc"
3-
4-
// RUN: %clang -S -### -fopenacc -fexperimental-openacc-macro-override=202211 %s 2>&1 | FileCheck %s --check-prefix=CHECK-MACRO-OVERRIDE
5-
// RUN: %clang -S -### -fopenacc -fexperimental-openacc-macro-override 202211 %s 2>&1 | FileCheck %s --check-prefix=CHECK-MACRO-OVERRIDE
6-
// CHECK-MACRO-OVERRIDE: "-cc1"{{.*}} "-fexperimental-openacc-macro-override" "202211"
7-
8-
// RUN: not %clang -S -fopenacc -fexperimental-openacc-macro-override=202211L %s 2>&1 | FileCheck %s --check-prefix=INVALID
9-
// RUN: not %clang -S -fopenacc -fexperimental-openacc-macro-override 202211L %s 2>&1 | FileCheck %s --check-prefix=INVALID
10-
// RUN: not %clang -S -fopenacc -fexperimental-openacc-macro-override=L202211 %s 2>&1 | FileCheck %s --check-prefix=INVALID
11-
// RUN: not %clang -S -fopenacc -fexperimental-openacc-macro-override L202211 %s 2>&1 | FileCheck %s --check-prefix=INVALID
12-
// RUN: not %clang -S -fopenacc -fexperimental-openacc-macro-override=2022L11 %s 2>&1 | FileCheck %s --check-prefix=INVALID
13-
// RUN: not %clang -S -fopenacc -fexperimental-openacc-macro-override 2022L11 %s 2>&1 | FileCheck %s --check-prefix=INVALID
14-
// INVALID: error: the clang compiler does not support

clang/test/Preprocessor/openacc.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
// RUN: %clang_cc1 -E -fopenacc %s | FileCheck %s --check-prefix=DEFAULT
2-
// RUN: %clang_cc1 -E -fopenacc -fexperimental-openacc-macro-override 202211 %s | FileCheck %s --check-prefix=OVERRIDE
32

4-
// DEFAULT: OpenACC:1:
5-
// OVERRIDE: OpenACC:202211:
3+
// DEFAULT: OpenACC:202506:
64
OpenACC:_OPENACC:
75

86
// RUN: %clang_cc1 -E -dM -fopenacc %s | FileCheck %s --check-prefix=MACRO_PRINT_DEF
9-
// RUN: %clang_cc1 -E -dM -fopenacc -fexperimental-openacc-macro-override 202211 %s | FileCheck %s --check-prefix=MACRO_PRINT_OVR
10-
// MACRO_PRINT_DEF: #define _OPENACC 1
11-
// MACRO_PRINT_OVR: #define _OPENACC 202211
7+
// MACRO_PRINT_DEF: #define _OPENACC 202506
128

139

0 commit comments

Comments
 (0)