annotate gcc/lto-streamer-in.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Read the GIMPLE representation from a file stream.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
111
kono
parents: 67
diff changeset
3 Copyright (C) 2009-2017 Free Software Foundation, Inc.
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 Re-implemented by Diego Novillo <dnovillo@google.com>
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 This file is part of GCC.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 GCC is free software; you can redistribute it and/or modify it under
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 the terms of the GNU General Public License as published by the Free
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 Software Foundation; either version 3, or (at your option) any later
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 version.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 for more details.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 along with GCC; see the file COPYING3. If not see
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 <http://www.gnu.org/licenses/>. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 #include "config.h"
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 #include "system.h"
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 #include "coretypes.h"
111
kono
parents: 67
diff changeset
26 #include "backend.h"
kono
parents: 67
diff changeset
27 #include "target.h"
kono
parents: 67
diff changeset
28 #include "rtl.h"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 #include "tree.h"
111
kono
parents: 67
diff changeset
30 #include "gimple.h"
kono
parents: 67
diff changeset
31 #include "cfghooks.h"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 #include "tree-pass.h"
111
kono
parents: 67
diff changeset
33 #include "ssa.h"
kono
parents: 67
diff changeset
34 #include "gimple-streamer.h"
kono
parents: 67
diff changeset
35 #include "toplev.h"
kono
parents: 67
diff changeset
36 #include "gimple-iterator.h"
kono
parents: 67
diff changeset
37 #include "tree-cfg.h"
kono
parents: 67
diff changeset
38 #include "tree-into-ssa.h"
kono
parents: 67
diff changeset
39 #include "tree-dfa.h"
kono
parents: 67
diff changeset
40 #include "tree-ssa.h"
kono
parents: 67
diff changeset
41 #include "except.h"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 #include "cgraph.h"
111
kono
parents: 67
diff changeset
43 #include "cfgloop.h"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 #include "debug.h"
111
kono
parents: 67
diff changeset
45
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46
111
kono
parents: 67
diff changeset
47 struct freeing_string_slot_hasher : string_slot_hasher
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 {
111
kono
parents: 67
diff changeset
49 static inline void remove (value_type *);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 };
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51
111
kono
parents: 67
diff changeset
52 inline void
kono
parents: 67
diff changeset
53 freeing_string_slot_hasher::remove (value_type *v)
kono
parents: 67
diff changeset
54 {
kono
parents: 67
diff changeset
55 free (v);
kono
parents: 67
diff changeset
56 }
kono
parents: 67
diff changeset
57
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 /* The table to hold the file names. */
111
kono
parents: 67
diff changeset
59 static hash_table<freeing_string_slot_hasher> *file_name_hash_table;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 /* Check that tag ACTUAL has one of the given values. NUM_TAGS is the
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 number of valid tag values to check. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64
111
kono
parents: 67
diff changeset
65 void
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 lto_tag_check_set (enum LTO_tags actual, int ntags, ...)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 va_list ap;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 int i;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 va_start (ap, ntags);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 for (i = 0; i < ntags; i++)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 if ((unsigned) actual == va_arg (ap, unsigned))
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 va_end (ap);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 return;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 va_end (ap);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 internal_error ("bytecode stream: unexpected tag %s", lto_tag_name (actual));
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83
111
kono
parents: 67
diff changeset
84 /* Read LENGTH bytes from STREAM to ADDR. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85
111
kono
parents: 67
diff changeset
86 void
kono
parents: 67
diff changeset
87 lto_input_data_block (struct lto_input_block *ib, void *addr, size_t length)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 {
111
kono
parents: 67
diff changeset
89 size_t i;
kono
parents: 67
diff changeset
90 unsigned char *const buffer = (unsigned char *) addr;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91
111
kono
parents: 67
diff changeset
92 for (i = 0; i < length; i++)
kono
parents: 67
diff changeset
93 buffer[i] = streamer_read_uchar (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 /* Lookup STRING in file_name_hash_table. If found, return the existing
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 string, otherwise insert STRING as the canonical version. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
99
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 static const char *
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 canon_file_name (const char *string)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 {
111
kono
parents: 67
diff changeset
103 string_slot **slot;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 struct string_slot s_slot;
111
kono
parents: 67
diff changeset
105 size_t len = strlen (string);
kono
parents: 67
diff changeset
106
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 s_slot.s = string;
111
kono
parents: 67
diff changeset
108 s_slot.len = len;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
109
111
kono
parents: 67
diff changeset
110 slot = file_name_hash_table->find_slot (&s_slot, INSERT);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 if (*slot == NULL)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 char *saved_string;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 struct string_slot *new_slot;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
115
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 saved_string = (char *) xmalloc (len + 1);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 new_slot = XCNEW (struct string_slot);
111
kono
parents: 67
diff changeset
118 memcpy (saved_string, string, len + 1);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 new_slot->s = saved_string;
111
kono
parents: 67
diff changeset
120 new_slot->len = len;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 *slot = new_slot;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 return saved_string;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 else
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 {
111
kono
parents: 67
diff changeset
126 struct string_slot *old_slot = *slot;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 return old_slot->s;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
130
111
kono
parents: 67
diff changeset
131 /* Pointer to currently alive instance of lto_location_cache. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
132
111
kono
parents: 67
diff changeset
133 lto_location_cache *lto_location_cache::current_cache;
kono
parents: 67
diff changeset
134
kono
parents: 67
diff changeset
135 /* Sort locations in source order. Start with file from last application. */
kono
parents: 67
diff changeset
136
kono
parents: 67
diff changeset
137 int
kono
parents: 67
diff changeset
138 lto_location_cache::cmp_loc (const void *pa, const void *pb)
kono
parents: 67
diff changeset
139 {
kono
parents: 67
diff changeset
140 const cached_location *a = ((const cached_location *)pa);
kono
parents: 67
diff changeset
141 const cached_location *b = ((const cached_location *)pb);
kono
parents: 67
diff changeset
142 const char *current_file = current_cache->current_file;
kono
parents: 67
diff changeset
143 int current_line = current_cache->current_line;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
144
111
kono
parents: 67
diff changeset
145 if (a->file == current_file && b->file != current_file)
kono
parents: 67
diff changeset
146 return -1;
kono
parents: 67
diff changeset
147 if (a->file != current_file && b->file == current_file)
kono
parents: 67
diff changeset
148 return 1;
kono
parents: 67
diff changeset
149 if (a->file == current_file && b->file == current_file)
kono
parents: 67
diff changeset
150 {
kono
parents: 67
diff changeset
151 if (a->line == current_line && b->line != current_line)
kono
parents: 67
diff changeset
152 return -1;
kono
parents: 67
diff changeset
153 if (a->line != current_line && b->line == current_line)
kono
parents: 67
diff changeset
154 return 1;
kono
parents: 67
diff changeset
155 }
kono
parents: 67
diff changeset
156 if (a->file != b->file)
kono
parents: 67
diff changeset
157 return strcmp (a->file, b->file);
kono
parents: 67
diff changeset
158 if (a->sysp != b->sysp)
kono
parents: 67
diff changeset
159 return a->sysp ? 1 : -1;
kono
parents: 67
diff changeset
160 if (a->line != b->line)
kono
parents: 67
diff changeset
161 return a->line - b->line;
kono
parents: 67
diff changeset
162 return a->col - b->col;
kono
parents: 67
diff changeset
163 }
kono
parents: 67
diff changeset
164
kono
parents: 67
diff changeset
165 /* Apply all changes in location cache. Add locations into linemap and patch
kono
parents: 67
diff changeset
166 trees. */
kono
parents: 67
diff changeset
167
kono
parents: 67
diff changeset
168 bool
kono
parents: 67
diff changeset
169 lto_location_cache::apply_location_cache ()
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 {
111
kono
parents: 67
diff changeset
171 static const char *prev_file;
kono
parents: 67
diff changeset
172 if (!loc_cache.length ())
kono
parents: 67
diff changeset
173 return false;
kono
parents: 67
diff changeset
174 if (loc_cache.length () > 1)
kono
parents: 67
diff changeset
175 loc_cache.qsort (cmp_loc);
kono
parents: 67
diff changeset
176
kono
parents: 67
diff changeset
177 for (unsigned int i = 0; i < loc_cache.length (); i++)
kono
parents: 67
diff changeset
178 {
kono
parents: 67
diff changeset
179 struct cached_location loc = loc_cache[i];
kono
parents: 67
diff changeset
180
kono
parents: 67
diff changeset
181 if (current_file != loc.file)
kono
parents: 67
diff changeset
182 linemap_add (line_table, prev_file ? LC_RENAME : LC_ENTER,
kono
parents: 67
diff changeset
183 loc.sysp, loc.file, loc.line);
kono
parents: 67
diff changeset
184 else if (current_line != loc.line)
kono
parents: 67
diff changeset
185 {
kono
parents: 67
diff changeset
186 int max = loc.col;
kono
parents: 67
diff changeset
187
kono
parents: 67
diff changeset
188 for (unsigned int j = i + 1; j < loc_cache.length (); j++)
kono
parents: 67
diff changeset
189 if (loc.file != loc_cache[j].file
kono
parents: 67
diff changeset
190 || loc.line != loc_cache[j].line)
kono
parents: 67
diff changeset
191 break;
kono
parents: 67
diff changeset
192 else if (max < loc_cache[j].col)
kono
parents: 67
diff changeset
193 max = loc_cache[j].col;
kono
parents: 67
diff changeset
194 linemap_line_start (line_table, loc.line, max + 1);
kono
parents: 67
diff changeset
195 }
kono
parents: 67
diff changeset
196 gcc_assert (*loc.loc == BUILTINS_LOCATION + 1);
kono
parents: 67
diff changeset
197 if (current_file == loc.file && current_line == loc.line
kono
parents: 67
diff changeset
198 && current_col == loc.col)
kono
parents: 67
diff changeset
199 *loc.loc = current_loc;
kono
parents: 67
diff changeset
200 else
kono
parents: 67
diff changeset
201 current_loc = *loc.loc = linemap_position_for_column (line_table,
kono
parents: 67
diff changeset
202 loc.col);
kono
parents: 67
diff changeset
203 current_line = loc.line;
kono
parents: 67
diff changeset
204 prev_file = current_file = loc.file;
kono
parents: 67
diff changeset
205 current_col = loc.col;
kono
parents: 67
diff changeset
206 }
kono
parents: 67
diff changeset
207 loc_cache.truncate (0);
kono
parents: 67
diff changeset
208 accepted_length = 0;
kono
parents: 67
diff changeset
209 return true;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
210 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
211
111
kono
parents: 67
diff changeset
212 /* Tree merging did not suceed; mark all changes in the cache as accepted. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
213
111
kono
parents: 67
diff changeset
214 void
kono
parents: 67
diff changeset
215 lto_location_cache::accept_location_cache ()
kono
parents: 67
diff changeset
216 {
kono
parents: 67
diff changeset
217 gcc_assert (current_cache == this);
kono
parents: 67
diff changeset
218 accepted_length = loc_cache.length ();
kono
parents: 67
diff changeset
219 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
220
111
kono
parents: 67
diff changeset
221 /* Tree merging did suceed; throw away recent changes. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
222
111
kono
parents: 67
diff changeset
223 void
kono
parents: 67
diff changeset
224 lto_location_cache::revert_location_cache ()
kono
parents: 67
diff changeset
225 {
kono
parents: 67
diff changeset
226 loc_cache.truncate (accepted_length);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
228
111
kono
parents: 67
diff changeset
229 /* Read a location bitpack from input block IB and either update *LOC directly
kono
parents: 67
diff changeset
230 or add it to the location cache.
kono
parents: 67
diff changeset
231 It is neccesary to call apply_location_cache to get *LOC updated. */
kono
parents: 67
diff changeset
232
kono
parents: 67
diff changeset
233 void
kono
parents: 67
diff changeset
234 lto_location_cache::input_location (location_t *loc, struct bitpack_d *bp,
kono
parents: 67
diff changeset
235 struct data_in *data_in)
kono
parents: 67
diff changeset
236 {
kono
parents: 67
diff changeset
237 static const char *stream_file;
kono
parents: 67
diff changeset
238 static int stream_line;
kono
parents: 67
diff changeset
239 static int stream_col;
kono
parents: 67
diff changeset
240 static bool stream_sysp;
kono
parents: 67
diff changeset
241 bool file_change, line_change, column_change;
kono
parents: 67
diff changeset
242
kono
parents: 67
diff changeset
243 gcc_assert (current_cache == this);
kono
parents: 67
diff changeset
244
kono
parents: 67
diff changeset
245 *loc = bp_unpack_int_in_range (bp, "location", 0, RESERVED_LOCATION_COUNT);
kono
parents: 67
diff changeset
246
kono
parents: 67
diff changeset
247 if (*loc < RESERVED_LOCATION_COUNT)
kono
parents: 67
diff changeset
248 return;
kono
parents: 67
diff changeset
249
kono
parents: 67
diff changeset
250 /* Keep value RESERVED_LOCATION_COUNT in *loc as linemap lookups will
kono
parents: 67
diff changeset
251 ICE on it. */
kono
parents: 67
diff changeset
252
kono
parents: 67
diff changeset
253 file_change = bp_unpack_value (bp, 1);
kono
parents: 67
diff changeset
254 line_change = bp_unpack_value (bp, 1);
kono
parents: 67
diff changeset
255 column_change = bp_unpack_value (bp, 1);
kono
parents: 67
diff changeset
256
kono
parents: 67
diff changeset
257 if (file_change)
kono
parents: 67
diff changeset
258 {
kono
parents: 67
diff changeset
259 stream_file = canon_file_name (bp_unpack_string (data_in, bp));
kono
parents: 67
diff changeset
260 stream_sysp = bp_unpack_value (bp, 1);
kono
parents: 67
diff changeset
261 }
kono
parents: 67
diff changeset
262
kono
parents: 67
diff changeset
263 if (line_change)
kono
parents: 67
diff changeset
264 stream_line = bp_unpack_var_len_unsigned (bp);
kono
parents: 67
diff changeset
265
kono
parents: 67
diff changeset
266 if (column_change)
kono
parents: 67
diff changeset
267 stream_col = bp_unpack_var_len_unsigned (bp);
kono
parents: 67
diff changeset
268
kono
parents: 67
diff changeset
269 /* This optimization saves location cache operations druing gimple
kono
parents: 67
diff changeset
270 streaming. */
kono
parents: 67
diff changeset
271
kono
parents: 67
diff changeset
272 if (current_file == stream_file && current_line == stream_line
kono
parents: 67
diff changeset
273 && current_col == stream_col && current_sysp == stream_sysp)
kono
parents: 67
diff changeset
274 {
kono
parents: 67
diff changeset
275 *loc = current_loc;
kono
parents: 67
diff changeset
276 return;
kono
parents: 67
diff changeset
277 }
kono
parents: 67
diff changeset
278
kono
parents: 67
diff changeset
279 struct cached_location entry
kono
parents: 67
diff changeset
280 = {stream_file, loc, stream_line, stream_col, stream_sysp};
kono
parents: 67
diff changeset
281 loc_cache.safe_push (entry);
kono
parents: 67
diff changeset
282 }
kono
parents: 67
diff changeset
283
kono
parents: 67
diff changeset
284 /* Read a location bitpack from input block IB and either update *LOC directly
kono
parents: 67
diff changeset
285 or add it to the location cache.
kono
parents: 67
diff changeset
286 It is neccesary to call apply_location_cache to get *LOC updated. */
kono
parents: 67
diff changeset
287
kono
parents: 67
diff changeset
288 void
kono
parents: 67
diff changeset
289 lto_input_location (location_t *loc, struct bitpack_d *bp,
kono
parents: 67
diff changeset
290 struct data_in *data_in)
kono
parents: 67
diff changeset
291 {
kono
parents: 67
diff changeset
292 data_in->location_cache.input_location (loc, bp, data_in);
kono
parents: 67
diff changeset
293 }
kono
parents: 67
diff changeset
294
kono
parents: 67
diff changeset
295 /* Read location and return it instead of going through location caching.
kono
parents: 67
diff changeset
296 This should be used only when the resulting location is not going to be
kono
parents: 67
diff changeset
297 discarded. */
kono
parents: 67
diff changeset
298
kono
parents: 67
diff changeset
299 location_t
kono
parents: 67
diff changeset
300 stream_input_location_now (struct bitpack_d *bp, struct data_in *data_in)
kono
parents: 67
diff changeset
301 {
kono
parents: 67
diff changeset
302 location_t loc;
kono
parents: 67
diff changeset
303 stream_input_location (&loc, bp, data_in);
kono
parents: 67
diff changeset
304 data_in->location_cache.apply_location_cache ();
kono
parents: 67
diff changeset
305 return loc;
kono
parents: 67
diff changeset
306 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
307
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
308 /* Read a reference to a tree node from DATA_IN using input block IB.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
309 TAG is the expected node that should be found in IB, if TAG belongs
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
310 to one of the indexable trees, expect to read a reference index to
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
311 be looked up in one of the symbol tables, otherwise read the pysical
111
kono
parents: 67
diff changeset
312 representation of the tree using stream_read_tree. FN is the
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
313 function scope for the read tree. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
314
111
kono
parents: 67
diff changeset
315 tree
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
316 lto_input_tree_ref (struct lto_input_block *ib, struct data_in *data_in,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
317 struct function *fn, enum LTO_tags tag)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
318 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
319 unsigned HOST_WIDE_INT ix_u;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
320 tree result = NULL_TREE;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
321
111
kono
parents: 67
diff changeset
322 lto_tag_check_range (tag, LTO_field_decl_ref, LTO_namelist_decl_ref);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
323
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
324 switch (tag)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
325 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
326 case LTO_type_ref:
111
kono
parents: 67
diff changeset
327 ix_u = streamer_read_uhwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
328 result = lto_file_decl_data_get_type (data_in->file_data, ix_u);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
329 break;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
330
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
331 case LTO_ssa_name_ref:
111
kono
parents: 67
diff changeset
332 ix_u = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
333 result = (*SSANAMES (fn))[ix_u];
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
334 break;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
335
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
336 case LTO_field_decl_ref:
111
kono
parents: 67
diff changeset
337 ix_u = streamer_read_uhwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
338 result = lto_file_decl_data_get_field_decl (data_in->file_data, ix_u);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
339 break;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
340
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
341 case LTO_function_decl_ref:
111
kono
parents: 67
diff changeset
342 ix_u = streamer_read_uhwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
343 result = lto_file_decl_data_get_fn_decl (data_in->file_data, ix_u);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
344 break;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
345
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
346 case LTO_type_decl_ref:
111
kono
parents: 67
diff changeset
347 ix_u = streamer_read_uhwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
348 result = lto_file_decl_data_get_type_decl (data_in->file_data, ix_u);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
349 break;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
350
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
351 case LTO_namespace_decl_ref:
111
kono
parents: 67
diff changeset
352 ix_u = streamer_read_uhwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
353 result = lto_file_decl_data_get_namespace_decl (data_in->file_data, ix_u);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
354 break;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
355
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
356 case LTO_global_decl_ref:
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
357 case LTO_result_decl_ref:
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
358 case LTO_const_decl_ref:
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
359 case LTO_imported_decl_ref:
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
360 case LTO_label_decl_ref:
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
361 case LTO_translation_unit_decl_ref:
111
kono
parents: 67
diff changeset
362 case LTO_namelist_decl_ref:
kono
parents: 67
diff changeset
363 ix_u = streamer_read_uhwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
364 result = lto_file_decl_data_get_var_decl (data_in->file_data, ix_u);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
365 break;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
366
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
367 default:
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
368 gcc_unreachable ();
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
369 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
370
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
371 gcc_assert (result);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
372
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
373 return result;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
374 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
375
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
376
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
377 /* Read and return a double-linked list of catch handlers from input
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
378 block IB, using descriptors in DATA_IN. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
379
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
380 static struct eh_catch_d *
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
381 lto_input_eh_catch_list (struct lto_input_block *ib, struct data_in *data_in,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
382 eh_catch *last_p)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
383 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
384 eh_catch first;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
385 enum LTO_tags tag;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
386
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
387 *last_p = first = NULL;
111
kono
parents: 67
diff changeset
388 tag = streamer_read_record_start (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
389 while (tag)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
390 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
391 tree list;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
392 eh_catch n;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
393
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
394 lto_tag_check_range (tag, LTO_eh_catch, LTO_eh_catch);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
395
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
396 /* Read the catch node. */
111
kono
parents: 67
diff changeset
397 n = ggc_cleared_alloc<eh_catch_d> ();
kono
parents: 67
diff changeset
398 n->type_list = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
399 n->filter_list = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
400 n->label = stream_read_tree (ib, data_in);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
401
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
402 /* Register all the types in N->FILTER_LIST. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
403 for (list = n->filter_list; list; list = TREE_CHAIN (list))
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
404 add_type_for_runtime (TREE_VALUE (list));
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
405
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
406 /* Chain N to the end of the list. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
407 if (*last_p)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
408 (*last_p)->next_catch = n;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
409 n->prev_catch = *last_p;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
410 *last_p = n;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
411
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
412 /* Set the head of the list the first time through the loop. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
413 if (first == NULL)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
414 first = n;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
415
111
kono
parents: 67
diff changeset
416 tag = streamer_read_record_start (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
417 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
418
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
419 return first;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
420 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
421
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
422
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
423 /* Read and return EH region IX from input block IB, using descriptors
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
424 in DATA_IN. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
425
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
426 static eh_region
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
427 input_eh_region (struct lto_input_block *ib, struct data_in *data_in, int ix)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
428 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
429 enum LTO_tags tag;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
430 eh_region r;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
431
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
432 /* Read the region header. */
111
kono
parents: 67
diff changeset
433 tag = streamer_read_record_start (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
434 if (tag == LTO_null)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
435 return NULL;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
436
111
kono
parents: 67
diff changeset
437 r = ggc_cleared_alloc<eh_region_d> ();
kono
parents: 67
diff changeset
438 r->index = streamer_read_hwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
439
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
440 gcc_assert (r->index == ix);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
441
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
442 /* Read all the region pointers as region numbers. We'll fix up
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
443 the pointers once the whole array has been read. */
111
kono
parents: 67
diff changeset
444 r->outer = (eh_region) (intptr_t) streamer_read_hwi (ib);
kono
parents: 67
diff changeset
445 r->inner = (eh_region) (intptr_t) streamer_read_hwi (ib);
kono
parents: 67
diff changeset
446 r->next_peer = (eh_region) (intptr_t) streamer_read_hwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
447
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
448 switch (tag)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
449 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
450 case LTO_ert_cleanup:
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
451 r->type = ERT_CLEANUP;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
452 break;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
453
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
454 case LTO_ert_try:
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
455 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
456 struct eh_catch_d *last_catch;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
457 r->type = ERT_TRY;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
458 r->u.eh_try.first_catch = lto_input_eh_catch_list (ib, data_in,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
459 &last_catch);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
460 r->u.eh_try.last_catch = last_catch;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
461 break;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
462 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
463
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
464 case LTO_ert_allowed_exceptions:
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
465 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
466 tree l;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
467
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
468 r->type = ERT_ALLOWED_EXCEPTIONS;
111
kono
parents: 67
diff changeset
469 r->u.allowed.type_list = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
470 r->u.allowed.label = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
471 r->u.allowed.filter = streamer_read_uhwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
472
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
473 for (l = r->u.allowed.type_list; l ; l = TREE_CHAIN (l))
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
474 add_type_for_runtime (TREE_VALUE (l));
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
475 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
476 break;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
477
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
478 case LTO_ert_must_not_throw:
111
kono
parents: 67
diff changeset
479 {
kono
parents: 67
diff changeset
480 r->type = ERT_MUST_NOT_THROW;
kono
parents: 67
diff changeset
481 r->u.must_not_throw.failure_decl = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
482 bitpack_d bp = streamer_read_bitpack (ib);
kono
parents: 67
diff changeset
483 r->u.must_not_throw.failure_loc
kono
parents: 67
diff changeset
484 = stream_input_location_now (&bp, data_in);
kono
parents: 67
diff changeset
485 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
486 break;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
487
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
488 default:
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
489 gcc_unreachable ();
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
490 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
491
111
kono
parents: 67
diff changeset
492 r->landing_pads = (eh_landing_pad) (intptr_t) streamer_read_hwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
493
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
494 return r;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
495 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
496
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
497
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
498 /* Read and return EH landing pad IX from input block IB, using descriptors
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
499 in DATA_IN. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
500
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
501 static eh_landing_pad
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
502 input_eh_lp (struct lto_input_block *ib, struct data_in *data_in, int ix)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
503 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
504 enum LTO_tags tag;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
505 eh_landing_pad lp;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
506
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
507 /* Read the landing pad header. */
111
kono
parents: 67
diff changeset
508 tag = streamer_read_record_start (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
509 if (tag == LTO_null)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
510 return NULL;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
511
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
512 lto_tag_check_range (tag, LTO_eh_landing_pad, LTO_eh_landing_pad);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
513
111
kono
parents: 67
diff changeset
514 lp = ggc_cleared_alloc<eh_landing_pad_d> ();
kono
parents: 67
diff changeset
515 lp->index = streamer_read_hwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
516 gcc_assert (lp->index == ix);
111
kono
parents: 67
diff changeset
517 lp->next_lp = (eh_landing_pad) (intptr_t) streamer_read_hwi (ib);
kono
parents: 67
diff changeset
518 lp->region = (eh_region) (intptr_t) streamer_read_hwi (ib);
kono
parents: 67
diff changeset
519 lp->post_landing_pad = stream_read_tree (ib, data_in);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
520
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
521 return lp;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
522 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
523
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
524
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
525 /* After reading the EH regions, pointers to peer and children regions
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
526 are region numbers. This converts all these region numbers into
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
527 real pointers into the rematerialized regions for FN. ROOT_REGION
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
528 is the region number for the root EH region in FN. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
529
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
530 static void
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
531 fixup_eh_region_pointers (struct function *fn, HOST_WIDE_INT root_region)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
532 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
533 unsigned i;
111
kono
parents: 67
diff changeset
534 vec<eh_region, va_gc> *eh_array = fn->eh->region_array;
kono
parents: 67
diff changeset
535 vec<eh_landing_pad, va_gc> *lp_array = fn->eh->lp_array;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
536 eh_region r;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
537 eh_landing_pad lp;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
538
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
539 gcc_assert (eh_array && lp_array);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
540
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
541 gcc_assert (root_region >= 0);
111
kono
parents: 67
diff changeset
542 fn->eh->region_tree = (*eh_array)[root_region];
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
543
111
kono
parents: 67
diff changeset
544 #define FIXUP_EH_REGION(r) (r) = (*eh_array)[(HOST_WIDE_INT) (intptr_t) (r)]
kono
parents: 67
diff changeset
545 #define FIXUP_EH_LP(p) (p) = (*lp_array)[(HOST_WIDE_INT) (intptr_t) (p)]
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
546
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
547 /* Convert all the index numbers stored in pointer fields into
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
548 pointers to the corresponding slots in the EH region array. */
111
kono
parents: 67
diff changeset
549 FOR_EACH_VEC_ELT (*eh_array, i, r)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
550 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
551 /* The array may contain NULL regions. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
552 if (r == NULL)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
553 continue;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
554
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
555 gcc_assert (i == (unsigned) r->index);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
556 FIXUP_EH_REGION (r->outer);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
557 FIXUP_EH_REGION (r->inner);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
558 FIXUP_EH_REGION (r->next_peer);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
559 FIXUP_EH_LP (r->landing_pads);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
560 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
561
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
562 /* Convert all the index numbers stored in pointer fields into
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
563 pointers to the corresponding slots in the EH landing pad array. */
111
kono
parents: 67
diff changeset
564 FOR_EACH_VEC_ELT (*lp_array, i, lp)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
565 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
566 /* The array may contain NULL landing pads. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
567 if (lp == NULL)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
568 continue;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
569
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
570 gcc_assert (i == (unsigned) lp->index);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
571 FIXUP_EH_LP (lp->next_lp);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
572 FIXUP_EH_REGION (lp->region);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
573 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
574
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
575 #undef FIXUP_EH_REGION
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
576 #undef FIXUP_EH_LP
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
577 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
578
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
579
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
580 /* Initialize EH support. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
581
111
kono
parents: 67
diff changeset
582 void
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
583 lto_init_eh (void)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
584 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
585 static bool eh_initialized_p = false;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
586
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
587 if (eh_initialized_p)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
588 return;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
589
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
590 /* Contrary to most other FEs, we only initialize EH support when at
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
591 least one of the files in the set contains exception regions in
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
592 it. Since this happens much later than the call to init_eh in
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
593 lang_dependent_init, we have to set flag_exceptions and call
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
594 init_eh again to initialize the EH tables. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
595 flag_exceptions = 1;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
596 init_eh ();
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
597
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
598 eh_initialized_p = true;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
599 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
600
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
601
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
602 /* Read the exception table for FN from IB using the data descriptors
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
603 in DATA_IN. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
604
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
605 static void
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
606 input_eh_regions (struct lto_input_block *ib, struct data_in *data_in,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
607 struct function *fn)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
608 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
609 HOST_WIDE_INT i, root_region, len;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
610 enum LTO_tags tag;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
611
111
kono
parents: 67
diff changeset
612 tag = streamer_read_record_start (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
613 if (tag == LTO_null)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
614 return;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
615
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
616 lto_tag_check_range (tag, LTO_eh_table, LTO_eh_table);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
617
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
618 /* If the file contains EH regions, then it was compiled with
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
619 -fexceptions. In that case, initialize the backend EH
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
620 machinery. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
621 lto_init_eh ();
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
622
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
623 gcc_assert (fn->eh);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
624
111
kono
parents: 67
diff changeset
625 root_region = streamer_read_hwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
626 gcc_assert (root_region == (int) root_region);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
627
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
628 /* Read the EH region array. */
111
kono
parents: 67
diff changeset
629 len = streamer_read_hwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
630 gcc_assert (len == (int) len);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
631 if (len > 0)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
632 {
111
kono
parents: 67
diff changeset
633 vec_safe_grow_cleared (fn->eh->region_array, len);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
634 for (i = 0; i < len; i++)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
635 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
636 eh_region r = input_eh_region (ib, data_in, i);
111
kono
parents: 67
diff changeset
637 (*fn->eh->region_array)[i] = r;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
638 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
639 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
640
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
641 /* Read the landing pads. */
111
kono
parents: 67
diff changeset
642 len = streamer_read_hwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
643 gcc_assert (len == (int) len);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
644 if (len > 0)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
645 {
111
kono
parents: 67
diff changeset
646 vec_safe_grow_cleared (fn->eh->lp_array, len);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
647 for (i = 0; i < len; i++)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
648 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
649 eh_landing_pad lp = input_eh_lp (ib, data_in, i);
111
kono
parents: 67
diff changeset
650 (*fn->eh->lp_array)[i] = lp;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
651 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
652 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
653
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
654 /* Read the runtime type data. */
111
kono
parents: 67
diff changeset
655 len = streamer_read_hwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
656 gcc_assert (len == (int) len);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
657 if (len > 0)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
658 {
111
kono
parents: 67
diff changeset
659 vec_safe_grow_cleared (fn->eh->ttype_data, len);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
660 for (i = 0; i < len; i++)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
661 {
111
kono
parents: 67
diff changeset
662 tree ttype = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
663 (*fn->eh->ttype_data)[i] = ttype;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
664 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
665 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
666
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
667 /* Read the table of action chains. */
111
kono
parents: 67
diff changeset
668 len = streamer_read_hwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
669 gcc_assert (len == (int) len);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
670 if (len > 0)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
671 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
672 if (targetm.arm_eabi_unwinder)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
673 {
111
kono
parents: 67
diff changeset
674 vec_safe_grow_cleared (fn->eh->ehspec_data.arm_eabi, len);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
675 for (i = 0; i < len; i++)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
676 {
111
kono
parents: 67
diff changeset
677 tree t = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
678 (*fn->eh->ehspec_data.arm_eabi)[i] = t;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
679 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
680 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
681 else
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
682 {
111
kono
parents: 67
diff changeset
683 vec_safe_grow_cleared (fn->eh->ehspec_data.other, len);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
684 for (i = 0; i < len; i++)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
685 {
111
kono
parents: 67
diff changeset
686 uchar c = streamer_read_uchar (ib);
kono
parents: 67
diff changeset
687 (*fn->eh->ehspec_data.other)[i] = c;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
688 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
689 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
690 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
691
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
692 /* Reconstruct the EH region tree by fixing up the peer/children
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
693 pointers. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
694 fixup_eh_region_pointers (fn, root_region);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
695
111
kono
parents: 67
diff changeset
696 tag = streamer_read_record_start (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
697 lto_tag_check_range (tag, LTO_null, LTO_null);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
698 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
699
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
700
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
701 /* Make a new basic block with index INDEX in function FN. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
702
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
703 static basic_block
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
704 make_new_block (struct function *fn, unsigned int index)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
705 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
706 basic_block bb = alloc_block ();
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
707 bb->index = index;
111
kono
parents: 67
diff changeset
708 SET_BASIC_BLOCK_FOR_FN (fn, index, bb);
kono
parents: 67
diff changeset
709 n_basic_blocks_for_fn (fn)++;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
710 return bb;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
711 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
712
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
713
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
714 /* Read the CFG for function FN from input block IB. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
715
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
716 static void
111
kono
parents: 67
diff changeset
717 input_cfg (struct lto_input_block *ib, struct data_in *data_in,
kono
parents: 67
diff changeset
718 struct function *fn)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
719 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
720 unsigned int bb_count;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
721 basic_block p_bb;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
722 unsigned int i;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
723 int index;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
724
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
725 init_empty_tree_cfg_for_function (fn);
111
kono
parents: 67
diff changeset
726 init_ssa_operands (fn);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
727
111
kono
parents: 67
diff changeset
728 profile_status_for_fn (fn) = streamer_read_enum (ib, profile_status_d,
kono
parents: 67
diff changeset
729 PROFILE_LAST);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
730
111
kono
parents: 67
diff changeset
731 bb_count = streamer_read_uhwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
732
111
kono
parents: 67
diff changeset
733 last_basic_block_for_fn (fn) = bb_count;
kono
parents: 67
diff changeset
734 if (bb_count > basic_block_info_for_fn (fn)->length ())
kono
parents: 67
diff changeset
735 vec_safe_grow_cleared (basic_block_info_for_fn (fn), bb_count);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
736
111
kono
parents: 67
diff changeset
737 if (bb_count > label_to_block_map_for_fn (fn)->length ())
kono
parents: 67
diff changeset
738 vec_safe_grow_cleared (label_to_block_map_for_fn (fn), bb_count);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
739
111
kono
parents: 67
diff changeset
740 index = streamer_read_hwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
741 while (index != -1)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
742 {
111
kono
parents: 67
diff changeset
743 basic_block bb = BASIC_BLOCK_FOR_FN (fn, index);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
744 unsigned int edge_count;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
745
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
746 if (bb == NULL)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
747 bb = make_new_block (fn, index);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
748
111
kono
parents: 67
diff changeset
749 edge_count = streamer_read_uhwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
750
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
751 /* Connect up the CFG. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
752 for (i = 0; i < edge_count; i++)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
753 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
754 unsigned int dest_index;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
755 unsigned int edge_flags;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
756 basic_block dest;
111
kono
parents: 67
diff changeset
757 profile_probability probability;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
758 edge e;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
759
111
kono
parents: 67
diff changeset
760 dest_index = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
761 probability = profile_probability::stream_in (ib);
kono
parents: 67
diff changeset
762 edge_flags = streamer_read_uhwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
763
111
kono
parents: 67
diff changeset
764 dest = BASIC_BLOCK_FOR_FN (fn, dest_index);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
765
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
766 if (dest == NULL)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
767 dest = make_new_block (fn, dest_index);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
768
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
769 e = make_edge (bb, dest, edge_flags);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
770 e->probability = probability;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
771 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
772
111
kono
parents: 67
diff changeset
773 index = streamer_read_hwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
774 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
775
111
kono
parents: 67
diff changeset
776 p_bb = ENTRY_BLOCK_PTR_FOR_FN (fn);
kono
parents: 67
diff changeset
777 index = streamer_read_hwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
778 while (index != -1)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
779 {
111
kono
parents: 67
diff changeset
780 basic_block bb = BASIC_BLOCK_FOR_FN (fn, index);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
781 bb->prev_bb = p_bb;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
782 p_bb->next_bb = bb;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
783 p_bb = bb;
111
kono
parents: 67
diff changeset
784 index = streamer_read_hwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
785 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
786
111
kono
parents: 67
diff changeset
787 /* ??? The cfgloop interface is tied to cfun. */
kono
parents: 67
diff changeset
788 gcc_assert (cfun == fn);
kono
parents: 67
diff changeset
789
kono
parents: 67
diff changeset
790 /* Input the loop tree. */
kono
parents: 67
diff changeset
791 unsigned n_loops = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
792 if (n_loops == 0)
kono
parents: 67
diff changeset
793 return;
kono
parents: 67
diff changeset
794
kono
parents: 67
diff changeset
795 struct loops *loops = ggc_cleared_alloc<struct loops> ();
kono
parents: 67
diff changeset
796 init_loops_structure (fn, loops, n_loops);
kono
parents: 67
diff changeset
797 set_loops_for_fn (fn, loops);
kono
parents: 67
diff changeset
798
kono
parents: 67
diff changeset
799 /* Input each loop and associate it with its loop header so
kono
parents: 67
diff changeset
800 flow_loops_find can rebuild the loop tree. */
kono
parents: 67
diff changeset
801 for (unsigned i = 1; i < n_loops; ++i)
kono
parents: 67
diff changeset
802 {
kono
parents: 67
diff changeset
803 int header_index = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
804 if (header_index == -1)
kono
parents: 67
diff changeset
805 {
kono
parents: 67
diff changeset
806 loops->larray->quick_push (NULL);
kono
parents: 67
diff changeset
807 continue;
kono
parents: 67
diff changeset
808 }
kono
parents: 67
diff changeset
809
kono
parents: 67
diff changeset
810 struct loop *loop = alloc_loop ();
kono
parents: 67
diff changeset
811 loop->header = BASIC_BLOCK_FOR_FN (fn, header_index);
kono
parents: 67
diff changeset
812 loop->header->loop_father = loop;
kono
parents: 67
diff changeset
813
kono
parents: 67
diff changeset
814 /* Read everything copy_loop_info copies. */
kono
parents: 67
diff changeset
815 loop->estimate_state = streamer_read_enum (ib, loop_estimation, EST_LAST);
kono
parents: 67
diff changeset
816 loop->any_upper_bound = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
817 if (loop->any_upper_bound)
kono
parents: 67
diff changeset
818 loop->nb_iterations_upper_bound = streamer_read_widest_int (ib);
kono
parents: 67
diff changeset
819 loop->any_likely_upper_bound = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
820 if (loop->any_likely_upper_bound)
kono
parents: 67
diff changeset
821 loop->nb_iterations_likely_upper_bound = streamer_read_widest_int (ib);
kono
parents: 67
diff changeset
822 loop->any_estimate = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
823 if (loop->any_estimate)
kono
parents: 67
diff changeset
824 loop->nb_iterations_estimate = streamer_read_widest_int (ib);
kono
parents: 67
diff changeset
825
kono
parents: 67
diff changeset
826 /* Read OMP SIMD related info. */
kono
parents: 67
diff changeset
827 loop->safelen = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
828 loop->dont_vectorize = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
829 loop->force_vectorize = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
830 loop->simduid = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
831
kono
parents: 67
diff changeset
832 place_new_loop (fn, loop);
kono
parents: 67
diff changeset
833
kono
parents: 67
diff changeset
834 /* flow_loops_find doesn't like loops not in the tree, hook them
kono
parents: 67
diff changeset
835 all as siblings of the tree root temporarily. */
kono
parents: 67
diff changeset
836 flow_loop_tree_node_add (loops->tree_root, loop);
kono
parents: 67
diff changeset
837 }
kono
parents: 67
diff changeset
838
kono
parents: 67
diff changeset
839 /* Rebuild the loop tree. */
kono
parents: 67
diff changeset
840 flow_loops_find (loops);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
841 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
842
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
843
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
844 /* Read the SSA names array for function FN from DATA_IN using input
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
845 block IB. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
846
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
847 static void
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
848 input_ssa_names (struct lto_input_block *ib, struct data_in *data_in,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
849 struct function *fn)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
850 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
851 unsigned int i, size;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
852
111
kono
parents: 67
diff changeset
853 size = streamer_read_uhwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
854 init_ssanames (fn, size);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
855
111
kono
parents: 67
diff changeset
856 i = streamer_read_uhwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
857 while (i)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
858 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
859 tree ssa_name, name;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
860 bool is_default_def;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
861
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
862 /* Skip over the elements that had been freed. */
111
kono
parents: 67
diff changeset
863 while (SSANAMES (fn)->length () < i)
kono
parents: 67
diff changeset
864 SSANAMES (fn)->quick_push (NULL_TREE);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
865
111
kono
parents: 67
diff changeset
866 is_default_def = (streamer_read_uchar (ib) != 0);
kono
parents: 67
diff changeset
867 name = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
868 ssa_name = make_ssa_name_fn (fn, name, NULL);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
869
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
870 if (is_default_def)
111
kono
parents: 67
diff changeset
871 {
kono
parents: 67
diff changeset
872 set_ssa_default_def (cfun, SSA_NAME_VAR (ssa_name), ssa_name);
kono
parents: 67
diff changeset
873 SSA_NAME_DEF_STMT (ssa_name) = gimple_build_nop ();
kono
parents: 67
diff changeset
874 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
875
111
kono
parents: 67
diff changeset
876 i = streamer_read_uhwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
877 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
878 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
879
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
880
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
881 /* Go through all NODE edges and fixup call_stmt pointers
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
882 so they point to STMTS. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
883
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
884 static void
111
kono
parents: 67
diff changeset
885 fixup_call_stmt_edges_1 (struct cgraph_node *node, gimple **stmts,
kono
parents: 67
diff changeset
886 struct function *fn)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
887 {
111
kono
parents: 67
diff changeset
888 #define STMT_UID_NOT_IN_RANGE(uid) \
kono
parents: 67
diff changeset
889 (gimple_stmt_max_uid (fn) < uid || uid == 0)
kono
parents: 67
diff changeset
890
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
891 struct cgraph_edge *cedge;
111
kono
parents: 67
diff changeset
892 struct ipa_ref *ref = NULL;
kono
parents: 67
diff changeset
893 unsigned int i;
kono
parents: 67
diff changeset
894
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
895 for (cedge = node->callees; cedge; cedge = cedge->next_callee)
111
kono
parents: 67
diff changeset
896 {
kono
parents: 67
diff changeset
897 if (STMT_UID_NOT_IN_RANGE (cedge->lto_stmt_uid))
kono
parents: 67
diff changeset
898 fatal_error (input_location,
kono
parents: 67
diff changeset
899 "Cgraph edge statement index out of range");
kono
parents: 67
diff changeset
900 cedge->call_stmt = as_a <gcall *> (stmts[cedge->lto_stmt_uid - 1]);
kono
parents: 67
diff changeset
901 if (!cedge->call_stmt)
kono
parents: 67
diff changeset
902 fatal_error (input_location,
kono
parents: 67
diff changeset
903 "Cgraph edge statement index not found");
kono
parents: 67
diff changeset
904 }
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
905 for (cedge = node->indirect_calls; cedge; cedge = cedge->next_callee)
111
kono
parents: 67
diff changeset
906 {
kono
parents: 67
diff changeset
907 if (STMT_UID_NOT_IN_RANGE (cedge->lto_stmt_uid))
kono
parents: 67
diff changeset
908 fatal_error (input_location,
kono
parents: 67
diff changeset
909 "Cgraph edge statement index out of range");
kono
parents: 67
diff changeset
910 cedge->call_stmt = as_a <gcall *> (stmts[cedge->lto_stmt_uid - 1]);
kono
parents: 67
diff changeset
911 if (!cedge->call_stmt)
kono
parents: 67
diff changeset
912 fatal_error (input_location, "Cgraph edge statement index not found");
kono
parents: 67
diff changeset
913 }
kono
parents: 67
diff changeset
914 for (i = 0; node->iterate_reference (i, ref); i++)
kono
parents: 67
diff changeset
915 if (ref->lto_stmt_uid)
kono
parents: 67
diff changeset
916 {
kono
parents: 67
diff changeset
917 if (STMT_UID_NOT_IN_RANGE (ref->lto_stmt_uid))
kono
parents: 67
diff changeset
918 fatal_error (input_location,
kono
parents: 67
diff changeset
919 "Reference statement index out of range");
kono
parents: 67
diff changeset
920 ref->stmt = stmts[ref->lto_stmt_uid - 1];
kono
parents: 67
diff changeset
921 if (!ref->stmt)
kono
parents: 67
diff changeset
922 fatal_error (input_location, "Reference statement index not found");
kono
parents: 67
diff changeset
923 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
924 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
925
111
kono
parents: 67
diff changeset
926
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
927 /* Fixup call_stmt pointers in NODE and all clones. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
928
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
929 static void
111
kono
parents: 67
diff changeset
930 fixup_call_stmt_edges (struct cgraph_node *orig, gimple **stmts)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
931 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
932 struct cgraph_node *node;
111
kono
parents: 67
diff changeset
933 struct function *fn;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
934
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
935 while (orig->clone_of)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
936 orig = orig->clone_of;
111
kono
parents: 67
diff changeset
937 fn = DECL_STRUCT_FUNCTION (orig->decl);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
938
111
kono
parents: 67
diff changeset
939 if (!orig->thunk.thunk_p)
kono
parents: 67
diff changeset
940 fixup_call_stmt_edges_1 (orig, stmts, fn);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
941 if (orig->clones)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
942 for (node = orig->clones; node != orig;)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
943 {
111
kono
parents: 67
diff changeset
944 if (!node->thunk.thunk_p)
kono
parents: 67
diff changeset
945 fixup_call_stmt_edges_1 (node, stmts, fn);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
946 if (node->clones)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
947 node = node->clones;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
948 else if (node->next_sibling_clone)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
949 node = node->next_sibling_clone;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
950 else
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
951 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
952 while (node != orig && !node->next_sibling_clone)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
953 node = node->clone_of;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
954 if (node != orig)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
955 node = node->next_sibling_clone;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
956 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
957 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
958 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
959
111
kono
parents: 67
diff changeset
960
kono
parents: 67
diff changeset
961 /* Input the base body of struct function FN from DATA_IN
kono
parents: 67
diff changeset
962 using input block IB. */
kono
parents: 67
diff changeset
963
kono
parents: 67
diff changeset
964 static void
kono
parents: 67
diff changeset
965 input_struct_function_base (struct function *fn, struct data_in *data_in,
kono
parents: 67
diff changeset
966 struct lto_input_block *ib)
kono
parents: 67
diff changeset
967 {
kono
parents: 67
diff changeset
968 struct bitpack_d bp;
kono
parents: 67
diff changeset
969 int len;
kono
parents: 67
diff changeset
970
kono
parents: 67
diff changeset
971 /* Read the static chain and non-local goto save area. */
kono
parents: 67
diff changeset
972 fn->static_chain_decl = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
973 fn->nonlocal_goto_save_area = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
974
kono
parents: 67
diff changeset
975 /* Read all the local symbols. */
kono
parents: 67
diff changeset
976 len = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
977 if (len > 0)
kono
parents: 67
diff changeset
978 {
kono
parents: 67
diff changeset
979 int i;
kono
parents: 67
diff changeset
980 vec_safe_grow_cleared (fn->local_decls, len);
kono
parents: 67
diff changeset
981 for (i = 0; i < len; i++)
kono
parents: 67
diff changeset
982 {
kono
parents: 67
diff changeset
983 tree t = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
984 (*fn->local_decls)[i] = t;
kono
parents: 67
diff changeset
985 }
kono
parents: 67
diff changeset
986 }
kono
parents: 67
diff changeset
987
kono
parents: 67
diff changeset
988 /* Input the current IL state of the function. */
kono
parents: 67
diff changeset
989 fn->curr_properties = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
990
kono
parents: 67
diff changeset
991 /* Read all the attributes for FN. */
kono
parents: 67
diff changeset
992 bp = streamer_read_bitpack (ib);
kono
parents: 67
diff changeset
993 fn->is_thunk = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
994 fn->has_local_explicit_reg_vars = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
995 fn->returns_pcc_struct = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
996 fn->returns_struct = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
997 fn->can_throw_non_call_exceptions = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
998 fn->can_delete_dead_exceptions = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
999 fn->always_inline_functions_inlined = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1000 fn->after_inlining = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1001 fn->stdarg = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1002 fn->has_nonlocal_label = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1003 fn->has_forced_label_in_static = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1004 fn->calls_alloca = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1005 fn->calls_setjmp = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1006 fn->has_force_vectorize_loops = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1007 fn->has_simduid_loops = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1008 fn->va_list_fpr_size = bp_unpack_value (&bp, 8);
kono
parents: 67
diff changeset
1009 fn->va_list_gpr_size = bp_unpack_value (&bp, 8);
kono
parents: 67
diff changeset
1010 fn->last_clique = bp_unpack_value (&bp, sizeof (short) * 8);
kono
parents: 67
diff changeset
1011
kono
parents: 67
diff changeset
1012 /* Input the function start and end loci. */
kono
parents: 67
diff changeset
1013 fn->function_start_locus = stream_input_location_now (&bp, data_in);
kono
parents: 67
diff changeset
1014 fn->function_end_locus = stream_input_location_now (&bp, data_in);
kono
parents: 67
diff changeset
1015 }
kono
parents: 67
diff changeset
1016
kono
parents: 67
diff changeset
1017
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1018 /* Read the body of function FN_DECL from DATA_IN using input block IB. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1019
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1020 static void
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1021 input_function (tree fn_decl, struct data_in *data_in,
111
kono
parents: 67
diff changeset
1022 struct lto_input_block *ib, struct lto_input_block *ib_cfg)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1023 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1024 struct function *fn;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1025 enum LTO_tags tag;
111
kono
parents: 67
diff changeset
1026 gimple **stmts;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1027 basic_block bb;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1028 struct cgraph_node *node;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1029
111
kono
parents: 67
diff changeset
1030 tag = streamer_read_record_start (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1031 lto_tag_check (tag, LTO_function);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1032
111
kono
parents: 67
diff changeset
1033 /* Read decls for parameters and args. */
kono
parents: 67
diff changeset
1034 DECL_RESULT (fn_decl) = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
1035 DECL_ARGUMENTS (fn_decl) = streamer_read_chain (ib, data_in);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1036
111
kono
parents: 67
diff changeset
1037 /* Read debug args if available. */
kono
parents: 67
diff changeset
1038 unsigned n_debugargs = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1039 if (n_debugargs)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1040 {
111
kono
parents: 67
diff changeset
1041 vec<tree, va_gc> **debugargs = decl_debug_args_insert (fn_decl);
kono
parents: 67
diff changeset
1042 vec_safe_grow (*debugargs, n_debugargs);
kono
parents: 67
diff changeset
1043 for (unsigned i = 0; i < n_debugargs; ++i)
kono
parents: 67
diff changeset
1044 (**debugargs)[i] = stream_read_tree (ib, data_in);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1045 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1046
111
kono
parents: 67
diff changeset
1047 /* Read the tree of lexical scopes for the function. */
kono
parents: 67
diff changeset
1048 DECL_INITIAL (fn_decl) = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
1049 unsigned block_leaf_count = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1050 while (block_leaf_count--)
kono
parents: 67
diff changeset
1051 stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
1052
kono
parents: 67
diff changeset
1053 if (!streamer_read_uhwi (ib))
kono
parents: 67
diff changeset
1054 return;
kono
parents: 67
diff changeset
1055
kono
parents: 67
diff changeset
1056 push_struct_function (fn_decl);
kono
parents: 67
diff changeset
1057 fn = DECL_STRUCT_FUNCTION (fn_decl);
kono
parents: 67
diff changeset
1058 init_tree_ssa (fn);
kono
parents: 67
diff changeset
1059 /* We input IL in SSA form. */
kono
parents: 67
diff changeset
1060 cfun->gimple_df->in_ssa_p = true;
kono
parents: 67
diff changeset
1061
kono
parents: 67
diff changeset
1062 gimple_register_cfg_hooks ();
kono
parents: 67
diff changeset
1063
kono
parents: 67
diff changeset
1064 node = cgraph_node::get (fn_decl);
kono
parents: 67
diff changeset
1065 if (!node)
kono
parents: 67
diff changeset
1066 node = cgraph_node::create (fn_decl);
kono
parents: 67
diff changeset
1067 input_struct_function_base (fn, data_in, ib);
kono
parents: 67
diff changeset
1068 input_cfg (ib_cfg, data_in, fn);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1069
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1070 /* Read all the SSA names. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1071 input_ssa_names (ib, data_in, fn);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1072
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1073 /* Read the exception handling regions in the function. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1074 input_eh_regions (ib, data_in, fn);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1075
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1076 gcc_assert (DECL_INITIAL (fn_decl));
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1077 DECL_SAVED_TREE (fn_decl) = NULL_TREE;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1078
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1079 /* Read all the basic blocks. */
111
kono
parents: 67
diff changeset
1080 tag = streamer_read_record_start (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1081 while (tag)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1082 {
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1083 input_bb (ib, tag, data_in, fn,
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1084 node->count_materialization_scale);
111
kono
parents: 67
diff changeset
1085 tag = streamer_read_record_start (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1086 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1087
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1088 /* Fix up the call statements that are mentioned in the callgraph
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1089 edges. */
111
kono
parents: 67
diff changeset
1090 set_gimple_stmt_max_uid (cfun, 0);
kono
parents: 67
diff changeset
1091 FOR_ALL_BB_FN (bb, cfun)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1092 {
111
kono
parents: 67
diff changeset
1093 gimple_stmt_iterator gsi;
kono
parents: 67
diff changeset
1094 for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
kono
parents: 67
diff changeset
1095 {
kono
parents: 67
diff changeset
1096 gimple *stmt = gsi_stmt (gsi);
kono
parents: 67
diff changeset
1097 gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
kono
parents: 67
diff changeset
1098 }
kono
parents: 67
diff changeset
1099 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
kono
parents: 67
diff changeset
1100 {
kono
parents: 67
diff changeset
1101 gimple *stmt = gsi_stmt (gsi);
kono
parents: 67
diff changeset
1102 gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
kono
parents: 67
diff changeset
1103 }
kono
parents: 67
diff changeset
1104 }
kono
parents: 67
diff changeset
1105 stmts = (gimple **) xcalloc (gimple_stmt_max_uid (fn), sizeof (gimple *));
kono
parents: 67
diff changeset
1106 FOR_ALL_BB_FN (bb, cfun)
kono
parents: 67
diff changeset
1107 {
kono
parents: 67
diff changeset
1108 gimple_stmt_iterator bsi = gsi_start_phis (bb);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1109 while (!gsi_end_p (bsi))
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1110 {
111
kono
parents: 67
diff changeset
1111 gimple *stmt = gsi_stmt (bsi);
kono
parents: 67
diff changeset
1112 gsi_next (&bsi);
kono
parents: 67
diff changeset
1113 stmts[gimple_uid (stmt)] = stmt;
kono
parents: 67
diff changeset
1114 }
kono
parents: 67
diff changeset
1115 bsi = gsi_start_bb (bb);
kono
parents: 67
diff changeset
1116 while (!gsi_end_p (bsi))
kono
parents: 67
diff changeset
1117 {
kono
parents: 67
diff changeset
1118 gimple *stmt = gsi_stmt (bsi);
kono
parents: 67
diff changeset
1119 bool remove = false;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1120 /* If we're recompiling LTO objects with debug stmts but
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1121 we're not supposed to have debug stmts, remove them now.
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1122 We can't remove them earlier because this would cause uid
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1123 mismatches in fixups, but we can do it at this point, as
111
kono
parents: 67
diff changeset
1124 long as debug stmts don't require fixups.
kono
parents: 67
diff changeset
1125 Similarly remove all IFN_*SAN_* internal calls */
kono
parents: 67
diff changeset
1126 if (!flag_wpa)
kono
parents: 67
diff changeset
1127 {
kono
parents: 67
diff changeset
1128 if (!MAY_HAVE_DEBUG_STMTS && is_gimple_debug (stmt))
kono
parents: 67
diff changeset
1129 remove = true;
kono
parents: 67
diff changeset
1130 if (is_gimple_call (stmt)
kono
parents: 67
diff changeset
1131 && gimple_call_internal_p (stmt))
kono
parents: 67
diff changeset
1132 {
kono
parents: 67
diff changeset
1133 switch (gimple_call_internal_fn (stmt))
kono
parents: 67
diff changeset
1134 {
kono
parents: 67
diff changeset
1135 case IFN_UBSAN_NULL:
kono
parents: 67
diff changeset
1136 if ((flag_sanitize
kono
parents: 67
diff changeset
1137 & (SANITIZE_NULL | SANITIZE_ALIGNMENT)) == 0)
kono
parents: 67
diff changeset
1138 remove = true;
kono
parents: 67
diff changeset
1139 break;
kono
parents: 67
diff changeset
1140 case IFN_UBSAN_BOUNDS:
kono
parents: 67
diff changeset
1141 if ((flag_sanitize & SANITIZE_BOUNDS) == 0)
kono
parents: 67
diff changeset
1142 remove = true;
kono
parents: 67
diff changeset
1143 break;
kono
parents: 67
diff changeset
1144 case IFN_UBSAN_VPTR:
kono
parents: 67
diff changeset
1145 if ((flag_sanitize & SANITIZE_VPTR) == 0)
kono
parents: 67
diff changeset
1146 remove = true;
kono
parents: 67
diff changeset
1147 break;
kono
parents: 67
diff changeset
1148 case IFN_UBSAN_OBJECT_SIZE:
kono
parents: 67
diff changeset
1149 if ((flag_sanitize & SANITIZE_OBJECT_SIZE) == 0)
kono
parents: 67
diff changeset
1150 remove = true;
kono
parents: 67
diff changeset
1151 break;
kono
parents: 67
diff changeset
1152 case IFN_UBSAN_PTR:
kono
parents: 67
diff changeset
1153 if ((flag_sanitize & SANITIZE_POINTER_OVERFLOW) == 0)
kono
parents: 67
diff changeset
1154 remove = true;
kono
parents: 67
diff changeset
1155 break;
kono
parents: 67
diff changeset
1156 case IFN_ASAN_MARK:
kono
parents: 67
diff changeset
1157 if ((flag_sanitize & SANITIZE_ADDRESS) == 0)
kono
parents: 67
diff changeset
1158 remove = true;
kono
parents: 67
diff changeset
1159 break;
kono
parents: 67
diff changeset
1160 case IFN_TSAN_FUNC_EXIT:
kono
parents: 67
diff changeset
1161 if ((flag_sanitize & SANITIZE_THREAD) == 0)
kono
parents: 67
diff changeset
1162 remove = true;
kono
parents: 67
diff changeset
1163 break;
kono
parents: 67
diff changeset
1164 default:
kono
parents: 67
diff changeset
1165 break;
kono
parents: 67
diff changeset
1166 }
kono
parents: 67
diff changeset
1167 gcc_assert (!remove || gimple_call_lhs (stmt) == NULL_TREE);
kono
parents: 67
diff changeset
1168 }
kono
parents: 67
diff changeset
1169 }
kono
parents: 67
diff changeset
1170 if (remove)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1171 {
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1172 gimple_stmt_iterator gsi = bsi;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1173 gsi_next (&bsi);
111
kono
parents: 67
diff changeset
1174 unlink_stmt_vdef (stmt);
kono
parents: 67
diff changeset
1175 release_defs (stmt);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1176 gsi_remove (&gsi, true);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1177 }
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1178 else
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1179 {
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1180 gsi_next (&bsi);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1181 stmts[gimple_uid (stmt)] = stmt;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1182 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1183 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1184 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1185
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1186 /* Set the gimple body to the statement sequence in the entry
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1187 basic block. FIXME lto, this is fairly hacky. The existence
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1188 of a gimple body is used by the cgraph routines, but we should
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1189 really use the presence of the CFG. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1190 {
111
kono
parents: 67
diff changeset
1191 edge_iterator ei = ei_start (ENTRY_BLOCK_PTR_FOR_FN (cfun)->succs);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1192 gimple_set_body (fn_decl, bb_seq (ei_edge (ei)->dest));
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1193 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1194
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1195 fixup_call_stmt_edges (node, stmts);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1196 execute_all_ipa_stmt_fixups (node, stmts);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1197
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1198 update_ssa (TODO_update_ssa_only_virtuals);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1199 free_dominance_info (CDI_DOMINATORS);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1200 free_dominance_info (CDI_POST_DOMINATORS);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1201 free (stmts);
111
kono
parents: 67
diff changeset
1202 pop_cfun ();
kono
parents: 67
diff changeset
1203 }
kono
parents: 67
diff changeset
1204
kono
parents: 67
diff changeset
1205 /* Read the body of function FN_DECL from DATA_IN using input block IB. */
kono
parents: 67
diff changeset
1206
kono
parents: 67
diff changeset
1207 static void
kono
parents: 67
diff changeset
1208 input_constructor (tree var, struct data_in *data_in,
kono
parents: 67
diff changeset
1209 struct lto_input_block *ib)
kono
parents: 67
diff changeset
1210 {
kono
parents: 67
diff changeset
1211 DECL_INITIAL (var) = stream_read_tree (ib, data_in);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1212 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1213
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1214
111
kono
parents: 67
diff changeset
1215 /* Read the body from DATA for function NODE and fill it in.
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1216 FILE_DATA are the global decls and types. SECTION_TYPE is either
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1217 LTO_section_function_body or LTO_section_static_initializer. If
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1218 section type is LTO_section_function_body, FN must be the decl for
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1219 that function. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1220
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1221 static void
111
kono
parents: 67
diff changeset
1222 lto_read_body_or_constructor (struct lto_file_decl_data *file_data, struct symtab_node *node,
kono
parents: 67
diff changeset
1223 const char *data, enum lto_section_type section_type)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1224 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1225 const struct lto_function_header *header;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1226 struct data_in *data_in;
111
kono
parents: 67
diff changeset
1227 int cfg_offset;
kono
parents: 67
diff changeset
1228 int main_offset;
kono
parents: 67
diff changeset
1229 int string_offset;
kono
parents: 67
diff changeset
1230 tree fn_decl = node->decl;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1231
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1232 header = (const struct lto_function_header *) data;
111
kono
parents: 67
diff changeset
1233 if (TREE_CODE (node->decl) == FUNCTION_DECL)
kono
parents: 67
diff changeset
1234 {
kono
parents: 67
diff changeset
1235 cfg_offset = sizeof (struct lto_function_header);
kono
parents: 67
diff changeset
1236 main_offset = cfg_offset + header->cfg_size;
kono
parents: 67
diff changeset
1237 string_offset = main_offset + header->main_size;
kono
parents: 67
diff changeset
1238 }
kono
parents: 67
diff changeset
1239 else
kono
parents: 67
diff changeset
1240 {
kono
parents: 67
diff changeset
1241 main_offset = sizeof (struct lto_function_header);
kono
parents: 67
diff changeset
1242 string_offset = main_offset + header->main_size;
kono
parents: 67
diff changeset
1243 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1244
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1245 data_in = lto_data_in_create (file_data, data + string_offset,
111
kono
parents: 67
diff changeset
1246 header->string_size, vNULL);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1247
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1248 if (section_type == LTO_section_function_body)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1249 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1250 struct lto_in_decl_state *decl_state;
111
kono
parents: 67
diff changeset
1251 unsigned from;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1252
111
kono
parents: 67
diff changeset
1253 gcc_checking_assert (node);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1254
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1255 /* Use the function's decl state. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1256 decl_state = lto_get_function_in_decl_state (file_data, fn_decl);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1257 gcc_assert (decl_state);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1258 file_data->current_decl_state = decl_state;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1259
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1260
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1261 /* Set up the struct function. */
111
kono
parents: 67
diff changeset
1262 from = data_in->reader_cache->nodes.length ();
kono
parents: 67
diff changeset
1263 lto_input_block ib_main (data + main_offset, header->main_size,
kono
parents: 67
diff changeset
1264 file_data->mode_table);
kono
parents: 67
diff changeset
1265 if (TREE_CODE (node->decl) == FUNCTION_DECL)
kono
parents: 67
diff changeset
1266 {
kono
parents: 67
diff changeset
1267 lto_input_block ib_cfg (data + cfg_offset, header->cfg_size,
kono
parents: 67
diff changeset
1268 file_data->mode_table);
kono
parents: 67
diff changeset
1269 input_function (fn_decl, data_in, &ib_main, &ib_cfg);
kono
parents: 67
diff changeset
1270 }
kono
parents: 67
diff changeset
1271 else
kono
parents: 67
diff changeset
1272 input_constructor (fn_decl, data_in, &ib_main);
kono
parents: 67
diff changeset
1273 data_in->location_cache.apply_location_cache ();
kono
parents: 67
diff changeset
1274 /* And fixup types we streamed locally. */
kono
parents: 67
diff changeset
1275 {
kono
parents: 67
diff changeset
1276 struct streamer_tree_cache_d *cache = data_in->reader_cache;
kono
parents: 67
diff changeset
1277 unsigned len = cache->nodes.length ();
kono
parents: 67
diff changeset
1278 unsigned i;
kono
parents: 67
diff changeset
1279 for (i = len; i-- > from;)
kono
parents: 67
diff changeset
1280 {
kono
parents: 67
diff changeset
1281 tree t = streamer_tree_cache_get_tree (cache, i);
kono
parents: 67
diff changeset
1282 if (t == NULL_TREE)
kono
parents: 67
diff changeset
1283 continue;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1284
111
kono
parents: 67
diff changeset
1285 if (TYPE_P (t))
kono
parents: 67
diff changeset
1286 {
kono
parents: 67
diff changeset
1287 gcc_assert (TYPE_CANONICAL (t) == NULL_TREE);
kono
parents: 67
diff changeset
1288 if (type_with_alias_set_p (t)
kono
parents: 67
diff changeset
1289 && canonical_type_used_p (t))
kono
parents: 67
diff changeset
1290 TYPE_CANONICAL (t) = TYPE_MAIN_VARIANT (t);
kono
parents: 67
diff changeset
1291 if (TYPE_MAIN_VARIANT (t) != t)
kono
parents: 67
diff changeset
1292 {
kono
parents: 67
diff changeset
1293 gcc_assert (TYPE_NEXT_VARIANT (t) == NULL_TREE);
kono
parents: 67
diff changeset
1294 TYPE_NEXT_VARIANT (t)
kono
parents: 67
diff changeset
1295 = TYPE_NEXT_VARIANT (TYPE_MAIN_VARIANT (t));
kono
parents: 67
diff changeset
1296 TYPE_NEXT_VARIANT (TYPE_MAIN_VARIANT (t)) = t;
kono
parents: 67
diff changeset
1297 }
kono
parents: 67
diff changeset
1298 }
kono
parents: 67
diff changeset
1299 }
kono
parents: 67
diff changeset
1300 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1301
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1302 /* Restore decl state */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1303 file_data->current_decl_state = file_data->global_decl_state;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1304 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1305
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1306 lto_data_in_delete (data_in);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1307 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1308
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1309
111
kono
parents: 67
diff changeset
1310 /* Read the body of NODE using DATA. FILE_DATA holds the global
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1311 decls and types. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1312
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1313 void
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1314 lto_input_function_body (struct lto_file_decl_data *file_data,
111
kono
parents: 67
diff changeset
1315 struct cgraph_node *node, const char *data)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1316 {
111
kono
parents: 67
diff changeset
1317 lto_read_body_or_constructor (file_data, node, data, LTO_section_function_body);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1318 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1319
111
kono
parents: 67
diff changeset
1320 /* Read the body of NODE using DATA. FILE_DATA holds the global
kono
parents: 67
diff changeset
1321 decls and types. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1322
111
kono
parents: 67
diff changeset
1323 void
kono
parents: 67
diff changeset
1324 lto_input_variable_constructor (struct lto_file_decl_data *file_data,
kono
parents: 67
diff changeset
1325 struct varpool_node *node, const char *data)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1326 {
111
kono
parents: 67
diff changeset
1327 lto_read_body_or_constructor (file_data, node, data, LTO_section_function_body);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1328 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1329
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1330
111
kono
parents: 67
diff changeset
1331 /* Queue of acummulated decl -> DIE mappings. Similar to locations those
kono
parents: 67
diff changeset
1332 are only applied to prevailing tree nodes during tree merging. */
kono
parents: 67
diff changeset
1333 vec<dref_entry> dref_queue;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1334
111
kono
parents: 67
diff changeset
1335 /* Read the physical representation of a tree node EXPR from
kono
parents: 67
diff changeset
1336 input block IB using the per-file context in DATA_IN. */
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1337
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1338 static void
111
kono
parents: 67
diff changeset
1339 lto_read_tree_1 (struct lto_input_block *ib, struct data_in *data_in, tree expr)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1340 {
111
kono
parents: 67
diff changeset
1341 /* Read all the bitfield values in EXPR. Note that for LTO, we
kono
parents: 67
diff changeset
1342 only write language-independent bitfields, so no more unpacking is
kono
parents: 67
diff changeset
1343 needed. */
kono
parents: 67
diff changeset
1344 streamer_read_tree_bitfields (ib, data_in, expr);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1345
111
kono
parents: 67
diff changeset
1346 /* Read all the pointer fields in EXPR. */
kono
parents: 67
diff changeset
1347 streamer_read_tree_body (ib, data_in, expr);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1348
111
kono
parents: 67
diff changeset
1349 /* Read any LTO-specific data not read by the tree streamer. */
kono
parents: 67
diff changeset
1350 if (DECL_P (expr)
kono
parents: 67
diff changeset
1351 && TREE_CODE (expr) != FUNCTION_DECL
kono
parents: 67
diff changeset
1352 && TREE_CODE (expr) != TRANSLATION_UNIT_DECL)
kono
parents: 67
diff changeset
1353 DECL_INITIAL (expr) = stream_read_tree (ib, data_in);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1354
111
kono
parents: 67
diff changeset
1355 /* Stream references to early generated DIEs. Keep in sync with the
kono
parents: 67
diff changeset
1356 trees handled in dwarf2out_register_external_die. */
kono
parents: 67
diff changeset
1357 if ((DECL_P (expr)
kono
parents: 67
diff changeset
1358 && TREE_CODE (expr) != FIELD_DECL
kono
parents: 67
diff changeset
1359 && TREE_CODE (expr) != DEBUG_EXPR_DECL
kono
parents: 67
diff changeset
1360 && TREE_CODE (expr) != TYPE_DECL)
kono
parents: 67
diff changeset
1361 || TREE_CODE (expr) == BLOCK)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1362 {
111
kono
parents: 67
diff changeset
1363 const char *str = streamer_read_string (data_in, ib);
kono
parents: 67
diff changeset
1364 if (str)
kono
parents: 67
diff changeset
1365 {
kono
parents: 67
diff changeset
1366 unsigned HOST_WIDE_INT off = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1367 dref_entry e = { expr, str, off };
kono
parents: 67
diff changeset
1368 dref_queue.safe_push (e);
kono
parents: 67
diff changeset
1369 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1370 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1371 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1372
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1373 /* Read the physical representation of a tree node with tag TAG from
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1374 input block IB using the per-file context in DATA_IN. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1375
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1376 static tree
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1377 lto_read_tree (struct lto_input_block *ib, struct data_in *data_in,
111
kono
parents: 67
diff changeset
1378 enum LTO_tags tag, hashval_t hash)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1379 {
111
kono
parents: 67
diff changeset
1380 /* Instantiate a new tree node. */
kono
parents: 67
diff changeset
1381 tree result = streamer_alloc_tree (ib, data_in, tag);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1382
111
kono
parents: 67
diff changeset
1383 /* Enter RESULT in the reader cache. This will make RESULT
kono
parents: 67
diff changeset
1384 available so that circular references in the rest of the tree
kono
parents: 67
diff changeset
1385 structure can be resolved in subsequent calls to stream_read_tree. */
kono
parents: 67
diff changeset
1386 streamer_tree_cache_append (data_in->reader_cache, result, hash);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1387
111
kono
parents: 67
diff changeset
1388 lto_read_tree_1 (ib, data_in, result);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1389
111
kono
parents: 67
diff changeset
1390 /* end_marker = */ streamer_read_uchar (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1391
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1392 return result;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1393 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1394
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1395
111
kono
parents: 67
diff changeset
1396 /* Populate the reader cache with trees materialized from the SCC
kono
parents: 67
diff changeset
1397 following in the IB, DATA_IN stream. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1398
111
kono
parents: 67
diff changeset
1399 hashval_t
kono
parents: 67
diff changeset
1400 lto_input_scc (struct lto_input_block *ib, struct data_in *data_in,
kono
parents: 67
diff changeset
1401 unsigned *len, unsigned *entry_len)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1402 {
111
kono
parents: 67
diff changeset
1403 /* A blob of unnamed tree nodes, fill the cache from it and
kono
parents: 67
diff changeset
1404 recurse. */
kono
parents: 67
diff changeset
1405 unsigned size = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1406 hashval_t scc_hash = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1407 unsigned scc_entry_len = 1;
kono
parents: 67
diff changeset
1408
kono
parents: 67
diff changeset
1409 if (size == 1)
kono
parents: 67
diff changeset
1410 {
kono
parents: 67
diff changeset
1411 enum LTO_tags tag = streamer_read_record_start (ib);
kono
parents: 67
diff changeset
1412 lto_input_tree_1 (ib, data_in, tag, scc_hash);
kono
parents: 67
diff changeset
1413 }
kono
parents: 67
diff changeset
1414 else
kono
parents: 67
diff changeset
1415 {
kono
parents: 67
diff changeset
1416 unsigned int first = data_in->reader_cache->nodes.length ();
kono
parents: 67
diff changeset
1417 tree result;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1418
111
kono
parents: 67
diff changeset
1419 scc_entry_len = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1420
kono
parents: 67
diff changeset
1421 /* Materialize size trees by reading their headers. */
kono
parents: 67
diff changeset
1422 for (unsigned i = 0; i < size; ++i)
kono
parents: 67
diff changeset
1423 {
kono
parents: 67
diff changeset
1424 enum LTO_tags tag = streamer_read_record_start (ib);
kono
parents: 67
diff changeset
1425 if (tag == LTO_null
kono
parents: 67
diff changeset
1426 || (tag >= LTO_field_decl_ref && tag <= LTO_global_decl_ref)
kono
parents: 67
diff changeset
1427 || tag == LTO_tree_pickle_reference
kono
parents: 67
diff changeset
1428 || tag == LTO_integer_cst
kono
parents: 67
diff changeset
1429 || tag == LTO_tree_scc)
kono
parents: 67
diff changeset
1430 gcc_unreachable ();
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1431
111
kono
parents: 67
diff changeset
1432 result = streamer_alloc_tree (ib, data_in, tag);
kono
parents: 67
diff changeset
1433 streamer_tree_cache_append (data_in->reader_cache, result, 0);
kono
parents: 67
diff changeset
1434 }
kono
parents: 67
diff changeset
1435
kono
parents: 67
diff changeset
1436 /* Read the tree bitpacks and references. */
kono
parents: 67
diff changeset
1437 for (unsigned i = 0; i < size; ++i)
kono
parents: 67
diff changeset
1438 {
kono
parents: 67
diff changeset
1439 result = streamer_tree_cache_get_tree (data_in->reader_cache,
kono
parents: 67
diff changeset
1440 first + i);
kono
parents: 67
diff changeset
1441 lto_read_tree_1 (ib, data_in, result);
kono
parents: 67
diff changeset
1442 /* end_marker = */ streamer_read_uchar (ib);
kono
parents: 67
diff changeset
1443 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1444 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1445
111
kono
parents: 67
diff changeset
1446 *len = size;
kono
parents: 67
diff changeset
1447 *entry_len = scc_entry_len;
kono
parents: 67
diff changeset
1448 return scc_hash;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1449 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1450
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1451
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1452 /* Read a tree from input block IB using the per-file context in
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1453 DATA_IN. This context is used, for example, to resolve references
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1454 to previously read nodes. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1455
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1456 tree
111
kono
parents: 67
diff changeset
1457 lto_input_tree_1 (struct lto_input_block *ib, struct data_in *data_in,
kono
parents: 67
diff changeset
1458 enum LTO_tags tag, hashval_t hash)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1459 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1460 tree result;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1461
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1462 gcc_assert ((unsigned) tag < (unsigned) LTO_NUM_TAGS);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1463
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1464 if (tag == LTO_null)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1465 result = NULL_TREE;
111
kono
parents: 67
diff changeset
1466 else if (tag >= LTO_field_decl_ref && tag <= LTO_namelist_decl_ref)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1467 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1468 /* If TAG is a reference to an indexable tree, the next value
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1469 in IB is the index into the table where we expect to find
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1470 that tree. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1471 result = lto_input_tree_ref (ib, data_in, cfun, tag);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1472 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1473 else if (tag == LTO_tree_pickle_reference)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1474 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1475 /* If TAG is a reference to a previously read tree, look it up in
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1476 the reader cache. */
111
kono
parents: 67
diff changeset
1477 result = streamer_get_pickled_tree (ib, data_in);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1478 }
111
kono
parents: 67
diff changeset
1479 else if (tag == LTO_integer_cst)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1480 {
111
kono
parents: 67
diff changeset
1481 /* For shared integer constants in singletons we can use the
kono
parents: 67
diff changeset
1482 existing tree integer constant merging code. */
kono
parents: 67
diff changeset
1483 tree type = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
1484 unsigned HOST_WIDE_INT len = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1485 unsigned HOST_WIDE_INT i;
kono
parents: 67
diff changeset
1486 HOST_WIDE_INT a[WIDE_INT_MAX_ELTS];
kono
parents: 67
diff changeset
1487
kono
parents: 67
diff changeset
1488 for (i = 0; i < len; i++)
kono
parents: 67
diff changeset
1489 a[i] = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
1490 gcc_assert (TYPE_PRECISION (type) <= MAX_BITSIZE_MODE_ANY_INT);
kono
parents: 67
diff changeset
1491 result = wide_int_to_tree (type, wide_int::from_array
kono
parents: 67
diff changeset
1492 (a, len, TYPE_PRECISION (type)));
kono
parents: 67
diff changeset
1493 streamer_tree_cache_append (data_in->reader_cache, result, hash);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1494 }
111
kono
parents: 67
diff changeset
1495 else if (tag == LTO_tree_scc)
kono
parents: 67
diff changeset
1496 gcc_unreachable ();
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1497 else
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1498 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1499 /* Otherwise, materialize a new node from IB. */
111
kono
parents: 67
diff changeset
1500 result = lto_read_tree (ib, data_in, tag, hash);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1501 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1502
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1503 return result;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1504 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1505
111
kono
parents: 67
diff changeset
1506 tree
kono
parents: 67
diff changeset
1507 lto_input_tree (struct lto_input_block *ib, struct data_in *data_in)
kono
parents: 67
diff changeset
1508 {
kono
parents: 67
diff changeset
1509 enum LTO_tags tag;
kono
parents: 67
diff changeset
1510
kono
parents: 67
diff changeset
1511 /* Input and skip SCCs. */
kono
parents: 67
diff changeset
1512 while ((tag = streamer_read_record_start (ib)) == LTO_tree_scc)
kono
parents: 67
diff changeset
1513 {
kono
parents: 67
diff changeset
1514 unsigned len, entry_len;
kono
parents: 67
diff changeset
1515 lto_input_scc (ib, data_in, &len, &entry_len);
kono
parents: 67
diff changeset
1516
kono
parents: 67
diff changeset
1517 /* Register DECLs with the debuginfo machinery. */
kono
parents: 67
diff changeset
1518 while (!dref_queue.is_empty ())
kono
parents: 67
diff changeset
1519 {
kono
parents: 67
diff changeset
1520 dref_entry e = dref_queue.pop ();
kono
parents: 67
diff changeset
1521 debug_hooks->register_external_die (e.decl, e.sym, e.off);
kono
parents: 67
diff changeset
1522 }
kono
parents: 67
diff changeset
1523 }
kono
parents: 67
diff changeset
1524 return lto_input_tree_1 (ib, data_in, tag, 0);
kono
parents: 67
diff changeset
1525 }
kono
parents: 67
diff changeset
1526
kono
parents: 67
diff changeset
1527
kono
parents: 67
diff changeset
1528 /* Input toplevel asms. */
kono
parents: 67
diff changeset
1529
kono
parents: 67
diff changeset
1530 void
kono
parents: 67
diff changeset
1531 lto_input_toplevel_asms (struct lto_file_decl_data *file_data, int order_base)
kono
parents: 67
diff changeset
1532 {
kono
parents: 67
diff changeset
1533 size_t len;
kono
parents: 67
diff changeset
1534 const char *data = lto_get_section_data (file_data, LTO_section_asm,
kono
parents: 67
diff changeset
1535 NULL, &len);
kono
parents: 67
diff changeset
1536 const struct lto_simple_header_with_strings *header
kono
parents: 67
diff changeset
1537 = (const struct lto_simple_header_with_strings *) data;
kono
parents: 67
diff changeset
1538 int string_offset;
kono
parents: 67
diff changeset
1539 struct data_in *data_in;
kono
parents: 67
diff changeset
1540 tree str;
kono
parents: 67
diff changeset
1541
kono
parents: 67
diff changeset
1542 if (! data)
kono
parents: 67
diff changeset
1543 return;
kono
parents: 67
diff changeset
1544
kono
parents: 67
diff changeset
1545 string_offset = sizeof (*header) + header->main_size;
kono
parents: 67
diff changeset
1546
kono
parents: 67
diff changeset
1547 lto_input_block ib (data + sizeof (*header), header->main_size,
kono
parents: 67
diff changeset
1548 file_data->mode_table);
kono
parents: 67
diff changeset
1549
kono
parents: 67
diff changeset
1550 data_in = lto_data_in_create (file_data, data + string_offset,
kono
parents: 67
diff changeset
1551 header->string_size, vNULL);
kono
parents: 67
diff changeset
1552
kono
parents: 67
diff changeset
1553 while ((str = streamer_read_string_cst (data_in, &ib)))
kono
parents: 67
diff changeset
1554 {
kono
parents: 67
diff changeset
1555 asm_node *node = symtab->finalize_toplevel_asm (str);
kono
parents: 67
diff changeset
1556 node->order = streamer_read_hwi (&ib) + order_base;
kono
parents: 67
diff changeset
1557 if (node->order >= symtab->order)
kono
parents: 67
diff changeset
1558 symtab->order = node->order + 1;
kono
parents: 67
diff changeset
1559 }
kono
parents: 67
diff changeset
1560
kono
parents: 67
diff changeset
1561 lto_data_in_delete (data_in);
kono
parents: 67
diff changeset
1562
kono
parents: 67
diff changeset
1563 lto_free_section_data (file_data, LTO_section_asm, NULL, data, len);
kono
parents: 67
diff changeset
1564 }
kono
parents: 67
diff changeset
1565
kono
parents: 67
diff changeset
1566
kono
parents: 67
diff changeset
1567 /* Input mode table. */
kono
parents: 67
diff changeset
1568
kono
parents: 67
diff changeset
1569 void
kono
parents: 67
diff changeset
1570 lto_input_mode_table (struct lto_file_decl_data *file_data)
kono
parents: 67
diff changeset
1571 {
kono
parents: 67
diff changeset
1572 size_t len;
kono
parents: 67
diff changeset
1573 const char *data = lto_get_section_data (file_data, LTO_section_mode_table,
kono
parents: 67
diff changeset
1574 NULL, &len);
kono
parents: 67
diff changeset
1575 if (! data)
kono
parents: 67
diff changeset
1576 {
kono
parents: 67