aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorDominik Adamski <dominik.adamski@amd.com>2023-11-28 19:57:36 +0100
committerDominik Adamski <dominik.adamski@amd.com>2023-11-29 03:01:01 -0600
commit95943d2fab7e6f8dcea216df2d56a0512201b467 (patch)
tree340b052fdc9f726ff8c2c2929515e1fd8bbc4cd3 /flang/lib/Frontend/CompilerInvocation.cpp
parentebeae22cdebc1db62a0264cf8f5179d079ff3262 (diff)
downloadllvm-95943d2fab7e6f8dcea216df2d56a0512201b467.zip
llvm-95943d2fab7e6f8dcea216df2d56a0512201b467.tar.gz
llvm-95943d2fab7e6f8dcea216df2d56a0512201b467.tar.bz2
[Flang] Add code-object-version option (#72638)
Information about code object version can be configured by the user for AMD GPU target and it needs to be placed in LLVM IR generated by Flang. Information about code object version in MLIR generated by the parser can be reused by other tools. There is no need to specify extra flags if we want to invoke MLIR tools (like fir-opt) separately. Changes in comparison to a8ac93: * added information about required targets for test flang/test/Driver/driver-help.f90
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 1c09ae9..0dc11ab 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -268,6 +268,17 @@ static void parseCodeGenArgs(Fortran::frontend::CodeGenOptions &opts,
opts.PrepareForThinLTO = true;
}
+ if (const llvm::opt::Arg *a = args.getLastArg(
+ clang::driver::options::OPT_mcode_object_version_EQ)) {
+ llvm::StringRef s = a->getValue();
+ if (s == "5")
+ opts.CodeObjectVersion = llvm::CodeObjectVersionKind::COV_5;
+ if (s == "4")
+ opts.CodeObjectVersion = llvm::CodeObjectVersionKind::COV_4;
+ if (s == "none")
+ opts.CodeObjectVersion = llvm::CodeObjectVersionKind::COV_None;
+ }
+
// -f[no-]save-optimization-record[=<format>]
if (const llvm::opt::Arg *a =
args.getLastArg(clang::driver::options::OPT_opt_record_file))