Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
wb_browser.h
Go to the documentation of this file.
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 #ifndef wb_browser_INCLUDED
00037 #define wb_browser_INCLUDED "wb_browser.h"
00038 
00039 #ifndef wb_buffer_INCLUDED
00040 #include "wb_buffer.h"
00041 #endif 
00042 
00043 #ifndef wb_carray_INCLUDED
00044 #include "wb_carray.h"
00045 #endif 
00046 
00047 #ifndef __SYS_ELF_H__
00048 #include <elf.h>
00049 #endif
00050 
00051 #ifndef ipl_summary_INCLUDED
00052 #include "ipl_summary.h"
00053 #endif 
00054 
00055 #ifndef ipl_summarize_INCLUDED
00056 #include "ipl_summarize.h"
00057 #endif
00058 
00059 
00060 class ARRAY_SUMMARY; 
00061 const INT WB_MAX_STRING_LENGTH = 1000;
00062 const INT WB_ASCII_CHAR_COUNT = 256; 
00063 
00064 enum WB_SOURCE_LANGUAGE {
00065   WB_SRC_NONE, 
00066   WB_SRC_FORTRAN, 
00067   WB_SRC_C
00068 };
00069 
00070 enum WB_REQUIRED_PIECES { 
00071   WBR_NONE = 0, 
00072   WBR_DU = 1, 
00073   WBR_DG = 2, 
00074   WBR_ALIAS = 4, 
00075   WBR_PARENT = 8, 
00076   WBR_MPFMAP = 16, 
00077   WBR_MPFINFO = 32, 
00078   WBR_AAMAP = 64,
00079   WBR_REDMAP = 128
00080 }; 
00081 
00082 struct WB_COMMAND { 
00083   char _command; 
00084   WB_REQUIRED_PIECES _required_fields; 
00085   WB_COMMAND* _subcommand; 
00086   char* _text; 
00087 }; 
00088 
00089 class WB_BROWSER {
00090 private: 
00091   WN* _global_fd; 
00092   DU_MANAGER* _du; 
00093   ALIAS_MANAGER* _alias_mgr; 
00094   WB_COMMAND* _command_list; 
00095   WB_COMMAND* _old_command_list; 
00096   ARRAY_DIRECTED_GRAPH16* _dg; 
00097   WN_MAP _parent_map; 
00098   WN_MAP _prompf_id_map; 
00099   WN_MAP _access_array_map;
00100   WN_MAP _reduction_map;
00101   PROMPF_INFO* _prompf_info; 
00102   SUMMARIZE<IPL>* _scalar_summary;
00103   ARRAY_SUMMARY* _array_summary; 
00104   WB_SOURCE_LANGUAGE _source_language; 
00105   WN* _cnode; 
00106   INT _fancy_level; 
00107   INT _sanity_check_level; 
00108   BOOL _davinci_mode; 
00109   PU* _pu; 
00110   WB_BUFFER _buffer; 
00111   WB_CARRAY _carray; 
00112   char _keymap[WB_ASCII_CHAR_COUNT]; 
00113   char _old_keymap[WB_ASCII_CHAR_COUNT]; 
00114   BOOL _is_subcommand;  
00115 protected: 
00116   WB_COMMAND* Command_List() {return _command_list;};
00117   WB_COMMAND* Old_Command_List() {return _old_command_list;};
00118   void Set_Old_Command_List(WB_COMMAND* old_command_list)
00119     {_old_command_list = old_command_list;};
00120   ARRAY_DIRECTED_GRAPH16* Dg() { return _dg; }
00121   WN_MAP Parent_Map() { return _parent_map; }
00122   WN_MAP Prompf_Id_Map() { return _prompf_id_map; }
00123   WN_MAP Access_Array_Map() { return _access_array_map; }
00124   WN_MAP Reduction_Map() { return _reduction_map; }
00125   char Command(INT i) { return (_command_list)[i]._command; }
00126   WB_REQUIRED_PIECES Required_Fields(INT i) 
00127     { return (_command_list)[i]._required_fields; }
00128   char* Command_Text(INT i) { return (_command_list)[i]._text; }
00129   WB_COMMAND* Subcommand(INT i) {return (_command_list)[i]._subcommand;};
00130   void Set_Subcommand(char ch);
00131   void Reset_Subcommand();
00132   BOOL Is_Subcommand() {return _is_subcommand;};
00133   BOOL Required_Fields_Present(INT i); 
00134   PROMPF_INFO* Prompf_Info() { return _prompf_info; }
00135   SUMMARIZE<IPL>* Scalar_Summary() { return _scalar_summary; }
00136   ARRAY_SUMMARY* Array_Summary() { return _array_summary; }
00137   WB_SOURCE_LANGUAGE Source_Language() { return _source_language; } 
00138   WN* Cnode() { return _cnode; }
00139   INT Fancy_Level() { return _fancy_level; } 
00140   INT Sanity_Check_Level() { return _sanity_check_level; } 
00141   BOOL DaVinci_Mode() { return _davinci_mode; }
00142   void Set_Source_Language(WB_SOURCE_LANGUAGE source_language) 
00143     { _source_language = source_language; } 
00144   void Set_Cnode(WN* cnode) { _cnode = cnode; }; 
00145   void Set_Fancy_Level(INT fancy_level) { _fancy_level = fancy_level; }
00146   WB_BUFFER & Buffer() { return _buffer; } 
00147   WB_CARRAY & Carray() { return _carray; } 
00148   void Error_Cleanup(); 
00149   void This_Node(WN* wn, BOOL print_vertex = TRUE, 
00150     BOOL print_brackets = FALSE); 
00151   void Print_This_Node(WN* wn, BOOL print_vertex = TRUE,
00152     BOOL print_brackets = FALSE);
00153   void Find_Walk(char *s, WN* wn); 
00154   void Find_Operator_Walk(OPERATOR opr_test, WN* wn); 
00155   void Access_Array();
00156   void Reduction_Node(WN* wn, FILE* fp);
00157   void Reduction_Walk(WN* wn_tree, FILE* fp);
00158   void Reduction();
00159   BOOL Aliased_Node(WN* wn);
00160   void Alias_Walk(WN* wn_test, WN* wn_start, ALIAS_RESULT ar);
00161   void Dep_Symbol(WN* wn); 
00162   void Deps_Loop();
00163   void Deps_Ref();
00164   void Loops_Walk(WN* wn, FILE* fp, INT spaces, INT increment);
00165   BOOL Unmappable_Character(char ch);
00166   void Initialize_Keymap(char ch);
00167   void Initialize_Language();
00168   void Address_Walk(WN* wn_tree, INT spaces, INT increment);
00169   void Root(); 
00170   void Next(); 
00171   void Previous(); 
00172   void Set_Node(); 
00173   void Address(); 
00174   void Addresses(); 
00175   void Fancy_Up(); 
00176   void Fancy_Down(); 
00177   void Kids(); 
00178   void Statements(); 
00179   void This_Tree(); 
00180   void Symbol(); 
00181   void Type(); 
00182   void Find(); 
00183   void Find_Symbols(); 
00184   void Find_Operator(); 
00185   void Uses(); 
00186   void Defs();
00187   void Alias(); 
00188   void Parent(); 
00189   void Ancestors(); 
00190   void Promp_Map(); 
00191   void Promp_Info(); 
00192   void Whirl2fc(); 
00193   void Whirl2fset(); 
00194   void Whirl2cset(); 
00195   void Deps(); 
00196   void Vertices(); 
00197   void Vertex_Set_Node(); 
00198   void Loops(); 
00199   void Set_Map_Id(); 
00200   void Map_Id(); 
00201   void DaVinci_Toggle();
00202   void Summary_Symbol(FILE* fp, INT symbol_index, BOOL is_list); 
00203   void Summary_Ivar(FILE* fp, INT ivar_index);
00204   void Summary_Ivar_Global(FILE* fp, INT ivar_index);
00205   void Summary_Formal(FILE* fp, INT formal_index);
00206   void Summary_Common(FILE* fp, INT common_index);
00207   void Summary_Common_Shape(FILE* fp, INT common_shape_index);
00208   void Summary_Procedure(FILE* fp, INT procedure_index);
00209   void Summary_Global(FILE* fp, INT global_index);
00210   void Summary_Callsite(FILE* fp, INT callsite_index);
00211   void Summary_Control_Dependence(FILE* fp, INT control_index);
00212   void Summary_Actual(FILE* fp, INT actual_index);
00213   void Summary_Value(FILE* fp, INT value_index);
00214   void Summary_Cfg_Node(FILE* fp, INT cfg_index);
00215   void Summary_Region(FILE* fp, INT region_index);
00216   void Summary_Projected_Region(FILE* fp, INT proj_region_index);
00217   void Summary_Projected_Node(FILE* fp, INT proj_node_index);
00218   void Summary_Term(FILE* fp, INT term_index);
00219   void Summary_Loop_Info(FILE* fp, INT loop_info_index);
00220   void Summary_Phi(FILE* fp, INT phi_index);
00221   void Summary_Chi(FILE* fp, INT chi_index);
00222   void Summary_Expr(FILE* fp, INT expr_index);
00223   void Summary_Stid(FILE* fp, INT stid_index);
00224   void Summary_Stmt(FILE* fp, INT stmt_index);
00225   void Summary_Feedback(FILE* fp, INT feedback_index);
00226   BOOL Summary_Valid_Command(char ch);
00227   BOOL Summary_Scalar_Command(char ch);
00228   BOOL Summary_Array_Command(char ch);
00229   INT Summary_Size(char ch);
00230   void Summary_Single(FILE* fp, char ch, INT index, BOOL is_list);
00231   void Summary(FILE* fp);
00232   void Summary_Locate(FILE* fp);  
00233   void Help(); 
00234   void Invoke_Command(char ch); 
00235 public: 
00236   WB_BROWSER(); 
00237   WB_BROWSER(WN* global_fd, DU_MANAGER* du, ALIAS_MANAGER* alias_mgr,
00238     WN_MAP prompf_id_map, WN_MAP access_arrray_map, WN_MAP reduction_map, 
00239     PU* pu, WB_COMMAND* command_list); 
00240   PU* Pu() { return _pu; }
00241   void Set_Pu(PU* pu) { _pu = pu; }
00242   WN* Global_Fd() { return _global_fd; }
00243   void Set_Global_Fd(WN* global_fd) { _global_fd = global_fd; }
00244   DU_MANAGER* Du() { return _du; } 
00245   void Set_Du(DU_MANAGER* du) { _du = du; } 
00246   ALIAS_MANAGER* Alias_Mgr() { return _alias_mgr; }
00247   void Set_Alias_Manager(ALIAS_MANAGER* alias_mgr) 
00248     { _alias_mgr = alias_mgr; } 
00249   void Set_Command_List(WB_COMMAND* command_list) 
00250     { _command_list = command_list; } 
00251   void Set_Dg(ARRAY_DIRECTED_GRAPH16* dg) { _dg = dg; }
00252   void Set_Parent_Map(WN_MAP parent_map) { _parent_map = parent_map; }
00253   void Set_Prompf_Id_Map(WN_MAP prompf_id_map) 
00254     { _prompf_id_map = prompf_id_map; }
00255   void Set_Access_Array_Map(WN_MAP access_array_map) 
00256     { _access_array_map = access_array_map; }
00257   void Set_Reduction_Map(WN_MAP reduction_map) 
00258     { _reduction_map = reduction_map; }
00259   void Set_Prompf_Info(PROMPF_INFO* prompf_info) 
00260     { _prompf_info = prompf_info; }
00261   void Set_Scalar_Summary(SUMMARIZE<IPL>* scalar_summary) 
00262     { _scalar_summary = scalar_summary; }
00263   void Set_Array_Summary(ARRAY_SUMMARY* array_summary) 
00264     { _array_summary = array_summary; }
00265   void Set_Sanity_Check_Level(INT sanity_check_level) 
00266     { _sanity_check_level = sanity_check_level; }
00267   void Sdebug(char init_buffer[]);
00268   void Debug(); 
00269 }; 
00270 
00271 #endif /* wb_browser_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines