Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
ti_bundle.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  *  Synopsis:
00041  *
00042  *      Bundle (or template) accounting package for various clients including
00043  *      the software pipeliner, local (BB) scheduler, disassembler and 
00044  *      linker. 
00045  *
00046  *  Interface Description:
00047  *
00048  *      Exported types:
00049  *
00050  *      Exported functions:
00051  *
00052  *          BOOL TI_BUNDLE_Has_Property(
00053  *              TI_BUNDLE *bundle
00054  *              ISA_EXEC_UNIT_PROPERTY property
00055  *              INT *error
00056  *          )
00057  *
00058  *              Returns TRUE if <bundle> contains an instance of <property>.
00059  *              If an error occurs, <error> is set to TI_RC_ERROR.
00060  *
00061  *          BOOL TI_BUNDLE_Is_Full(
00062  *              TI_BUNDLE *bundle
00063  *              INT *error
00064  *          )
00065  *
00066  *              Returns TRUE if <bundle> is fully packed with insts. If 
00067  *              an error occurs, <error> is set to TI_RC_ERROR.
00068  *
00069  *          BOOL TI_BUNDLE_Is_Empty(
00070  *              TI_BUNDLE *bundle
00071  *              INT *error
00072  *          )
00073  *
00074  *              Returns TRUE if <bundle> is empty. If an error occurs, 
00075  *              <error> is set to TI_RC_ERROR.
00076  *
00077  *          INT TI_BUNDLE_Return_Template(
00078  *              TI_BUNDLE *bundle
00079  *          )
00080  *              
00081  *              Returns the template encoding bit for the slot pattern in
00082  *              <bundle>.
00083  *              
00084  *          void TI_BUNDLE_Clear(
00085  *              TI_BUNDLE *bundle
00086  *          )
00087  *              
00088  *              Reset the contents of the bundle.
00089  *
00090  *          BOOL TI_BUNDLE_Slot_Available(
00091  *              TI_BUNDLE  *bundle
00092  *              ISA_EXEC_UNIT_PROPERTY  property
00093  *              INT slot
00094  *          )
00095  *
00096  *              Check to see if 'slot' for 'property' is available for
00097  *              the given 'bundle'. Returns TRUE if available; FALSE 
00098  *              otherwise.
00099  *
00100  *          BOOL TI_BUNDLE_Stop_Bit_Available(
00101  *              TI_BUNDLE  *bundle
00102  *              INT slot
00103  *          )
00104  *
00105  *              Check to see if a stop bit can be set for 'slot'
00106  *              in the given 'bundle'. Returns TRUE if available; FALSE 
00107  *              otherwise.  
00108  *
00109  *          void TI_BUNDLE_Reserve_Slot(
00110  *              TI_BUNDLE  *bundle
00111  *              INT        slot
00112  *              ISA_EXEC_UNIT_PROPERTY property
00113  *          )
00114  *
00115  *              Reserve 'slot' for 'property' at the given 'bundle'.
00116  *
00117  *          void TI_BUNDLE_Reserve_Stop_Bit(
00118  *              TI_BUNDLE  *bundle
00119  *              INT        slot
00120  *          )
00121  *
00122  *              Reserve 'slot' position for STOP bit at the given 'bundle'.
00123  *
00124  *          void TI_BUNDLE_Unreserve_Stop_Bit(
00125  *              TI_BUNDLE  *bundle
00126  *              INT        slot
00127  *          )
00128  *
00129  *              Unreserve 'slot' position for STOP bit at the given 'bundle'.
00130  *
00131  *
00132  * ====================================================================
00133  * ====================================================================
00134  */
00135 
00136 #ifndef ti_bundle_INCLUDED
00137 #define ti_bundle_INCLUDED
00138 
00139 #include "topcode.h"
00140 
00141 #ifdef __cplusplus
00142 extern "C" {
00143 #endif
00144 
00145 #ifdef _KEEP_RCS_ID
00146 #endif /* _KEEP_RCS_ID */
00147 
00148 #ifndef defs_INCLUDED
00149 #define defs_INCLUDED
00150 typedef signed int INT;
00151 typedef signed int INT32;
00152 typedef signed long long INT64;
00153 typedef signed char mINT8;
00154 typedef signed short mINT16;
00155 typedef signed int mINT32;
00156 typedef signed long long mINT64;
00157 typedef unsigned int UINT;
00158 typedef unsigned int UINT32;
00159 typedef unsigned long long UINT64;
00160 typedef unsigned char mUINT8;
00161 typedef unsigned short mUINT16;
00162 typedef unsigned int mUINT32;
00163 typedef unsigned long long mUINT64;
00164 typedef int BOOL;
00165 typedef unsigned char mBOOL;
00166 #ifndef TRUE
00167 #define TRUE    ((BOOL) 1)
00168 #endif
00169 #ifndef FALSE
00170 #define FALSE   ((BOOL) 0)
00171 #endif
00172 #if defined(_LANGUAGE_C) && !defined(inline)
00173 #define inline static __inline
00174 #endif
00175 #endif
00176 
00177 typedef struct ti_bundle {
00178   ISA_BUNDLE_INFO *bundle_info; /* exported interface from targ_info */
00179   BOOL slot_filled[ISA_MAX_SLOTS];  
00180 } TI_BUNDLE;
00181 
00182 /* TI_BUNDLE accessors:
00183  */
00184 
00185 #define TI_BUNDLE_bundle_info(t)            ((t)->bundle_info)
00186 #define TI_BUNDLE_slot_count(t)             ((t)->bundle_info->slot_count)
00187 #define TI_BUNDLE_exec_property(t,i)        ((t)->bundle_info->slot[i])
00188 #define TI_BUNDLE_stop_bit(t,i)             ((t)->bundle_info->stop[i])
00189 #define TI_BUNDLE_slot_filled(t,i)          ((t)->slot_filled[i])
00190 #define TI_BUNDLE_slot_mask(t)              ((t)->bundle_info->slot_mask)
00191 #define TI_BUNDLE_stop_mask(t)              ((t)->bundle_info->stop_mask)
00192 #define TI_BUNDLE_pack_code(t)              ((t)->bundle_info->pack_code)
00193 
00194 #define Set_TI_BUNDLE_exec_property(t, i, value) ((t)->bundle_info->slot[i] = \
00195                                                   (value))
00196 #define Set_TI_BUNDLE_slot_mask(t, i)       ((t)->bundle_info->slot_mask = i)
00197 #define Set_TI_BUNDLE_stop_mask(t, i)       ((t)->bundle_info->stop_mask = i)
00198 #define Set_TI_BUNDLE_slot_count(t, i)      ((t)->bundle_info->slot_count = i)
00199 #define Set_TI_BUNDLE_stop_bit(t, i, value) ((t)->bundle_info->stop[i] = \
00200                                                   (value))
00201 #define Set_TI_BUNDLE_pack_code(t, value)   ((t)->bundle_info->pack_code = \
00202                                                   (value))
00203 
00204 /* Iterator Macros */
00205 
00206 #define FOR_ALL_SLOT_MEMBERS(bundle, i) \
00207      for (i = 0; i < TI_BUNDLE_slot_count(bundle); ++i)
00208 
00209 inline BOOL
00210 TI_BUNDLE_Stop_Bit_Present(TI_BUNDLE *bundle) {
00211   INT i;
00212   for (i = 0; i < TI_BUNDLE_slot_count(bundle) - 1; ++i) {
00213     if (TI_BUNDLE_stop_bit(bundle, i)) return TRUE;
00214   }
00215   return FALSE;
00216 }
00217 
00218 extern BOOL TI_BUNDLE_Has_Property(
00219   TI_BUNDLE *bundle,
00220   ISA_EXEC_UNIT_PROPERTY property,
00221   INT *error
00222 );
00223 
00224 extern BOOL TI_BUNDLE_Is_Full(
00225   TI_BUNDLE *bundle,
00226   INT *error
00227 );
00228 
00229 extern BOOL TI_BUNDLE_Is_Empty(
00230   TI_BUNDLE *bundle,
00231   INT *error
00232 );
00233 
00234 extern INT TI_BUNDLE_Return_Template(
00235   TI_BUNDLE *bundle
00236 );
00237 
00238 extern void TI_BUNDLE_Clear(
00239   TI_BUNDLE *bundle
00240 );
00241 
00242 extern BOOL TI_BUNDLE_Slot_Available(
00243   TI_BUNDLE  *bundle,
00244   ISA_EXEC_UNIT_PROPERTY  property,
00245   INT        slot
00246 );
00247 
00248 extern BOOL TI_BUNDLE_Stop_Bit_Available(
00249   TI_BUNDLE  *bundle,
00250   INT        slot
00251 );
00252 
00253 extern void TI_BUNDLE_Reserve_Slot(
00254   TI_BUNDLE  *bundle,
00255   INT slot,
00256   ISA_EXEC_UNIT_PROPERTY property
00257 );
00258 
00259 extern void TI_BUNDLE_Reserve_Stop_Bit(
00260   TI_BUNDLE  *bundle,
00261   INT slot
00262 );
00263 
00264 extern void TI_BUNDLE_Unreserve_Stop_Bit(
00265   TI_BUNDLE  *bundle,
00266   INT slot
00267 );
00268 
00269 #ifdef __cplusplus
00270 }
00271 #endif
00272 #endif /* ti_res_res_INCLUDED */
00273 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines