[pph] AST streaming (1/4) (issue4303049)

Diego Novillo dnovillo@google.com
Wed Mar 23 22:14:00 GMT 2011


This set of 4 patches sets up the basic streaming facility for PPH.
The idea is to re-use common code in LTO streaming and add streaming
hooks for dealing with front end specific data.

As we discussed earlier today (http://gcc.gnu.org/ml/gcc/2011-03/msg00354.html),
the front end needs to handle more tree codes that we do not care
about in gimple.  Furthermore, we are interested in removing some of
the tree codes that gimple is forced to handle.  So, the actual
pickling of trees will eventually move into language specific files
and we will add streaming hooks to call from common code.

These patches are actually a single unit, but I split them in 4 parts
for clarity:

1- Adds the inevitable tracer flag (-fpph-tracer) to show what the
   writer and the reader think they are doing.

2- Adds the main streaming support.
   For now PPH files are very simple:
   	- Identification string
	- Version (major, minor, patchlevel)
	- Size of string table.
	- String table.
	- Symbol table.
   This is the extent of the data that we are currently streaming.

   PPH streaming works similarly to FILE I/O:

   	pph_stream_open(): Opens a pph file by setting up all the
	    data structures and tables needed by LTO routines.
	pph_output_*/pph_input_*: Wrappers around LTO streaming
	    routines.
	pph_stream_close(): Writes out all the streams built by the
	    pph_output_* calls.

    Above these pph streaming routines we are implementing the
    high-level logic for saving and restoring the parser state.  This
    patch works now for PTH (pre-tokenized headers).  There is also
    some early saving of parsed trees, but it is still very
    incomplete.

3- Exports some LTO functions that were private to the LTO streamer.

4- Hacks around some checks and assumptions that LTO makes about
   gimple.  These are the ones that I will need to either add hooks or
   factor out somehow.  For now I marked them with FIXME notes.  I
   want to get most/all of them before I decide how to factor things
   out.

Lawrence, we have some regressions in pph.exp because we can't handle
template decls.  I'll be fixing that in the next few days.

Tested on x86_64.


Diego.


c-family/ChangeLog.pph

	* c-family/c.opt (fpph-hdr, fpph-map): Re-order.
	(fpph-tracer): New.

diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index fd4406f..211586a 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -925,14 +925,6 @@ fpph
 C++ Var(flag_pph)
 -fpph   Enable pre-parsed header (PPH) support
 
-fpph-hdr=
-C++ ObjC++ Joined MissingArgError(missing filename after %qs)
--fpph-hdr=<base-name>   A mapping from <base-name>.h to <base-name>.pph
-
-fpph-map=
-C++ ObjC++ Joined MissingArgError(missing filename after %qs)
--fpph-map=<file-name>   A file of mappings from #include to PPH file
-
 fpph-debug=
 C++ Joined RejectNegative UInteger Var(flag_pph_debug)
 -fpph-debug=N   Enable debugging output at level N from PPH support
@@ -945,14 +937,26 @@ fpph-fmt=
 C++ Joined RejectNegative UInteger Var(flag_pph_fmt)
 -fpph-fmt=N   Output format is (0) normal (1) pretty summary (2) dump
 
+fpph-hdr=
+C++ ObjC++ Joined MissingArgError(missing filename after %qs)
+-fpph-hdr=<base-name>   A mapping from <base-name>.h to <base-name>.pph
+
 fpph-logfile=
 C++ Joined RejectNegative Var(flag_pph_logfile)
 -fpph-logfile=<file-name>	Emit PPH debug information to <file-name>
 
+fpph-map=
+C++ ObjC++ Joined MissingArgError(missing filename after %qs)
+-fpph-map=<file-name>   A file of mappings from #include to PPH file
+
 fpph-stats
 C++ Var(flag_pph_stats)
 -fpph-stats	Enable statistics gathering for PPH
 
+fpph-tracer
+C++ Var(flag_pph_tracer)
+-fpph-tracer	Enable tracing of PPH streaming operations
+
 fpreprocessed
 C ObjC C++ ObjC++
 Treat the input file as already preprocessed

--
This patch is available for review at http://codereview.appspot.com/4303049



More information about the Gcc-patches mailing list