beabi: remove a bunch of unused/deprecated flags
authorMatthias Braun <matthias.braun@kit.edu>
Tue, 6 Mar 2012 11:47:31 +0000 (12:47 +0100)
committerMatthias Braun <matthias.braun@kit.edu>
Tue, 6 Mar 2012 11:47:31 +0000 (12:47 +0100)
ir/be/TEMPLATE/bearch_TEMPLATE.c
ir/be/amd64/bearch_amd64.c
ir/be/beabi.c
ir/be/beabi.h
ir/be/ia32/bearch_ia32.c

index 2fc2f99..29ab627 100644 (file)
@@ -230,10 +230,7 @@ static void TEMPLATE_get_call_abi(ir_type *method_type, be_abi_call_t *abi)
        be_abi_call_flags_t call_flags;
 
        /* set abi flags for calls */
-       call_flags.bits.store_args_sequential = 1;
-       call_flags.bits.try_omit_fp           = 1;
-       call_flags.bits.fp_free               = 0;
-       call_flags.bits.call_has_imm          = 1;
+       call_flags.bits.call_has_imm = true;
 
        /* set stack parameter passing style */
        be_abi_call_set_flags(abi, call_flags, &TEMPLATE_abi_callbacks);
index 2e31788..6eaf8af 100644 (file)
@@ -331,11 +331,6 @@ static void amd64_end_codegeneration(void *self)
        free(self);
 }
 
-typedef struct {
-       be_abi_call_flags_bits_t flags;
-       ir_graph *irg;
-} amd64_abi_env_t;
-
 /**
  * Get the between type for that call.
  * @param self The callback object.
@@ -398,10 +393,7 @@ static void amd64_get_call_abi(ir_type *method_type, be_abi_call_t *abi)
        int no_reg = 0;
 
        /* set abi flags for calls */
-       call_flags.bits.store_args_sequential = 0;
-       call_flags.bits.try_omit_fp           = 1;
-       call_flags.bits.fp_free               = 0;
-       call_flags.bits.call_has_imm          = 1;
+       call_flags.bits.call_has_imm = true;
 
        /* set stack parameter passing style */
        be_abi_call_set_flags(abi, call_flags, &amd64_abi_callbacks);
index 1e6cb71..7b47d03 100644 (file)
@@ -368,9 +368,7 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp)
        const arch_register_t *sp  = arch_env->sp;
        be_abi_call_t *call        = be_abi_call_new(sp->reg_class);
        ir_mode *mach_mode         = sp->reg_class->mode;
-       int no_alloc               = call->flags.bits.frame_is_setup_on_call;
        int n_res                  = get_method_n_ress(call_tp);
-       int do_seq                 = call->flags.bits.store_args_sequential && !no_alloc;
 
        ir_node *res_proj  = NULL;
        int n_reg_params   = 0;
@@ -430,9 +428,7 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp)
         * Note: we also have to do this for stack_size == 0, because we may have
         * to adjust stack alignment for the call.
         */
-       if (!do_seq && !no_alloc) {
-               curr_sp = be_new_IncSP(sp, bl, curr_sp, stack_size, 1);
-       }
+       curr_sp = be_new_IncSP(sp, bl, curr_sp, stack_size, 1);
 
        dbgi = get_irn_dbg_info(irn);
        /* If there are some parameters which shall be passed on the stack. */
@@ -441,20 +437,8 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp)
                ir_node **in       = ALLOCAN(ir_node*, n_stack_params+1);
                unsigned  n_in     = 0;
 
-               /* push params in reverse direction because stack grows downwards */
-               if (do_seq) {
-                       for (i = 0; i < n_stack_params >> 1; ++i) {
-                               int other  = n_stack_params - i - 1;
-                               int tmp    = stack_param_idx[i];
-                               stack_param_idx[i]     = stack_param_idx[other];
-                               stack_param_idx[other] = tmp;
-                       }
-               }
-
                curr_mem = get_Call_mem(irn);
-               if (! do_seq) {
-                       in[n_in++] = curr_mem;
-               }
+               in[n_in++] = curr_mem;
 
                for (i = 0; i < n_stack_params; ++i) {
                        int p                  = stack_param_idx[i];
@@ -470,30 +454,23 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp)
                         * the stack pointer for the next must be incremented,
                         * and the memory value propagated.
                         */
-                       if (do_seq) {
-                               curr_ofs = 0;
-                               addr = curr_sp = be_new_IncSP(sp, bl, curr_sp,
-                                                             param_size + arg->space_before, 0);
-                               add_irn_dep(curr_sp, curr_mem);
-                       } else {
-                               curr_ofs += arg->space_before;
-                               curr_ofs =  round_up2(curr_ofs, arg->alignment);
-
-                               /* Make the expression to compute the argument's offset. */
-                               if (curr_ofs > 0) {
-                                       ir_mode *constmode = mach_mode;
-                                       if (mode_is_reference(mach_mode)) {
-                                               constmode = mode_Is;
-                                       }
-                                       addr = new_r_Const_long(irg, constmode, curr_ofs);
-                                       addr = new_r_Add(bl, curr_sp, addr, mach_mode);
+                       curr_ofs += arg->space_before;
+                       curr_ofs =  round_up2(curr_ofs, arg->alignment);
+
+                       /* Make the expression to compute the argument's offset. */
+                       if (curr_ofs > 0) {
+                               ir_mode *constmode = mach_mode;
+                               if (mode_is_reference(mach_mode)) {
+                                       constmode = mode_Is;
                                }
+                               addr = new_r_Const_long(irg, constmode, curr_ofs);
+                               addr = new_r_Add(bl, curr_sp, addr, mach_mode);
                        }
 
                        /* Insert a store for primitive arguments. */
                        if (is_atomic_type(param_type)) {
                                ir_node *nomem     = get_irg_no_mem(irg);
-                               ir_node *mem_input = do_seq ? curr_mem : nomem;
+                               ir_node *mem_input = nomem;
                                ir_node *store     = new_rd_Store(dbgi, bl, mem_input, addr, param, cons_none);
                                mem   = new_r_Proj(store, mode_M, pn_Store_M);
                        } else {
@@ -507,19 +484,14 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp)
 
                        curr_ofs += param_size;
 
-                       if (do_seq)
-                               curr_mem = mem;
-                       else
-                               in[n_in++] = mem;
+                       in[n_in++] = mem;
                }
 
                /* We need the sync only, if we didn't build the stores sequentially. */
-               if (! do_seq) {
-                       if (n_stack_params >= 1) {
-                               curr_mem = new_r_Sync(bl, n_in, in);
-                       } else {
-                               curr_mem = get_Call_mem(irn);
-                       }
+               if (n_stack_params >= 1) {
+                       curr_mem = new_r_Sync(bl, n_in, in);
+               } else {
+                       curr_mem = get_Call_mem(irn);
                }
        }
 
@@ -768,9 +740,7 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp)
                }
        }
        /* Clean up the stack frame or revert alignment fixes if we allocated it */
-       if (! no_alloc) {
-               curr_sp = be_new_IncSP(sp, bl, curr_sp, -stack_size, 0);
-       }
+       curr_sp = be_new_IncSP(sp, bl, curr_sp, -stack_size, 0);
 
        be_abi_call_free(call);
 
@@ -1015,7 +985,6 @@ static int cmp_call_dependency(const void *c1, const void *c2)
 
 /**
  * Walker: links all Call/Alloc/Free nodes to the Block they are contained.
- * Clears the irg_is_leaf flag if a Call is detected.
  */
 static void link_ops_in_block_walker(ir_node *irn, void *data)
 {
@@ -1028,9 +997,6 @@ static void link_ops_in_block_walker(ir_node *irn, void *data)
                ir_node *bl       = get_nodes_block(irn);
                void *save        = get_irn_link(bl);
 
-               if (code == iro_Call)
-                       env->call->flags.bits.irg_is_leaf = 0;
-
                set_irn_link(irn, save);
                set_irn_link(bl, irn);
        }
@@ -1127,7 +1093,6 @@ static void process_calls(ir_graph *irg)
 {
        be_abi_irg_t *abi = be_get_irg_abi(irg);
 
-       abi->call->flags.bits.irg_is_leaf = 1;
        irg_walk_graph(irg, firm_clear_link, link_ops_in_block_walker, abi);
 
        ir_heights = heights_new(irg);
index 4bab8f8..5bca530 100644 (file)
 #include "beabihelper.h"
 
 struct be_abi_call_flags_bits_t {
-       unsigned store_args_sequential  : 1;  /**< Use sequential stores for arguments. */
-       unsigned try_omit_fp            : 1;  /**< Try to omit the frame pointer. */
-       unsigned fp_free                : 1;  /**< The function can use any register as frame pointer. */
-       unsigned call_has_imm           : 1;  /**< A call can take the callee's address as an immediate. */
-       unsigned irg_is_leaf            : 1;  /**< 1, if the IRG is a leaf function. */
-       unsigned frame_is_setup_on_call : 1;  /**< Set to one, if there is already enough room on the stack for call args. */
+       bool try_omit_fp   : 1; /**< Try to omit the frame pointer. */
+       bool call_has_imm  : 1; /**< A call can take the callee's address as an
+                                    immediate. */
 };
 
 union be_abi_call_flags_t {
index a3b499c..917a2c3 100644 (file)
@@ -190,14 +190,6 @@ static ir_node *ia32_get_admissible_noreg(ir_node *irn, int pos)
        }
 }
 
-/**
- * The IA32 ABI callback object.
- */
-typedef struct {
-       be_abi_call_flags_bits_t flags;  /**< The call flags. */
-       ir_graph *irg;                   /**< The associated graph. */
-} ia32_abi_env_t;
-
 static ir_entity *ia32_get_frame_entity(const ir_node *irn)
 {
        return is_ia32_irn(irn) ? get_ia32_frame_ent(irn) : NULL;
@@ -1929,10 +1921,8 @@ static void ia32_get_call_abi(ir_type *method_type, be_abi_call_t *abi)
        be_abi_call_flags_t call_flags = be_abi_call_get_flags(abi);
 
        /* set abi flags for calls */
-       call_flags.bits.store_args_sequential = 0;
        /* call_flags.bits.try_omit_fp                 not changed: can handle both settings */
-       call_flags.bits.fp_free               = 0;  /* the frame pointer is fixed in IA32 */
-       call_flags.bits.call_has_imm          = 0;  /* No call immediate, we handle this by ourselves */
+       call_flags.bits.call_has_imm = false;  /* No call immediate, we handle this by ourselves */
 
        /* set parameter passing style */
        be_abi_call_set_flags(abi, call_flags, &ia32_abi_callbacks);