1 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-rtl-expand-details" } */
5 typedef long unsigned int size_t;
7 typedef union tree_node
*tree
;
8 union gimple_statement_d
;
9 typedef union gimple_statement_d
*gimple
;
10 typedef const union tree_node
*const_tree
;
11 typedef const union gimple_statement_d
*const_gimple
;
13 typedef struct gimple_seq_d
*gimple_seq
;
15 typedef struct edge_def
*edge
;
16 struct basic_block_def
;
17 typedef struct basic_block_def
*basic_block
;
18 typedef const struct basic_block_def
*const_basic_block
;
23 typedef struct ssa_use_operand_d
29 struct ssa_use_operand_d imm_use
;
38 extern struct function
*cfun
;
41 unsigned int dest_idx
;
43 static __inline__
void
44 VEC_edge_must_be_pointer_type (void)
46 (void) ((edge
) 1 == (void *) 1);
47 } typedef struct VEC_edge_base
54 typedef struct VEC_edge_none
59 static __inline__ edge
60 VEC_edge_base_index (const VEC_edge_base
* vec_
, unsigned ix_
,
61 const char *file_
, unsigned line_
, const char *function_
)
63 return vec_
->vec
[ix_
];
66 typedef struct VEC_edge_gc
70 struct basic_block_def
74 static __inline__ edge
75 single_succ_edge (const_basic_block bb
)
77 return (VEC_edge_base_index
78 ((((bb
)->succs
) ? &((bb
)->succs
)->base
: 0), (0),
79 "/home/gcc/virgin-gcc/gcc/basic-block.h", 563, __FUNCTION__
));
82 edge
find_edge (basic_block
, basic_block
);
83 typedef tree
*def_operand_p
;
84 typedef ssa_use_operand_t
*use_operand_p
;
85 struct gimple_seq_node_d
;
86 typedef struct gimple_seq_node_d
*gimple_seq_node
;
87 struct gimple_seq_node_d
96 } gimple_stmt_iterator
;
97 struct gimple_statement_phi
99 struct phi_arg_d args
[1];
101 union gimple_statement_d
103 struct gimple_statement_phi gimple_phi
;
105 extern size_t const gimple_ops_offset_
[];
106 int gimple_statement_structure (gimple
);
107 static __inline__ tree
*
108 gimple_ops (gimple gs
)
111 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
112 return (tree
*) ((char *) gs
+ off
);
115 static __inline__ tree
116 gimple_op (const_gimple gs
, unsigned i
)
118 return gimple_ops ((((union
120 const union gimple_statement_d
* _q
;
121 union gimple_statement_d
* _nq
;}) (((gs
))))._nq
))[i
];
124 static __inline__
struct phi_arg_d
*
125 gimple_phi_arg (gimple gs
, unsigned index
)
127 return &(gs
->gimple_phi
.args
[index
]);
130 static __inline__ tree
131 gimple_switch_label (const_gimple gs
, unsigned index
)
133 return gimple_op (gs
, index
+ 1);
136 gimple_stmt_iterator
gsi_start_phis (basic_block
);
137 extern basic_block
label_to_block_fn (struct function
*, tree
);
139 static __inline__ tree
140 get_use_from_ptr (use_operand_p use
)
145 static __inline__ use_operand_p
146 gimple_phi_arg_imm_use_ptr (gimple gs
, int i
)
148 return &gimple_phi_arg (gs
, i
)->imm_use
;
151 struct switch_conv_info
153 basic_block final_bb
;
154 basic_block switch_bb
;
156 tree
*default_values
;
158 static struct switch_conv_info info
;
159 void gsi_next (gimple_stmt_iterator
*);
160 int gsi_gsi_start_phis (basic_block
);
163 gather_default_values (tree default_case
)
165 gimple_stmt_iterator gsi
;
167 (label_to_block_fn ((cfun
+ 0), default_case
->exp
.operands
[2]));
170 if (bb
== info
.final_bb
)
171 e
= find_edge (info
.switch_bb
, bb
);
173 e
= single_succ_edge (bb
);
174 for (gsi
= gsi_start_phis (info
.final_bb
);
175 gsi_gsi_start_phis (info
.final_bb
); gsi_next (&gsi
))
177 gimple phi
= gsi
.ptr
->stmt
;
178 tree val
= get_use_from_ptr (gimple_phi_arg_imm_use_ptr
179 ((((phi
))), (((e
)->dest_idx
))));
180 info
.default_values
[i
++] = val
;
184 unsigned int gimple_switch_num_labels (gimple
);
187 process_switch (gimple swtch
)
189 unsigned int i
, branch_num
= gimple_switch_num_labels (swtch
);
191 info
.reason
= "switch has no labels\n";
192 gather_default_values (gimple_switch_label (swtch
, 0));
195 /* Verify that out-of-ssa coalescing did its job by verifying there are not
196 any partition copies inserted. */
198 /* { dg-final { scan-rtl-dump-not "partition copy" "expand"} } */