MSP430.h 2.8 KB

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