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