* - res_type: A list with the types of parameters. This list is ordered.
* The nth type in this list corresponds to the nth input to
* Return nodes. (See ircons.h for more information.)
- *
- * - value_res_ents
- * A list of entities (whose owner is a struct private to the
- * method type) that represent results passed by value.
*/
/* These macros define the suffixes for the types and entities used
Also changes the type in the pass-by-value representation by just
changing the type of the corresponding entity if the representation is constructed. */
FIRM_API void set_method_res_type(ir_type *method, size_t pos, ir_type *tp);
-/** Returns an entity that represents the copied value result. Only necessary
- for compounds passed by value. This information is constructed only on demand. */
-FIRM_API ir_entity *get_method_value_res_ent(ir_type *method, size_t pos);
-
-/**
- * Returns a type that represents the copied value results.
- */
-FIRM_API ir_type *get_method_value_res_type(const ir_type *method);
/**
* This enum flags the variadicity of methods (methods with a
case pn_Call_X_regular:
case pn_Call_X_except:
case pn_Call_T_result:
- case pn_Call_P_value_res_base:
case pn_Call_max:
break;
}
break;
case pn_Call_X_except:
- case pn_Call_P_value_res_base:
/* should not happen here */
edges_reroute(proj, bad, irg);
break;
set_Tuple_pred(call, pn_Call_X_regular, jmp);
set_Tuple_pred(call, pn_Call_X_except, bad);
set_Tuple_pred(call, pn_Call_T_result, res);
- set_Tuple_pred(call, pn_Call_P_value_res_base, bad);
}
}
case pn_Call_X_regular:
case pn_Call_X_except:
case pn_Call_T_result:
- case pn_Call_P_value_res_base:
case pn_Call_max:
break;
}
X(X_regular),
X(X_except),
X(T_result),
- X(P_value_res_base)
#undef X
};
(proj == pn_Call_M && mode == mode_M) ||
(proj == pn_Call_X_regular && mode == mode_X) ||
(proj == pn_Call_X_except && mode == mode_X) ||
- (proj == pn_Call_T_result && mode == mode_T) ||
- (proj == pn_Call_P_value_res_base && mode_is_reference(mode))
+ (proj == pn_Call_T_result && mode == mode_T)
),
"wrong Proj from Call", 0,
show_proj_failure(p);
if (env->params->flags & LF_COMPOUND_RETURN) {
/* check for compound returns */
ir_node *src = get_CopyB_src(n);
- /* older scheme using value_res_ent */
- if (is_Sel(src)) {
- ir_node *proj = get_Sel_ptr(src);
- if (is_Proj(proj) && get_Proj_proj(proj) == pn_Call_P_value_res_base) {
+ if (is_Proj(src)) {
+ ir_node *proj = get_Proj_pred(src);
+ if (is_Proj(proj) && get_Proj_proj(proj) == pn_Call_T_result) {
ir_node *call = get_Proj_pred(proj);
if (is_Call(call)) {
- /* found a CopyB from compound Call result */
- cl_entry *e = get_Call_entry(call, env);
- set_irn_link(n, e->copyb);
- e->copyb = n;
- }
- }
- } else {
- /* new scheme: compound results are determined by the call type only */
- if (is_Proj(src)) {
- ir_node *proj = get_Proj_pred(src);
- if (is_Proj(proj) && get_Proj_proj(proj) == pn_Call_T_result) {
- ir_node *call = get_Proj_pred(proj);
- if (is_Call(call)) {
- ctp = get_Call_type(call);
- if (is_compound_type(get_method_res_type(ctp, get_Proj_proj(src)))) {
- /* found a CopyB from compound Call result */
- cl_entry *e = get_Call_entry(call, env);
- set_irn_link(n, e->copyb);
- e->copyb = n;
- }
+ ctp = get_Call_type(call);
+ if (is_compound_type(get_method_res_type(ctp, get_Proj_proj(src)))) {
+ /* found a CopyB from compound Call result */
+ cl_entry *e = get_Call_entry(call, env);
+ set_irn_link(n, e->copyb);
+ e->copyb = n;
}
}
}
*/
static void add_hidden_param(ir_graph *irg, size_t n_com, ir_node **ins, cl_entry *entry, wlk_env *env)
{
- ir_node *p, *n, *src, *mem, *blk;
- ir_entity *ent;
- ir_type *owner;
+ ir_node *p, *n, *mem, *blk;
size_t n_args;
n_args = 0;
for (p = entry->copyb; p; p = n) {
- size_t idx;
- n = (ir_node*)get_irn_link(p);
- src = get_CopyB_src(p);
-
- /* old scheme using value_res_ent */
- if (is_Sel(src)) {
- ent = get_Sel_entity(src);
- owner = get_entity_owner(ent);
-
- /* find the hidden parameter index */
- for (idx = 0; idx < get_struct_n_members(owner); ++idx)
- if (get_struct_member(owner, idx) == ent)
- break;
- assert(idx < get_struct_n_members(owner));
- } else {
- /* new scheme: compound returns are determined by the call type and are Proj's */
- idx = get_Proj_proj(src);
- }
+ ir_node *src = get_CopyB_src(p);
+ size_t idx = get_Proj_proj(src);
+ n = (ir_node*)get_irn_link(p);
ins[idx] = get_CopyB_dst(p);
mem = get_CopyB_mem(p);
set_Tuple_pred(call, pn_Call_X_regular, reg_jmp);
set_Tuple_pred(call, pn_Call_X_except, exc_jmp);
set_Tuple_pred(call, pn_Call_T_result, irn);
- set_Tuple_pred(call, pn_Call_P_value_res_base, new_r_Bad(irg));
} /* replace_call */
/* A mapper for the integer abs. */
set_Tuple_pred(call, pn_Call_X_regular, new_r_Jmp(blk));
set_Tuple_pred(call, pn_Call_X_except, new_r_Bad(irg));
set_Tuple_pred(call, pn_Call_T_result, new_r_Bad(irg));
- set_Tuple_pred(call, pn_Call_P_value_res_base, new_r_Bad(irg));
++env->nr_deads;
}
/* handle the regular call */
set_Tuple_pred(call, pn_Call_X_regular, new_r_Jmp(post_bl));
- /* For now, we cannot inline calls with value_base */
- set_Tuple_pred(call, pn_Call_P_value_res_base, new_r_Bad(irg));
-
/* Finally the exception control flow.
We have two possible situations:
First if the Call branches to an exception handler:
set_Tuple_pred(call, pn_Call_X_regular, jmp);
set_Tuple_pred(call, pn_Call_X_except, bad);
set_Tuple_pred(call, pn_Call_T_result, tuple);
- set_Tuple_pred(call, pn_Call_P_value_res_base, bad);
for (i = 0; i < env->n_ress; ++i) {
ir_node *res = get_Return_res(p, i);
return firm_unknown_type;
}
-/* Suffixes added to types used for pass-by-value representations. */
-static ident *value_ress_suffix = NULL;
-
void ir_init_type(void)
{
- value_ress_suffix = new_id_from_str(VALUE_RESS_SUFFIX);
-
/* construct none and unknown type. */
firm_none_type = new_type(tpop_none, mode_BAD, NULL);
set_type_size_bytes(firm_none_type, 0);
free_type(firm_unknown_type);
firm_unknown_type = NULL;
}
- value_ress_suffix = NULL;
}
/** the global type visited flag */
res->attr.ma.value_params = NULL;
res->attr.ma.n_res = n_res;
res->attr.ma.res_type = XMALLOCNZ(tp_ent_pair, n_res);
- res->attr.ma.value_ress = NULL;
res->attr.ma.variadicity = variadicity_non_variadic;
res->attr.ma.additional_properties = mtp_no_property;
hook_new_type(res);
res->attr.ma.n_res = n_res;
res->attr.ma.res_type = XMALLOCN(tp_ent_pair, n_res);
memcpy(res->attr.ma.res_type, tp->attr.ma.res_type, n_res * sizeof(res->attr.ma.res_type[0]));
- res->attr.ma.value_ress = tp->attr.ma.value_ress;
res->attr.ma.variadicity = tp->attr.ma.variadicity;
res->attr.ma.additional_properties = tp->attr.ma.additional_properties;
res->attr.ma.irg_calling_conv = tp->attr.ma.irg_calling_conv;
free_type(method->attr.ma.value_params);
}
*/
- if (method->attr.ma.value_ress) {
- free_type_entities(method->attr.ma.value_ress);
- free_type(method->attr.ma.value_ress);
- }
}
size_t (get_method_n_params)(const ir_type *method)
/* set the result ir_type */
method->attr.ma.res_type[pos].tp = tp;
/* If information constructed set pass-by-value representation. */
- if (method->attr.ma.value_ress) {
- assert(get_method_n_ress(method) == get_struct_n_members(method->attr.ma.value_ress));
- set_entity_type(get_struct_member(method->attr.ma.value_ress, pos), tp);
- }
-}
-
-ir_entity *get_method_value_res_ent(ir_type *method, size_t pos)
-{
- assert(method->type_op == type_method);
- assert(pos < get_method_n_ress(method));
-
- if (!method->attr.ma.value_ress) {
- /* result value type not created yet, build */
- method->attr.ma.value_ress = build_value_type("<value result>",
- get_method_n_ress(method), method->attr.ma.res_type);
- }
- /*
- * build_value_type() sets the method->attr.ma.value_ress type as default if
- * no type is set!
- */
- assert((get_entity_type(method->attr.ma.res_type[pos].ent) != method->attr.ma.value_ress)
- && "result type not yet set");
-
- return method->attr.ma.res_type[pos].ent;
-}
-
-ir_type *get_method_value_res_type(const ir_type *method)
-{
- assert(method->type_op == type_method);
- return method->attr.ma.value_ress;
}
const char *get_variadicity_name(ir_variadicity vari)
ir_type *value_params; /**< A type whose entities represent copied value arguments. */
size_t n_res; /**< Number of results. */
tp_ent_pair *res_type; /**< Array of result type/value ir_entity pairs. */
- ir_type *value_ress; /**< A type whose entities represent copied value results. */
ir_variadicity variadicity; /**< The variadicity of the method. */
mtp_additional_properties additional_properties; /**< Set of additional method properties. */
unsigned irg_calling_conv; /**< A set of calling convention flags. */
("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
("X_except", "control flow when exception occured", "pn_Generic_X_except"),
("T_result", "tuple containing all results", "pn_Generic_other"),
- ("P_value_res_base", "pointer to memory register containing copied results passed by value"),
]
flags = [ "fragile", "uses_memory" ]
attrs = [