DECL_CALL_CLOBBERED tweek
Jan Hubicka
jh@suse.cz
Fri Dec 29 10:37:00 GMT 2006
> On 12/20/06, Jan Hubicka <jh@suse.cz> wrote:
> >Hi,
> >this patch I am fully testing now on i686 makes the call clobbered issues
> >go
> >away. If this seems sensible, I would for sake of consistency replace
> >DECL_CALL_CLOBBERED with gimple_call_clobbered_var and
> >gimple_set_call_clobbered_var inlines in tree-flow-inline.h?
>
> You probably want to speed test this on PR 26804 (which is the reason
> call clobberin was moved to be a flag test instead of a bitmap test).
Hi,
I think my results are within tolerance. Before:
tree alias analysis : 7.51 (10%) usr 0.28 ( 8%) sys 7.83 (10%)
wall 193258 kB (25%) ggc
TOTAL : 75.20 3.72 79.87
775722 kB
After:
tree alias analysis : 8.69 (11%) usr 0.36 (11%) sys 9.10 (11%)
wall 193258 kB (25%) ggc
TOTAL : 75.70 3.40 80.77
775722 kB
It is probably because annotations are slower, but still not O(n).
So I am attaching cleanded up patch (that basically replace
DECL_CALL_CLOBBERED with the direct variable annotation access, because
there seems to be enough abstraction already). Bootstrapped/regtested
i686-linux. OK?
* tree.h (DECL_CALL_CLOBBERED): Remove.
(tree_decl_common): Remove call_clobbered flag.
* tree-flow.h (struct var_ann_d): Add call_clobbered flag.
* tree-ssa-alias.c (mark_non_addressable, reset_cc_flags): Update.
* tree-flow-inline.h (is_call_clobbered, mark_call_clobbered,
clear_call_clobbered): Update.
* tree-ssa.c (verify_call_clobbering): Update.
Index: tree.h
===================================================================
*** tree.h (revision 120243)
--- tree.h (working copy)
*************** struct tree_memory_partition_tag GTY(())
*** 2607,2618 ****
#define DECL_GIMPLE_REG_P(DECL) \
DECL_COMMON_CHECK (DECL)->decl_common.gimple_reg_flag
- /* This is true if DECL is call clobbered in the current function.
- The result of this flag should always be the same as
- bitmap_bit_p (call_clobbered_vars, DECL_UID (decl)). */
- #define DECL_CALL_CLOBBERED(DECL) \
- DECL_COMMON_CHECK (DECL)->decl_common.call_clobbered_flag
-
struct tree_decl_common GTY(())
{
struct tree_decl_minimal common;
--- 2607,2612 ----
*************** struct tree_decl_common GTY(())
*** 2653,2659 ****
/* Logically, these two would go in a theoretical base shared by var and
parm decl. */
unsigned gimple_reg_flag : 1;
- unsigned call_clobbered_flag : 1;
union tree_decl_u1 {
/* In a FUNCTION_DECL for which DECL_BUILT_IN holds, this is
--- 2653,2658 ----
Index: tree-ssa-alias.c
===================================================================
*** tree-ssa-alias.c (revision 120243)
--- tree-ssa-alias.c (working copy)
*************** mark_non_addressable (tree var)
*** 126,132 ****
mpt = memory_partition (var);
if (!MTAG_P (var))
! DECL_CALL_CLOBBERED (var) = false;
bitmap_clear_bit (gimple_call_clobbered_vars (cfun), DECL_UID (var));
TREE_ADDRESSABLE (var) = 0;
--- 126,132 ----
mpt = memory_partition (var);
if (!MTAG_P (var))
! var_ann (var)->call_clobbered = false;
bitmap_clear_bit (gimple_call_clobbered_vars (cfun), DECL_UID (var));
TREE_ADDRESSABLE (var) = 0;
*************** struct tree_opt_pass pass_create_structu
*** 3214,3220 ****
0 /* letter */
};
! /* Reset the DECL_CALL_CLOBBERED flags on our referenced vars. In
theory, this only needs to be done for globals. */
static unsigned int
--- 3214,3220 ----
0 /* letter */
};
! /* Reset the call_clobbered flags on our referenced vars. In
theory, this only needs to be done for globals. */
static unsigned int
*************** reset_cc_flags (void)
*** 3224,3230 ****
referenced_var_iterator rvi;
FOR_EACH_REFERENCED_VAR (var, rvi)
! DECL_CALL_CLOBBERED (var) = false;
return 0;
}
--- 3224,3230 ----
referenced_var_iterator rvi;
FOR_EACH_REFERENCED_VAR (var, rvi)
! var_ann (var)->call_clobbered = false;
return 0;
}
Index: tree-flow-inline.h
===================================================================
*** tree-flow-inline.h (revision 120243)
--- tree-flow-inline.h (working copy)
*************** static inline bool
*** 919,925 ****
is_call_clobbered (tree var)
{
if (!MTAG_P (var))
! return DECL_CALL_CLOBBERED (var);
else
return bitmap_bit_p (gimple_call_clobbered_vars (cfun), DECL_UID (var));
}
--- 919,925 ----
is_call_clobbered (tree var)
{
if (!MTAG_P (var))
! return var_ann (var)->call_clobbered;
else
return bitmap_bit_p (gimple_call_clobbered_vars (cfun), DECL_UID (var));
}
*************** mark_call_clobbered (tree var, unsigned
*** 930,936 ****
{
var_ann (var)->escape_mask |= escape_type;
if (!MTAG_P (var))
! DECL_CALL_CLOBBERED (var) = true;
bitmap_set_bit (gimple_call_clobbered_vars (cfun), DECL_UID (var));
}
--- 930,936 ----
{
var_ann (var)->escape_mask |= escape_type;
if (!MTAG_P (var))
! var_ann (var)->call_clobbered = true;
bitmap_set_bit (gimple_call_clobbered_vars (cfun), DECL_UID (var));
}
*************** clear_call_clobbered (tree var)
*** 943,949 ****
if (MTAG_P (var) && TREE_CODE (var) != STRUCT_FIELD_TAG)
MTAG_GLOBAL (var) = 0;
if (!MTAG_P (var))
! DECL_CALL_CLOBBERED (var) = false;
bitmap_clear_bit (gimple_call_clobbered_vars (cfun), DECL_UID (var));
}
--- 943,949 ----
if (MTAG_P (var) && TREE_CODE (var) != STRUCT_FIELD_TAG)
MTAG_GLOBAL (var) = 0;
if (!MTAG_P (var))
! var_ann (var)->call_clobbered = false;
bitmap_clear_bit (gimple_call_clobbered_vars (cfun), DECL_UID (var));
}
Index: tree-ssa.c
===================================================================
*** tree-ssa.c (revision 120243)
--- tree-ssa.c (working copy)
*************** verify_call_clobbering (void)
*** 508,518 ****
tree var;
referenced_var_iterator rvi;
! /* At all times, the result of the DECL_CALL_CLOBBERED flag should
match the result of the call_clobbered_vars bitmap. Verify both
that everything in call_clobbered_vars is marked
! DECL_CALL_CLOBBERED, and that everything marked
! DECL_CALL_CLOBBERED is in call_clobbered_vars. */
EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, i, bi)
{
var = referenced_var (i);
--- 508,518 ----
tree var;
referenced_var_iterator rvi;
! /* At all times, the result of the call_clobbered flag should
match the result of the call_clobbered_vars bitmap. Verify both
that everything in call_clobbered_vars is marked
! call_clobbered, and that everything marked
! call_clobbered is in call_clobbered_vars. */
EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, i, bi)
{
var = referenced_var (i);
*************** verify_call_clobbering (void)
*** 520,529 ****
if (memory_partition (var))
var = memory_partition (var);
! if (!MTAG_P (var) && !DECL_CALL_CLOBBERED (var))
{
error ("variable in call_clobbered_vars but not marked "
! "DECL_CALL_CLOBBERED");
debug_variable (var);
goto err;
}
--- 520,529 ----
if (memory_partition (var))
var = memory_partition (var);
! if (!MTAG_P (var) && !var_ann (var)->call_clobbered)
{
error ("variable in call_clobbered_vars but not marked "
! "call_clobbered");
debug_variable (var);
goto err;
}
*************** verify_call_clobbering (void)
*** 538,547 ****
var = memory_partition (var);
if (!MTAG_P (var)
! && DECL_CALL_CLOBBERED (var)
&& !bitmap_bit_p (gimple_call_clobbered_vars (cfun), DECL_UID (var)))
{
! error ("variable marked DECL_CALL_CLOBBERED but not in "
"call_clobbered_vars bitmap.");
debug_variable (var);
goto err;
--- 538,547 ----
var = memory_partition (var);
if (!MTAG_P (var)
! && var_ann (var)->call_clobbered
&& !bitmap_bit_p (gimple_call_clobbered_vars (cfun), DECL_UID (var)))
{
! error ("variable marked call_clobbered but not in "
"call_clobbered_vars bitmap.");
debug_variable (var);
goto err;
Index: tree-flow.h
===================================================================
*** tree-flow.h (revision 120243)
--- tree-flow.h (working copy)
*************** struct var_ann_d GTY(())
*** 251,256 ****
--- 251,259 ----
/* True for HEAP and PARM_NOALIAS artificial variables. */
unsigned is_heapvar : 1;
+ /* True if the variable is call clobbered. */
+ unsigned int call_clobbered : 1;
+
/* Memory partition tag assigned to this symbol. */
tree mpt;
More information about the Gcc-patches
mailing list