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: [lto] PATCH: add more CALL_EXPR interfaces


Ian Lance Taylor wrote:
Sandra Loosemore <sandra@codesourcery.com> writes:

I haven't yet changed the low-level representation of CALL_EXPRs to
actually have a variable number of operands.  My plan is to continue
to use struct tree_exp, and instead of stuffing a TREE_LIST of
arguments in operand 1, put an INT_CST node there that holds the
number of arguments following the fixed operands in the node.  It's a
little icky, but the storage overhead should be negligible (since
integer constants are shared) and it avoids having to special-case
CALL_EXPRs every place where compound expressions are being
manipulated.

I assume this is a temporary maneuver, and that with the new representation the first operand will be an int, not an INT_CST node.

Well, no. Giving these new beasts the same representation as other kinds of expressions using struct tree_exp means that existing places in the code -- tree walkers and the like -- that iterate over the operands of an expression don't need to be special-cased. I think special-casing TREE_OPERAND to account for a different offset to the first "real" operand is a much messier and less efficient solution than maintaining a uniform representation and just treating the argument count itself as an (implicit) operand that needs to be unwrapped.


      default:
!       if (TREE_CODE_CLASS (code) == tcc_call)
! 	return (sizeof (struct tree_exp)
! 		+ (TREE_OPERAND_LENGTH (node) - 1) * sizeof (char *));
!       else
! 	return tree_code_size (code);
      }
  }

Why sizeof (char *)? Why not sizeof (tree)?


I see that TREE_VEC uses sizeof (char *), but that looks weird to me
also.

Well, "why" is because I copied that expression verbatim from tree_code_size and just substituted TREE_OPERAND_LENGTH for TREE_CODE_LENGTH. :-P I can certainly make all these instances use sizeof (tree) instead.


-Sandra


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