This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][LTO] Stream PHI locations properly


Easier than I thought ...

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to the 
branch.

Richard.

2009-08-03  Richard Guenther  <rguenther@suse.de>

	* lto-streamer-out.c (output_phi): Output phi argument locations.
	* lto-streamer-in.c (lto_input_location): Move before first use.
	(input_phi): Input phi argument locations.

Index: gcc/lto-streamer-out.c
===================================================================
*** gcc/lto-streamer-out.c	(revision 150354)
--- gcc/lto-streamer-out.c	(working copy)
*************** output_phi (struct output_block *ob, gim
*** 1753,1758 ****
--- 1753,1759 ----
      {
        lto_output_tree_ref (ob, gimple_phi_arg_def (phi, i));
        output_uleb128 (ob, gimple_phi_arg_edge (phi, i)->src->index);
+       lto_output_location (ob, gimple_phi_arg_location (phi, i));
      }
  }
  
Index: gcc/lto-streamer-in.c
===================================================================
*** gcc/lto-streamer-in.c	(revision 150354)
--- gcc/lto-streamer-in.c	(working copy)
*************** input_cfg (struct lto_input_block *ib, s
*** 761,766 ****
--- 761,795 ----
  }
  
  
+ /* Read a location from input block IB.  */
+ 
+ static location_t
+ lto_input_location (struct lto_input_block *ib, struct data_in *data_in)
+ {
+   expanded_location xloc;
+   location_t loc;
+ 
+   xloc.file = input_string (data_in, ib);
+   if (xloc.file == NULL)
+     return UNKNOWN_LOCATION;
+ 
+   xloc.line = lto_input_sleb128 (ib);
+   xloc.column = lto_input_sleb128 (ib);
+ 
+   if (data_in->current_file)
+     linemap_add (line_table, LC_LEAVE, false, NULL, 0);
+ 
+   data_in->current_file = canon_file_name (xloc.file);
+   data_in->current_line = xloc.line;
+   data_in->current_col = xloc.column;
+ 
+   linemap_add (line_table, LC_ENTER, false, data_in->current_file, xloc.line);
+   LINEMAP_POSITION_FOR_COLUMN (loc, line_table, xloc.column);
+ 
+   return loc;
+ }
+ 
+ 
  /* Read a PHI function for basic block BB in function FN.  DATA_IN is
     the file being read.  IB is the input block to use for reading.  */
  
*************** input_phi (struct lto_input_block *ib, b
*** 786,791 ****
--- 815,821 ----
      {
        tree def = lto_input_tree (ib, data_in);
        int src_index = lto_input_uleb128 (ib);
+       location_t arg_loc = lto_input_location (ib, data_in);
        basic_block sbb = BASIC_BLOCK_FOR_FUNCTION (fn, src_index);
        
        edge e = NULL;
*************** input_phi (struct lto_input_block *ib, b
*** 798,805 ****
  	    break;
  	  }
  
!       /* FIXME lto: we need to properly stream phi argument locations.  */
!       add_phi_arg (result, def, e, UNKNOWN_LOCATION); 
      }
  
    return result;
--- 828,834 ----
  	    break;
  	  }
  
!       add_phi_arg (result, def, e, arg_loc); 
      }
  
    return result;
*************** input_ssa_names (struct lto_input_block 
*** 840,874 ****
  }
  
  
- /* Read a location from input block IB.  */
- 
- static location_t
- lto_input_location (struct lto_input_block *ib, struct data_in *data_in)
- {
-   expanded_location xloc;
-   location_t loc;
- 
-   xloc.file = input_string (data_in, ib);
-   if (xloc.file == NULL)
-     return UNKNOWN_LOCATION;
- 
-   xloc.line = lto_input_sleb128 (ib);
-   xloc.column = lto_input_sleb128 (ib);
- 
-   if (data_in->current_file)
-     linemap_add (line_table, LC_LEAVE, false, NULL, 0);
- 
-   data_in->current_file = canon_file_name (xloc.file);
-   data_in->current_line = xloc.line;
-   data_in->current_col = xloc.column;
- 
-   linemap_add (line_table, LC_ENTER, false, data_in->current_file, xloc.line);
-   LINEMAP_POSITION_FOR_COLUMN (loc, line_table, xloc.column);
- 
-   return loc;
- }
- 
- 
  /* Read a statement with tag TAG in function FN from block IB using
     descriptors in DATA_IN.  */
  
--- 869,874 ----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]