Commit | Line | Data |
---|---|---|
78f96d04 C |
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 | /* Number of entries in const_equiv_map and const_arg_map. */ | |
67 | int const_equiv_map_size; | |
68 | /* This is incremented for each new basic block. | |
69 | It is used to store in const_age_map to record the domain of validity | |
70 | of each entry in const_equiv_map. | |
71 | A value of -1 indicates an entry for a reg which is a parm. | |
72 | All other values are "positive". */ | |
73 | #define CONST_AGE_PARM (-1) | |
74 | unsigned int const_age; | |
75 | /* In parallel with const_equiv_map, record the valid age for each entry. | |
76 | The entry is invalid if its age is less than const_age. */ | |
77 | unsigned int *const_age_map; | |
78 | /* Target of the inline function being expanded, or NULL if none. */ | |
79 | rtx inline_target; | |
80 | /* When an insn is being copied by copy_rtx_and_substitute, | |
81 | this is nonzero if we have copied an ASM_OPERANDS. | |
82 | In that case, it is the original input-operand vector. */ | |
83 | rtvec orig_asm_operands_vector; | |
84 | /* When an insn is being copied by copy_rtx_and_substitute, | |
85 | this is nonzero if we have copied an ASM_OPERANDS. | |
86 | In that case, it is the copied input-operand vector. */ | |
87 | rtvec copy_asm_operands_vector; | |
88 | /* Likewise, this is the copied constraints vector. */ | |
89 | rtvec copy_asm_constraints_vector; | |
90 | ||
91 | /* The next few fields are used for subst_constants to record the SETs | |
92 | that it saw. */ | |
93 | int num_sets; | |
94 | struct equiv_table | |
95 | { | |
96 | rtx dest; | |
97 | rtx equiv; | |
98 | } equiv_sets[MAX_RECOG_OPERANDS]; | |
99 | /* Record the last thing assigned to pc. This is used for folded | |
100 | conditional branch insns. */ | |
101 | rtx last_pc_value; | |
102 | #ifdef HAVE_cc0 | |
103 | /* Record the last thing assigned to cc0. */ | |
104 | rtx last_cc0_value; | |
105 | #endif | |
106 | }; | |
107 | ||
108 | /* Return a copy of an rtx (as needed), substituting pseudo-register, | |
109 | labels, and frame-pointer offsets as necessary. */ | |
110 | extern rtx copy_rtx_and_substitute (); | |
111 | ||
112 | extern void try_constants (); | |
113 | ||
114 | extern void mark_stores (); | |
115 | ||
116 | /* We do some simple constant folding optimization. This optimization | |
117 | really exists primarily to save time inlining a function. It | |
118 | also helps users who ask for inline functions without -O. */ | |
119 | extern rtx try_fold_condition (); | |
120 | ||
121 | extern rtx *global_const_equiv_map; |