Commit 5ecbb181 authored by Michael Beck's avatar Michael Beck
Browse files

- preliminary steps to remove the value_param Proj

[r25245]
parent e686761d
......@@ -1530,11 +1530,10 @@ static void lower_frame_sels_walker(ir_node *irn, void *data)
ir_node *nw;
int pos = 0;
if (ptr == ctx->param_base) {
if (get_entity_owner(ent) == ctx->value_tp) {
ir_entity *argument_ent = get_entity_link(ent);
/* replace by its copy from the argument type */
assert(get_entity_owner(ent) == ctx->value_tp);
pos = get_struct_member_index(ctx->value_tp, ent);
if (argument_ent == NULL) {
......@@ -1567,7 +1566,7 @@ static void lower_frame_sels_walker(ir_node *irn, void *data)
exchange(irn, nw);
/* check, if it's a param sel and if have not seen this entity before */
if (ptr == ctx->param_base && get_entity_link(ent) == NULL) {
if (get_entity_owner(ent) == ctx->value_tp && get_entity_link(ent) == NULL) {
ent_pos_pair pair;
pair.ent = ent;
......
......@@ -2286,21 +2286,18 @@ static void lower_ASM(ir_node *asmn, ir_mode *mode, lower_env_t *env) {
* Translate a Sel node.
*/
static void lower_Sel(ir_node *sel, ir_mode *mode, lower_env_t *env) {
ir_node *ptr = get_Sel_ptr(sel);
(void)mode;
(void) mode;
/* we must only lower value parameter sels if we change the
/* we must only lower value parameter Sels if we change the
value parameter type. */
if (env->value_param_tp != NULL &&
ptr == get_irg_value_param_base(current_ir_graph)) {
if (env->value_param_tp != NULL) {
ir_entity *ent = get_Sel_entity(sel);
int pos = PTR_TO_INT(get_entity_link(ent));
if (get_entity_owner(ent) == env->value_param_tp) {
int pos = PTR_TO_INT(get_entity_link(ent));
assert(get_entity_owner(ent) == env->value_param_tp);
ent = get_method_value_param_ent(env->l_mtp, pos);
set_Sel_entity(sel, ent);
ent = get_method_value_param_ent(env->l_mtp, pos);
set_Sel_entity(sel, ent);
} /* if */
} /* if */
} /* lower_Sel */
......
......@@ -339,6 +339,7 @@ static void *ADDRESS_TAKEN = &_x;
static int find_possible_replacements(ir_graph *irg)
{
ir_node *irg_frame = get_irg_frame(irg);
ir_type *frame_tp;
int i, n;
int res = 0;
......@@ -347,19 +348,12 @@ static int find_possible_replacements(ir_graph *irg)
n = get_irn_n_outs(irg_frame);
/*
* First, clear the link field of all interestingentities.
* Note that we did not rely on the fact that there is only
* one Sel node per entity, so we might access one entity
* more than once here.
* That's why we have need two loops.
* First, clear the link field of all interesting entities.
*/
for (i = 0; i < n; ++i) {
ir_node *succ = get_irn_out(irg_frame, i);
if (is_Sel(succ)) {
ir_entity *ent = get_Sel_entity(succ);
set_entity_link(ent, NULL);
}
frame_tp = get_irg_frame_type(irg);
for (i = get_class_n_members(frame_tp) - 1; i >= 0; --i) {
ir_entity *ent = get_class_member(frame_tp, i);
set_entity_link(ent, NULL);
}
/*
......@@ -374,7 +368,12 @@ static int find_possible_replacements(ir_graph *irg)
ir_entity *ent = get_Sel_entity(succ);
ir_type *ent_type;
if (get_entity_link(ent) == ADDRESS_TAKEN)
/* we are only interested in entities on the frame, NOT
on the value type */
if (get_entity_owner(ent) != frame_tp)
continue;
if (get_entity_link(ent) == ADDRESS_TAKEN)
continue;
/*
......
......@@ -344,6 +344,11 @@ static int find_possible_replacements(ir_graph *irg) {
ir_entity *ent = get_Sel_entity(succ);
ir_type *ent_type;
/* we are only interested in entities on the frame, NOT
on the value type */
if (get_entity_owner(ent) != frame_tp)
continue;
if (get_entity_link(ent) == ADDRESS_TAKEN)
continue;
......
......@@ -419,11 +419,17 @@ static void do_opt_tail_rec(ir_graph *irg, tr_env *env) {
static int check_lifetime_of_locals(ir_graph *irg) {
ir_node *irg_frame, *irg_val_param_base;
int i;
ir_type *frame_tp = get_irg_frame_type(irg);
irg_frame = get_irg_frame(irg);
for (i = get_irn_n_outs(irg_frame) - 1; i >= 0; --i) {
ir_node *succ = get_irn_out(irg_frame, i);
/* we are only interested in entities on the frame type
* (locals), not on the value type */
if (get_entity_owner(get_Sel_entity(succ)) != frame_tp)
continue;
if (is_Sel(succ) && is_address_taken(succ))
return 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment