aboutsummaryrefslogtreecommitdiff
path: root/flang/lib
diff options
context:
space:
mode:
authorKelvin Li <kkwli@users.noreply.github.com>2024-10-29 14:20:11 -0400
committerGitHub <noreply@github.com>2024-10-29 14:20:11 -0400
commit8e14c6c172b122203f46a9ad114d51c74535cbb7 (patch)
treee77b7e46db7503dc4404f50b7a66d2825ee36d2d /flang/lib
parent9e37cbb469c0ec2fdbf4e3e7b0d9a2938ac30b01 (diff)
downloadllvm-8e14c6c172b122203f46a9ad114d51c74535cbb7.zip
llvm-8e14c6c172b122203f46a9ad114d51c74535cbb7.tar.gz
llvm-8e14c6c172b122203f46a9ad114d51c74535cbb7.tar.bz2
[flang] Support -mabi=vec-extabi and -mabi=vec-default on AIX (#113215)
This option is to enable the AIX extended and default vector ABIs.
Diffstat (limited to 'flang/lib')
-rw-r--r--flang/lib/Frontend/CompilerInstance.cpp7
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp10
2 files changed, 15 insertions, 2 deletions
diff --git a/flang/lib/Frontend/CompilerInstance.cpp b/flang/lib/Frontend/CompilerInstance.cpp
index d37430e..35c2ae3 100644
--- a/flang/lib/Frontend/CompilerInstance.cpp
+++ b/flang/lib/Frontend/CompilerInstance.cpp
@@ -313,7 +313,6 @@ bool CompilerInstance::setUpTargetMachine() {
<< error;
return false;
}
-
// Create `TargetMachine`
const auto &CGOpts = getInvocation().getCodeGenOpts();
std::optional<llvm::CodeGenOptLevel> OptLevelOrNone =
@@ -322,9 +321,13 @@ bool CompilerInstance::setUpTargetMachine() {
llvm::CodeGenOptLevel OptLevel = *OptLevelOrNone;
std::string featuresStr = getTargetFeatures();
std::optional<llvm::CodeModel::Model> cm = getCodeModel(CGOpts.CodeModel);
+
+ llvm::TargetOptions tOpts = llvm::TargetOptions();
+ tOpts.EnableAIXExtendedAltivecABI = targetOpts.EnableAIXExtendedAltivecABI;
+
targetMachine.reset(theTarget->createTargetMachine(
theTriple, /*CPU=*/targetOpts.cpu,
- /*Features=*/featuresStr, llvm::TargetOptions(),
+ /*Features=*/featuresStr, /*Options=*/tOpts,
/*Reloc::Model=*/CGOpts.getRelocationModel(),
/*CodeModel::Model=*/cm, OptLevel));
assert(targetMachine && "Failed to create TargetMachine");
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 94d3d11..1214a2e 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -457,6 +457,16 @@ static void parseTargetArgs(TargetOptions &opts, llvm::opt::ArgList &args) {
if (args.hasArg(clang::driver::options::OPT_fdisable_integer_16))
opts.disabledIntegerKinds.push_back(16);
+
+ if (const llvm::opt::Arg *a =
+ args.getLastArg(clang::driver::options::OPT_mabi_EQ)) {
+ llvm::StringRef V = a->getValue();
+ if (V == "vec-extabi") {
+ opts.EnableAIXExtendedAltivecABI = true;
+ } else if (V == "vec-default") {
+ opts.EnableAIXExtendedAltivecABI = false;
+ }
+ }
}
// Tweak the frontend configuration based on the frontend action
static void setUpFrontendBasedOnAction(FrontendOptions &opts) {