]>
Commit | Line | Data |
---|---|---|
3250221d RS |
1 | /* Function integration definitions for GNU C-Compiler |
2 | Copyright (C) 1990 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of GNU CC. | |
5 | ||
6 | GNU CC is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2, or (at your option) | |
9 | any later version. | |
10 | ||
11 | GNU CC is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU CC; see the file COPYING. If not, write to | |
18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
19 | ||
20 | /* This structure is used to remap objects in the function being inlined to | |
21 | those belonging to the calling function. It is passed by | |
22 | expand_inline_function to its children. | |
23 | ||
24 | This structure is also used when unrolling loops and otherwise | |
25 | replicating code, although not all fields are needed in this case; | |
26 | only those fields needed by copy_rtx_and_substitute() and its children | |
27 | are used. | |
28 | ||
29 | This structure is used instead of static variables because | |
30 | expand_inline_function may be called recursively via expand_expr. */ | |
31 | ||
32 | struct inline_remap | |
33 | { | |
34 | /* Definition of function be inlined. */ | |
35 | union tree_node *fndecl; | |
36 | /* Place to put insns needed at start of function. */ | |
37 | rtx insns_at_start; | |
38 | /* Mapping from old registers to new registers. | |
39 | It is allocated and deallocated in `expand_inline_function' */ | |
40 | rtx *reg_map; | |
41 | /* Mapping from old code-labels to new code-labels. | |
42 | The first element of this map is label_map[min_labelno]. */ | |
43 | rtx *label_map; | |
44 | /* Mapping from old insn uid's to copied insns. The first element | |
45 | of this map is insn_map[min_insnno]; the last element is | |
46 | insn_map[max_insnno]. We keep the bounds here for when the map | |
47 | only covers a partial range of insns (such as loop unrolling or | |
48 | code replication). */ | |
49 | rtx *insn_map; | |
50 | int min_insnno, max_insnno; | |
51 | ||
52 | /* Map pseudo reg number in calling function to equivalent constant. We | |
53 | cannot in general substitute constants into parameter pseudo registers, | |
54 | since some machine descriptions (many RISCs) won't always handle | |
55 | the resulting insns. So if an incoming parameter has a constant | |
56 | equivalent, we record it here, and if the resulting insn is | |
57 | recognizable, we go with it. | |
58 | ||
59 | We also use this mechanism to convert references to incoming arguments | |
60 | and stacked variables. copy_rtx_and_substitute will replace the virtual | |
61 | incoming argument and virtual stacked variables registers with new | |
62 | pseudos that contain pointers into the replacement area allocated for | |
63 | this inline instance. These pseudos are then marked as being equivalent | |
64 | to the appropriate address and substituted if valid. */ | |
65 | rtx *const_equiv_map; | |
66 | /* This is incremented for each new basic block. | |
67 | It is used to store in const_age_map to record the domain of validity | |
68 | of each entry in const_equiv_map. | |
69 | A value of -1 indicates an entry for a reg which is a parm. | |
70 | All other values are "positive". */ | |
71 | #define CONST_AGE_PARM (-1) | |
72 | unsigned int const_age; | |
73 | /* In parallel with const_equiv_map, record the valid age for each entry. | |
74 | The entry is invalid if its age is less than const_age. */ | |
75 | unsigned int *const_age_map; | |
76 | /* Target of the inline function being expanded, or NULL if none. */ | |
77 | rtx inline_target; | |
78 | /* When an insn is being copied by copy_rtx_and_substitute, | |
79 | this is nonzero if we have copied an ASM_OPERANDS. | |
80 | In that case, it is the original input-operand vector. */ | |
81 | rtvec orig_asm_operands_vector; | |
82 | /* When an insn is being copied by copy_rtx_and_substitute, | |
83 | this is nonzero if we have copied an ASM_OPERANDS. | |
84 | In that case, it is the copied input-operand vector. */ | |
85 | rtvec copy_asm_operands_vector; | |
86 | /* Likewise, this is the copied constraints vector. */ | |
87 | rtvec copy_asm_constraints_vector; | |
88 | ||
89 | /* The next few fields are used for subst_constants to record the SETs | |
90 | that it saw. */ | |
91 | int num_sets; | |
92 | struct equiv_table | |
93 | { | |
94 | rtx dest; | |
95 | rtx equiv; | |
96 | } equiv_sets[MAX_RECOG_OPERANDS]; | |
97 | /* Record the last thing assigned to pc. This is used for folded | |
98 | conditional branch insns. */ | |
99 | rtx last_pc_value; | |
100 | #ifdef HAVE_cc0 | |
101 | /* Record the last thing assigned to cc0. */ | |
102 | rtx last_cc0_value; | |
103 | #endif | |
104 | }; | |
105 | ||
106 | /* Return a copy of an rtx (as needed), substituting pseudo-register, | |
107 | labels, and frame-pointer offsets as necessary. */ | |
108 | extern rtx copy_rtx_and_substitute (); | |
109 | ||
110 | extern void try_constants (); | |
111 | ||
112 | extern void mark_stores (); | |
113 | ||
114 | /* We do some simple constant folding optimization. This optimization | |
115 | really exists primarily to save time inlining a function. It | |
116 | also helps users who ask for inline functions without -O. */ | |
117 | extern rtx try_fold_condition (); | |
118 | ||
119 | extern rtx *global_const_equiv_map; |