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 #ifndef global_cycles_finder_INCLUDED 00031 #define global_cycles_finder_INCLUDED 00032 00033 #include "region.h" 00034 00035 class GLOBAL_CYCLES_FINDER_MEM { 00036 00037 protected: 00038 MEM_POOL _m; 00039 00040 GLOBAL_CYCLES_FINDER_MEM() { 00041 MEM_POOL_Initialize( &_m, "GLOBAL_CYCLES_MEM", true ); 00042 MEM_POOL_Push( &_m ); 00043 } 00044 00045 ~GLOBAL_CYCLES_FINDER_MEM() { 00046 MEM_POOL_Pop( &_m ); 00047 MEM_POOL_Delete(&_m ); 00048 } 00049 }; 00050 00051 //============================================================================ 00052 // 00053 // Class Name: GLOBAL_CYCLES_FINDER 00054 // 00055 // Base Class: GLOBAL_CYCLES_FINDER_MEM 00056 // 00057 // Derived Class: <none> 00058 // 00059 // Class Description: This class try to find out all cycles in a global cfg 00060 // and return a BBMAP,which store all cycles dest bb. 00061 // 00062 // Note: 00063 // 00064 //============================================================================ 00065 00066 class GLOBAL_CYCLES_FINDER : public GLOBAL_CYCLES_FINDER_MEM { 00067 private: 00068 void Detect_Global_Cycle(GLOBAL_CYCLE_VECTOR& cycles,BB *bb, 00069 INT_VECTOR dfn,BS *visited,INT32 next_dfn); 00070 00071 public: 00072 void Find_Global_Cycles(GLOBAL_CYCLE_VECTOR& cycles); 00073 void Print(GLOBAL_CYCLE_VECTOR cycles,FILE *f = stderr); 00074 }; 00075 00076 #endif
1.5.6