clang  16.0.0git
MSP430.h
Go to the documentation of this file.
1 //===--- MSP430.h - MSP430-specific Tool Helpers ----------------*- 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_MSP430_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MSP430_H
11 
12 #include "Gnu.h"
13 #include "clang/Driver/Driver.h"
15 #include "clang/Driver/InputInfo.h"
16 #include "clang/Driver/Tool.h"
17 #include "clang/Driver/ToolChain.h"
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/Option/Option.h"
20 
21 #include <string>
22 #include <vector>
23 
24 namespace clang {
25 namespace driver {
26 namespace toolchains {
27 
28 class LLVM_LIBRARY_VISIBILITY MSP430ToolChain : public Generic_ELF {
29 public:
30  MSP430ToolChain(const Driver &D, const llvm::Triple &Triple,
31  const llvm::opt::ArgList &Args);
32  void
33  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
34  llvm::opt::ArgStringList &CC1Args) const override;
35  void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
36  llvm::opt::ArgStringList &CC1Args,
37  Action::OffloadKind) const override;
38 
39  bool isPICDefault() const override { return false; }
40  bool isPIEDefault(const llvm::opt::ArgList &Args) const override {
41  return false;
42  }
43  bool isPICDefaultForced() const override { return true; }
44 
45  UnwindLibType
46  GetUnwindLibType(const llvm::opt::ArgList &Args) const override {
47  return UNW_None;
48  }
49 
50 protected:
51  Tool *buildLinker() const override;
52 
53 private:
54  std::string computeSysRoot() const override;
55 };
56 
57 } // end namespace toolchains
58 
59 namespace tools {
60 namespace msp430 {
61 
62 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
63 public:
64  Linker(const ToolChain &TC) : Tool("MSP430::Linker", "msp430-elf-ld", TC) {}
65  bool hasIntegratedCPP() const override { return false; }
66  bool isLinkJob() const override { return true; }
67  void ConstructJob(Compilation &C, const JobAction &JA,
68  const InputInfo &Output, const InputInfoList &Inputs,
69  const llvm::opt::ArgList &TCArgs,
70  const char *LinkingOutput) const override;
71 
72 private:
73  void AddStartFiles(bool UseExceptions, const llvm::opt::ArgList &Args,
74  llvm::opt::ArgStringList &CmdArgs) const;
75  void AddDefaultLibs(const llvm::opt::ArgList &Args,
76  llvm::opt::ArgStringList &CmdArgs) const;
77  void AddEndFiles(bool UseExceptions, const llvm::opt::ArgList &Args,
78  llvm::opt::ArgStringList &CmdArgs) const;
79 };
80 
81 void getMSP430TargetFeatures(const Driver &D, const llvm::opt::ArgList &Args,
82  std::vector<llvm::StringRef> &Features);
83 } // end namespace msp430
84 } // end namespace tools
85 } // end namespace driver
86 } // end namespace clang
87 
88 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MSP430_H
clang::driver::toolchains::MSP430ToolChain::isPIEDefault
bool isPIEDefault(const llvm::opt::ArgList &Args) const override
Test whether this toolchain defaults to PIE.
Definition: MSP430.h:40
Driver.h
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
llvm::SmallVector
Definition: LLVM.h:38
clang::driver::tools::msp430::Linker
Definition: MSP430.h:62
clang::driver::InputInfo
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
InputInfo.h
clang::driver::Tool
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
clang::driver::toolchains::Generic_ELF
Definition: Gnu.h:363
DriverDiagnostic.h
clang::driver::tools::msp430::Linker::Linker
Linker(const ToolChain &TC)
Definition: MSP430.h:64
Tool.h
clang::driver::tools::msp430::Linker::isLinkJob
bool isLinkJob() const override
Definition: MSP430.h:66
ToolChain.h
Gnu.h
clang::driver::ToolChain
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:91
clang::driver::toolchains::MSP430ToolChain
Definition: MSP430.h:28
clang::driver::Compilation
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
clang::driver::toolchains::MSP430ToolChain::isPICDefaultForced
bool isPICDefaultForced() const override
Tests whether this toolchain forces its default for PIC, PIE or non-PIC.
Definition: MSP430.h:43
clang
Definition: CalledOnceCheck.h:17
clang::driver::Driver
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:75
clang::driver::tools::msp430::getMSP430TargetFeatures
void getMSP430TargetFeatures(const Driver &D, const llvm::opt::ArgList &Args, std::vector< llvm::StringRef > &Features)
clang::driver::toolchains::MSP430ToolChain::GetUnwindLibType
UnwindLibType GetUnwindLibType(const llvm::opt::ArgList &Args) const override
Definition: MSP430.h:46
clang::driver::toolchains::MSP430ToolChain::isPICDefault
bool isPICDefault() const override
Test whether this toolchain defaults to PIC.
Definition: MSP430.h:39
clang::driver::Action::OffloadKind
OffloadKind
Definition: Action.h:86
clang::driver::JobAction
Definition: Action.h:398
clang::driver::tools::msp430::Linker::hasIntegratedCPP
bool hasIntegratedCPP() const override
Definition: MSP430.h:65