Commit 06bfa9ab authored by Michael Beck's avatar Michael Beck
Browse files

param_weight and param_access must be flexible arrays

clean up a bit

[r6870]
parent 0f2cd506
......@@ -372,7 +372,7 @@ static void analyze_method_params_weight(entity *ent)
if (nparams <= 0)
return;
ent->param_weight = malloc(sizeof(float) * nparams);
ent->param_weight = NEW_ARR_F(float, nparams);
irg = get_entity_irg(ent);
/* First we initialize the parameter weight with 0. */
......@@ -396,9 +396,11 @@ static void analyze_method_params_weight(entity *ent)
ent->param_weight[proj_nr] += calc_method_param_weight(arg);
}
#if 0
printf("\n%s:\n", get_entity_name(ent));
for (i = nparams - 1; i >= 0; --i)
printf("The weight of argument %i is %f \n", i, ent->param_weight[i]);
#endif
}
/*
......
......@@ -107,17 +107,25 @@ new_rd_entity (dbg_info *db, type *owner, ident *name, type *type)
else
res->allocation = allocation_automatic;
res->visibility = visibility_local;
res->visibility = visibility_local;
res->volatility = volatility_non_volatile;
res->stickyness = stickyness_unsticky;
res->offset = -1;
res->peculiarity = peculiarity_existent;
res->link = NULL;
if (is_Method_type(type)) {
symconst_symbol sym;
sym.entity_p = res;
res->variability = variability_constant;
rem = current_ir_graph;
current_ir_graph = get_const_code_irg();
res->value = new_SymConst(sym, symconst_addr_ent);
current_ir_graph = rem;
res->irg_add_properties = 0;
sym.entity_p = res;
rem = current_ir_graph;
current_ir_graph = get_const_code_irg();
res->value = new_SymConst(sym, symconst_addr_ent);
current_ir_graph = rem;
res->variability = variability_constant;
res->irg_add_properties = irg_no_property;
res->param_access = NULL;
res->param_weight = NULL;
}
else {
res->variability = variability_uninitialized;
......@@ -126,12 +134,6 @@ new_rd_entity (dbg_info *db, type *owner, ident *name, type *type)
res->val_paths = NULL;
}
res->volatility = volatility_non_volatile;
res->stickyness = stickyness_unsticky;
res->offset = -1;
res->link = NULL;
res->peculiarity = peculiarity_existent;
if (is_Class_type(owner)) {
res->overwrites = NEW_ARR_F(entity *, 0);
res->overwrittenby = NEW_ARR_F(entity *, 0);
......@@ -192,6 +194,15 @@ static void free_entity_attrs(entity *ent) {
}
ent->val_paths = NULL;
ent->values = NULL;
if (ent->param_access) {
DEL_ARR_F(ent->param_access);
ent->param_access = NULL;
}
if (ent->param_weight) {
DEL_ARR_F(ent->param_weight);
ent->param_weight;
}
}
entity *
......@@ -270,11 +281,6 @@ ident *
return get_entity_ident(ent);
}
/*
void set_entitye_ld_name (entity *, char *ld_name);
void set_entity_ld_ident (entity *, ident *ld_ident);
*/
type *
(get_entity_owner)(entity *ent) {
return _get_entity_owner(ent);
......@@ -389,7 +395,7 @@ set_entity_variability (entity *ent, ent_variability var)
if ((is_compound_type(ent->type)) &&
(ent->variability == variability_uninitialized) && (var != variability_uninitialized)) {
/* Allocate datastructures for constant values */
/* Allocate data structures for constant values */
ent->values = NEW_ARR_F(ir_node *, 0);
ent->val_paths = NEW_ARR_F(compound_graph_path *, 0);
}
......@@ -401,7 +407,7 @@ set_entity_variability (entity *ent, ent_variability var)
if ((is_compound_type(ent->type)) &&
(var == variability_uninitialized) && (ent->variability != variability_uninitialized)) {
/* Free datastructures for constant values */
/* Free data structures for constant values */
DEL_ARR_F(ent->values); ent->values = NULL;
DEL_ARR_F(ent->val_paths); ent->val_paths = NULL;
}
......
Supports Markdown
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