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 #ifdef USE_PCH 00038 #include "be_com_pch.h" 00039 #endif /* USE_PCH */ 00040 #pragma hdrstop 00041 #include <sys/types.h> 00042 #if defined(BUILD_OS_DARWIN) 00043 #include "darwin_elf.h" 00044 #else /* defined(BUILD_OS_DARWIN) */ 00045 #include <elf.h> 00046 #endif /* defined(BUILD_OS_DARWIN) */ 00047 #include <ctype.h> 00048 #include "wn.h" 00049 #include <stdio.h> 00050 #include "wb_carray.h" 00051 #include "opt_du.h" 00052 #include "opt_alias_mgr.h" 00053 #include "wb_util.h" 00054 00055 WB_CARRAY WB_carray; 00056 00057 //----------------------------------------------------------------------- 00058 // NAME: WB_CARRAY::Enter_This_Node 00059 // FUNCTION: Enter the node 'wn' into the saved node array '_carray'. 00060 // Update the value of '_next_index', the index of the next available 00061 // entry in '_carray'. 00062 // NOTE: The 'wn' is not entered into the 'carray' if it is already full. 00063 //----------------------------------------------------------------------- 00064 00065 void WB_CARRAY::Enter_This_Node(WN* wn) 00066 { 00067 if (_next_index < WB_MAX_SAVED_NODES) 00068 _carray[_next_index] = wn; 00069 _next_index++; 00070 } 00071 00072 //----------------------------------------------------------------------- 00073 // NAME: WB_CARRAY::Enter_This_Node_Unique 00074 // FUNCTION: Same as 'enter_this_node', except the 'wn' is not entered 00075 // if it is already there. 00076 //----------------------------------------------------------------------- 00077 00078 INT WB_CARRAY::Enter_This_Node_Unique(WN* wn) 00079 { 00080 INT i; 00081 for (i = 0; i < _next_index; i++) 00082 if (wn == _carray[i]) 00083 break; 00084 if (i < _next_index) 00085 return i; 00086 if (_next_index < WB_MAX_SAVED_NODES) 00087 _carray[_next_index] = wn; 00088 _next_index++; 00089 return _next_index - 1; 00090 } 00091
1.5.6