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++?



Yep that's a nice interface for handling CFG nodes.
I saw something like this also in open64.
It's so simple to just say: iterate over all BB in topological order
and just write "for (topological_CFG::iterator i = ..."
:-)

Just an FYI, I reimplemented from scratch (so i wouldn't have to deal with any revealing of code i've been asked not to reveal issues) the graph_traits stuff, and their callgraph stuff, in a C++ based AST optimizer.

The following code actually works:
static CallGraph temp; /* I'm just playing with the callgraph for right now, so ignore this*/
...
extern "C" void update_and_print_call_graph (tree F)
{
temp.update(F);
/* Print out call graph in depth first order */
for (df_iterator<CallGraph *> I = df_begin (&temp,true), E=df_end (&temp); I != E; ++I)
std::cout <<"Call graph node name:"<< IDENTIFIER_POINTER (DECL_NAME (CGN>getFunction())) << std::endl;
}


I've yet to deal with the issue of a Tree class (either by conversion, or abstraction).
Too lazy.
It's just something i play with from time to time.
Though if you guys want to play with a C++ based AST optimizer, i'll throw it on a branch or something (It can construct callgraphs incrementally, and a few other things).
--Dan


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