1 /* Definitions for code generation pass of GNU compiler.
2 Copyright (C) 1987-2015 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
23 /* This is the 4th arg to `expand_expr'.
24 EXPAND_STACK_PARM means we are possibly expanding a call param onto
26 EXPAND_SUM means it is ok to return a PLUS rtx or MULT rtx.
27 EXPAND_INITIALIZER is similar but also record any labels on forced_labels.
28 EXPAND_CONST_ADDRESS means it is ok to return a MEM whose address
29 is a constant that is not a legitimate address.
30 EXPAND_WRITE means we are only going to write to the resulting rtx.
31 EXPAND_MEMORY means we are interested in a memory result, even if
32 the memory is constant and we could have propagated a constant value,
33 or the memory is unaligned on a STRICT_ALIGNMENT target. */
34 enum expand_modifier
{EXPAND_NORMAL
= 0, EXPAND_STACK_PARM
, EXPAND_SUM
,
35 EXPAND_CONST_ADDRESS
, EXPAND_INITIALIZER
, EXPAND_WRITE
,
38 /* Prevent the compiler from deferring stack pops. See
39 inhibit_defer_pop for more information. */
40 #define NO_DEFER_POP (inhibit_defer_pop += 1)
42 /* Allow the compiler to defer stack pops. See inhibit_defer_pop for
44 #define OK_DEFER_POP (inhibit_defer_pop -= 1)
46 /* This structure is used to pass around information about exploded
47 unary, binary and trinary expressions between expand_expr_real_1 and
49 typedef struct separate_ops
57 /* This is run during target initialization to set up which modes can be
58 used directly in memory and to initialize the block move optab. */
59 extern void init_expr_target (void);
61 /* This is run at the start of compiling a function. */
62 extern void init_expr (void);
64 /* Emit some rtl insns to move data between rtx's, converting machine modes.
65 Both modes must be floating or both fixed. */
66 extern void convert_move (rtx
, rtx
, int);
68 /* Convert an rtx to specified machine mode and return the result. */
69 extern rtx
convert_to_mode (machine_mode
, rtx
, int);
71 /* Convert an rtx to MODE from OLDMODE and return the result. */
72 extern rtx
convert_modes (machine_mode
, machine_mode
, rtx
, int);
74 /* Emit code to move a block Y to a block X. */
81 /* Like BLOCK_OP_NORMAL, but the libcall can be tail call optimized. */
85 extern GTY(()) tree block_clear_fn
;
86 extern void init_block_move_fn (const char *);
87 extern void init_block_clear_fn (const char *);
89 extern rtx
emit_block_move (rtx
, rtx
, rtx
, enum block_op_methods
);
90 extern rtx
emit_block_move_via_libcall (rtx
, rtx
, rtx
, bool);
91 extern rtx
emit_block_move_hints (rtx
, rtx
, rtx
, enum block_op_methods
,
92 unsigned int, HOST_WIDE_INT
,
93 unsigned HOST_WIDE_INT
,
94 unsigned HOST_WIDE_INT
,
95 unsigned HOST_WIDE_INT
);
96 extern bool emit_storent_insn (rtx to
, rtx from
);
98 /* Copy all or part of a value X into registers starting at REGNO.
99 The number of registers to be filled is NREGS. */
100 extern void move_block_to_reg (int, rtx
, int, machine_mode
);
102 /* Copy all or part of a BLKmode value X out of registers starting at REGNO.
103 The number of registers to be filled is NREGS. */
104 extern void move_block_from_reg (int, rtx
, int);
106 /* Generate a non-consecutive group of registers represented by a PARALLEL. */
107 extern rtx
gen_group_rtx (rtx
);
109 /* Load a BLKmode value into non-consecutive registers represented by a
111 extern void emit_group_load (rtx
, rtx
, tree
, int);
113 /* Similarly, but load into new temporaries. */
114 extern rtx
emit_group_load_into_temps (rtx
, rtx
, tree
, int);
116 /* Move a non-consecutive group of registers represented by a PARALLEL into
117 a non-consecutive group of registers represented by a PARALLEL. */
118 extern void emit_group_move (rtx
, rtx
);
120 /* Move a group of registers represented by a PARALLEL into pseudos. */
121 extern rtx
emit_group_move_into_temps (rtx
);
123 /* Store a BLKmode value from non-consecutive registers represented by a
125 extern void emit_group_store (rtx
, rtx
, tree
, int);
127 extern rtx
maybe_emit_group_store (rtx
, tree
);
129 /* Copy BLKmode object from a set of registers. */
130 extern void copy_blkmode_from_reg (rtx
, rtx
, tree
);
132 /* Mark REG as holding a parameter for the next CALL_INSN.
133 Mode is TYPE_MODE of the non-promoted parameter, or VOIDmode. */
134 extern void use_reg_mode (rtx
*, rtx
, machine_mode
);
135 extern void clobber_reg_mode (rtx
*, rtx
, machine_mode
);
137 extern rtx
copy_blkmode_to_reg (machine_mode
, tree
);
139 /* Mark REG as holding a parameter for the next CALL_INSN. */
141 use_reg (rtx
*fusage
, rtx reg
)
143 use_reg_mode (fusage
, reg
, VOIDmode
);
146 /* Mark REG as clobbered by the call with FUSAGE as CALL_INSN_FUNCTION_USAGE. */
148 clobber_reg (rtx
*fusage
, rtx reg
)
150 clobber_reg_mode (fusage
, reg
, VOIDmode
);
153 /* Mark NREGS consecutive regs, starting at REGNO, as holding parameters
154 for the next CALL_INSN. */
155 extern void use_regs (rtx
*, int, int);
157 /* Mark a PARALLEL as holding a parameter for the next CALL_INSN. */
158 extern void use_group_regs (rtx
*, rtx
);
160 /* Write zeros through the storage of OBJECT.
161 If OBJECT has BLKmode, SIZE is its length in bytes. */
162 extern rtx
clear_storage (rtx
, rtx
, enum block_op_methods
);
163 extern rtx
clear_storage_hints (rtx
, rtx
, enum block_op_methods
,
164 unsigned int, HOST_WIDE_INT
,
165 unsigned HOST_WIDE_INT
,
166 unsigned HOST_WIDE_INT
,
167 unsigned HOST_WIDE_INT
);
168 /* The same, but always output an library call. */
169 rtx
set_storage_via_libcall (rtx
, rtx
, rtx
, bool);
171 /* Expand a setmem pattern; return true if successful. */
172 extern bool set_storage_via_setmem (rtx
, rtx
, rtx
, unsigned int,
173 unsigned int, HOST_WIDE_INT
,
174 unsigned HOST_WIDE_INT
,
175 unsigned HOST_WIDE_INT
,
176 unsigned HOST_WIDE_INT
);
178 extern unsigned HOST_WIDE_INT
move_by_pieces_ninsns (unsigned HOST_WIDE_INT
,
182 /* Return nonzero if it is desirable to store LEN bytes generated by
183 CONSTFUN with several move instructions by store_by_pieces
184 function. CONSTFUNDATA is a pointer which will be passed as argument
185 in every CONSTFUN call.
186 ALIGN is maximum alignment we can assume.
187 MEMSETP is true if this is a real memset/bzero, not a copy
188 of a const string. */
189 extern int can_store_by_pieces (unsigned HOST_WIDE_INT
,
190 rtx (*) (void *, HOST_WIDE_INT
,
192 void *, unsigned int, bool);
194 /* Generate several move instructions to store LEN bytes generated by
195 CONSTFUN to block TO. (A MEM rtx with BLKmode). CONSTFUNDATA is a
196 pointer which will be passed as argument in every CONSTFUN call.
197 ALIGN is maximum alignment we can assume.
198 MEMSETP is true if this is a real memset/bzero, not a copy.
200 extern rtx
store_by_pieces (rtx
, unsigned HOST_WIDE_INT
,
201 rtx (*) (void *, HOST_WIDE_INT
, machine_mode
),
202 void *, unsigned int, bool, int);
204 /* Emit insns to set X from Y. */
205 extern rtx_insn
*emit_move_insn (rtx
, rtx
);
206 extern rtx_insn
*gen_move_insn (rtx
, rtx
);
207 extern rtx
gen_move_insn_uncast (rtx
, rtx
);
209 /* Emit insns to set X from Y, with no frills. */
210 extern rtx_insn
*emit_move_insn_1 (rtx
, rtx
);
212 extern rtx_insn
*emit_move_complex_push (machine_mode
, rtx
, rtx
);
213 extern rtx_insn
*emit_move_complex_parts (rtx
, rtx
);
214 extern void write_complex_part (rtx
, rtx
, bool);
215 extern rtx
emit_move_resolve_push (machine_mode
, rtx
);
217 /* Push a block of length SIZE (perhaps variable)
218 and return an rtx to address the beginning of the block. */
219 extern rtx
push_block (rtx
, int, int);
221 /* Generate code to push something onto the stack, given its mode and type. */
222 extern bool emit_push_insn (rtx
, machine_mode
, tree
, rtx
, unsigned int,
223 int, rtx
, int, rtx
, rtx
, int, rtx
, bool);
225 /* Expand an assignment that stores the value of FROM into TO. */
226 extern void expand_assignment (tree
, tree
, bool);
228 /* Generate code for computing expression EXP,
229 and storing the value into TARGET.
230 If SUGGEST_REG is nonzero, copy the value through a register
231 and return that register, if that is possible. */
232 extern rtx
store_expr_with_bounds (tree
, rtx
, int, bool, tree
);
233 extern rtx
store_expr (tree
, rtx
, int, bool);
235 /* Given an rtx that may include add and multiply operations,
236 generate them as insns and return a pseudo-reg containing the value.
237 Useful after calling expand_expr with 1 as sum_ok. */
238 extern rtx
force_operand (rtx
, rtx
);
240 /* Work horses for expand_expr. */
241 extern rtx
expand_expr_real (tree
, rtx
, machine_mode
,
242 enum expand_modifier
, rtx
*, bool);
243 extern rtx
expand_expr_real_1 (tree
, rtx
, machine_mode
,
244 enum expand_modifier
, rtx
*, bool);
245 extern rtx
expand_expr_real_2 (sepops
, rtx
, machine_mode
,
246 enum expand_modifier
);
248 /* Generate code for computing expression EXP.
249 An rtx for the computed value is returned. The value is never null.
250 In the case of a void EXP, const0_rtx is returned. */
252 expand_expr (tree exp
, rtx target
, machine_mode mode
,
253 enum expand_modifier modifier
)
255 return expand_expr_real (exp
, target
, mode
, modifier
, NULL
, false);
259 expand_normal (tree exp
)
261 return expand_expr_real (exp
, NULL_RTX
, VOIDmode
, EXPAND_NORMAL
, NULL
, false);
265 /* Return the tree node and offset if a given argument corresponds to
266 a string constant. */
267 extern tree
string_constant (tree
, tree
*);
269 /* Two different ways of generating switch statements. */
270 extern int try_casesi (tree
, tree
, tree
, tree
, rtx
, rtx
, rtx
, int);
271 extern int try_tablejump (tree
, tree
, tree
, tree
, rtx
, rtx
, int);
273 extern int safe_from_p (const_rtx
, tree
, int);
275 /* Get the personality libfunc for a function decl. */
276 rtx
get_personality_function (tree
);
278 /* Determine whether the LEN bytes can be moved by using several move
279 instructions. Return nonzero if a call to move_by_pieces should
281 extern int can_move_by_pieces (unsigned HOST_WIDE_INT
, unsigned int);
283 extern unsigned HOST_WIDE_INT
highest_pow2_factor (const_tree
);
284 bool array_at_struct_end_p (tree
);
286 /* Return a tree of sizetype representing the size, in bytes, of the element
287 of EXP, an ARRAY_REF or an ARRAY_RANGE_REF. */
288 extern tree
array_ref_element_size (tree
);
290 extern bool categorize_ctor_elements (const_tree
, HOST_WIDE_INT
*,
291 HOST_WIDE_INT
*, bool *);
293 /* Return a tree representing the offset, in bytes, of the field referenced
294 by EXP. This does not include any offset in DECL_FIELD_BIT_OFFSET. */
295 extern tree
component_ref_field_offset (tree
);
297 extern void expand_operands (tree
, tree
, rtx
, rtx
*, rtx
*,
298 enum expand_modifier
);
300 /* rtl.h and tree.h were included. */
301 /* Return an rtx for the size in bytes of the value of an expr. */
302 extern rtx
expr_size (tree
);
304 #endif /* GCC_EXPR_H */