Mercurial > hg > CbC > CbC_gcc
comparison gcc/ipa-ref-inline.h @ 63:b7f97abdc517 gcc-4.6-20100522
update gcc from gcc-4.5.0 to gcc-4.6
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 24 May 2010 12:47:05 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
56:3c8a44c06a95 | 63:b7f97abdc517 |
---|---|
1 /* IPA reference lists. | |
2 Copyright (C) 2010 | |
3 Free Software Foundation, Inc. | |
4 Contributed by Jan Hubicka | |
5 | |
6 This file is part of GCC. | |
7 | |
8 GCC is free software; you can redistribute it and/or modify it under | |
9 the terms of the GNU General Public License as published by the Free | |
10 Software Foundation; either version 3, or (at your option) any later | |
11 version. | |
12 | |
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with GCC; see the file COPYING3. If not see | |
20 <http://www.gnu.org/licenses/>. */ | |
21 | |
22 /* Return callgraph node REF is refering. */ | |
23 static inline struct cgraph_node * | |
24 ipa_ref_node (struct ipa_ref *ref) | |
25 { | |
26 gcc_assert (ref->refered_type == IPA_REF_CGRAPH); | |
27 return ref->refered.cgraph_node; | |
28 } | |
29 | |
30 /* Return varpool node REF is refering. */ | |
31 | |
32 static inline struct varpool_node * | |
33 ipa_ref_varpool_node (struct ipa_ref *ref) | |
34 { | |
35 gcc_assert (ref->refered_type == IPA_REF_VARPOOL); | |
36 return ref->refered.varpool_node; | |
37 } | |
38 | |
39 /* Return cgraph node REF is in. */ | |
40 | |
41 static inline struct cgraph_node * | |
42 ipa_ref_refering_node (struct ipa_ref *ref) | |
43 { | |
44 gcc_assert (ref->refering_type == IPA_REF_CGRAPH); | |
45 return ref->refering.cgraph_node; | |
46 } | |
47 | |
48 /* Return varpool node REF is in. */ | |
49 | |
50 static inline struct varpool_node * | |
51 ipa_ref_refering_varpool_node (struct ipa_ref *ref) | |
52 { | |
53 gcc_assert (ref->refering_type == IPA_REF_VARPOOL); | |
54 return ref->refering.varpool_node; | |
55 } | |
56 | |
57 /* Return reference list REF is in. */ | |
58 | |
59 static inline struct ipa_ref_list * | |
60 ipa_ref_refering_ref_list (struct ipa_ref *ref) | |
61 { | |
62 if (ref->refering_type == IPA_REF_CGRAPH) | |
63 return &ipa_ref_refering_node (ref)->ref_list; | |
64 else | |
65 return &ipa_ref_refering_varpool_node (ref)->ref_list; | |
66 } | |
67 | |
68 /* Return reference list REF is in. */ | |
69 | |
70 static inline struct ipa_ref_list * | |
71 ipa_ref_refered_ref_list (struct ipa_ref *ref) | |
72 { | |
73 if (ref->refered_type == IPA_REF_CGRAPH) | |
74 return &ipa_ref_node (ref)->ref_list; | |
75 else | |
76 return &ipa_ref_varpool_node (ref)->ref_list; | |
77 } | |
78 | |
79 /* Return first reference in LIST or NULL if empty. */ | |
80 | |
81 static inline struct ipa_ref * | |
82 ipa_ref_list_first_reference (struct ipa_ref_list *list) | |
83 { | |
84 if (!VEC_length (ipa_ref_t, list->references)) | |
85 return NULL; | |
86 return VEC_index (ipa_ref_t, list->references, 0); | |
87 } | |
88 | |
89 /* Return first refering ref in LIST or NULL if empty. */ | |
90 | |
91 static inline struct ipa_ref * | |
92 ipa_ref_list_first_refering (struct ipa_ref_list *list) | |
93 { | |
94 if (!VEC_length (ipa_ref_ptr, list->refering)) | |
95 return NULL; | |
96 return VEC_index (ipa_ref_ptr, list->refering, 0); | |
97 } | |
98 | |
99 /* Clear reference list. */ | |
100 | |
101 static inline void | |
102 ipa_empty_ref_list (struct ipa_ref_list *list) | |
103 { | |
104 list->refering = NULL; | |
105 list->references = NULL; | |
106 } | |
107 | |
108 /* Clear reference list. */ | |
109 | |
110 static inline unsigned int | |
111 ipa_ref_list_nreferences (struct ipa_ref_list *list) | |
112 { | |
113 return VEC_length (ipa_ref_t, list->references); | |
114 } | |
115 | |
116 #define ipa_ref_list_reference_iterate(L,I,P) \ | |
117 VEC_iterate(ipa_ref_t, (L)->references, (I), (P)) | |
118 #define ipa_ref_list_refering_iterate(L,I,P) \ | |
119 VEC_iterate(ipa_ref_ptr, (L)->refering, (I), (P)) |