]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ipa-ref-inline.h
Update Copyright years for files modified in 2011 and/or 2012.
[thirdparty/gcc.git] / gcc / ipa-ref-inline.h
CommitLineData
8d810329 1/* IPA reference lists.
71e45bc2 2 Copyright (C) 2010, 2012
8d810329 3 Free Software Foundation, Inc.
4 Contributed by Jan Hubicka
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
10Software Foundation; either version 3, or (at your option) any later
11version.
12
13GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16for more details.
17
18You should have received a copy of the GNU General Public License
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
21
04ec15fa 22/* Return callgraph node REF is referring. */
8d810329 23static inline struct cgraph_node *
24ipa_ref_node (struct ipa_ref *ref)
25{
04ec15fa 26 return cgraph (ref->referred);
8d810329 27}
28
04ec15fa 29/* Return varpool node REF is referring. */
8d810329 30
31static inline struct varpool_node *
32ipa_ref_varpool_node (struct ipa_ref *ref)
33{
04ec15fa 34 return varpool (ref->referred);
8d810329 35}
36
37/* Return cgraph node REF is in. */
38
39static inline struct cgraph_node *
04ec15fa 40ipa_ref_referring_node (struct ipa_ref *ref)
8d810329 41{
04ec15fa 42 return cgraph (ref->referring);
8d810329 43}
44
45/* Return varpool node REF is in. */
46
47static inline struct varpool_node *
04ec15fa 48ipa_ref_referring_varpool_node (struct ipa_ref *ref)
8d810329 49{
04ec15fa 50 return varpool (ref->referring);
8d810329 51}
52
53/* Return reference list REF is in. */
54
55static inline struct ipa_ref_list *
04ec15fa 56ipa_ref_referring_ref_list (struct ipa_ref *ref)
8d810329 57{
04ec15fa 58 return &ref->referring->symbol.ref_list;
8d810329 59}
60
61/* Return reference list REF is in. */
62
63static inline struct ipa_ref_list *
04ec15fa 64ipa_ref_referred_ref_list (struct ipa_ref *ref)
8d810329 65{
04ec15fa 66 return &ref->referred->symbol.ref_list;
8d810329 67}
68
69/* Return first reference in LIST or NULL if empty. */
70
71static inline struct ipa_ref *
72ipa_ref_list_first_reference (struct ipa_ref_list *list)
73{
f1f41a6c 74 if (!vec_safe_length (list->references))
8d810329 75 return NULL;
f1f41a6c 76 return &(*list->references)[0];
8d810329 77}
78
04ec15fa 79/* Return first referring ref in LIST or NULL if empty. */
8d810329 80
81static inline struct ipa_ref *
04ec15fa 82ipa_ref_list_first_referring (struct ipa_ref_list *list)
8d810329 83{
f1f41a6c 84 if (!list->referring.length ())
8d810329 85 return NULL;
f1f41a6c 86 return list->referring[0];
8d810329 87}
88
89/* Clear reference list. */
90
91static inline void
92ipa_empty_ref_list (struct ipa_ref_list *list)
93{
f1f41a6c 94 list->referring.create (0);
8d810329 95 list->references = NULL;
96}
97
98/* Clear reference list. */
99
100static inline unsigned int
101ipa_ref_list_nreferences (struct ipa_ref_list *list)
102{
f1f41a6c 103 return vec_safe_length (list->references);
8d810329 104}
105
106#define ipa_ref_list_reference_iterate(L,I,P) \
f1f41a6c 107 vec_safe_iterate ((L)->references, (I), &(P))
04ec15fa 108#define ipa_ref_list_referring_iterate(L,I,P) \
f1f41a6c 109 (L)->referring.iterate ((I), &(P))