diff options
author | dberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-20 18:23:04 +0000 |
---|---|---|
committer | dberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-20 18:23:04 +0000 |
commit | d22f311cce6ce08073d43bb240b5c19eed625a40 (patch) | |
tree | 699467bcecbc07238b3312bf2f2fa78521678900 | |
parent | 61feb0e74f306cbf7c9e9f5e9829905acf4c5870 (diff) |
2004-01-20 Daniel Berlin <dberlin@dberlin.org>lno-merge-20040120
* tree-alias-ander.c (andersen_op_assign): Update
prototype. Make this handle &x in the operands using
the addrargs parameter.
(andersen_init): Turn off ip_partial until variables
aliasing variables in other functions is resolved.
(andersen_add_var): Use newly renamed alias_var_new_with_aterm.
Fix comment.
(andersen_add_var_same): Ditto.
(andersen_function_call): Use ip_partial, not flag_unit_at_a_time.
* tree-alias-common.c (get_values_from_constructor): Add bitmap
and int * arguments. Used to mark operands that we are taking
address of.
(get_alias_var_decl): We should never see FIELD_DECL's right now.
(intra_function_call): Reverse ordering for slightly faster
projection merging.
(find_op_of_decl): New function.
(find_func_aliases): Use it.
Comment x = foo.y case.
Move get_alias_var_decl of arguments so we only call it if
necessary.
Handle address of arguments in operations.
(create_fun_alias_var): tvar->var.
Set context of fakeargs.
Set context of fakedecls.
Set DECL_PTA_ALIASVAR of RETURN_DECL's.
(create_fun_alias_var_ptf): tvar->var.
Set context of fakedecls.
(create_alias_vars): Only create alias vars for globals
with DECL_INITIAL's.
* tree-alias-common.h (struct tree_alias_ops):
Update op_assign arguments.
(may_alias): Fix comment.
(same_points_to_set): Ditto.
(empty_points_to_set): Ditto.
* tree-alias-type.h: Rename alias_tvar_new_with_aterm
-> alias_var_new_with_aterm.
* tree-alias-type.c: Ditto.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@76218 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog.tree-ssa | 40 | ||||
-rw-r--r-- | gcc/tree-alias-ander.c | 44 | ||||
-rw-r--r-- | gcc/tree-alias-common.c | 203 | ||||
-rw-r--r-- | gcc/tree-alias-common.h | 8 | ||||
-rw-r--r-- | gcc/tree-alias-type.c | 2 | ||||
-rw-r--r-- | gcc/tree-alias-type.h | 2 |
6 files changed, 197 insertions, 102 deletions
diff --git a/gcc/ChangeLog.tree-ssa b/gcc/ChangeLog.tree-ssa index 1fd00999308..730e3e50fb4 100644 --- a/gcc/ChangeLog.tree-ssa +++ b/gcc/ChangeLog.tree-ssa @@ -1,3 +1,43 @@ +2004-01-20 Daniel Berlin <dberlin@dberlin.org> + + * tree-alias-ander.c (andersen_op_assign): Update + prototype. Make this handle &x in the operands using + the addrargs parameter. + (andersen_init): Turn off ip_partial until variables + aliasing variables in other functions is resolved. + (andersen_add_var): Use newly renamed alias_var_new_with_aterm. + Fix comment. + (andersen_add_var_same): Ditto. + (andersen_function_call): Use ip_partial, not flag_unit_at_a_time. + * tree-alias-common.c (get_values_from_constructor): Add bitmap + and int * arguments. Used to mark operands that we are taking + address of. + (get_alias_var_decl): We should never see FIELD_DECL's right now. + (intra_function_call): Reverse ordering for slightly faster + projection merging. + (find_op_of_decl): New function. + (find_func_aliases): Use it. + Comment x = foo.y case. + Move get_alias_var_decl of arguments so we only call it if + necessary. + Handle address of arguments in operations. + (create_fun_alias_var): tvar->var. + Set context of fakeargs. + Set context of fakedecls. + Set DECL_PTA_ALIASVAR of RETURN_DECL's. + (create_fun_alias_var_ptf): tvar->var. + Set context of fakedecls. + (create_alias_vars): Only create alias vars for globals + with DECL_INITIAL's. + * tree-alias-common.h (struct tree_alias_ops): + Update op_assign arguments. + (may_alias): Fix comment. + (same_points_to_set): Ditto. + (empty_points_to_set): Ditto. + * tree-alias-type.h: Rename alias_tvar_new_with_aterm + -> alias_var_new_with_aterm. + * tree-alias-type.c: Ditto. + 2004-01-20 Richard Henderson <rth@redhat.com> * tree-sra.c (get_scalar_for_field): Validate field. diff --git a/gcc/tree-alias-ander.c b/gcc/tree-alias-ander.c index 07c1857e42e..60c9767a646 100644 --- a/gcc/tree-alias-ander.c +++ b/gcc/tree-alias-ander.c @@ -104,7 +104,7 @@ static void andersen_addr_assign (struct tree_alias_ops *, static void andersen_ptr_assign (struct tree_alias_ops *, alias_var, alias_var); static void andersen_op_assign (struct tree_alias_ops *, - alias_var, varray_type, tree); + alias_var, varray_type, tree, bitmap); static void andersen_heap_assign (struct tree_alias_ops *, alias_var); static void andersen_assign_ptr (struct tree_alias_ops *, alias_var, alias_var); @@ -442,8 +442,10 @@ andersen_init (struct tree_alias_ops *ops ATTRIBUTE_UNUSED) ptamap = splay_tree_new (splay_tree_compare_pointers, NULL, NULL); +#if 0 /* Don't claim we can do ip partial unless we have unit_at_a_time on. */ - if (!flag_unit_at_a_time) + if (!flag_unit_at_a_time) +#endif andersen_ops.ip_partial = 0; } @@ -497,14 +499,14 @@ andersen_add_var (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, tree decl) if (alias_get_name (decl) != NULL) { - ret = alias_tvar_new_with_aterm (decl, + ret = alias_var_new_with_aterm (decl, pta_make_ref (alias_get_name (decl))); } else { char *tmp_name; ASM_FORMAT_PRIVATE_NAME (tmp_name, "unnamed var", id_num++); - ret = alias_tvar_new_with_aterm (decl, pta_make_ref (tmp_name)); + ret = alias_var_new_with_aterm (decl, pta_make_ref (tmp_name)); } splay_tree_insert (ptamap, (splay_tree_key) ALIAS_VAR_ATERM (ret), (splay_tree_value) ret); @@ -514,7 +516,7 @@ andersen_add_var (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, tree decl) } /* Add a variable to the analyzer that is equivalent (as far as - aliases go) to some existing var. + aliases go) to some existing alias variable. For Andersen, we just call a function that does this for us. */ static alias_var @@ -528,13 +530,13 @@ andersen_add_var_same (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, tree decl, alias_get_name (decl), alias_get_name (ALIAS_VAR_DECL (tv))); if (alias_get_name (decl) != NULL) - ret = alias_tvar_new_with_aterm (decl, + ret = alias_var_new_with_aterm (decl, pta_make_ref (alias_get_name (decl))); else { char *tmp_name; ASM_FORMAT_PRIVATE_NAME (tmp_name, "unnamed var", id_num++); - ret = alias_tvar_new_with_aterm (decl, pta_make_ref (tmp_name)); + ret = alias_var_new_with_aterm (decl, pta_make_ref (tmp_name)); } pta_join (ALIAS_VAR_ATERM (tv), ALIAS_VAR_ATERM (ret)); @@ -638,7 +640,8 @@ pointer_destroying_op (tree op) static void andersen_op_assign (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, - alias_var lhs, varray_type operands, tree operation) + alias_var lhs, varray_type operands, tree operation, + bitmap addrargs) { aterm newvar = NULL; @@ -676,7 +679,10 @@ andersen_op_assign (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, { alias_var tempvar = VARRAY_GENERIC_PTR (operands, i); aterm t2 = ALIAS_VAR_ATERM (tempvar); - newvar = pta_join (newvar, t2); + if (bitmap_bit_p (addrargs, i)) + newvar = pta_join (newvar, pta_address (t2)); + else + newvar = pta_join (newvar, t2); } } else if (VARRAY_ACTIVE_SIZE (operands) == 2) @@ -685,13 +691,23 @@ andersen_op_assign (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, alias_var tv2 = VARRAY_GENERIC_PTR (operands, 1); aterm t1 = ALIAS_VAR_ATERM (tv1); aterm t2 = ALIAS_VAR_ATERM (tv2); - newvar = pta_join (t1, t2); + if (bitmap_bit_p (addrargs, 0) && bitmap_bit_p (addrargs, 1)) + newvar = pta_join (pta_address (t1), pta_address (t2)); + else if (bitmap_bit_p (addrargs, 0)) + newvar = pta_join (pta_address (t1), t2); + else if (bitmap_bit_p (addrargs, 1)) + newvar = pta_join (t1, pta_address (t2)); + else + newvar = pta_join (t1, t2); } else if (VARRAY_ACTIVE_SIZE (operands) == 1) { alias_var tv1 = VARRAY_GENERIC_PTR (operands, 0); aterm t1 = ALIAS_VAR_ATERM (tv1); - newvar = t1; + if (bitmap_bit_p (addrargs, 0)) + newvar = pta_address (t1); + else + newvar = t1; } pta_assignment (ALIAS_VAR_ATERM (lhs), pta_rvalue (newvar)); } @@ -705,7 +721,7 @@ andersen_heap_assign (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, #if 0 alias_type type1; ECR tau; - type1 = ECR_get_type (alias_tvar_get_ECR (lhs)); + type1 = ECR_get_type (alias_var_get_ECR (lhs)); tau = alias_ltype_loc (type1); if (ECR_get_type (tau) == alias_bottom) @@ -762,7 +778,7 @@ andersen_function_def (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, /* Inference for a function call assignment. */ static int -andersen_function_call (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, +andersen_function_call (struct tree_alias_ops *ops, alias_var lhs, alias_var func, varray_type args, bitmap addrargs) { @@ -801,7 +817,7 @@ andersen_function_call (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, necessary. */ if (TREE_CODE (decl) == FUNCTION_DECL && DECL_PTA_ALIASVAR (decl) - && flag_unit_at_a_time + && ops->ip_partial && (cgraph_local_info (decl)->local)) { return 0; diff --git a/gcc/tree-alias-common.c b/gcc/tree-alias-common.c index 2bd170abfcc..47d42e4f6a2 100644 --- a/gcc/tree-alias-common.c +++ b/gcc/tree-alias-common.c @@ -96,7 +96,7 @@ static alias_var create_fun_alias_var_ptf (tree, tree); static alias_var create_fun_alias_var (tree, int); static alias_var create_alias_var (tree); static void intra_function_call (varray_type); -static void get_values_from_constructor (tree, varray_type *); +static void get_values_from_constructor (tree, varray_type *, bitmap, int *); static bool call_may_clobber (tree); static bool call_may_return (tree); @@ -140,7 +140,8 @@ static alias_var get_alias_var_decl (tree decl) { alias_var newvar; - + if (TREE_CODE (decl) == FIELD_DECL) + abort (); if (DECL_P (decl)) { if (DECL_PTA_ALIASVAR (decl)) @@ -158,8 +159,7 @@ get_alias_var_decl (tree decl) || TREE_PUBLIC (decl) || TREE_STATIC (decl) || decl_function_context (decl) == NULL) - && decl != pta_global_var - /* && !TREE_READONLY (decl)*/) + && decl != pta_global_var) { current_alias_ops->addr_assign (current_alias_ops, get_alias_var (pta_global_var), @@ -284,21 +284,6 @@ intra_function_call (varray_type args) size_t i; alias_var av = get_alias_var (pta_global_var); - /* We assume that an actual parameter can point to any global. */ - for (i = 0; i < l; i++) - { - alias_var argav = VARRAY_GENERIC_PTR (args, i); - /* Restricted pointers can't be aliased with other - restricted pointers. */ - if (!TYPE_RESTRICT (TREE_TYPE (ALIAS_VAR_DECL (argav))) - || !TYPE_RESTRICT (TREE_TYPE (ALIAS_VAR_DECL (av)))) - { - /* Arguments can alias globals, and whatever they point to - can point to a global as well. */ - if (!TREE_READONLY (ALIAS_VAR_DECL (argav))) - current_alias_ops->simple_assign (current_alias_ops, argav, av); - } - } /* We assume assignments among the actual parameters. */ for (i = 0; i < l; i++) { @@ -320,12 +305,27 @@ intra_function_call (varray_type args) current_alias_ops->simple_assign (current_alias_ops, argi, argj); } } + /* We assume that an actual parameter can point to any global. */ + for (i = 0; i < l; i++) + { + alias_var argav = VARRAY_GENERIC_PTR (args, i); + /* Restricted pointers can't be aliased with other + restricted pointers. */ + if (!TYPE_RESTRICT (TREE_TYPE (ALIAS_VAR_DECL (argav))) + || !TYPE_RESTRICT (TREE_TYPE (ALIAS_VAR_DECL (av)))) + { + /* Arguments can alias globals, and whatever they point to + can point to a global as well. */ + current_alias_ops->simple_assign (current_alias_ops, argav, av); + } + } } /* Put all pointers in a constructor in an array. */ static void -get_values_from_constructor (tree constructor, varray_type *vals) +get_values_from_constructor (tree constructor, varray_type *vals, + bitmap addrargs, int *i) { tree elt_list; switch (TREE_CODE (constructor)) @@ -340,14 +340,16 @@ get_values_from_constructor (tree constructor, varray_type *vals) if (TREE_CODE (value) == TREE_LIST || TREE_CODE (value) == CONSTRUCTOR) { - get_values_from_constructor (value, vals); - } + get_values_from_constructor (value, vals, addrargs, i); } else { alias_var aav; aav = get_alias_var (value); if (aav) VARRAY_PUSH_GENERIC_PTR (*vals, aav); + if (TREE_CODE (value) == ADDR_EXPR) + bitmap_set_bit (addrargs, *i); + *i = *i + 1; } } } @@ -357,7 +359,7 @@ get_values_from_constructor (tree constructor, varray_type *vals) elt_list; elt_list = TREE_CHAIN (elt_list)) { - get_values_from_constructor (TREE_VALUE (elt_list), vals); + get_values_from_constructor (TREE_VALUE (elt_list), vals, addrargs, i); } break; default: @@ -395,7 +397,19 @@ deal_with_call_aliasing (tree callargs, alias_var lhsAV) } } - +/* Find the operand of the component ref that actually is doing + something to the DECL */ +static tree +find_op_of_decl (tree cref) +{ + while (!DECL_P (TREE_OPERAND (cref, 0))) + { + cref = TREE_OPERAND (cref, 0); + } + return cref; +} + + /* Tree walker that is the heart of the aliasing infrastructure. TP is a pointer to the current tree. WALK_SUBTREES specifies whether to continue traversing subtrees or @@ -449,6 +463,10 @@ find_func_aliases (tree stp) { op1 = TREE_OPERAND (op1, 0); } + /* Take care of fact that we may have multi-level component + refs. */ + if (TREE_CODE (op1) == COMPONENT_REF) + op1 = find_op_of_decl (op1); #endif /* You would think we could test rhsAV at the top, rather than @@ -469,6 +487,7 @@ find_func_aliases (tree stp) current_alias_ops->simple_assign (current_alias_ops, lhsAV, rhsAV); } + /* x = foo.y */ else if (TREE_CODE (op1) == COMPONENT_REF && DECL_P (TREE_OPERAND (op1, 0))) { @@ -517,29 +536,33 @@ find_func_aliases (tree stp) {} else { - varray_type args; - tree arg; - tree callop0, callop1; - int argnum; - VARRAY_GENERIC_PTR_INIT (args, 1, "Arguments"); - bitmap_clear (addrargs); - callop1 = TREE_OPERAND (op1, 1); - callop0 = TREE_OPERAND (op1, 0); - for (arg = callop1, argnum = 0; - arg; - arg = TREE_CHAIN (arg), argnum++) - { - alias_var aav = get_alias_var (TREE_VALUE (arg)); - if (aav) - { - VARRAY_PUSH_GENERIC_PTR (args, aav); - if (TREE_CODE (TREE_VALUE (arg)) == ADDR_EXPR) - bitmap_set_bit (addrargs, argnum); - } - } + /* NORETURN functions have no effect on aliasing. */ if (call_may_return (op1)) - { + { + varray_type args; + tree arg; + tree callop0, callop1; + int argnum; + + /* Collect the arguments */ + VARRAY_GENERIC_PTR_INIT (args, 1, "Arguments"); + bitmap_clear (addrargs); + callop1 = TREE_OPERAND (op1, 1); + callop0 = TREE_OPERAND (op1, 0); + for (arg = callop1, argnum = 0; + arg; + arg = TREE_CHAIN (arg), argnum++) + { + alias_var aav = get_alias_var (TREE_VALUE (arg)); + if (aav) + { + VARRAY_PUSH_GENERIC_PTR (args, aav); + if (TREE_CODE (TREE_VALUE (arg)) == ADDR_EXPR) + bitmap_set_bit (addrargs, argnum); + } + } + /* Simulate the call */ if (current_alias_ops->function_call (current_alias_ops, lhsAV, get_alias_var (callop0), args, addrargs)) @@ -550,10 +573,8 @@ find_func_aliases (tree stp) { intra_function_call (args); } - if (POINTER_TYPE_P (TREE_TYPE (op0))) deal_with_call_aliasing (callop1, lhsAV); - } } } @@ -561,14 +582,15 @@ find_func_aliases (tree stp) /* x = op (...) */ else { + bitmap_clear (addrargs); if (TREE_CODE (op1) == CONSTRUCTOR) { varray_type ops; - + int i = 0; VARRAY_GENERIC_PTR_INIT (ops, 1, "Operands"); - get_values_from_constructor (op1, &ops); + get_values_from_constructor (op1, &ops, addrargs, &i); current_alias_ops->op_assign (current_alias_ops, lhsAV, - ops, op1); + ops, op1, addrargs); } else switch (TREE_CODE_CLASS (TREE_CODE (op1))) @@ -584,16 +606,18 @@ find_func_aliases (tree stp) varray_type ops; int i; VARRAY_GENERIC_PTR_INIT (ops, 1, "Operands"); - for (i=0; i < TREE_CODE_LENGTH (TREE_CODE (op1)); i++) + for (i = 0; i < TREE_CODE_LENGTH (TREE_CODE (op1)); i++) { alias_var aav; op = TREE_OPERAND (op1, i); aav = get_alias_var (op); if (aav) VARRAY_PUSH_GENERIC_PTR (ops, aav); + if (TREE_CODE (op) == ADDR_EXPR) + bitmap_set_bit (addrargs, i); } current_alias_ops->op_assign (current_alias_ops, lhsAV, - ops, op1); + ops, op1, addrargs); } break; default: @@ -699,28 +723,36 @@ find_func_aliases (tree stp) callvar = get_alias_var (TREE_OPERAND (stp, 0)); if (callvar != NULL) { - int argnum; - VARRAY_GENERIC_PTR_INIT (args, 1, "Arguments"); - bitmap_clear (addrargs); - for (arg = TREE_OPERAND (stp, 1), argnum=0; - arg; - arg = TREE_CHAIN (arg), argnum++) + + /* NORETURN and CONST functions with no return value + have no effect on aliasing (as may be seen above, + const functions that return a value might have an + effect on aliasing, since the return value can point + to one of the arguments. */ + if (call_may_clobber (stp)) { - alias_var aav = get_alias_var (TREE_VALUE (arg)); - if (aav) + int argnum; + VARRAY_GENERIC_PTR_INIT (args, 1, "Arguments"); + bitmap_clear (addrargs); + for (arg = TREE_OPERAND (stp, 1), argnum=0; + arg; + arg = TREE_CHAIN (arg), argnum++) { - VARRAY_PUSH_GENERIC_PTR (args, aav); - if (TREE_CODE (TREE_VALUE (arg)) == ADDR_EXPR) - bitmap_set_bit (addrargs, argnum); + alias_var aav = get_alias_var (TREE_VALUE (arg)); + if (aav) + { + VARRAY_PUSH_GENERIC_PTR (args, aav); + if (TREE_CODE (TREE_VALUE (arg)) == ADDR_EXPR) + bitmap_set_bit (addrargs, argnum); + } + } + if (current_alias_ops->function_call (current_alias_ops, NULL, + callvar, args, addrargs)) + if (!current_alias_ops->ip && flag_argument_noalias != 2) + intra_function_call (args); } - /* NORETURN and CONST functions have no effect on aliasing. */ - if (call_may_clobber (stp)) - if (current_alias_ops->function_call (current_alias_ops, NULL, - callvar, args, addrargs)) - if (!current_alias_ops->ip && flag_argument_noalias != 2) - intra_function_call (args); } } } @@ -753,8 +785,8 @@ create_fun_alias_var (tree decl, int force) tree arg; for (arg = DECL_ARGUMENTS (decl); arg; arg = TREE_CHAIN (arg)) { - alias_var tvar = get_alias_var (arg); - VARRAY_PUSH_GENERIC_PTR (params, tvar); + alias_var var = get_alias_var (arg); + VARRAY_PUSH_GENERIC_PTR (params, var); /* Incoming pointers can point to pta_global_var, unless either we are interprocedural, or we can do ip on all statics + this function has been defined + it's not an @@ -764,7 +796,7 @@ create_fun_alias_var (tree decl, int force) /* FIXME: Need to let analyzer decide in partial case. */ && (!current_alias_ops->ip_partial || !cgraph_local_info (decl)->local)) - current_alias_ops->simple_assign (current_alias_ops, tvar, + current_alias_ops->simple_assign (current_alias_ops, var, get_alias_var (pta_global_var)); } } @@ -777,10 +809,10 @@ create_fun_alias_var (tree decl, int force) arg = TREE_CHAIN (arg)) { tree fakedecl = create_tmp_var_raw (TREE_VALUE (arg), "normarg"); - alias_var tvar; - DECL_CONTEXT (fakedecl) = current_function_decl; - tvar = get_alias_var (fakedecl); - VARRAY_PUSH_GENERIC_PTR (params, tvar); + alias_var var; + DECL_CONTEXT (fakedecl) = current_function_decl; + var = get_alias_var (fakedecl); + VARRAY_PUSH_GENERIC_PTR (params, var); /* Incoming pointers can point to pta_global_var, unless either we are interprocedural, or we can do ip on all @@ -792,7 +824,7 @@ create_fun_alias_var (tree decl, int force) && (!current_alias_ops->ip_partial || !TREE_STATIC (decl) || TREE_PUBLIC (decl))) - current_alias_ops->simple_assign (current_alias_ops, tvar, + current_alias_ops->simple_assign (current_alias_ops, var, get_alias_var (pta_global_var)); } } @@ -804,6 +836,7 @@ create_fun_alias_var (tree decl, int force) { tree fakedecl = create_tmp_var_raw (void_type_node, "fakearg"); alias_var fakevar; + DECL_CONTEXT (fakedecl) = current_function_decl; fakevar = get_alias_var (fakedecl); VARRAY_PUSH_GENERIC_PTR (params, fakevar); } @@ -812,11 +845,13 @@ create_fun_alias_var (tree decl, int force) { rdecl = create_tmp_var_raw (TREE_TYPE (TREE_TYPE (decl)), "_rv_"); retvar = current_alias_ops->add_var (current_alias_ops, rdecl); + DECL_PTA_ALIASVAR (rdecl) = retvar; } else { retvar = current_alias_ops->add_var (current_alias_ops, DECL_RESULT (decl)); + DECL_PTA_ALIASVAR (DECL_RESULT (decl)) = retvar; } VARRAY_PUSH_GENERIC_PTR (alias_vars, retvar); ALIAS_VAR_VARNUM (retvar) = VARRAY_ACTIVE_SIZE (alias_vars) - 1; @@ -833,7 +868,7 @@ create_fun_alias_var (tree decl, int force) } /* Create an alias variable for a pointer-to-member function DECL of - * type TYPE, it's arguments, and it's return value. + type TYPE, it's arguments, and it's return value. Returns the alias_var for the PTF. This includes creating alias_var's for @@ -862,9 +897,10 @@ create_fun_alias_var_ptf (tree decl, tree type) arg = TREE_CHAIN (arg)) { tree fakedecl = create_tmp_var_raw (TREE_VALUE (arg), "ptfarg"); - alias_var tvar; - tvar = get_alias_var (fakedecl); - VARRAY_PUSH_GENERIC_PTR (params, tvar); + alias_var var; + DECL_CONTEXT (fakedecl) = DECL_CONTEXT (decl); + var = get_alias_var (fakedecl); + VARRAY_PUSH_GENERIC_PTR (params, var); } } /* Functions declared like void f() are *not* equivalent to void @@ -875,6 +911,7 @@ create_fun_alias_var_ptf (tree decl, tree type) { tree fakedecl = create_tmp_var_raw (void_type_node, "fakearg"); alias_var fakevar; + DECL_CONTEXT (fakedecl) = DECL_CONTEXT (decl); fakevar = get_alias_var (fakedecl); VARRAY_PUSH_GENERIC_PTR (params, fakevar); } @@ -970,7 +1007,9 @@ create_alias_vars (void) for (vars = cfun->unexpanded_var_list; vars; vars = TREE_CHAIN (vars)) { var = TREE_VALUE (vars); - if (TREE_CODE (var) != LABEL_DECL) + if (TREE_CODE (var) != LABEL_DECL + && decl_function_context (var) == NULL + && DECL_INITIAL (var)) find_func_aliases (var); } } diff --git a/gcc/tree-alias-common.h b/gcc/tree-alias-common.h index 2a445d49d91..45c9e4b8973 100644 --- a/gcc/tree-alias-common.h +++ b/gcc/tree-alias-common.h @@ -45,7 +45,7 @@ struct tree_alias_ops Called to process operators of the form a = op(...), where a is a variable. */ void (*op_assign) (struct tree_alias_ops *, alias_var, varray_type, - tree); + tree, bitmap); /* Process a heap assignment (a = alloc (...)) Called to process a heap assignment of the form a = alloc (...), where a is a variable, and *alloc is a function that @@ -68,14 +68,14 @@ struct tree_alias_ops int (*function_call) (struct tree_alias_ops *, alias_var, alias_var, varray_type, bitmap); - /* Determine if two vars may alias. */ + /* Determine if two alias variables may alias. */ bool (*may_alias) (struct tree_alias_ops *, alias_var, alias_var); - /* Determine if two vars have the same points-to set. */ + /* Determine if two alias variables have the same points-to set. */ bool (*same_points_to_set) (struct tree_alias_ops *, alias_var, alias_var); - /* Determine if the var has an empty points-to set. */ + /* Determine if the alias variable has an empty points-to set. */ bool (*empty_points_to_set) (struct tree_alias_ops *, alias_var); /* Private data. */ diff --git a/gcc/tree-alias-type.c b/gcc/tree-alias-type.c index 117ddb804b7..20bcbf733fd 100644 --- a/gcc/tree-alias-type.c +++ b/gcc/tree-alias-type.c @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "tree-alias-type.h" alias_var -alias_tvar_new_with_aterm (tree decl, struct aterm_ *term) +alias_var_new_with_aterm (tree decl, struct aterm_ *term) { alias_var ret = ggc_alloc (sizeof (struct alias_var_aterm)); ALIAS_VAR_KIND (ret) = ATERM_AVAR; diff --git a/gcc/tree-alias-type.h b/gcc/tree-alias-type.h index ca1c36b1f62..7740e9933d7 100644 --- a/gcc/tree-alias-type.h +++ b/gcc/tree-alias-type.h @@ -37,5 +37,5 @@ typedef union alias_var_def *alias_var; union alias_type_def; typedef union alias_type_def *alias_type; -alias_var alias_tvar_new_with_aterm (tree, struct aterm_ *); +alias_var alias_var_new_with_aterm (tree, struct aterm_ *); #endif |