This is the mail archive of the gcc@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]

Re: Two other optimization questions.


> How would that source equivalent look like? 

I guess there is a number of options, and it is not clear which one
would be working best. Basically, if you have


// header
struct A{
};

exported template<typename X> A foo(X); //I hope I got the syntax right

//implementation
A bar(int);

struct B{
  int convert(class Foobar);
};

template<typename X>
A foo(X x)
{
  B b;
  return bar(b.convert(x));
}

then storing foo should store the following things:
- the layout and members of A
- the layout and members of B
- all declarations of bar (question: is bar here a dependent name or not?)
- the statements of foo themselves

It might or might not be feasible to store the tree representation of
foo and everything referenced by it. Whether this is a reasonable
approach depends on how compact that representation is. Perhaps it is
more efficient to reconstruct the source from the tree representation,
and store plain source. Getting line information right is then
non-trivial. I guess the entire export business is non-trivial.

Regards,
Martin


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