annotate gcc/lto-streamer-in.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
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
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
3 Copyright (C) 2009-2018 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);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
828 loop->unroll = streamer_read_hwi (ib);
111
kono
parents: 67
diff changeset
829 loop->dont_vectorize = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
830 loop->force_vectorize = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
831 loop->simduid = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
832
kono
parents: 67
diff changeset
833 place_new_loop (fn, loop);
kono
parents: 67
diff changeset
834
kono
parents: 67
diff changeset
835 /* flow_loops_find doesn't like loops not in the tree, hook them
kono
parents: 67
diff changeset
836 all as siblings of the tree root temporarily. */
kono
parents: 67
diff changeset
837 flow_loop_tree_node_add (loops->tree_root, loop);
kono
parents: 67
diff changeset
838 }
kono
parents: 67
diff changeset
839
kono
parents: 67
diff changeset
840 /* Rebuild the loop tree. */
kono
parents: 67
diff changeset
841 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
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
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
845 /* 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
846 block IB. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
847
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
848 static void
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
849 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
850 struct function *fn)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
851 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
852 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
853
111
kono
parents: 67
diff changeset
854 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
855 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
856
111
kono
parents: 67
diff changeset
857 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
858 while (i)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
859 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
860 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
861 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
862
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
863 /* Skip over the elements that had been freed. */
111
kono
parents: 67
diff changeset
864 while (SSANAMES (fn)->length () < i)
kono
parents: 67
diff changeset
865 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
866
111
kono
parents: 67
diff changeset
867 is_default_def = (streamer_read_uchar (ib) != 0);
kono
parents: 67
diff changeset
868 name = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
869 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
870
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
871 if (is_default_def)
111
kono
parents: 67
diff changeset
872 {
kono
parents: 67
diff changeset
873 set_ssa_default_def (cfun, SSA_NAME_VAR (ssa_name), ssa_name);
kono
parents: 67
diff changeset
874 SSA_NAME_DEF_STMT (ssa_name) = gimple_build_nop ();
kono
parents: 67
diff changeset
875 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
876
111
kono
parents: 67
diff changeset
877 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
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
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
882 /* 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
883 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
884
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
885 static void
111
kono
parents: 67
diff changeset
886 fixup_call_stmt_edges_1 (struct cgraph_node *node, gimple **stmts,
kono
parents: 67
diff changeset
887 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
888 {
111
kono
parents: 67
diff changeset
889 #define STMT_UID_NOT_IN_RANGE(uid) \
kono
parents: 67
diff changeset
890 (gimple_stmt_max_uid (fn) < uid || uid == 0)
kono
parents: 67
diff changeset
891
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
892 struct cgraph_edge *cedge;
111
kono
parents: 67
diff changeset
893 struct ipa_ref *ref = NULL;
kono
parents: 67
diff changeset
894 unsigned int i;
kono
parents: 67
diff changeset
895
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
896 for (cedge = node->callees; cedge; cedge = cedge->next_callee)
111
kono
parents: 67
diff changeset
897 {
kono
parents: 67
diff changeset
898 if (STMT_UID_NOT_IN_RANGE (cedge->lto_stmt_uid))
kono
parents: 67
diff changeset
899 fatal_error (input_location,
kono
parents: 67
diff changeset
900 "Cgraph edge statement index out of range");
kono
parents: 67
diff changeset
901 cedge->call_stmt = as_a <gcall *> (stmts[cedge->lto_stmt_uid - 1]);
kono
parents: 67
diff changeset
902 if (!cedge->call_stmt)
kono
parents: 67
diff changeset
903 fatal_error (input_location,
kono
parents: 67
diff changeset
904 "Cgraph edge statement index not found");
kono
parents: 67
diff changeset
905 }
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
906 for (cedge = node->indirect_calls; cedge; cedge = cedge->next_callee)
111
kono
parents: 67
diff changeset
907 {
kono
parents: 67
diff changeset
908 if (STMT_UID_NOT_IN_RANGE (cedge->lto_stmt_uid))
kono
parents: 67
diff changeset
909 fatal_error (input_location,
kono
parents: 67
diff changeset
910 "Cgraph edge statement index out of range");
kono
parents: 67
diff changeset
911 cedge->call_stmt = as_a <gcall *> (stmts[cedge->lto_stmt_uid - 1]);
kono
parents: 67
diff changeset
912 if (!cedge->call_stmt)
kono
parents: 67
diff changeset
913 fatal_error (input_location, "Cgraph edge statement index not found");
kono
parents: 67
diff changeset
914 }
kono
parents: 67
diff changeset
915 for (i = 0; node->iterate_reference (i, ref); i++)
kono
parents: 67
diff changeset
916 if (ref->lto_stmt_uid)
kono
parents: 67
diff changeset
917 {
kono
parents: 67
diff changeset
918 if (STMT_UID_NOT_IN_RANGE (ref->lto_stmt_uid))
kono
parents: 67
diff changeset
919 fatal_error (input_location,
kono
parents: 67
diff changeset
920 "Reference statement index out of range");
kono
parents: 67
diff changeset
921 ref->stmt = stmts[ref->lto_stmt_uid - 1];
kono
parents: 67
diff changeset
922 if (!ref->stmt)
kono
parents: 67
diff changeset
923 fatal_error (input_location, "Reference statement index not found");
kono
parents: 67
diff changeset
924 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
925 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
926
111
kono
parents: 67
diff changeset
927
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
928 /* 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
929
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
930 static void
111
kono
parents: 67
diff changeset
931 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
932 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
933 struct cgraph_node *node;
111
kono
parents: 67
diff changeset
934 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
935
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
936 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
937 orig = orig->clone_of;
111
kono
parents: 67
diff changeset
938 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
939
111
kono
parents: 67
diff changeset
940 if (!orig->thunk.thunk_p)
kono
parents: 67
diff changeset
941 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
942 if (orig->clones)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
943 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
944 {
111
kono
parents: 67
diff changeset
945 if (!node->thunk.thunk_p)
kono
parents: 67
diff changeset
946 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
947 if (node->clones)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
948 node = node->clones;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
949 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
950 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
951 else
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
952 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
953 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
954 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
955 if (node != orig)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
956 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
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 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
960
111
kono
parents: 67
diff changeset
961
kono
parents: 67
diff changeset
962 /* Input the base body of struct function FN from DATA_IN
kono
parents: 67
diff changeset
963 using input block IB. */
kono
parents: 67
diff changeset
964
kono
parents: 67
diff changeset
965 static void
kono
parents: 67
diff changeset
966 input_struct_function_base (struct function *fn, struct data_in *data_in,
kono
parents: 67
diff changeset
967 struct lto_input_block *ib)
kono
parents: 67
diff changeset
968 {
kono
parents: 67
diff changeset
969 struct bitpack_d bp;
kono
parents: 67
diff changeset
970 int len;
kono
parents: 67
diff changeset
971
kono
parents: 67
diff changeset
972 /* Read the static chain and non-local goto save area. */
kono
parents: 67
diff changeset
973 fn->static_chain_decl = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
974 fn->nonlocal_goto_save_area = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
975
kono
parents: 67
diff changeset
976 /* Read all the local symbols. */
kono
parents: 67
diff changeset
977 len = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
978 if (len > 0)
kono
parents: 67
diff changeset
979 {
kono
parents: 67
diff changeset
980 int i;
kono
parents: 67
diff changeset
981 vec_safe_grow_cleared (fn->local_decls, len);
kono
parents: 67
diff changeset
982 for (i = 0; i < len; i++)
kono
parents: 67
diff changeset
983 {
kono
parents: 67
diff changeset
984 tree t = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
985 (*fn->local_decls)[i] = t;
kono
parents: 67
diff changeset
986 }
kono
parents: 67
diff changeset
987 }
kono
parents: 67
diff changeset
988
kono
parents: 67
diff changeset
989 /* Input the current IL state of the function. */
kono
parents: 67
diff changeset
990 fn->curr_properties = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
991
kono
parents: 67
diff changeset
992 /* Read all the attributes for FN. */
kono
parents: 67
diff changeset
993 bp = streamer_read_bitpack (ib);
kono
parents: 67
diff changeset
994 fn->is_thunk = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
995 fn->has_local_explicit_reg_vars = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
996 fn->returns_pcc_struct = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
997 fn->returns_struct = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
998 fn->can_throw_non_call_exceptions = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
999 fn->can_delete_dead_exceptions = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1000 fn->always_inline_functions_inlined = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1001 fn->after_inlining = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1002 fn->stdarg = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1003 fn->has_nonlocal_label = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1004 fn->has_forced_label_in_static = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1005 fn->calls_alloca = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1006 fn->calls_setjmp = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1007 fn->has_force_vectorize_loops = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1008 fn->has_simduid_loops = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1009 fn->va_list_fpr_size = bp_unpack_value (&bp, 8);
kono
parents: 67
diff changeset
1010 fn->va_list_gpr_size = bp_unpack_value (&bp, 8);
kono
parents: 67
diff changeset
1011 fn->last_clique = bp_unpack_value (&bp, sizeof (short) * 8);
kono
parents: 67
diff changeset
1012
kono
parents: 67
diff changeset
1013 /* Input the function start and end loci. */
kono
parents: 67
diff changeset
1014 fn->function_start_locus = stream_input_location_now (&bp, data_in);
kono
parents: 67
diff changeset
1015 fn->function_end_locus = stream_input_location_now (&bp, data_in);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1016
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1017 /* Restore the instance discriminators if present. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1018 int instance_number = bp_unpack_value (&bp, 1);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1019 if (instance_number)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1020 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1021 instance_number = bp_unpack_value (&bp, sizeof (int) * CHAR_BIT);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1022 maybe_create_decl_to_instance_map ()->put (fn->decl, instance_number);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1023 }
111
kono
parents: 67
diff changeset
1024 }
kono
parents: 67
diff changeset
1025
kono
parents: 67
diff changeset
1026
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1027 /* 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
1028
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1029 static void
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1030 input_function (tree fn_decl, struct data_in *data_in,
111
kono
parents: 67
diff changeset
1031 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
1032 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1033 struct function *fn;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1034 enum LTO_tags tag;
111
kono
parents: 67
diff changeset
1035 gimple **stmts;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1036 basic_block bb;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1037 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
1038
111
kono
parents: 67
diff changeset
1039 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
1040 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
1041
111
kono
parents: 67
diff changeset
1042 /* Read decls for parameters and args. */
kono
parents: 67
diff changeset
1043 DECL_RESULT (fn_decl) = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
1044 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
1045
111
kono
parents: 67
diff changeset
1046 /* Read debug args if available. */
kono
parents: 67
diff changeset
1047 unsigned n_debugargs = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1048 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
1049 {
111
kono
parents: 67
diff changeset
1050 vec<tree, va_gc> **debugargs = decl_debug_args_insert (fn_decl);
kono
parents: 67
diff changeset
1051 vec_safe_grow (*debugargs, n_debugargs);
kono
parents: 67
diff changeset
1052 for (unsigned i = 0; i < n_debugargs; ++i)
kono
parents: 67
diff changeset
1053 (**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
1054 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1055
111
kono
parents: 67
diff changeset
1056 /* Read the tree of lexical scopes for the function. */
kono
parents: 67
diff changeset
1057 DECL_INITIAL (fn_decl) = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
1058 unsigned block_leaf_count = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1059 while (block_leaf_count--)
kono
parents: 67
diff changeset
1060 stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
1061
kono
parents: 67
diff changeset
1062 if (!streamer_read_uhwi (ib))
kono
parents: 67
diff changeset
1063 return;
kono
parents: 67
diff changeset
1064
kono
parents: 67
diff changeset
1065 push_struct_function (fn_decl);
kono
parents: 67
diff changeset
1066 fn = DECL_STRUCT_FUNCTION (fn_decl);
kono
parents: 67
diff changeset
1067 init_tree_ssa (fn);
kono
parents: 67
diff changeset
1068 /* We input IL in SSA form. */
kono
parents: 67
diff changeset
1069 cfun->gimple_df->in_ssa_p = true;
kono
parents: 67
diff changeset
1070
kono
parents: 67
diff changeset
1071 gimple_register_cfg_hooks ();
kono
parents: 67
diff changeset
1072
kono
parents: 67
diff changeset
1073 node = cgraph_node::get (fn_decl);
kono
parents: 67
diff changeset
1074 if (!node)
kono
parents: 67
diff changeset
1075 node = cgraph_node::create (fn_decl);
kono
parents: 67
diff changeset
1076 input_struct_function_base (fn, data_in, ib);
kono
parents: 67
diff changeset
1077 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
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 SSA names. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1080 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
1081
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1082 /* 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
1083 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
1084
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1085 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
1086 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
1087
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1088 /* Read all the basic blocks. */
111
kono
parents: 67
diff changeset
1089 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
1090 while (tag)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1091 {
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
1092 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
1093 node->count_materialization_scale);
111
kono
parents: 67
diff changeset
1094 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
1095 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1096
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1097 /* 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
1098 edges. */
111
kono
parents: 67
diff changeset
1099 set_gimple_stmt_max_uid (cfun, 0);
kono
parents: 67
diff changeset
1100 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
1101 {
111
kono
parents: 67
diff changeset
1102 gimple_stmt_iterator gsi;
kono
parents: 67
diff changeset
1103 for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
kono
parents: 67
diff changeset
1104 {
kono
parents: 67
diff changeset
1105 gimple *stmt = gsi_stmt (gsi);
kono
parents: 67
diff changeset
1106 gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
kono
parents: 67
diff changeset
1107 }
kono
parents: 67
diff changeset
1108 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
kono
parents: 67
diff changeset
1109 {
kono
parents: 67
diff changeset
1110 gimple *stmt = gsi_stmt (gsi);
kono
parents: 67
diff changeset
1111 gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
kono
parents: 67
diff changeset
1112 }
kono
parents: 67
diff changeset
1113 }
kono
parents: 67
diff changeset
1114 stmts = (gimple **) xcalloc (gimple_stmt_max_uid (fn), sizeof (gimple *));
kono
parents: 67
diff changeset
1115 FOR_ALL_BB_FN (bb, cfun)
kono
parents: 67
diff changeset
1116 {
kono
parents: 67
diff changeset
1117 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
1118 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
1119 {
111
kono
parents: 67
diff changeset
1120 gimple *stmt = gsi_stmt (bsi);
kono
parents: 67
diff changeset
1121 gsi_next (&bsi);
kono
parents: 67
diff changeset
1122 stmts[gimple_uid (stmt)] = stmt;
kono
parents: 67
diff changeset
1123 }
kono
parents: 67
diff changeset
1124 bsi = gsi_start_bb (bb);
kono
parents: 67
diff changeset
1125 while (!gsi_end_p (bsi))
kono
parents: 67
diff changeset
1126 {
kono
parents: 67
diff changeset
1127 gimple *stmt = gsi_stmt (bsi);
kono
parents: 67
diff changeset
1128 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
1129 /* 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
1130 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
1131 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
1132 mismatches in fixups, but we can do it at this point, as
111
kono
parents: 67
diff changeset
1133 long as debug stmts don't require fixups.
kono
parents: 67
diff changeset
1134 Similarly remove all IFN_*SAN_* internal calls */
kono
parents: 67
diff changeset
1135 if (!flag_wpa)
kono
parents: 67
diff changeset
1136 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1137 if (is_gimple_debug (stmt)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1138 && (gimple_debug_nonbind_marker_p (stmt)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1139 ? !MAY_HAVE_DEBUG_MARKER_STMTS
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1140 : !MAY_HAVE_DEBUG_BIND_STMTS))
111
kono
parents: 67
diff changeset
1141 remove = true;
kono
parents: 67
diff changeset
1142 if (is_gimple_call (stmt)
kono
parents: 67
diff changeset
1143 && gimple_call_internal_p (stmt))
kono
parents: 67
diff changeset
1144 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1145 bool replace = false;
111
kono
parents: 67
diff changeset
1146 switch (gimple_call_internal_fn (stmt))
kono
parents: 67
diff changeset
1147 {
kono
parents: 67
diff changeset
1148 case IFN_UBSAN_NULL:
kono
parents: 67
diff changeset
1149 if ((flag_sanitize
kono
parents: 67
diff changeset
1150 & (SANITIZE_NULL | SANITIZE_ALIGNMENT)) == 0)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1151 replace = true;
111
kono
parents: 67
diff changeset
1152 break;
kono
parents: 67
diff changeset
1153 case IFN_UBSAN_BOUNDS:
kono
parents: 67
diff changeset
1154 if ((flag_sanitize & SANITIZE_BOUNDS) == 0)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1155 replace = true;
111
kono
parents: 67
diff changeset
1156 break;
kono
parents: 67
diff changeset
1157 case IFN_UBSAN_VPTR:
kono
parents: 67
diff changeset
1158 if ((flag_sanitize & SANITIZE_VPTR) == 0)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1159 replace = true;
111
kono
parents: 67
diff changeset
1160 break;
kono
parents: 67
diff changeset
1161 case IFN_UBSAN_OBJECT_SIZE:
kono
parents: 67
diff changeset
1162 if ((flag_sanitize & SANITIZE_OBJECT_SIZE) == 0)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1163 replace = true;
111
kono
parents: 67
diff changeset
1164 break;
kono
parents: 67
diff changeset
1165 case IFN_UBSAN_PTR:
kono
parents: 67
diff changeset
1166 if ((flag_sanitize & SANITIZE_POINTER_OVERFLOW) == 0)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1167 replace = true;
111
kono
parents: 67
diff changeset
1168 break;
kono
parents: 67
diff changeset
1169 case IFN_ASAN_MARK:
kono
parents: 67
diff changeset
1170 if ((flag_sanitize & SANITIZE_ADDRESS) == 0)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1171 replace = true;
111
kono
parents: 67
diff changeset
1172 break;
kono
parents: 67
diff changeset
1173 case IFN_TSAN_FUNC_EXIT:
kono
parents: 67
diff changeset
1174 if ((flag_sanitize & SANITIZE_THREAD) == 0)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1175 replace = true;
111
kono
parents: 67
diff changeset
1176 break;
kono
parents: 67
diff changeset
1177 default:
kono
parents: 67
diff changeset
1178 break;
kono
parents: 67
diff changeset
1179 }
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1180 if (replace)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1181 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1182 gimple_call_set_internal_fn (as_a <gcall *> (stmt),
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1183 IFN_NOP);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1184 update_stmt (stmt);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1185 }
111
kono
parents: 67
diff changeset
1186 }
kono
parents: 67
diff changeset
1187 }
kono
parents: 67
diff changeset
1188 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
1189 {
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
1190 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
1191 gsi_next (&bsi);
111
kono
parents: 67
diff changeset
1192 unlink_stmt_vdef (stmt);
kono
parents: 67
diff changeset
1193 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
1194 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
1195 }
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
1196 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
1197 {
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
1198 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
1199 stmts[gimple_uid (stmt)] = stmt;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1200
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1201 /* Remember that the input function has begin stmt
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1202 markers, so that we know to expect them when emitting
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1203 debug info. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1204 if (!cfun->debug_nonbind_markers
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1205 && gimple_debug_nonbind_marker_p (stmt))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1206 cfun->debug_nonbind_markers = true;
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
1207 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1208 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1209 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1210
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1211 /* 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
1212 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
1213 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
1214 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
1215 {
111
kono
parents: 67
diff changeset
1216 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
1217 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
1218 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1219
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1220 update_max_bb_count ();
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1221 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
1222 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
1223
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1224 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
1225 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
1226 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
1227 free (stmts);
111
kono
parents: 67
diff changeset
1228 pop_cfun ();
kono
parents: 67
diff changeset
1229 }
kono
parents: 67
diff changeset
1230
kono
parents: 67
diff changeset
1231 /* Read the body of function FN_DECL from DATA_IN using input block IB. */
kono
parents: 67
diff changeset
1232
kono
parents: 67
diff changeset
1233 static void
kono
parents: 67
diff changeset
1234 input_constructor (tree var, struct data_in *data_in,
kono
parents: 67
diff changeset
1235 struct lto_input_block *ib)
kono
parents: 67
diff changeset
1236 {
kono
parents: 67
diff changeset
1237 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
1238 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1239
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1240
111
kono
parents: 67
diff changeset
1241 /* 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
1242 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
1243 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
1244 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
1245 that function. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1246
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1247 static void
111
kono
parents: 67
diff changeset
1248 lto_read_body_or_constructor (struct lto_file_decl_data *file_data, struct symtab_node *node,
kono
parents: 67
diff changeset
1249 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
1250 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1251 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
1252 struct data_in *data_in;
111
kono
parents: 67
diff changeset
1253 int cfg_offset;
kono
parents: 67
diff changeset
1254 int main_offset;
kono
parents: 67
diff changeset
1255 int string_offset;
kono
parents: 67
diff changeset
1256 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
1257
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1258 header = (const struct lto_function_header *) data;
111
kono
parents: 67
diff changeset
1259 if (TREE_CODE (node->decl) == FUNCTION_DECL)
kono
parents: 67
diff changeset
1260 {
kono
parents: 67
diff changeset
1261 cfg_offset = sizeof (struct lto_function_header);
kono
parents: 67
diff changeset
1262 main_offset = cfg_offset + header->cfg_size;
kono
parents: 67
diff changeset
1263 string_offset = main_offset + header->main_size;
kono
parents: 67
diff changeset
1264 }
kono
parents: 67
diff changeset
1265 else
kono
parents: 67
diff changeset
1266 {
kono
parents: 67
diff changeset
1267 main_offset = sizeof (struct lto_function_header);
kono
parents: 67
diff changeset
1268 string_offset = main_offset + header->main_size;
kono
parents: 67
diff changeset
1269 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1270
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1271 data_in = lto_data_in_create (file_data, data + string_offset,
111
kono
parents: 67
diff changeset
1272 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
1273
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1274 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
1275 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1276 struct lto_in_decl_state *decl_state;
111
kono
parents: 67
diff changeset
1277 unsigned from;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1278
111
kono
parents: 67
diff changeset
1279 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
1280
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1281 /* 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
1282 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
1283 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
1284 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
1285
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1286
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1287 /* Set up the struct function. */
111
kono
parents: 67
diff changeset
1288 from = data_in->reader_cache->nodes.length ();
kono
parents: 67
diff changeset
1289 lto_input_block ib_main (data + main_offset, header->main_size,
kono
parents: 67
diff changeset
1290 file_data->mode_table);
kono
parents: 67
diff changeset
1291 if (TREE_CODE (node->decl) == FUNCTION_DECL)
kono
parents: 67
diff changeset
1292 {
kono
parents: 67
diff changeset
1293 lto_input_block ib_cfg (data + cfg_offset, header->cfg_size,
kono
parents: 67
diff changeset
1294 file_data->mode_table);
kono
parents: 67
diff changeset
1295 input_function (fn_decl, data_in, &ib_main, &ib_cfg);
kono
parents: 67
diff changeset
1296 }
kono
parents: 67
diff changeset
1297 else
kono
parents: 67
diff changeset
1298 input_constructor (fn_decl, data_in, &ib_main);
kono
parents: 67
diff changeset
1299 data_in->location_cache.apply_location_cache ();
kono
parents: 67
diff changeset
1300 /* And fixup types we streamed locally. */
kono
parents: 67
diff changeset
1301 {
kono
parents: 67
diff changeset
1302 struct streamer_tree_cache_d *cache = data_in->reader_cache;
kono
parents: 67
diff changeset
1303 unsigned len = cache->nodes.length ();
kono
parents: 67
diff changeset
1304 unsigned i;
kono
parents: 67
diff changeset
1305 for (i = len; i-- > from;)
kono
parents: 67
diff changeset
1306 {
kono
parents: 67
diff changeset
1307 tree t = streamer_tree_cache_get_tree (cache, i);
kono
parents: 67
diff changeset
1308 if (t == NULL_TREE)
kono
parents: 67
diff changeset
1309 continue;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1310
111
kono
parents: 67
diff changeset
1311 if (TYPE_P (t))
kono
parents: 67
diff changeset
1312 {
kono
parents: 67
diff changeset
1313 gcc_assert (TYPE_CANONICAL (t) == NULL_TREE);
kono
parents: 67
diff changeset
1314 if (type_with_alias_set_p (t)
kono
parents: 67
diff changeset
1315 && canonical_type_used_p (t))
kono
parents: 67
diff changeset
1316 TYPE_CANONICAL (t) = TYPE_MAIN_VARIANT (t);
kono
parents: 67
diff changeset
1317 if (TYPE_MAIN_VARIANT (t) != t)
kono
parents: 67
diff changeset
1318 {
kono
parents: 67
diff changeset
1319 gcc_assert (TYPE_NEXT_VARIANT (t) == NULL_TREE);
kono
parents: 67
diff changeset
1320 TYPE_NEXT_VARIANT (t)
kono
parents: 67
diff changeset
1321 = TYPE_NEXT_VARIANT (TYPE_MAIN_VARIANT (t));
kono
parents: 67
diff changeset
1322 TYPE_NEXT_VARIANT (TYPE_MAIN_VARIANT (t)) = t;
kono
parents: 67
diff changeset
1323 }
kono
parents: 67
diff changeset
1324 }
kono
parents: 67
diff changeset
1325 }
kono
parents: 67
diff changeset
1326 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1327
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1328 /* Restore decl state */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1329 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
1330 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1331
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1332 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
1333 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1334
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1335
111
kono
parents: 67
diff changeset
1336 /* 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
1337 decls and types. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1338
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1339 void
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1340 lto_input_function_body (struct lto_file_decl_data *file_data,
111
kono
parents: 67
diff changeset
1341 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
1342 {
111
kono
parents: 67
diff changeset
1343 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
1344 }
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 the body of NODE using DATA. FILE_DATA holds the global
kono
parents: 67
diff changeset
1347 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
1348
111
kono
parents: 67
diff changeset
1349 void
kono
parents: 67
diff changeset
1350 lto_input_variable_constructor (struct lto_file_decl_data *file_data,
kono
parents: 67
diff changeset
1351 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
1352 {
111
kono
parents: 67
diff changeset
1353 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
1354 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1355
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1356
111
kono
parents: 67
diff changeset
1357 /* Queue of acummulated decl -> DIE mappings. Similar to locations those
kono
parents: 67
diff changeset
1358 are only applied to prevailing tree nodes during tree merging. */
kono
parents: 67
diff changeset
1359 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
1360
111
kono
parents: 67
diff changeset
1361 /* Read the physical representation of a tree node EXPR from
kono
parents: 67
diff changeset
1362 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
1363
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
1364 static void
111
kono
parents: 67
diff changeset
1365 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
1366 {
111
kono
parents: 67
diff changeset
1367 /* Read all the bitfield values in EXPR. Note that for LTO, we
kono
parents: 67
diff changeset
1368 only write language-independent bitfields, so no more unpacking is
kono
parents: 67
diff changeset
1369 needed. */
kono
parents: 67
diff changeset
1370 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
1371
111
kono
parents: 67
diff changeset
1372 /* Read all the pointer fields in EXPR. */
kono
parents: 67
diff changeset
1373 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
1374
111
kono
parents: 67
diff changeset
1375 /* Read any LTO-specific data not read by the tree streamer. */
kono
parents: 67
diff changeset
1376 if (DECL_P (expr)
kono
parents: 67
diff changeset
1377 && TREE_CODE (expr) != FUNCTION_DECL
kono
parents: 67
diff changeset
1378 && TREE_CODE (expr) != TRANSLATION_UNIT_DECL)
kono
parents: 67
diff changeset
1379 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
1380
111
kono
parents: 67
diff changeset
1381 /* Stream references to early generated DIEs. Keep in sync with the
kono
parents: 67
diff changeset
1382 trees handled in dwarf2out_register_external_die. */
kono
parents: 67
diff changeset
1383 if ((DECL_P (expr)
kono
parents: 67
diff changeset
1384 && TREE_CODE (expr) != FIELD_DECL
kono
parents: 67
diff changeset
1385 && TREE_CODE (expr) != DEBUG_EXPR_DECL
kono
parents: 67
diff changeset
1386 && TREE_CODE (expr) != TYPE_DECL)
kono
parents: 67
diff changeset
1387 || 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
1388 {
111
kono
parents: 67
diff changeset
1389 const char *str = streamer_read_string (data_in, ib);
kono
parents: 67
diff changeset
1390 if (str)
kono
parents: 67
diff changeset
1391 {
kono
parents: 67
diff changeset
1392 unsigned HOST_WIDE_INT off = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1393 dref_entry e = { expr, str, off };
kono
parents: 67
diff changeset
1394 dref_queue.safe_push (e);
kono
parents: 67
diff changeset
1395 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1396 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1397 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1398
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1399 /* 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
1400 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
1401
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1402 static tree
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1403 lto_read_tree (struct lto_input_block *ib, struct data_in *data_in,
111
kono
parents: 67
diff changeset
1404 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
1405 {
111
kono
parents: 67
diff changeset
1406 /* Instantiate a new tree node. */
kono
parents: 67
diff changeset
1407 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
1408
111
kono
parents: 67
diff changeset
1409 /* Enter RESULT in the reader cache. This will make RESULT
kono
parents: 67
diff changeset
1410 available so that circular references in the rest of the tree
kono
parents: 67
diff changeset
1411 structure can be resolved in subsequent calls to stream_read_tree. */
kono
parents: 67
diff changeset
1412 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
1413
111
kono
parents: 67
diff changeset
1414 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
1415
111
kono
parents: 67
diff changeset
1416 /* 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
1417
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1418 return result;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1419 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1420
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1421
111
kono
parents: 67
diff changeset
1422 /* Populate the reader cache with trees materialized from the SCC
kono
parents: 67
diff changeset
1423 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
1424
111
kono
parents: 67
diff changeset
1425 hashval_t
kono
parents: 67
diff changeset
1426 lto_input_scc (struct lto_input_block *ib, struct data_in *data_in,
kono
parents: 67
diff changeset
1427 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
1428 {
111
kono
parents: 67
diff changeset
1429 /* A blob of unnamed tree nodes, fill the cache from it and
kono
parents: 67
diff changeset
1430 recurse. */
kono
parents: 67
diff changeset
1431 unsigned size = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1432 hashval_t scc_hash = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1433 unsigned scc_entry_len = 1;
kono
parents: 67
diff changeset
1434
kono
parents: 67
diff changeset
1435 if (size == 1)
kono
parents: 67
diff changeset
1436 {
kono
parents: 67
diff changeset
1437 enum LTO_tags tag = streamer_read_record_start (ib);
kono
parents: 67
diff changeset
1438 lto_input_tree_1 (ib, data_in, tag, scc_hash);
kono
parents: 67
diff changeset
1439 }
kono
parents: 67
diff changeset
1440 else
kono
parents: 67
diff changeset
1441 {
kono
parents: 67
diff changeset
1442 unsigned int first = data_in->reader_cache->nodes.length ();
kono
parents: 67
diff changeset
1443 tree result;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1444
111
kono
parents: 67
diff changeset
1445 scc_entry_len = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1446
kono
parents: 67
diff changeset
1447 /* Materialize size trees by reading their headers. */
kono
parents: 67
diff changeset
1448 for (unsigned i = 0; i < size; ++i)
kono
parents: 67
diff changeset
1449 {
kono
parents: 67
diff changeset
1450 enum LTO_tags tag = streamer_read_record_start (ib);
kono
parents: 67
diff changeset
1451 if (tag == LTO_null
kono
parents: 67
diff changeset
1452 || (tag >= LTO_field_decl_ref && tag <= LTO_global_decl_ref)
kono
parents: 67
diff changeset
1453 || tag == LTO_tree_pickle_reference
kono
parents: 67
diff changeset
1454 || tag == LTO_integer_cst
kono
parents: 67
diff changeset
1455 || tag == LTO_tree_scc)
kono
parents: 67
diff changeset
1456 gcc_unreachable ();
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1457
111
kono
parents: 67
diff changeset
1458 result = streamer_alloc_tree (ib, data_in, tag);
kono
parents: 67
diff changeset
1459 streamer_tree_cache_append (data_in->reader_cache, result, 0);
kono
parents: 67
diff changeset
1460 }
kono
parents: 67
diff changeset
1461
kono
parents: 67
diff changeset
1462 /* Read the tree bitpacks and references. */
kono
parents: 67
diff changeset
1463 for (unsigned i = 0; i < size; ++i)
kono
parents: 67
diff changeset
1464 {
kono
parents: 67
diff changeset
1465 result = streamer_tree_cache_get_tree (data_in->reader_cache,
kono
parents: 67
diff changeset
1466 first + i);
kono
parents: 67
diff changeset
1467 lto_read_tree_1 (ib, data_in, result);
kono
parents: 67
diff changeset
1468 /* end_marker = */ streamer_read_uchar (ib);
kono
parents: 67
diff changeset
1469 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1470 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1471
111
kono
parents: 67
diff changeset
1472 *len = size;
kono
parents: 67
diff changeset
1473 *entry_len = scc_entry_len;
kono
parents: 67
diff changeset
1474 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
1475 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1476
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1477
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1478 /* 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
1479 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
1480 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
1481
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1482 tree
111
kono
parents: 67
diff changeset
1483 lto_input_tree_1 (struct lto_input_block *ib, struct data_in *data_in,
kono
parents: 67
diff changeset
1484 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
1485 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1486 tree result;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1487
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1488 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
1489
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1490 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
1491 result = NULL_TREE;
111
kono
parents: 67
diff changeset
1492 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
1493 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1494 /* 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
1495 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
1496 that tree. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1497 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
1498 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1499 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
1500 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1501 /* 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
1502 the reader cache. */
111
kono
parents: 67
diff changeset
1503 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
1504 }
111
kono
parents: 67
diff changeset
1505 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
1506 {
111
kono
parents: 67
diff changeset
1507 /* For shared integer constants in singletons we can use the
kono
parents: 67
diff changeset
1508 existing tree integer constant merging code. */
kono
parents: 67
diff changeset
1509 tree type = stream_read_tree (ib, data_in);
kono
parents: 67
diff changeset
1510 unsigned HOST_WIDE_INT len = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1511 unsigned HOST_WIDE_INT i;
kono
parents: 67
diff changeset
1512 HOST_WIDE_INT a[WIDE_INT_MAX_ELTS];
kono
parents: 67
diff changeset
1513
kono
parents: 67
diff changeset
1514 for (i = 0; i < len; i++)
kono
parents: 67
diff changeset
1515 a[i] = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
1516 gcc_assert (TYPE_PRECISION (type) <= MAX_BITSIZE_MODE_ANY_INT);
kono
parents: 67
diff changeset
1517 result = wide_int_to_tree (type, wide_int::from_array
kono
parents: 67
diff changeset
1518 (a, len, TYPE_PRECISION (type)));
kono
parents: 67
diff changeset
1519 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
1520 }
111
kono
parents: 67
diff changeset
1521 else if (tag == LTO_tree_scc)
kono
parents: 67
diff changeset
1522 gcc_unreachable ();
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1523 else
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1524 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1525 /* Otherwise, materialize a new node from IB. */
111
kono
parents: 67
diff changeset
1526 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
1527 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1528
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1529 return result;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1530 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1531
111
kono
parents: 67
diff changeset
1532 tree
kono
parents: 67
diff changeset
1533 lto_input_tree (struct lto_input_block *ib, struct data_in *data_in)
kono
parents: 67
diff changeset
1534 {
kono
parents: 67
diff changeset
1535 enum LTO_tags tag;
kono
parents: 67
diff changeset
1536
kono
parents: 67
diff changeset
1537 /* Input and skip SCCs. */
kono
parents: 67
diff changeset
1538 while ((tag = streamer_read_record_start (ib)) == LTO_tree_scc)
kono
parents: 67
diff changeset
1539 {
kono
parents: 67
diff changeset
1540 unsigned len, entry_len;
kono
parents: 67
diff changeset
1541 lto_input_scc (ib, data_in, &len, &entry_len);
kono
parents: 67
diff changeset
1542
kono
parents: 67
diff changeset
1543 /* Register DECLs with the debuginfo machinery. */
kono
parents: 67
diff changeset
1544 while (!dref_queue.is_empty ())
kono
parents: 67
diff changeset
1545 {
kono
parents: 67
diff changeset
1546 dref_entry e = dref_queue.pop ();
kono
parents: 67
diff changeset
1547 debug_hooks->register_external_die (e.decl, e.sym, e.off);
kono
parents: 67
diff changeset
1548 }
kono
parents: 67
diff changeset
1549 }
kono
parents: 67
diff changeset
1550 return lto_input_tree_1 (ib, data_in, tag, 0);
kono
parents: 67
diff changeset
1551 }
kono
parents: 67
diff changeset
1552
kono
parents: 67
diff changeset
1553
kono
parents: 67
diff changeset
1554 /* Input toplevel asms. */
kono
parents: 67
diff changeset
1555
kono
parents: 67
diff changeset
1556 void
kono
parents: 67
diff changeset
1557 lto_input_toplevel_asms (struct lto_file_decl_data *file_data, int order_base)
kono
parents: 67
diff changeset
1558 {
kono
parents: 67
diff changeset
1559 size_t len;
kono
parents: 67
diff changeset
1560 const char *data = lto_get_section_data (file_data, LTO_section_asm,
kono
parents: 67
diff changeset
1561 NULL, &len);
kono
parents: 67
diff changeset
1562 const struct lto_simple_header_with_strings *header
kono
parents: 67
diff changeset
1563 = (const struct lto_simple_header_with_strings *) data;
kono
parents: 67
diff changeset
1564 int string_offset;
kono
parents: 67
diff changeset
1565 struct data_in *data_in;
kono
parents: 67
diff changeset
1566 tree str;
kono
parents: 67
diff changeset
1567
kono
parents: 67
diff changeset
1568 if (! data)
kono
parents: 67
diff changeset
1569 return;
kono
parents: 67
diff changeset
1570
kono
parents: 67
diff changeset
1571 string_offset = sizeof (*header) + header->main_size;
kono
parents: 67
diff changeset
1572
kono
parents: 67
diff changeset
1573 lto_input_block ib (data + sizeof (*header), header->main_size,
kono
parents: 67
diff changeset
1574 file_data->mode_table);
kono
parents: 67
diff changeset
1575
kono
parents: 67
diff changeset
1576 data_in = lto_data_in_create (file_data, data + string_offset,
kono
parents: 67
diff changeset
1577 header->string_size, vNULL);
kono
parents: 67
diff changeset
1578
kono
parents: 67
diff changeset
1579 while ((str = streamer_read_string_cst (data_in, &ib)))
kono
parents: 67
diff changeset
1580 {
kono
parents: 67
diff changeset
1581 asm_node *node = symtab->finalize_toplevel_asm (str);
kono
parents: 67
diff changeset
1582 node->order = streamer_read_hwi (&ib) + order_base;
kono
parents: 67
diff changeset
1583 if (node->order >= symtab->order)
kono
parents: 67
diff changeset
1584 symtab->order = node->order + 1;
kono
parents: 67
diff changeset
1585 }
kono
parents: 67
diff changeset
1586
kono
parents: 67
diff changeset
1587 lto_data_in_delete (data_in);
kono
parents: 67
diff changeset
1588
kono
parents: 67
diff changeset
1589 lto_free_section_data (file_data, LTO_section_asm, NULL, data, len);
kono
parents: 67
diff changeset
1590 }
kono
parents: 67
diff changeset
1591
kono
parents: 67
diff changeset
1592
kono
parents: 67
diff changeset
1593 /* Input mode table. */
kono
parents: 67
diff changeset
1594
kono
parents: 67
diff changeset
1595 void
kono
parents: 67
diff changeset
1596 lto_input_mode_table (struct lto_file_decl_data *file_data)
kono
parents: 67
diff changeset
1597 {
kono
parents: 67
diff changeset
1598 size_t len;
kono
parents: 67
diff changeset
1599 const char *data = lto_get_section_data (file_data, LTO_section_mode_table,
kono
parents: 67
diff changeset
1600 NULL, &len);
kono
parents: 67
diff changeset
1601 if (! data)
kono
parents: 67
diff changeset
1602 {
kono
parents: 67
diff changeset
1603 internal_error ("cannot read LTO mode table from %s",
kono
parents: 67
diff changeset
1604 file_data->file_name);
kono
parents: 67
diff changeset
1605 return;
kono
parents: 67
diff changeset
1606 }
kono
parents: 67
diff changeset
1607
kono
parents: 67
diff changeset
1608 unsigned char *table = ggc_cleared_vec_alloc<unsigned char> (1 << 8);
kono
parents: 67
diff changeset
1609 file_data->mode_table = table;
kono
parents: 67
diff changeset
1610 const struct lto_simple_header_with_strings *header
kono
parents: 67
diff changeset
1611 = (const struct lto_simple_header_with_strings *) data;
kono
parents: 67
diff changeset
1612 int string_offset;
kono
parents: 67
diff changeset
1613 struct data_in *data_in;
kono
parents: 67
diff changeset
1614 string_offset = sizeof (*header) + header->main_size;
kono
parents: 67
diff changeset
1615
kono
parents: 67
diff changeset
1616 lto_input_block ib (data + sizeof (*header), header->main_size, NULL);
kono
parents: 67
diff changeset
1617 data_in = lto_data_in_create (file_data, data + string_offset,
kono
parents: 67
diff changeset
1618 header->string_size, vNULL);
kono
parents: 67
diff changeset
1619 bitpack_d bp = streamer_read_bitpack (&ib);
kono
parents: 67
diff changeset
1620
kono
parents: 67
diff changeset
1621 table[VOIDmode] = VOIDmode;
kono
parents: 67
diff changeset
1622 table[BLKmode] = BLKmode;
kono
parents: 67
diff changeset
1623 unsigned int m;
kono
parents: 67
diff changeset
1624 while ((m = bp_unpack_value (&bp, 8)) != VOIDmode)
kono
parents: 67
diff changeset
1625 {
kono
parents: 67
diff changeset
1626 enum mode_class mclass
kono
parents: 67
diff changeset
1627 = bp_unpack_enum (&bp, mode_class, MAX_MODE_CLASS);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1628 poly_uint16 size = bp_unpack_poly_value (&bp, 16);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1629 poly_uint16 prec = bp_unpack_poly_value (&bp, 16);
111
kono
parents: 67
diff changeset
1630 machine_mode inner = (machine_mode) bp_unpack_value (&bp, 8);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1631 poly_uint16 nunits = bp_unpack_poly_value (&bp, 16);
111
kono
parents: 67
diff changeset
1632 unsigned int ibit = 0, fbit = 0;
kono
parents: 67
diff changeset
1633 unsigned int real_fmt_len = 0;
kono
parents: 67
diff changeset
1634 const char *real_fmt_name = NULL;
kono
parents: 67
diff changeset
1635 switch (mclass)
kono
parents: 67
diff changeset
1636 {
kono
parents: 67
diff changeset
1637 case MODE_FRACT:
kono
parents: 67
diff changeset
1638 case MODE_UFRACT:
kono
parents: 67
diff changeset
1639 case MODE_ACCUM:
kono
parents: 67
diff changeset
1640 case MODE_UACCUM:
kono
parents: 67
diff changeset
1641 ibit = bp_unpack_value (&bp, 8);
kono
parents: 67
diff changeset
1642 fbit = bp_unpack_value (&bp, 8);
kono
parents: 67
diff changeset
1643 break;
kono
parents: 67
diff changeset
1644 case MODE_FLOAT:
kono
parents: 67
diff changeset
1645 case MODE_DECIMAL_FLOAT:
kono
parents: 67
diff changeset
1646 real_fmt_name = bp_unpack_indexed_string (data_in, &bp,
kono
parents: 67
diff changeset
1647 &real_fmt_len);
kono
parents: 67
diff changeset
1648 break;
kono
parents: 67
diff changeset
1649 default:
kono
parents: 67
diff changeset
1650 break;
kono
parents: 67
diff changeset
1651 }
kono
parents: 67
diff changeset
1652 /* First search just the GET_CLASS_NARROWEST_MODE to wider modes,
kono
parents: 67
diff changeset
1653 if not found, fallback to all modes. */
kono
parents: 67
diff changeset
1654 int pass;
kono
parents: 67
diff changeset
1655 for (pass = 0; pass < 2; pass++)
kono
parents: 67
diff changeset
1656 for (machine_mode mr = pass ? VOIDmode
kono
parents: 67
diff changeset
1657 : GET_CLASS_NARROWEST_MODE (mclass);
kono
parents: 67
diff changeset
1658 pass ? mr < MAX_MACHINE_MODE : mr != VOIDmode;
kono
parents: 67
diff changeset
1659 pass ? mr = (machine_mode) (mr + 1)
kono
parents: 67
diff changeset
1660 : mr = GET_MODE_WIDER_MODE (mr).else_void ())
kono
parents: 67
diff changeset
1661 if (GET_MODE_CLASS (mr) != mclass
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1662 || maybe_ne (GET_MODE_SIZE (mr), size)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1663 || maybe_ne (GET_MODE_PRECISION (mr), prec)
111
kono
parents: 67
diff changeset
1664 || (inner == m
kono
parents: 67
diff changeset
1665 ? GET_MODE_INNER (mr) != mr
kono
parents: 67
diff changeset
1666 : GET_MODE_INNER (mr) != table[(int) inner])
kono
parents: 67
diff changeset
1667 || GET_MODE_IBIT (mr) != ibit
kono
parents: 67
diff changeset
1668 || GET_MODE_FBIT (mr) != fbit
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1669 || maybe_ne (GET_MODE_NUNITS (mr), nunits))
111
kono
parents: 67
diff changeset
1670 continue;
kono
parents: 67
diff changeset
1671 else if ((mclass == MODE_FLOAT || mclass == MODE_DECIMAL_FLOAT)
kono
parents: 67
diff changeset
1672 && strcmp (REAL_MODE_FORMAT (mr)->name, real_fmt_name) != 0)
kono
parents: 67
diff changeset
1673 continue;
kono
parents: 67
diff changeset
1674 else
kono
parents: 67
diff changeset
1675 {
kono
parents: 67
diff changeset
1676 table[m] = mr;
kono
parents: 67
diff changeset
1677 pass = 2;
kono
parents: 67
diff changeset
1678 break;
kono
parents: 67
diff changeset
1679 }
kono
parents: 67
diff changeset
1680 unsigned int mname_len;
kono
parents: 67
diff changeset
1681 const char *mname = bp_unpack_indexed_string (data_in, &bp, &mname_len);
kono
parents: 67
diff changeset
1682 if (pass == 2)
kono
parents: 67
diff changeset
1683 {
kono
parents: 67
diff changeset
1684 switch (mclass)
kono
parents: 67
diff changeset
1685 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1686 case MODE_VECTOR_BOOL:
111
kono
parents: 67
diff changeset
1687 case MODE_VECTOR_INT:
kono
parents: 67
diff changeset
1688 case MODE_VECTOR_FLOAT:
kono
parents: 67
diff changeset
1689 case MODE_VECTOR_FRACT:
kono
parents: 67
diff changeset
1690 case MODE_VECTOR_UFRACT:
kono
parents: 67
diff changeset
1691 case MODE_VECTOR_ACCUM:
kono
parents: 67
diff changeset
1692 case MODE_VECTOR_UACCUM:
kono
parents: 67
diff changeset
1693 /* For unsupported vector modes just use BLKmode,
kono
parents: 67
diff changeset
1694 if the scalar mode is supported. */
kono
parents: 67
diff changeset
1695 if (table[(int) inner] != VOIDmode)
kono
parents: 67
diff changeset
1696 {
kono
parents: 67
diff changeset
1697 table[m] = BLKmode;
kono
parents: 67
diff changeset
1698 break;
kono
parents: 67
diff changeset
1699 }
kono
parents: 67
diff changeset
1700 /* FALLTHRU */
kono
parents: 67
diff changeset
1701 default:
kono
parents: 67
diff changeset
1702 fatal_error (UNKNOWN_LOCATION, "unsupported mode %s\n", mname);
kono
parents: 67
diff changeset
1703 break;
kono
parents: 67
diff changeset
1704 }
kono
parents: 67
diff changeset
1705 }
kono
parents: 67
diff changeset
1706 }
kono
parents: 67
diff changeset
1707 lto_data_in_delete (data_in);
kono
parents: 67
diff changeset
1708
kono
parents: 67
diff changeset
1709 lto_free_section_data (file_data, LTO_section_mode_table, NULL, data, len);
kono
parents: 67
diff changeset
1710 }
kono
parents: 67
diff changeset
1711
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1712
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1713 /* Initialization for the LTO reader. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1714
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1715 void
111
kono
parents: 67
diff changeset
1716 lto_reader_init (void)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1717 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1718 lto_streamer_init ();
111
kono
parents: 67
diff changeset
1719 file_name_hash_table
kono
parents: 67
diff changeset
1720 = new hash_table<freeing_string_slot_hasher> (37);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1721 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1722
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1723
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1724 /* Create a new data_in object for FILE_DATA. STRINGS is the string
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1725 table to use with LEN strings. RESOLUTIONS is the vector of linker
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1726 resolutions (NULL if not using a linker plugin). */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1727
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1728 struct data_in *
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1729 lto_data_in_create (struct lto_file_decl_data *file_data, const char *strings,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1730 unsigned len,
111
kono
parents: 67
diff changeset
1731 vec<ld_plugin_symbol_resolution_t> resolutions)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1732 {
111
kono
parents: 67
diff changeset
1733 struct data_in *data_in = new (struct data_in);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1734 data_in->file_data = file_data;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1735 data_in->strings = strings;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1736 data_in->strings_len = len;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1737 data_in->globals_resolution = resolutions;
111
kono
parents: 67
diff changeset
1738 data_in->reader_cache = streamer_tree_cache_create (false, false, true);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1739 return data_in;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1740 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1741
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1742
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1743 /* Remove DATA_IN. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1744
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1745 void
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1746 lto_data_in_delete (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
1747 {
111
kono
parents: 67
diff changeset
1748 data_in->globals_resolution.release ();
kono
parents: 67
diff changeset
1749 streamer_tree_cache_delete (data_in->reader_cache);
kono
parents: 67
diff changeset
1750 delete data_in;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1751 }