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

RU_manager.h

Go to the documentation of this file.
00001 /******************************************************************************\
00002  *
00003  *  File:  RU_manager.h (Resource Usage Manager)
00004  *
00005  *  Description:
00006  *    Header file for resource usage manager
00007  *
00008  *  Creation Date : May 1993
00009  *
00010  *  Authors : Scott Mahlke, John Gyllenhaal
00011  *
00012  *  Revision 1.1.1.1  1995/08/30 16:49:02  david
00013  *  Import of IMPACT source
00014  *
00015  * Revision 1.1  1994/01/19  18:49:06  roger
00016  * Initial revision
00017  *
00018  * Lavery - Added external functions RU_number_of_alts() and 
00019  * 6/94     RU_update_usage_count() 
00020  *
00021 \******************************************************************************/
00022 #ifndef RU_MANAGER_H
00023 #define RU_MANAGER_H
00024 
00025 #include <stdio.h>
00026 #include <malloc.h>
00027 #include <stdarg.h>
00028 //#include <Lcode/l_code.h>
00029 #include "lmdes.h"
00030 #include "sm_mdes.h"
00031 #include "mdes2.h" 
00032 
00033 #define RU_MAP_DEFAULT_SIZE             128
00034 
00035 #define RU_MODE_ACYCLIC                 0
00036 #define RU_MODE_CYCLIC                  1
00037 
00038 /*=========================================================================*/
00039 /*
00040  *      Data structures
00041  */
00042 /*=========================================================================*/
00043 
00044 /*
00045  *      Memory allocation structures
00046  */
00047 
00048 typedef struct _RU_Alloc_Header
00049 {
00050         struct _RU_Alloc_Header   *next;
00051 } RU_Alloc_Header;
00052 
00053 typedef struct _RU_Alloc_Data
00054 {
00055         RU_Alloc_Header *head;          /* Pointer to head of free list */
00056         int             allocated;      /* Number allocated */
00057         int             free;           /* Number free */
00058 } RU_Alloc_Data;
00059 
00060 /*
00061  *      RU info structure associated with each Lcode op
00062  */
00063 
00064 #define RU_SELECTED_ALT(info)((Mdes_Alt *)(info->selected_alt))
00065 #define RU_SELECTED_ALT_ID(info)((int)(info->selected_alt->id))
00066 
00067 typedef struct _RU_Info
00068 {
00069         struct legoOp           *op;            /* debugging purpose only */
00070         int             proc_opc;       /* opcode */ /*HZ: to make it compatible
00071                                          to IA64 style opcode class, use base
00072                                          opcode here instead */
00073         int             *pred;          /* indices of predicates used by op */
00074         Mdes_Alt        *selected_alt;  /* alternative selected by RU manager */
00075         int             issue_time;     /* time op is issued at */
00076         int             slot_used;      /* slot op is placed in */
00077 } RU_Info;
00078 
00079 /*
00080  *      RU map structure
00081  */
00082 
00083 typedef struct _RU_Node
00084 {
00085         RU_Info         *info;
00086         SM_Choice       *choice;
00087         int             option_num;
00088         struct _RU_Node *prev_node;
00089         struct _RU_Node *next_node;
00090 } RU_Node;
00091 
00092 typedef struct _RU_Map
00093 {
00094         int             *resources_mask;
00095         RU_Node         *first_node;
00096         RU_Node         *last_node;
00097 } RU_Map;
00098 
00099 /*=========================================================================*/
00100 /*
00101  *      Global variables
00102  */
00103 /*=========================================================================*/
00104 
00105 extern RU_Map *RU_map;
00106 extern int RU_map_length;
00107 extern int RU_map_mode;
00108 extern int RU_map_cycles;
00109 extern int *RU_mask;
00110 extern int RU_mask_width;
00111 extern int RU_max_pred;
00112 
00113 /*=========================================================================*/
00114 /*
00115  *      External functions
00116  */
00117 /*=========================================================================*/
00118 
00119 /*
00120  *      RU_pred
00121  */
00122 extern void RU_set_max_pred (int);
00123         /* (int max) */
00124 
00125 extern int *RU_pred_alloc ();
00126         /* () */
00127 
00128 extern void RU_pred_free (int *);
00129         /* (int *ptr) */
00130 
00131 extern void RU_pred_print_alloc_data (FILE *, int);
00132         /* (FILE *F, int verbose) */
00133 
00134 /*
00135  *      RU_info
00136  */
00137 extern RU_Info *RU_info_alloc ();
00138         /* () */
00139 
00140 extern void RU_info_free (RU_Info *);
00141         /* (RU_Info *ptr) */
00142 
00143 extern void RU_info_print_alloc_data (FILE *, int);
00144         /* (FILE *F, int verbose) */
00145 
00146 extern RU_Info *RU_info_create (legoOp *, int *);
00147         /* (legoOp *op, int *pred) */
00148 
00149 extern void RU_info_delete (RU_Info *);
00150         /* (RU_Info *info) */ 
00151 
00152 /*
00153  *      RU_node
00154  */
00155 extern RU_Node *RU_node_alloc ();
00156         /* () */
00157 
00158 extern void RU_node_free (RU_Node *);
00159         /* (RU_Node *ptr) */
00160 
00161 extern void RU_node_print_alloc_data (FILE *, int);
00162         /* (FILE *F, int verbose) */
00163 
00164 extern RU_Node *RU_node_create (RU_Info *);
00165         /* (RU_Info *info) */
00166 
00167 extern void RU_node_delete (RU_Map *, RU_Node *);
00168         /* (RU_Map *map, RU_Node *node) */
00169 
00170 extern void RU_node_delete_all (RU_Node *);
00171         /* (RU_Node *list) */
00172 
00173 extern void RU_node_insert_before (RU_Map *, RU_Node *, RU_Node *);
00174         /* (RU_Map *map, RU_Node *before_node, RU_Node *node) */
00175 
00176 extern void RU_node_insert_after (RU_Map *, RU_Node *, RU_Node *);
00177         /* (RU_Map *map, RU_Node *after_node, RU_Node *node) */
00178 
00179 extern RU_Node *RU_node_find (RU_Node *, RU_Info *, Mdes_Rused *);
00180         /* (RU_Node *list, RU_Info *ru_info, Mdes_Rused *rused) */
00181 
00182 /*
00183  *      RU_map
00184  */
00185 extern void RU_map_create (int);
00186         /* (int length) */
00187 
00188 extern void RU_map_realloc ();
00189         /* () */
00190 
00191 extern void RU_map_init (int, int);
00192         /* (int mode, int cycles) */
00193         /* mode = RU_ACYCLIC_MODE or RU_CYCLIC_MODE, cycles only matters for
00194            cyclic mode to specify ii for cyclic schedule. */
00195 
00196 extern void RU_map_delete ();
00197         /* () */
00198 
00199 /*
00200  *      Resource MII functions
00201  */
00202 extern int RU_number_of_alts(RU_Info *, Mdes_Info *, int);
00203         /* (RU_Info *ru_info, Mdes_Info *mdes_info, int flags) */
00204 
00205 extern void RU_update_usage_count(RU_Info *, Mdes_Info *, int *, int);
00206       /* (RU_Info *ru_info, Mdes_Info *mdes_info, int *ru_count, int flags) */
00207 
00208 /*
00209  *      RU_map scheduling functions
00210  */
00211 extern int RU_alt_flags_compatible (RU_Info *, Mdes_Alt *, int);
00212         /* (RU_Info *ru_info, Mdes_Alt *alt, int flags) */
00213 
00214 extern int RU_can_place (int, SM_Choice *, int);
00215         /* (int issue_time, SM_Choice *choice, int option_num) */
00216 
00217 extern void RU_place (int, SM_Choice *, int, RU_Info *);
00218         /* (int issue_time, SM_Choice *choice, int option_num,
00219             RU_Info *ru_info) */
00220 
00221 extern void RU_unplace (int, SM_Choice *, RU_Info *);
00222         /* (int issue_time, SM_Choice *choice, RU_Info *ru_info) */
00223 
00224 extern int RU_schedule_op (RU_Info *, Mdes_Info *, int *, int, int, int, int);
00225         /* (RU_Info *ru_info, Mdes_Info *mdes_info, int *operand_ready_times,
00226             int issue_time, int earliest_slot, int latest_slot, int flags) */
00227         /* (return = slot scheduled in, -1 if cannot be scheduled) */
00228 
00229 extern int RU_schedule_op_reverse (RU_Info *, Mdes_Info *, int *, int, int, int, int);
00230         /* (RU_Info *ru_info, Mdes_Info *mdes_info, int *operand_ready_times,
00231             int issue_time, int earliest_slot, int latest_slot, int flags) */
00232         /* (return = slot scheduled in, -1 if cannot be scheduled) */
00233 
00234 extern int RU_can_schedule_op (RU_Info *, Mdes_Info *, int *, int, int, int, int);
00235         /* (RU_Info *ru_info, Mdes_Info *mdes_info, int *operand_ready_times,
00236             int issue_time, int earliest_slot, int latest_slot, int flags) */
00237         /* (return = slot can be scheduled in, -1 if cannot be scheduled) */
00238 
00239 extern int RU_schedule_op_at (RU_Info *, Mdes_Info *, int *, int, int, int);
00240         /* (RU_Info *ru_info, Mdes_Info *mdes_info, int *operand_ready_times,
00241             int issue_time, int slot, int flags) */
00242         /* (return = slot scheduled in, -1 if cannot be scheduled) */
00243 
00244 extern void RU_unschedule_op (RU_Info *);
00245         /* (RU_Info *ru_info) */
00246 
00247 #endif

Generated on Mon Jul 21 20:28:52 2003 for TINKER LEGO DOC by doxygen 1.3.2