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