1 //===--- CodeGenOptions.cpp - Shared codegen option handling --------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Frontend/Driver/CodeGenOptions.h"
10 #include "llvm/Analysis/TargetLibraryInfo.h"
11 #include "llvm/TargetParser/Triple.h"
12
13 namespace llvm::driver {
14
createTLII(llvm::Triple & TargetTriple,driver::VectorLibrary Veclib)15 TargetLibraryInfoImpl *createTLII(llvm::Triple &TargetTriple,
16 driver::VectorLibrary Veclib) {
17 TargetLibraryInfoImpl *TLII = new TargetLibraryInfoImpl(TargetTriple);
18
19 using VectorLibrary = llvm::driver::VectorLibrary;
20 switch (Veclib) {
21 case VectorLibrary::Accelerate:
22 TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::Accelerate,
23 TargetTriple);
24 break;
25 case VectorLibrary::LIBMVEC:
26 TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::LIBMVEC_X86,
27 TargetTriple);
28 break;
29 case VectorLibrary::MASSV:
30 TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::MASSV,
31 TargetTriple);
32 break;
33 case VectorLibrary::SVML:
34 TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::SVML,
35 TargetTriple);
36 break;
37 case VectorLibrary::SLEEF:
38 TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::SLEEFGNUABI,
39 TargetTriple);
40 break;
41 case VectorLibrary::Darwin_libsystem_m:
42 TLII->addVectorizableFunctionsFromVecLib(
43 TargetLibraryInfoImpl::DarwinLibSystemM, TargetTriple);
44 break;
45 case VectorLibrary::ArmPL:
46 TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::ArmPL,
47 TargetTriple);
48 break;
49 case VectorLibrary::AMDLIBM:
50 TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::AMDLIBM,
51 TargetTriple);
52 break;
53 default:
54 break;
55 }
56 return TLII;
57 }
58
59 } // namespace llvm::driver
60