|
|
1.1 root 1: /* Definitions for AT&T 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:
22: #define TARGET_VERSION printf (" (80386, ATT syntax)");
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 "
99: #define ASM_SHORT "\t.value "
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:
109: #undef ASM_FILE_START
110: #define ASM_FILE_START(FILE) \
111: do { if (optimize) ASM_FILE_START_1 (FILE); \
112: } while (0)
113:
114: #define ASM_FILE_START_1(FILE) fprintf (FILE, "\t.optim\n")
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: /* This is how to output an assembler line
127: that says to advance the location counter
128: to a multiple of 2**LOG bytes. */
129:
130: #define ASM_OUTPUT_ALIGN(FILE,LOG) \
131: if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
132:
133: /* This is how to output an assembler line
134: that says to advance the location counter by SIZE bytes. */
135:
136: #define ASM_OUTPUT_SKIP(FILE,SIZE) \
137: fprintf ((FILE), "\t.set .,.+%d\n", (SIZE))
138:
139: /* Output before read-only data. */
140:
141: #define TEXT_SECTION_ASM_OP ".text"
142:
143: /* Output before writable data. */
144:
145: #define DATA_SECTION_ASM_OP ".data"
146:
147: /* Define the syntax of labels and symbol definitions/declarations. */
148:
149: /* This says how to output an assembler line
150: to define a global common symbol. */
151:
152: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE) \
153: ( fputs (".comm ", (FILE)), \
154: assemble_name ((FILE), (NAME)), \
155: fprintf ((FILE), ",%d\n", (SIZE)))
156:
157: /* This says how to output an assembler line
158: to define a local common symbol. */
159:
160: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE) \
161: (data_section (), \
162: ASM_OUTPUT_LABEL ((FILE), (NAME)), \
163: fprintf ((FILE), "\t.set .,.+%d\n", (SIZE)))
164:
165: /* This is how to store into the string BUF
166: the symbol_ref name of an internal numbered label where
167: PREFIX is the class of label and NUM is the number within the class.
168: This is suitable for output with `assemble_name'. */
169:
170: #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
171: sprintf ((BUF), ".%s%d", (PREFIX), (NUMBER))
172:
173: /* This is how to output a reference to a user-level label named NAME. */
174:
175: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
176: fprintf (FILE, "%s", NAME)
177:
178: /* This is how to output an internal numbered label where
179: PREFIX is the class of label and NUM is the number within the class. */
180:
181: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
182: fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
183:
184: /* This is how to output a command to make the user-level label named NAME
185: defined for reference from other files. */
186:
187: #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
188: (fputs (".globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.