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