aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2011-05-02 14:37:13 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2011-05-02 12:37:13 +0000
commitbc0fe8cb2a6ed9db82b4380e9d4b1837e97ea526 (patch)
tree2680cf7b12422f82aa3a8f4513c70dc9d5e3692d /gcc
parentd12530b543a23510d7bdc3dcd9e0d58ffe18b418 (diff)
downloadgcc-bc0fe8cb2a6ed9db82b4380e9d4b1837e97ea526.zip
gcc-bc0fe8cb2a6ed9db82b4380e9d4b1837e97ea526.tar.gz
gcc-bc0fe8cb2a6ed9db82b4380e9d4b1837e97ea526.tar.bz2
lto-section-in.c (lto_input_1_unsigned): Move to lto-streamer.h
* lto-section-in.c (lto_input_1_unsigned): Move to lto-streamer.h (lto_section_overrun): New. * lto-section-out.c (append_block): Rename to ... (lto_append_block): ... this one; export. (lto_output_1_stream): Move lto lto-streamer.h (lto_output_data_stream): Update. * lto-streamer.h (lto_section_overrun, lto_append_block): Declare. (lto_output_1_stream, lto_input_1_unsigned): Turn into inline functions. From-SVN: r173247
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/lto-section-in.c20
-rw-r--r--gcc/lto-section-out.c23
-rw-r--r--gcc/lto-streamer.h32
4 files changed, 55 insertions, 32 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5a89d63..6a8d393 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2011-05-02 Jan Hubicka <jh@suse.cz>
+
+ * lto-section-in.c (lto_input_1_unsigned): Move to lto-streamer.h
+ (lto_section_overrun): New.
+ * lto-section-out.c (append_block): Rename to ...
+ (lto_append_block): ... this one; export.
+ (lto_output_1_stream): Move lto lto-streamer.h
+ (lto_output_data_stream): Update.
+ * lto-streamer.h (lto_section_overrun, lto_append_block): Declare.
+ (lto_output_1_stream, lto_input_1_unsigned): Turn into inline
+ functions.
+
2011-05-02 Richard Guenther <rguenther@suse.de>
* tree.c (tree_code_counts): New global array.
diff --git a/gcc/lto-section-in.c b/gcc/lto-section-in.c
index e7928c4..4b88fb1 100644
--- a/gcc/lto-section-in.c
+++ b/gcc/lto-section-in.c
@@ -62,16 +62,6 @@ const char *lto_section_name[LTO_N_SECTION_TYPES] =
"inline"
};
-unsigned char
-lto_input_1_unsigned (struct lto_input_block *ib)
-{
- if (ib->p >= ib->len)
- internal_error ("bytecode stream: trying to read %d bytes "
- "after the end of the input buffer", ib->p - ib->len);
-
- return (ib->data[ib->p++]);
-}
-
/* Read an ULEB128 Number of IB. */
@@ -486,3 +476,13 @@ lto_get_function_in_decl_state (struct lto_file_decl_data *file_data,
slot = htab_find_slot (file_data->function_decl_states, &temp, NO_INSERT);
return slot? ((struct lto_in_decl_state*) *slot) : NULL;
}
+
+
+/* Report read pass end of the section. */
+
+void
+lto_section_overrun (struct lto_input_block *ib)
+{
+ internal_error ("bytecode stream: trying to read %d bytes "
+ "after the end of the input buffer", ib->p - ib->len);
+}
diff --git a/gcc/lto-section-out.c b/gcc/lto-section-out.c
index 0e8949a..234d63e 100644
--- a/gcc/lto-section-out.c
+++ b/gcc/lto-section-out.c
@@ -194,8 +194,8 @@ lto_write_stream (struct lto_output_stream *obs)
/* Adds a new block to output stream OBS. */
-static void
-append_block (struct lto_output_stream *obs)
+void
+lto_append_block (struct lto_output_stream *obs)
{
struct lto_char_ptr_base *new_block;
@@ -234,23 +234,6 @@ append_block (struct lto_output_stream *obs)
}
-/* Write a character to the output block. */
-
-void
-lto_output_1_stream (struct lto_output_stream *obs, char c)
-{
- /* No space left. */
- if (obs->left_in_block == 0)
- append_block (obs);
-
- /* Write the actual character. */
- *obs->current_pointer = c;
- obs->current_pointer++;
- obs->total_size++;
- obs->left_in_block--;
-}
-
-
/* Write raw DATA of length LEN to the output block OB. */
void
@@ -263,7 +246,7 @@ lto_output_data_stream (struct lto_output_stream *obs, const void *data,
/* No space left. */
if (obs->left_in_block == 0)
- append_block (obs);
+ lto_append_block (obs);
/* Determine how many bytes to copy in this loop. */
if (len <= obs->left_in_block)
diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index 5d1f15a..4fe8f51 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -758,7 +758,6 @@ extern const char *lto_get_section_data (struct lto_file_decl_data *,
extern void lto_free_section_data (struct lto_file_decl_data *,
enum lto_section_type,
const char *, const char *, size_t);
-extern unsigned char lto_input_1_unsigned (struct lto_input_block *);
extern unsigned HOST_WIDE_INT lto_input_uleb128 (struct lto_input_block *);
extern unsigned HOST_WIDEST_INT lto_input_widest_uint_uleb128 (
struct lto_input_block *);
@@ -774,6 +773,7 @@ extern hashval_t lto_hash_in_decl_state (const void *);
extern int lto_eq_in_decl_state (const void *, const void *);
extern struct lto_in_decl_state *lto_get_function_in_decl_state (
struct lto_file_decl_data *, tree);
+extern void lto_section_overrun (struct lto_input_block *) ATTRIBUTE_NORETURN;
/* In lto-section-out.c */
extern hashval_t lto_hash_decl_slot_node (const void *);
@@ -783,7 +783,6 @@ extern int lto_eq_type_slot_node (const void *, const void *);
extern void lto_begin_section (const char *, bool);
extern void lto_end_section (void);
extern void lto_write_stream (struct lto_output_stream *);
-extern void lto_output_1_stream (struct lto_output_stream *, char);
extern void lto_output_data_stream (struct lto_output_stream *, const void *,
size_t);
extern void lto_output_uleb128_stream (struct lto_output_stream *,
@@ -817,6 +816,7 @@ extern void lto_push_out_decl_state (struct lto_out_decl_state *);
extern struct lto_out_decl_state *lto_pop_out_decl_state (void);
extern void lto_record_function_out_decl_state (tree,
struct lto_out_decl_state *);
+extern void lto_append_block (struct lto_output_stream *);
/* In lto-streamer.c. */
@@ -1174,4 +1174,32 @@ bp_unpack_value (struct bitpack_d *bp, unsigned nbits)
return val & mask;
}
+
+/* Write a character to the output block. */
+
+static inline void
+lto_output_1_stream (struct lto_output_stream *obs, char c)
+{
+ /* No space left. */
+ if (obs->left_in_block == 0)
+ lto_append_block (obs);
+
+ /* Write the actual character. */
+ *obs->current_pointer = c;
+ obs->current_pointer++;
+ obs->total_size++;
+ obs->left_in_block--;
+}
+
+
+/* Read byte from the input block. */
+
+static inline unsigned char
+lto_input_1_unsigned (struct lto_input_block *ib)
+{
+ if (ib->p >= ib->len)
+ lto_section_overrun (ib);
+ return (ib->data[ib->p++]);
+}
+
#endif /* GCC_LTO_STREAMER_H */