00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 #ifndef GRA_LUNIT_INCLUDED
00073 #define GRA_LUNIT_INCLUDED
00074
00075 #ifndef GRA_LUNIT_RCS_ID
00076 #define GRA_LUNIT_RCS_ID
00077 #ifdef _KEEP_RCS_ID
00078 static char *gra_lunit_rcs_id = "$Source: /scratch/mee/2.4-65/kpro64-pending/be/cg/gra_mon/SCCS/s.gra_lunit.h $ $Revision: 1.2 $";
00079 #endif
00080 #endif
00081
00082 #include "defs.h"
00083 #include "register.h"
00084
00085 #include "gra_bb.h"
00086
00087
00088 class GRA_BB;
00089
00090 enum LU_FLAG {
00091 LUNIT_FLAGS_spill_listed = 0x1,
00092
00093
00094 LUNIT_FLAGS_spill_below = 0x2,
00095
00096
00097 LUNIT_FLAGS_restore_above = 0x4,
00098
00099
00100 LUNIT_FLAGS_split_defreach_out = 0x8,
00101
00102
00103
00104
00105 LUNIT_FLAGS_split_live_in = 0x10,
00106
00107
00108
00109
00110 LUNIT_FLAGS_has_exposed_use = 0x20,
00111
00112
00113 LUNIT_FLAGS_has_def = 0x40,
00114
00115 LUNIT_FLAGS_spill_below_sticks = 0x80,
00116
00117
00118 LUNIT_FLAGS_split_lunit = 0x100,
00119
00120 LUNIT_FLAGS_true_reference = 0x200,
00121 LUNIT_FLAGS_def_from_home = 0x400,
00122
00123
00124 LUNIT_FLAGS_syncs_with_home = 0x800,
00125
00126
00127 };
00128
00129 class LUNIT;
00130 class LRANGE;
00131 class LUNIT_BB_LIST_ITER;
00132 class LUNIT_LRANGE_LIST_ITER;
00133 class LUNIT_SPILL_LIST_ITER;
00134 class LRANGE_LUNIT_ITER;
00135
00136 extern LUNIT* LUNIT_Create( LRANGE* lrange, GRA_BB* gbb );
00137
00138 class LUNIT {
00139 friend class LRANGE;
00140 friend class LUNIT_BB_LIST_ITER;
00141 friend class LUNIT_LRANGE_LIST_ITER;
00142 friend class LUNIT_SPILL_LIST_ITER;
00143 friend class LRANGE_LUNIT_ITER;
00144 friend LUNIT *LUNIT_Create(LRANGE *, GRA_BB*);
00145 private:
00146 LRANGE* lrange;
00147
00148 GRA_BB* gbb;
00149 LUNIT* bb_list_next;
00150 LUNIT* lrange_list_next;
00151 LUNIT* spill_list_next;
00152 float pref_priority;
00153
00154 REGISTER_SET allowed_preferences;
00155
00156
00157
00158
00159
00160
00161 UINT32 flags;
00162 INT def_count;
00163
00164 INT last_def;
00165
00166 #ifdef TARG_IA64
00167 BOOL has_use;
00168 #endif
00169 LRANGE* global_pref;
00170 public:
00171 LUNIT(void) {}
00172 ~LUNIT(void) {}
00173
00174
00175 GRA_BB *Gbb(void) { return gbb; }
00176 LRANGE *Lrange(void) { return lrange; }
00177 void Lrange_Set(LRANGE *lr) { lrange = lr; }
00178 float Pref_Priority(void) { return pref_priority; }
00179 REGISTER_SET Allowed_Preferences(void) { return allowed_preferences; }
00180 INT Def_Count(void) { return def_count; }
00181 void Def_Count_Set(INT d) { def_count = d; }
00182 INT Last_Def(void) { return last_def; }
00183 void Last_Def_Set(INT ld) { last_def = ld; }
00184 LRANGE *Global_Pref(void) { return global_pref; }
00185 void Global_Pref_Set(LRANGE *lr){ global_pref = lr; }
00186
00187
00188 BOOL Has_Exposed_Use(void) { return flags & LUNIT_FLAGS_has_exposed_use; }
00189 void Has_Exposed_Use_Set(void){ flags |= LUNIT_FLAGS_has_exposed_use; }
00190 BOOL Has_Def(void) { return flags & LUNIT_FLAGS_has_def; }
00191 void Has_Def_Set(void) { flags |= LUNIT_FLAGS_has_def; }
00192 #ifdef TARG_IA64
00193 BOOL Has_Use(void) {return has_use; }
00194 void Has_Use_Set(void) { has_use = TRUE;}
00195 #endif
00196 BOOL Spill_Below_Sticks(void){ return flags & LUNIT_FLAGS_spill_below_sticks; }
00197 void Spill_Below_Sticks_Set(void){ flags |= LUNIT_FLAGS_spill_below_sticks; }
00198 BOOL Split_Lunit(void) { return flags & LUNIT_FLAGS_split_lunit; }
00199 void Split_Lunit_Set(void){ flags |= LUNIT_FLAGS_split_lunit; }
00200 BOOL True_Reference(void) { return flags & LUNIT_FLAGS_true_reference; }
00201 void True_Reference_Set(void){ flags |= LUNIT_FLAGS_true_reference; }
00202 BOOL Def_From_Home(void) { return flags & LUNIT_FLAGS_def_from_home; }
00203 void Def_From_Home_Set(void){ flags |= LUNIT_FLAGS_def_from_home; }
00204 void Def_From_Home_Reset(void){ flags &= ~LUNIT_FLAGS_def_from_home; }
00205 BOOL Syncs_With_Home(void){ return flags & LUNIT_FLAGS_syncs_with_home; }
00206 void Syncs_With_Home_Set(void){ flags |= LUNIT_FLAGS_syncs_with_home; }
00207 void Syncs_With_Home_Reset(void){ flags &= ~LUNIT_FLAGS_syncs_with_home; }
00208 BOOL Spill_Listed(void) { return flags & LUNIT_FLAGS_spill_listed; }
00209 void Spill_Listed_Set(void){ flags |= LUNIT_FLAGS_spill_listed; }
00210 void Spill_Listed_Reset(void){ flags &= ~LUNIT_FLAGS_spill_listed; }
00211 BOOL Restore_Above(void) { return flags & LUNIT_FLAGS_restore_above; }
00212 void Restore_Above_Set(void){ flags |= LUNIT_FLAGS_restore_above; }
00213 void Restore_Above_Reset(void){ flags &= ~LUNIT_FLAGS_restore_above; }
00214 BOOL Split_Defreach_Out(void) { return flags & LUNIT_FLAGS_split_defreach_out; }
00215 void Split_Defreach_Out_Set(void){ flags |= LUNIT_FLAGS_split_defreach_out; }
00216 BOOL Split_Live_In(void) { return flags & LUNIT_FLAGS_split_live_in; }
00217 void Split_Live_In_Set(void){ flags |= LUNIT_FLAGS_split_live_in; }
00218 BOOL Spill_Below(void) { return flags & LUNIT_FLAGS_spill_below; }
00219 void Spill_Below_Set(void){ flags |= LUNIT_FLAGS_spill_below; }
00220 void Spill_Below_Reset(void){ flags &= ~LUNIT_FLAGS_spill_below; }
00221
00222
00223 LUNIT* BB_List_Push(LUNIT* new_elt) { new_elt->bb_list_next = this;
00224 return new_elt; }
00225 LUNIT* Lrange_List_Push(LUNIT* new_elt) { new_elt->lrange_list_next = this;
00226 return new_elt; }
00227 LUNIT* Spill_List_Push(LUNIT *new_elt) { new_elt->spill_list_next = this;
00228 return new_elt; }
00229
00230
00231 void Preference_Copy(LRANGE *);
00232 BOOL Live_Out(void);
00233 BOOL Live_In(void);
00234 float Priority(void);
00235 };
00236
00237
00238
00239
00240
00241 class LUNIT_BB_LIST_ITER {
00242 LUNIT* current;
00243 LUNIT* next;
00244 public:
00245 LUNIT_BB_LIST_ITER(void) {}
00246 ~LUNIT_BB_LIST_ITER(void) {}
00247
00248 void Init(LUNIT *head) { current = head;
00249 if ( current != NULL )
00250 next = current->bb_list_next; }
00251 BOOL Done(void) { return current == NULL; }
00252 LUNIT *Current(void) { return current; }
00253 void Step(void) { current = next;
00254 if (next != NULL)
00255 next = next->bb_list_next; }
00256 };
00257
00258
00259
00260
00261
00262 class LUNIT_LRANGE_LIST_ITER {
00263 LUNIT* current;
00264 LUNIT* next;
00265 public:
00266 LUNIT_LRANGE_LIST_ITER(void) {}
00267 ~LUNIT_LRANGE_LIST_ITER(void) {}
00268
00269 void Init(LUNIT *head) { current = head;
00270 if ( current != NULL )
00271 next = current->lrange_list_next; }
00272 BOOL Done(void) { return current == NULL; }
00273 LUNIT *Current(void) { return current; }
00274 void Step(void) { current = next;
00275 if (next != NULL)
00276 next = next->lrange_list_next; }
00277 };
00278
00279
00280
00281
00282 class LUNIT_SPILL_LIST_ITER {
00283 LUNIT* current;
00284 public:
00285 LUNIT_SPILL_LIST_ITER(void) {}
00286 ~LUNIT_SPILL_LIST_ITER(void) {}
00287
00288 void Init(LUNIT *head) { current = head; }
00289 BOOL Done(void) { return current == NULL; }
00290 LUNIT *Current(void) { return current; }
00291 void Step(void) { current = current->spill_list_next; }
00292 };
00293
00294 #ifndef TARG_IA64
00295 extern LUNIT* LUNIT_Create( LRANGE* lrange, GRA_BB* gbb );
00296 #endif
00297
00298 #endif
00299