From patchwork Wed Mar 23 22:14:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 88121 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id D3058B6F77 for ; Thu, 24 Mar 2011 09:15:17 +1100 (EST) Received: (qmail 22377 invoked by alias); 23 Mar 2011 22:14:46 -0000 Received: (qmail 22347 invoked by uid 22791); 23 Mar 2011 22:14:44 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 23 Mar 2011 22:14:17 +0000 Received: from hpaq7.eem.corp.google.com (hpaq7.eem.corp.google.com [172.25.149.7]) by smtp-out.google.com with ESMTP id p2NMEFiv001501; Wed, 23 Mar 2011 15:14:15 -0700 Received: from topo.tor.corp.google.com (topo.tor.corp.google.com [172.29.41.2]) by hpaq7.eem.corp.google.com with ESMTP id p2NMECUk016644; Wed, 23 Mar 2011 15:14:13 -0700 Received: by topo.tor.corp.google.com (Postfix, from userid 54752) id F2FD6ED0E; Wed, 23 Mar 2011 18:14:11 -0400 (EDT) To: gcc-patches@gcc.gnu.org, reply@codereview.appspotmail.com, crowl@google.com Subject: [pph] AST streaming (1/4) (issue4303049) Message-Id: <20110323221411.F2FD6ED0E@topo.tor.corp.google.com> Date: Wed, 23 Mar 2011 18:14:11 -0400 (EDT) From: dnovillo@google.com (Diego Novillo) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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. --- This patch is available for review at http://codereview.appspot.com/4303049 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= A mapping from .h to .pph - -fpph-map= -C++ ObjC++ Joined MissingArgError(missing filename after %qs) --fpph-map= 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= A mapping from .h to .pph + fpph-logfile= C++ Joined RejectNegative Var(flag_pph_logfile) -fpph-logfile= Emit PPH debug information to +fpph-map= +C++ ObjC++ Joined MissingArgError(missing filename after %qs) +-fpph-map= 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