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

lmdes.h

Go to the documentation of this file.
00001 /******************************************************************************\
00002  *
00003  *  File:  lmdes.h
00004  *
00005  *  Description:
00006  *    Header file for low level machine description for architecture (mdes).
00007  *
00008  *  Creation Date :  May, 1993
00009  *
00010  *  Authors:  John C. Gyllenhaal, Scott Mahlke
00011  *
00012  *      Copyright (c) 1993 John Gyllenhaal, Wen-mei Hwu and
00013  *                         The Board of Trustees of the University of Illinois.
00014  *                         All rights reserved.
00015  *      The University of Illinois software License Agreement
00016  *      specifies the terms and conditions for redistribution.
00017 \******************************************************************************/
00018 #ifndef LMDES_H
00019 #define LMDES_H
00020 
00021 #include <stdio.h>
00022 #include "dynamic_symbol.h"
00023 #include "md.h" // Emre
00024 /* For JCG's Ph.D. numbers and Micro 29 paper added structures to
00025  * take extensive stats on mdes usage.  Normally this functionality
00026  * is not needed so TAKE_MDES_STATS should be set to 0.
00027  */
00028 #define TAKE_MDES_STATS 0
00029 
00030 /* For Lcode, casts void pointer for Mdes_Info */
00031 #define MDES_INFO(oper) ((Mdes_Info *)(oper->mdes_info))
00032 
00033 /* Operand/sync specifiers */
00034 #define                 MDES_PRED       0
00035 #define                 MDES_DEST       1
00036 #define                 MDES_SRC        2
00037 #define                 MDES_SYNC_IN    3
00038 #define                 MDES_SYNC_OUT   4
00039 
00040 /* Processor model, must be identical to hmdes.h declaration */
00041 #define                 MDES_SUPERSCALAR        0
00042 #define                 MDES_VLIW               1
00043 
00044 /* Mdes_Rused flags */
00045 #define MDES_OVERLAPPING_REQUEST        0x00000001
00046 
00047 typedef struct mdes_IO_set_st
00048 {
00049     int         id;
00050     int         external_id;
00051     char        *name;
00052     int         *mask;
00053 } Mdes_IO_Set;
00054 
00055 typedef struct mdes_IO_item_st
00056 {
00057     int         id;
00058     char        *name;
00059     Mdes_IO_Set **operand_type;
00060 } Mdes_IO_Item;
00061 
00062 typedef struct mdes_resource_st
00063 {
00064     int         id;
00065     char        *name;
00066 } Mdes_Resource;
00067 
00068 typedef struct mdes_rmask_st
00069 {
00070     int         *uncond;
00071     int         *pred;
00072 } Mdes_Rmask;
00073 
00074 typedef struct mdes_Rused
00075 {
00076     int         flags;  /* Bit flags for Rused list entry */
00077     int         start_usage;
00078     int         end_usage;
00079     int         num_options;
00080     Mdes_Rmask  *option;
00081 } Mdes_Rused;
00082 
00083 typedef struct mdes_reslist_st
00084 {
00085     int         id;
00086     char        *name;
00087     int         num_used;
00088     Mdes_Rused  *used;
00089     int         num_slot_options; /* Number of slot options for this ResList*/
00090     int         *slot_options;    /* slot numbers, in mdes order (not sorted)*/
00091     int         num_RU_entries_required;
00092 } Mdes_ResList;
00093 
00094 typedef struct mdes_latency_st
00095 {
00096     int                 id;
00097     char                *name;
00098     int                 exception;
00099     int                 *operand_latency;
00100 } Mdes_Latency;
00101 
00102 typedef struct mdes_alt_st
00103 {
00104     int id;
00105     char        *asm_name;
00106     int alt_flags;
00107     struct mdes_operation_st    *operation;
00108     Mdes_IO_Item                *IO_item;
00109     Mdes_ResList                *reslist; /* NULL if .lmdes2 used */
00110     struct SM_Table     *table;  /* NULL if .lmdes used */
00111     Mdes_Latency                *latency;
00112 } Mdes_Alt;
00113 
00114 typedef struct Mdes_Stats
00115 {
00116     double              num_oper_checks;
00117     double              num_oper_checks_failed;
00118     double              num_table_checks;
00119     double              num_table_checks_failed;
00120     double              num_option_checks;
00121     double              num_option_checks_failed;
00122     double              num_usage_checks;
00123     double              num_usage_checks_failed;
00124     double              num_slot_checks;
00125     double              num_slot_checks_failed;
00126     INT_Symbol_Table    *first_choice_dist;
00127     INT_Symbol_Table    *num_choice_dist;
00128     INT_Symbol_Table    *succeed_first_choice_dist;
00129     INT_Symbol_Table    *succeed_num_choice_dist;
00130     INT_Symbol_Table    *succeed_option_check_dist;
00131     INT_Symbol_Table    *fail_option_check_dist;
00132     INT_Symbol_Table    *succeed_usage_check_dist;
00133     INT_Symbol_Table    *fail_usage_check_dist;
00134 } Mdes_Stats;
00135 
00136 typedef struct mdes_operation_st
00137 {
00138     int                 id;
00139     int                 opcode;
00140     char                *external_name;
00141     int                 num_alts;
00142     Mdes_Alt            *alt;
00143     int                 op_flags;
00144     int                 heuristic_alt;  /* Used for heuristics */
00145     
00146 #if TAKE_MDES_STATS
00147     /* For mdes statistics */
00148     Mdes_Stats          sched_prepass;
00149     Mdes_Stats          sched_postpass;
00150 #endif
00151 } Mdes_Operation;
00152 
00153 typedef struct mdes_st
00154 {
00155     char                *file_name;
00156     int                 processor_model;/* MDES_SUPERSCALAR, MDES_VLIW */
00157     int                 number[5];      /* Number of each operand/sync type */
00158     int                 offset[5];      /* Offset for each operand/sync type */
00159     char                *name[5];       /* Name of each operand/sync type */
00160     int                 operand_count;
00161     int                 latency_count;
00162     int                 num_slots;
00163     int                 max_slot;
00164     int                 IOmask_width;
00165     int                 num_reg_files;
00166     int                 max_IO_set_id;
00167     int                 null_external_id;
00168     Mdes_IO_Set         **IO_set_table; /* Indexed by external id */
00169     int                 num_IO_sets;
00170     Mdes_IO_Set         *IO_set;
00171     int                 num_IO_items;
00172     Mdes_IO_Item        *IO_item;
00173     int                 num_resources;
00174     Mdes_Resource       *resource;
00175     int                 num_reslists;
00176     int                 Rmask_width;
00177     Mdes_ResList        *reslist;
00178     int                 num_latencies;
00179     Mdes_Latency        *latency;
00180     int                 num_operations;
00181     Mdes_Operation      *operation;
00182     int                 max_opcode;
00183     Mdes_Operation      **op_table;     /* Indexed by opcode */
00184     Mdes_IO_Set         **operand_type_buf;     /* Used by Build_Mdes_Info */
00185     int                 *index_type;    /* For reverse mapping operand index */
00186     int                 *index_number;  /* For reverse mapping operand index */
00187     
00188     /* Start converting routines over to version2 data structures */
00189     struct Mdes2        *mdes2;
00190 
00191     /* New parameter for version2 mdes.  If set, the scheduler only
00192      * needs to only check the resource constraints for the first alternative
00193      * to match format and dependence requirements, otherwise (per original
00194      * specification) all alternatives need to be checked (until a match
00195      * is found or there are no more alternatives).  Makes describing
00196      * the SuperSPARC's cascadable operations more efficient.
00197      */
00198     int                 check_resources_for_only_one_alt;
00199 } Mdes;
00200 
00201 typedef struct mdes_compatable_alt_st
00202 {
00203     Mdes_Alt                            *alt;
00204     struct mdes_compatable_alt_st       *next;
00205 } Mdes_Compatable_Alt;
00206 
00207 typedef struct Mdes_Info
00208 {
00209     int                 opcode;                 /* For debugging */
00210     int                 num_compatable_alts;
00211     Mdes_Compatable_Alt *compatable_alts;       /* Linked list */
00212 } Mdes_Info;
00213 
00214 /* Interface macros */
00215 #define mdes_processor_model()  lmdes->processor_model
00216 #define mdes_total_slots()      lmdes->num_slots
00217 
00218 #ifdef __cplusplus
00219 extern "C" {
00220 #endif
00221 
00222 /* How the LMDES is accessed by the outside world */
00223 extern Mdes *lmdes;
00224 
00225 /* Interface functions */
00226 extern void L_init_lmdes (char *mdes_file_name, int num_pred, int num_dest,
00227                           int num_src, int num_sync);
00228 extern void print_mdes ( FILE *out, Mdes *mdes );
00229 extern int lmdes_initialized (void);            /* (void) */ /* returns 1 or 0 */
00230 
00231 extern Mdes_Info *build_mdes_info (unsigned int opcode, int *io_list);
00232 extern void free_mdes_info (Mdes_Info *info);
00233 
00234 extern void print_mdes_operand_name ( FILE *out, Mdes *mdes, unsigned int index );
00235 extern void mdes_print_IO_set (FILE *out, unsigned int id);
00236 
00237 extern int mdes_defined_opcode (unsigned int opcode);
00238 
00239 extern int op_flag_set (unsigned int opcode, int mask);
00240 extern int alt_flag_set (unsigned int opcode, unsigned int alt_no, int mask);
00241 extern int any_alt_flag_set (Mdes_Info *mdes_info, int mask);
00242 
00243 extern int mdes_max_opcode (void);           /* (void) */
00244 extern int mdes_operand_count (void);   /* (void) */
00245 extern int mdes_latency_count (void);   /* (void) */
00246 extern int mdes_num_operands (unsigned int operand_type);
00247 extern int mdes_null_operand ( void );
00248 
00249 
00250 
00251 extern int operand_index (unsigned int operand_type, unsigned int operand_number);
00252                   /* Ie. (MDES_SRC, 0) */
00253 extern int operand_type (unsigned int operand_index);
00254 extern int operand_number (unsigned int operand_index);
00255 
00256 extern int max_operand_time (Mdes_Info *mdes_info, int operand_index);
00257 extern int min_operand_time (Mdes_Info *mdes_info, int operand_index);
00258 
00259 extern int mdes_calc_min_ready_time (Mdes_Info *mdes_info, int *ready_time);
00260 
00261 extern int mdes_operand_latency (unsigned int opcode, unsigned int alt_no, 
00262                           unsigned int operand_index);
00263 
00264 extern int mdes_max_completion_time (int opcode, int alt_no);
00265 extern int mdes_heuristic_alt_id (int opcode);
00266 
00267 extern Mdes *load_lmdes_from_version2 (char *mdes_file_name, int num_pred,
00268                                        int num_dest, int num_src, 
00269                                        int num_sync);
00270 extern void Malloc_struct (void **ptr, int size);
00271 extern void Malloc_name (char **ptr, char *name);
00272 extern void M_punt (char *format, ...);
00273 extern void print_mdes_stats (FILE *out, int prepass);
00274 extern void increment_check_history (INT_Symbol_Table *table, int num_checks,
00275                                      int inc);
00276 extern int  get_int_parm (MD *md, char *parm_name); // Added by Emre
00277 #ifdef __cplusplus
00278 }
00279 #endif
00280 
00281 #endif 

Generated on Mon Jul 21 20:27:54 2003 for TINKER LEGO DOC by doxygen 1.3.2