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]
Other format: [Raw text]

Re: [tree-ssa] AST optimizer in C++?


Pop Sébastian wrote:
Keeping the original tree structure as it is avoids to retranslate the representation back to trees once we're finished. So I'm for abstraction.
I think that we should avoid is to deal with tree structure directly, and build an interface that will abstract existent structures (maybe tree structures will change).
Perhaps something like:

class Tree {
   union tree_node *node;
};

class Decl : public Tree {
  Identifier name () { return DECL_NAME (node); }
};

class VarDecl : public Decl {
};

Or:

class Tree {
  union tree_common common;
}

class Decl : public Tree {
  ... tree_decl fields, excluding common ...;
}

Either might be worth exploring, especially if we can start using
more specific function and variable type specifiers than just tree ...

Long term, I'd be in favor of re-writing the entire ocmpiler in C++,
but as a migration strategy it has to be a *wrapper* around the
existing tree types, and at least for now must allow boostrapping
without an existing C++ compiler.  If the experiment looks promising,
I'd be open to switching the entire compiler to C++, again assuming
it can be done incrmentally, without a total re-write!
--
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/


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