|
|
1.1 root 1: Info file gcc.info, produced by Makeinfo, -*- Text -*- from input
2: file gcc.texinfo.
3:
4: This file documents the use and the internals of the GNU compiler.
5:
6: Copyright (C) 1988 Free Software Foundation, Inc.
7:
8: Permission is granted to make and distribute verbatim copies of this
9: manual provided the copyright notice and this permission notice are
10: preserved on all copies.
11:
12: Permission is granted to copy and distribute modified versions of
13: this manual under the conditions for verbatim copying, provided also
14: that the section entitled ``GNU CC General Public License'' is
15: included exactly as in the original, and provided that the entire
16: resulting derived work is distributed under the terms of a permission
17: notice identical to this one.
18:
19: Permission is granted to copy and distribute translations of this
20: manual into another language, under the above conditions for modified
21: versions, except that the section entitled ``GNU CC General Public
22: License'' and this permission notice may be included in translations
23: approved by the Free Software Foundation instead of in the original
24: English.
25:
26:
27:
28: File: gcc.info, Node: Assembler Format, Prev: Condition Code, Up: Machine Macros
29:
30: Output of Assembler Code
31: ========================
32:
33: `ASM_SPEC'
34: A C string constant that tells the GNU CC driver program options
35: to pass to the assembler. It can also specify how to translate
36: options you give to GNU CC into options for GNU CC to pass to
37: the assembler. See the file `tm-sun3.h' for an example of this.
38:
39: Do not define this macro if it does not need to do anything.
40:
41: `LINK_SPEC'
42: A C string constant that tells the GNU CC driver program options
43: to pass to the linker. It can also specify how to translate
44: options you give to GNU CC into options for GNU CC to pass to
45: the linker.
46:
47: Do not define this macro if it does not need to do anything.
48:
49: `LIB_SPEC'
50: Another C string constant used much like `LINK_SPEC'. The
51: difference between the two is that `LIBS_SPEC' is used at the
52: end of the command given to the linker.
53:
54: If this macro is not defined, a default is provided that loads
55: the standard C library from the usual place. See `gcc.c'.
56:
57: `STARTFILE_SPEC'
58: Another C string constant used much like `LINK_SPEC'. The
59: difference between the two is that `STARTFILE_SPEC' is used at
60: the very beginning of the command given to the linker.
61:
62: If this macro is not defined, a default is provided that loads
63: the standard C startup file from the usual place. See `gcc.c'.
64:
65: `ASM_FILE_START (STREAM)'
66: A C expression which outputs to the stdio stream STREAM some
67: appropriate text to go at the start of an assembler file.
68:
69: Normally this macro is defined to output a line containing
70: `#NO_APP', which is a comment that has no effect on most
71: assemblers but tells the GNU assembler that it can save time by
72: not checking for certain assembler constructs.
73:
74: On systems that use SDB, it is necessary to output certain
75: commands; see `tm-attasm.h'.
76:
77: `ASM_APP_ON'
78: A C string constant for text to be output before each `asm'
79: statement or group of consecutive ones. Normally this is
80: `"#APP"', which is a comment that has no effect on most
81: assemblers but tells the GNU assembler that it must check the
82: lines that follow for all valid assembler constructs.
83:
84: `ASM_APP_OFF'
85: A C string constant for text to be output after each `asm'
86: statement or group of consecutive ones. Normally this is
87: `"#NO_APP"', which tells the GNU assembler to resume making the
88: time-saving assumptions that are valid for ordinary compiler
89: output.
90:
91: `TEXT_SECTION_ASM_OP'
92: A C string constant for the assembler operation that should
93: precede instructions and read-only data. Normally `".text"' is
94: right.
95:
96: `DATA_SECTION_ASM_OP'
97: A C string constant for the assembler operation to identify the
98: following data as writable initialized data. Normally `".data"'
99: is right.
100:
101: `REGISTER_NAMES'
102: A C initializer containing the assembler's names for the machine
103: registers, each one as a C string constant. This is what
104: translates register numbers in the compiler into assembler
105: language.
106:
107: `DBX_REGISTER_NUMBER (REGNO)'
108: A C expression that returns the DBX register number for the
109: compiler register number REGNO. In simple cases, the value of
110: this expression may be REGNO itself. But sometimes there are
111: some registers that the compiler knows about and DBX does not,
112: or vice versa. In such cases, some register may need to have
113: one number in the compiler and another for DBX.
114:
115: `DBX_DEBUGGING_INFO'
116: Define this macro if GNU CC should produce debugging output for
117: DBX in response to the `-g' option.
118:
119: `SDB_DEBUGGING_INFO'
120: Define this macro if GNU CC should produce debugging output for
121: SDB in response to the `-g' option.
122:
123: `PUT_SDB_OP'
124: Define these macros to override the assembler syntax for the
125: special SDB assembler directives. See `sdbout.c' for a list of
126: these macros and their arguments. If the standard syntax is
127: used, you need not define them yourself.
128:
129: `SDB_GENERATE_FAKE'
130: Define this macro to override the usual method of constructing a
131: dummy name for anonymous structure and union types. See
132: `sdbout.c' for more infomation.
133:
134: `DBX_NO_XREFS'
135: Define this macro if DBX on your system does not support the
136: construct `xsTAGNAME'. On some systems, this construct is used
137: to describe a forward reference to a structure named TAGNAME.
138: On other systems, this construct is not supported at all.
139:
140: `DBX_CONTIN_LENGTH'
141: A symbol name in DBX-format debugging information is normally
142: continued (split into two separate `.stabs' directives) when it
143: exceeds a certain length (by default, 80 characters). On some
144: operating systems, DBX requires this splitting; on others,
145: splitting must not be done. You can inhibit splitting by
146: defining this macro with the value zero. You can override the
147: default splitting-length by defining this macro as an expression
148: for the length you desire.
149:
150: `DBX_CONTIN_CHAR'
151: Normally continuation is indicated by adding a `\' character to
152: the end of a `.stabs' string when a continuation follows. To
153: use a different character instead, define this macro as a
154: character constant for the character you want to use. Do not
155: define this macro if backslash is correct for your system.
156:
157: `ASM_OUTPUT_LABEL (STREAM, NAME)'
158: A C statement (sans semicolon) to output to the stdio stream
159: STREAM the assembler definition of a label named NAME. Use the
160: expression `assemble_name (STREAM, NAME)' to output the name
161: itself; before and after that, output the additional assembler
162: syntax for defining the name, and a newline.
163:
164: `ASM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL)'
165: A C statement (sans semicolon) to output to the stdio stream
166: STREAM any text necessary for declaring the name NAME of a
167: function which is being defined. This macro is responsible for
168: outputting the label definition (perhaps using
169: `ASM_OUTPUT_LABEL'). The argument DECL is the `FUNCTION_DECL'
170: tree node representing the function.
171:
172: If this macro is not defined, then the function name is defined
173: in the usual manner as a label (by means of `ASM_OUTPUT_LABEL').
174:
175: `ASM_GLOBALIZE_LABEL (STREAM, NAME)'
176: A C statement (sans semicolon) to output to the stdio stream
177: STREAM some commands that will make the label NAME global; that
178: is, available for reference from other files. Use the
179: expression `assemble_name (STREAM, NAME)' to output the name
180: itself; before and after that, output the additional assembler
181: syntax for making that name global, and a newline.
182:
183: `ASM_OUTPUT_EXTERNAL (STREAM, NAME, DECL)'
184: A C statement (sans semicolon) to output to the stdio stream
185: STREAM any text necessary for declaring the name of an external
186: symbol named NAME which is referenced in this compilation but
187: not defined. The value of DECL is the tree node for the
188: declaration.
189:
190: This macro need not be defined if it does not need to output
191: anything. The GNU assembler and most Unix assemblers don't
192: require anything.
193:
194: `ASM_OUTPUT_LABELREF (STREAM, NAME)'
195: A C statement to output to the stdio stream STREAM a reference
196: in assembler syntax to a label named NAME. The character `_'
197: should be added to the front of the name, if that is customary
198: on your operating system, as it is in most Berkeley Unix
199: systems. This macro is used in `assemble_name'.
200:
201: `ASM_GENERATE_INTERNAL_LABEL (STRING, PREFIX, NUM)'
202: A C statement to store into the string STRING a label whose name
203: is made from the string PREFIX and the number NUM.
204:
205: This string, when output subsequently by `ASM_OUTPUT_LABELREF',
206: should produce the same output that `ASM_OUTPUT_INTERNAL_LABEL'
207: would produce with the same PREFIX and NUM.
208:
209: `ASM_OUTPUT_INTERNAL_LABEL (STREAM, PREFIX, NUM)'
210: A C statement to output to the stdio stream STREAM a label whose
211: name is made from the string PREFIX and the number NUM. These
212: labels are used for internal purposes, and there is no reason
213: for them to appear in the symbol table of the object file. On
214: many systems, the letter `L' at the beginning of a label has
215: this effect. The usual definition of this macro is as follows:
216:
217: fprintf (STREAM, "L%s%d:\n", PREFIX, NUM)
218:
219: `ASM_OUTPUT_CASE_LABEL (STREAM, PREFIX, NUM, TABLE)'
220: Define this if the label before a jump-table needs to be output
221: specially. The first three arguments are the same as for
222: `ASM_OUTPUT_INTERNAL_LABEL'; the fourth argument is the
223: jump-table which follows (a `jump_insn' containing an `addr_vec'
224: or `addr_diff_vec').
225:
226: This feature is used on system V to output a `swbeg' statement
227: for the table.
228:
229: If this macro is not defined, these labels are output with
230: `ASM_OUTPUT_INTERNAL_LABEL'.
231:
232: `ASM_OUTPUT_CASE_END (STREAM, NUM, TABLE)'
233: Define this if something special must be output at the end of a
234: jump-table. The definition should be a C statement to be
235: executed after the assembler code for the table is written. It
236: should write the appropriate code to stdio stream STREAM. The
237: argument TABLE is the jump-table insn, and NUM is the
238: label-number of the preceding label.
239:
240: If this macro is not defined, nothing special is output at the
241: end of the jump-table.
242:
243: `ASM_FORMAT_PRIVATE_NAME (OUTVAR, NAME, NUMBER)'
244: A C expression to assign to OUTVAR (which is a variable of type
245: `char *') a newly allocated string made from the string NAME and
246: the number NUMBER, with some suitable punctuation added. Use
247: `alloca' to get space for the string.
248:
249: This string will be used as the argument to
250: `ASM_OUTPUT_LABELREF' to produce an assembler label for an
251: internal static variable whose name is NAME. Therefore, the
252: string must be such as to result in valid assembler code. The
253: argument NUMBER is different each time this macro is executed;
254: it prevents conflicts between similarly-named internal static
255: variables in different scopes.
256:
257: Ideally this string should not be a valid C identifier, to
258: prevent any conflict with the user's own symbols. Most
259: assemblers allow periods or percent signs in assembler symbols;
260: putting at least one of these between the name and the number
261: will suffice.
262:
263: `ASM_OUTPUT_REG_PUSH (STREAM, REGNO)'
264: A C expression to output to STREAM some assembler code which
265: will push hard register number REGNO onto the stack. The code
266: need not be optimal, since this macro is used only when profiling.
267:
268: `ASM_OUTPUT_REG_POP (STREAM, REGNO)'
269: A C expression to output to STREAM some assembler code which
270: will pop hard register number REGNO off of the stack. The code
271: need not be optimal, since this macro is used only when profiling.
272:
273: `ASM_OUTPUT_ADDR_DIFF_ELT (STREAM, VALUE, REL)'
274: This macro should be provided on machines where the addresses in
275: a dispatch table are relative to the table's own address.
276:
277: The definition should be a C statement to output to the stdio
278: stream STREAM an assembler pseudo-instruction to generate a
279: difference between two labels. VALUE and REL are the numbers of
280: two internal labels. The definitions of these labels are output
281: using `ASM_OUTPUT_INTERNAL_LABEL', and they must be printed in
282: the same way here. For example,
283:
284: fprintf (STREAM, "\t.word L%d-L%d\n",
285: VALUE, REL)
286:
287: `ASM_OUTPUT_ADDR_VEC_ELT (STREAM, VALUE)'
288: This macro should be provided on machines where the addresses in
289: a dispatch table are absolute.
290:
291: The definition should be a C statement to output to the stdio
292: stream STREAM an assembler pseudo-instruction to generate a
293: reference to a label. VALUE is the number of an internal label
294: whose definition is output using `ASM_OUTPUT_INTERNAL_LABEL'.
295: For example,
296:
297: fprintf (STREAM, "\t.word L%d\n", VALUE)
298:
299: `ASM_OUTPUT_DOUBLE (STREAM, VALUE)'
300: A C statement to output to the stdio stream STREAM an assembler
301: instruction to assemble a `double' constant whose value is
302: VALUE. VALUE will be a C expression of type `double'.
303:
304: `ASM_OUTPUT_FLOAT (STREAM, VALUE)'
305: A C statement to output to the stdio stream STREAM an assembler
306: instruction to assemble a `float' constant whose value is VALUE.
307: vALUE will be a C expression of type `float'.
308:
309: `ASM_OUTPUT_INT (STREAM, EXP)'
310: `ASM_OUTPUT_SHORT (STREAM, EXP)'
311: `ASM_OUTPUT_CHAR (STREAM, EXP)'
312: A C statement to output to the stdio stream STREAM an assembler
313: instruction to assemble a `int', `short' or `char' constant
314: whose value is VALUE. The argument EXP will be an RTL
315: expression which represents a constant value. Use
316: `output_addr_const (EXP)' to output this value as an assembler
317: expression.
318:
319: `ASM_OUTPUT_BYTE (STREAM, VALUE)'
320: A C statement to output to the stdio stream STREAM an assembler
321: instruction to assemble a single byte containing the number VALUE.
322:
323: `ASM_OUTPUT_ASCII (STREAM, PTR, LEN)'
324: A C statement to output to the stdio stream STREAM an assembler
325: instruction to assemble a string constant containing the LEN
326: bytes at PTR. PTR will be a C expression of type `char *' and
327: LEN a C expression of type `int'.
328:
329: If the assembler has a `.ascii' pseudo-op as found in the
330: Berkeley Unix assembler, do not define the macro
331: `ASM_OUTPUT_ASCII'.
332:
333: `ASM_OUTPUT_SKIP (STREAM, NBYTES)'
334: A C statement to output to the stdio stream STREAM an assembler
335: instruction to advance the location counter by NBYTES bytes.
336: NBYTES will be a C expression of type `int'.
337:
338: `ASM_OUTPUT_ALIGN (STREAM, POWER)'
339: A C statement to output to the stdio stream STREAM an assembler
340: instruction to advance the location counter to a multiple of 2
341: to the POWER bytes. POWER will be a C expression of type `int'.
342:
343: `ASM_OUTPUT_COMMON (STREAM, NAME, SIZE)'
344: A C statement (sans semicolon) to output to the stdio stream
345: STREAM the assembler definition of a common-label named NAME
346: whose size is SIZE bytes. Use the expression `assemble_name
347: (STREAM, NAME)' to output the name itself; before and after
348: that, output the additional assembler syntax for defining the
349: name, and a newline.
350:
351: This macro controls how the assembler definitions of
352: uninitialized global variables are output.
353:
354: `ASM_OUTPUT_LOCAL (STREAM, NAME, SIZE)'
355: A C statement (sans semicolon) to output to the stdio stream
356: STREAM the assembler definition of a local-common-label named
357: NAME whose size is SIZE bytes. Use the expression
358: `assemble_name (STREAM, NAME)' to output the name itself; before
359: and after that, output the additional assembler syntax for
360: defining the name, and a newline.
361:
362: This macro controls how the assembler definitions of
363: uninitialized static variables are output.
364:
365: `ASM_OUTPUT_SOURCE_LINE (STREAM, LINE)'
366: A C statment to output DBX or SDB debugging information before
367: code for line number LINE of the current source file to the
368: stdio stream STREAM.
369:
370: This macro need not be defined if the standard form of debugging
371: information for the debugger in use is appropriate.
372:
373: `ASM_OUTPUT_IDENT (STREAM, STRING)'
374: A C statement to output something to the assembler file to
375: handle a `#ident' directive containing the text STRING. If this
376: macro is not defined, the assembler code `.ident "STRING"' will
377: be output by default.
378:
379: This macro is significant only if `IDENT_DIRECTIVE' is defined.
380:
381: `TARGET_BELL'
382: A C constant expression for the integer value for escape
383: sequence `\a'.
384:
385: `TARGET_BS'
386: `TARGET_TAB'
387: `TARGET_NEWLINE'
388: C constant expressions for the integer values for escape
389: sequences `\b', `\t' and `\n'.
390:
391: `TARGET_VT'
392: `TARGET_FF'
393: `TARGET_CR'
394: C constant expressions for the integer values for escape
395: sequences `\v', `\f' and `\r'.
396:
397: `ASM_OUTPUT_OPCODE (STREAM, PTR)'
398: Define this macro if you are using an unusual assembler that
399: requires different names for the machine instructions.
400:
401: The definition is a C statement or statements which output an
402: assembler instruction opcode to the stdio stream STREAM. The
403: macro-operand PTR is a variable of type `char *' which points to
404: the opcode name in its ``internal'' form--the form that is
405: written in the machine description. The definition should
406: output the opcode name to STREAM, performing any translation you
407: desire, and increment the variable PTR to point at the end of
408: the opcode so that it will not be output twice.
409:
410: In fact, your macro definition may process less than the entire
411: opcode name, or more than the opcode name; but if you want to
412: process text that includes `%'-sequences to substitute operands,
413: you must take care of the substitution yourself. Just be sure
414: to increment PTR over whatever text should not be output normally.
415:
416: If the macro definition does nothing, the instruction is output
417: in the usual way.
418:
419: `FINAL_PRESCAN_INSN (INSN, OPVEC, NOPERANDS)'
420: If defined, a C statement to be executed just prior to the
421: output of assembler code for INSN, to modify the extracted
422: operands so they will be output differently.
423:
424: Here the argument OPVEC is the vector containing the operands
425: extracted from INSN, and NOPERANDS is the number of elements of
426: the vector which contain meaningful data for this insn. The
427: contents of this vector are what will be used to convert the
428: insn template into assembler code, so you can change the
429: assembler output by changing the contents of the vector.
430:
431: This macro is useful when various assembler syntaxes share a
432: single file of instruction patterns; by defining this macro
433: differently, you can cause a large class of instructions to be
434: output differently (such as with rearranged operands).
435: Naturally, variations in assembler syntax affecting individual
436: insn patterns ought to be handled by writing conditional output
437: routines in those patterns.
438:
439: If this macro is not defined, it is equivalent to a null
440: statement.
441:
442: `PRINT_OPERAND (STREAM, X, CODE)'
443: A C compound statement to output to stdio stream STREAM the
444: assembler syntax for an instruction operand X. X is an RTL
445: expression.
446:
447: CODE is a value that can be used to specify one of several ways
448: of printing the operand. It is used when identical operands
449: must be printed differently depending on the context. CODE
450: comes from the `%' specification that was used to request
451: printing of the operand. If the specification was just `%DIGIT'
452: then CODE is 0; if the specification was `%LTR DIGIT' then CODE
453: is the ASCII code for LTR.
454:
455: If X is a register, this macro should print the register's name.
456: The names can be found in an array `reg_names' whose type is
457: `char *[]'. `reg_names' is initialized from `REGISTER_NAMES'.
458:
459: When the machine description has a specification `%PUNCT' (a `%'
460: followed by a punctuation character), this macro is called with
461: a null pointer for X and the punctuation character for CODE.
462:
463: `PRINT_OPERAND_ADDRESS (STREAM, X)'
464: A C compound statement to output to stdio stream STREAM the
465: assembler syntax for an instruction operand that is a memory
466: reference whose address is X. X is an RTL expression.
467:
468: `ASM_OPEN_PAREN'
469: `ASM_CLOSE_PAREN'
470: These macros are defined as C string constant, describing the
471: syntax in the assembler for grouping arithmetic expressions.
472: The following definitions are correct for most assemblers:
473:
474: #define ASM_OPEN_PAREN "("
475: #define ASM_CLOSE_PAREN ")"
476:
477:
478:
479: File: gcc.info, Node: Config, Prev: Machine Macros, Up: Top
480:
481: The Configuration File
482: **********************
483:
484: The configuration file `xm-MACHINE.h' contains macro definitions that
485: describe the machine and system on which the compiler is running.
486: Most of the values in it are actually the same on all machines that
487: GNU CC runs on, so large parts of all configuration files are
488: identical. But there are some macros that vary:
489:
490: `FAILURE_EXIT_CODE'
491: A C expression for the status code to be returned when the
492: compiler exits after serious errors.
493:
494: `SUCCESS_EXIT_CODE'
495: A C expression for the status code to be returned when the
496: compiler exits without serious errors.
497:
498: In addition, configuration files for system V define `bcopy', `bzero'
499: and `bcmp' as aliases. Some files define `alloca' as a macro when
500: compiled with GNU CC, in order to take advantage of the benefit of
501: GNU CC's built-in `alloca'.
502:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.