beabi: Turn be_abi_call_flags_t into a struct.
authorChristoph Mallon <christoph.mallon@gmx.de>
Sat, 24 Nov 2012 10:45:49 +0000 (11:45 +0100)
committerChristoph Mallon <christoph.mallon@gmx.de>
Sat, 24 Nov 2012 10:45:49 +0000 (11:45 +0100)
Remove the union aspect to interpret the flags as one unsigned int.

ir/be/TEMPLATE/bearch_TEMPLATE.c
ir/be/amd64/bearch_amd64.c
ir/be/be_types.h
ir/be/beabi.c
ir/be/beabi.h
ir/be/ia32/bearch_ia32.c

index 3c64b23..5df5adc 100644 (file)
@@ -229,7 +229,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.call_has_imm = true;
+       call_flags.call_has_imm = true;
 
        /* set stack parameter passing style */
        be_abi_call_set_flags(abi, call_flags, &TEMPLATE_abi_callbacks);
index c8addba..86f73b1 100644 (file)
@@ -356,7 +356,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.call_has_imm = true;
+       call_flags.call_has_imm = true;
 
        /* set stack parameter passing style */
        be_abi_call_set_flags(abi, call_flags, &amd64_abi_callbacks);
index 284e10e..22886ee 100644 (file)
@@ -58,7 +58,7 @@ typedef struct be_lv_t                  be_lv_t;
 typedef union  be_lv_info_t             be_lv_info_t;
 
 typedef struct be_abi_call_flags_bits_t be_abi_call_flags_bits_t;
-typedef union  be_abi_call_flags_t      be_abi_call_flags_t;
+typedef struct be_abi_call_flags_t      be_abi_call_flags_t;
 typedef struct be_abi_callbacks_t       be_abi_callbacks_t;
 typedef struct be_abi_call_t            be_abi_call_t;
 typedef struct be_abi_irg_t             be_abi_irg_t;
index a035beb..5a1cc6b 100644 (file)
@@ -282,12 +282,10 @@ static be_abi_call_t *be_abi_call_new(const arch_register_class_t *cls_addr)
 {
        be_abi_call_t *call = XMALLOCZ(be_abi_call_t);
 
-       call->flags.val  = 0;
-       call->params     = new_set(cmp_call_arg, 16);
-       call->cb         = NULL;
-       call->cls_addr   = cls_addr;
-
-       call->flags.bits.try_omit_fp = be_omit_fp;
+       call->params            = new_set(cmp_call_arg, 16);
+       call->cb                = NULL;
+       call->cls_addr          = cls_addr;
+       call->flags.try_omit_fp = be_omit_fp;
 
        return call;
 }
@@ -562,7 +560,7 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp)
 
        /* ins collected, build the call */
        throws_exception = ir_throws_exception(irn);
-       if (env->call->flags.bits.call_has_imm && is_SymConst(call_ptr)) {
+       if (env->call->flags.call_has_imm && is_SymConst(call_ptr)) {
                /* direct call */
                low_call = be_new_Call(dbgi, irg, bl, curr_mem, sp->single_req, curr_sp,
                                       sp->single_req, curr_sp,
@@ -831,7 +829,7 @@ static ir_node *adjust_alloc(be_abi_irg_t *env, ir_node *alloc, ir_node *curr_sp
 
        /* The stack pointer will be modified in an unknown manner.
           We cannot omit it. */
-       env->call->flags.bits.try_omit_fp = 0;
+       env->call->flags.try_omit_fp = 0;
 
        stack_alignment = 1 << arch_env->stack_alignment;
        size            = adjust_alloc_size(stack_alignment, size, block, dbg);
@@ -899,7 +897,7 @@ static ir_node *adjust_free(be_abi_irg_t *env, ir_node *free, ir_node *curr_sp)
 
        /* The stack pointer will be modified in an unknown manner.
           We cannot omit it. */
-       env->call->flags.bits.try_omit_fp = 0;
+       env->call->flags.try_omit_fp = 0;
        subsp = be_new_SubSP(arch_env->sp, block, curr_sp, size);
        set_irn_dbg_info(subsp, dbg);
 
@@ -991,7 +989,7 @@ static void link_ops_in_block_walker(ir_node *irn, void *data)
                unsigned long  value = get_tarval_long(tv);
                /* use ebp, so the climbframe algo works... */
                if (value > 0) {
-                       env->call->flags.bits.try_omit_fp = 0;
+                       env->call->flags.try_omit_fp = 0;
                }
        }
 }
@@ -1040,7 +1038,7 @@ static void process_ops_in_block(ir_node *bl, void *data)
                        case iro_Call:
                                if (! be_omit_fp) {
                                        /* The stack pointer will be modified due to a call. */
-                                       env->call->flags.bits.try_omit_fp = 0;
+                                       env->call->flags.try_omit_fp = 0;
                                }
                                curr_sp = adjust_call(env, irn, curr_sp);
                                break;
@@ -1446,7 +1444,7 @@ static void modify_irg(ir_graph *const irg, be_abi_irg_t *const env)
                }
        }
 
-       stack_layout->sp_relative = call->flags.bits.try_omit_fp;
+       stack_layout->sp_relative = call->flags.try_omit_fp;
        bet_type = call->cb->get_between_type(irg);
        stack_frame_init(stack_layout, arg_type, bet_type,
                         get_irg_frame_type(irg));
@@ -1475,7 +1473,7 @@ static void modify_irg(ir_graph *const irg, be_abi_irg_t *const env)
                }
        }
 
-       fp_reg = call->flags.bits.try_omit_fp ? arch_env->sp : arch_env->bp;
+       fp_reg = call->flags.try_omit_fp ? arch_env->sp : arch_env->bp;
        rbitset_clear(birg->allocatable_regs, fp_reg->global_index);
 
        /* handle start block here (place a jump in the block) */
index 3ce9516..9b612ce 100644 (file)
 #include "beabi.h"
 #include "beabihelper.h"
 
-struct be_abi_call_flags_bits_t {
+struct be_abi_call_flags_t {
        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 {
-       be_abi_call_flags_bits_t bits;
-       unsigned val;
-};
-
 struct be_abi_callbacks_t {
        /**
         * Get the between type for that call.
index ba26ada..ad7da53 100644 (file)
@@ -1908,8 +1908,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.try_omit_fp                 not changed: can handle both settings */
-       call_flags.bits.call_has_imm = false;  /* No call immediate, we handle this by ourselves */
+       /* call_flags.try_omit_fp                 not changed: can handle both settings */
+       call_flags.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);