Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/llvm/tools/clang/include/clang/Basic/DiagnosticDriverKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -402,4 +402,15 @@ def warn_drv_experimental_isel_incomplete_opt : Warning<
def warn_drv_moutline_unsupported_opt : Warning<
"The '%0' architecture does not support -moutline; flag ignored">,
InGroup<OptionIgnored>;

def warn_drv_msp430_hwmult_unsupported : Warning<"the given MCU does not "
"support hardware multiply, but -mhwmult is set to %0.">,
InGroup<InvalidCommandLineArgument>;
def warn_drv_msp430_hwmult_mismatch : Warning<"the given MCU supports %0 "
"hardware multiply, but -mhwmult is set to %1.">,
InGroup<InvalidCommandLineArgument>;
def warn_drv_msp430_hwmult_no_device : Warning<"no MCU device specified, but "
"'-mhwmult' is set to 'auto', assuming no hardware multiply. Use -mmcu to "
"specify a MSP430 device, or -mhwmult to set hardware multiply type "
"explicitly.">, InGroup<InvalidCommandLineArgument>;
}
247 changes: 247 additions & 0 deletions src/llvm/tools/clang/include/clang/Basic/MSP430Target.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
//===--- MSP430Target.def - MSP430 Feature/Processor Database----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the MSP430 devices and their features.
//
//===----------------------------------------------------------------------===//

#ifndef MSP430_MCU_FEAT
#define MSP430_MCU_FEAT(NAME, HWMULT) MSP430_MCU(NAME)
#endif

#ifndef MSP430_MCU
#define MSP430_MCU(NAME)
#endif

MSP430_MCU("msp430c111")
MSP430_MCU("msp430c1111")
MSP430_MCU("msp430c112")
MSP430_MCU("msp430c1121")
MSP430_MCU("msp430c1331")
MSP430_MCU("msp430c1351")
MSP430_MCU("msp430e112")
MSP430_MCU("msp430f110")
MSP430_MCU("msp430f1101")
MSP430_MCU("msp430f1101a")
MSP430_MCU("msp430f1111")
MSP430_MCU("msp430f1111a")
MSP430_MCU("msp430f112")
MSP430_MCU("msp430f1121")
MSP430_MCU("msp430f1121a")
MSP430_MCU("msp430f1122")
MSP430_MCU("msp430f1132")
MSP430_MCU("msp430f122")
MSP430_MCU("msp430f1222")
MSP430_MCU("msp430f123")
MSP430_MCU("msp430f1232")
MSP430_MCU("msp430f133")
MSP430_MCU("msp430f135")
MSP430_MCU("msp430f155")
MSP430_MCU("msp430f156")
MSP430_MCU("msp430f157")
MSP430_MCU("msp430p112")
MSP430_MCU("msp430f2001")
MSP430_MCU("msp430f2011")
MSP430_MCU("msp430f2002")
MSP430_MCU("msp430f2012")
MSP430_MCU("msp430f2003")
MSP430_MCU("msp430f2013")
MSP430_MCU("msp430f2101")
MSP430_MCU("msp430f2111")
MSP430_MCU("msp430f2121")
MSP430_MCU("msp430f2131")
MSP430_MCU("msp430f2112")
MSP430_MCU("msp430f2122")
MSP430_MCU("msp430f2132")
MSP430_MCU("msp430f2232")
MSP430_MCU("msp430f2252")
MSP430_MCU("msp430f2272")
MSP430_MCU("msp430f2234")
MSP430_MCU("msp430f2254")
MSP430_MCU("msp430f2274")
MSP430_MCU("msp430g2211")
MSP430_MCU("msp430g2201")
MSP430_MCU("msp430g2111")
MSP430_MCU("msp430g2101")
MSP430_MCU("msp430g2001")
MSP430_MCU("msp430g2231")
MSP430_MCU("msp430g2221")
MSP430_MCU("msp430g2131")
MSP430_MCU("msp430g2121")
MSP430_MCU("msp430g2102")
MSP430_MCU("msp430g2202")
MSP430_MCU("msp430g2302")
MSP430_MCU("msp430g2402")
MSP430_MCU("msp430g2132")
MSP430_MCU("msp430g2232")
MSP430_MCU("msp430g2332")
MSP430_MCU("msp430g2432")
MSP430_MCU("msp430g2112")
MSP430_MCU("msp430g2212")
MSP430_MCU("msp430g2312")
MSP430_MCU("msp430g2412")
MSP430_MCU("msp430g2152")
MSP430_MCU("msp430g2252")
MSP430_MCU("msp430g2352")
MSP430_MCU("msp430g2452")
MSP430_MCU("msp430g2113")
MSP430_MCU("msp430g2213")
MSP430_MCU("msp430g2313")
MSP430_MCU("msp430g2413")
MSP430_MCU("msp430g2513")
MSP430_MCU("msp430g2153")
MSP430_MCU("msp430g2253")
MSP430_MCU("msp430g2353")
MSP430_MCU("msp430g2453")
MSP430_MCU("msp430g2553")
MSP430_MCU("msp430g2203")
MSP430_MCU("msp430g2303")
MSP430_MCU("msp430g2403")
MSP430_MCU("msp430g2233")
MSP430_MCU("msp430g2333")
MSP430_MCU("msp430g2433")
MSP430_MCU("msp430g2533")
MSP430_MCU("msp430tch5e")
MSP430_MCU("msp430g2444")
MSP430_MCU("msp430g2544")
MSP430_MCU("msp430g2744")
MSP430_MCU("msp430g2755")
MSP430_MCU("msp430g2855")
MSP430_MCU("msp430g2955")
MSP430_MCU("msp430g2230")
MSP430_MCU("msp430g2210")
MSP430_MCU("msp430c311s")
MSP430_MCU("msp430c312")
MSP430_MCU("msp430c313")
MSP430_MCU("msp430c314")
MSP430_MCU("msp430c315")
MSP430_MCU("msp430c323")
MSP430_MCU("msp430c325")
MSP430_MCU("msp430c412")
MSP430_MCU("msp430c413")
MSP430_MCU("msp430e313")
MSP430_MCU("msp430e315")
MSP430_MCU("msp430e325")
MSP430_MCU("msp430p313")
MSP430_MCU("msp430p315")
MSP430_MCU("msp430p315s")
MSP430_MCU("msp430p325")
MSP430_MCU("msp430f412")
MSP430_MCU("msp430f413")
MSP430_MCU("msp430f415")
MSP430_MCU("msp430f417")
MSP430_MCU("msp430f4132")
MSP430_MCU("msp430f4152")
MSP430_MCU("msp430f435")
MSP430_MCU("msp430f436")
MSP430_MCU("msp430f437")
MSP430_MCU("msp430f4351")
MSP430_MCU("msp430f4361")
MSP430_MCU("msp430f4371")
MSP430_MCU("msp430fe423")
MSP430_MCU("msp430fe425")
MSP430_MCU("msp430fe427")
MSP430_MCU("msp430fe423a")
MSP430_MCU("msp430fe425a")
MSP430_MCU("msp430fe427a")
MSP430_MCU("msp430fe4232")
MSP430_MCU("msp430fe4242")
MSP430_MCU("msp430fe4252")
MSP430_MCU("msp430fe4272")
MSP430_MCU("msp430f4250")
MSP430_MCU("msp430f4260")
MSP430_MCU("msp430f4270")
MSP430_MCU("msp430fg4250")
MSP430_MCU("msp430fg4260")
MSP430_MCU("msp430fg4270")
MSP430_MCU("msp430fw423")
MSP430_MCU("msp430fw425")
MSP430_MCU("msp430fw427")
MSP430_MCU("msp430fw428")
MSP430_MCU("msp430fw429")
MSP430_MCU("msp430fg437")
MSP430_MCU("msp430fg438")
MSP430_MCU("msp430fg439")
MSP430_MCU("msp430f438")
MSP430_MCU("msp430f439")
MSP430_MCU("msp430f477")
MSP430_MCU("msp430f478")
MSP430_MCU("msp430f479")
MSP430_MCU("msp430fg477")
MSP430_MCU("msp430fg478")
MSP430_MCU("msp430fg479")

// With 16-bit hardware multiplier
MSP430_MCU_FEAT("msp430f147", "16bit")
MSP430_MCU_FEAT("msp430f148", "16bit")
MSP430_MCU_FEAT("msp430f149", "16bit")
MSP430_MCU_FEAT("msp430f1471", "16bit")
MSP430_MCU_FEAT("msp430f1481", "16bit")
MSP430_MCU_FEAT("msp430f1491", "16bit")
MSP430_MCU_FEAT("msp430f167", "16bit")
MSP430_MCU_FEAT("msp430f168", "16bit")
MSP430_MCU_FEAT("msp430f169", "16bit")
MSP430_MCU_FEAT("msp430f1610", "16bit")
MSP430_MCU_FEAT("msp430f1611", "16bit")
MSP430_MCU_FEAT("msp430f1612", "16bit")
MSP430_MCU_FEAT("msp430c336", "16bit")
MSP430_MCU_FEAT("msp430c337", "16bit")
MSP430_MCU_FEAT("msp430e337", "16bit")
MSP430_MCU_FEAT("msp430p337", "16bit")
MSP430_MCU_FEAT("msp430f423", "16bit")
MSP430_MCU_FEAT("msp430f425", "16bit")
MSP430_MCU_FEAT("msp430f427", "16bit")
MSP430_MCU_FEAT("msp430f423a", "16bit")
MSP430_MCU_FEAT("msp430f425a", "16bit")
MSP430_MCU_FEAT("msp430f427a", "16bit")
MSP430_MCU_FEAT("msp430f4481", "16bit")
MSP430_MCU_FEAT("msp430f4491", "16bit")
MSP430_MCU_FEAT("msp430f447", "16bit")
MSP430_MCU_FEAT("msp430f448", "16bit")
MSP430_MCU_FEAT("msp430f449", "16bit")
MSP430_MCU_FEAT("msp430f2330", "16bit")
MSP430_MCU_FEAT("msp430f2350", "16bit")
MSP430_MCU_FEAT("msp430f2370", "16bit")
MSP430_MCU_FEAT("msp430f233", "16bit")
MSP430_MCU_FEAT("msp430f235", "16bit")
MSP430_MCU_FEAT("msp430f247", "16bit")
MSP430_MCU_FEAT("msp430f248", "16bit")
MSP430_MCU_FEAT("msp430f249", "16bit")
MSP430_MCU_FEAT("msp430f2410", "16bit")
MSP430_MCU_FEAT("msp430f2471", "16bit")
MSP430_MCU_FEAT("msp430f2481", "16bit")
MSP430_MCU_FEAT("msp430f2491", "16bit")
MSP430_MCU_FEAT("msp430i2020", "16bit")
MSP430_MCU_FEAT("msp430i2021", "16bit")
MSP430_MCU_FEAT("msp430i2030", "16bit")
MSP430_MCU_FEAT("msp430i2031", "16bit")
MSP430_MCU_FEAT("msp430i2040", "16bit")
MSP430_MCU_FEAT("msp430i2041", "16bit")
MSP430_MCU_FEAT("msp430afe221", "16bit")
MSP430_MCU_FEAT("msp430afe231", "16bit")
MSP430_MCU_FEAT("msp430afe251", "16bit")
MSP430_MCU_FEAT("msp430afe222", "16bit")
MSP430_MCU_FEAT("msp430afe232", "16bit")
MSP430_MCU_FEAT("msp430afe252", "16bit")
MSP430_MCU_FEAT("msp430afe223", "16bit")
MSP430_MCU_FEAT("msp430afe233", "16bit")
MSP430_MCU_FEAT("msp430afe253", "16bit")

// With 32 Bit Hardware Multiplier
MSP430_MCU_FEAT("msp430f4783", "32bit")
MSP430_MCU_FEAT("msp430f4793", "32bit")
MSP430_MCU_FEAT("msp430f4784", "32bit")
MSP430_MCU_FEAT("msp430f4794", "32bit")

// Generic MSUs
MSP430_MCU("msp430")
MSP430_MCU("msp430i2xxgeneric")

#undef MSP430_MCU
#undef MSP430_MCU_FEAT
1 change: 1 addition & 0 deletions src/llvm/tools/clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1990,6 +1990,7 @@ def mfloat_abi_EQ : Joined<["-"], "mfloat-abi=">, Group<m_Group>, Values<"soft,s
def mfpmath_EQ : Joined<["-"], "mfpmath=">, Group<m_Group>;
def mfpu_EQ : Joined<["-"], "mfpu=">, Group<m_Group>;
def mhwdiv_EQ : Joined<["-"], "mhwdiv=">, Group<m_Group>;
def mhwmult_EQ : Joined<["-"], "mhwmult=">, Group<m_Group>;
def mglobal_merge : Flag<["-"], "mglobal-merge">, Group<m_Group>, Flags<[CC1Option]>,
HelpText<"Enable merging of globals">;
def mhard_float : Flag<["-"], "mhard-float">, Group<m_Group>;
Expand Down
1 change: 1 addition & 0 deletions src/llvm/tools/clang/include/clang/module.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ module Clang_Basic {
textual header "Basic/BuiltinsXCore.def"
textual header "Basic/DiagnosticOptions.def"
textual header "Basic/Features.def"
textual header "Basic/MSP430Target.def"
textual header "Basic/LangOptions.def"
textual header "Basic/OpenCLExtensions.def"
textual header "Basic/OpenCLImageTypes.def"
Expand Down
1 change: 1 addition & 0 deletions src/llvm/tools/clang/lib/Driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ add_clang_library(clangDriver
ToolChains/MipsLinux.cpp
ToolChains/MinGW.cpp
ToolChains/Minix.cpp
ToolChains/MSP430.cpp
ToolChains/MSVC.cpp
ToolChains/Myriad.cpp
ToolChains/NaCl.cpp
Expand Down
4 changes: 4 additions & 0 deletions src/llvm/tools/clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "ToolChains/Hexagon.h"
#include "ToolChains/Lanai.h"
#include "ToolChains/Linux.h"
#include "ToolChains/MSP430.h"
#include "ToolChains/MSVC.h"
#include "ToolChains/MinGW.h"
#include "ToolChains/Minix.h"
Expand Down Expand Up @@ -4601,6 +4602,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
case llvm::Triple::avr:
TC = llvm::make_unique<toolchains::AVRToolChain>(*this, Target, Args);
break;
case llvm::Triple::msp430:
TC = llvm::make_unique<toolchains::MSP430ToolChain>(*this, Target, Args);
break;
case llvm::Triple::riscv32:
case llvm::Triple::riscv64:
TC = llvm::make_unique<toolchains::RISCVToolChain>(*this, Target, Args);
Expand Down
3 changes: 3 additions & 0 deletions src/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "CommonArgs.h"
#include "Hexagon.h"
#include "InputInfo.h"
#include "MSP430.h"
#include "PS4CPU.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/LangOptions.h"
Expand Down Expand Up @@ -363,6 +364,8 @@ static void getTargetFeatures(const ToolChain &TC, const llvm::Triple &Triple,
case llvm::Triple::amdgcn:
amdgpu::getAMDGPUTargetFeatures(D, Args, Features);
break;
case llvm::Triple::msp430:
msp430::getMSP430TargetFeatures(D, Args, Features);
}

// Find the last of each feature.
Expand Down
34 changes: 34 additions & 0 deletions src/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,10 @@ static bool isRISCV(llvm::Triple::ArchType Arch) {
return Arch == llvm::Triple::riscv32 || Arch == llvm::Triple::riscv64;
}

static bool isMSP430(llvm::Triple::ArchType Arch) {
return Arch == llvm::Triple::msp430;
}

static Multilib makeMultilib(StringRef commonSuffix) {
return Multilib(commonSuffix, commonSuffix, commonSuffix);
}
Expand Down Expand Up @@ -1423,6 +1427,26 @@ static void findAndroidArmMultilibs(const Driver &D,
Result.Multilibs = AndroidArmMultilibs;
}

static bool findMSP430Multilibs(const Driver &D,
const llvm::Triple &TargetTriple,
StringRef Path, const ArgList &Args,
DetectedMultilibs &Result) {
FilterNonExistent NonExistent(Path, "/crtbegin.o", D.getVFS());
Multilib MSP430Multilib = makeMultilib("/430");
// FIXME: when clang starts to support msp430x ISA additional logic
// to select between multilib must be implemented
// Multilib MSP430xMultilib = makeMultilib("/large");

Result.Multilibs.push_back(MSP430Multilib);
Result.Multilibs.FilterOut(NonExistent);

Multilib::flags_list Flags;
if (Result.Multilibs.select(Flags, Result.SelectedMultilib))
return true;

return false;
}

static void findRISCVMultilibs(const Driver &D,
const llvm::Triple &TargetTriple, StringRef Path,
const ArgList &Args, DetectedMultilibs &Result) {
Expand Down Expand Up @@ -1910,6 +1934,9 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
static const char *const MIPSN32ELTriples[] = {
"mips64el-linux-gnuabin32", "mipsisa64r6el-linux-gnuabin32"};

static const char *const MSP430LibDirs[] = {"/lib"};
static const char *const MSP430Triples[] = {"msp430-elf"};

static const char *const PPCLibDirs[] = {"/lib32", "/lib"};
static const char *const PPCTriples[] = {
"powerpc-linux-gnu", "powerpc-unknown-linux-gnu", "powerpc-linux-gnuspe",
Expand Down Expand Up @@ -2134,6 +2161,10 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
BiarchTripleAliases.append(begin(MIPSN32ELTriples), end(MIPSN32ELTriples));
BiarchTripleAliases.append(begin(MIPSTriples), end(MIPSTriples));
break;
case llvm::Triple::msp430:
LibDirs.append(begin(MSP430LibDirs), end(MSP430LibDirs));
TripleAliases.append(begin(MSP430Triples), end(MSP430Triples));
break;
case llvm::Triple::ppc:
LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
TripleAliases.append(begin(PPCTriples), end(PPCTriples));
Expand Down Expand Up @@ -2205,6 +2236,8 @@ bool Generic_GCC::GCCInstallationDetector::ScanGCCForMultilibs(
return false;
} else if (isRISCV(TargetArch)) {
findRISCVMultilibs(D, TargetTriple, Path, Args, Detected);
} else if (isMSP430(TargetArch)) {
findMSP430Multilibs(D, TargetTriple, Path, Args, Detected);
} else if (!findBiarchMultilibs(D, TargetTriple, Path, Args,
NeedsBiarchSuffix, Detected)) {
return false;
Expand Down Expand Up @@ -2468,6 +2501,7 @@ bool Generic_GCC::IsIntegratedAssemblerDefault() const {
case llvm::Triple::systemz:
case llvm::Triple::mips:
case llvm::Triple::mipsel:
case llvm::Triple::msp430:
return true;
case llvm::Triple::mips64:
case llvm::Triple::mips64el:
Expand Down
Loading