|
|
1.1 root 1: /* Definitions for Sun assembler syntax for the Intel 80386.
2: Copyright (C) 1988 Free Software Foundation, Inc.
3:
4: This file is part of GNU CC.
5:
1.1.1.3 ! root 6: GNU CC is free software; you can redistribute it and/or modify
! 7: it under the terms of the GNU General Public License as published by
! 8: the Free Software Foundation; either version 1, or (at your option)
! 9: any later version.
! 10:
1.1 root 11: GNU CC is distributed in the hope that it will be useful,
1.1.1.3 ! root 12: but WITHOUT ANY WARRANTY; without even the implied warranty of
! 13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! 14: GNU General Public License for more details.
! 15:
! 16: You should have received a copy of the GNU General Public License
! 17: along with GNU CC; see the file COPYING. If not, write to
! 18: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
1.1 root 19:
20:
1.1.1.2 root 21: #define TARGET_VERSION fprintf (stderr, " (80386, Sun syntax)");
1.1 root 22:
23: /* Define the syntax of instructions and addresses. */
24:
25: /* Define some concatenation macros to concatenate an opcode
26: and one, two or three operands. In other assembler syntaxes
27: they may alter the order of ther operands. */
28:
29: #ifdef __STDC__
30: #define AS2(a,b,c) #a " " #b "," #c
31: #define AS3(a,b,c,d) #a " " #b "," #c "," #d
32: #define AS1(a,b) #a " " #b
33: #else
34: #define AS1(a,b) "a b"
35: #define AS2(a,b,c) "a b,c"
36: #define AS3(a,b,c,d) "a b,c,d"
37: #endif
38:
39: /* Output the size-letter for an opcode.
40: CODE is the letter used in an operand spec (L, B, W, S or Q).
41: CH is the corresponding lower case letter
42: (except if CODE is L then CH is `l'). */
43: #define PUT_OP_SIZE(CODE,CH,FILE) putc (CH,(FILE))
44:
45: /* Opcode suffix for fullword insn. */
46: #define L_SIZE "l"
47:
48: /* Prefix for register names in this syntax. */
49: #define RP "%"
50:
51: /* Prefix for immediate operands in this syntax. */
52: #define IP "$"
53:
54: /* Prefix for internally generated assembler labels. */
55: #define LPREFIX ".L"
56:
57: /* Output the prefix for an immediate operand, or for an offset operand. */
58: #define PRINT_IMMED_PREFIX(FILE) fputs ("$", (FILE))
59: #define PRINT_OFFSET_PREFIX(FILE) fputs ("$", (FILE))
60:
61: /* Indirect call instructions should use `*'. */
62: #define USE_STAR 1
63:
64: /* Prefix for a memory-operand X. */
65: #define PRINT_PTR(X, FILE)
66:
67: /* Delimiters that surround base reg and index reg. */
68: #define ADDR_BEG(FILE) putc('(', (FILE))
69: #define ADDR_END(FILE) putc(')', (FILE))
70:
71: /* Print an index register (whose rtx is IREG). */
72: #define PRINT_IREG(FILE,IREG) \
73: do \
74: { fputs (",", (FILE)); PRINT_REG ((IREG), 0, (FILE)); } \
75: while (0)
76:
77: /* Print an index scale factor SCALE. */
78: #define PRINT_SCALE(FILE,SCALE) \
79: if ((SCALE) != 1) fprintf ((FILE), ",%d", (SCALE))
80:
81: /* Print a base/index combination.
82: BREG is the base reg rtx, IREG is the index reg rtx,
83: and SCALE is the index scale factor (an integer). */
84:
85: #define PRINT_B_I_S(BREG,IREG,SCALE,FILE) \
86: { ADDR_BEG (FILE); \
87: if (BREG) PRINT_REG ((BREG), 0, (FILE)); \
88: if ((IREG) != 0) \
89: { PRINT_IREG ((FILE), (IREG)); \
90: PRINT_SCALE ((FILE), (SCALE)); } \
91: ADDR_END (FILE); }
92:
93: /* Define the syntax of pseudo-ops, labels and comments. */
94:
95: /* Assembler pseudos to introduce constants of various size. */
96:
97: #define ASM_BYTE "\t.byte\t"
98: #define ASM_SHORT "\t.value\t"
99: #define ASM_LONG "\t.long\t"
100: #define ASM_DOUBLE "\t.double\t"
101:
102: /* String containing the assembler's comment-starter. */
103:
104: #define COMMENT_BEGIN "/"
105:
106: /* Output at beginning of assembler file. */
107: /* The .file command should always begin the output. */
108:
109: #undef ASM_FILE_START
110: #define ASM_FILE_START(FILE) \
1.1.1.2 root 111: do { \
112: extern char *version_string, *language_string; \
113: { \
114: int len = strlen (dump_base_name); \
115: char *na = dump_base_name + len; \
116: /* NA gets DUMP_BASE_NAME sans directory names. */\
117: while (na > dump_base_name) \
118: { \
119: if (na[-1] == '/') \
120: break; \
121: na--; \
122: } \
123: fprintf (FILE, "\t.file\t\"%s\"\n", na); \
124: } \
125: fprintf (FILE, "\t.version\t\"%s %s\"\n", \
126: language_string, version_string); \
127: if (optimize) ASM_FILE_START_1 (FILE); \
1.1 root 128: } while (0)
129:
130: #define ASM_FILE_START_1(FILE) fprintf (FILE, "\t.optim\n")
131:
132: /* Output to assembler file text saying following lines
133: may contain character constants, extra white space, comments, etc. */
134:
135: #define ASM_APP_ON "/APP\n"
136:
137: /* Output to assembler file text saying following lines
138: no longer contain unusual constructs. */
139:
140: #define ASM_APP_OFF "/NO_APP\n"
141:
142: /* This is how to output an assembler line
143: that says to advance the location counter
144: to a multiple of 2**LOG bytes. */
145:
146: #define ASM_OUTPUT_ALIGN(FILE,LOG) \
147: if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
148:
149: /* This is how to output an assembler line
150: that says to advance the location counter by SIZE bytes. */
151:
152: #define ASM_OUTPUT_SKIP(FILE,SIZE) \
153: fprintf ((FILE), "\t.set\t.,.+%d\n", (SIZE))
154:
155: /* Output before read-only data. */
156:
157: #define TEXT_SECTION_ASM_OP "\t.text"
158:
159: /* Output before writable data. */
160:
161: #define DATA_SECTION_ASM_OP "\t.data"
162:
163: /* Define the syntax of labels and symbol definitions/declarations. */
164:
165: /* This says how to output an assembler line
166: to define a global common symbol. */
167:
168: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
169: ( fputs ("\t.comm\t", (FILE)), \
170: assemble_name ((FILE), (NAME)), \
171: fprintf ((FILE), ",%d\n", (SIZE)))
172:
173: /* This says how to output an assembler line
174: to define a local common symbol. */
175:
176: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
177: (data_section (), \
178: ASM_OUTPUT_LABEL ((FILE), (NAME)), \
179: fprintf ((FILE), "\t.set\t.,.+%d\n", (SIZE)))
180:
181: /* This is how to store into the string BUF
182: the symbol_ref name of an internal numbered label where
183: PREFIX is the class of label and NUM is the number within the class.
184: This is suitable for output with `assemble_name'. */
185:
186: #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
187: sprintf ((BUF), ".%s%d", (PREFIX), (NUMBER))
188:
189: /* This is how to output a reference to a user-level label named NAME. */
190:
191: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
192: fprintf (FILE, "%s", NAME)
193:
194: /* This is how to output an internal numbered label where
195: PREFIX is the class of label and NUM is the number within the class. */
196:
197: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
198: fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
199:
200: /* This is how to output a command to make the user-level label named NAME
201: defined for reference from other files. */
202:
203: #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
204: (fputs ("\t.globl\t", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE))
205:
206: /* How to output an ASCII string constant. */
207:
208: #define ASM_OUTPUT_ASCII(FILE, p, size) \
209: { int i=0; \
210: while (i < size) \
211: { if (i%10 == 0) { if (i!=0) fprintf (FILE, "\n"); \
212: fprintf (FILE, ASM_BYTE); } \
213: else fprintf (FILE, ","); \
214: fprintf (FILE, "0x%x",(p[i++] & 0377)) ;} \
215: fprintf (FILE, "\n"); }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.