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