00001 /* 00002 * Copyright 2003, 2004, 2005, 2006 PathScale, Inc. All Rights Reserved. 00003 */ 00004 00005 /* 00006 00007 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00008 00009 This program is free software; you can redistribute it and/or modify it 00010 under the terms of version 2 of the GNU General Public License as 00011 published by the Free Software Foundation. 00012 00013 This program is distributed in the hope that it would be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 00017 Further, this software is distributed without any warranty that it is 00018 free of the rightful claim of any third person regarding infringement 00019 or the like. Any license provided herein, whether implied or 00020 otherwise, applies only to this software file. Patent licenses, if 00021 any, provided herein do not apply to combinations of this program with 00022 other software, or any other product whatsoever. 00023 00024 You should have received a copy of the GNU General Public License along 00025 with this program; if not, write the Free Software Foundation, Inc., 59 00026 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00027 00028 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00029 Mountain View, CA 94043, or: 00030 00031 http://www.sgi.com 00032 00033 For further information regarding this notice, see: 00034 00035 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00036 00037 */ 00038 00039 00040 /* -*-Mode: c++;-*- (Tell emacs to use c++ mode) */ 00041 00042 // Definitions that are needed by almost every ipo_*.cxx. 00043 00044 #ifndef ipo_defs_INCLUDED 00045 #define ipo_defs_INCLUDED 00046 00047 00048 #ifndef symtab_INCLUDED 00049 #include "symtab.h" 00050 #endif 00051 00052 #ifndef cxx_ipa_cg_INCLUDED 00053 #include "ipa_cg.h" 00054 #endif 00055 00056 extern "C" WN_MAP RID_map; // #include "region_util.h" 00057 extern WN_MAP Parent_Map; // #include "ipo_main.h" 00058 00059 //---------------------------------------------------------------------- 00060 // Save/restore the context of an IPA_NODE 00061 //---------------------------------------------------------------------- 00062 class IPA_NODE_CONTEXT 00063 { 00064 private: 00065 00066 SYMTAB_IDX _current_scope; 00067 SCOPE* _scope_tab; 00068 PU* _current_pu; 00069 PU_Info* _current_pu_info; 00070 00071 MEM_POOL* src_pool; 00072 MEM_POOL* pu_pool; 00073 MEM_POOL* wn_pool; 00074 00075 WN_MAP parent_map; 00076 WN_MAP region_map; 00077 WN_MAP_TAB* map_tab; 00078 00079 DST_TYPE dst; 00080 FEEDBACK* feedback; 00081 00082 public: 00083 00084 IPA_NODE_CONTEXT (IPA_NODE *node) { 00085 _current_scope = CURRENT_SYMTAB; 00086 _scope_tab = Scope_tab; 00087 _current_pu = Current_pu; 00088 _current_pu_info = Current_PU_Info; 00089 src_pool = MEM_src_pool_ptr; 00090 pu_pool = MEM_pu_pool_ptr; 00091 wn_pool = WN_mem_pool_ptr; 00092 parent_map = Parent_Map; 00093 region_map = RID_map; 00094 map_tab = Current_Map_Tab; 00095 dst = Current_DST; 00096 feedback = Cur_PU_Feedback; 00097 00098 #ifdef KEY 00099 // Support these as necessary. 00100 if (node->Is_Builtin()) { 00101 MEM_src_pool_ptr = NULL; 00102 Current_PU_Info = node->Builtin_PU_Info(); 00103 Current_DST = NULL; 00104 Parent_Map = 0; 00105 } else 00106 #endif 00107 { 00108 MEM_src_pool_ptr = IP_FILE_HDR_mem_pool (node->File_Header ()); 00109 Current_PU_Info = node->PU_Info (); 00110 Current_DST = node->File_Dst(); 00111 Parent_Map = node->Parent_Map(); 00112 } 00113 Current_Map_Tab = PU_Info_maptab (Current_PU_Info); 00114 WN_mem_pool_ptr = node->Mem_Pool(); 00115 MEM_pu_pool_ptr = WN_mem_pool_ptr; 00116 Current_pu = &(node->Get_PU ()); 00117 CURRENT_SYMTAB = PU_lexical_level (*Current_pu); 00118 Scope_tab = node->Scope (); 00119 Cur_PU_Feedback = node->Feedback_Info (); 00120 } 00121 00122 ~IPA_NODE_CONTEXT () { 00123 CURRENT_SYMTAB = _current_scope; 00124 Scope_tab = _scope_tab; 00125 Current_pu = _current_pu; 00126 Current_PU_Info = _current_pu_info; 00127 MEM_src_pool_ptr = src_pool; 00128 WN_mem_pool_ptr = wn_pool; 00129 MEM_pu_pool_ptr = pu_pool; 00130 Parent_Map = parent_map; 00131 RID_map = region_map; 00132 Current_Map_Tab = map_tab; 00133 Current_DST = dst; 00134 Cur_PU_Feedback = feedback; 00135 } 00136 }; // IPA_NODE_CONTEXT 00137 00138 #endif// ipo_defs_INCLUDED
1.5.6