clang  12.0.0git
PS4CPU.h
Go to the documentation of this file.
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.
65  const llvm::opt::ArgList &DriverArgs,
66  llvm::opt::ArgStringList &CC1Args) const override {}
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
void addProfileRTArgs(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
bool useRelaxRelocations() const override
Check whether to enable x86 relax relocations by default.
Definition: PS4CPU.h:102
unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain (0=off...
Definition: PS4CPU.h:76
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
Assemble(const ToolChain &TC)
Definition: PS4CPU.h:29
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:59
void addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Definition: PS4CPU.h:67
llvm::DebuggerKind getDefaultDebuggerTuning() const override
Definition: PS4CPU.h:80
bool hasIntegratedCPP() const override
Definition: PS4CPU.h:31
void addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Definition: PS4CPU.h:64
llvm::DenormalMode getDefaultDenormalModeForType(const llvm::opt::ArgList &DriverArgs, const JobAction &JA, const llvm::fltSemantics *FPType) const override
Returns the output denormal handling type in the default floating point environment for the given FPT...
Definition: PS4CPU.h:95
void addSanitizerArgs(const ToolChain &TC, llvm::opt::ArgStringList &CmdArgs)
bool canSplitThinLTOUnit() const override
Returns true when it's possible to split LTO unit to use whole program devirtualization and CFI santi...
Definition: PS4CPU.h:88
Dataflow Directional Tag Classes.
bool IsObjCNonFragileABIDefault() const override
IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.
Definition: PS4CPU.h:72
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: PS4CPU.h:71
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:90