1 /* { dg-do compile } */
2 /* { dg-options "-O2 -w" } */
4 /* This file was automatically reduced from tree-ssa-operands.c. It
5 contains many warnings, but it exposes a copy propagation bug that
6 is somewhat difficult to reproduce otherwise. */
8 typedef long unsigned int size_t;
9 extern void fancy_abort (const char *, int, const char *) __attribute__ ((__noreturn__
));
10 typedef union tree_node
*tree
;
12 TREE_LIST
, ARRAY_TYPE
, RECORD_TYPE
, UNION_TYPE
, QUAL_UNION_TYPE
, STRING_CST
, LT_EXPR
, GE_EXPR
, LABEL_EXPR
, ASM_EXPR
, SSA_NAME
, };
13 enum tree_code_class
{
14 tcc_type
, tcc_reference
, tcc_expression
};
15 extern const enum tree_code_class tree_code_type
[];
16 extern const unsigned char tree_code_length
[];
18 union tree_ann_d
*ann
;
19 __extension__
enum tree_code code
: 8;
31 typedef struct ssa_use_operand_d
{
32 struct ssa_use_operand_d
* prev
;
33 struct ssa_use_operand_d
* next
;
38 struct tree_ssa_name
{
39 struct ssa_use_operand_d imm_uses
;
42 struct tree_common common
;
43 struct tree_string string
;
44 struct tree_list list
;
46 struct tree_ssa_name ssa_name
;
48 typedef struct bitmap_head_def
*bitmap
;
49 typedef union varray_data_tag
{
55 struct varray_head_tag
{
60 typedef struct varray_head_tag
*varray_type
;
61 extern void varray_check_failed (varray_type
, size_t, const char *, int, const char *) __attribute__ ((__noreturn__
));
62 typedef ssa_use_operand_t
*use_operand_p
;
64 struct use_optype_d
*next
;
65 struct ssa_use_operand_d use_ptr
;
67 typedef struct use_optype_d
*use_optype_p
;
68 struct ssa_operand_memory_d
{
69 char mem
[(2048 - sizeof (void *))];
71 struct stmt_operands_d
{
72 struct use_optype_d
* use_ops
;
77 typedef struct subvar
*subvar_t
;
82 unsigned modified
: 1;
83 struct stmt_operands_d operands
;
84 bitmap addresses_taken
;
86 typedef struct var_ann_d
*var_ann_t
;
87 typedef struct stmt_ann_d
*stmt_ann_t
;
88 static __inline__ var_ann_t
var_ann (tree t
) {
90 static __inline__ stmt_ann_t
stmt_ann (tree t
) {
91 ((void)(!(is_gimple_stmt (t
)) ? fancy_abort ("/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-flow-inline.h", 55, __FUNCTION__
), 0 : 0));
92 return (stmt_ann_t
) t
->common
.ann
;
94 static __inline__
unsigned char stmt_modified_p (tree t
) {
95 stmt_ann_t ann
= stmt_ann (t
);
96 return ann
? ann
->modified
: 1;
98 static __inline__
void delink_imm_use (ssa_use_operand_t
*linknode
) {
99 if (linknode
->prev
== ((void *)0)) return;
100 linknode
->prev
->next
= linknode
->next
;
101 linknode
->next
->prev
= linknode
->prev
;
102 linknode
->prev
= ((void *)0);
103 linknode
->next
= ((void *)0);
105 static __inline__
void link_imm_use_to_list (ssa_use_operand_t
*linknode
, ssa_use_operand_t
*list
) {
106 linknode
->prev
= list
;
107 linknode
->next
= list
->next
;
108 list
->next
= linknode
;
110 static __inline__
void link_imm_use (ssa_use_operand_t
*linknode
, tree def
) {
111 ssa_use_operand_t
*root
;
112 if (!def
|| ((enum tree_code
) (def
)->common
.code
) != SSA_NAME
) linknode
->prev
= ((void *)0);
114 root
= &(__extension__ ({ const tree __t
= (def
); if (((enum tree_code
) (__t
)->common
.code
) != (SSA_NAME
)) tree_check_failed (__t
, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-flow-inline.h", 222, __FUNCTION__
, (SSA_NAME
), 0); __t
; }
115 )->ssa_name
.imm_uses
);
116 link_imm_use_to_list (linknode
, root
);
119 static __inline__
void link_imm_use_stmt (ssa_use_operand_t
*linknode
, tree def
, tree stmt
) {
120 link_imm_use (linknode
, def
);
122 struct ggc_root_tab
{
124 struct opbuild_list_d
{
131 static struct opbuild_list_d build_uses
;
132 static struct opbuild_list_d build_v_may_defs
;
133 static struct ssa_operand_memory_d
*operand_memory
= ((void *)0);
134 static unsigned operand_memory_index
;
135 static use_optype_p free_uses
= ((void *)0);
136 static __inline__
int opbuild_next (struct opbuild_list_d
*list
, int prev
) {
137 return __extension__ (*({
138 varray_type
const _va
= (list
->next
);
139 const size_t _n
= (prev
);
140 if (_n
>= _va
->num_elements
) varray_check_failed (_va
, _n
, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 323, __FUNCTION__
);
145 static __inline__ tree
* opbuild_elem_real (struct opbuild_list_d
*list
, int elem
) {
146 return __extension__ (*({
147 varray_type
const _va
= (list
->vars
);
148 const size_t _n
= (elem
);
149 if (_n
>= _va
->num_elements
) varray_check_failed (_va
, _n
, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 332, __FUNCTION__
);
154 static __inline__
void opbuild_clear (struct opbuild_list_d
*list
) {
155 ((list
->vars
)->elements_used
= 0);
156 ((list
->next
)->elements_used
= 0);
158 static __inline__
void * ssa_operand_alloc (unsigned size
) {
160 if (operand_memory_index
+ size
>= (2048 - sizeof (void *))) {
161 ptr
= ggc_alloc_stat (sizeof (struct ssa_operand_memory_d
) );
163 ptr
= &(operand_memory
->mem
[operand_memory_index
]);
166 static __inline__
void correct_use_link (use_operand_p ptr
, tree stmt
) {
171 unsigned char stmt_mod
= 1;
172 while (stmt_mod
) { while (prev
->stmt
== stmt
|| prev
->stmt
== ((void *)0)) prev
= prev
->prev
; if (prev
->use
== ((void *)0)) stmt_mod
= 0; else if ((stmt_mod
= stmt_modified_p (prev
->stmt
))) prev
= prev
->prev
; }
173 if (prev
->use
== ((void *)0)) root
= prev
->stmt
;
174 else root
= *(prev
->use
);
175 if (root
== *(ptr
->use
)) return;
177 delink_imm_use (ptr
);
178 link_imm_use (ptr
, *(ptr
->use
));
180 static __inline__
struct use_optype_d
* alloc_use (void) {
181 struct use_optype_d
*ret
;
183 free_uses
= free_uses
->next
;
185 ret
= (struct use_optype_d
*)ssa_operand_alloc (sizeof (struct use_optype_d
));
188 static __inline__
void finalize_ssa_use_ops (tree stmt
) {
190 struct use_optype_d
*old_ops
, *ptr
, *last
;
192 struct use_optype_d new_list
;
194 if (old_ops
) old_base
= ((old_ops
)->use_ptr
.use
);
195 while (old_ops
&& new_i
!= -1) {
196 tree
* new_base
= opbuild_elem_real (&build_uses
, (new_i
));
197 if (old_base
== new_base
) { last
->next
= old_ops
; last
= old_ops
; correct_use_link ((&((last
)->use_ptr
)), stmt
); old_ops
= old_ops
->next
; new_i
= opbuild_next (&build_uses
, new_i
); }
198 else if (old_base
< new_base
) { use_operand_p use_p
= (&((old_ops
)->use_ptr
)); delink_imm_use (use_p
); old_ops
= old_ops
->next
; ptr
->next
= free_uses
; }
199 else { ptr
= alloc_use (); (ptr
)->use_ptr
.use
= (opbuild_elem_real (&build_uses
, (new_i
))); link_imm_use_stmt (&((ptr
)->use_ptr
), *(opbuild_elem_real (&build_uses
, (new_i
))), (stmt
)); new_i
= opbuild_next (&build_uses
, new_i
); }
200 if (old_ops
) old_base
= ((old_ops
)->use_ptr
.use
);
204 new_i
= opbuild_next (&build_uses
, new_i
)) {
206 (ptr
)->use_ptr
.use
= (opbuild_elem_real (&build_uses
, (new_i
)));
207 link_imm_use_stmt (&((ptr
)->use_ptr
), *(opbuild_elem_real (&build_uses
, (new_i
))), (stmt
));
210 { use_operand_p use_p
= (&((ptr
)->use_ptr
)); delink_imm_use (use_p
); }
212 (stmt_ann (stmt
)->operands
.use_ops
) = new_list
.next
;
215 for (ptr
= (stmt_ann (stmt
)->operands
.use_ops
);
217 ptr
= ptr
->next
) x
++;
220 finalize_ssa_uses (tree stmt
) {
223 ((void)(!(*(opbuild_elem_real (&build_uses
, x
)) != stmt
) ? fancy_abort ("/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 581, __FUNCTION__
), 0 : 0));
225 finalize_ssa_use_ops (stmt
);
226 opbuild_clear (&build_uses
);
228 finalize_ssa_v_may_def_ops (tree stmt
) {
234 new_i
= opbuild_next (&build_v_may_defs
, new_i
)) {
239 get_expr_operands (tree stmt
, tree
*expr_p
, int flags
) {
243 { subvar_t svars
; if (var_can_have_subvars (expr
) && (svars
= get_subvars_for_var (expr
))) { } { } }
244 { { if (code
== LT_EXPR
|| code
== GE_EXPR
) { swap_tree_operands (stmt
, &__extension__ (*({const tree __t
= __extension__ ({ const tree __t
= (expr
); char const __c
= tree_code_type
[(int) (((enum tree_code
) (__t
)->common
.code
))]; if (!((__c
) >= tcc_reference
&& (__c
) <= tcc_expression
)) tree_class_check_failed (__t
, tcc_expression
, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1435, __FUNCTION__
); __t
; }); const int __i
= (0); if (__i
< 0 || __i
>= tree_code_length
[(int) (((enum tree_code
) (__t
)->common
.code
))]) tree_operand_check_failed (__i
, ((enum tree_code
) (__t
)->common
.code
), "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1435, __FUNCTION__
); &__t
->exp
.operands
[__i
]; })), &__extension__ (*({const tree __t
= __extension__ ({ const tree __t
= (expr
); char const __c
= tree_code_type
[(int) (((enum tree_code
) (__t
)->common
.code
))]; if (!((__c
) >= tcc_reference
&& (__c
) <= tcc_expression
)) tree_class_check_failed (__t
, tcc_expression
, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1436, __FUNCTION__
); __t
; }); const int __i
= (1); if (__i
< 0 || __i
>= tree_code_length
[(int) (((enum tree_code
) (__t
)->common
.code
))]) tree_operand_check_failed (__i
, ((enum tree_code
) (__t
)->common
.code
), "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1436, __FUNCTION__
); &__t
->exp
.operands
[__i
]; }))); } { } } }
247 get_asm_expr_operands (tree stmt
) {
248 int noutputs
= list_length (__extension__ (*({
249 const tree __t
= __extension__ ({ const tree __t
= (__extension__ ({ const tree __t
= (stmt
); if (((enum tree_code
) (__t
)->common
.code
) != (ASM_EXPR
)) tree_check_failed (__t
, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1495, __FUNCTION__
, (ASM_EXPR
), 0); __t
; })); char const __c
= tree_code_type
[(int) (((enum tree_code
) (__t
)->common
.code
))]; if (!((__c
) >= tcc_reference
&& (__c
) <= tcc_expression
)) tree_class_check_failed (__t
, tcc_expression
, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1495, __FUNCTION__
); __t
; }
252 if (__i
< 0 || __i
>= tree_code_length
[(int) (((enum tree_code
) (__t
)->common
.code
))]) tree_operand_check_failed (__i
, ((enum tree_code
) (__t
)->common
.code
), "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1495, __FUNCTION__
);
253 &__t
->exp
.operands
[__i
];
256 const char **oconstraints
= (const char **) __builtin_alloca((noutputs
) * sizeof (const char *));
259 const char *constraint
;
260 unsigned char allows_mem
, allows_reg
, is_inout
;
262 oconstraints
[i
] = constraint
= ((const char *)(__extension__ ({ const tree __t
= ((__extension__ ({ const tree __t
= ((__extension__ ({ const tree __t
= (link
); if (((enum tree_code
) (__t
)->common
.code
) != (TREE_LIST
)) tree_check_failed (__t
, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1506, __FUNCTION__
, (TREE_LIST
), 0); __t
; })->list
.purpose
)); if (((enum tree_code
) (__t
)->common
.code
) != (TREE_LIST
)) tree_check_failed (__t
, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1506, __FUNCTION__
, (TREE_LIST
), 0); __t
; })->list
.value
)); if (((enum tree_code
) (__t
)->common
.code
) != (STRING_CST
)) tree_check_failed (__t
, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1506, __FUNCTION__
, (STRING_CST
), 0); __t
; }
264 parse_output_constraint (&constraint
, i
, 0, 0, &allows_mem
, &allows_reg
, &is_inout
);
267 get_indirect_ref_operands (tree stmt
, tree expr
, int flags
) {
268 tree
*pptr
= &__extension__ (*({
269 const tree __t
= __extension__ ({ const tree __t
= (expr
); char const __c
= tree_code_type
[(int) (((enum tree_code
) (__t
)->common
.code
))]; if (!((__c
) >= tcc_reference
&& (__c
) <= tcc_expression
)) tree_class_check_failed (__t
, tcc_expression
, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1591, __FUNCTION__
); __t
; }
272 if (__i
< 0 || __i
>= tree_code_length
[(int) (((enum tree_code
) (__t
)->common
.code
))]) tree_operand_check_failed (__i
, ((enum tree_code
) (__t
)->common
.code
), "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1591, __FUNCTION__
);
273 &__t
->exp
.operands
[__i
];
278 struct ptr_info_def
*pi
= ((void *)0);
279 if (((enum tree_code
) (ptr
)->common
.code
) == SSA_NAME
&& pi
->name_mem_tag
) { }
282 note_addressable (tree var
, stmt_ann_t s_ann
) {
285 if (var_can_have_subvars (var
) && (svars
= get_subvars_for_var (var
))) bitmap_set_bit (s_ann
->addresses_taken
, var_ann (var
)->uid
);
288 const struct ggc_root_tab gt_ggc_r_gt_tree_ssa_operands_h
[] = {