sdemtk.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* Definitions of target machine for GNU compiler.
  2. MIPS SDE version, for use with the SDE C library rather than newlib.
  3. Copyright (C) 2007-2015 Free Software Foundation, Inc.
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3, or (at your option)
  8. any later version.
  9. GCC is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GCC; see the file COPYING3. If not see
  15. <http://www.gnu.org/licenses/>. */
  16. #define TARGET_OS_CPP_BUILTINS() \
  17. do \
  18. { \
  19. builtin_assert ("system=sde"); \
  20. builtin_assert ("system=posix"); \
  21. builtin_define ("__SDE_MIPS__"); \
  22. \
  23. /* Deprecated: use __mips_isa_rev >= 2. */ \
  24. if (ISA_MIPS32R2) \
  25. builtin_define ("__mipsr2"); \
  26. \
  27. /* Deprecated: use __mips_fpr == 64. */ \
  28. if (TARGET_FLOAT64) \
  29. builtin_define ("__mipsfp64"); \
  30. \
  31. if (TARGET_NO_FLOAT) \
  32. builtin_define ("__NO_FLOAT"); \
  33. else if (TARGET_SOFT_FLOAT_ABI) \
  34. builtin_define ("__SOFT_FLOAT"); \
  35. else if (TARGET_SINGLE_FLOAT) \
  36. builtin_define ("__SINGLE_FLOAT"); \
  37. \
  38. if (TARGET_BIG_ENDIAN) \
  39. { \
  40. builtin_assert ("endian=big"); \
  41. builtin_assert ("cpu=mipseb"); \
  42. } \
  43. else \
  44. { \
  45. builtin_assert ("endian=little"); \
  46. builtin_assert ("cpu=mipsel"); \
  47. } \
  48. } \
  49. while (0)
  50. /* For __clear_cache in libgcc2.c. */
  51. #ifdef IN_LIBGCC2
  52. extern void mips_sync_icache (void *beg, unsigned long len);
  53. #undef CLEAR_INSN_CACHE
  54. #define CLEAR_INSN_CACHE(beg, end) \
  55. mips_sync_icache (beg, end - beg)
  56. #endif
  57. /* For mips_cache_flush_func in mips.opt. */
  58. #undef CACHE_FLUSH_FUNC
  59. #define CACHE_FLUSH_FUNC "mips_sync_icache"
  60. /* For inline code which needs to sync the icache and dcache,
  61. noting that the SDE library takes arguments (address, size). */
  62. #undef MIPS_ICACHE_SYNC
  63. #define MIPS_ICACHE_SYNC(ADDR, SIZE) \
  64. emit_library_call (gen_rtx_SYMBOL_REF (Pmode, mips_cache_flush_func), \
  65. LCT_NORMAL, VOIDmode, 2, ADDR, Pmode, \
  66. SIZE, TYPE_MODE (sizetype))
  67. /* This version of _mcount does not pop 2 words from the stack. */
  68. #undef FUNCTION_PROFILER
  69. #define FUNCTION_PROFILER(FILE, LABELNO) \
  70. { \
  71. mips_push_asm_switch (&mips_noat); \
  72. /* _mcount treats $2 as the static chain register. */ \
  73. if (cfun->static_chain_decl != NULL) \
  74. fprintf (FILE, "\tmove\t%s,%s\n", reg_names[2], \
  75. reg_names[STATIC_CHAIN_REGNUM]); \
  76. /* MIPS16 code passes saved $ra in $v1 instead of $at. */ \
  77. fprintf (FILE, "\tmove\t%s,%s\n", \
  78. reg_names[GP_REG_FIRST + (TARGET_MIPS16 ? 3 : 1)], \
  79. reg_names[RETURN_ADDR_REGNUM]); \
  80. fprintf (FILE, "\tjal\t_mcount\n"); \
  81. mips_pop_asm_switch (&mips_noat); \
  82. /* _mcount treats $2 as the static chain register. */ \
  83. if (cfun->static_chain_decl != NULL) \
  84. fprintf (FILE, "\tmove\t%s,%s\n", reg_names[STATIC_CHAIN_REGNUM], \
  85. reg_names[2]); \
  86. }
  87. /* ...nor does the call sequence preserve $31. */
  88. #undef MIPS_SAVE_REG_FOR_PROFILING_P
  89. #define MIPS_SAVE_REG_FOR_PROFILING_P(REGNO) ((REGNO) == RETURN_ADDR_REGNUM)
  90. /* Compile in support for the -mno-float option. */
  91. #define TARGET_SUPPORTS_NO_FLOAT 1