00001 /* 00002 Copyright (C) 2000-2003, Institute of Computing Technology, Chinese Academy of Sciences 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without modification, 00006 are permitted provided that the following conditions are met: 00007 00008 Redistributions of source code must retain the above copyright notice, this list 00009 of conditions and the following disclaimer. 00010 00011 Redistributions in binary form must reproduce the above copyright notice, this list 00012 of conditions and the following disclaimer in the documentation and/or other materials 00013 provided with the distribution. 00014 00015 Neither the name of the owner nor the names of its contributors may be used to endorse or 00016 promote products derived from this software without specific prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 00019 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00020 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR 00021 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00022 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 00023 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00024 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00025 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 */ 00027 00028 //-*-c++-*- 00029 //============================================================================= 00030 // 00031 // Module: region_update.h 00032 // $Revision: 1.1.1.1 $ 00033 // $Date: 2005/10/21 19:00:00 $ 00034 // $Author: marcel $ 00035 // $Source: /proj/osprey/CVS/open64/osprey1.0/be/cg/orc_ict/region_update.h,v $ 00036 // 00037 //============================================================================= 00038 00039 #ifndef region_update_INCLUDED 00040 #define region_update_INCLUDED 00041 00042 //============================================================================ 00043 // 00044 // Class Name: REGION_LOOP_UPDATE_MEM 00045 // 00046 // Base Class: <none> 00047 // 00048 // Derived Class: REGION_LOOP_UPDATE 00049 // 00050 // Class Description: 00051 // 00052 // Note: 00053 // 00054 //============================================================================ 00055 00056 class REGION_LOOP_UPDATE_MEM { 00057 00058 protected: 00059 MEM_POOL _m; 00060 00061 REGION_LOOP_UPDATE_MEM() { 00062 MEM_POOL_Initialize( &_m, "REGION_LOOP_UPDATE_MEM", true ); 00063 MEM_POOL_Push( &_m ); 00064 } 00065 00066 ~REGION_LOOP_UPDATE_MEM() { 00067 MEM_POOL_Pop( &_m ); 00068 MEM_POOL_Delete(&_m ); 00069 } 00070 }; 00071 00072 00073 //============================================================================ 00074 // 00075 // Class Name: REGION_LOOP_UPDATE 00076 // 00077 // Base Class: REGION_LOOP_UPDATE_MEM 00078 // 00079 // Derived Class: <none> 00080 // 00081 // Class Description: 00082 // 00083 // Note: 00084 // 00085 //============================================================================ 00086 00087 class REGION_LOOP_UPDATE :public REGION_LOOP_UPDATE_MEM { 00088 00089 typedef mempool_allocator<BB *> BB_ALLOC; 00090 typedef std::vector<BB *, BB_ALLOC> BB_CONTAINER; 00091 typedef BB_CONTAINER::iterator BB_ITER; 00092 00093 private: 00094 REGION_TREE *_region_tree; 00095 BB *_first_bb; 00096 BB_CONTAINER _bbs_not_in_loop; 00097 BB_CONTAINER _loop_bbs;// all bbs in loop and new generated by loop opt 00098 00099 void Find_Loop_BBs(); 00100 void Set_No_Further_Optimization(REGION *par); 00101 00102 public: 00103 REGION_LOOP_UPDATE(REGION_TREE *tree, BB *first_bb):_bbs_not_in_loop(BB_ALLOC(&_m)){ 00104 _region_tree = tree; 00105 _first_bb = first_bb; 00106 } 00107 00108 ~REGION_LOOP_UPDATE(){}; 00109 00110 00111 // record all bbs which are not in loop into _bbs_not_in_loop 00112 void Record_Loop_Region_Boundary(LOOP_REGION *loop); 00113 00114 REGION *Del_Loop_Region(LOOP_REGION *loop); 00115 00116 void Rebuild_Loop_Region(REGION *par, BOOL succ); 00117 00118 }; 00119 00120 extern void *Record_And_Del_Loop_Region(LOOP_DESCR *loop, void *tmp, BOOL); 00121 extern void Rebuild_Loop_Region(void *tmp_loop_update, void *tmp_loop_rgn); 00122 00123 // if can moved from src_bb to target_bb 00124 extern BOOL Can_Be_Moved(BB * src_bb, BB * target_bb); 00125 00126 #endif
1.5.6