Coverage Report

Created: 2020-02-15 09:57

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Driver/ToolChains/HIP.h
Line
Count
Source (jump to first uncovered line)
1
//===--- HIP.h - HIP 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_HIP_H
10
#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIP_H
11
12
#include "clang/Driver/ToolChain.h"
13
#include "clang/Driver/Tool.h"
14
15
namespace clang {
16
namespace driver {
17
18
namespace tools {
19
20
namespace AMDGCN {
21
  // Construct command for creating HIP fatbin.
22
  void constructHIPFatbinCommand(Compilation &C, const JobAction &JA,
23
                  StringRef OutputFileName, const InputInfoList &Inputs,
24
                  const llvm::opt::ArgList &TCArgs, const Tool& T);
25
26
// Runs llvm-link/opt/llc/lld, which links multiple LLVM bitcode, together with
27
// device library, then compiles it to ISA in a shared object.
28
class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
29
public:
30
31
  Linker(const ToolChain &TC) : Tool("AMDGCN::Linker", "amdgcn-link", TC) {}
31
32
59
  bool hasIntegratedCPP() const override { return false; }
33
34
  void ConstructJob(Compilation &C, const JobAction &JA,
35
                    const InputInfo &Output, const InputInfoList &Inputs,
36
                    const llvm::opt::ArgList &TCArgs,
37
                    const char *LinkingOutput) const override;
38
39
private:
40
  /// \return llvm-link output file name.
41
  const char *constructLLVMLinkCommand(Compilation &C, const JobAction &JA,
42
                                       const InputInfoList &Inputs,
43
                                       const llvm::opt::ArgList &Args,
44
                                       llvm::StringRef SubArchName,
45
                                       llvm::StringRef OutputFilePrefix) const;
46
47
  /// \return opt output file name.
48
  const char *constructOptCommand(Compilation &C, const JobAction &JA,
49
                                  const InputInfoList &Inputs,
50
                                  const llvm::opt::ArgList &Args,
51
                                  llvm::StringRef SubArchName,
52
                                  llvm::StringRef OutputFilePrefix,
53
                                  const char *InputFileName) const;
54
55
  /// \return llc output file name.
56
  const char *constructLlcCommand(Compilation &C, const JobAction &JA,
57
                                  const InputInfoList &Inputs,
58
                                  const llvm::opt::ArgList &Args,
59
                                  llvm::StringRef SubArchName,
60
                                  llvm::StringRef OutputFilePrefix,
61
                                  const char *InputFileName,
62
                                  bool OutputIsAsm = false) const;
63
64
  void constructLldCommand(Compilation &C, const JobAction &JA,
65
                           const InputInfoList &Inputs, const InputInfo &Output,
66
                           const llvm::opt::ArgList &Args,
67
                           const char *InputFileName) const;
68
};
69
70
} // end namespace AMDGCN
71
} // end namespace tools
72
73
namespace toolchains {
74
75
class LLVM_LIBRARY_VISIBILITY HIPToolChain : public ToolChain {
76
public:
77
  HIPToolChain(const Driver &D, const llvm::Triple &Triple,
78
                const ToolChain &HostTC, const llvm::opt::ArgList &Args);
79
80
120
  const llvm::Triple *getAuxTriple() const override {
81
120
    return &HostTC.getTriple();
82
120
  }
83
84
  llvm::opt::DerivedArgList *
85
  TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
86
                Action::OffloadKind DeviceOffloadKind) const override;
87
  void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
88
                             llvm::opt::ArgStringList &CC1Args,
89
                             Action::OffloadKind DeviceOffloadKind) const override;
90
91
419
  bool useIntegratedAs() const override { return true; }
92
0
  bool isCrossCompiling() const override { return true; }
93
61
  bool isPICDefault() const override { return false; }
94
61
  bool isPIEDefault() const override { return false; }
95
61
  bool isPICDefaultForced() const override { return false; }
96
61
  bool SupportsProfiling() const override { return false; }
97
61
  bool IsMathErrnoDefault() const override { return false; }
98
99
  void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override;
100
  CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
101
  void
102
  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
103
                            llvm::opt::ArgStringList &CC1Args) const override;
104
  void AddClangCXXStdlibIncludeArgs(
105
      const llvm::opt::ArgList &Args,
106
      llvm::opt::ArgStringList &CC1Args) const override;
107
  void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
108
                           llvm::opt::ArgStringList &CC1Args) const override;
109
110
  SanitizerMask getSupportedSanitizers() const override;
111
112
  VersionTuple
113
  computeMSVCVersion(const Driver *D,
114
                     const llvm::opt::ArgList &Args) const override;
115
116
1
  unsigned GetDefaultDwarfVersion() const override { return 4; }
117
118
  const ToolChain &HostTC;
119
120
protected:
121
  Tool *buildLinker() const override;
122
};
123
124
} // end namespace toolchains
125
} // end namespace driver
126
} // end namespace clang
127
128
#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIP_H