===================================================================
@@ -1689,9 +1689,9 @@ input_cgraph_opt_section (struct lto_fil
{
const struct lto_function_header *header =
(const struct lto_function_header *) data;
- const int32_t cfg_offset = sizeof (struct lto_function_header);
- const int32_t main_offset = cfg_offset + header->cfg_size;
- const int32_t string_offset = main_offset + header->main_size;
+ const int cfg_offset = sizeof (struct lto_function_header);
+ const int main_offset = cfg_offset + header->cfg_size;
+ const int string_offset = main_offset + header->main_size;
struct data_in *data_in;
struct lto_input_block ib_main;
unsigned int i;
===================================================================
@@ -1271,6 +1271,14 @@ lto_out_decl_state_written_size (struct
/* Write symbol T into STREAM in CACHE. SEEN specifies symbols we wrote
so far. */
+#if HOST_BITS_PER_WIDE_INT >= 64
+# define host_int64 HOST_WIDE_INT
+#elif HOST_BITS_PER_WIDEST_INT >= 64
+# define host_int64 HOST_WIDEST_INT
+#else
+# error "host has no 64-bit type"
+#endif
+
static void
write_symbol (struct streamer_tree_cache_d *cache,
struct lto_output_stream *stream,
@@ -1280,7 +1288,7 @@ write_symbol (struct streamer_tree_cache
enum gcc_plugin_symbol_kind kind;
enum gcc_plugin_symbol_visibility visibility;
unsigned slot_num;
- uint64_t size;
+ unsigned host_int64 size;
const char *comdat;
unsigned char c;
@@ -1338,7 +1346,7 @@ write_symbol (struct streamer_tree_cache
when symbol has attribute (visibility("hidden")) specified.
targetm.binds_local_p check DECL_VISIBILITY_SPECIFIED and gets this
right. */
-
+
if (DECL_EXTERNAL (t)
&& !targetm.binds_local_p (t))
visibility = GCCPV_DEFAULT;
@@ -1363,10 +1371,13 @@ write_symbol (struct streamer_tree_cache
&& DECL_SIZE (t)
&& TREE_CODE (DECL_SIZE (t)) == INTEGER_CST)
{
- size = (HOST_BITS_PER_WIDE_INT >= 64)
- ? (uint64_t) int_size_in_bytes (TREE_TYPE (t))
- : (((uint64_t) TREE_INT_CST_HIGH (DECL_SIZE_UNIT (t))) << 32)
- | TREE_INT_CST_LOW (DECL_SIZE_UNIT (t));
+#if HOST_BITS_PER_WIDE_INT >= 64
+ size = (unsigned host_int64) int_size_in_bytes (TREE_TYPE (t));
+#else
+ size
+ = (unsigned host_int64) TREE_INT_CST_HIGH (DECL_SIZE_UNIT (t)) << 32
+ || (unsigned host_int64) TREE_INT_CST_LOW (DECL_SIZE_UNIT (t));
+#endif
}
else
size = 0;
===================================================================
@@ -979,9 +979,9 @@ lto_read_body (struct lto_file_decl_data
{
const struct lto_function_header *header;
struct data_in *data_in;
- int32_t cfg_offset;
- int32_t main_offset;
- int32_t string_offset;
+ int cfg_offset;
+ int main_offset;
+ int string_offset;
struct lto_input_block ib_cfg;
struct lto_input_block ib_main;
@@ -1172,7 +1172,7 @@ lto_input_toplevel_asms (struct lto_file
const char *data = lto_get_section_data (file_data, LTO_section_asm,
NULL, &len);
const struct lto_asm_header *header = (const struct lto_asm_header *) data;
- int32_t string_offset;
+ int string_offset;
struct data_in *data_in;
struct lto_input_block ib;
tree str;
===================================================================
@@ -224,7 +224,7 @@ lto_create_simple_input_block (struct lt
= (const struct lto_simple_header *) data;
struct lto_input_block* ib_main;
- int32_t main_offset = sizeof (struct lto_simple_header);
+ int main_offset = sizeof (struct lto_simple_header);
if (!data)
return NULL;
===================================================================
@@ -3019,9 +3019,9 @@ inline_read_section (struct lto_file_dec
{
const struct lto_function_header *header =
(const struct lto_function_header *) data;
- const int32_t cfg_offset = sizeof (struct lto_function_header);
- const int32_t main_offset = cfg_offset + header->cfg_size;
- const int32_t string_offset = main_offset + header->main_size;
+ const int cfg_offset = sizeof (struct lto_function_header);
+ const int main_offset = cfg_offset + header->cfg_size;
+ const int string_offset = main_offset + header->main_size;
struct data_in *data_in;
struct lto_input_block ib;
unsigned int i, count2, j;
===================================================================
@@ -267,7 +267,7 @@ lto_read_in_decl_state (struct data_in *
uint32_t ix;
tree decl;
uint32_t i, j;
-
+
ix = *data++;
decl = streamer_tree_cache_get (data_in->reader_cache, ix);
if (TREE_CODE (decl) != FUNCTION_DECL)
@@ -879,9 +879,9 @@ lto_read_decls (struct lto_file_decl_dat
VEC(ld_plugin_symbol_resolution_t,heap) *resolutions)
{
const struct lto_decl_header *header = (const struct lto_decl_header *) data;
- const int32_t decl_offset = sizeof (struct lto_decl_header);
- const int32_t main_offset = decl_offset + header->decl_state_size;
- const int32_t string_offset = main_offset + header->main_size;
+ const int decl_offset = sizeof (struct lto_decl_header);
+ const int main_offset = decl_offset + header->decl_state_size;
+ const int string_offset = main_offset + header->main_size;
struct lto_input_block ib_main;
struct data_in *data_in;
unsigned int i;
@@ -939,10 +939,21 @@ lto_read_decls (struct lto_file_decl_dat
lto_data_in_delete (data_in);
}
-/* strtoll is not portable. */
-int64_t
-lto_parse_hex (const char *p) {
- uint64_t ret = 0;
+#if HOST_BITS_PER_WIDE_INT >= 64
+# define host_int64 HOST_WIDE_INT
+#elif HOST_BITS_PER_WIDEST_INT >= 64
+# define host_int64 HOST_WIDEST_INT
+#else
+# error "host has no 64-bit type"
+#endif
+
+/* strtoll is not portable. */
+
+static host_int64
+lto_parse_hex (const char *p)
+{
+ host_int64 ret = 0;
+
for (; *p != '\0'; ++p)
{
char c = *p;
@@ -958,6 +969,7 @@ lto_parse_hex (const char *p) {
internal_error ("could not parse hex number");
ret |= part;
}
+
return ret;
}
@@ -993,7 +1005,7 @@ lto_resolution_read (splay_tree file_ids
{
int t;
char offset_p[17];
- int64_t offset;
+ host_int64 offset;
t = fscanf (resolution, "@0x%16s", offset_p);
if (t != 1)
internal_error ("could not parse file offset");
===================================================================
@@ -68,6 +68,4 @@ struct lto_section_list
struct lto_section_slot *first, *last;
};
-int64_t lto_parse_hex (const char *p);
-
#endif /* LTO_H */
===================================================================
@@ -3003,9 +3003,9 @@ ipa_prop_read_section (struct lto_file_d
{
const struct lto_function_header *header =
(const struct lto_function_header *) data;
- const int32_t cfg_offset = sizeof (struct lto_function_header);
- const int32_t main_offset = cfg_offset + header->cfg_size;
- const int32_t string_offset = main_offset + header->main_size;
+ const int cfg_offset = sizeof (struct lto_function_header);
+ const int main_offset = cfg_offset + header->cfg_size;
+ const int string_offset = main_offset + header->main_size;
struct data_in *data_in;
struct lto_input_block ib_main;
unsigned int i;