Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
be_util.cxx
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  *  06-Dec -95 - Original Version
00042  *
00043  * Description:
00044  *    Utilities for all backend components.
00045  *
00046  * ====================================================================
00047  * ====================================================================
00048  */
00049 
00050 #include "defs.h"
00051 #include "wn.h"
00052 #include "be_util.h"
00053 
00054 static INT32 current_pu_count;
00055 
00056 void
00057 Reset_Current_PU_Count(void)
00058 {
00059   current_pu_count = 0;
00060 }
00061 
00062 void
00063 Advance_Current_PU_Count(void)
00064 {
00065   current_pu_count++;
00066 }
00067 
00068 INT32
00069 Current_PU_Count(void)
00070 {
00071   return current_pu_count;
00072 }
00073 
00074 //-----------------------------------------------------------------------
00075 // NAME: St_Idx_Is_Intconst
00076 // FUNCTION: Returns TRUE if 'st_idx' is an integer constant and, when this
00077 //   is the case, sets the value in 'val'.  Otherwise, returns FALSE.
00078 //-----------------------------------------------------------------------
00079 
00080 extern BOOL St_Idx_Is_Intconst(ST_IDX st_idx, INT64 *val)
00081 {
00082   ST* st = &St_Table[st_idx]; 
00083   if (ST_class(st)==CLASS_CONST) {
00084     TCON t = STC_val(st);
00085     switch(TCON_ty(t)) {
00086       case MTYPE_I1: case MTYPE_I2 : case MTYPE_I4: case MTYPE_I8 :
00087         *val = t.vals.i0;
00088         return TRUE;
00089       case MTYPE_U1: case MTYPE_U2 : case MTYPE_U4: case MTYPE_U8 :
00090         *val = t.vals.k0;
00091         return TRUE;
00092       default:
00093         return FALSE;
00094     }
00095   } else {
00096     return FALSE;
00097   }
00098 }
00099 
00100 //-----------------------------------------------------------------------
00101 // NAME: Wn_Is_Intconst
00102 // FUNCTION: Returns TRUE if 'ldid' is an integer constant and, when this
00103 //   is the case, sets the value in 'val'.  Otherwise, returns FALSE.
00104 //-----------------------------------------------------------------------
00105 
00106 extern BOOL Wn_Is_Intconst(WN *ldid, INT64 *val)
00107 {
00108   return St_Idx_Is_Intconst(ST_st_idx(WN_st(ldid)), val);
00109 } 
00110 
00111 // ----------------------------------------------------------------------
00112 // symbols defined in be.so but used in cg.so
00113 /* official builds will link with identfile that defines _Release_ID */
00114 extern const char *__Release_ID;
00115 const char *Default_Release_ID = "none";
00116 #pragma weak __Release_ID = Default_Release_ID
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines