00001 /* 00002 00003 Copyright (C) 2008 . 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 */ 00025 00026 #ifndef dipa_phase_ctrl_INCLUDED 00027 #define dipa_phase_ctrl_INCLUDED 00028 00029 #include <list> 00030 00031 #include "mempool.h" 00032 #include "dipa_phase.h" 00033 00034 /* ==================================================================== 00035 * ==================================================================== 00036 * 00037 * 00038 * Description: 00039 * 00040 * This module provides the interface for phase control. It is based on 00041 * the program-independent functions provided by rta/open64/resource.h. 00042 * 00043 * ==================================================================== 00044 * ==================================================================== 00045 */ 00046 00047 /* 00048 * DIPA phases should be registered in phase manager. The phase manager will call 00049 * DIPA functions. 00050 */ 00051 00052 class DIPA_Phase_Manager { 00053 private: 00054 static INT32 last_phase_id; 00055 static Phase_List phase_list; // top level phases only 00056 static DIPA_Phase *cur_phase; 00057 static MEM_POOL MEM_dipa_pool; 00058 static MEM_POOL MEM_dipa_nz_pool; 00059 static const char *tfile_name; 00060 static FILE *tfile; 00061 00062 static CMD_ARGS dipa_args; 00063 static DIPA_Olist dipa_olist; 00064 00065 public: 00066 static PHASE_ID Register_Phase(const char *name, INT32 parentId, INT32 prevId); 00067 static PHASE_ID Register_Phase(DIPA_Phase *cur, DIPA_Phase *parent, DIPA_Phase *prev); 00068 00069 static void Add_Global_Arg(const char *arg_name, const char *arg_val); 00070 static void Add_DIPA_File(char *fname); 00071 00072 static BOOL Init_IPA(void); 00073 static BOOL Do_IPA(void); 00074 static BOOL End_IPA(void); 00075 00076 static PHASE_ID Get_Phase_ID (const char *name); 00077 static DIPA_Phase *Get_Phase (PHASE_ID ph_id); 00078 00079 static void Set_Cur_Phase(DIPA_Phase *_phase) { cur_phase = _phase; } 00080 static const char *Get_Cur_Phase_Name(void); 00081 00082 static BOOL Init_Memory(void); 00083 static inline MEM_POOL *Get_Mempool(void) { return &MEM_dipa_pool; } 00084 static inline MEM_POOL *Get_Nz_Mempool(void) { return &MEM_dipa_nz_pool; } 00085 00086 static BOOL Init_Trace_File(const char *fname); 00087 static void Set_Trace_File(const char *fname); 00088 static const char *Get_Trace_File(void) { return tfile_name; } 00089 static FILE *Get_Trace_File_Desc(void) { if (tfile) return tfile; return stdout; } 00090 00091 static void Dump_All_Stats(FILE *file); 00092 static void Accum_All_Stats(void); 00093 00094 static void Set_Error_Line(INT32); 00095 static void Set_Error_File(const char *fname); 00096 00097 static void Dump_All_Phases(void); 00098 00099 }; 00100 00101 #endif /* dipa_phase_ctrl_INCLUDED */
1.5.6