Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

hyperform.H

Go to the documentation of this file.
00001 /*
00002  * hyperform.H
00003  *
00004  * 4/23/97 WAH:  Created.
00005  * 12/11/97 WAH: Moved sweepops here from IR.
00006  * 1/16/98 WAH:  Added hammock_stats class.
00007  */
00008 
00009 #ifndef LEGORFORM_HYPERBLOCK_HEADER
00010 #define LEGORFORM_HYPERBLOCK_HEADER
00011 
00012 #include <values.h>
00013 #include "TinkerKnobs.H"
00014 
00015 /*
00016  * class hyper_stats
00017  *
00018  * Statistics structure for hyperblock formation - does not work
00019  * yet!!!
00020  */
00021 class hyper_stats
00022 {
00023 
00024 #ifndef WTSIZE
00025 #define WTSIZE (10000)
00026 #endif
00027 
00028 struct idpair
00029 {
00030   int i;  // amount of superblocks with given taildup/op count
00031   double d;  // total weight of these superblocks
00032 }; // end struct idpair
00033 
00034 public:
00035   char *filename;
00036   long super_count;
00037   long td_count;
00038   struct idpair td_stats[WTSIZE];
00039   long op_count;
00040   struct idpair op_stats[WTSIZE];
00041   double total_weight;
00042   // add more stats later
00043 
00044   hyper_stats (char *fn)
00045   {
00046     int i;
00047     
00048     filename = new char [strlen (fn) + 1];
00049     strcpy (filename, fn);
00050     super_count = td_count = op_count = 0;
00051     for (i = 0; i < WTSIZE; i++)
00052       {
00053         td_stats[i].i = op_stats[i].i = 0;
00054         td_stats[i].d = op_stats[i].d = 0.0;
00055       } // end for
00056     total_weight = 0.0;
00057   } // end hyper_stats
00058   void dump (FILE *out)
00059   {
00060     int i;
00061 
00062     fprintf (out, "%s\t%ld\t", filename, super_count);
00063     fprintf (out, "%lf\t",
00064              ((double) td_count) / ((double) super_count));
00065     fprintf (out, "%lf\n",
00066              ((double) op_count) / ((double) super_count));
00067 
00068     if (super_count > 0 && td_count != 0)
00069       {
00070         for (i = 0; i < WTSIZE; i++)
00071           if (td_stats[i].i != 0)
00072             fprintf (out, "\t%d\t%d\t%lf\n", i, td_stats[i].i,
00073                      td_stats[i].d / total_weight);
00074         fprintf (out, "\n");
00075         for (i = 0; i < WTSIZE; i++)
00076           if (op_stats[i].i != 0)
00077             fprintf (out, "\t%d\t%d\t%lf\n", i, op_stats[i].i,
00078                      op_stats[i].d / total_weight);
00079       } // end if
00080     fprintf (out, "\n");
00081     return;
00082   } // end dump
00083 }; // end class hyper_stats
00084 
00085 // void hyperform (legoProc *, ..., hyper_stats * = NULL);
00086 
00087 /*
00088  * class hammock_info
00089  *
00090  * Information about a hammock.
00091  */
00092 class hammock_info
00093 {
00094 public:
00095   legoRegion *S;  // start of hammock
00096   legoRegion *T;  // "then" branch of hammock
00097   legoRegion *E;  // "else" branch of hammock (NULL is delta)
00098   legoRegion *J;  // end (join) of hammock
00099 
00100   hammock_info() {S = T = E = J = NULL;}
00101   int HammockDetected (void) {return (S != NULL);}
00102   int IsDelta (void) {return (E == NULL);}
00103 }; // end class hammock_info
00104 
00105 /*
00106  * class hammock_stats
00107  *
00108  * Statistics structure for hammock conversion.
00109  */
00110 class hammock_stats
00111 {
00112 public:
00113   int numdelta;  // number of deltas found/converted
00114   int numdiamond;  // number of diamonds found/converted
00115 
00116   hammock_stats() {numdelta = numdiamond = 0;}
00117 }; // end class hammock_stats
00118   
00119 
00120 // Routines for simple hammock conversion.
00121 hammock_info *DetectHammock (legoRegion *);
00122 legoRegion *IfConvertHammock (hammock_info *, knobs *);
00123 legoRegion *DetectAndConvertHammock (legoRegion *, knobs *);
00124 int hammock (legoRegion *, int, knobs *, hammock_stats * = NULL);
00125 
00126 extern int NextPredRegNum;  // next available predicate register number
00127 
00128 void sweepops (legoHB *, int = 0);
00129 
00130 legoOp *IfConvertTreeBranch (legoOp *branchop, knobs *K); 
00131 void PredicateTreeBranch (legoOp *branchop); 
00132 
00133 void FullyIfConvertTreeBranch (legoRegion *region, knobs *K); 
00134 void FullyIfConvertTreeBranch (legoTreegion *tree, knobs *K); 
00135 
00136 void IfConvertAndPredicateTreeBranch (legoRegion *region, knobs *K); 
00137 void IfConvertAndPredicateTreeBranch (legoTreegion *tree, knobs *K); 
00138 
00139 void FullyPredicateTreeBranch (legoRegion *region); 
00140 void FullyPredicateTreeBranch (legoTreegion *tree); 
00141 
00142 #endif // LEGORFORM_HYPERBLOCK_HEADER
00143 

Generated on Mon Jul 21 20:24:15 2003 for TINKER LEGO DOC by doxygen 1.3.2