aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Frontend
diff options
context:
space:
mode:
authorTom Eccles <tom.eccles@arm.com>2023-11-13 10:04:50 +0000
committerGitHub <noreply@github.com>2023-11-13 10:04:50 +0000
commita207e6307a589d482fd11c1aac17507c6eabc802 (patch)
tree7e43a5318da175a334bde09077f6ef1f072b7375 /llvm/lib/Frontend
parent4cc791bc98e075879f8c379f17e0b0369d57a40d (diff)
downloadllvm-a207e6307a589d482fd11c1aac17507c6eabc802.zip
llvm-a207e6307a589d482fd11c1aac17507c6eabc802.tar.gz
llvm-a207e6307a589d482fd11c1aac17507c6eabc802.tar.bz2
[flang] add fveclib flag (#71734)
-fveclib= allows users to choose a vectorized libm so that loops containing math functions are vectorized. This is implemented as much as possible in the same way as in clang. The driver test in veclib.f90 is copied from the clang test.
Diffstat (limited to 'llvm/lib/Frontend')
-rw-r--r--llvm/lib/Frontend/CMakeLists.txt1
-rw-r--r--llvm/lib/Frontend/Driver/CMakeLists.txt15
-rw-r--r--llvm/lib/Frontend/Driver/CodeGenOptions.cpp55
3 files changed, 71 insertions, 0 deletions
diff --git a/llvm/lib/Frontend/CMakeLists.txt b/llvm/lib/Frontend/CMakeLists.txt
index 5ef092e..62dd0da 100644
--- a/llvm/lib/Frontend/CMakeLists.txt
+++ b/llvm/lib/Frontend/CMakeLists.txt
@@ -1,3 +1,4 @@
+add_subdirectory(Driver)
add_subdirectory(HLSL)
add_subdirectory(OpenACC)
add_subdirectory(OpenMP)
diff --git a/llvm/lib/Frontend/Driver/CMakeLists.txt b/llvm/lib/Frontend/Driver/CMakeLists.txt
new file mode 100644
index 0000000..23de499
--- /dev/null
+++ b/llvm/lib/Frontend/Driver/CMakeLists.txt
@@ -0,0 +1,15 @@
+add_llvm_component_library(LLVMFrontendDriver
+ CodeGenOptions.cpp
+
+ ADDITIONAL_HEADER_DIRS
+ ${LLVM_MAIN_INCLUDE_DIR}/llvm/Frontend/Driver
+
+ DEPENDS
+ LLVMAnalysis
+ LLVMTargetParser
+
+ LINK_COMPONENTS
+ Core
+ Support
+ Analysis
+ )
diff --git a/llvm/lib/Frontend/Driver/CodeGenOptions.cpp b/llvm/lib/Frontend/Driver/CodeGenOptions.cpp
new file mode 100644
index 0000000..96c5b19
--- /dev/null
+++ b/llvm/lib/Frontend/Driver/CodeGenOptions.cpp
@@ -0,0 +1,55 @@
+//===--- CodeGenOptions.cpp - Shared codegen option handling --------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Frontend/Driver/CodeGenOptions.h"
+#include "llvm/Analysis/TargetLibraryInfo.h"
+#include "llvm/TargetParser/Triple.h"
+
+namespace llvm::driver {
+
+TargetLibraryInfoImpl *createTLII(llvm::Triple &TargetTriple,
+ driver::VectorLibrary Veclib) {
+ TargetLibraryInfoImpl *TLII = new TargetLibraryInfoImpl(TargetTriple);
+
+ using VectorLibrary = llvm::driver::VectorLibrary;
+ switch (Veclib) {
+ case VectorLibrary::Accelerate:
+ TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::Accelerate,
+ TargetTriple);
+ break;
+ case VectorLibrary::LIBMVEC:
+ TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::LIBMVEC_X86,
+ TargetTriple);
+ break;
+ case VectorLibrary::MASSV:
+ TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::MASSV,
+ TargetTriple);
+ break;
+ case VectorLibrary::SVML:
+ TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::SVML,
+ TargetTriple);
+ break;
+ case VectorLibrary::SLEEF:
+ TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::SLEEFGNUABI,
+ TargetTriple);
+ break;
+ case VectorLibrary::Darwin_libsystem_m:
+ TLII->addVectorizableFunctionsFromVecLib(
+ TargetLibraryInfoImpl::DarwinLibSystemM, TargetTriple);
+ break;
+ case VectorLibrary::ArmPL:
+ TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::ArmPL,
+ TargetTriple);
+ break;
+ default:
+ break;
+ }
+ return TLII;
+}
+
+} // namespace llvm::driver