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