public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: AST-Optimizer and De-Parse
@ 2002-04-20  3:52 James Michael DuPont
  2002-04-23  7:49 ` Diego Novillo
  0 siblings, 1 reply; 9+ messages in thread
From: James Michael DuPont @ 2002-04-20  3:52 UTC (permalink / raw)
  To: Diego Novillo; +Cc: Nathan Sidwell, gcc, sander, marc-alexandre.autret, sander

Diego,

Got the ast-optimizer-branch cc1 compiled from
cvs.
Working, but have some questions.

Used the invocation:
../cc1 step1_raw.c -fdump-tree-simple
-fdump-tree-simple-unparse -ftree-ssa

Here is the original code 
http://introspector.sourceforge.net/vcg/step1_original.c
\r\rFirst I ran the ccp over the code, and
then Indent.

That produced a readable input,
so that solves the problem of the stupid uglifier.
Also it is good that I can read german!

Here you will find the input that I passed to the
compiler :
http://introspector.sourceforge.net/vcg/vcg_pl_956a/vcg_pl_956a.c

Here you will find the output of the 
http://introspector.sourceforge.net/vcg/vcg_pl_956a.c.simple

The one part of the simplified code is very strange at
theis point
73-        void T.1;
74-        void T.2;
75:        <<< error >>>;
76-        T.1;
77:        <<< error >>>;
78-        T.2;
79-        exit (1);

I ran the code through the introspector 
You will find one xml and one sql file perl 
function. 
I was hoping that you might find that interesting!

here is a tgz of the entire output with all files from
this test run,\rincluding all xml, and sql files from
the introspector.
\r\rPI-LINK-c8bf8ccf6ee2640509327c69defb671f7bb49727

I think the next step is to clean up all
of the source files in this way and to try and
recompiling and testing the 'cleaned' files

Hope to hear from you,
Mike

=====
James Michael DuPont

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: AST-Optimizer and De-Parse
  2002-04-20  3:52 AST-Optimizer and De-Parse James Michael DuPont
@ 2002-04-23  7:49 ` Diego Novillo
  2002-04-23  9:33   ` James Michael DuPont
  0 siblings, 1 reply; 9+ messages in thread
From: Diego Novillo @ 2002-04-23  7:49 UTC (permalink / raw)
  To: James Michael DuPont
  Cc: Nathan Sidwell, gcc, sander, marc-alexandre.autret, sander

On Sat, 20 Apr 2002, James Michael DuPont wrote:

> Here you will find the input that I passed to the
> compiler :
> http://introspector.sourceforge.net/vcg/vcg_pl_956a/vcg_pl_956a.c
> 
> Here you will find the output of the 
> http://introspector.sourceforge.net/vcg/vcg_pl_956a.c.simple
> 
> The one part of the simplified code is very strange at
> theis point
> 73-        void T.1;
> 74-        void T.2;
> 75:        <<< error >>>;
> 76-        T.1;
> 77:        <<< error >>>;
> 78-        T.2;
> 79-        exit (1);
> 
The <<< error >>>> markers mean that the simplifier produced an
incorrect tree node.  I committed a few bug fixes yesterday.  I'd
suggest upgrading your local tree and re-build the compiler.

Thanks for testing the code.  This will help us fix all the bugs
and add missing features.

> here is a tgz of the entire output with all files from
> this test run, including all xml, and sql files from
> the introspector. http://introspector.sourceforge.net/vcg.tgz
>
Thanks.  What do I need to browse the xml files?


Diego.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: AST-Optimizer and De-Parse
  2002-04-23  7:49 ` Diego Novillo
@ 2002-04-23  9:33   ` James Michael DuPont
  0 siblings, 0 replies; 9+ messages in thread
From: James Michael DuPont @ 2002-04-23  9:33 UTC (permalink / raw)
  To: Diego Novillo; +Cc: Nathan Sidwell, gcc, sander, marc-alexandre.autret, sander

> incorrect tree node.  I committed a few bug fixes
> yesterday.  I'd
> suggest upgrading your local tree and re-build the
> compiler.
Yes I will do that, I am interested in the
ast-optimizer.

I would like to get the output in a format :

1. Directory per Modules
Two files per function, one for the original and the 
second for the optimised.

> Thanks for testing the code.  This will help us fix
> all the bugs
> and add missing features.

> Thanks.  What do I need to browse the xml files?
The only program that uses the xml right now is the
perl of the introspector.

The XML is a graph produced by the c-dumper.

The patches are located 
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/introspector/introspector/c_files/

You might be interested in using the
introspector-dumper for the helping to view and debug
the ast-optimiser. 

I have some ouputs for graphvis/vcg and sql.

mike

=====
James Michael DuPont

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: AST-Optimizer and De-Parse
  2002-04-10  8:56       ` James Michael DuPont
@ 2002-04-10  9:20         ` Diego Novillo
  0 siblings, 0 replies; 9+ messages in thread
From: Diego Novillo @ 2002-04-10  9:20 UTC (permalink / raw)
  To: James Michael DuPont; +Cc: Nathan Sidwell, gcc

On Wed, 10 Apr 2002, James Michael DuPont wrote:

> > Sure.  It is not, however, enabled by any -f switch
> > at the moment. 
> > We've been using it directly from gdb.  
> 
> Have you setup any commands to do that? 
>
The two functions you want to call are debug_c_node() and
debug_c_tree().  debug_c_node() unparses a single tree node,
while debug_c_tree() follows the TREE_CHAIN links:

(gdb) call unparse_c_node (t)

If you want to setup a gdb macro, add this to ~/.gdbinit:

define pts
if ($arg0 != -1)
set $NODE=$arg0
end
set debug_c_node ($NODE)
end


> What would you suggest, I am a little confused.
> Does the dump-tree-simple-unparse do what is needed or
> does it have to be added in first?
> 
That one exists already.  The problem is that it is called when
simplifying functions (which is fairly broken at the moment).  
If you want to try it, compile your file with '-ftree-ssa
-fdump-tree-simple-unparse'.  You should get a .c.simple file
with all the functions in the file before and after
simplification.


> I will look into this soon, but dont know how much
> time i'll get, but I will try tonight. I am really
> interested in the ast-opt. branch anyway, this will be
> a good starting point.
> 
If you want to add a generic unparsing switch, I would start by
replicating the code for -fdump-tree-XXX in the C++ front-end
(cp/optimize.c:dump_function).  A good place to put an entry
point to it would be right before/after the call to the tree SSA
transformations in c-decl.c:c_expand_body.


Diego.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: AST-Optimizer and De-Parse
  2002-04-09  5:43     ` Diego Novillo
@ 2002-04-10  8:56       ` James Michael DuPont
  2002-04-10  9:20         ` Diego Novillo
  0 siblings, 1 reply; 9+ messages in thread
From: James Michael DuPont @ 2002-04-10  8:56 UTC (permalink / raw)
  To: Diego Novillo; +Cc: Nathan Sidwell, gcc

Sorry for my beginner questions that follow,
I will read up on them anyway, but maybe you have a
quick answer.

> Sure.  It is not, however, enabled by any -f switch
> at the moment. 
> We've been using it directly from gdb.  

Have you setup any commands to do that? 
I really don't know anything about making gdb-callable
functions like the p for trees. 
I know that you can call any function from the gdb
that you want, so you just make an alias?

>The only
> switch that uses it is
> -fdump-tree-simple-unparse, which dumps the function
> before and after
> simplification.
So that is enabled?
> 
> Feel free to add a new -f switch if you want to
> invoke it independently.
What would you suggest, I am a little confused.
Does the dump-tree-simple-unparse do what is needed or
does it have to be added in first?

I will look into this soon, but dont know how much
time i'll get, but I will try tonight. I am really
interested in the ast-opt. branch anyway, this will be
a good starting point.

mike

=====
James Michael DuPont

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: AST-Optimizer and De-Parse
  2002-04-08 23:10   ` James Michael DuPont
@ 2002-04-09  5:43     ` Diego Novillo
  2002-04-10  8:56       ` James Michael DuPont
  0 siblings, 1 reply; 9+ messages in thread
From: Diego Novillo @ 2002-04-09  5:43 UTC (permalink / raw)
  To: James Michael DuPont; +Cc: Nathan Sidwell, gcc

On Tue, 2002-04-09 at 02:01, James Michael DuPont wrote:

> Just wanted to know if it is ready to be tested.
>
Sure.  It is not, however, enabled by any -f switch at the moment. 
We've been using it directly from gdb.  The only switch that uses it is
-fdump-tree-simple-unparse, which dumps the function before and after
simplification.

Feel free to add a new -f switch if you want to invoke it independently.


Diego.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: AST-Optimizer and De-Parse
  2002-04-08 16:52 ` Diego Novillo
@ 2002-04-08 23:10   ` James Michael DuPont
  2002-04-09  5:43     ` Diego Novillo
  0 siblings, 1 reply; 9+ messages in thread
From: James Michael DuPont @ 2002-04-08 23:10 UTC (permalink / raw)
  To: Diego Novillo; +Cc: Nathan Sidwell, gcc

Thanks Diago,
I remember you telling me about the deparser,
Just wanted to know if it is ready to be tested.
This is a good test because we have nothing to loose,
and only to gain!

> You don't really need the unparser in the AST
> branch, you could achieve
> the same with GNU indent.
Yes, I have heard, cpp the comments and macros out
into a branch for debian and then indent. 
We can be safly interested in the code for the GNU
projects and dont need to macros for every compiler. I
mean it can also be made non-ansi again later :).

> 
> But, sure, the unparser in the AST branch could
> pretty print this.  
Great, I would like to try it out.

>The
> one caveat with it, is that currently we do not
> guarantee that you'll
> get compilable code.  
Right not it is not readable code!

> It's mainly for debugging
> purposes.  Check
> c-pretty-print.c in the AST branch.

It might turn out to be interesting....
I will be trying that out soon, keep you posted...

Thanks,
mike

=====
James Michael DuPont

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: AST-Optimizer and De-Parse
  2002-04-08  8:16 James Michael DuPont
@ 2002-04-08 16:52 ` Diego Novillo
  2002-04-08 23:10   ` James Michael DuPont
  0 siblings, 1 reply; 9+ messages in thread
From: Diego Novillo @ 2002-04-08 16:52 UTC (permalink / raw)
  To: James Michael DuPont; +Cc: Nathan Sidwell, gcc

On Mon, 2002-04-08 at 11:16, James Michael DuPont wrote:

> would it be possible to use some form of de-parse to
> extract the code and pretty print it back out?
> 
You don't really need the unparser in the AST branch, you could achieve
the same with GNU indent.

But, sure, the unparser in the AST branch could pretty print this.  The
one caveat with it, is that currently we do not guarantee that you'll
get compilable code.  It's mainly for debugging purposes.  Check
c-pretty-print.c in the AST branch.


Diego.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* AST-Optimizer and De-Parse
@ 2002-04-08  8:16 James Michael DuPont
  2002-04-08 16:52 ` Diego Novillo
  0 siblings, 1 reply; 9+ messages in thread
From: James Michael DuPont @ 2002-04-08  8:16 UTC (permalink / raw)
  To: nathan; +Cc: gcc

Dear Nathan and gcc developers,

I was wondering about the current status of the
ast-optimiser and have an interesting challenge.

There is a nice tool graph-layout called VCG that is
GPLd, 
unfortunatly the core it was "uglified" for various
reasons. 

The debian distribution has the uglified code as part
of the distribution because it was shown that code
could be extracted out with some work.

The package is located
http://packages.debian.org/unstable/graphics/vcg.html

I remember reading that the ast-opt. branch was to
include some deparsing.

would it be possible to use some form of de-parse to
extract the code and pretty print it back out?

That would allow the better usage of the code in
future GNU projects.

Following is an example code from the "step1.c" in the
source of the vcg module.
Here is an example function: insert_anchor_edges
<--------------- SNIP -----------------
#ifdef ANSI_C
void insert_anchor_edges(void)
#else
void insert_anchor_edges()
#endif
{ GEDGE edge; ; assert((dummylist==NULL)); edge =
edgelist; while (edge) { /*;chor_edges()
{;*/ if ( ((( edge )->anchor) /*;{;*/ <=64) && (((
edge )->anchor) /*;{;*/ >0) /*;{
dge;;*/ &&(!(( edge )->invisible) /*;dge;;*/ )) 
gs_ide34 (edge); edge = (( edge )->next) /*;
(dummylist==NULL));;*/ ; } edge = tmpedgelist; while
(edge) { if ( ((( edge )->anchor) /*;
>invisible) /+;R/SC;yy+NT )) ;*/ <=64) && ((( edge
)->anchor) /*;>invisible) /+;
R/SC;yy+NT )) ;*/ >0) &&(!(( edge )->invisible)
/*;gs_ide34 (edge);;
*/ ))  gs_ide34 (edge); edge = (( edge
)->internal_next) /*;};*/ ; } }
#ifdef ANSI_C
static void gs_ide34 (GEDGE edge)
#else
static void gs_ide34 (edge) GEDGE edge;
#endif
{ GEDGE h; GNODE v; CONNECT c1,c2; ; if
((G_orientation==1 /*;/+D/+ edge;
;*/ )||(G_orientation==2 /*;/+D/+ edge;;*/ )) {
G_orientation= 0 /*;
{;*/ ; if (!silent) {  FPRINTF(stderr,"Orientation
ignored, because"); /*; c1,c2;
;;*/  FPRINTF(stderr," edge attribute `anchor' used
!\n"); } } c1 = (( (( edge )->start) /*;
0 /+;R/SC;yy+NT ;;*/ )->connection) /*; 0
/+;R/SC;yy+NT ;;*/ ; if (!c1) { /*;if (!silent) { 
(stderr, ;rientation ignored, because );*/   v =
gs_ide14 (-1); (( v )->invisible) /*;,  edge attribute
`anchor' used !zn );
;*/ = 0; (( v )->level) /*;};*/ = (( (( edge )->start)
/*;};*/ )->level) /*;
};*/ ; (( v )->nhorder) /*;};*/ = (( (( edge )->start)
/*;};*/ )->nhorder) /*;
};*/ ; (( v )->anchordummy) /*; (( edge )->start)
/+;R/SC;yy+NT )->con;
*/ = 1; h = tmpedgealloc( (( edge )->linestyle)
/*;ide14 (-1);;*/ ,  (( edge )->thickness) /*;
ble) /+;R/SC;yy+NT = 0;;*/ ,  (( edge )->eclass)
/*;C;yy+NT = (( (( edge )->start) /+;
R/SC;;*/ , 200, (( edge )->color) /*;= 1;;*/ ,  ((
edge )->labelcolor) /*;
= tmpedgealloc(;*/ ,  0, (( edge )->arrowsize2)
/*;ness) /+;R/SC;yy+NT , ;
*/ ,  0 /*;/SC;yy+NT ,;*/ ,  (( edge )->arrowstyle2)
/*;200,;*/ ,  (( edge )->arrowcolor1) /*;
)->color) /+;R/SC;yy+NT , ;*/ ,  (( edge
)->arrowcolor2) /*;elcolor) /+;
R/SC;yy+NT , ;*/ ,  (( edge )->horder) /*;0,;*/ ); ((
h )->anchor) /*;
)->arrowsize2) /+;R/SC;yy+NT , ;*/ = 66; (( h
)->start) /*;T , ;*/ = (( edge )->start) /*;
T , ;*/ ; (( h )->end) /*;2) /+;R/SC;yy+NT , ;*/ = v;
(( h )->label) /*;
/SC;yy+NT , ;*/ = NULL; c1 = connectalloc((( h
)->start) /*;NT , ;*/ ); /*;NT , 
edge )->horder) /+;R/SC;yy+NT );;*/ (( c1 )->target)
/*; edge )->horder) /+;R/SC;yy+NT );;*/ = v; (( c1
)->edge) /*;
nchor) /+;R/SC;yy+NT = 66;;*/ = h; c2 =
connectalloc(v); (( c2 )->target) /*;
+NT = v;;*/ = (( h )->start) /*;+NT = v;;*/ ; (( c2
)->edge) /*; NULL;
;*/ = h; } v = (( c1 )->target) /*;1 )->target)
/+;R/SC;yy+NT = v;;*/ ; /*;1 )->target) /+;R/SC;yy+NT
= v;
ge) /+;R/SC;yy+NT = h;;*/   assert((v)); assert(((( v
)->anchordummy) /*;v);;*/ )); h = tmpedgealloc(
/*;yy+NT = (( h )->start) /+;R/SC;yy+NT ;
;;*/ (( edge )->linestyle) /*;;;*/ , (( edge
)->thickness) /*;};*/ , (( edge )->eclass) /*;
c1 )->target) /+;R/SC;yy+NT ; ;*/ , (( edge
)->priority) /*;assert((v));
;*/ , (( edge )->color) /*;((( v )->anchordummy)
/+;R/SC;yy+NT ));;*/ , /*;((( v )->anchordummy)
/+;R/SC;yy+NT ));
oc(;*/ (( edge )->labelcolor) /*;oc(;*/ , (( edge
)->arrowsize1) /*; /+;R/SC;
yy+NT ,;*/ , (( edge )->arrowsize2) /*;C;yy+NT ,;*/ ,
(( edge )->arrowstyle1) /*;
(( edge )->eclass) /+;R/SC;yy+NT ,;*/ , (( edge
)->arrowstyle2) /*; )->priority) /+;
R/SC;yy+NT ,;*/ , (( edge )->arrowcolor1) /*;or)
/+;R/SC;yy+NT ,;*/ , (( edge )->arrowcolor2) /*;
) /+;R/SC;yy+NT ,;*/ , (( edge )->horder) /*;SC;yy+NT
,;*/ ); (( h )->anchor) /*;
T ,;*/ = - (( edge )->anchor) /*;T ,;*/ ; (( h
)->start) /*; edge )->arrowstyle1) /+;
R/SC;yy+NT ,;*/ = v; (( h )->end) /*;->arrowstyle2)
/+;R/SC;yy+NT ,;
*/ = (( edge )->end) /*;->arrowstyle2) /+;R/SC;yy+NT
,;*/ ; (( h )->label) /*;
color1) /+;R/SC;yy+NT ,;*/ = (( edge )->label)
/*;color1) /+;R/SC;yy+NT ,;
*/ ; delete_adjedge(edge); (( edge )->invisible) /*;NT
);;*/ = 0; create_adjedge(h); /*;edge )->anchor)
/+;R/SC;yy+NT ;
)->start) /+;R/SC;yy+NT = v;;*/ }


=====
James Michael DuPont

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2002-04-23 16:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-20  3:52 AST-Optimizer and De-Parse James Michael DuPont
2002-04-23  7:49 ` Diego Novillo
2002-04-23  9:33   ` James Michael DuPont
  -- strict thread matches above, loose matches on Subject: below --
2002-04-08  8:16 James Michael DuPont
2002-04-08 16:52 ` Diego Novillo
2002-04-08 23:10   ` James Michael DuPont
2002-04-09  5:43     ` Diego Novillo
2002-04-10  8:56       ` James Michael DuPont
2002-04-10  9:20         ` Diego Novillo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).