]>
Commit | Line | Data |
---|---|---|
8d810329 | 1 | /* IPA reference lists. |
3aea1f79 | 2 | Copyright (C) 2010-2014 Free Software Foundation, Inc. |
8d810329 | 3 | Contributed by Jan Hubicka |
4 | ||
5 | This file is part of GCC. | |
6 | ||
7 | GCC is free software; you can redistribute it and/or modify it under | |
8 | the terms of the GNU General Public License as published by the Free | |
9 | Software Foundation; either version 3, or (at your option) any later | |
10 | version. | |
11 | ||
12 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
13 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 | for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with GCC; see the file COPYING3. If not see | |
19 | <http://www.gnu.org/licenses/>. */ | |
20 | ||
21 | struct cgraph_node; | |
098f44bc | 22 | class varpool_node; |
452659af | 23 | class symtab_node; |
04ec15fa | 24 | |
8d810329 | 25 | |
26 | /* How the reference is done. */ | |
27 | enum GTY(()) ipa_ref_use | |
28 | { | |
29 | IPA_REF_LOAD, | |
30 | IPA_REF_STORE, | |
c70f46b0 | 31 | IPA_REF_ADDR, |
32 | IPA_REF_ALIAS | |
8d810329 | 33 | }; |
34 | ||
8d810329 | 35 | /* Record of reference in callgraph or varpool. */ |
36 | struct GTY(()) ipa_ref | |
37 | { | |
51ce5652 | 38 | public: |
39 | /* Remove reference. */ | |
40 | void remove_reference (); | |
41 | ||
42 | /* Return true when execution of reference can lead to return from | |
43 | function. */ | |
44 | bool cannot_lead_to_return (); | |
45 | ||
46 | /* Return reference list this reference is in. */ | |
47 | struct ipa_ref_list * referring_ref_list (void); | |
48 | ||
49 | /* Return reference list this reference is in. */ | |
50 | struct ipa_ref_list * referred_ref_list (void); | |
51 | ||
452659af | 52 | symtab_node *referring; |
53 | symtab_node *referred; | |
8d810329 | 54 | gimple stmt; |
4d044066 | 55 | unsigned int lto_stmt_uid; |
04ec15fa | 56 | unsigned int referred_index; |
8d810329 | 57 | ENUM_BITFIELD (ipa_ref_use) use:2; |
4d044066 | 58 | unsigned int speculative:1; |
8d810329 | 59 | }; |
60 | ||
61 | typedef struct ipa_ref ipa_ref_t; | |
62 | typedef struct ipa_ref *ipa_ref_ptr; | |
63 | ||
8d810329 | 64 | |
65 | /* List of references. This is stored in both callgraph and varpool nodes. */ | |
66 | struct GTY(()) ipa_ref_list | |
67 | { | |
51ce5652 | 68 | public: |
69 | /* Return first reference in list or NULL if empty. */ | |
70 | struct ipa_ref *first_reference (void) | |
71 | { | |
72 | if (!vec_safe_length (references)) | |
73 | return NULL; | |
74 | return &(*references)[0]; | |
75 | } | |
76 | ||
77 | /* Return first referring ref in list or NULL if empty. */ | |
78 | struct ipa_ref *first_referring (void) | |
79 | { | |
80 | if (!referring.length ()) | |
81 | return NULL; | |
82 | return referring[0]; | |
83 | } | |
84 | ||
85 | /* Clear reference list. */ | |
86 | void clear (void) | |
87 | { | |
88 | referring.create (0); | |
89 | references = NULL; | |
90 | } | |
91 | ||
92 | /* Return number of references. */ | |
93 | unsigned int nreferences (void) | |
94 | { | |
95 | return vec_safe_length (references); | |
96 | } | |
97 | ||
8d810329 | 98 | /* Store actual references in references vector. */ |
f1f41a6c | 99 | vec<ipa_ref_t, va_gc> *references; |
9d75589a | 100 | /* Referring is vector of pointers to references. It must not live in GGC space |
8d810329 | 101 | or GGC will try to mark middle of references vectors. */ |
f1f41a6c | 102 | vec<ipa_ref_ptr> GTY((skip)) referring; |
8d810329 | 103 | }; |