1 | //===--- XCore.h - XCore 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_XCORE_H |
10 | #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_XCORE_H |
11 | |
12 | #include "clang/Driver/Tool.h" |
13 | #include "clang/Driver/ToolChain.h" |
14 | |
15 | namespace clang { |
16 | namespace driver { |
17 | namespace tools { |
18 | |
19 | namespace XCore { |
20 | // For XCore, we do not need to instantiate tools for PreProcess, PreCompile and |
21 | // Compile. |
22 | // We simply use "clang -cc1" for those actions. |
23 | class LLVM_LIBRARY_VISIBILITY Assembler final : public Tool { |
24 | public: |
25 | Assembler(const ToolChain &TC) : Tool("XCore::Assembler" , "XCore-as" , TC) {} |
26 | |
27 | bool hasIntegratedCPP() const override { return false; } |
28 | void ConstructJob(Compilation &C, const JobAction &JA, |
29 | const InputInfo &Output, const InputInfoList &Inputs, |
30 | const llvm::opt::ArgList &TCArgs, |
31 | const char *LinkingOutput) const override; |
32 | }; |
33 | |
34 | class LLVM_LIBRARY_VISIBILITY Linker final : public Tool { |
35 | public: |
36 | Linker(const ToolChain &TC) : Tool("XCore::Linker" , "XCore-ld" , TC) {} |
37 | |
38 | bool hasIntegratedCPP() const override { return false; } |
39 | bool isLinkJob() const override { return true; } |
40 | void ConstructJob(Compilation &C, const JobAction &JA, |
41 | const InputInfo &Output, const InputInfoList &Inputs, |
42 | const llvm::opt::ArgList &TCArgs, |
43 | const char *LinkingOutput) const override; |
44 | }; |
45 | } // end namespace XCore. |
46 | } // end namespace tools |
47 | |
48 | namespace toolchains { |
49 | |
50 | class LLVM_LIBRARY_VISIBILITY XCoreToolChain : public ToolChain { |
51 | public: |
52 | XCoreToolChain(const Driver &D, const llvm::Triple &Triple, |
53 | const llvm::opt::ArgList &Args); |
54 | |
55 | protected: |
56 | Tool *buildAssembler() const override; |
57 | Tool *buildLinker() const override; |
58 | |
59 | public: |
60 | bool IsIntegratedAssemblerDefault() const override { return false; } |
61 | bool isPICDefault() const override; |
62 | bool isPIEDefault(const llvm::opt::ArgList &Args) const override; |
63 | bool isPICDefaultForced() const override; |
64 | bool SupportsProfiling() const override; |
65 | bool hasBlocksRuntime() const override; |
66 | void |
67 | AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, |
68 | llvm::opt::ArgStringList &CC1Args) const override; |
69 | void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, |
70 | llvm::opt::ArgStringList &CC1Args, |
71 | Action::OffloadKind DeviceOffloadKind) const override; |
72 | void AddClangCXXStdlibIncludeArgs( |
73 | const llvm::opt::ArgList &DriverArgs, |
74 | llvm::opt::ArgStringList &CC1Args) const override; |
75 | void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, |
76 | llvm::opt::ArgStringList &CmdArgs) const override; |
77 | }; |
78 | |
79 | } // end namespace toolchains |
80 | } // end namespace driver |
81 | } // end namespace clang |
82 | |
83 | #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_XCORE_H |
84 | |