Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(538)

Side by Side Diff: src/IceIntrinsics.cpp

Issue 1017453007: Subzero: Support non sequentially consistent memory orderings for atomic ops. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceIntrinsics.h ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceIntrinsics.cpp - Functions related to intrinsics ----===// 1 //===- subzero/src/IceIntrinsics.cpp - Functions related to intrinsics ----===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file implements the Intrinsics utilities for matching and 10 // This file implements the Intrinsics utilities for matching and
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 return nullptr; 226 return nullptr;
227 IceString NameSuffix = Name.substr(LLVMPrefixLen); 227 IceString NameSuffix = Name.substr(LLVMPrefixLen);
228 auto it = Map.find(NameSuffix); 228 auto it = Map.find(NameSuffix);
229 if (it == Map.end()) { 229 if (it == Map.end()) {
230 Error = true; 230 Error = true;
231 return nullptr; 231 return nullptr;
232 } 232 }
233 return &it->second; 233 return &it->second;
234 } 234 }
235 235
236 bool Intrinsics::VerifyMemoryOrder(uint64_t Order) { 236 bool Intrinsics::VerifyMemoryOrder(IntrinsicID ID, uint64_t Order,
237 uint64_t OrderOther) {
JF 2015/03/17 16:00:07 Rename to isMemoryOrderValid?
Jim Stichnoth 2015/03/17 16:44:56 Done.
238 if (Order == Intrinsics::MemoryOrderInvalid)
239 return false;
240 if (Order == Intrinsics::MemoryOrderNum)
241 return false;
242 switch (ID) {
243 default:
244 llvm_unreachable("VerifyMemoryOrder: Unknown IntrinsicID");
245 return false;
246 break;
JF 2015/03/17 16:00:07 unreachable, return false *and* break! Porque no l
Jim Stichnoth 2015/03/17 16:44:56 20 goto 10 But yeah, break was left over from a p
JF 2015/03/17 16:58:53 It's truly unreachable if you whitelist above :-)
Jim Stichnoth 2015/03/17 18:42:04 Actually the ID can be for any intrinsic, not just
JF 2015/03/17 21:18:14 Bug?
JF 2015/03/18 06:26:30 No bug for this? :(
Jim Stichnoth 2015/03/18 13:50:15 Done.
247 case AtomicFence:
248 case AtomicFenceAll:
249 case AtomicRMW:
250 return true;
JF 2015/03/17 16:00:07 You have to reject relaxed and consume, though you
Jim Stichnoth 2015/03/17 16:44:56 Oops, done. BTW, I should have brought this up in
JF 2015/03/17 16:58:53 I think so: they're generally usable as a base to
251 case AtomicCmpxchg:
252 switch (OrderOther) {
253 case Intrinsics::MemoryOrderInvalid:
254 case Intrinsics::MemoryOrderNum:
255 case Intrinsics::MemoryOrderRelease:
256 case Intrinsics::MemoryOrderAcquireRelease:
JF 2015/03/17 16:00:07 Additional PNaCl restriction: reject relaxed and c
Jim Stichnoth 2015/03/17 16:44:56 Done.
257 return false;
258 default:
259 if (OrderOther > Order)
260 return false;
261 if (Order == Intrinsics::MemoryOrderRelease &&
262 OrderOther == Intrinsics::MemoryOrderRelaxed)
JF 2015/03/17 16:00:07 This should be: Success == Release && Failure !=
Jim Stichnoth 2015/03/17 16:44:56 Done.
263 return false;
264 return true;
265 }
266 break;
267 case AtomicLoad:
268 if (Order == Intrinsics::MemoryOrderRelease)
269 return false;
270 if (Order == Intrinsics::MemoryOrderAcquireRelease)
271 return false;
272 return true;
273 break;
274 case AtomicStore:
275 if (Order == Intrinsics::MemoryOrderConsume)
276 return false;
277 if (Order == Intrinsics::MemoryOrderAcquire)
278 return false;
279 if (Order == Intrinsics::MemoryOrderAcquireRelease)
280 return false;
281 return true;
282 break;
283 }
284 return false;
JF 2015/03/17 16:00:08 Is this reachable?
Jim Stichnoth 2015/03/17 16:44:56 Done.
237 // There is only one memory ordering for atomics allowed right now. 285 // There is only one memory ordering for atomics allowed right now.
238 return Order == Intrinsics::MemoryOrderSequentiallyConsistent; 286 return Order == Intrinsics::MemoryOrderSequentiallyConsistent;
JF 2015/03/17 16:00:07 This definitely isn't reachable!
Jim Stichnoth 2015/03/17 16:44:56 Oops, I forgot to remove the old code!
239 } 287 }
240 288
241 Intrinsics::ValidateCallValue 289 Intrinsics::ValidateCallValue
242 Intrinsics::FullIntrinsicInfo::validateCall(const Ice::InstCall *Call, 290 Intrinsics::FullIntrinsicInfo::validateCall(const Ice::InstCall *Call,
243 SizeT &ArgIndex) const { 291 SizeT &ArgIndex) const {
244 assert(NumTypes >= 1); 292 assert(NumTypes >= 1);
245 Variable *Result = Call->getDest(); 293 Variable *Result = Call->getDest();
246 if (Result == nullptr) { 294 if (Result == nullptr) {
247 if (Signature[0] != Ice::IceType_void) 295 if (Signature[0] != Ice::IceType_void)
248 return Intrinsics::BadReturnType; 296 return Intrinsics::BadReturnType;
(...skipping 12 matching lines...) Expand all
261 return Intrinsics::IsValidCall; 309 return Intrinsics::IsValidCall;
262 } 310 }
263 311
264 Type Intrinsics::FullIntrinsicInfo::getArgType(SizeT Index) const { 312 Type Intrinsics::FullIntrinsicInfo::getArgType(SizeT Index) const {
265 assert(NumTypes > 1); 313 assert(NumTypes > 1);
266 assert(Index + 1 < NumTypes); 314 assert(Index + 1 < NumTypes);
267 return Signature[Index + 1]; 315 return Signature[Index + 1];
268 } 316 }
269 317
270 } // end of namespace Ice 318 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceIntrinsics.h ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698