From b4e912a7f6521c7fecbf4bde2eb5e6166bb92d1f Mon Sep 17 00:00:00 2001 From: Bill Maddox Date: Thu, 29 May 2008 20:13:15 +0000 Subject: * lto-tree-in.h, lto-tree-out.h: New files, accidently omitted from previous commit. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/lto-streamer@136183 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.lto | 7 +++- gcc/lto-tree-in.h | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++ gcc/lto-tree-out.h | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 244 insertions(+), 1 deletion(-) create mode 100644 gcc/lto-tree-in.h create mode 100644 gcc/lto-tree-out.h diff --git a/gcc/ChangeLog.lto b/gcc/ChangeLog.lto index cb04b9255b6..2da2e94221a 100644 --- a/gcc/ChangeLog.lto +++ b/gcc/ChangeLog.lto @@ -1,6 +1,11 @@ +2008-05-29 Bill Maddox + + * lto-tree-in.h, lto-tree-out.h: New files, + accidently omitted from previous commit. + 2008-05-28 Bill Maddox -Replace the DWARF reader in the LTO front-end. + Replace the DWARF reader in the LTO front-end. * lto-tree-flags.def: Add flags for *_DECL and *_TYPE for use by g lobal streamer. diff --git a/gcc/lto-tree-in.h b/gcc/lto-tree-in.h new file mode 100644 index 00000000000..b27997e1045 --- /dev/null +++ b/gcc/lto-tree-in.h @@ -0,0 +1,118 @@ +/* LTO input code. + Copyright (C) 2007, 2008 Free Software Foundation, Inc. + Contributed by Kenneth Zadeck + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License" +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_LTO_TREE_IN_H +#define GCC_LTO_TREE_IN_H + +#include "lto-section-in.h" + + +/* lto-function-in.c */ + +struct data_in +{ + /* The global decls and types. */ + struct lto_file_decl_data* file_data; + + /* The offsets to decode the local_decls. */ + int *local_decls_index; + + /* A table to reconstruct the local_decls. */ + int *local_decl_indexes; + +#ifdef LTO_STREAM_DEBUGGING + /* The offsets to decode the local_decls debug info. */ + int *local_decls_index_d; +#endif + + /* The local var_decls and the parm_decls. */ + tree *local_decls; + + /* All of the labels. */ + tree *labels; + + /* The string table. */ + const char * strings; + + /* The length of the string table. */ + unsigned int strings_len; + /* Number of named labels. Used to find the index of unnamed labels + since they share space with the named labels. */ + unsigned int num_named_labels; + const char *current_file; + int current_line; + int current_col; + + /* ### */ + /* Context for reading global variables and types. + When a new variable or type is read in from the stream, + it is pushed onto this vector. Subsequent references + to the variable or type specify the vector index. */ + VEC(tree,heap) *globals_index; + + /* ### */ + /* True if reading globals and types. */ + bool global; +}; + +/* Used in lto/lto.c */ +extern void lto_static_init_local (void); +extern tree input_tree (struct lto_input_block *, struct data_in *); + +/* FN is a FUNCTION_DECL. DATA is the LTO data written out during + ordinary compilation, encoding the body of FN. FILE_DATA are the + tables holding all of the global types and decls used by FN. Upon + return, DECL_SAVED_TREE for FN contains the reconstituted body of + FN and DECL_INITIAL contains the BLOCK tree for the function. + However, it is not this function's responsibility to provide FN to + the optimizers or code-generators; that will be done by the + caller. */ +extern void +lto_input_function_body (struct lto_file_decl_data* file_data, + tree fn, const char *data); + +/* DATA is the LTO data written out during ordinary compilation, + encoding the initializers for the static and external vars. + FILE_DATA are the tables holding all of the global types and decls + used in that file. */ +extern void +lto_input_constructors_and_inits (struct lto_file_decl_data* file_data, + const char *data); + + +/* lto-symtab.c */ + +/* The NEW_VAR (a VAR_DECL) has just been read. If there is an + existing variable with the same name, merge the declaration for + NEW_VAR with the previous declaration and return the previous + declaration. In this case, NEW_VAR must no longer be used by the + caller. All other entities referenced from NEW_VAR (including, in + particular, its type) must already have been merged before this + function is called. If the merge fails (due to inconsistencies + between the declarations), an error message is issued, and + error_mark_node is returned. If there is no previous declaration, + NEW_VAR is returned. */ +extern tree lto_symtab_merge_var (tree new_var); + +/* Like lto_symtab_merge_var, but for functions. */ +extern tree lto_symtab_merge_fn (tree new_fn); + + +#endif /* GCC_LTO_TREE_IN_H */ diff --git a/gcc/lto-tree-out.h b/gcc/lto-tree-out.h new file mode 100644 index 00000000000..6d5809511d6 --- /dev/null +++ b/gcc/lto-tree-out.h @@ -0,0 +1,120 @@ +/* LTO output code. + Copyright (C) 2007, 2008 Free Software Foundation, Inc. + Contributed by Kenneth Zadeck + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_LTO_TREE_OUT_H +#define GCC_LTO_TREE_OUT_H + +#include "lto-section-out.h" + + +/* lto-function-out.c */ + +/* The fields written to a function or extern variable header. */ + +struct output_block +{ + enum lto_section_type section_type; + struct lto_out_decl_state *decl_state; + + /* The stream that the main tree codes are written to. */ + struct lto_output_stream *main_stream; + /* The stream that contains the indexes for the local name table. */ + struct lto_output_stream *local_decl_index_stream; + /* The stream that contains the local name table. */ + struct lto_output_stream *local_decl_stream; + /* The stream that contains the names for the named_labels. */ + struct lto_output_stream *named_label_stream; + /* The stream that contains the string table. */ + struct lto_output_stream *string_stream; + /* The stream that contains the ssa_names table. */ + struct lto_output_stream *ssa_names_stream; + /* The stream that contains the cfg. */ + struct lto_output_stream *cfg_stream; + +#ifdef LTO_STREAM_DEBUGGING + /* The stream that contains the local decls index debugging information. */ + struct lto_output_stream *debug_decl_index_stream; + /* The stream that contains the local decls debugging information. */ + struct lto_output_stream *debug_decl_stream; + /* The stream that contains the labels debugging information. */ + struct lto_output_stream *debug_label_stream; + /* The stream that contains the ssa_names debugging information. */ + struct lto_output_stream *debug_ssa_names_stream; + /* The stream that contains the cfg debugging information. */ + struct lto_output_stream *debug_cfg_stream; + /* The stream that contains the gimple debugging information. */ + struct lto_output_stream *debug_main_stream; +#endif + + /* The hash table that contains the set of labels we have seen so + far and the indexes assigned to them. */ + htab_t label_hash_table; + int next_named_label_index; + int next_unnamed_label_index; + VEC(tree,heap) *named_labels; + + /* The hash table that contains the set of local parm and var decls + we have seen so far and the indexes assigned to them. */ + htab_t local_decl_hash_table; + unsigned int next_local_decl_index; + /* The local_decls_index and the local_decls_index_d are the indexes + in the local var stream and the local var debugging stream where + a particular local var is located. This allows the local vars to + be read in random order. */ + VEC(int,heap) *local_decls_index; + /* Index in local_decls so that list can be reconstructed + properly. */ + VEC(int,heap) *unexpanded_local_decls_index; +#ifdef LTO_STREAM_DEBUGGING + VEC(int,heap) *local_decls_index_d; +#endif + VEC(tree,heap) *local_decls; + + /* The hash table that contains the set of strings we have seen so + far and the indexes assigned to them. */ + htab_t string_hash_table; + unsigned int next_string_index; + + /* The current cgraph_node that we are currently serializing. Null + if we are serializing something else. */ + struct cgraph_node *cgraph_node; + + /* These are the last file and line that were seen in the stream. + If the current node differs from these, it needs to insert + something into the stream and fix these up. */ + const char *current_file; + int current_line; + int current_col; + + /* ### */ + /* True if writing globals and types. */ + bool global; + /* Map global decls and types to indices in the main stream. */ + htab_t main_hash_table; + /* Index in main stream of next node. */ + unsigned int next_main_index; +}; + +struct output_block * create_output_block (enum lto_section_type); +void destroy_output_block (struct output_block *); + +extern void output_tree (struct output_block *, tree); + +#endif /* GCC_LTO_TREE_OUT_H */ -- cgit v1.2.3