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]

AST-Optimizer and De-Parse


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/


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