XCore.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //===--- XCore.h - Declare XCore 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 XCore TargetInfo objects.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_XCORE_H
  13. #define LLVM_CLANG_LIB_BASIC_TARGETS_XCORE_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 XCoreTargetInfo : public TargetInfo {
  21. static const Builtin::Info BuiltinInfo[];
  22. public:
  23. XCoreTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
  24. : TargetInfo(Triple) {
  25. NoAsmVariants = true;
  26. LongLongAlign = 32;
  27. SuitableAlign = 32;
  28. DoubleAlign = LongDoubleAlign = 32;
  29. SizeType = UnsignedInt;
  30. PtrDiffType = SignedInt;
  31. IntPtrType = SignedInt;
  32. WCharType = UnsignedChar;
  33. WIntType = UnsignedInt;
  34. UseZeroLengthBitfieldAlignment = true;
  35. resetDataLayout("e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:32"
  36. "-f64:32-a:0:32-n32");
  37. }
  38. void getTargetDefines(const LangOptions &Opts,
  39. MacroBuilder &Builder) const override;
  40. ArrayRef<Builtin::Info> getTargetBuiltins() const override;
  41. BuiltinVaListKind getBuiltinVaListKind() const override {
  42. return TargetInfo::VoidPtrBuiltinVaList;
  43. }
  44. const char *getClobbers() const override { return ""; }
  45. ArrayRef<const char *> getGCCRegNames() const override {
  46. static const char *const GCCRegNames[] = {
  47. "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
  48. "r8", "r9", "r10", "r11", "cp", "dp", "sp", "lr"
  49. };
  50. return llvm::makeArrayRef(GCCRegNames);
  51. }
  52. ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
  53. return None;
  54. }
  55. bool validateAsmConstraint(const char *&Name,
  56. TargetInfo::ConstraintInfo &Info) const override {
  57. return false;
  58. }
  59. int getEHDataRegisterNumber(unsigned RegNo) const override {
  60. // R0=ExceptionPointerRegister R1=ExceptionSelectorRegister
  61. return (RegNo < 2) ? RegNo : -1;
  62. }
  63. bool allowsLargerPreferedTypeAlignment() const override { return false; }
  64. };
  65. } // namespace targets
  66. } // namespace clang
  67. #endif // LLVM_CLANG_LIB_BASIC_TARGETS_XCORE_H