xref: /freebsd/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/ARM.h (revision 105fd928b0b5b35ab529e5f6914788dc49582901)
1 //===--- ARM.h - ARM-specific (not AArch64) Tool Helpers --------*- C++ -*-===//
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 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ARCH_ARM_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ARCH_ARM_H
11 
12 #include "clang/Driver/ToolChain.h"
13 #include "llvm/ADT/StringRef.h"
14 #include "llvm/ADT/Triple.h"
15 #include "llvm/Option/Option.h"
16 #include "llvm/Support/TargetParser.h"
17 #include <string>
18 #include <vector>
19 
20 namespace clang {
21 namespace driver {
22 namespace tools {
23 namespace arm {
24 
25 std::string getARMTargetCPU(StringRef CPU, llvm::StringRef Arch,
26                             const llvm::Triple &Triple);
27 const std::string getARMArch(llvm::StringRef Arch, const llvm::Triple &Triple);
28 StringRef getARMCPUForMArch(llvm::StringRef Arch, const llvm::Triple &Triple);
29 llvm::ARM::ArchKind getLLVMArchKindForARM(StringRef CPU, StringRef Arch,
30                                           const llvm::Triple &Triple);
31 StringRef getLLVMArchSuffixForARM(llvm::StringRef CPU, llvm::StringRef Arch,
32                                   const llvm::Triple &Triple);
33 
34 void appendBE8LinkFlag(const llvm::opt::ArgList &Args,
35                        llvm::opt::ArgStringList &CmdArgs,
36                        const llvm::Triple &Triple);
37 enum class ReadTPMode {
38   Invalid,
39   Soft,
40   Cp15,
41 };
42 
43 enum class FloatABI {
44   Invalid,
45   Soft,
46   SoftFP,
47   Hard,
48 };
49 
50 FloatABI getDefaultFloatABI(const llvm::Triple &Triple);
51 FloatABI getARMFloatABI(const ToolChain &TC, const llvm::opt::ArgList &Args);
52 FloatABI getARMFloatABI(const Driver &D, const llvm::Triple &Triple,
53                         const llvm::opt::ArgList &Args);
54 ReadTPMode getReadTPMode(const Driver &D, const llvm::opt::ArgList &Args);
55 
56 bool useAAPCSForMachO(const llvm::Triple &T);
57 void getARMArchCPUFromArgs(const llvm::opt::ArgList &Args,
58                            llvm::StringRef &Arch, llvm::StringRef &CPU,
59                            bool FromAs = false);
60 void getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
61                           const llvm::opt::ArgList &Args,
62                           llvm::opt::ArgStringList &CmdArgs,
63                           std::vector<llvm::StringRef> &Features, bool ForAS);
64 int getARMSubArchVersionNumber(const llvm::Triple &Triple);
65 bool isARMMProfile(const llvm::Triple &Triple);
66 bool isARMAProfile(const llvm::Triple &Triple);
67 
68 } // end namespace arm
69 } // end namespace tools
70 } // end namespace driver
71 } // end namespace clang
72 
73 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ARCH_ARM_H
74