annotate gcc/lto-streamer-in.c @ 158:494b0b89df80 default tip

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