Sorry, forgot to attach another patch. This patch contains the changes in
osprey/common/com, including:
* read/write WSSA information from/to .B/.I/etc file
* enhancements to ir_b2a to dump the WSSA information
* options to control WSSA. It's turned off by default so far.

Thank you very much.

2010/11/17 Jian-Xin Lai <laij...@gmail.com>

> Hi Sun,
>
> Could you please review the code for WHIRL SSA WOPT emitter? This emitter
> is used to translate the HSSA into WHIRL SSA. The wssa_emitter.h and
> wssa_emitter.cxx provide the interface and implementation to translate the
> WOPT symtab, HSSA CODEREP, HSSA phi node, HSSA chi node, HSSA mu node to
> WSSA symtab, WSSA version, WSSA phi node, WSSA chi node, WSSA mu node
> respectively.
> The changes in be/opt will invoke these functions to generate WHIRL SSA in
> either PreOPT or MainOPT.
>
> Thank you very much.
>
> --
> Regards,
> Lai Jian-Xin
>



-- 
Regards,
Lai Jian-Xin
Index: common/com/ir_bwrite.cxx
===================================================================
--- common/com/ir_bwrite.cxx	(revision 3402)
+++ common/com/ir_bwrite.cxx	(working copy)
@@ -99,6 +99,7 @@
 #include "tracing.h"                /* TEMPORARY FOR ROBERT'S DEBUGGING */
 
 #ifdef BACK_END
+#include "wssa_io.h"
 #include "glob.h"
 #include "pf_cg.h"
 #include "instr_reader.h"
@@ -1045,7 +1046,44 @@
 
 } /* WN_write_depgraph */
 
+/*
+ *  Note: write the SSA info into file
+ */
+void
+WN_write_SSA(PU_Info *pu, Output_File *fl)
+{
+    Section *cur_section = fl->cur_section;
 
+    if (PU_Info_state(pu, WT_SSA) == Subsect_Missing)
+	return;
+
+    if (strcmp(cur_section->name, MIPS_WHIRL_PU_SECTION) != 0 ||
+	PU_Info_state(pu, WT_SSA) != Subsect_InMem)
+	ErrMsg (EC_IR_Scn_Write, "WHIRL SSA info", fl->file_name);
+
+    WSSA::WHIRL_SSA_MANAGER *wssa_mgr = PU_Info_ssa_ptr(pu);
+    if (!wssa_mgr->Is_stat_OK()) {
+      Set_PU_Info_state(pu, WT_SSA, Subsect_Missing);
+      PU_Info_subsect_size(pu, WT_SSA) = 0;
+      PU_Info_subsect_offset(pu, WT_SSA) = fl->file_size - cur_section->shdr.sh_offset;
+      delete wssa_mgr;
+      return;
+    }
+    
+    fl->file_size = ir_b_align(fl->file_size, sizeof(mINT32), 0);
+    off_t wssa_base = fl->file_size;
+
+    WSSA::WHIRL_SSA_IO wssa_io(wssa_mgr);
+    wssa_io.Write_To_Output_File(fl);
+
+    Set_PU_Info_state(pu, WT_SSA, Subsect_Written);
+    PU_Info_subsect_size(pu, WT_SSA) = fl->file_size - wssa_base;
+    PU_Info_subsect_offset(pu, WT_SSA) = wssa_base - cur_section->shdr.sh_offset;
+
+    // wssa_mgr is no longer needed
+    delete wssa_mgr;
+} 
+
 /*
  * Write out the prefetch pointer mapping. The prefetch mappings are written
  * to PU subsections.  The size and offset of the output subsection are
@@ -1453,6 +1491,10 @@
     WN_write_tree (pu, off_map, ir_output);
 
 #ifdef BACK_END
+    /*write out the whirl ssa info*/
+    if (PU_Info_state(pu, WT_SSA) == Subsect_InMem)
+        WN_write_SSA(pu, ir_output);
+
     if (Write_BE_Maps || Write_ALIAS_CLASS_Map) {
 	if (Write_BE_Maps) {
 	    WN_write_depgraph(pu, off_map, ir_output);
Index: common/com/ir_bwrite.h
===================================================================
--- common/com/ir_bwrite.h	(revision 3402)
+++ common/com/ir_bwrite.h	(working copy)
@@ -152,6 +152,7 @@
 				 INT32        subsection_type,
 				 WN_MAP       value_map,
 				 const char  *subsection_name);
+extern void WN_write_SSA(PU_Info *pu, Output_File *fl);
 #ifndef OWN_ERROR_PACKAGE
 
 /*
Index: common/com/config_opt.h
===================================================================
--- common/com/config_opt.h	(revision 3402)
+++ common/com/config_opt.h	(working copy)
@@ -200,6 +200,10 @@
 extern BOOL Early_Goto_Conversion;
 extern BOOL Early_Goto_Conversion_Set;
 extern INT32 OPT_Madd_Height;
+
+extern BOOL OPT_Enable_WHIRL_SSA;  // enable SSA on WHIRL
+extern BOOL OPT_Enable_BUILD_WHIRL_SSA; // enable build WSSA driect from WHIRL
+
 #endif
 #ifdef __cplusplus
 }
Index: common/com/config_opt.cxx
===================================================================
--- common/com/config_opt.cxx	(revision 3402)
+++ common/com/config_opt.cxx	(working copy)
@@ -325,6 +325,10 @@
 BOOL Early_Goto_Conversion_Set = FALSE;
 #endif	// KEY
 
+
+BOOL OPT_Enable_WHIRL_SSA = FALSE;  // SSA on WHIRL, disabled by default
+BOOL OPT_Enable_BUILD_WHIRL_SSA = FALSE;  // SSA on WHIRL, disabled by default
+
 /***** Obsolete options *****/
 static BOOL Fprop_Limit_Set = FALSE;
 
@@ -850,6 +854,14 @@
     "Enable dead function elimination in the frontend" },
 #endif /* __linux__ */
 
+  { OVK_BOOL,	OV_INTERNAL,	FALSE, "wssa",	NULL,
+    0, 0, 0,	&OPT_Enable_WHIRL_SSA,	NULL,
+    "Enable building up SSA on WHIRL" },
+
+  { OVK_BOOL,	OV_INTERNAL,	FALSE, "wssa_build",	NULL,
+    0, 0, 0,	&OPT_Enable_BUILD_WHIRL_SSA,	NULL,
+    "Enable building WHIRL SSA directly on WHIRL" },
+
   /* Obsolete options: */
 
   { OVK_OBSOLETE,	OV_INTERNAL,	FALSE, "global_limit",		NULL,
Index: common/com/ir_bread.h
===================================================================
--- common/com/ir_bread.h	(revision 3402)
+++ common/com/ir_bread.h	(working copy)
@@ -126,6 +126,7 @@
 extern INT WN_get_dst (void *handle);
 extern INT WN_get_localmap (void *handle);
 extern INT WN_get_feedback (void* handle, PU_Info*pu, MEM_POOL* pool);    
+extern INT WN_get_SSA (void *handle, PU_Info *pu, MEM_POOL* pool);
 
 /*
  * Read the command line flags used to compile the input file.  The
Index: common/com/ir_reader.cxx
===================================================================
--- common/com/ir_reader.cxx	(revision 3402)
+++ common/com/ir_reader.cxx	(working copy)
@@ -108,6 +108,7 @@
 #include "dwarf_DST_mem.h"
 #include "ir_reader.h"
 #include "tracing.h"
+#include "config_opt.h"
 
 #ifdef BACK_END
 #include "opt_alias_mgr.h"
@@ -126,6 +127,13 @@
 #include "dvector.h"
 #endif /* BACK_END */
 
+#if defined(BACK_END) || defined(IR_TOOLS)
+/*for whirl ssa*/
+#include "wssa_mgr.h"
+#include "wssa_wn.h"
+#include "pu_info.h"
+#endif
+
 #include <sstream> 
 using namespace std; 
 
@@ -892,6 +900,59 @@
    fprintf(ir_ofile, ">");
 }
 
+#if defined(BACK_END) || defined(IR_TOOLS)
+static void ir_put_phi_list(WN* wn, INT indent)
+{
+   const WSSA::WHIRL_SSA_MANAGER * wsm = PU_Info_ssa_ptr(Current_PU_Info);
+   if (! wsm->Is_stat_OK())
+      return;
+
+   if (! wsm->WN_has_phi(wn))
+      return;
+
+   ir_put_marker("PHI NODES",indent);
+   for (WSSA::WHIRL_SSA_MANAGER::const_phi_iterator phi_iter = wsm->WN_phi_begin(wn);
+        phi_iter != wsm->WN_phi_end(wn);
+        ++phi_iter) {
+      phi_iter->Print(ir_ofile, indent);
+   }
+} 
+
+static void ir_put_chi_list(WN* wn, INT indent)
+{
+   const WSSA::WHIRL_SSA_MANAGER * wsm = PU_Info_ssa_ptr(Current_PU_Info);
+   if (! wsm->Is_stat_OK())
+      return;
+
+   if (! wsm->WN_has_chi(wn))
+      return;
+
+   ir_put_marker("CHI NODES",indent);
+   for (WSSA::WHIRL_SSA_MANAGER::const_chi_iterator chi_iter = wsm->WN_chi_begin(wn);
+        chi_iter != wsm->WN_chi_end(wn);
+        ++chi_iter) {
+      chi_iter->Print(ir_ofile, indent);
+   }
+}
+
+static void ir_put_mu_list(WN* wn, INT indent)
+{
+   const WSSA::WHIRL_SSA_MANAGER * wsm = PU_Info_ssa_ptr(Current_PU_Info);
+   if (! wsm->Is_stat_OK())
+       return;
+
+   if (! wsm->WN_has_mu(wn))
+      return;
+
+   ir_put_marker("MU NODES",indent);
+   for (WSSA::WHIRL_SSA_MANAGER::const_mu_iterator mu_iter = wsm->WN_mu_begin(wn);
+        mu_iter != wsm->WN_mu_end(wn);
+        ++mu_iter) {
+      mu_iter->Print(ir_ofile, indent);
+   }
+}
+#endif
+
 /*
  *  Write an WN * in ascii form on an individual line.
  */ 
@@ -927,6 +988,12 @@
 	fprintf(ir_ofile, "[%5d]", handle);
     }
 
+#if defined(BACK_END) || defined(IR_TOOLS)
+    if (OPT_Enable_WHIRL_SSA && WSSA::WN_has_mu(wn)) {
+        ir_put_mu_list(wn, indent);
+    }
+#endif
+
     if (indent > 0 && opcode == OPC_LABEL)
 	fprintf(ir_ofile, "%*s", indent-1, "");
     else
@@ -1004,7 +1071,7 @@
 	    Is_True(OPCODE_operator(opcode) == OPR_INTRINSIC_OP ||
 		    OPCODE_operator(opcode) == OPR_INTRINSIC_CALL,
 		    ("ir_put_wn, expected an intrinsic"));
-#if defined(BACK_END) || defined(IR_TOOLS) || defined(TARG_NVISA)
+#if defined(BACK_END) || defined(IR_TOOLS)
 	    fprintf(ir_ofile, " <%d,%s>", WN_intrinsic(wn),
 		    INTRINSIC_name((INTRINSIC) WN_intrinsic(wn)));
 #endif
@@ -1019,7 +1086,18 @@
     if (OPCODE_has_flags(opcode)) 
 	fprintf(ir_ofile, " %d", WN_flag(wn));
     if (OPCODE_has_sym(opcode)) {
-	ir_put_st (WN_st_idx(wn));
+        ir_put_st (WN_st_idx(wn));
+#if defined(BACK_END) || defined(IR_TOOLS)
+        if (OPT_Enable_WHIRL_SSA) {
+            WSSA::WHIRL_SSA_MANAGER * wsm = PU_Info_ssa_ptr(Current_PU_Info);
+            Is_True( wsm != NULL, ("WHIRL SSA MANAGER is NULL") );
+            if (wsm->Is_stat_OK() && WSSA::WN_has_ver(wn)) {
+                WSSA::VER_IDX ver = wsm->Get_wn_ver(wn);
+                WSSA::WST_IDX wst = wsm->Get_ver_wst(ver);
+                fprintf(ir_ofile, " %sv%d", wsm->WST_name(wst), wsm->Get_ver_num(ver));
+            }
+        }
+#endif
     }
 
     if (OPCODE_has_1ty(opcode)) {
@@ -1233,9 +1311,13 @@
 	      WN_MAP32_Get(WN_MAP_ALIAS_CLASS, wn));
     }
     fprintf(ir_ofile, "\n");
+#if defined(BACK_END) || defined(IR_TOOLS)
+    if (OPT_Enable_WHIRL_SSA && WSSA::WN_has_chi(wn)) {
+        ir_put_chi_list(wn, indent);
+    }
+#endif
 }
 
-
 /*
  *  Write an expression and its children in postfix order.
  *  If dump_parent_before_children, write it in prefix order instead.
@@ -1348,6 +1430,10 @@
       if ( WN_label_loop_info(wn) != NULL ) {
 	ir_put_stmt(WN_label_loop_info(wn), indent+1);
       }
+#if defined(BACK_END) || defined(IR_TOOLS)
+      if (OPT_Enable_WHIRL_SSA)
+        ir_put_phi_list(wn, indent);
+#endif
       already_dumped_wn = TRUE;
       break;
 
@@ -1362,12 +1448,21 @@
 	ir_put_stmt(WN_else(wn), indent+1);
       }
       ir_put_marker("END_IF", indent);
+#if defined(BACK_END) || defined(IR_TOOLS)
+      if (OPT_Enable_WHIRL_SSA)
+        ir_put_phi_list(wn, indent);
+#endif
       break;
 
     case OPC_DO_LOOP:
       ir_put_expr(WN_index(wn), indent+1);
       ir_put_marker("INIT",indent);
       ir_put_stmt(WN_start(wn), indent+1);
+#if defined(BACK_END) || defined(IR_TOOLS)
+      if (OPT_Enable_WHIRL_SSA) {
+        ir_put_phi_list(wn, indent+1);
+      }
+#endif
       ir_put_marker("COMP", indent);
       ir_put_expr(WN_end(wn), indent+1);
       ir_put_marker("INCR", indent);
@@ -1380,6 +1475,30 @@
       ir_put_stmt(WN_do_body(wn), indent+1);
       break;
 
+    case OPC_WHILE_DO:
+#if defined(BACK_END) || defined(IR_TOOLS)
+      if (OPT_Enable_WHIRL_SSA) {
+        ir_put_phi_list(wn, indent+1);
+      }
+#endif
+      ir_put_marker("COMP",indent);
+      ir_put_expr(WN_kid(wn, 0), indent+1);
+      ir_put_marker("BODY", indent);
+      ir_put_stmt(WN_kid(wn, 1), indent+1);
+      break;
+
+    case OPC_DO_WHILE:
+#if defined(BACK_END) || defined(IR_TOOLS)
+      if (OPT_Enable_WHIRL_SSA) {
+        ir_put_phi_list(wn, indent+1);
+      }
+#endif
+      ir_put_marker("BODY", indent);
+      ir_put_stmt(WN_kid(wn, 1), indent+1);
+      ir_put_marker("COMP",indent);
+      ir_put_expr(WN_kid(wn, 0), indent+1);
+      break;
+
     case OPC_LOOP_INFO:
       ir_put_wn(wn, indent);
       if ( WN_loop_induction(wn) != NULL ) {
@@ -1409,6 +1528,11 @@
       if (WN_kid_count(wn) > 2)
 	ir_put_stmt(WN_kid(wn,2), indent+1);
       ir_put_marker("END_SWITCH", indent);
+#if defined(BACK_END) || defined(IR_TOOLS)
+      if (OPT_Enable_WHIRL_SSA) {
+        ir_put_phi_list(wn, indent+1);
+      }
+#endif
       already_dumped_wn = TRUE;
       break;
 
Index: common/com/ir_bread.cxx
===================================================================
--- common/com/ir_bread.cxx	(revision 3402)
+++ common/com/ir_bread.cxx	(working copy)
@@ -85,6 +85,7 @@
 #include "wn_core.h"		    /* for WN */
 #include "wn.h"		            /* for max_region_id */
 #include "wn_map.h"		    /* for WN maps */
+
 #define USE_DST_INTERNALS
 #include "dwarf_DST_mem.h"	    /* for dst */
 #include "pu_info.h"
@@ -92,6 +93,7 @@
 #include "ir_bwrite.h"
 #include "ir_bcom.h"
 #include "ir_bread.h"
+#include "config_opt.h"
 
 #if defined(BACK_END)
 #include "xstats.h"
@@ -100,6 +102,10 @@
 #include "pf_cg.h"
 #endif
 
+#if defined(BACK_END) || defined(IR_TOOLS) || defined(BUILD_WHIRL2C) || defined(BUILD_WHIRL2F)
+#include "wssa_io.h"
+#endif
+
 #ifdef BACK_END
 extern "C" {
 extern void Init_Dep_Graph(void *g);
@@ -403,14 +409,64 @@
     return 0;
 } // WN_get_strtab
 
+/*
+ *  Note: get SSA info from file into memory 
+ */
+#ifdef Is_True_On
+WSSA::WHIRL_SSA_MANAGER* G_ssa;
+#endif
 
+INT
+WN_get_SSA (void *handle, PU_Info *pu, MEM_POOL* pool)
+{
+  WSSA::WHIRL_SSA_MANAGER* wssa_mgr;
+  Subsect_State st = PU_Info_state(pu, WT_SSA);
+  if (st == Subsect_InMem) {
+    Is_True(PU_Info_ssa_ptr(pu) != NULL, ("WSSA manager is null"));
+    return 0;
+  }
+  else if (st == Subsect_Written) {
+    return ERROR_RETURN;
+  }
+  else if (st != Subsect_Exists) {
+    wssa_mgr = new WSSA::WHIRL_SSA_MANAGER(pool);
+#ifdef Is_True_On
+    G_ssa = wssa_mgr;
+    Is_True(PU_Info_ssa_ptr(pu) == NULL, ("WSSA manager is not null"));
+#endif
+    Set_PU_Info_ssa_ptr(pu, wssa_mgr);
+    Set_PU_Info_state(pu, WT_SSA, Subsect_InMem);
+    return 0;
+  }
+
+  OFFSET_AND_SIZE shdr = get_section (handle, SHT_MIPS_WHIRL, WT_PU_SECTION);
+  if (shdr.offset == 0)
+    return ERROR_RETURN;
+
+  char *base = (char *) handle + shdr.offset +
+  PU_Info_subsect_offset (pu, WT_SSA);
+
+  wssa_mgr = PU_Info_ssa_ptr(pu);
+  FmtAssert(wssa_mgr != NULL, ("WSSA manager is null"));
+
+#ifdef Is_True_On
+  G_ssa = wssa_mgr;
+#endif
+
+  //read PHI,CHI,MU tables into memory
+  WSSA::WHIRL_SSA_IO wssa_io(wssa_mgr);
+  wssa_io.Read_SSA_From_File(base);
+  
+  Set_PU_Info_state(pu, WT_SSA, Subsect_InMem);
+}
+
 /*
  *  Note: fix_tree is a hot spot for the binary reader, so be very careful
  *  to make everything as fast as possible.
  */
 
 static INT
-fix_tree (WN *node, char *base, Elf64_Word size)
+fix_tree (PU_Info* pu, WN *node, char *base, Elf64_Word size)
 {
     OPCODE opcode = (OPCODE) WN_opcode (node);
     WN *wn;
@@ -446,7 +502,7 @@
 	    CONVERT_OFFSET(WN*, WN_last(node));
 
 	    do {
-		if (fix_tree (wn, base, size) == ERROR_VALUE)
+		if (fix_tree (pu, wn, base, size) == ERROR_VALUE)
 		    return ERROR_VALUE;
 		wn = WN_next(wn);
 	    } while (wn);
@@ -464,7 +520,7 @@
 	    } else {
 		CONVERT_OFFSET(WN*, wn);
 		*wn_ptr = wn;
-		if (fix_tree (wn, base, size) == ERROR_VALUE)
+		if (fix_tree (pu, wn, base, size) == ERROR_VALUE)
     	            return ERROR_VALUE;
 	    }
 	}
@@ -499,6 +555,14 @@
 	}
     }
 
+#if defined(BACK_END) || defined(IR_TOOLS)
+    WSSA::WHIRL_SSA_MANAGER* mgr = PU_Info_ssa_ptr(pu);
+    if (WN_map_id(node) != -1 && mgr != NULL) {
+        // create the map between WN* and map_id
+        mgr->Add_wn(node);
+    }
+#endif
+
     return 0;
 } /* fix_tree */
 
@@ -928,7 +992,7 @@
        map table */
 
     Current_Map_Tab = PU_Info_maptab(pu);
-    if (fix_tree (wn, tree_base, size) == ERROR_VALUE)
+    if (fix_tree (pu, wn, tree_base, size) == ERROR_VALUE)
 	return (WN *)ERROR_VALUE;
 
     WN_next(wn) = NULL;
@@ -1526,6 +1590,12 @@
     else
 	Current_pu = &Pu_Table[ST_pu (Scope_tab[CURRENT_SYMTAB].st)];
 
+#if defined(BACK_END) || defined(IR_TOOLS)
+    if (PU_Info_state(pu, WT_SSA) == Subsect_Exists) {
+        // having WSSA in the IR file, create the SSA manager
+        Set_PU_Info_ssa_ptr(pu, new WSSA::WHIRL_SSA_MANAGER(pool));
+    }
+#endif
 
     if (WN_get_tree (local_fhandle, pu) == (WN*) -1) {
 	ErrMsg ( EC_IR_Scn_Read, "tree", local_ir_file);
@@ -1549,6 +1619,11 @@
     }
 #endif
 
+#if defined(BACK_END) || defined(IR_TOOLS)
+    if (WN_get_SSA (local_fhandle, pu, pool) == -1) {
+	ErrMsg ( EC_IR_Scn_Read, "WHIRL SSA", local_ir_file);
+    }
+#endif
 
     if (WN_get_INT32_map(local_fhandle, pu,
 			 WT_ALIAS_CLASS, WN_MAP_ALIAS_CLASS) == -1) {
Index: ipa/common/ipc_bread.cxx
===================================================================
--- ipa/common/ipc_bread.cxx	(revision 3402)
+++ ipa/common/ipc_bread.cxx	(working copy)
@@ -61,6 +61,10 @@
 #include "ipc_symtab_merge.h"		// for idx_map
 #include "ipl_summary.h"		// for SUMMARY_PROCEDURE, etc.
 
+#if defined(BACK_END) || defined(IR_TOOLS)
+#include "wssa_mgr.h"
+#endif
+
 BOOL IPA_Has_Feedback = FALSE;      /* set if ANY input file contains
                                        feedback information */
 
@@ -416,7 +420,7 @@
 // ipa, we need to remap ST_IDX's while walking the tree.
 
 INT
-IP_READ_fix_tree (WN *node, char *base, Elf64_Word size,
+IP_READ_fix_tree (PU_Info* pu, WN *node, char *base, Elf64_Word size,
                   const IPC_GLOBAL_IDX_MAP* idx_map)
 {
     OPCODE opcode = (OPCODE) WN_opcode (node);
@@ -479,7 +483,7 @@
             WN_last(node) = convert_offset(WN_last(node), base);
 
             do {
-                if (IP_READ_fix_tree (wn, base, size, idx_map) == ERROR_VALUE)
+                if (IP_READ_fix_tree (pu, wn, base, size, idx_map) == ERROR_VALUE)
                     return ERROR_VALUE;
                 wn = WN_next(wn);
             } while (wn);
@@ -496,7 +500,7 @@
             else {
                 wn = convert_offset(wn, base);
                 *wn_ptr = wn;
-                if (IP_READ_fix_tree (wn, base, size, idx_map) == ERROR_VALUE)
+                if (IP_READ_fix_tree (pu, wn, base, size, idx_map) == ERROR_VALUE)
                     return ERROR_VALUE;
             }
         }
@@ -531,6 +535,14 @@
         }
     }
 
+#if defined(BACK_END) || defined(IR_TOOLS)
+    WSSA::WHIRL_SSA_MANAGER* mgr = PU_Info_ssa_ptr(pu);
+    if (WN_map_id(node) != -1 && mgr != NULL) {
+        // create the map between WN* and map_id
+        mgr->Add_wn(node);
+    }
+#endif
+
     return 0;
 } // IP_READ_fix_tree 
 
@@ -570,7 +582,7 @@
     // Fix up the pointers in the WNs, and remap symbol table indices.
 
     Current_Map_Tab = PU_Info_maptab(pu);
-    if (IP_READ_fix_tree (wn, tree_base, size, idx_map) == ERROR_VALUE)
+    if (IP_READ_fix_tree (pu, wn, tree_base, size, idx_map) == ERROR_VALUE)
       return reinterpret_cast<WN*>(ERROR_VALUE);
 
     WN_next(wn) = NULL;
@@ -770,6 +782,13 @@
     else
       Current_pu = &Pu_Table[ST_pu (Scope_tab[CURRENT_SYMTAB].st)];
 
+#if defined(BACK_END) || defined(IR_TOOLS)
+    if (PU_Info_state(pu, WT_SSA) == Subsect_Exists) {
+        // having WSSA in the IR file, create the SSA manager
+        Set_PU_Info_ssa_ptr(pu, new WSSA::WHIRL_SSA_MANAGER(pool));
+    }
+#endif
+
     if (IP_READ_get_tree (fhandle, pu, IP_FILE_HDR_idx_maps(s)) == (WN*) -1) {
       ErrMsg ( EC_IR_Scn_Read, "tree", IP_FILE_HDR_file_name(s));
     }
@@ -795,6 +814,15 @@
     }
 #endif
 
+#if defined(BACK_END) || defined(IR_TOOLS)
+    if (PU_Info_state(pu, WT_SSA) == Subsect_Exists) {
+      // We should call
+      //    WN_get_SSA (fhandle, pu, pool);
+      // But WSSA doesn't support IPA so far, onlu set the state
+      Set_PU_Info_state(pu, WT_SSA, Subsect_InMem);
+    }
+#endif
+
     if (WN_get_feedback (fhandle, pu, pool) == -1)
 	ErrMsg ( EC_IR_Scn_Read, "feedback info", IP_FILE_HDR_file_name(s));
 
Index: ipa/common/ipc_bwrite.cxx
===================================================================
--- ipa/common/ipc_bwrite.cxx	(revision 3402)
+++ ipa/common/ipc_bwrite.cxx	(working copy)
@@ -233,6 +233,17 @@
   if (PU_Info_state (pu, WT_FEEDBACK) == Subsect_InMem)
       WN_write_feedback (pu, outfile);
 
+#if defined(BACK_END) || defined(IR_TOOLS)
+  if (PU_Info_state (pu, WT_SSA) == Subsect_InMem) {
+      // We should call
+      //    WN_write_SSA (pu, outfile);
+      // But since WSSA doesn't support IPA so far. Only set the status
+      Set_PU_Info_state(pu, WT_SSA, Subsect_Missing);
+      PU_Info_subsect_size(pu, WT_SSA) = 0;
+      PU_Info_subsect_offset(pu, WT_SSA) = 0;
+  }
+#endif
+
   WN_write_tree (pu, off_map, outfile);
 
   if (Write_ALIAS_CLASS_Map || Write_AC_INTERNAL_Map) {
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to