*/
static ir_type *create_modified_mtd_type(const lower_params_t *lp, ir_type *mtp)
{
- ir_type *lowered, *ptr_tp, *value_type;
+ ir_type *lowered, *ptr_tp;
ir_type **params, **results, *res_tp;
size_t *param_map;
ir_mode *modes[MAX_REGISTER_RET_VAL];
- size_t n_ress, n_params, nn_ress, nn_params, i, first_variadic;
+ size_t n_ress, n_params, nn_ress, nn_params, i;
add_hidden hidden_params;
int changed = 0;
ir_variadicity var;
- if (is_lowered_type(mtp)) {
- /* the type is already lowered. Not handled yet. */
- assert(0 && "lowered types NYI");
- }
-
- lowered = get_associated_type(mtp);
+ lowered = get_type_lowered(mtp);
if (lowered != NULL)
return lowered;
NEW_ARR_A(size_t, param_map, n_params + n_ress);
- first_variadic = get_method_first_variadic_param_index(mtp);
-
hidden_params = lp->hidden_params;
if (hidden_params == ADD_HIDDEN_SMART &&
get_method_variadicity(mtp) == variadicity_variadic)
}
}
- /* move the index of the first variadic parameter */
- first_variadic += nn_params;
-
for (i = 0; i < n_params; ++i, ++nn_params) {
params[nn_params] = get_method_param_type(mtp, i);
param_map[nn_params] = i;
var = get_method_variadicity(mtp);
set_method_variadicity(lowered, var);
- if (var == variadicity_variadic)
- set_method_first_variadic_param_index(lowered, first_variadic);
/* associate the lowered type with the original one for easier access */
if (changed) {
set_lowered_type(mtp, lowered);
- value_type = get_method_value_param_type(mtp);
- if (value_type != NULL) {
- /* set new param positions */
- for (i = 0; i < nn_params; ++i) {
- ir_entity *ent = get_method_value_param_ent(lowered, i);
- size_t pos = param_map[i];
- ident *id;
-
- set_entity_link(ent, INT_TO_PTR(pos));
- if (pos >= n_params) {
- /* formally return value, ignore for now */
- continue;
- }
-
- id = get_method_param_ident(mtp, pos);
- if (id != NULL) {
- set_method_param_ident(lowered, i, id);
- set_entity_ident(ent, id);
- }
- }
-
- set_lowered_type(value_type, get_method_value_param_type(lowered));
- }
-
return lowered;
}
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);
size_t i;
size_t j;
- if (is_lowered_type(ctp))
- ctp = get_associated_type(ctp);
+ ctp = get_type_unlowered(ctp);
for (j = i = 0; i < get_method_n_ress(ctp); ++i) {
ir_type *rtp = get_method_res_type(ctp, i);