xref: /netbsd-src/external/apache2/llvm/dist/clang/lib/Driver/ToolChains/MSP430.h (revision e038c9c4676b0f19b1b7dd08a940c6ed64a6d5ae)
17330f729Sjoerg //===--- MSP430.h - MSP430-specific Tool Helpers ----------------*- C++ -*-===//
27330f729Sjoerg //
37330f729Sjoerg // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
47330f729Sjoerg // See https://llvm.org/LICENSE.txt for license information.
57330f729Sjoerg // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
67330f729Sjoerg //
77330f729Sjoerg //===----------------------------------------------------------------------===//
87330f729Sjoerg 
97330f729Sjoerg #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MSP430_H
107330f729Sjoerg #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MSP430_H
117330f729Sjoerg 
127330f729Sjoerg #include "Gnu.h"
137330f729Sjoerg #include "InputInfo.h"
147330f729Sjoerg #include "clang/Driver/Driver.h"
157330f729Sjoerg #include "clang/Driver/DriverDiagnostic.h"
167330f729Sjoerg #include "clang/Driver/Tool.h"
177330f729Sjoerg #include "clang/Driver/ToolChain.h"
187330f729Sjoerg #include "llvm/ADT/StringRef.h"
197330f729Sjoerg #include "llvm/Option/Option.h"
207330f729Sjoerg 
217330f729Sjoerg #include <string>
227330f729Sjoerg #include <vector>
237330f729Sjoerg 
247330f729Sjoerg namespace clang {
257330f729Sjoerg namespace driver {
267330f729Sjoerg namespace toolchains {
277330f729Sjoerg 
287330f729Sjoerg class LLVM_LIBRARY_VISIBILITY MSP430ToolChain : public Generic_ELF {
297330f729Sjoerg public:
307330f729Sjoerg   MSP430ToolChain(const Driver &D, const llvm::Triple &Triple,
317330f729Sjoerg                   const llvm::opt::ArgList &Args);
327330f729Sjoerg   void
337330f729Sjoerg   AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
347330f729Sjoerg                             llvm::opt::ArgStringList &CC1Args) const override;
357330f729Sjoerg   void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
367330f729Sjoerg                              llvm::opt::ArgStringList &CC1Args,
377330f729Sjoerg                              Action::OffloadKind) const override;
387330f729Sjoerg 
isPICDefault()397330f729Sjoerg   bool isPICDefault() const override { return false; }
isPIEDefault()407330f729Sjoerg   bool isPIEDefault() const override { return false; }
isPICDefaultForced()417330f729Sjoerg   bool isPICDefaultForced() const override { return true; }
427330f729Sjoerg 
43*e038c9c4Sjoerg   UnwindLibType
GetUnwindLibType(const llvm::opt::ArgList & Args)44*e038c9c4Sjoerg   GetUnwindLibType(const llvm::opt::ArgList &Args) const override {
45*e038c9c4Sjoerg     return UNW_None;
46*e038c9c4Sjoerg   }
47*e038c9c4Sjoerg 
487330f729Sjoerg protected:
497330f729Sjoerg   Tool *buildLinker() const override;
507330f729Sjoerg 
517330f729Sjoerg private:
52*e038c9c4Sjoerg   std::string computeSysRoot() const override;
537330f729Sjoerg };
547330f729Sjoerg 
557330f729Sjoerg } // end namespace toolchains
567330f729Sjoerg 
577330f729Sjoerg namespace tools {
587330f729Sjoerg namespace msp430 {
597330f729Sjoerg 
60*e038c9c4Sjoerg class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
617330f729Sjoerg public:
Linker(const ToolChain & TC)62*e038c9c4Sjoerg   Linker(const ToolChain &TC) : Tool("MSP430::Linker", "msp430-elf-ld", TC) {}
hasIntegratedCPP()637330f729Sjoerg   bool hasIntegratedCPP() const override { return false; }
isLinkJob()647330f729Sjoerg   bool isLinkJob() const override { return true; }
657330f729Sjoerg   void ConstructJob(Compilation &C, const JobAction &JA,
667330f729Sjoerg                     const InputInfo &Output, const InputInfoList &Inputs,
677330f729Sjoerg                     const llvm::opt::ArgList &TCArgs,
687330f729Sjoerg                     const char *LinkingOutput) const override;
69*e038c9c4Sjoerg 
70*e038c9c4Sjoerg private:
71*e038c9c4Sjoerg   void AddStartFiles(bool UseExceptions, const llvm::opt::ArgList &Args,
72*e038c9c4Sjoerg                      llvm::opt::ArgStringList &CmdArgs) const;
73*e038c9c4Sjoerg   void AddDefaultLibs(const llvm::opt::ArgList &Args,
74*e038c9c4Sjoerg                       llvm::opt::ArgStringList &CmdArgs) const;
75*e038c9c4Sjoerg   void AddEndFiles(bool UseExceptions, const llvm::opt::ArgList &Args,
76*e038c9c4Sjoerg                    llvm::opt::ArgStringList &CmdArgs) const;
777330f729Sjoerg };
787330f729Sjoerg 
797330f729Sjoerg void getMSP430TargetFeatures(const Driver &D, const llvm::opt::ArgList &Args,
807330f729Sjoerg                              std::vector<llvm::StringRef> &Features);
817330f729Sjoerg } // end namespace msp430
827330f729Sjoerg } // end namespace tools
837330f729Sjoerg } // end namespace driver
847330f729Sjoerg } // end namespace clang
857330f729Sjoerg 
867330f729Sjoerg #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MSP430_H
87