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 * Module: dominate.h 00040 * $Revision: 1.2 $ 00041 * $Date: 02/11/07 23:41:23-00:00 $ 00042 * $Author: fchow@keyresearch.com $ 00043 * $Source: /scratch/mee/2.4-65/kpro64-pending/be/cg/SCCS/s.dominate.h $ 00044 * 00045 * Description: 00046 * 00047 * Definitions for basic block (BB) dominator/post-dominator information 00048 * generation and maintenence. 00049 * 00050 * Definitions: 00051 * BB A dominates B iff all paths from the entry to B intersects A. 00052 * BB A post-dominates B iff all paths from B to the exit intersects A. 00053 * 00054 * Constants: 00055 * 00056 * Utilities: 00057 * 00058 * void Calculate_Dominators(void) 00059 * Calculate_Dominators generates a dominator and post-dominator 00060 * bit vector for each BB. Dynamic memory is allocated to hold these 00061 * bit vectors and must be freed by calling Free_Dominators_Memory. 00062 * 00063 * NOTE: The performance of this routine will degrade if the BB list 00064 * is not topologically sorted. 00065 * 00066 * void BB_REGION_Calculate_Dominators(const BB_REGION& region) 00067 * Generate dominator and post-dominators sets for a BB_REGION. Assumes 00068 * that the dominator/post-dominator information at the borders of the 00069 * region is valid. Also, dominator information will not be correct outside the region after 00070 * this is called. 00071 * 00072 * void BB_SET_Calculate_Dominators(const BB_SET bbset, BOOL compute_dom, BOOL compute_pdom) 00073 * Generate dominator info for the set of BB's in bbset. The dominator info will be correct 00074 * and include only those BB's in bbset. If you use this, you'll need to do a global 00075 * recomputation later. Compute_dom and compute_pdom allow the computation of only the 00076 * dominator and post dominator sets, if desired. 00077 * 00078 * void Free_Dominators_Memory(void) 00079 * Frees dynamic resources allocated by Calculate_Dominators. 00080 * 00081 * BS *BB_dom_set(BB *bb) 00082 * Returns a bit vector indentifying the dominators of <bb>. 00083 * Bit indicies correspond to BB_id's. 00084 * 00085 * BS *BB_pdom_set(BB *bb) 00086 * Returns a bit vector indentifying the post-dominators of <bb>. 00087 * Bit indicies correspond to BB_id's. 00088 * 00089 * BOOL BB_Has_Dominator_Info(BB *bb) 00090 * Returns a boolean value to indicate if <bb> has dominator 00091 * info available. This will be false for BBs created after 00092 * a call to Calculate_Dominators or for all BBs once 00093 * Free_Dominators_Memory is called. 00094 * 00095 * ==================================================================== 00096 * ==================================================================== 00097 */ 00098 00099 #ifndef DOMINATE_INCLUDED 00100 #define DOMINATE_INCLUDED 00101 00102 #include "bitset.h" 00103 00104 /* The following declarations are PRIVATE to the implementation: 00105 */ 00106 typedef struct dominators { 00107 BS **dom_set; 00108 BS **pdom_set; 00109 INT size; 00110 } DOMINATORS; 00111 00112 extern DOMINATORS bb_dom_map; 00113 00114 extern void Set_BB_dom_set(BB *bb, BS *bs); 00115 00116 extern void Set_BB_pdom_set(BB *bb, BS *bs); 00117 00118 /* Public declarations: 00119 */ 00120 00121 #define BB_dom_set(bb) ((BS *)(bb_dom_map.dom_set[BB_id(bb)])) 00122 #define BB_pdom_set(bb) ((BS *)(bb_dom_map.pdom_set[BB_id(bb)])) 00123 00124 #define BB_Has_Dominator_Info(bb) (BB_id(bb) < bb_dom_map.size) 00125 00126 extern void Calculate_Dominators(void); 00127 extern void BB_REGION_Calculate_Dominators(const BB_REGION& region); 00128 extern void BB_SET_Calculate_Dominators(BB_SET *bbset, BOOL compute_dom, BOOL compute_pdom); 00129 extern void Free_Dominators_Memory(void); 00130 00131 #endif /* DOMINATE_INCLUDED */
1.5.6