Get rid of pn_Start_value_param:
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 19 Jan 2009 00:47:39 +0000 (00:47 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 19 Jan 2009 00:47:39 +0000 (00:47 +0000)
Access to value_type entities is now given by the frame pointer.

[r25246]

12 files changed:
include/libfirm/irgraph.h
include/libfirm/irnode.h
ir/ana/irsimpletype.c
ir/be/beabi.c
ir/ir/irdump.c
ir/ir/irgraph.c
ir/ir/irgraph_t.h
ir/ir/irnode.c
ir/ir/irtypes.h
ir/ir/irvrfy.c
ir/opt/opt_inline.c
ir/opt/tailrec.c

index e970e10..3aed3b9 100644 (file)
@@ -256,11 +256,6 @@ ir_node *get_irg_args(const ir_graph *irg);
 /** Sets the node that represents the argument pointer of the given IR graph. */
 void     set_irg_args(ir_graph *irg, ir_node *node);
 
-/** Returns the node that represents the value parameter base pointer of the given IR graph. */
-ir_node *get_irg_value_param_base(const ir_graph *irg);
-/** Sets the node that represents the value parameter base pointer of the given IR graph. */
-void     set_irg_value_param_base(ir_graph *irg, ir_node *node);
-
 /** Returns the current block of an IR graph. */
 ir_node *get_irg_current_block(const ir_graph *irg);
 /** Sets the current block of an IR graph. */
index 7c922e7..44f437a 100644 (file)
@@ -319,8 +319,6 @@ typedef enum {
        pn_Start_P_tls,            /**< Projection on the pointer to the thread local store
                                        segment containing _all_thread local variables. */
        pn_Start_T_args,           /**< Projection on all arguments. */
-       pn_Start_P_value_arg_base, /**< Pointer to region of compound value arguments as defined by
-                                       type of this method. */
        pn_Start_max               /**< number of projections from a Start */
 } pn_Start; /* Projection numbers for Start. */
 
@@ -336,12 +334,6 @@ ir_type *is_frame_pointer(const ir_node *n);
  * from Start.  If so returns tls type, else Null. */
 ir_type *is_tls_pointer(const ir_node *n);
 
-/** Test whether arbitrary node is value arg base.
- *
- * Test whether arbitrary node is value arg base, i.e. Proj(pn_Start_P_value_arg_base)
- * from Start.   If so returns 1, else 0. */
-int is_value_arg_pointer(const ir_node *n);
-
 /* @@@ no more supported  */
 ir_node **get_Block_cfgpred_arr(ir_node *node);
 int       get_Block_n_cfgpreds(const ir_node *node);
index af4d3da..136d01c 100644 (file)
@@ -138,10 +138,6 @@ static ir_type *find_type_for_Proj(ir_node *n) {
                case pn_Start_P_tls:
                        tp = find_pointer_type_to(get_tls_type());
                        break;
-               case pn_Start_P_value_arg_base:
-                       DB((dbg, SET_LEVEL_1, "Value arg base proj %ld from Start: unknown type\n", get_irn_node_nr(n)));
-                       tp =  firm_unknown_type; /* find_pointer_type_to(get....(get_entity_type(get_irg_entity(get_irn_irg(pred))))); */
-                       break;
                default:
                        DB((dbg, SET_LEVEL_1, "Proj %ld %ld from Start: unknown type\n", get_Proj_proj(n), get_irn_node_nr(n)));
                        tp = firm_unknown_type;
index 42ca151..7231477 100644 (file)
@@ -1506,7 +1506,6 @@ struct ent_pos_pair {
 typedef struct lower_frame_sels_env_t {
        ent_pos_pair *value_param_list;        /**< the list of all value param entities */
        ir_node      *frame;                   /**< the current frame */
-       ir_node      *param_base;              /**< the current value parameter base */
        const arch_register_class_t *sp_class; /**< register class of the stack pointer */
        ir_type      *value_tp;                /**< the value type if any */
        ir_type      *frame_tp;                /**< the frame type */
@@ -1524,7 +1523,7 @@ static void lower_frame_sels_walker(ir_node *irn, void *data)
        if (is_Sel(irn)) {
                ir_node *ptr = get_Sel_ptr(irn);
 
-               if (ptr == ctx->frame || ptr == ctx->param_base) {
+               if (ptr == ctx->frame) {
                        ir_entity    *ent = get_Sel_entity(irn);
                        ir_node      *bl  = get_nodes_block(irn);
                        ir_node      *nw;
@@ -1755,7 +1754,6 @@ static void modify_irg(be_abi_irg_t *env)
        ir_node *reg_params_bl;
        ir_node **args;
        ir_node *arg_tuple;
-       ir_node *value_param_base;
        const ir_edge_t *edge;
        ir_type *arg_type, *bet_type, *tp;
        lower_frame_sels_env_t ctx;
@@ -1789,7 +1787,6 @@ static void modify_irg(be_abi_irg_t *env)
        /* Convert the Sel nodes in the irg to frame addr nodes: */
        ctx.value_param_list = NEW_ARR_F(ent_pos_pair, 0);
        ctx.frame            = get_irg_frame(irg);
-       ctx.param_base       = get_irg_value_param_base(irg);
        ctx.sp_class         = env->arch_env->sp->reg_class;
        ctx.frame_tp         = get_irg_frame_type(irg);
 
@@ -1802,11 +1799,6 @@ static void modify_irg(be_abi_irg_t *env)
        /* fix the frame type layout again */
        set_type_state(ctx.frame_tp, layout_fixed);
 
-       /* value_param_base anchor is not needed anymore now */
-       value_param_base = get_irg_value_param_base(irg);
-       kill_node(value_param_base);
-       set_irg_value_param_base(irg, new_r_Bad(irg));
-
        env->regs  = pmap_create();
 
        n_params = get_method_n_params(method_type);
index dcc187d..5305cc9 100644 (file)
@@ -917,7 +917,6 @@ static const pns_lookup_t start_lut[] = {
        X(P_frame_base),
        X(P_tls),
        X(T_args),
-       X(P_value_arg_base)
 #undef X
 };
 
index 23a53c0..9e74261 100644 (file)
@@ -259,7 +259,6 @@ ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc) {
        set_irg_frame           (res, new_Proj(start, mode_P_data, pn_Start_P_frame_base));
        set_irg_tls             (res, new_Proj(start, mode_P_data, pn_Start_P_tls));
        set_irg_args            (res, new_Proj(start, mode_T,      pn_Start_T_args));
-       set_irg_value_param_base(res, new_Proj(start, mode_P_data, pn_Start_P_value_arg_base));
        initial_mem             = new_Proj(start, mode_M, pn_Start_M);
        set_irg_initial_mem(res, initial_mem);
 
@@ -699,16 +698,6 @@ void
        _set_irg_args(irg, node);
 }
 
-ir_node *
-(get_irg_value_param_base)(const ir_graph *irg) {
-       return _get_irg_value_param_base(irg);
-}
-
-void
-(set_irg_value_param_base)(ir_graph *irg, ir_node *node) {
-       _set_irg_value_param_base(irg, node);
-}
-
 ir_node *
 (get_irg_bad)(const ir_graph *irg) {
        return _get_irg_bad(irg);
index 7c941d1..bf53ff0 100644 (file)
@@ -218,16 +218,6 @@ _set_irg_args(ir_graph *irg, ir_node *node) {
        set_irn_n(irg->anchor, anchor_args, node);
 }
 
-static inline ir_node *
-_get_irg_value_param_base(const ir_graph *irg) {
-       return get_irn_intra_n(irg->anchor, anchor_value_param_base);
-}
-
-static inline void
-_set_irg_value_param_base(ir_graph *irg, ir_node *node) {
-       set_irn_n(irg->anchor, anchor_value_param_base, node);
-}
-
 static inline ir_node *
 _get_irg_bad(const ir_graph *irg) {
        return get_irn_intra_n(irg->anchor, anchor_bad);
@@ -557,8 +547,6 @@ _get_interprocedural_view(void) {
 #define set_irg_initial_mem(irg, node)        _set_irg_initial_mem(irg, node)
 #define get_irg_args(irg)                     _get_irg_args(irg)
 #define set_irg_args(irg, node)               _set_irg_args(irg, node)
-#define get_irg_value_param_base(irg)         _get_irg_value_param_base(irg)
-#define set_irg_value_param_base(irg, node)   _set_irg_value_param_base(irg, node)
 #define get_irg_bad(irg)                      _get_irg_bad(irg)
 #define set_irg_bad(irg, node)                _set_irg_bad(irg, node)
 #define get_irg_no_mem(irg)                   _get_irg_no_mem(irg)
index 3fb0473..b8b6c21 100644 (file)
@@ -643,16 +643,6 @@ ir_type *is_tls_pointer(const ir_node *n) {
        return NULL;
 }
 
-/* Test whether arbitrary node is value arg base, i.e. Proj(pn_Start_P_value_arg_base)
- * from Start.  If so returns 1, else 0. */
-int is_value_arg_pointer(const ir_node *n) {
-       if (is_Proj(n) &&
-               (get_Proj_proj(n) == pn_Start_P_value_arg_base) &&
-               is_Start(get_Proj_pred(n)))
-               return 1;
-       return 0;
-}
-
 /* Returns an array with the predecessors of the Block. Depending on
    the implementation of the graph data structure this can be a copy of
    the internal representation of predecessors as well as the internal
index 22110a4..81b5dcb 100644 (file)
@@ -417,7 +417,6 @@ enum irg_anchors {
                                      thread local data. */
        anchor_initial_mem,      /**< initial memory of this graph */
        anchor_args,             /**< methods arguments */
-       anchor_value_param_base, /**< method value param base */
        anchor_bad,              /**< bad node of this ir_graph, the one and
                                      only in this graph */
        anchor_no_mem,           /**< NoMem node of this ir_graph, the one and only in this graph */
index 0ac7151..0a4e8d4 100644 (file)
@@ -305,9 +305,7 @@ static int verify_node_Proj_Start(ir_node *n, ir_node *p) {
                        (proj == pn_Start_M         && mode == mode_M) ||
                        (proj == pn_Start_P_frame_base && mode_is_reference(mode)) ||
                        (proj == pn_Start_P_tls     && mode_is_reference(mode)) ||
-                       (proj == pn_Start_T_args    && mode == mode_T) ||
-                       (proj == pn_Start_P_value_arg_base && mode_is_reference(mode)) ||
-                       (proj == pn_Start_P_value_arg_base && mode == mode_T)    /* FIXME: only one of those */
+                       (proj == pn_Start_T_args    && mode == mode_T)
                ),
                "wrong Proj from Start", 0,
                show_proj_failure(p);
@@ -690,15 +688,6 @@ static int verify_node_Proj_Proj(ir_node *pred, ir_node *p) {
                                                show_proj_mode_failure(p, get_method_param_type(mt, proj));
                                                );
                        }
-               } else if (nr == pn_Start_P_value_arg_base) {
-                       ASSERT_AND_RET(
-                               (proj >= 0 && mode_is_reference(mode)),
-                               "wrong Proj from Proj from Start", 0
-                               );
-                       ASSERT_AND_RET(
-                               (proj < get_method_n_params(mt)),
-                               "More Projs for args than args in type", 0
-                               );
                }
                break;
 
index 26b0d6e..f4dcb8b 100644 (file)
@@ -768,10 +768,16 @@ static void copy_preds_inline(ir_node *n, void *env) {
  */
 static void find_addr(ir_node *node, void *env) {
        int *allow_inline = env;
-       if (is_Proj(node) &&
-                       is_Start(get_Proj_pred(node)) &&
-                       get_Proj_proj(node) == pn_Start_P_value_arg_base) {
-               *allow_inline = 0;
+       if (is_Sel(node)) {
+               ir_graph *irg = current_ir_graph;
+               if (get_Sel_ptr(node) == get_irg_frame(irg)) {
+                       /* access to frame */
+                       ir_entity *ent = get_Sel_entity(node);
+                       if (get_entity_owner(ent) != get_irg_frame_type(irg)) {
+                               /* access to value_type */
+                               *allow_inline = 0;
+                       }
+               }
        } else if (is_Alloc(node) && get_Alloc_where(node) == stack_alloc) {
                /* From GCC:
                 * Refuse to inline alloca call unless user explicitly forced so as this
@@ -977,9 +983,7 @@ int inline_method(ir_node *call, ir_graph *called_graph) {
        in[pn_Start_P_frame_base]     = get_irg_frame(irg);
        in[pn_Start_P_tls]            = get_irg_tls(irg);
        in[pn_Start_T_args]           = new_Tuple(n_params, args_in);
-       /* in[pn_Start_P_value_arg_base] = ??? */
-       assert(pn_Start_P_value_arg_base == pn_Start_max - 1 && "pn_Start_P_value_arg_base not supported, fix");
-       pre_call = new_Tuple(pn_Start_max - 1, in);
+       pre_call = new_Tuple(pn_Start_max, in);
        post_call = call;
 
        /* --
index 551a8fc..28ab28f 100644 (file)
@@ -417,7 +417,7 @@ static void do_opt_tail_rec(ir_graph *irg, tr_env *env) {
  * @return non-zero if it's ok to do tail recursion
  */
 static int check_lifetime_of_locals(ir_graph *irg) {
-       ir_node *irg_frame, *irg_val_param_base;
+       ir_node *irg_frame;
        int i;
        ir_type *frame_tp = get_irg_frame_type(irg);
 
@@ -425,21 +425,16 @@ static int check_lifetime_of_locals(ir_graph *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)) {
+                       /* Check if we have compound arguments.
+                          For now, we cannot handle them, */
+                       if (get_entity_owner(get_Sel_entity(succ)) != frame_tp)
+                               return 0;
 
-               if (is_Sel(succ) && is_address_taken(succ))
-                       return 0;
+                       if (is_address_taken(succ))
+                               return 0;
+               }
        }
-
-       /* Check if we have compound arguments.
-          For now, we cannot handle them, */
-       irg_val_param_base = get_irg_value_param_base(irg);
-       if (get_irn_n_outs(irg_val_param_base) > 0)
-               return 0;
-
        return 1;
 }