1*0b57cec5SDimitry Andric //===--- MSP430.h - Declare MSP430 target feature support -------*- C++ -*-===// 2*0b57cec5SDimitry Andric // 3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*0b57cec5SDimitry Andric // 7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 8*0b57cec5SDimitry Andric // 9*0b57cec5SDimitry Andric // This file declares MSP430 TargetInfo objects. 10*0b57cec5SDimitry Andric // 11*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 12*0b57cec5SDimitry Andric 13*0b57cec5SDimitry Andric #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_H 14*0b57cec5SDimitry Andric #define LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_H 15*0b57cec5SDimitry Andric 16*0b57cec5SDimitry Andric #include "clang/Basic/TargetInfo.h" 17*0b57cec5SDimitry Andric #include "clang/Basic/TargetOptions.h" 18*0b57cec5SDimitry Andric #include "llvm/ADT/Triple.h" 19*0b57cec5SDimitry Andric #include "llvm/Support/Compiler.h" 20*0b57cec5SDimitry Andric 21*0b57cec5SDimitry Andric namespace clang { 22*0b57cec5SDimitry Andric namespace targets { 23*0b57cec5SDimitry Andric 24*0b57cec5SDimitry Andric class LLVM_LIBRARY_VISIBILITY MSP430TargetInfo : public TargetInfo { 25*0b57cec5SDimitry Andric static const char *const GCCRegNames[]; 26*0b57cec5SDimitry Andric 27*0b57cec5SDimitry Andric public: 28*0b57cec5SDimitry Andric MSP430TargetInfo(const llvm::Triple &Triple, const TargetOptions &) 29*0b57cec5SDimitry Andric : TargetInfo(Triple) { 30*0b57cec5SDimitry Andric TLSSupported = false; 31*0b57cec5SDimitry Andric IntWidth = 16; 32*0b57cec5SDimitry Andric IntAlign = 16; 33*0b57cec5SDimitry Andric LongWidth = 32; 34*0b57cec5SDimitry Andric LongLongWidth = 64; 35*0b57cec5SDimitry Andric LongAlign = LongLongAlign = 16; 36*0b57cec5SDimitry Andric FloatWidth = 32; 37*0b57cec5SDimitry Andric FloatAlign = 16; 38*0b57cec5SDimitry Andric DoubleWidth = LongDoubleWidth = 64; 39*0b57cec5SDimitry Andric DoubleAlign = LongDoubleAlign = 16; 40*0b57cec5SDimitry Andric PointerWidth = 16; 41*0b57cec5SDimitry Andric PointerAlign = 16; 42*0b57cec5SDimitry Andric SuitableAlign = 16; 43*0b57cec5SDimitry Andric SizeType = UnsignedInt; 44*0b57cec5SDimitry Andric IntMaxType = SignedLongLong; 45*0b57cec5SDimitry Andric IntPtrType = SignedInt; 46*0b57cec5SDimitry Andric PtrDiffType = SignedInt; 47*0b57cec5SDimitry Andric SigAtomicType = SignedLong; 48*0b57cec5SDimitry Andric resetDataLayout("e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16"); 49*0b57cec5SDimitry Andric } 50*0b57cec5SDimitry Andric void getTargetDefines(const LangOptions &Opts, 51*0b57cec5SDimitry Andric MacroBuilder &Builder) const override; 52*0b57cec5SDimitry Andric 53*0b57cec5SDimitry Andric ArrayRef<Builtin::Info> getTargetBuiltins() const override { 54*0b57cec5SDimitry Andric // FIXME: Implement. 55*0b57cec5SDimitry Andric return None; 56*0b57cec5SDimitry Andric } 57*0b57cec5SDimitry Andric 58*0b57cec5SDimitry Andric bool allowsLargerPreferedTypeAlignment() const override { return false; } 59*0b57cec5SDimitry Andric 60*0b57cec5SDimitry Andric bool hasFeature(StringRef Feature) const override { 61*0b57cec5SDimitry Andric return Feature == "msp430"; 62*0b57cec5SDimitry Andric } 63*0b57cec5SDimitry Andric 64*0b57cec5SDimitry Andric ArrayRef<const char *> getGCCRegNames() const override; 65*0b57cec5SDimitry Andric 66*0b57cec5SDimitry Andric ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override { 67*0b57cec5SDimitry Andric // No aliases. 68*0b57cec5SDimitry Andric return None; 69*0b57cec5SDimitry Andric } 70*0b57cec5SDimitry Andric 71*0b57cec5SDimitry Andric bool validateAsmConstraint(const char *&Name, 72*0b57cec5SDimitry Andric TargetInfo::ConstraintInfo &info) const override { 73*0b57cec5SDimitry Andric // FIXME: implement 74*0b57cec5SDimitry Andric switch (*Name) { 75*0b57cec5SDimitry Andric case 'K': // the constant 1 76*0b57cec5SDimitry Andric case 'L': // constant -1^20 .. 1^19 77*0b57cec5SDimitry Andric case 'M': // constant 1-4: 78*0b57cec5SDimitry Andric return true; 79*0b57cec5SDimitry Andric } 80*0b57cec5SDimitry Andric // No target constraints for now. 81*0b57cec5SDimitry Andric return false; 82*0b57cec5SDimitry Andric } 83*0b57cec5SDimitry Andric 84*0b57cec5SDimitry Andric const char *getClobbers() const override { 85*0b57cec5SDimitry Andric // FIXME: Is this really right? 86*0b57cec5SDimitry Andric return ""; 87*0b57cec5SDimitry Andric } 88*0b57cec5SDimitry Andric 89*0b57cec5SDimitry Andric BuiltinVaListKind getBuiltinVaListKind() const override { 90*0b57cec5SDimitry Andric // FIXME: implement 91*0b57cec5SDimitry Andric return TargetInfo::CharPtrBuiltinVaList; 92*0b57cec5SDimitry Andric } 93*0b57cec5SDimitry Andric }; 94*0b57cec5SDimitry Andric 95*0b57cec5SDimitry Andric } // namespace targets 96*0b57cec5SDimitry Andric } // namespace clang 97*0b57cec5SDimitry Andric #endif // LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_H 98