00001 /* 00002 * Copyright 2003, 2004, 2005, 2006 PathScale, Inc. All Rights Reserved. 00003 * 00004 * This program is free software; you can redistribute it and/or modify it 00005 * under the terms of version 2 of the GNU General Public License as 00006 * published by the Free Software Foundation. 00007 * 00008 * This program is distributed in the hope that it would be useful, but 00009 * WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00011 * 00012 * Further, this software is distributed without any warranty that it is 00013 * free of the rightful claim of any third person regarding infringement 00014 * or the like. Any license provided herein, whether implied or 00015 * otherwise, applies only to this software file. Patent licenses, if 00016 * any, provided herein do not apply to combinations of this program with 00017 * other software, or any other product whatsoever. 00018 * 00019 * You should have received a copy of the GNU General Public License along 00020 * with this program; if not, write the Free Software Foundation, Inc., 59 00021 * Temple Place - Suite 330, Boston MA 02111-1307, USA. 00022 */ 00023 00024 00025 #ifndef OUTPUT_FUNC_START_PROFILER_INCLUDE 00026 #define OUTPUT_FUNC_START_PROFILER_INCLUDE 00027 00028 00029 #include "wn.h" 00030 #include "pu_info.h" 00031 #include "DaVinci.h" 00032 #include "cxx_template.h" 00033 #include "symtab.h" 00034 #include "wn_map.h" 00035 #include "mempool.h" //it includes "defs.h" 00036 #include "wn_util.h" 00037 #include "symtab_utils.h" 00038 #include "lwn_util.h" //WN_Parentize() 00039 #include "ir_reader.h" 00040 #include "tracing.h" 00041 #include "data_layout.h" //Allocate_Object() 00042 00043 class OUTPUT_FUNC_START_PROFILER_MEM { 00044 protected: 00045 MEM_POOL _mem_pool; 00046 00047 OUTPUT_FUNC_START_PROFILER_MEM (void) { 00048 MEM_POOL_Initialize (&_mem_pool, "OUTPUT_FUNC_START_PROFILER_MEM", TRUE); 00049 MEM_POOL_Push(&_mem_pool); 00050 }; 00051 00052 ~OUTPUT_FUNC_START_PROFILER_MEM (void) { 00053 MEM_POOL_Pop (&_mem_pool); 00054 MEM_POOL_Delete (&_mem_pool); 00055 }; 00056 }; 00057 00058 00059 class OUTPUT_FUNC_START_PROFILER : public OUTPUT_FUNC_START_PROFILER_MEM { 00060 private: 00061 const char* _file_name; 00062 PU_Info** _pu_tree_p; 00063 00064 static const char* _prefix; 00065 static const char* _init_proc; 00066 static const char* _lpbx_0; 00067 00068 ST* _func_st; 00069 ST* _lpbx_st; 00070 WN* _func_entry; 00071 WN* _func_body; 00072 PU_Info* _pu_info; 00073 SYMTAB_IDX _func_level; 00074 char* _func_name; 00075 00076 char* Construct_Func_Name(const char *name); 00077 public: 00078 00079 void Set_file_name(const char* file) { _file_name = file; } 00080 void Set_pu_tree(PU_Info** p) { _pu_tree_p = p; } 00081 00082 static const char* Get_prefix() { return _prefix; } 00083 00084 OUTPUT_FUNC_START_PROFILER (const char* src_file_name = NULL, PU_Info** pu_tree_p = NULL); 00085 ~OUTPUT_FUNC_START_PROFILER (void) {} 00086 00087 void Generate_Func_Start_Profiler_PU(void); 00088 void Fill_In_Func_Body(void); 00089 }; 00090 00091 extern OUTPUT_FUNC_START_PROFILER Output_Func_Start_Profiler; 00092 00093 #endif 00094 00095
1.5.6