|
|
1.1 root 1: /* Definitions for BSD assembler syntax for Intel 386
2: (actually AT&T syntax for insns and operands,
3: adapted to BSD conventions for symbol names and debugging.)
4: Copyright (C) 1988 Free Software Foundation, Inc.
5:
6: This file is part of GNU CC.
7:
8: GNU CC is free software; you can redistribute it and/or modify
9: it under the terms of the GNU General Public License as published by
10: the Free Software Foundation; either version 1, or (at your option)
11: any later version.
12:
13: GNU CC is distributed in the hope that it will be useful,
14: but WITHOUT ANY WARRANTY; without even the implied warranty of
15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: GNU General Public License for more details.
17:
18: You should have received a copy of the GNU General Public License
19: along with GNU CC; see the file COPYING. If not, write to
20: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21:
22: /* Use the Sequent Symmetry assembler syntax. */
23:
24: #define TARGET_VERSION fprintf (stderr, " (80386, BSD syntax)");
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 "
99: #define ASM_SHORT "\t.word "
100: #define ASM_LONG "\t.long "
101: #define ASM_DOUBLE "\t.double "
102:
103: /* String containing the assembler's comment-starter. */
104:
105: #define COMMENT_BEGIN "/"
106:
107: /* Output at beginning of assembler file.
108: ??? I am skeptical of this -- RMS. */
109:
110: #define ASM_FILE_START(FILE) \
111: fprintf (FILE, "\t.file\t\"%s\"\n", dump_base_name);
112:
113: /* This was suggested, but it shouldn't be right for DBX output. -- RMS
114: #define ASM_OUTPUT_SOURCE_FILENAME(FILE, NAME) */
115:
116: /* Output to assembler file text saying following lines
117: may contain character constants, extra white space, comments, etc. */
118:
119: #define ASM_APP_ON "/APP\n"
120:
121: /* Output to assembler file text saying following lines
122: no longer contain unusual constructs. */
123:
124: #define ASM_APP_OFF "/NO_APP\n"
125:
126: /* Define the syntax of labels and symbol definitions/declarations. */
127:
128: /* This is how to output an assembler line
129: that says to advance the location counter by SIZE bytes. */
130:
131: #define ASM_OUTPUT_SKIP(FILE,SIZE) \
132: fprintf (FILE, "\t.space %d\n", (SIZE))
133:
134: /* Output before read-only data. */
135:
136: #define TEXT_SECTION_ASM_OP ".text"
137:
138: /* Output before writable data. */
139:
140: #define DATA_SECTION_ASM_OP ".data"
141:
142: /* Define the syntax of labels and symbol definitions/declarations. */
143:
144: /* This says how to output an assembler line
145: to define a global common symbol. */
146:
147: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
148: ( fputs (".comm ", (FILE)), \
149: assemble_name ((FILE), (NAME)), \
150: fprintf ((FILE), ",%d\n", (SIZE)))
151:
152: /* This says how to output an assembler line
153: to define a local common symbol. */
154:
155: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
156: ( fputs (".lcomm ", (FILE)), \
157: assemble_name ((FILE), (NAME)), \
158: fprintf ((FILE), ",%d\n", (SIZE)))
159:
160: /* This is how to output an assembler line
161: that says to advance the location counter
162: to a multiple of 2**LOG bytes. */
163:
164: #define ASM_OUTPUT_ALIGN(FILE,LOG) \
165: if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", (LOG))
166:
167: /* This is how to store into the string BUF
168: the symbol_ref name of an internal numbered label where
169: PREFIX is the class of label and NUM is the number within the class.
170: This is suitable for output with `assemble_name'. */
171:
172: #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
173: sprintf ((BUF), "*%s%d", (PREFIX), (NUMBER))
174:
175: /* This is how to output an internal numbered label where
176: PREFIX is the class of label and NUM is the number within the class. */
177:
178: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
179: fprintf (FILE, "%s%d:\n", PREFIX, NUM)
180:
181: /* This is how to output a reference to a user-level label named NAME. */
182:
183: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
184: fprintf (FILE, "_%s", NAME)
185:
186: /* Sequent has some changes in the format of DBX symbols. */
187: #define DBX_NO_XREFS 1
188:
189: /* Don't split DBX symbols into continuations. */
190: #define DBX_CONTIN_LENGTH 0
191:
192: /* This is how to output a command to make the user-level label named NAME
193: defined for reference from other files. */
194:
195: #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
196: (fputs (".globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE))
197:
198: /* This is how to output an assembler line defining a `double' constant. */
199:
200: #undef ASM_OUTPUT_DOUBLE
201: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
202: fprintf (FILE, "\t.double 0d%.20e\n", (VALUE))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.