XCore.h 2.6 KB

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