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