00001 /* 00002 * Copyright 2008 PathScale, LLC. All Rights Reserved. 00003 */ 00004 00005 /* 00006 00007 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00008 00009 This program is free software; you can redistribute it and/or modify it 00010 under the terms of version 2 of the GNU General Public License as 00011 published by the Free Software Foundation. 00012 00013 This program is distributed in the hope that it would be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 00017 Further, this software is distributed without any warranty that it is 00018 free of the rightful claim of any third person regarding infringement 00019 or the like. Any license provided herein, whether implied or 00020 otherwise, applies only to this software file. Patent licenses, if 00021 any, provided herein do not apply to combinations of this program with 00022 other software, or any other product whatsoever. 00023 00024 You should have received a copy of the GNU General Public License along 00025 with this program; if not, write the Free Software Foundation, Inc., 59 00026 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00027 00028 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00029 Mountain View, CA 94043, or: 00030 00031 http://www.sgi.com 00032 00033 For further information regarding this notice, see: 00034 00035 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00036 00037 */ 00038 00039 00040 // -*-C++-*- 00041 00059 #ifndef wn_INCLUDED 00060 #include "wn.h" 00061 #endif 00062 #include "cxx_hash.h" 00063 00064 #ifndef cse_declare 00065 00066 #define cse_declare 00067 00068 class WN; 00069 typedef struct mem_pool MEM_POOL; 00070 00071 class EQUIV_PAIR { 00072 public: 00073 mUINT16 From; 00074 mUINT16 To; 00075 EQUIV_PAIR (mUINT16 f, mUINT16 t) { From = f; To = t;} 00076 }; 00077 00078 class WN_PAIR { 00079 public: 00080 WN *Wn1; 00081 WN *Wn2; 00082 WN_PAIR (WN *wn1, WN *wn2) { Wn1 = wn1; Wn2 = wn2; }; 00083 }; 00084 00085 class WN_PAIR_EC { 00086 public: 00087 WN *Wn1; 00088 WN *Wn2; 00089 INT32 EClass; 00090 WN_PAIR_EC (WN *wn1, WN *wn2, INT32 eclass) { 00091 Wn1 = wn1; Wn2 = wn2; EClass = eclass; 00092 }; 00093 }; 00094 00095 00096 00097 00098 typedef HASH_TABLE<UINT32,WN_PAIR*> EQUIV_WN_HASH_TABLE; 00099 class EQUIV_WN_HASH { 00100 EQUIV_WN_HASH_TABLE _table; 00101 // intermix From and Two 00102 UINT32 Signature(EQUIV_PAIR ep) { 00103 UINT32 result1 = (ep.From & 0xF0F0); 00104 UINT32 result2 = ((ep.From & 0x0F0F) << 16); 00105 UINT32 result3 = (ep.To & 0x0F0F); 00106 UINT32 result4 = ((ep.To & 0xF0F0) << 16); 00107 UINT32 result = result1 | result2 | result3 | result4 ; 00108 return result; 00109 } 00110 public: 00111 EQUIV_WN_HASH(const UINT elements,MEM_POOL *pool) : _table(elements,pool) {;} 00112 void Remove(EQUIV_PAIR ep) { _table.Remove(Signature(ep)); } 00113 WN_PAIR *Find(EQUIV_PAIR ep) { return _table.Find(Signature(ep)); } 00114 void Enter(EQUIV_PAIR ep, WN_PAIR *wp) { _table.Enter(Signature(ep),wp); } 00115 }; 00116 00117 extern void Inter_Iteration_Cses(WN *func_nd); 00118 #ifdef KEY 00119 extern void Invariant_Factorization(WN *func_nd); 00120 extern BOOL Is_Invariant_Factorization_Beneficial(WN *loop); 00121 #endif 00122 #ifdef _KEEP_RCS_ID 00123 static char *cse_rcs_id = cse_INCLUDED "$Revision$"; 00124 #endif /* _KEEP_RCS_ID */ 00125 00126 00127 #endif 00128 00129 00130 00131 00132
1.5.6