tm-3b1.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. /* Definitions of target machine for GNU compiler.
  2. AT&T UNIX PC version (pc7300, 3b1)
  3. Written by Alex Crain
  4. bug reports to alex@umbc3.umd.edu
  5. Copyright (C) 1987 Free Software Foundation, Inc.
  6. This file is part of GNU CC.
  7. GNU CC is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY. No author or distributor
  9. accepts responsibility to anyone for the consequences of using it
  10. or for whether it serves any particular purpose or works at all,
  11. unless he says so in writing. Refer to the GNU CC General Public
  12. License for full details.
  13. Everyone is granted permission to copy, modify and redistribute
  14. GNU CC, but only under the conditions described in the
  15. GNU CC General Public License. A copy of this license is
  16. supposed to have been given to you along with GNU CC so you
  17. can know your rights and responsibilities. It should be in a
  18. file named COPYING. Among other things, the copyright notice
  19. and this notice must be preserved on all copies. */
  20. #include "tm-hp9k320.h"
  21. /* See tm-m68k.h. 7 means 680[01]0 with no 68881. */
  22. #undef TARGET_DEFAULT
  23. #define TARGET_DEFAULT 0
  24. /* -m68020 requires special flags to the assembler. */
  25. #undef ASM_SPEC
  26. #define ASM_SPEC "%{m68020:-68020}%{!m68020:-68010}"
  27. /* we use /lib/libp/lib* when profiling */
  28. #undef LIB_SPEC
  29. #define LIB_SPEC "%{!shlib:%{p:-L/lib/libp} %{pg:-L/lib/libp} -lc}"
  30. /* shared libraries need to use crt0s.o */
  31. #undef STARTFILE_SPEC
  32. #define STARTFILE_SPEC \
  33. "%{!shlib:%{pg:mcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}\
  34. %{shlib:crt0s.o%s shlib.ifile%s} "
  35. /* cpp has to support a #sccs directive for the /usr/include files */
  36. #define SCCS_DIRECTIVE
  37. /* Names to predefine in the preprocessor for this target machine. */
  38. #undef CPP_PREDEFINES
  39. #define CPP_PREDEFINES "-Dmc68000 -Dmc68k -Dm68k -Dunix -Dunixpc"
  40. /* Override parts of tm-m68k.h to fit the HPUX assembler. */
  41. #undef TARGET_VERSION
  42. #undef ASM_OUTPUT_DOUBLE
  43. #undef ASM_OUTPUT_FLOAT
  44. #undef ASM_OUTPUT_ALIGN
  45. #undef ASM_OUTPUT_SOURCE_FILENAME
  46. #undef ASM_OUTPUT_SOURCE_LINE
  47. #undef PRINT_OPERAND_ADDRESS
  48. #undef ASM_OUTPUT_INTERNAL_LABEL
  49. #undef ASM_OUTPUT_OPCODE
  50. #undef ASM_OUTPUT_LOCAL
  51. #undef ASM_OUTPUT_LABELREF
  52. #undef ASM_OUTPUT_ASCII
  53. #define TARGET_VERSION printf (" (68k, SGS/AT&T unixpc syntax)");
  54. /* The unixpc doesn't know about double's and float's */
  55. #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
  56. do { union { double d; long l[2]; } tem; \
  57. tem.d = (VALUE); \
  58. fprintf(FILE, "\tlong 0x%x,0x%x\n", tem.l[0], tem.l[1]); \
  59. } while (0)
  60. #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
  61. do { union { float f; long l;} tem; \
  62. tem.f = (VALUE); \
  63. fprintf (FILE, "\tlong 0x%x\n", tem.l); \
  64. } while (0)
  65. #define ASM_OUTPUT_ALIGN(FILE,LOG) \
  66. if ((LOG) == 1) \
  67. fprintf (FILE, "\teven\n"); \
  68. else if ((LOG) != 0) \
  69. abort ();
  70. /* The beginnings of sdb support... */
  71. #define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME) \
  72. fprintf (FILE, "\tfile\t\"%s\"\n", FILENAME);
  73. #define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO) \
  74. fprintf (FILE, "\tln\t%d\n", LINENO);
  75. /* Yet another null terminated string format. */
  76. #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
  77. { register int sp = 0, lp = 0; \
  78. fprintf (FILE, "\tbyte\t"); \
  79. loop: \
  80. if (PTR[sp] > ' ' && ! (PTR[sp] & 0x80) && PTR[sp] != '\\') \
  81. { lp += 3; \
  82. fprintf (FILE, "'%c", PTR[sp]); } \
  83. else \
  84. { lp += 5; \
  85. fprintf (FILE, "0x%x", PTR[sp]); } \
  86. if (++sp < LEN) \
  87. { if (lp > 60) \
  88. { lp = 0; \
  89. fprintf (FILE, "\n%s ", ASCII_DATA_ASM_OP); } \
  90. else \
  91. putc (',', FILE); \
  92. goto loop; } \
  93. putc ('\n', FILE); }
  94. /* Note that in the case of the movhi which fetches an element of
  95. an ADDR_DIFF_VEC the offset output is too large by 2.
  96. This is because the 3b1 assembler refuses to subtract 2.
  97. ASM_OUTPUT_CASE_LABEL, below, compensates for this. */
  98. #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
  99. { register rtx reg1, reg2, breg, ireg; \
  100. register rtx addr = ADDR; \
  101. rtx offset; \
  102. switch (GET_CODE (addr)) \
  103. { \
  104. case REG: \
  105. fprintf (FILE, "(%s)", reg_name [REGNO (addr)]); \
  106. break; \
  107. case PRE_DEC: \
  108. fprintf (FILE, "-(%s)", reg_name [REGNO (XEXP (addr, 0))]); \
  109. break; \
  110. case POST_INC: \
  111. fprintf (FILE, "(%s)+", reg_name [REGNO (XEXP (addr, 0))]); \
  112. break; \
  113. case PLUS: \
  114. reg1 = 0; reg2 = 0; \
  115. ireg = 0; breg = 0; \
  116. offset = 0; \
  117. if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
  118. { \
  119. offset = XEXP (addr, 0); \
  120. addr = XEXP (addr, 1); \
  121. } \
  122. else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
  123. { \
  124. offset = XEXP (addr, 1); \
  125. addr = XEXP (addr, 0); \
  126. } \
  127. if (GET_CODE (addr) != PLUS) ; \
  128. else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
  129. { \
  130. reg1 = XEXP (addr, 0); \
  131. addr = XEXP (addr, 1); \
  132. } \
  133. else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
  134. { \
  135. reg1 = XEXP (addr, 1); \
  136. addr = XEXP (addr, 0); \
  137. } \
  138. else if (GET_CODE (XEXP (addr, 0)) == MULT) \
  139. { \
  140. reg1 = XEXP (addr, 0); \
  141. addr = XEXP (addr, 1); \
  142. } \
  143. else if (GET_CODE (XEXP (addr, 1)) == MULT) \
  144. { \
  145. reg1 = XEXP (addr, 1); \
  146. addr = XEXP (addr, 0); \
  147. } \
  148. else if (GET_CODE (XEXP (addr, 0)) == REG) \
  149. { \
  150. reg1 = XEXP (addr, 0); \
  151. addr = XEXP (addr, 1); \
  152. } \
  153. else if (GET_CODE (XEXP (addr, 1)) == REG) \
  154. { \
  155. reg1 = XEXP (addr, 1); \
  156. addr = XEXP (addr, 0); \
  157. } \
  158. if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
  159. || GET_CODE (addr) == SIGN_EXTEND) \
  160. { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
  161. /* for OLD_INDEXING \
  162. else if (GET_CODE (addr) == PLUS) \
  163. { \
  164. if (GET_CODE (XEXP (addr, 0)) == REG) \
  165. { \
  166. reg2 = XEXP (addr, 0); \
  167. addr = XEXP (addr, 1); \
  168. } \
  169. else if (GET_CODE (XEXP (addr, 1)) == REG) \
  170. { \
  171. reg2 = XEXP (addr, 1); \
  172. addr = XEXP (addr, 0); \
  173. } \
  174. } \
  175. */ \
  176. if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
  177. if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
  178. || GET_CODE (reg1) == MULT)) \
  179. || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
  180. { breg = reg2; ireg = reg1; } \
  181. else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
  182. { breg = reg1; ireg = reg2; } \
  183. if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
  184. { int scale = 1; \
  185. if (GET_CODE (ireg) == MULT) \
  186. { scale = INTVAL (XEXP (ireg, 1)); \
  187. ireg = XEXP (ireg, 0); } \
  188. if (GET_CODE (ireg) == SIGN_EXTEND) \
  189. fprintf (FILE, "L%d-LI%d(%%pc,%s.w", \
  190. CODE_LABEL_NUMBER (XEXP (addr, 0)), \
  191. CODE_LABEL_NUMBER (XEXP (addr, 0)), \
  192. reg_name[REGNO (XEXP (ireg, 0))]); \
  193. else \
  194. fprintf (FILE, "L%d-LI%d(%%pc,%s.l", \
  195. CODE_LABEL_NUMBER (XEXP (addr, 0)), \
  196. CODE_LABEL_NUMBER (XEXP (addr, 0)), \
  197. reg_name[REGNO (ireg)]); \
  198. if (scale != 1) fprintf (FILE, ":%d", scale); \
  199. fprintf (FILE, ")"); \
  200. break; } \
  201. if (ireg != 0 || breg != 0) \
  202. { int scale = 1; \
  203. if (breg == 0) \
  204. abort (); \
  205. if (addr != 0) \
  206. output_addr_const (FILE, addr); \
  207. fprintf (FILE, "(%s", reg_name[REGNO (breg)]); \
  208. if (ireg != 0) \
  209. putc (',', FILE); \
  210. if (ireg != 0 && GET_CODE (ireg) == MULT) \
  211. { scale = INTVAL (XEXP (ireg, 1)); \
  212. ireg = XEXP (ireg, 0); } \
  213. if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
  214. fprintf (FILE, "%s.w", reg_name[REGNO (XEXP (ireg, 0))]); \
  215. else if (ireg != 0) \
  216. fprintf (FILE, "%s.l", reg_name[REGNO (ireg)]); \
  217. if (scale != 1) fprintf (FILE, ":%d", scale); \
  218. putc (')', FILE); \
  219. break; \
  220. } \
  221. else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
  222. { fprintf (FILE, "L%d-LI%d(%%pc,%s.w)", \
  223. CODE_LABEL_NUMBER (XEXP (addr, 0)), \
  224. CODE_LABEL_NUMBER (XEXP (addr, 0)), \
  225. reg_name[REGNO (reg1)]); \
  226. break; } \
  227. default: \
  228. if (GET_CODE (addr) == CONST_INT \
  229. && INTVAL (addr) < 0x8000 \
  230. && INTVAL (addr) >= -0x8000) \
  231. fprintf (FILE, "%d", INTVAL (addr)); \
  232. else \
  233. output_addr_const (FILE, addr); \
  234. }}
  235. #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
  236. fprintf (FILE, "%s%d:\n", PREFIX, NUM)
  237. #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
  238. fprintf (FILE, "\tswbeg &%d\n%s%d:\n\tshort 0", XVECLEN (TABLE, 1) + 1, PREFIX, NUM)
  239. #define ASM_OUTPUT_OPCODE(FILE, PTR) \
  240. { if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
  241. { ++(PTR); \
  242. while (*(PTR) != ' ') \
  243. { putc (*(PTR), (FILE)); ++(PTR); } \
  244. fprintf ((FILE), ".w"); } \
  245. else if ((PTR)[0] == 'f') \
  246. { \
  247. if (!strncmp ((PTR), "fmove", 5)) \
  248. { fprintf ((FILE), "fmov"); (PTR) += 5; } \
  249. else if (!strncmp ((PTR), "ftst", 4)) \
  250. { fprintf ((FILE), "ftest"); (PTR) += 4; } \
  251. } \
  252. /* MOVE, MOVEA, MOVEQ, MOVEC ==> MOV */ \
  253. else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \
  254. && (PTR)[2] == 'v' && (PTR)[3] == 'e') \
  255. { fprintf ((FILE), "mov"); (PTR) += 4; \
  256. if ((PTR)[0] == 'q' || (PTR)[0] == 'a' || \
  257. (PTR)[0] == 'c') (PTR)++; } \
  258. /* SUB, SUBQ, SUBA, SUBI ==> SUB */ \
  259. else if ((PTR)[0] == 's' && (PTR)[1] == 'u' \
  260. && (PTR)[2] == 'b') \
  261. { fprintf ((FILE), "sub"); (PTR) += 3; \
  262. if ((PTR)[0] == 'q' || (PTR)[0] == 'i' || \
  263. (PTR)[0] == 'a') (PTR)++; } \
  264. /* CMP, CMPA, CMPI, CMPM ==> CMP */ \
  265. else if ((PTR)[0] == 'c' && (PTR)[1] == 'm' \
  266. && (PTR)[2] == 'p') \
  267. { fprintf ((FILE), "cmp"); (PTR) += 3; \
  268. if ((PTR)[0] == 'a' || (PTR)[0] == 'i' || \
  269. (PTR)[0] == 'm') (PTR)++; } \
  270. }
  271. #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE) \
  272. ( fputs ("\tlcomm ", (FILE)), \
  273. assemble_name ((FILE), (NAME)), \
  274. fprintf ((FILE), ",%d\n", (SIZE)))
  275. #define ASM_OUTPUT_LABELREF(FILE,NAME) \
  276. fprintf (FILE, "%s", NAME)