#define OPT "optimizer"
#define LINKER "linker"
#define COMBINER "combiner"
+#define PRIO "priority"
#define RUNT "rts"
#define NEEDT "need"
#define CALL "callname"
if ( new->t_combine ) twice=YES ;
new->t_combine= YES ;
} else
+ if ( strcmp(ty_name,PRIO)==0 ) {
+ new->t_priority= atoi(bol) ;
+ } else
if ( strcmp(ty_name,PROP)==0 ) {
/* Obsolete by now, to be removed */
for ( ptr=bol ; *ptr ; ptr++ ) {
/******************** data used only while scanning *******************/
+static int last_pcount; /* The added priority of
+ the best path so far */
+
static int last_ncount; /* The # of non-optimizing transformations
in the best path sofar */
scan_found() {
register list_elem *scan;
- int ncount, ocount ;
+ int ncount, ocount, pcount ;
suf_found= 1;
#ifdef DEBUG
if ( debug>=3 ) vprint("Scan found\n") ;
#endif
/* Gather data used in comparison */
- ncount=0; ocount=0;
+ ncount=0; ocount=0; pcount=0;
scanlist(l_first(tr_list),scan) {
if (t_cont(*scan)->t_scan) {
#ifdef DEBUG
if ( debug>=4 ) vprint("%s-",t_cont(*scan)->t_name) ;
#endif
if( t_cont(*scan)->t_optim ) ocount++ ;else ncount++ ;
+ pcount += t_cont(*scan)->t_priority ;
}
}
#ifdef DEBUG
/* Is this transformation better then any found yet ? */
#ifdef DEBUG
if ( debug>=3 ) {
- vprint("old n:%d, o:%d - new n:%d, o:%d\n",
- last_ncount,last_ocount,ncount,ocount) ;
+ vprint("old n:%d, o:%d, p:%d - new n:%d, o:%d, p:%d\n",
+ last_ncount,last_ocount,last_pcount,
+ ncount,ocount,pcount) ;
}
#endif
if ( last_ncount== -1 || /* None found yet */
- last_ncount>ncount || /* Shorter nec. path */
- (last_ncount==ncount && /* Same nec. path, optimize?*/
- (Optflag? last_ocount<ocount : last_ocount>ocount ) ) ) {
+ last_pcount<pcount || /* Better priority */
+ ( last_pcount==pcount && /* Same prio, and */
+ ( last_ncount>ncount || /* Shorter nec. path */
+ (last_ncount==ncount && /* Same nec. path, optimize?*/
+ (Optflag? last_ocount<ocount : last_ocount>ocount ))))) {
/* Yes it is */
#ifdef DEBUG
if ( debug>=3 ) vprint("Better\n");
scanlist(l_first(tr_list),scan) {
t_cont(*scan)->t_bscan=t_cont(*scan)->t_scan;
}
- last_ncount=ncount; last_ocount=ocount;
+ last_ncount=ncount; last_ocount=ocount; last_pcount=pcount;
}
}