1183234Ssimon//===--- MSP430.h - MSP430-specific Tool Helpers ----------------*- C++ -*-===// 2280304Sjkim// 3280304Sjkim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4183234Ssimon// See https://llvm.org/LICENSE.txt for license information. 5183234Ssimon// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6183234Ssimon// 7183234Ssimon//===----------------------------------------------------------------------===// 8183234Ssimon 9183234Ssimon#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MSP430_H 10183234Ssimon#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MSP430_H 11183234Ssimon 12183234Ssimon#include "Gnu.h" 13183234Ssimon#include "clang/Driver/Driver.h" 14280304Sjkim#include "clang/Driver/DriverDiagnostic.h" 15183234Ssimon#include "clang/Driver/InputInfo.h" 16183234Ssimon#include "clang/Driver/Tool.h" 17183234Ssimon#include "clang/Driver/ToolChain.h" 18183234Ssimon#include "llvm/ADT/StringRef.h" 19183234Ssimon#include "llvm/Option/Option.h" 20183234Ssimon 21183234Ssimon#include <string> 22183234Ssimon#include <vector> 23183234Ssimon 24183234Ssimonnamespace clang { 25183234Ssimonnamespace driver { 26183234Ssimonnamespace toolchains { 27183234Ssimon 28183234Ssimonclass LLVM_LIBRARY_VISIBILITY MSP430ToolChain : public Generic_ELF { 29183234Ssimonpublic: 30183234Ssimon MSP430ToolChain(const Driver &D, const llvm::Triple &Triple, 31183234Ssimon const llvm::opt::ArgList &Args); 32183234Ssimon void 33183234Ssimon AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, 34183234Ssimon llvm::opt::ArgStringList &CC1Args) const override; 35183234Ssimon void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, 36183234Ssimon llvm::opt::ArgStringList &CC1Args, 37183234Ssimon Action::OffloadKind) const override; 38183234Ssimon 39183234Ssimon bool isPICDefault() const override { return false; } 40183234Ssimon bool isPIEDefault(const llvm::opt::ArgList &Args) const override { 41183234Ssimon return false; 42183234Ssimon } 43183234Ssimon bool isPICDefaultForced() const override { return true; } 44183234Ssimon 45183234Ssimon UnwindLibType 46183234Ssimon GetUnwindLibType(const llvm::opt::ArgList &Args) const override { 47183234Ssimon return UNW_None; 48183234Ssimon } 49183234Ssimon 50183234Ssimonprotected: 51183234Ssimon Tool *buildLinker() const override; 52183234Ssimon 53183234Ssimonprivate: 54183234Ssimon std::string computeSysRoot() const override; 55183234Ssimon}; 56183234Ssimon 57183234Ssimon} // end namespace toolchains 58183234Ssimon 59183234Ssimonnamespace tools { 60183234Ssimonnamespace msp430 { 61183234Ssimon 62183234Ssimonclass LLVM_LIBRARY_VISIBILITY Linker final : public Tool { 63183234Ssimonpublic: 64183234Ssimon Linker(const ToolChain &TC) : Tool("MSP430::Linker", "msp430-elf-ld", TC) {} 65183234Ssimon bool hasIntegratedCPP() const override { return false; } 66183234Ssimon bool isLinkJob() const override { return true; } 67183234Ssimon void ConstructJob(Compilation &C, const JobAction &JA, 68183234Ssimon const InputInfo &Output, const InputInfoList &Inputs, 69183234Ssimon const llvm::opt::ArgList &TCArgs, 70183234Ssimon const char *LinkingOutput) const override; 71280304Sjkim 72280304Sjkimprivate: 73280304Sjkim void AddStartFiles(bool UseExceptions, const llvm::opt::ArgList &Args, 74280304Sjkim llvm::opt::ArgStringList &CmdArgs) const; 75280304Sjkim void AddDefaultLibs(const llvm::opt::ArgList &Args, 76280304Sjkim llvm::opt::ArgStringList &CmdArgs) const; 77280304Sjkim void AddEndFiles(bool UseExceptions, const llvm::opt::ArgList &Args, 78280304Sjkim llvm::opt::ArgStringList &CmdArgs) const; 79183234Ssimon}; 80280304Sjkim 81183234Ssimonvoid getMSP430TargetFeatures(const Driver &D, const llvm::opt::ArgList &Args, 82280304Sjkim std::vector<llvm::StringRef> &Features); 83183234Ssimon} // end namespace msp430 84280304Sjkim} // end namespace tools 85183234Ssimon} // end namespace driver 86280304Sjkim} // end namespace clang 87280304Sjkim 88280304Sjkim#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MSP430_H 89280304Sjkim