This is the mail archive of the 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]: Trying to make list nodes smaller, but the C++ FE keepsbeating me down

Daniel Berlin wrote:

So i added TREE_LIST_WT (WT = With type) for the C++ FE, and was
converting all the users over, but it appears there is magic in here
that i don't understand that is checking in various places. I don't
understand where and when TREE_LIST is supposed to appear in the C++ FE,
and when we expect TREE_TYPE to be valid in it.

One place I suspect you didn't find is BV_VCALL_INDEX. That's a great example of something that shouldn't be a tree. You could find the uses of this macro and replace them with a little struct:

  struct binfo_virtual {
    tree fn;
    tree delta;
    tree vcall_index;
    struct binfo_virtual *next;

Test that, get that checked in, and then try your patch again. I'd also search for all uses of build_list/tree_cons/TREE_PURPOSE/TREE_VALUE and try to find places near there that set TREE_TYPE. Aha, here's one in pt.c:instantiate_class_template:

	  base_list = tree_cons (access, base, base_list);
	  if (BINFO_VIRTUAL_P (pbase_binfo))
	    TREE_TYPE (base_list) = integer_type_node;

OK, that's another place you need a new data structure. Look at xref_basetypes to see how its used. Now replace this base_list thing with a VEC of:

  struct base_descriptor {
    tree base_class;
    tree access; /* For brownie points, use access_kind instead!  */
    bool is_virtual;

And so forth.

Or, if you want to use a really big (and somewhat ugly) hammer, you could try just making every single use of tree_cons/build_list/etc. in the C++ front end use tree_cons_wt (after making sure that TREE_LIST_WT has a TREE_LIST as a prefix), changing all code in the compiler (including middle-end) that handles TREE_LIST to handle both types, and then trying that. It still might not work, if the C++ front end depends on language-independent code giving it back a TREE_LIST with room for a TREE_TYPE, but at least you'd have a better shot. Then, gradually back out handling of TREE_LIST_WT to the C++ front end. Now, I'm not sure if such a patch would be acceptable, but it would be a working methodology.

Mark Mitchell
CodeSourcery, LLC
(916) 791-8304

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