Add VEX fix 'powerpc too chatty even with --sigill-diagnostics=no' to NEWS.
[valgrind.git] / drd / drd_thread_bitmap.h
blob9a41b7cda0492af19d54a0cd33eaa34169905058
1 /*
2 This file is part of drd, a thread error detector.
4 Copyright (C) 2006-2017 Bart Van Assche <bvanassche@acm.org>.
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307, USA.
21 The GNU General Public License is contained in the file COPYING.
25 #ifndef __DRD_THREAD_BITMAP_H
26 #define __DRD_THREAD_BITMAP_H
29 #include "drd_bitmap.h"
30 #include "drd_thread.h" /* running_thread_get_segment() */
31 #include "pub_drd_bitmap.h"
34 static __inline__
35 Bool bm_access_load_1_triggers_conflict(const Addr a1)
37 DRD_(bm_access_load_1)(DRD_(sg_bm)(DRD_(running_thread_get_segment)()), a1);
38 return DRD_(bm_load_1_has_conflict_with)(DRD_(thread_get_conflict_set)(),
39 a1);
42 static __inline__
43 Bool bm_access_load_2_triggers_conflict(const Addr a1)
45 if ((a1 & 1) == 0)
47 bm_access_aligned_load(DRD_(sg_bm)(DRD_(running_thread_get_segment)()), a1, 2);
48 return bm_aligned_load_has_conflict_with(DRD_(thread_get_conflict_set)(),
49 a1, 2);
51 else
53 DRD_(bm_access_range)(DRD_(sg_bm)(DRD_(running_thread_get_segment)()),
54 a1, a1 + 2, eLoad);
55 return DRD_(bm_has_conflict_with)(DRD_(thread_get_conflict_set)(),
56 a1, a1 + 2, eLoad);
60 static __inline__
61 Bool bm_access_load_4_triggers_conflict(const Addr a1)
63 if ((a1 & 3) == 0)
65 bm_access_aligned_load(DRD_(sg_bm)(DRD_(running_thread_get_segment)()), a1, 4);
66 return bm_aligned_load_has_conflict_with(DRD_(thread_get_conflict_set)(),
67 a1, 4);
69 else
71 DRD_(bm_access_range)(DRD_(sg_bm)(DRD_(running_thread_get_segment)()),
72 a1, a1 + 4, eLoad);
73 return DRD_(bm_has_conflict_with)(DRD_(thread_get_conflict_set)(),
74 a1, a1 + 4, eLoad);
78 static __inline__
79 Bool bm_access_load_8_triggers_conflict(const Addr a1)
81 if ((a1 & 7) == 0)
83 bm_access_aligned_load(DRD_(sg_bm)(DRD_(running_thread_get_segment)()), a1, 8);
84 return bm_aligned_load_has_conflict_with(DRD_(thread_get_conflict_set)(),
85 a1, 8);
87 else if ((a1 & 3) == 0)
89 bm_access_aligned_load(DRD_(sg_bm)(DRD_(running_thread_get_segment)()), a1 + 0, 4);
90 bm_access_aligned_load(DRD_(sg_bm)(DRD_(running_thread_get_segment)()), a1 + 4, 4);
91 return DRD_(bm_has_conflict_with)(DRD_(thread_get_conflict_set)(),
92 a1, a1 + 8, eLoad);
94 else
96 DRD_(bm_access_range)(DRD_(sg_bm)(DRD_(running_thread_get_segment)()),
97 a1, a1 + 8, eLoad);
98 return DRD_(bm_has_conflict_with)(DRD_(thread_get_conflict_set)(),
99 a1, a1 + 8, eLoad);
103 static __inline__
104 Bool bm_access_load_triggers_conflict(const Addr a1, const Addr a2)
106 DRD_(bm_access_range_load)(DRD_(sg_bm)(DRD_(running_thread_get_segment)()), a1, a2);
107 return DRD_(bm_load_has_conflict_with)(DRD_(thread_get_conflict_set)(),
108 a1, a2);
111 static __inline__
112 Bool bm_access_store_1_triggers_conflict(const Addr a1)
114 DRD_(bm_access_store_1)(DRD_(sg_bm)(DRD_(running_thread_get_segment)()), a1);
115 return DRD_(bm_store_1_has_conflict_with)(DRD_(thread_get_conflict_set)(),
116 a1);
119 static __inline__
120 Bool bm_access_store_2_triggers_conflict(const Addr a1)
122 if ((a1 & 1) == 0)
124 bm_access_aligned_store(DRD_(sg_bm)(DRD_(running_thread_get_segment)()), a1, 2);
125 return bm_aligned_store_has_conflict_with(DRD_(thread_get_conflict_set)(),
126 a1, 2);
128 else
130 DRD_(bm_access_range)(DRD_(sg_bm)(DRD_(running_thread_get_segment)()),
131 a1, a1 + 2, eStore);
132 return DRD_(bm_has_conflict_with)(DRD_(thread_get_conflict_set)(),
133 a1, a1 + 2, eStore);
137 static __inline__
138 Bool bm_access_store_4_triggers_conflict(const Addr a1)
140 if ((a1 & 3) == 0)
142 bm_access_aligned_store(DRD_(sg_bm)(DRD_(running_thread_get_segment)()), a1, 4);
143 return bm_aligned_store_has_conflict_with(DRD_(thread_get_conflict_set)(),
144 a1, 4);
146 else
148 DRD_(bm_access_range)(DRD_(sg_bm)(DRD_(running_thread_get_segment)()),
149 a1, a1 + 4, eStore);
150 return DRD_(bm_has_conflict_with)(DRD_(thread_get_conflict_set)(),
151 a1, a1 + 4, eStore);
155 static __inline__
156 Bool bm_access_store_8_triggers_conflict(const Addr a1)
158 if ((a1 & 7) == 0)
160 bm_access_aligned_store(DRD_(sg_bm)(DRD_(running_thread_get_segment)()), a1, 8);
161 return bm_aligned_store_has_conflict_with(DRD_(thread_get_conflict_set)(),
162 a1, 8);
164 else if ((a1 & 3) == 0)
166 bm_access_aligned_store(DRD_(sg_bm)(DRD_(running_thread_get_segment)()),
167 a1 + 0, 4);
168 bm_access_aligned_store(DRD_(sg_bm)(DRD_(running_thread_get_segment)()),
169 a1 + 4, 4);
170 return DRD_(bm_has_conflict_with)(DRD_(thread_get_conflict_set)(),
171 a1, a1 + 8, eStore);
173 else
175 DRD_(bm_access_range)(DRD_(sg_bm)(DRD_(running_thread_get_segment)()),
176 a1, a1 + 8, eStore);
177 return DRD_(bm_has_conflict_with)(DRD_(thread_get_conflict_set)(),
178 a1, a1 + 8, eStore);
182 static __inline__
183 Bool bm_access_store_triggers_conflict(const Addr a1, const Addr a2)
185 DRD_(bm_access_range_store)(DRD_(sg_bm)(DRD_(running_thread_get_segment)()), a1, a2);
186 return DRD_(bm_store_has_conflict_with)(DRD_(thread_get_conflict_set)(),
187 a1, a2);
190 #endif // __DRD_THREAD_BITMAP_H