This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: CALL_EXPR representation part 3/9 (middle-end stuff)


Sandra Loosemore wrote on 02/10/07 10:24:

    if (ws_args)
!     {
!       tree args = tree_cons (NULL, t2,
! 			     tree_cons (NULL, t1,
! 					tree_cons (NULL, val, ws_args)));
!       t = build_function_call_expr (built_in_decls[start_ix], args);
!     }

Are there plans to completely remove this TREE_LIST interface? We could convert WS_ARGS to something more palatable for build_call_expr. A vector of trees should be fine, right?


--- 918,928 ----
if (tree_is_chrec (expr))
return true;
! n = TREE_OPERAND_LENGTH (expr);
! for (i = 0; i < n; i++)
! if (tree_contains_chrecs (TREE_OPERAND (expr, i), size))
! return true;
! return false;
}
Again, starting at 1 instead of 0 should preserve the original intent. In fact, I doubt you should be handling anything above 3.

--- 730,746 ----
node = *tp;
/* 'node' is the parent of 'TREE_OPERAND (node, *)'. */
+ /* ??? Should this be EXPR_P instead of EXPRESSION_CLASS_P? */
if (EXPRESSION_CLASS_P (node))

Yes. Changing this to EXPR_P is fine.


+   /* ??? Should this be EXPR_P instead of EXPRESSION_CLASS_P?  */
    if (EXPRESSION_CLASS_P (parent))
      {
Likewise.

*************** phi_translate (tree expr, bitmap_set_t s
*** 1005,1064 ****
switch (TREE_CODE_CLASS (TREE_CODE (expr)))
{
case tcc_expression:
{
if (TREE_CODE (expr) != CALL_EXPR)
return NULL;
else
{
! tree oldop0 = TREE_OPERAND (expr, 0);
! tree oldval0 = oldop0;
! tree oldarglist = TREE_OPERAND (expr, 1);
! tree oldop2 = TREE_OPERAND (expr, 2);
! tree oldval2 = oldop2;
! tree newop0;
! tree newarglist;
! tree newop2 = NULL;
! tree oldwalker;
! tree newwalker;
! tree newexpr;
tree vh = get_value_handle (expr);
- bool listchanged = false;
bool invariantarg = false;
VEC (tree, gc) *vuses = VALUE_HANDLE_VUSES (vh);
VEC (tree, gc) *tvuses;
! /* Call expressions are kind of weird because they have an
! argument list. We don't want to value number the list
! as one value number, because that doesn't make much
! sense, and just breaks the support functions we call,
! which expect TREE_OPERAND (call_expr, 2) to be a
! TREE_LIST. */
! oldval0 = find_leader_in_sets (oldop0, set1, set2);
! newop0 = phi_translate (oldval0, set1, set2, pred, phiblock);
! if (newop0 == NULL)
return NULL;
! if (oldop2)
{
! oldop2 = find_leader_in_sets (oldop2, set1, set2);
! newop2 = phi_translate (oldop2, set1, set2, pred, phiblock);
! if (newop2 == NULL)
return NULL;
}
! /* phi translate the argument list piece by piece.
! ! We could actually build the list piece by piece here,
! but it's likely to not be worth the memory we will save,
! unless you have millions of call arguments. */
! ! newarglist = pool_copy_list (oldarglist);
! for (oldwalker = oldarglist, newwalker = newarglist;
! oldwalker && newwalker;
! oldwalker = TREE_CHAIN (oldwalker),
! newwalker = TREE_CHAIN (newwalker))
{
! ! tree oldval = TREE_VALUE (oldwalker);
tree newval;
if (oldval)
{
--- 990,1041 ----
switch (TREE_CODE_CLASS (TREE_CODE (expr)))
{
case tcc_expression:
+ return NULL;
+ + case tcc_vl_exp:
{
if (TREE_CODE (expr) != CALL_EXPR)
return NULL;
else
{
! tree oldfn = CALL_EXPR_FN (expr);
! tree oldsc = CALL_EXPR_STATIC_CHAIN (expr);
! tree newfn, newsc = NULL;
! tree newexpr = NULL_TREE;
tree vh = get_value_handle (expr);
bool invariantarg = false;
+ int i, nargs;
VEC (tree, gc) *vuses = VALUE_HANDLE_VUSES (vh);
VEC (tree, gc) *tvuses;
! newfn = phi_translate (find_leader_in_sets (oldfn, set1, set2),
! set1, set2, pred, phiblock);
! if (newfn == NULL)
return NULL;
! if (newfn != oldfn)
{
! newexpr = temp_copy_call_expr (expr);
! CALL_EXPR_FN (newexpr) = get_value_handle (newfn);
! }
! if (oldsc)
! {
! newsc = phi_translate (find_leader_in_sets (oldsc, set1, set2),
! set1, set2, pred, phiblock);
! if (newsc == NULL)
return NULL;
+ if (newsc != oldsc)
+ {
+ if (!newexpr)
+ newexpr = temp_copy_call_expr (expr);
+ CALL_EXPR_STATIC_CHAIN (newexpr) = get_value_handle (newsc);
+ }
}
! /* phi translate the argument list piece by piece. */
! nargs = call_expr_nargs (expr);
! for (i = 0; i < nargs; i++)
{
! tree oldval = CALL_EXPR_ARG (expr, i);
tree newval;
if (oldval)
{

You are dropping the original comments in this code. Do they not apply anymore? ISTM that they are still valid.


Index: gcc/tree-ssa.c
===================================================================
*** gcc/tree-ssa.c (revision 121705)
--- gcc/tree-ssa.c (working copy)
*************** tree_ssa_useless_type_conversion (tree e
*** 955,962 ****
|| TREE_CODE (expr) == VIEW_CONVERT_EXPR
|| TREE_CODE (expr) == NON_LVALUE_EXPR)
return tree_ssa_useless_type_conversion_1 (TREE_TYPE (expr),
! TREE_TYPE (TREE_OPERAND (expr,
! 0)));
return false;
--- 955,962 ----
|| TREE_CODE (expr) == VIEW_CONVERT_EXPR
|| TREE_CODE (expr) == NON_LVALUE_EXPR)
return tree_ssa_useless_type_conversion_1 (TREE_TYPE (expr),
! GENERIC_TREE_TYPE (TREE_OPERAND (expr,
! 0)));
Why GENERIC_TREE_TYPE here? You shouldn't be getting a gimple-stmt here.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]