xref: /freebsd/contrib/llvm-project/clang/lib/Driver/ToolChains/PS4CPU.h (revision 6be3386466ab79a84b48429ae66244f21526d3df)
1 //===--- PS4CPU.h - PS4CPU ToolChain Implementations ------------*- 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_PS4CPU_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_PS4CPU_H
11 
12 #include "Gnu.h"
13 #include "clang/Driver/Tool.h"
14 #include "clang/Driver/ToolChain.h"
15 
16 namespace clang {
17 namespace driver {
18 namespace tools {
19 
20 namespace PS4cpu {
21 
22 void addProfileRTArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
23                       llvm::opt::ArgStringList &CmdArgs);
24 
25 void addSanitizerArgs(const ToolChain &TC, llvm::opt::ArgStringList &CmdArgs);
26 
27 class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
28 public:
29   Assemble(const ToolChain &TC) : Tool("PS4cpu::Assemble", "assembler", TC) {}
30 
31   bool hasIntegratedCPP() const override { return false; }
32 
33   void ConstructJob(Compilation &C, const JobAction &JA,
34                     const InputInfo &Output,
35                     const InputInfoList &Inputs,
36                     const llvm::opt::ArgList &TCArgs,
37                     const char *LinkingOutput) const override;
38 };
39 
40 class LLVM_LIBRARY_VISIBILITY Link : public Tool {
41 public:
42   Link(const ToolChain &TC) : Tool("PS4cpu::Link", "linker", TC) {}
43 
44   bool hasIntegratedCPP() const override { return false; }
45   bool isLinkJob() const override { return true; }
46 
47   void ConstructJob(Compilation &C, const JobAction &JA,
48                     const InputInfo &Output,
49                     const InputInfoList &Inputs,
50                     const llvm::opt::ArgList &TCArgs,
51                     const char *LinkingOutput) const override;
52 };
53 } // end namespace PS4cpu
54 } // namespace tools
55 
56 namespace toolchains {
57 
58 class LLVM_LIBRARY_VISIBILITY PS4CPU : public Generic_ELF {
59 public:
60   PS4CPU(const Driver &D, const llvm::Triple &Triple,
61          const llvm::opt::ArgList &Args);
62 
63   // No support for finding a C++ standard library yet.
64   void addLibCxxIncludePaths(
65       const llvm::opt::ArgList &DriverArgs,
66       llvm::opt::ArgStringList &CC1Args) const override {}
67   void addLibStdCxxIncludePaths(
68       const llvm::opt::ArgList &DriverArgs,
69       llvm::opt::ArgStringList &CC1Args) const override {}
70 
71   bool IsMathErrnoDefault() const override { return false; }
72   bool IsObjCNonFragileABIDefault() const override { return true; }
73   bool HasNativeLLVMSupport() const override;
74   bool isPICDefault() const override;
75 
76   unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
77     return 2; // SSPStrong
78   }
79 
80   llvm::DebuggerKind getDefaultDebuggerTuning() const override {
81     return llvm::DebuggerKind::SCE;
82   }
83 
84   SanitizerMask getSupportedSanitizers() const override;
85 
86   // PS4 toolchain uses legacy thin LTO API, which is not
87   // capable of unit splitting.
88   bool canSplitThinLTOUnit() const override { return false; }
89 
90   void addClangTargetOptions(
91     const llvm::opt::ArgList &DriverArgs,
92     llvm::opt::ArgStringList &CC1Args,
93     Action::OffloadKind DeviceOffloadingKind) const override;
94 
95   llvm::DenormalMode getDefaultDenormalModeForType(
96       const llvm::opt::ArgList &DriverArgs, const JobAction &JA,
97       const llvm::fltSemantics *FPType) const override {
98     // DAZ and FTZ are on by default.
99     return llvm::DenormalMode::getPreserveSign();
100   }
101 
102   bool useRelaxRelocations() const override { return true; }
103 
104 protected:
105   Tool *buildAssembler() const override;
106   Tool *buildLinker() const override;
107 };
108 
109 } // end namespace toolchains
110 } // end namespace driver
111 } // end namespace clang
112 
113 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_PS4CPU_H
114