clang 8.0.0

BareMetal.h
Go to the documentation of this file.
1 //===--- BareMetal.h - Bare Metal Tool and ToolChain -------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_BAREMETAL_H
11 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_BAREMETAL_H
12
13 #include "clang/Driver/Tool.h"
14 #include "clang/Driver/ToolChain.h"
15
16 #include <string>
17
18 namespace clang {
19 namespace driver {
20
21 namespace toolchains {
22
23 class LLVM_LIBRARY_VISIBILITY BareMetal : public ToolChain {
24 public:
25 BareMetal(const Driver &D, const llvm::Triple &Triple,
26 const llvm::opt::ArgList &Args);
27 ~BareMetal() override;
28
29 static bool handlesTarget(const llvm::Triple &Triple);
30 protected:
31 Tool *buildLinker() const override;
32
33 public:
34 bool useIntegratedAs() const override { return true; }
35 bool isCrossCompiling() const override { return true; }
36 bool isPICDefault() const override { return false; }
37 bool isPIEDefault() const override { return false; }
38 bool isPICDefaultForced() const override { return false; }
39 bool SupportsProfiling() const override { return false; }
40
41 RuntimeLibType GetDefaultRuntimeLibType() const override {
42 return ToolChain::RLT_CompilerRT;
43 }
44 CXXStdlibType GetDefaultCXXStdlibType() const override {
45 return ToolChain::CST_Libcxx;
46 }
47
48 const char *getDefaultLinker() const override { return "ld.lld"; }
49
50 std::string getRuntimesDir() const;
51 void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
52 llvm::opt::ArgStringList &CC1Args) const override;
53 void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
54 llvm::opt::ArgStringList &CC1Args,
55 Action::OffloadKind DeviceOffloadKind) const override;
56 void AddClangCXXStdlibIncludeArgs(
57 const llvm::opt::ArgList &DriverArgs,
58 llvm::opt::ArgStringList &CC1Args) const override;
59 void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
60 llvm::opt::ArgStringList &CmdArgs) const override;
61 void AddLinkRuntimeLib(const llvm::opt::ArgList &Args,
62 llvm::opt::ArgStringList &CmdArgs) const;
63 };
64
65 } // namespace toolchains
66
67 namespace tools {
68 namespace baremetal {
69
70 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
71 public:
72 Linker(const ToolChain &TC) : Tool("baremetal::Linker", "ld.lld", TC) {}
73 bool isLinkJob() const override { return true; }
74 bool hasIntegratedCPP() const override { return false; }
75 void ConstructJob(Compilation &C, const JobAction &JA,
76 const InputInfo &Output, const InputInfoList &Inputs,
77 const llvm::opt::ArgList &TCArgs,
78 const char *LinkingOutput) const override;
79 };
80
81 } // namespace baremetal
82 } // namespace tools
83
84 } // namespace driver
85 } // namespace clang
86
87 #endif
clang::driver::toolchains::BareMetal::isPICDefaultForced
bool isPICDefaultForced() const override
Tests whether this toolchain forces its default for PIC, PIE or non-PIC.
Definition: BareMetal.h:38
Tool.h
clang::driver::toolchains::BareMetal::GetDefaultRuntimeLibType
RuntimeLibType GetDefaultRuntimeLibType() const override
GetDefaultRuntimeLibType - Get the default runtime library variant to use.
Definition: BareMetal.h:41
clang::driver::toolchains::BareMetal::useIntegratedAs
bool useIntegratedAs() const override
Check if the toolchain should use the integrated assembler.
Definition: BareMetal.h:34
clang::driver::ToolChain::CXXStdlibType
CXXStdlibType
Definition: ToolChain.h:93
clang::driver::JobAction
Definition: Action.h:374
clang::driver::ToolChain::CST_Libcxx
Definition: ToolChain.h:94
clang::driver::InputInfo
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:23
clang::driver::ToolChain::RuntimeLibType
RuntimeLibType
Definition: ToolChain.h:98
clang::driver::tools::baremetal::Linker::isLinkJob
bool isLinkJob() const override
Definition: BareMetal.h:73
clang::driver::Driver
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:58
clang::driver::toolchains::BareMetal::getDefaultLinker
const char * getDefaultLinker() const override
GetDefaultLinker - Get the default linker to use.
Definition: BareMetal.h:48
clang::driver::toolchains::BareMetal::GetDefaultCXXStdlibType
CXXStdlibType GetDefaultCXXStdlibType() const override
Definition: BareMetal.h:44
clang::driver::toolchains::BareMetal::isPIEDefault
bool isPIEDefault() const override
Test whether this toolchain defaults to PIE.
Definition: BareMetal.h:37
ToolChain.h
llvm::SmallVector
Definition: LLVM.h:36
clang::driver::ToolChain::RLT_CompilerRT
Definition: ToolChain.h:99
clang::driver::Action::OffloadKind
OffloadKind
Definition: Action.h:83
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:22
clang::driver::toolchains::BareMetal::isPICDefault
bool isPICDefault() const override
Test whether this toolchain defaults to PIC.
Definition: BareMetal.h:36
clang::driver::toolchains::BareMetal::SupportsProfiling
bool SupportsProfiling() const override
SupportsProfiling - Does this tool chain support -pg.
Definition: BareMetal.h:39
clang::driver::Tool
Tool - Information on a specific compilation tool.
Definition: Tool.h:34
clang::driver::tools::baremetal::Linker
Definition: BareMetal.h:70
clang::driver::Compilation
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:46
clang::driver::tools::baremetal::Linker::hasIntegratedCPP
bool hasIntegratedCPP() const override
Definition: BareMetal.h:74
clang::driver::toolchains::BareMetal
Definition: BareMetal.h:23
clang::driver::toolchains::BareMetal::isCrossCompiling
bool isCrossCompiling() const override
Returns true if the toolchain is targeting a non-native architecture.
Definition: BareMetal.h:35
clang::driver::tools::baremetal::Linker::Linker
Linker(const ToolChain &TC)
Definition: BareMetal.h:72
clang::driver::ToolChain
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:89