|
|
1.1 root 1: Info file internals, produced by Makeinfo, -*- Text -*-
2: from input file internals.texinfo.
3:
4:
5:
6: This file documents the internals of the GNU compiler.
7:
8: Copyright (C) 1988 Free Software Foundation, Inc.
9:
10: Permission is granted to make and distribute verbatim copies of
11: this manual provided the copyright notice and this permission notice
12: are preserved on all copies.
13:
14: Permission is granted to copy and distribute modified versions of this
15: manual under the conditions for verbatim copying, provided also that the
16: section entitled ``GNU CC General Public License'' is included exactly as
17: in the original, and provided that the entire resulting derived work is
18: distributed under the terms of a permission notice identical to this one.
19:
20: Permission is granted to copy and distribute translations of this manual
21: into another language, under the above conditions for modified versions,
22: except that the section entitled ``GNU CC General Public License'' and
23: this permission notice may be included in translations approved by the
24: Free Software Foundation instead of in the original English.
25:
26:
27:
28:
29:
30:
31: File: internals, Node: Misc, Next: Condition Code, Prev: Addressing Modes, Up: Machine Macros
32:
33: Miscellaneous Parameters
34: ========================
35:
36: `CASE_VECTOR_MODE'
37: An alias for a machine mode name. This is the machine mode that
38: elements of a jump-table should have.
39:
40: `CASE_VECTOR_PC_RELATIVE'
41: Define this macro if jump-tables should contain relative addresses.
42:
43: `CASE_DROPS_THROUGH'
44: Define this if control falls through a `case' insn when the index
45: value is out of range. This means the specified default-label is
46: actually ignored by the `case' insn proper.
47:
48: `IMPLICIT_FIX_EXPR'
49: An alias for a tree code that should be used by default for conversion
50: of floating point values to fixed point. Normally, `FIX_ROUND_EXPR'
51: is used.
52:
53: `FIXUNS_TRUNC_LIKE_FIX_TRUNC'
54: Define this macro if the same instructions that convert a floating
55: point number to a signed fixed point number also convert validly to an
56: unsigned one.
57:
58: `EASY_DIV_EXPR'
59: An alias for a tree code that is the easiest kind of division to
60: compile code for in the general case. It may be `TRUNC_DIV_EXPR',
61: `FLOOR_DIV_EXPR', `CEIL_DIV_EXPR' or `ROUND_DIV_EXPR'. These four
62: division operators differ in how they round the result to an integer.
63: `EASY_DIV_EXPR' is used when it is permissible to use any of those
64: kinds of division and the choice should be made on the basis of
65: efficiency.
66:
67: `DEFAULT_SIGNED_CHAR'
68: An expression whose value is 1 or 0, according to whether the type
69: `char' should be signed or unsigned by default. The user can always
70: override this default with the options `-fsigned-char' and
71: `-funsigned-char'.
72:
73: `SCCS_DIRECTIVE'
74: Define this if the preprocessor should ignore `#sccs' directives with
75: no error message.
76:
77: `MOVE_MAX'
78: The maximum number of bytes that a single instruction can move quickly
79: from memory to memory.
80:
81: `INT_TYPE_SIZE'
82: A C expression for the size in bits of the type `int' on the target
83: machine.
84:
85: `SLOW_BYTE_ACCESS'
86: Define this macro as a C expression which is nonzero if accessing less
87: than a word of memory (i.e. a `char' or a `short') is slow (requires
88: more than one instruction).
89:
90: `SLOW_ZERO_EXTEND'
91: Define this macro if zero-extension (of a `char' or `short' to an
92: `int') can be done faster if the destination is a register that is
93: known to be zero.
94:
95: If you define this macro, you must have instruction patterns that
96: recognize RTL structures like this:
97:
98: (set (strict-low-part (subreg:QI (reg:SI ...) 0)) ...)
99:
100:
101: and likewise for `HImode'.
102:
103: `SHIFT_COUNT_TRUNCATED'
104: Define this macro if shift instructions ignore all but the lowest few
105: bits of the shift count. It implies that a sign-extend or zero-extend
106: instruction for the shift count can be omitted.
107:
108: `TRULY_NOOP_TRUNCATION (OUTPREC, INPREC)'
109: A C expression which is nonzero if on this machine it is safe to
110: ``convert'' an integer of INPREC bits to one of OUTPREC bits (where
111: OUTPREC is smaller than INPREC) by merely operating on it as if it had
112: only OUTPREC bits.
113:
114: On many machines, this expression can be 1.
115:
116: `NO_FUNCTION_CSE'
117: Define this macro if it is as good or better to call a constant
118: function address than to call an address kept in a register.
119:
120: `STORE_FLAG_VALUE'
121: A C expression for the value stored by a store-flag instruction
122: (`sCOND') when the condition is true. This is usually 1 or -1; it is
123: required to be an odd number.
124:
125: Do not define `STORE_FLAG_VALUE' if the machine has no store-flag
126: instructions.
127:
128: `Pmode'
129: An alias for the machine mode for pointers. Normally the definition
130: can be
131:
132: #define Pmode SImode
133:
134:
135: `FUNCTION_MODE'
136: An alias for the machine mode used for memory references to functions
137: being called, in `call' RTL expressions. On most machines this should
138: be `QImode'.
139:
140: `CONST_COST (X, CODE)'
141: A part of a C `switch' statement that describes the relative costs of
142: constant RTL expressions. It must contain `case' labels for
143: expression codes `const_int', `const', `symbol_ref', `label_ref' and
144: `const_double'. Each case must ultimately reach a `return' statement
145: to return the relative cost of the use of that kind of constant value
146: in an expression. The cost may depend on the precise value of the
147: constant, which is available for examination in X.
148:
149: CODE is the expression code---redundant, since it can be obtained with
150: `GET_CODE (X)'.
151:
152: `DOLLARS_IN_IDENTIFIERS'
153: Define this if the character `$' should be allowed in identifier names.
154:
155:
156: File: internals, Node: Condition Code, Next: Assembler Format, Prev: Misc, Up: Machine Macros
157:
158: Condition Code Information
159: ==========================
160:
161: The file `conditions.h' defines a variable `cc_status' to describe how the
162: condition code was computed (in case the interpretation of the condition
163: code depends on the instruction that it was set by). This variable
164: contains the RTL expressions on which the condition code is currently
165: based, and several standard flags.
166:
167: Sometimes additional machine-specific flags must be defined in the machine
168: description header file. It can also add additional machine-specific
169: information by defining `CC_STATUS_MDEP'.
170:
171: `CC_STATUS_MDEP'
172: C code for a data type which is used for declaring the `mdep'
173: component of `cc_status'. It defaults to `int'.
174:
175: `CC_STATUS_MDEP_INIT'
176: A C expression for the initial value of the `mdep' field. It defaults
177: to 0.
178:
179: `NOTICE_UPDATE_CC (EXP)'
180: A C compound statement to set the components of `cc_status'
181: appropriately for an insn whose body is EXP. It is this macro's
182: responsibility to recognize insns that set the condition code as a
183: byproduct of other activity as well as those that explicitly set
184: `(cc0)'.
185:
186: If there are insn that do not set the condition code but do alter
187: other machine registers, this macro must check to see whether they
188: invalidate the expressions that the condition code is recorded as
189: reflecting. For example, on the 68000, insns that store in address
190: registers do not set the condition code, which means that usually
191: `NOTICE_UPDATE_CC' can leave `cc_status' unaltered for such insns.
192: But suppose that the previous insn set the condition code based on
193: location `a4@(102)' and the current insn stores a new value in `a4'.
194: Although the condition code is not changed by this, it will no longer
195: be true that it reflects the contents of `a4@(102)'. Therefore,
196: `NOTICE_UPDATE_CC' must alter `cc_status' in this case to say that
197: nothing is known about the condition code value.
198:
199:
200: File: internals, Node: Assembler Format, Prev: Condition Code, Up: Machine Macros
201:
202: Output of Assembler Code
203: ========================
204:
205: `ASM_SPEC'
206: A C string constant that tells the GNU CC driver program options to
207: pass to the assembler. It can also specify how to translate options
208: you give to GNU CC into options for GNU CC to pass to the assembler.
209: See the file `tm-sun3.h' for an example of this.
210:
211: Do not define this macro if it does not need to do anything.
212:
213: `LINK_SPEC'
214: A C string constant that tells the GNU CC driver program options to
215: pass to the linker. It can also specify how to translate options you
216: give to GNU CC into options for GNU CC to pass to the linker.
217:
218: Do not define this macro if it does not need to do anything.
219:
220: `ASM_FILE_START'
221: A C string constant for text to be output at the start of each
222: assembler output file. Normally this is `"#NO_APP"', which is a
223: comment that has no effect on most assemblers but tells the GNU
224: assembler that it can save time by not checking for certain assembler
225: constructs.
226:
227: `ASM_APP_ON'
228: A C string constant for text to be output before each `asm' statement
229: or group of consecutive ones. Normally this is `"#APP"', which is a
230: comment that has no effect on most assemblers but tells the GNU
231: assembler that it must check the lines that follow for all valid
232: assembler constructs.
233:
234: `ASM_APP_OFF'
235: A C string constant for text to be output after each `asm' statement
236: or group of consecutive ones. Normally this is `"#NO_APP"', which
237: tells the GNU assembler to resume making the time-saving assumptions
238: that are valid for ordinary compiler output.
239:
240: `TEXT_SECTION_ASM_OP'
241: A C string constant for the assembler operation that should precede
242: instructions and read-only data. Normally `".text"' is right.
243:
244: `DATA_SECTION_ASM_OP'
245: A C string constant for the assembler operation to identify the
246: following data as writable initialized data. Normally `".data"' is
247: right.
248:
249: `REGISTER_NAMES'
250: A C initializer containing the assembler's names for the machine
251: registers, each one as a C string constant. This is what translates
252: register numbers in the compiler into assembler language.
253:
254: `DBX_REGISTER_NUMBER (REGNO)'
255: A C expression that returns the DBX register number for the compiler
256: register number REGNO. In simple cases, the value of this expression
257: may be REGNO itself. But sometimes there are some registers that the
258: compiler knows about and DBX does not, or vice versa. In such cases,
259: some register may need to have one number in the compiler and another
260: for DBX.
261:
262: `DBX_NO_XREFS'
263: Define this macro if DBX on your system does not support the construct
264: `xsTAGNAME'. On some systems, this construct is used to describe a
265: forward reference to a structure named TAGNAME. On other systems,
266: this construct is not supported at all.
267:
268: `DBX_CONTIN_LENGTH'
269: A symbol name in DBX-format debugging information is normally
270: continued (split into two separate `.stabs' directives) when it
271: exceeds a certain length (by default, 80 characters). On some
272: operating systems, DBX requires this splitting; on others, splitting
273: must not be done. You can inhibit splitting by defining this macro
274: with the value zero. You can override the default splitting-length by
275: defining this macro as an expression for the length you desire.
276:
277: `DBX_CONTIN_CHAR'
278: Normally continuation is indicated by adding a `\' character to the
279: end of a `.stabs' string when a continuation follows. To use a
280: different character instead, define this macro as a character constant
281: for the character you want to use. Do not define this macro if
282: backslash is correct for your system.
283:
284: `ASM_OUTPUT_LABEL (FILE, NAME)'
285: A C statement (sans semicolon) to output to the stdio stream FILE the
286: assembler definition of a label named NAME. Use the expression
287: `assemble_name (FILE, NAME)' to output the name itself; before and
288: after that, output the additional assembler syntax for defining the
289: name, and a newline.
290:
291: `ASM_DECLARE_FUNCTION_NAME (FILE, NAME)'
292: A C statement (sans semicolon) to output to the stdio stream FILE any
293: text necessary for declaring the name of a function which is being
294: defined. This macro is responsible for outputting the label
295: definition (perhaps using `ASM_OUTPUT_LABEL').
296:
297: If this macro is not defined, then the function name is defined in the
298: usual manner as a label (by means of `ASM_OUTPUT_LABEL').
299:
300: `ASM_GLOBALIZE_LABEL (FILE, NAME)'
301: A C statement (sans semicolon) to output to the stdio stream FILE some
302: commands that will make the label NAME global; that is, available for
303: reference from other files. Use the expression `assemble_name (FILE,
304: NAME)' to output the name itself; before and after that, output the
305: additional assembler syntax for making that name global, and a newline.
306:
307: `ASM_OUTPUT_EXTERNAL (FILE, NAME)'
308: A C statement (sans semicolon) to output to the stdio stream FILE any
309: text necessary for declaring the name of an external symbol which is
310: referenced in this compilation but not defined.
311:
312: This macro need not be defined if it does not need to output anything.
313: The GNU assembler and most Unix assemblers don't require anything.
314:
315: `ASM_OUTPUT_LABELREF (FILE, NAME)'
316: A C statement to output to the stdio stream FILE a reference in
317: assembler syntax to a label named NAME. The character `_' should be
318: added to the front of the name, if that is customary on your operating
319: system, as it is in most Berkeley Unix systems. This macro is used in
320: `assemble_name'.
321:
322: `ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM)'
323: A C statement to output to the stdio stream FILE a label whose name is
324: made from the string PREFIX and the number NUM. These labels are used
325: for internal purposes, and there is no reason for them to appear in
326: the symbol table of the object file. On many systems, the letter `L'
327: at the beginning of a label has this effect. The usual definition of
328: this macro is as follows:
329:
330: fprintf (FILE, "L%s%d:\n", PREFIX, NUM)
331:
332:
333: `ASM_OUTPUT_CASE_LABEL (FILE, PREFIX, NUM, TABLE)'
334: Define this if the label before a jump-table needs to be output
335: specially. The first three arguments are the same as for
336: `ASM_OUTPUT_INTERNAL_LABEL'; the fourth argument is the jump-table
337: which follows (a `jump_insn' containing an `addr_vec' or
338: `addr_diff_vec').
339:
340: This feature is used on system V to output a `swbeg' statement for the
341: table.
342:
343: If this macro is not defined, these labels are output with
344: `ASM_OUTPUT_INTERNAL_LABEL'.
345:
346: `ASM_FORMAT_PRIVATE_NAME (OUTVAR, NAME, NUMBER)'
347: A C expression to assign to OUTVAR (which is a variable of type `char
348: *') a newly allocated string made from the string NAME and the number
349: NUMBER, with some suitable punctuation added. Use `alloca' to get
350: space for the string.
351:
352: This string will be used as the argument to `ASM_OUTPUT_LABELREF' to
353: produce an assembler label for an internal static variable whose name
354: is NAME. Therefore, the string must be such as to result in valid
355: assembler code. The argument NUMBER is different each time this macro
356: is executed; it prevents conflicts between similarly-named internal
357: static variables in different scopes.
358:
359: Ideally this string should not be a valid C identifier, to prevent any
360: conflict with the user's own symbols. Most assemblers allow periods
361: or percent signs in assembler symbols; putting at least one of these
362: between the name and the number will suffice.
363:
364: `ASM_OUTPUT_ADDR_DIFF_ELT (FILE, VALUE, REL)'
365: This macro should be provided on machines where the addresses in a
366: dispatch table are relative to the table's own address.
367:
368: The definition should be a C statement to output to the stdio stream
369: FILE an assembler pseudo-instruction to generate a difference between
370: two labels. VALUE and REL are the numbers of two internal labels.
371: The definitions of these labels are output using
372: `ASM_OUTPUT_INTERNAL_LABEL', and they must be printed in the same way
373: here. For example,
374:
375: fprintf (FILE, "\t.word L%d-L%d\n",
376: VALUE, REL)
377:
378:
379: `ASM_OUTPUT_ADDR_VEC_ELT (FILE, VALUE)'
380: This macro should be provided on machines where the addresses in a
381: dispatch table are absolute.
382:
383: The definition should be a C statement to output to the stdio stream
384: FILE an assembler pseudo-instruction to generate a reference to a
385: label. VALUE is the number of an internal label whose definition is
386: output using `ASM_OUTPUT_INTERNAL_LABEL'. For example,
387:
388: fprintf (FILE, "\t.word L%d\n", VALUE)
389:
390:
391: `ASM_OUTPUT_DOUBLE (FILE, VALUE)'
392: A C statement to output to the stdio stream FILE an assembler
393: instruction to assemble a `double' constant whose value is VALUE.
394: VALUE will be a C expression of type `double'.
395:
396: `ASM_OUTPUT_FLOAT (FILE, VALUE)'
397: A C statement to output to the stdio stream FILE an assembler
398: instruction to assemble a `float' constant whose value is VALUE.
399: VALUE will be a C expression of type `float'.
400:
401: `ASM_OUTPUT_INT (FILE, EXP)'
402: `ASM_OUTPUT_SHORT (FILE, EXP)'
403: `ASM_OUTPUT_CHAR (FILE, EXP)'
404: A C statement to output to the stdio stream FILE an assembler
405: instruction to assemble a `int', `short' or `char' constant whose
406: value is VALUE. The argument EXP will be an RTL expression which
407: represents a constant value. Use `output_addr_const (EXP)' to output
408: this value as an assembler expression.
409:
410: `ASM_OUTPUT_BYTE (FILE, VALUE)'
411: A C statement to output to the stdio stream FILE an assembler
412: instruction to assemble a single byte containing the number VALUE.
413:
414: `ASM_OUTPUT_ASCII (FILE, PTR, LEN)'
415: A C statement to output to the stdio stream FILE an assembler
416: instruction to assemble a string constant containing the LEN bytes at
417: PTR. PTR will be a C expression of type `char *' and LEN a C
418: expression of type `int'.
419:
420: If the assembler has a `.ascii' pseudo-op as found in the Berkeley
421: Unix assembler, do not define the macro `ASM_OUTPUT_ASCII'.
422:
423: `ASM_OUTPUT_SKIP (FILE, NBYTES)'
424: A C statement to output to the stdio stream FILE an assembler
425: instruction to advance the location counter by NBYTES bytes. NBYTES
426: will be a C expression of type `int'.
427:
428: `ASM_OUTPUT_ALIGN (FILE, POWER)'
429: A C statement to output to the stdio stream FILE an assembler
430: instruction to advance the location counter to a multiple of 2 to the
431: POWER bytes. POWER will be a C expression of type `int'.
432:
433: `ASM_OUTPUT_COMMON (FILE, NAME, SIZE)'
434: A C statement (sans semicolon) to output to the stdio stream FILE the
435: assembler definition of a common-label named NAME whose size is SIZE
436: bytes. Use the expression `assemble_name (FILE, NAME)' to output the
437: name itself; before and after that, output the additional assembler
438: syntax for defining the name, and a newline.
439:
440: This macro controls how the assembler definitions of uninitialized
441: global variables are output.
442:
443: `ASM_OUTPUT_LOCAL (FILE, NAME, SIZE)'
444: A C statement (sans semicolon) to output to the stdio stream FILE the
445: assembler definition of a local-common-label named NAME whose size is
446: SIZE bytes. Use the expression `assemble_name (FILE, NAME)' to output
447: the name itself; before and after that, output the additional
448: assembler syntax for defining the name, and a newline.
449:
450: This macro controls how the assembler definitions of uninitialized
451: static variables are output.
452:
453: `TARGET_BELL'
454: A C constant expression for the integer value for escape sequence `\a'.
455:
456: `TARGET_BS'
457: `TARGET_TAB'
458: `TARGET_NEWLINE'
459: C constant expressions for the integer values for escape sequences
460: `\b', `\t' and `\n'.
461:
462: `TARGET_VT'
463: `TARGET_FF'
464: `TARGET_CR'
465: C constant expressions for the integer values for escape sequences
466: `\v', `\f' and `\r'.
467:
468: `ASM_OUTPUT_OPCODE (FILE, PTR)'
469: Define this macro if you are using an unusual assembler that requires
470: different names for the machine instructions.
471:
472: The definition is a C statement or statements which output an
473: assembler instruction opcode to the stdio stream FILE. The
474: macro-operand PTR is a variable of type `char *' which points to the
475: opcode name in its ``internal'' form---the form that is written in the
476: machine description. The definition should output the opcode name to
477: FILE, performing any translation you desire, and increment the
478: variABLE PTR to point at the end of the opcode so that it will not be
479: output twice.
480:
481: In fact, your macro definition may process less than the entire opcode
482: name, or more than the opcode name; but if you want to process text
483: that includes `%'-sequences to substitute operands, you must take care
484: of the substitution yourself. Just be sure to increment PTR over
485: whatever text should not be output normally.
486:
487: If the macro definition does nothing, the instruction is output in the
488: usual way.
489:
490: `PRINT_OPERAND (FILE, X, CODE)'
491: A C compound statement to output to stdio stream FILE the assembler
492: syntax for an instruction operand X. X is an RTL expression.
493:
494: CODE is a value that can be used to specify one of several ways of
495: printing the operand. It is used when identical operands must be
496: printed differently depending on the context. CODE comes from the `%'
497: specification that was used to request printing of the operand. If
498: the specification was just `%DIGIT' then CODE is 0; if the
499: specification was `%LTR DIGIT' then CODE is the ASCII code for LTR.
500:
501: If X is a register, this macro should print the register's name. The
502: names can be found in an array `reg_names' whose type is `char *[]'.
503: `reg_names' is initialized from `REGISTER_NAMES'.
504:
505: When the machine description has a specification `%PUNCT' (a `%'
506: followed by a punctuation character), this macro is called with a null
507: pointer for X and the punctuation character for CODE.
508:
509: `PRINT_OPERAND_ADDRESS (FILE, X)'
510: A C compound statement to output to stdio stream FILE the assembler
511: syntax for an instruction operand that is a memory reference whose
512: address is X. X is an RTL expression.
513:
514: `ASM_OPEN_PAREN'
515: `ASM_CLOSE_PAREN'
516: These macros are defined as C string constant, describing the syntax
517: in the assembler for grouping arithmetic expressions. The following
518: definitions are correct for most assemblers:
519:
520: #define ASM_OPEN_PAREN "("
521: #define ASM_CLOSE_PAREN ")"
522:
523:
524:
525: File: internals, Node: Config, Prev: Machine Macros, Up: Top
526:
527: The Configuration File
528: **********************
529:
530: The configuration file `config-MACHINE.h' contains macro definitions that
531: describe the machine and system on which the compiler is running. Most of
532: the values in it are actually the same on all machines that GNU CC runs on,
533: so most all configuration files are identical. But there are some macros
534: that vary:
535:
536: `FAILURE_EXIT_CODE'
537: A C expression for the status code to be returned when the compiler
538: exits after serious errors.
539:
540: `SUCCESS_EXIT_CODE'
541: A C expression for the status code to be returned when the compiler
542: exits without serious errors.
543:
544:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.