|
|
1.1 root 1:
2:
3: File: internals, Node: Assembler Format, Prev: Condition Code, Up: Machine Macros
4:
5: Output of Assembler Code
6: ========================
7:
8: `ASM_SPEC'
9: A C string constant that tells the GNU CC driver program options to
10: pass to the assembler. It can also specify how to translate options
11: you give to GNU CC into options for GNU CC to pass to the assembler.
12: See the file `tm-sun3.h' for an example of this.
13:
14: Do not define this macro if it does not need to do anything.
15:
16: `LINK_SPEC'
17: A C string constant that tells the GNU CC driver program options to
18: pass to the linker. It can also specify how to translate options you
19: give to GNU CC into options for GNU CC to pass to the linker.
20:
21: Do not define this macro if it does not need to do anything.
22:
23: `ASM_FILE_START'
24: A C string constant for text to be output at the start of each
25: assembler output file. Normally this is `"#NO_APP"', which is a
26: comment that has no effect on most assemblers but tells the GNU
27: assembler that it can save time by not checking for certain assembler
28: constructs.
29:
30: `ASM_APP_ON'
31: A C string constant for text to be output before each `asm' statement
32: or group of consecutive ones. Normally this is `"#APP"', which is a
33: comment that has no effect on most assemblers but tells the GNU
34: assembler that it must check the lines that follow for all valid
35: assembler constructs.
36:
37: `ASM_APP_OFF'
38: A C string constant for text to be output after each `asm' statement
39: or group of consecutive ones. Normally this is `"#NO_APP"', which
40: tells the GNU assembler to resume making the time-saving assumptions
41: that are valid for ordinary compiler output.
42:
43: `TEXT_SECTION_ASM_OP'
44: A C string constant for the assembler operation that should precede
45: instructions and read-only data. Normally `".text"' is right.
46:
47: `DATA_SECTION_ASM_OP'
48: A C string constant for the assembler operation to identify the
49: following data as writable initialized data. Normally `".data"' is
50: right.
51:
52: `REGISTER_NAMES'
53: A C initializer containing the assembler's names for the machine
54: registers, each one as a C string constant. This is what translates
55: register numbers in the compiler into assembler language.
56:
57: `DBX_REGISTER_NUMBER (REGNO)'
58: A C expression that returns the DBX register number for the compiler
59: register number REGNO. In simple cases, the value of this expression
60: may be REGNO itself. But sometimes there are some registers that the
61: compiler knows about and DBX does not, or vice versa. In such cases,
62: some register may need to have one number in the compiler and another
63: for DBX.
64:
65: `DBX_NO_XREFS'
66: Define this macro if DBX on your system does not support the construct
67: `xsTAGNAME'. On some systems, this construct is used to describe a
68: forward reference to a structure named TAGNAME. On other systems,
69: this construct is not supported at all.
70:
71: `DBX_CONTIN_LENGTH'
72: A symbol name in DBX-format debugging information is normally
73: continued (split into two separate `.stabs' directives) when it
74: exceeds a certain length (by default, 80 characters). On some
75: operating systems, DBX requires this splitting; on others, splitting
76: must not be done. You can inhibit splitting by defining this macro
77: with the value zero. You can override the default splitting-length by
78: defining this macro as an expression for the length you desire.
79:
80: `DBX_CONTIN_CHAR'
81: Normally continuation is indicated by adding a `\' character to the
82: end of a `.stabs' string when a continuation follows. To use a
83: different character instead, define this macro as a character constant
84: for the character you want to use. Do not define this macro if
85: backslash is correct for your system.
86:
87: `ASM_OUTPUT_LABEL (FILE, NAME)'
88: A C statement (sans semicolon) to output to the stdio stream FILE the
89: assembler definition of a label named NAME. Use the expression
90: `assemble_name (FILE, NAME)' to output the name itself; before and
91: after that, output the additional assembler syntax for defining the
92: name, and a newline.
93:
94: `ASM_DECLARE_FUNCTION_NAME (FILE, NAME)'
95: A C statement (sans semicolon) to output to the stdio stream FILE any
96: text necessary for declaring the name of a function which is being
97: defined. This macro is responsible for outputting the label
98: definition (perhaps using `ASM_OUTPUT_LABEL').
99:
100: If this macro is not defined, then the function name is defined in the
101: usual manner as a label (by means of `ASM_OUTPUT_LABEL').
102:
103: `ASM_GLOBALIZE_LABEL (FILE, NAME)'
104: A C statement (sans semicolon) to output to the stdio stream FILE some
105: commands that will make the label NAME global; that is, available for
106: reference from other files. Use the expression `assemble_name (FILE,
107: NAME)' to output the name itself; before and after that, output the
108: additional assembler syntax for making that name global, and a newline.
109:
110: `ASM_OUTPUT_EXTERNAL (FILE, NAME)'
111: A C statement (sans semicolon) to output to the stdio stream FILE any
112: text necessary for declaring the name of an external symbol which is
113: referenced in this compilation but not defined.
114:
115: This macro need not be defined if it does not need to output anything.
116: The GNU assembler and most Unix assemblers don't require anything.
117:
118: `ASM_OUTPUT_LABELREF (FILE, NAME)'
119: A C statement to output to the stdio stream FILE a reference in
120: assembler syntax to a label named NAME. The character `_' should be
121: added to the front of the name, if that is customary on your operating
122: system, as it is in most Berkeley Unix systems. This macro is used in
123: `assemble_name'.
124:
125: `ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM)'
126: A C statement to output to the stdio stream FILE a label whose name is
127: made from the string PREFIX and the number NUM. These labels are used
128: for internal purposes, and there is no reason for them to appear in
129: the symbol table of the object file. On many systems, the letter `L'
130: at the beginning of a label has this effect. The usual definition of
131: this macro is as follows:
132:
133: fprintf (FILE, "L%s%d:\n", PREFIX, NUM)
134:
135: `ASM_OUTPUT_CASE_LABEL (FILE, PREFIX, NUM, TABLE)'
136: Define this if the label before a jump-table needs to be output
137: specially. The first three arguments are the same as for
138: `ASM_OUTPUT_INTERNAL_LABEL'; the fourth argument is the jump-table
139: which follows (a `jump_insn' containing an `addr_vec' or
140: `addr_diff_vec').
141:
142: This feature is used on system V to output a `swbeg' statement for the
143: table.
144:
145: If this macro is not defined, these labels are output with
146: `ASM_OUTPUT_INTERNAL_LABEL'.
147:
148: `ASM_FORMAT_PRIVATE_NAME (OUTVAR, NAME, NUMBER)'
149: A C expression to assign to OUTVAR (which is a variable of type `char
150: *') a newly allocated string made from the string NAME and the number
151: NUMBER, with some suitable punctuation added. Use `alloca' to get
152: space for the string.
153:
154: This string will be used as the argument to `ASM_OUTPUT_LABELREF' to
155: produce an assembler label for an internal static variable whose name
156: is NAME. Therefore, the string must be such as to result in valid
157: assembler code. The argument NUMBER is different each time this macro
158: is executed; it prevents conflicts between similarly-named internal
159: static variables in different scopes.
160:
161: Ideally this string should not be a valid C identifier, to prevent any
162: conflict with the user's own symbols. Most assemblers allow periods
163: or percent signs in assembler symbols; putting at least one of these
164: between the name and the number will suffice.
165:
166: `ASM_OUTPUT_ADDR_DIFF_ELT (FILE, VALUE, REL)'
167: This macro should be provided on machines where the addresses in a
168: dispatch table are relative to the table's own address.
169:
170: The definition should be a C statement to output to the stdio stream
171: FILE an assembler pseudo-instruction to generate a difference between
172: two labels. VALUE and REL are the numbers of two internal labels.
173: The definitions of these labels are output using
174: `ASM_OUTPUT_INTERNAL_LABEL', and they must be printed in the same way
175: here. For example,
176:
177: fprintf (FILE, "\t.word L%d-L%d\n",
178: VALUE, REL)
179:
180: `ASM_OUTPUT_ADDR_VEC_ELT (FILE, VALUE)'
181: This macro should be provided on machines where the addresses in a
182: dispatch table are absolute.
183:
184: The definition should be a C statement to output to the stdio stream
185: FILE an assembler pseudo-instruction to generate a reference to a
186: label. VALUE is the number of an internal label whose definition is
187: output using `ASM_OUTPUT_INTERNAL_LABEL'. For example,
188:
189: fprintf (FILE, "\t.word L%d\n", VALUE)
190:
191: `ASM_OUTPUT_DOUBLE (FILE, VALUE)'
192: A C statement to output to the stdio stream FILE an assembler
193: instruction to assemble a `double' constant whose value is VALUE.
194: VALUE will be a C expression of type `double'.
195:
196: `ASM_OUTPUT_FLOAT (FILE, VALUE)'
197: A C statement to output to the stdio stream FILE an assembler
198: instruction to assemble a `float' constant whose value is VALUE.
199: VALUE will be a C expression of type `float'.
200:
201: `ASM_OUTPUT_INT (FILE, EXP)'
202: `ASM_OUTPUT_SHORT (FILE, EXP)'
203: `ASM_OUTPUT_CHAR (FILE, EXP)'
204: A C statement to output to the stdio stream FILE an assembler
205: instruction to assemble a `int', `short' or `char' constant whose
206: value is VALUE. The argument EXP will be an RTL expression which
207: represents a constant value. Use `output_addr_const (EXP)' to output
208: this value as an assembler expression.
209:
210: `ASM_OUTPUT_BYTE (FILE, VALUE)'
211: A C statement to output to the stdio stream FILE an assembler
212: instruction to assemble a single byte containing the number VALUE.
213:
214: `ASM_OUTPUT_ASCII (FILE, PTR, LEN)'
215: A C statement to output to the stdio stream FILE an assembler
216: instruction to assemble a string constant containing the LEN bytes at
217: PTR. PTR will be a C expression of type `char *' and LEN a C
218: expression of type `int'.
219:
220: If the assembler has a `.ascii' pseudo-op as found in the Berkeley
221: Unix assembler, do not define the macro `ASM_OUTPUT_ASCII'.
222:
223: `ASM_OUTPUT_SKIP (FILE, NBYTES)'
224: A C statement to output to the stdio stream FILE an assembler
225: instruction to advance the location counter by NBYTES bytes. NBYTES
226: will be a C expression of type `int'.
227:
228: `ASM_OUTPUT_ALIGN (FILE, POWER)'
229: A C statement to output to the stdio stream FILE an assembler
230: instruction to advance the location counter to a multiple of 2 to the
231: POWER bytes. POWER will be a C expression of type `int'.
232:
233: `ASM_OUTPUT_COMMON (FILE, NAME, SIZE)'
234: A C statement (sans semicolon) to output to the stdio stream FILE the
235: assembler definition of a common-label named NAME whose size is SIZE
236: bytes. Use the expression `assemble_name (FILE, NAME)' to output the
237: name itself; before and after that, output the additional assembler
238: syntax for defining the name, and a newline.
239:
240: This macro controls how the assembler definitions of uninitialized
241: global variables are output.
242:
243: `ASM_OUTPUT_LOCAL (FILE, NAME, SIZE)'
244: A C statement (sans semicolon) to output to the stdio stream FILE the
245: assembler definition of a local-common-label named NAME whose size is
246: SIZE bytes. Use the expression `assemble_name (FILE, NAME)' to output
247: the name itself; before and after that, output the additional
248: assembler syntax for defining the name, and a newline.
249:
250: This macro controls how the assembler definitions of uninitialized
251: static variables are output.
252:
253: `TARGET_BELL'
254: A C constant expression for the integer value for escape sequence `\a'.
255:
256: `TARGET_BS'
257: `TARGET_TAB'
258: `TARGET_NEWLINE'
259: C constant expressions for the integer values for escape sequences
260: `\b', `\t' and `\n'.
261:
262: `TARGET_VT'
263: `TARGET_FF'
264: `TARGET_CR'
265: C constant expressions for the integer values for escape sequences
266: `\v', `\f' and `\r'.
267:
268: `ASM_OUTPUT_OPCODE (FILE, PTR)'
269: Define this macro if you are using an unusual assembler that requires
270: different names for the machine instructions.
271:
272: The definition is a C statement or statements which output an
273: assembler instruction opcode to the stdio stream FILE. The
274: macro-operand PTR is a variable of type `char *' which points to the
275: opcode name in its ``internal'' form---the form that is written in the
276: machine description. The definition should output the opcode name to
277: FILE, performing any translation you desire, and increment the
278: variABLE PTR to point at the end of the opcode so that it will not be
279: output twice.
280:
281: In fact, your macro definition may process less than the entire opcode
282: name, or more than the opcode name; but if you want to process text
283: that includes `%'-sequences to substitute operands, you must take care
284: of the substitution yourself. Just be sure to increment PTR over
285: whatever text should not be output normally.
286:
287: If the macro definition does nothing, the instruction is output in the
288: usual way.
289:
290: `PRINT_OPERAND (FILE, X, CODE)'
291: A C compound statement to output to stdio stream FILE the assembler
292: syntax for an instruction operand X. X is an RTL expression.
293:
294: CODE is a value that can be used to specify one of several ways of
295: printing the operand. It is used when identical operands must be
296: printed differently depending on the context. CODE comes from the `%'
297: specification that was used to request printing of the operand. If
298: the specification was just `%DIGIT' then CODE is 0; if the
299: specification was `%LTR DIGIT' then CODE is the ASCII code for LTR.
300:
301: If X is a register, this macro should print the register's name. The
302: names can be found in an array `reg_names' whose type is `char *[]'.
303: `reg_names' is initialized from `REGISTER_NAMES'.
304:
305: When the machine description has a specification `%PUNCT' (a `%'
306: followed by a punctuation character), this macro is called with a null
307: pointer for X and the punctuation character for CODE.
308:
309: `PRINT_OPERAND_ADDRESS (FILE, X)'
310: A C compound statement to output to stdio stream FILE the assembler
311: syntax for an instruction operand that is a memory reference whose
312: address is X. X is an RTL expression.
313:
314: `ASM_OPEN_PAREN'
315: `ASM_CLOSE_PAREN'
316: These macros are defined as C string constant, describing the syntax
317: in the assembler for grouping arithmetic expressions. The following
318: definitions are correct for most assemblers:
319:
320: #define ASM_OPEN_PAREN "("
321: #define ASM_CLOSE_PAREN ")"
322:
323:
324: File: internals, Node: Config, Prev: Machine Macros, Up: Top
325:
326: The Configuration File
327: **********************
328:
329: The configuration file `config-MACHINE.h' contains macro definitions that
330: describe the machine and system on which the compiler is running. Most of
331: the values in it are actually the same on all machines that GNU CC runs on,
332: so most all configuration files are identical. But there are some macros
333: that vary:
334:
335: `FAILURE_EXIT_CODE'
336: A C expression for the status code to be returned when the compiler
337: exits after serious errors.
338:
339: `SUCCESS_EXIT_CODE'
340: A C expression for the status code to be returned when the compiler
341: exits without serious errors.
342:
343:
344: Tag Table:
345: Node: Top1084
346: Node: Copying2276
347: Node: Contributors9633
348: Node: Options11165
349: Node: Installation36068
350: Node: VMS Install42638
351: Node: Trouble44602
352: Node: Incompatibilities44958
353: Node: Extensions49707
354: Node: Statement Exprs51271
355: Node: Naming Types52721
356: Node: Typeof53804
357: Node: Lvalues55502
358: Node: Conditionals57396
359: Node: Zero-Length58315
360: Node: Variable-Length58987
361: Node: Subscripting61129
362: Node: Pointer Arith61610
363: Node: Initializers62102
364: Node: Constructors62518
365: Node: Dollar Signs64001
366: Node: Alignment64297
367: Node: Inline65610
368: Node: Extended Asm67488
369: Node: Asm Labels72522
370: Node: Bugs73789
371: Node: Bug Criteria74501
372: Node: Bug Reporting77281
373: Node: Portability83698
374: Node: Interface85455
375: Node: Passes88262
376: Node: RTL100724
377: Node: RTL Objects102547
378: Node: Accessors105457
379: Node: Flags108739
380: Node: Macnusual assembler that requires
381: different names for the machine instructions.
382:
383: The definition is a C statement or statements which output an
384: assembler instruction opcode to the stdio stream FILE. The
385: macro-operand PTR is a variable of type `char *' which points to the
386: opcode name in its ``internal'' form---the form that is written in the
387: machine description. The definition should output the opcode name to
388: FILE, performing any translation you desire, and increment the
389: variABLE PTR to point at the end of the opcode so that it will not be
390: output twice.
391:
392: In fact, your macro definition may process less than the entire opcode
393: name, or more than the opcode name; but if you want to process text
394: that includes `%'-sequences to substitute operands, you must take care
395: of the substitution yourself. Just be sure to increment PTR over
396: whatever text should not be output normally.
397:
398: If the macro definition does nothing, the instruction is output in the
399: usual way.
400:
401: `PRINT_OPERAND (FILE, X, CODE)'
402: A C compound statement to output to stdio stream FILE the assembler
403: syntax for an i
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.