aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOllie Wild <aaw@google.com>2008-04-16 20:48:52 +0000
committerOllie Wild <aaw@google.com>2008-04-16 20:48:52 +0000
commita6b4f031db7f390702746650ef7b9cf681418305 (patch)
tree4e7dfb8a9596b57c062379b93b116cc3bfe9864f
parent5b41a27843bbfc66444d6f0e9963b53a092f3c2e (diff)
gcc/
* lto-function-out.c (output_type_ref_1): New function. (output_type_ref): Split into two functions. (output_function): Output an LTO_type record if DECL_CONTEXT (function) is a type. * lto-tags.h (LTO_tags): Add LTO_type enumerator. * lto-tree-tags.def (LTO_type): Add new name. gcc/lto/ * lto-function-in.c (input_type_ref_1): New function. (input_type_ref): Split into two functions. (input_function): Add support for type contexts. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/lto@134363 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.lto9
-rw-r--r--gcc/lto-function-out.c33
-rw-r--r--gcc/lto-tags.h1
-rw-r--r--gcc/lto-tree-tags.def1
-rw-r--r--gcc/lto/ChangeLog6
-rw-r--r--gcc/lto/lto-function-in.c25
6 files changed, 63 insertions, 12 deletions
diff --git a/gcc/ChangeLog.lto b/gcc/ChangeLog.lto
index bee6aae4a43..19105a7046c 100644
--- a/gcc/ChangeLog.lto
+++ b/gcc/ChangeLog.lto
@@ -1,3 +1,12 @@
+2008-04-16 Ollie Wild <aaw@google.com>
+
+ * lto-function-out.c (output_type_ref_1): New function.
+ (output_type_ref): Split into two functions.
+ (output_function): Output an LTO_type record if DECL_CONTEXT (function)
+ is a type.
+ * lto-tags.h (LTO_tags): Add LTO_type enumerator.
+ * lto-tree-tags.def (LTO_type): Add new name.
+
2008-03-25 Kenneth Zadeck <zadeck@naturalbridge.com>
Merge with mainline @133491.
diff --git a/gcc/lto-function-out.c b/gcc/lto-function-out.c
index 029a35cc6af..3bcc3de38f1 100644
--- a/gcc/lto-function-out.c
+++ b/gcc/lto-function-out.c
@@ -594,17 +594,14 @@ output_tree_flags (struct output_block *ob,
}
-/* Look up TYPE in the type table and write the uleb128 index for it.
- This is a hack and will be replaced with a real reference to the
- type. */
+/* Like output_type_ref, but no debug information is written. */
static void
-output_type_ref (struct output_block *ob, tree node)
+output_type_ref_1 (struct output_block *ob, tree node)
{
bool new;
unsigned int index;
- LTO_DEBUG_TOKEN ("type");
new = lto_output_decl_index (ob->main_stream,
ob->decl_state->type_hash_table,
&ob->decl_state->next_type_index,
@@ -615,6 +612,18 @@ output_type_ref (struct output_block *ob, tree node)
}
+/* Look up TYPE in the type table and write the uleb128 index for it.
+ This is a hack and will be replaced with a real reference to the
+ type. */
+
+static void
+output_type_ref (struct output_block *ob, tree node)
+{
+ LTO_DEBUG_TOKEN ("type");
+ output_type_ref_1 (ob, node);
+}
+
+
/* Look up NAME in the type table and if WRITE, write the uleb128
index for it to OB. */
@@ -1953,6 +1962,7 @@ output_function (struct cgraph_node* node)
struct function *fn = DECL_STRUCT_FUNCTION (function);
basic_block bb;
struct output_block *ob = create_output_block (LTO_section_function_body);
+ tree context;
LTO_SET_DEBUGGING_STREAM (debug_main_stream, main_data);
clear_line_info (ob);
@@ -1985,10 +1995,17 @@ output_function (struct cgraph_node* node)
output_zero (ob);
LTO_DEBUG_INDENT_TOKEN ("decl_context");
- if (DECL_CONTEXT (function))
- output_expr_operand (ob, DECL_CONTEXT (function));
- else
+ context = DECL_CONTEXT (function);
+ if (!context)
output_zero (ob);
+ else if (TYPE_P (context))
+ {
+ output_record_start (ob, NULL, NULL, LTO_type);
+ output_type_ref_1 (ob, context);
+ LTO_DEBUG_UNDENT ();
+ }
+ else
+ output_expr_operand (ob, DECL_CONTEXT (function));
/* We will renumber the statements. The code that does this uses
the same ordering that we use for serializing them so we can use
diff --git a/gcc/lto-tags.h b/gcc/lto-tags.h
index 82aa3e3996a..3c1d3996f0d 100644
--- a/gcc/lto-tags.h
+++ b/gcc/lto-tags.h
@@ -427,6 +427,7 @@ enum LTO_tags {
LTO_asm_clobbers,
LTO_function,
+ LTO_type,
LTO_eh_table,
/* Each of these requires 4 variants. 1 and 3 are have_inner and 2
diff --git a/gcc/lto-tree-tags.def b/gcc/lto-tree-tags.def
index 91b6f9387b7..aa6f47af9ab 100644
--- a/gcc/lto-tree-tags.def
+++ b/gcc/lto-tree-tags.def
@@ -305,6 +305,7 @@
SET_NAME (LTO_asm_outputs, "asm_outputs")
SET_NAME (LTO_asm_clobbers, "asm_clobbers")
SET_NAME (LTO_function, "function")
+ SET_NAME (LTO_type, "type")
SET_NAME (LTO_eh_table, "eh_table")
SET_NAME (LTO_eh_table_cleanup0, "eh_table_cleanup0")
SET_NAME (LTO_eh_table_cleanup1, "eh_table_cleanup1")
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 9ef871ce1b2..0e78bf9a269 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,5 +1,11 @@
2008-04-16 Ollie Wild <aaw@google.com>
+ * lto-function-in.c (input_type_ref_1): New function.
+ (input_type_ref): Split into two functions.
+ (input_function): Add support for type contexts.
+
+2008-04-16 Ollie Wild <aaw@google.com>
+
* lto.c (lto_materialize_function): Use DECL_ASSEMBLER_NAME to compute
section name
diff --git a/gcc/lto/lto-function-in.c b/gcc/lto/lto-function-in.c
index a637ee4f333..d1bd8bf5577 100644
--- a/gcc/lto/lto-function-in.c
+++ b/gcc/lto/lto-function-in.c
@@ -226,18 +226,27 @@ get_label_decl (struct data_in *data_in, struct lto_input_block *ib)
}
-/* Get the type referenced by the next token in IB. */
+/* Like get_type_ref, but no debug information is read. */
static tree
-input_type_ref (struct data_in *data_in, struct lto_input_block *ib)
+input_type_ref_1 (struct data_in *data_in, struct lto_input_block *ib)
{
int index;
- LTO_DEBUG_TOKEN ("type");
index = lto_input_uleb128 (ib);
return data_in->file_data->types[index];
}
+
+/* Get the type referenced by the next token in IB. */
+
+static tree
+input_type_ref (struct data_in *data_in, struct lto_input_block *ib)
+{
+ LTO_DEBUG_TOKEN ("type");
+ return input_type_ref_1 (data_in, ib);
+}
+
/* Set all of the FLAGS for NODE. */
#define CLEAROUT (BITS_PER_LTO_FLAGS_TYPE - 1)
@@ -1506,7 +1515,15 @@ input_function (tree fn_decl, struct data_in *data_in,
LTO_DEBUG_INDENT_TOKEN ("decl_context");
tag = input_record_start (ib);
if (tag)
- DECL_CONTEXT (fn_decl) = input_expr_operand (ib, data_in, fn, tag);
+ {
+ if (tag == LTO_type)
+ {
+ DECL_CONTEXT (fn_decl) = input_type_ref_1 (data_in, ib);
+ LTO_DEBUG_UNDENT ();
+ }
+ else
+ DECL_CONTEXT (fn_decl) = input_expr_operand (ib, data_in, fn, tag);
+ }
tag = input_record_start (ib);
while (tag)