Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
ti_res_count.h
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2 of the GNU General Public License as
00007   published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if 
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU General Public License along
00021   with this program; if not, write the Free Software Foundation, Inc., 59
00022   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00023 
00024   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00025   Mountain View, CA 94043, or:
00026 
00027   http://www.sgi.com
00028 
00029   For further information regarding this notice, see:
00030 
00031   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00032 
00033 */
00034 
00035 
00036 /* ====================================================================
00037  * ====================================================================
00038  *
00039  *
00040  *  Revision history:
00041  *   16-Oct-91 - Original Version
00042  *
00043  *  Synopsis:
00044  *
00045  *      Utility functions for determining scheduling resource constraints.
00046  *
00047  *  Interface Description:
00048  *
00049  *      Exported types:
00050  *
00051  *          TI_RES_COUNT
00052  *
00053  *              Opaque type to maintain context for the resource
00054  *              counting functions.
00055  *
00056  *      Exported functions:
00057  *
00058  *          TI_RES_COUNT *TI_RES_COUNT_Alloc(
00059  *              MEM_POOL *pool
00060  *          )
00061  *
00062  *              Allocate a new TI_RES_COUNT context from 'pool' with the 
00063  *              resource counters initialized to zero.
00064  *
00065  *          TI_RES_COUNT *TI_RES_COUNT_Print(
00066  *              FILE *fp,
00067  *              TI_RES_COUNT *res
00068  *          )
00069  *
00070  *              Print a representation of <res> to <fp>.
00071  *
00072  *          void TI_RES_COUNT_Add_Op_Resources(
00073  *              TI_RES_COUNT *counts
00074  *              TOP           opcode
00075  *          )
00076  *
00077  *              Add the resource usage counts of 'opcode' into the
00078  *              appropriate elements of 'counts'.
00079  *
00080  *          void TI_RES_COUNT_Add_Op_Resources_Scaled(
00081  *              TI_RES_COUNT *counts
00082  *              TOP           opcode,
00083  *              double        factor
00084  *          )
00085  *
00086  *              Add the resource usage counts of 'opcode' multiplied by
00087  *              'factor' into the appropriate elements of 'counts'.
00088  *
00089  *          void TI_RES_COUNT_Subtract_Op_Resources(
00090  *              TI_RES_COUNT *counts
00091  *              TOP           opcode
00092  *          )
00093  *
00094  *              Subtract the resource usage counts of 'opcode' from the 
00095  *              appropriate elements of 'counts'.
00096  *
00097  *          void TI_RES_COUNT_Subtract_Op_Resources_Scaled(
00098  *              TI_RES_COUNT *counts
00099  *              TOP           opcode,
00100  *              double        factor
00101  *          )
00102  *
00103  *              Subtract the resource usage counts of 'opcode' multiplied
00104  *              by 'factor' from the appropriate elements of 'counts'.
00105  *
00106  *          void TI_RES_COUNT_Add(
00107  *              TI_RES_COUNT *sum
00108  *              TI_RES_COUNT *addend1
00109  *              TI_RES_COUNT *addend2
00110  *          )
00111  *
00112  *              Add the individual resource counts of 'addend1' to 'addend2',
00113  *              storing the result in 'sum'.
00114  *
00115  *          void TI_RES_COUNT_Subtract(
00116  *              TI_RES_COUNT *difference
00117  *              TI_RES_COUNT *minuend
00118  *              TI_RES_COUNT *subtrahend
00119  *          )
00120  *
00121  *              Subtract the individual resource counts of 'subtrahend' from
00122  *              'minuend' storing the result in 'difference'.
00123  *
00124  *          double TI_RES_COUNT_Min_Cycles(
00125  *              TI_RES_COUNT *counts
00126  *          )
00127  *
00128  *              Compute and return a minimum cycle count based on the
00129  *              resource counts in 'counts'.
00130  *
00131  *          INT32 TI_RES_COUNT_Min_II(
00132  *              TI_RES_COUNT *counts
00133  *          )
00134  *
00135  *              Compute and return a minimum II based on the resource 
00136  *              counts in 'counts'. This is the first II at or above
00137  *              the minimum cycle count that is a possible II.  (Some 
00138  *              operations have resource requirements that prevent from 
00139  *              from being scheduled in the cycle count, e.g., something
00140  *              that wants a resource in its 1st and 3rd cycles cannot 
00141  *              be scheduled in 3 cycles if there is only one of these 
00142  *              resources.)
00143  *
00144  *         void
00145  *         TI_RES_COUNT_Emit_Note(
00146  *              const char *prefix,                    
00147  *              FILE *fp,
00148  *              TI_RES_COUNT *res,
00149  *              INT ii
00150  *         )
00151  *              Emit resource usage to asm note.
00152  * 
00153  *
00154  * ====================================================================
00155  * ====================================================================
00156  */
00157 
00158 #ifndef ti_res_count_INCLUDED
00159 #define ti_res_count_INCLUDED
00160 
00161 #include "topcode.h"
00162 
00163 #ifdef __cplusplus
00164 extern "C" {
00165 #endif
00166 
00167 #ifdef _KEEP_RCS_ID
00168 #endif /* _KEEP_RCS_ID */
00169 
00170 typedef struct ti_res_count TI_RES_COUNT;
00171 
00172 extern TI_RES_COUNT *
00173 TI_RES_COUNT_Alloc(
00174   MEM_POOL *pool
00175 );
00176 
00177 extern void
00178 TI_RES_COUNT_Add_Op_Resources(
00179   TI_RES_COUNT *counts,
00180   TOP           opcode
00181 );
00182 
00183 extern void
00184 TI_RES_COUNT_Add_Op_Resources_Scaled(
00185   TI_RES_COUNT *counts,
00186   TOP           opcode,
00187   double        factor
00188 );
00189 
00190 extern void
00191 TI_RES_COUNT_Subtract_Op_Resources(
00192   TI_RES_COUNT *counts,
00193   TOP           opcode
00194 );
00195 
00196 extern void
00197 TI_RES_COUNT_Subtract_Op_Resources_Scaled(
00198   TI_RES_COUNT *counts,
00199   TOP           opcode,
00200   double        factor
00201 );
00202 
00203 extern void
00204 TI_RES_COUNT_Add(
00205   TI_RES_COUNT *sum,
00206   TI_RES_COUNT *addend1,
00207   TI_RES_COUNT *addend2
00208 );
00209 
00210 extern void
00211 TI_RES_COUNT_Subtract(
00212   TI_RES_COUNT *difference,
00213   TI_RES_COUNT *minuend,
00214   TI_RES_COUNT *subtrahend
00215 );
00216 
00217 extern double
00218 TI_RES_COUNT_Min_Cycles(
00219   TI_RES_COUNT *counts
00220 );
00221 
00222 extern INT32
00223 TI_RES_COUNT_Min_II(
00224   TI_RES_COUNT *counts
00225 );
00226 
00227 extern void
00228 TI_RES_COUNT_Print(
00229   FILE *fp,
00230   TI_RES_COUNT *res
00231 );
00232 
00233 extern void
00234 TI_RES_COUNT_Emit_Note(
00235   const char *prefix,                  
00236   FILE *fp,
00237   TI_RES_COUNT *res,
00238   INT ii
00239 );
00240 
00241 #ifdef __cplusplus
00242 }
00243 #endif
00244 #endif /* ti_res_count_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines