|
|
1.1 root 1: /* Definitions of target machine for GNU compiler.
2: AT&T UNIX PC version (pc7300, 3b1)
3:
4: Written by Alex Crain
5: bug reports to [email protected]
6:
7: Copyright (C) 1987 Free Software Foundation, Inc.
8:
9: This file is part of GNU CC.
10:
11: GNU CC is free software; you can redistribute it and/or modify
12: it under the terms of the GNU General Public License as published by
13: the Free Software Foundation; either version 1, or (at your option)
14: any later version.
15:
16: GNU CC is distributed in the hope that it will be useful,
17: but WITHOUT ANY WARRANTY; without even the implied warranty of
18: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19: GNU General Public License for more details.
20:
21: You should have received a copy of the GNU General Public License
22: along with GNU CC; see the file COPYING. If not, write to
23: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
24:
25: #define SGS_3B1
26:
27: #include "tm-hp9k320.h"
28:
29: /* See tm-m68k.h. 0 means 680[01]0 with no 68881. */
30:
31: #undef TARGET_DEFAULT
32: #define TARGET_DEFAULT 0
33:
34: /* -m68020 requires special flags to the assembler. */
35:
36: #undef ASM_SPEC
37: #define ASM_SPEC "%{m68020:-68020}%{!m68020:-68010}"
38:
39: /* we use /lib/libp/lib* when profiling */
40:
41: #undef LIB_SPEC
42: #define LIB_SPEC "%{!shlib:%{p:-L/lib/libp} %{pg:-L/lib/libp} -lc}"
43:
44: /* shared libraries need to use crt0s.o */
45:
46: #undef STARTFILE_SPEC
47: #define STARTFILE_SPEC \
48: "%{!shlib:%{pg:mcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}\
49: %{shlib:crt0s.o%s shlib.ifile%s} "
50:
51: /* cpp has to support a #sccs directive for the /usr/include files */
52:
53: #define SCCS_DIRECTIVE
54:
55: /* Make output for SDB. */
56:
57: #define SDB_DEBUGGING_INFO
58:
59: /* The .file command should always begin the output. */
60:
61: #undef ASM_FILE_START
62: #define ASM_FILE_START(FILE) sdbout_filename ((FILE), main_input_filename)
63:
64: /* Don't try to define `gcc_compiled.' since the assembler might not
65: accept symbols with periods and GDB doesn't run on this machine anyway. */
66: #define ASM_IDENTIFY_GCC(FILE)
67:
68: /* Define __HAVE_68881__ in preprocessor if -m68881 is specified.
69: This will control the use of inline 68881 insns in certain macros. */
70:
71: #undef CPP_SPEC
72: #define CPP_SPEC "%{m68881:-D__HAVE_68881__}"
73:
74: /* Names to predefine in the preprocessor for this target machine. */
75: /* [email protected] says mc68000 and m68k should not be here. */
76:
77: #undef CPP_PREDEFINES
78: #define CPP_PREDEFINES "-Dmc68k -Dunix -Dunixpc"
79:
80: /* Specify how to pad function arguments.
81: Value should be `upward', `downward' or `none'.
82: Same as the default, except no padding for large or variable-size args. */
83:
84: #define FUNCTION_ARG_PADDING(mode, size) \
85: (((mode) == BLKmode \
86: ? (GET_CODE (size) == CONST_INT \
87: && INTVAL (size) < PARM_BOUNDARY / BITS_PER_UNIT) \
88: : GET_MODE_BITSIZE (mode) < PARM_BOUNDARY) \
89: ? downward : none)
90:
91: /* Override part of the obstack macros. */
92:
93: #define __PTR_TO_INT(P) ((int)(P))
94: #define __INT_TO_PTR(P) ((char *)(P))
95:
96: /* Override parts of tm-m68k.h to fit the SGS-3b1 assembler. */
97:
98: #undef TARGET_VERSION
99: #undef ASM_FORMAT_PRIVATE_NAME
100: #undef ASM_OUTPUT_DOUBLE
101: #undef ASM_OUTPUT_FLOAT
102: #undef ASM_OUTPUT_ALIGN
103: #undef ASM_OUTPUT_SOURCE_FILENAME
104: #undef ASM_OUTPUT_SOURCE_LINE
105: #undef PRINT_OPERAND_ADDRESS
106: #undef ASM_GENERATE_INTERNAL_LABEL
107: #undef FUNCTION_PROFILER
108: #undef ASM_OUTPUT_ADDR_VEC_ELT
109: #undef ASM_OUTPUT_ADDR_DIFF_ELT
110: #undef ASM_OUTPUT_INTERNAL_LABEL
111: #undef ASM_OUTPUT_OPCODE
112: #undef ASM_OUTPUT_LOCAL
113: #undef ASM_OUTPUT_LABELREF
114: #undef ASM_OUTPUT_ASCII
115:
116: #define TARGET_VERSION fprintf (stderr, " (68k, SGS/AT&T unixpc syntax)");
117:
118: /* Store in OUTPUT a string (made with alloca) containing
119: an assembler-name for a local static variable named NAME.
120: LABELNO is an integer which is different for each call. */
121:
122: #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
123: ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
124: sprintf ((OUTPUT), "%s_%%%d", (NAME), (LABELNO)))
125:
126: /* The unixpc doesn't know about double's and float's */
127:
128: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
129: do { union { double d; long l[2]; } tem; \
130: tem.d = (VALUE); \
131: fprintf(FILE, "\tlong 0x%x,0x%x\n", tem.l[0], tem.l[1]); \
132: } while (0)
133:
134: #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
135: do { union { float f; long l;} tem; \
136: tem.f = (VALUE); \
137: fprintf (FILE, "\tlong 0x%x\n", tem.l); \
138: } while (0)
139:
140: #define ASM_OUTPUT_ALIGN(FILE,LOG) \
141: if ((LOG) == 1) \
142: fprintf (FILE, "\teven\n"); \
143: else if ((LOG) != 0) \
144: abort ();
145:
146: /* The `space' pseudo in the text segment outputs nop insns rather than 0s,
147: so we must output 0s explicitly in the text segment. */
148: #undef ASM_OUTPUT_SKIP
149: #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1.1.1.2 ! root 150: if (in_text_section ()) \
1.1 root 151: { \
152: int i; \
1.1.1.2 ! root 153: for (i = 0; i < (SIZE) - 20; i += 20) \
1.1 root 154: fprintf (FILE, "\tbyte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n"); \
155: if (i < (SIZE)) \
156: { \
157: fprintf (FILE, "\tbyte 0"); \
158: i++; \
159: for (; i < (SIZE); i++) \
160: fprintf (FILE, ",0"); \
161: fprintf (FILE, "\n"); \
162: } \
163: } \
164: else \
165: fprintf (FILE, "\tspace %d\n", (SIZE))
166:
167: /* The beginnings of sdb support... */
168:
169: #define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME) \
170: fprintf (FILE, "\tfile\t\"%s\"\n", FILENAME)
171:
172: #define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO) \
173: fprintf (FILE, "\tln\t%d\n", \
174: (sdb_begin_function_line \
175: ? last_linenum - sdb_begin_function_line : 1))
176:
177: /* Yet another null terminated string format. */
178:
179: #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
180: { register int sp = 0, lp = 0; \
181: fprintf (FILE, "\tbyte\t"); \
182: loop: \
183: if (PTR[sp] > ' ' && ! (PTR[sp] & 0x80) && PTR[sp] != '\\') \
184: { lp += 3; \
185: fprintf (FILE, "'%c", PTR[sp]); } \
186: else \
187: { lp += 5; \
188: fprintf (FILE, "0x%x", PTR[sp]); } \
189: if (++sp < LEN) \
190: { if (lp > 60) \
191: { lp = 0; \
192: fprintf (FILE, "\n%s ", ASCII_DATA_ASM_OP); } \
193: else \
194: putc (',', FILE); \
195: goto loop; } \
196: putc ('\n', FILE); }
197:
198: /* Note that in the case of the movhi which fetches an element of
199: an ADDR_DIFF_VEC the offset output is too large by 2.
200: This is because the 3b1 assembler refuses to subtract 2.
201: ASM_OUTPUT_CASE_LABEL, below, compensates for this. */
202:
203: #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
204: { register rtx reg1, reg2, breg, ireg; \
205: register rtx addr = ADDR; \
206: rtx offset; \
207: switch (GET_CODE (addr)) \
208: { \
209: case REG: \
210: fprintf (FILE, "(%s)", reg_names[REGNO (addr)]); \
211: break; \
212: case PRE_DEC: \
213: fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]); \
214: break; \
215: case POST_INC: \
216: fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]); \
217: break; \
218: case PLUS: \
219: reg1 = 0; reg2 = 0; \
220: ireg = 0; breg = 0; \
221: offset = 0; \
222: if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
223: { \
224: offset = XEXP (addr, 0); \
225: addr = XEXP (addr, 1); \
226: } \
227: else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
228: { \
229: offset = XEXP (addr, 1); \
230: addr = XEXP (addr, 0); \
231: } \
232: if (GET_CODE (addr) != PLUS) ; \
233: else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
234: { \
235: reg1 = XEXP (addr, 0); \
236: addr = XEXP (addr, 1); \
237: } \
238: else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
239: { \
240: reg1 = XEXP (addr, 1); \
241: addr = XEXP (addr, 0); \
242: } \
243: else if (GET_CODE (XEXP (addr, 0)) == MULT) \
244: { \
245: reg1 = XEXP (addr, 0); \
246: addr = XEXP (addr, 1); \
247: } \
248: else if (GET_CODE (XEXP (addr, 1)) == MULT) \
249: { \
250: reg1 = XEXP (addr, 1); \
251: addr = XEXP (addr, 0); \
252: } \
253: else if (GET_CODE (XEXP (addr, 0)) == REG) \
254: { \
255: reg1 = XEXP (addr, 0); \
256: addr = XEXP (addr, 1); \
257: } \
258: else if (GET_CODE (XEXP (addr, 1)) == REG) \
259: { \
260: reg1 = XEXP (addr, 1); \
261: addr = XEXP (addr, 0); \
262: } \
263: if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
264: || GET_CODE (addr) == SIGN_EXTEND) \
265: { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
266: /* for OLD_INDEXING \
267: else if (GET_CODE (addr) == PLUS) \
268: { \
269: if (GET_CODE (XEXP (addr, 0)) == REG) \
270: { \
271: reg2 = XEXP (addr, 0); \
272: addr = XEXP (addr, 1); \
273: } \
274: else if (GET_CODE (XEXP (addr, 1)) == REG) \
275: { \
276: reg2 = XEXP (addr, 1); \
277: addr = XEXP (addr, 0); \
278: } \
279: } \
280: */ \
281: if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
282: if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
283: || GET_CODE (reg1) == MULT)) \
284: || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
285: { breg = reg2; ireg = reg1; } \
286: else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
287: { breg = reg1; ireg = reg2; } \
288: if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
289: { int scale = 1; \
290: if (GET_CODE (ireg) == MULT) \
291: { scale = INTVAL (XEXP (ireg, 1)); \
292: ireg = XEXP (ireg, 0); } \
293: if (GET_CODE (ireg) == SIGN_EXTEND) \
294: fprintf (FILE, "LD%%%d(%%pc,%s.w", \
295: CODE_LABEL_NUMBER (XEXP (addr, 0)), \
296: reg_names[REGNO (XEXP (ireg, 0))]); \
297: else \
298: fprintf (FILE, "LD%%%d(%%pc,%s.l", \
299: CODE_LABEL_NUMBER (XEXP (addr, 0)), \
300: reg_names[REGNO (ireg)]); \
301: if (scale != 1) fprintf (FILE, ":%d", scale); \
302: fprintf (FILE, ")"); \
303: break; } \
304: if (breg != 0 && ireg == 0 && GET_CODE (addr) == LABEL_REF) \
305: { fprintf (FILE, "LD%%%d(%%pc,%s.l", \
306: CODE_LABEL_NUMBER (XEXP (addr, 0)), \
307: reg_names[REGNO (breg)]); \
308: putc (')', FILE); \
309: break; } \
310: if (ireg != 0 || breg != 0) \
311: { int scale = 1; \
312: if (breg == 0) \
313: abort (); \
314: if (addr != 0) \
315: output_addr_const (FILE, addr); \
316: fprintf (FILE, "(%s", reg_names[REGNO (breg)]); \
317: if (ireg != 0) \
318: putc (',', FILE); \
319: if (ireg != 0 && GET_CODE (ireg) == MULT) \
320: { scale = INTVAL (XEXP (ireg, 1)); \
321: ireg = XEXP (ireg, 0); } \
322: if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
323: fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]); \
324: else if (ireg != 0) \
325: fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]); \
326: if (scale != 1) fprintf (FILE, ":%d", scale); \
327: putc (')', FILE); \
328: break; \
329: } \
330: else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
331: { fprintf (FILE, "LD%%%d(%%pc,%s.w)", \
332: CODE_LABEL_NUMBER (XEXP (addr, 0)), \
333: reg_names[REGNO (reg1)]); \
334: break; } \
335: default: \
336: if (GET_CODE (addr) == CONST_INT \
337: && INTVAL (addr) < 0x8000 \
338: && INTVAL (addr) >= -0x8000) \
339: fprintf (FILE, "%d", INTVAL (addr)); \
340: else \
341: output_addr_const (FILE, addr); \
342: }}
343:
344: #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
345: sprintf ((LABEL), "%s%%%d", (PREFIX), (NUM))
346:
347: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
348: fprintf (FILE, "%s%%%d:\n", PREFIX, NUM)
349:
350: /* Must put address in %a0 , not %d0 . -- LGM, 7/15/88 */
351: #define FUNCTION_PROFILER(FILE, LABEL_NO) \
352: fprintf (FILE, "\tmov.l &LP%%%d,%%a0\n\tjsr mcount\n", (LABEL_NO))
353:
354: #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
355: fprintf (FILE, "\tlong L%%%d\n", (VALUE))
356:
357: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
358: fprintf (FILE, "\tshort L%%%d-L%%%d\n", (VALUE), (REL))
359:
360: /* ihnp4!lmayk!lgm says that `short 0' triggers assembler bug;
361: `short L%nn-L%nn' supposedly works. */
362: #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
363: if (! RTX_INTEGRATED_P (TABLE)) \
364: fprintf (FILE, "\tswbeg &%d\n%s%%%d:\n", \
365: XVECLEN (PATTERN (TABLE), 1), (PREFIX), (NUM)); \
366: else \
367: fprintf (FILE, "\tswbeg &%d\n%s%%%d:\n\tshort %s%%%d-%s%%%d\n", \
368: XVECLEN (PATTERN (TABLE), 1) + 1, (PREFIX), (NUM), \
369: (PREFIX), (NUM), (PREFIX), (NUM))
370:
371: /* At end of a switch table, define LD%n iff the symbol LI%n was defined. */
372: #define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \
373: if (RTX_INTEGRATED_P (TABLE)) \
374: fprintf (FILE, "\tset LD%%%d,L%%%d-LI%%%d\n", (NUM), (NUM), (NUM))
375:
376: #define ASM_OUTPUT_OPCODE(FILE, PTR) \
377: { if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
378: { ++(PTR); \
379: while (*(PTR) != ' ') \
380: { putc (*(PTR), (FILE)); ++(PTR); } \
381: fprintf ((FILE), ".w"); } \
382: else if ((PTR)[0] == 'f') \
383: { \
384: if (!strncmp ((PTR), "fmove", 5)) \
385: { fprintf ((FILE), "fmov"); (PTR) += 5; } \
386: else if (!strncmp ((PTR), "ftst", 4)) \
387: { fprintf ((FILE), "ftest"); (PTR) += 4; } \
388: } \
389: /* MOVE, MOVEA, MOVEQ, MOVEC ==> MOV */ \
390: else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \
391: && (PTR)[2] == 'v' && (PTR)[3] == 'e') \
392: { fprintf ((FILE), "mov"); (PTR) += 4; \
393: if ((PTR)[0] == 'q' || (PTR)[0] == 'a' || \
394: (PTR)[0] == 'c') (PTR)++; } \
395: /* SUB, SUBQ, SUBA, SUBI ==> SUB */ \
396: else if ((PTR)[0] == 's' && (PTR)[1] == 'u' \
397: && (PTR)[2] == 'b') \
398: { fprintf ((FILE), "sub"); (PTR) += 3; \
399: if ((PTR)[0] == 'q' || (PTR)[0] == 'i' || \
400: (PTR)[0] == 'a') (PTR)++; } \
401: /* CMP, CMPA, CMPI, CMPM ==> CMP */ \
402: else if ((PTR)[0] == 'c' && (PTR)[1] == 'm' \
403: && (PTR)[2] == 'p') \
404: { fprintf ((FILE), "cmp"); (PTR) += 3; \
405: if ((PTR)[0] == 'a' || (PTR)[0] == 'i' || \
406: (PTR)[0] == 'm') (PTR)++; } \
407: }
408:
409: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
410: ( fputs ("\tlcomm ", (FILE)), \
411: assemble_name ((FILE), (NAME)), \
412: fprintf ((FILE), ",%d\n", (ROUNDED)))
413:
414: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
415: fprintf (FILE, "%s", NAME)
416:
417: /* Override usual definitions of SDB output macros.
418: These definitions differ only in the absence of the period
419: at the beginning of the name of the directive
420: and in the use of `~' as the symbol for the current location. */
421:
422: #define PUT_SDB_SCL(a) fprintf(asm_out_file, "\tscl\t%d;", (a))
423: #define PUT_SDB_INT_VAL(a) fprintf (asm_out_file, "\tval\t%d;", (a))
424: #define PUT_SDB_VAL(a) \
425: ( fputs ("\tval\t", asm_out_file), \
426: output_addr_const (asm_out_file, (a)), \
427: fputc (';', asm_out_file))
428:
429: #define PUT_SDB_DEF(a) \
430: do { fprintf (asm_out_file, "\tdef\t"); \
431: ASM_OUTPUT_LABELREF (asm_out_file, a); \
432: fprintf (asm_out_file, ";"); } while (0)
433:
434: #define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\tdef\t~%s;",a)
435: #define PUT_SDB_ENDEF fputs("\tendef\n", asm_out_file)
436: #define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\ttype\t0%o;", a)
437: #define PUT_SDB_SIZE(a) fprintf(asm_out_file, "\tsize\t%d;", a)
438: #define PUT_SDB_DIM(a) fprintf(asm_out_file, "\tdim\t%d;", a)
439:
440: #define PUT_SDB_TAG(a) \
441: do { fprintf (asm_out_file, "\ttag\t"); \
442: ASM_OUTPUT_LABELREF (asm_out_file, a); \
443: fprintf (asm_out_file, ";"); } while (0)
444:
445: #define PUT_SDB_BLOCK_START(LINE) \
446: fprintf (asm_out_file, \
447: "\tdef\t~bb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \
448: (LINE))
449:
450: #define PUT_SDB_BLOCK_END(LINE) \
451: fprintf (asm_out_file, \
452: "\tdef\t~eb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \
453: (LINE))
454:
455: #define PUT_SDB_FUNCTION_START(LINE) \
456: fprintf (asm_out_file, \
457: "\tdef\t~bf;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \
458: (LINE))
459:
460: #define PUT_SDB_FUNCTION_END(LINE) \
461: fprintf (asm_out_file, \
462: "\tdef\t~ef;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \
463: (LINE))
464:
465: #define PUT_SDB_EPILOGUE_END(NAME) \
466: fprintf (asm_out_file, \
467: "\tdef\t%s;\tval\t~;\tscl\t-1;\tendef\n", \
468: (NAME))
469:
470: #define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
471: sprintf ((BUFFER), "~%dfake", (NUMBER));
472:
473: /* Define subroutines to call to handle multiply, divide, and remainder.
474: Use the subroutines that the 3b1's library provides.
475: The `*' prevents an underscore from being prepended by the compiler. */
476:
477: #define DIVSI3_LIBCALL "*ldiv"
478: #define UDIVSI3_LIBCALL "*uldiv"
479: #define MODSI3_LIBCALL "*lrem"
480: #define UMODSI3_LIBCALL "*ulrem"
481: #define MULSI3_LIBCALL "*lmul"
482: #define UMULSI3_LIBCALL "*ulmul"
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.