clang 23.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"
16#include "clang/Driver/Tool.h"
18#include "llvm/ADT/StringRef.h"
19#include "llvm/Option/Option.h"
20
21#include <string>
22#include <vector>
23
24namespace clang {
25namespace driver {
26namespace toolchains {
27
28class LLVM_LIBRARY_VISIBILITY MSP430ToolChain : public Generic_ELF {
29public:
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 llvm::StringRef BoundArch,
38 Action::OffloadKind) const override;
39
40 bool isPICDefault() const override { return false; }
41 bool isPIEDefault(const llvm::opt::ArgList &Args) const override {
42 return false;
43 }
44 bool isPICDefaultForced() const override { return true; }
45
46 UnwindLibType
47 GetUnwindLibType(const llvm::opt::ArgList &Args) const override {
48 return UNW_None;
49 }
50
51protected:
52 Tool *buildLinker() const override;
53
54private:
55 std::string computeSysRoot() const override;
56};
57
58} // end namespace toolchains
59
60namespace tools {
61namespace msp430 {
62
63class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
64public:
65 Linker(const ToolChain &TC) : Tool("MSP430::Linker", "msp430-elf-ld", TC) {}
66 bool hasIntegratedCPP() const override { return false; }
67 bool isLinkJob() const override { return true; }
68 void ConstructJob(Compilation &C, const JobAction &JA,
69 const InputInfo &Output, const InputInfoList &Inputs,
70 const llvm::opt::ArgList &TCArgs,
71 const char *LinkingOutput) const override;
72
73private:
74 void AddStartFiles(bool UseExceptions, const llvm::opt::ArgList &Args,
75 llvm::opt::ArgStringList &CmdArgs) const;
76 void AddDefaultLibs(const llvm::opt::ArgList &Args,
77 llvm::opt::ArgStringList &CmdArgs) const;
78 void AddEndFiles(bool UseExceptions, const llvm::opt::ArgList &Args,
79 llvm::opt::ArgStringList &CmdArgs) const;
80};
81
82void getMSP430TargetFeatures(const Driver &D, const llvm::opt::ArgList &Args,
83 std::vector<llvm::StringRef> &Features);
84} // end namespace msp430
85} // end namespace tools
86} // end namespace driver
87} // end namespace clang
88
89#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MSP430_H
Compilation - A set of tasks to perform for a single driver invocation.
Definition Compilation.h:45
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition Driver.h:94
InputInfo - Wrapper for information about an input source.
Definition InputInfo.h:22
ToolChain - Access to tools for a single platform.
Definition ToolChain.h:95
Tool - Information on a specific compilation tool.
Definition Tool.h:32
Tool(const char *Name, const char *ShortName, const ToolChain &TC)
Definition Tool.cpp:14
Generic_ELF(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args)
Definition Gnu.h:439
MSP430ToolChain(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args)
MSP430 Toolchain.
Definition MSP430.cpp:108
void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add the clang cc1 arguments for system include paths.
Definition MSP430.cpp:147
void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, llvm::StringRef BoundArch, Action::OffloadKind) const override
Add options that need to be passed to cc1 for this target.
Definition MSP430.cpp:158
bool isPIEDefault(const llvm::opt::ArgList &Args) const override
Test whether this toolchain defaults to PIE.
Definition MSP430.h:41
bool isPICDefaultForced() const override
Tests whether this toolchain forces its default for PIC, PIE or non-PIC.
Definition MSP430.h:44
bool isPICDefault() const override
Test whether this toolchain defaults to PIC.
Definition MSP430.h:40
UnwindLibType GetUnwindLibType(const llvm::opt::ArgList &Args) const override
Definition MSP430.h:47
bool isLinkJob() const override
Definition MSP430.h:67
Linker(const ToolChain &TC)
Definition MSP430.h:65
bool hasIntegratedCPP() const override
Definition MSP430.h:66
void getMSP430TargetFeatures(const Driver &D, const llvm::opt::ArgList &Args, std::vector< llvm::StringRef > &Features)
SmallVector< InputInfo, 4 > InputInfoList
Definition Driver.h:50
The JSON file list parser is used to communicate input to InstallAPI.