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

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: Add TODO 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::isMemoryOrderValid(IntrinsicID ID, uint64_t Order,
237 // There is only one memory ordering for atomics allowed right now. 237 uint64_t OrderOther) {
238 return Order == Intrinsics::MemoryOrderSequentiallyConsistent; 238 // Reject orderings not allowed in PNaCl.
239 switch (Order) {
240 case Intrinsics::MemoryOrderAcquire:
241 case Intrinsics::MemoryOrderRelease:
242 case Intrinsics::MemoryOrderAcquireRelease:
243 case Intrinsics::MemoryOrderSequentiallyConsistent:
244 break;
245 default:
246 return false;
247 }
248 // Reject orderings not allowed by C++11.
249 switch (ID) {
250 default:
251 llvm_unreachable("isMemoryOrderValid: Unknown IntrinsicID");
252 return false;
253 case AtomicFence:
254 case AtomicFenceAll:
255 case AtomicRMW:
256 return true;
257 case AtomicCmpxchg:
258 switch (OrderOther) {
259 case Intrinsics::MemoryOrderInvalid:
jvoung (off chromium) 2015/03/17 19:05:21 Maybe call out case Intrinsics::MemoryOrderInvali
Jim Stichnoth 2015/03/17 21:05:11 Done.
260 case Intrinsics::MemoryOrderNum:
261 case Intrinsics::MemoryOrderRelease:
262 case Intrinsics::MemoryOrderAcquireRelease:
263 case Intrinsics::MemoryOrderRelaxed:
264 case Intrinsics::MemoryOrderConsume:
265 return false;
266 default:
267 if (OrderOther > Order)
268 return false;
269 if (Order == Intrinsics::MemoryOrderRelease &&
270 OrderOther != Intrinsics::MemoryOrderRelaxed)
271 return false;
272 return true;
273 }
274 case AtomicLoad:
275 switch (Order) {
276 case Intrinsics::MemoryOrderRelease:
277 case Intrinsics::MemoryOrderAcquireRelease:
278 return false;
279 default:
280 return true;
281 }
282 case AtomicStore:
283 switch (Order) {
284 case Intrinsics::MemoryOrderConsume:
285 case Intrinsics::MemoryOrderAcquire:
286 case Intrinsics::MemoryOrderAcquireRelease:
287 return false;
288 default:
289 return true;
290 }
291 }
239 } 292 }
240 293
241 Intrinsics::ValidateCallValue 294 Intrinsics::ValidateCallValue
242 Intrinsics::FullIntrinsicInfo::validateCall(const Ice::InstCall *Call, 295 Intrinsics::FullIntrinsicInfo::validateCall(const Ice::InstCall *Call,
243 SizeT &ArgIndex) const { 296 SizeT &ArgIndex) const {
244 assert(NumTypes >= 1); 297 assert(NumTypes >= 1);
245 Variable *Result = Call->getDest(); 298 Variable *Result = Call->getDest();
246 if (Result == nullptr) { 299 if (Result == nullptr) {
247 if (Signature[0] != Ice::IceType_void) 300 if (Signature[0] != Ice::IceType_void)
248 return Intrinsics::BadReturnType; 301 return Intrinsics::BadReturnType;
(...skipping 12 matching lines...) Expand all
261 return Intrinsics::IsValidCall; 314 return Intrinsics::IsValidCall;
262 } 315 }
263 316
264 Type Intrinsics::FullIntrinsicInfo::getArgType(SizeT Index) const { 317 Type Intrinsics::FullIntrinsicInfo::getArgType(SizeT Index) const {
265 assert(NumTypes > 1); 318 assert(NumTypes > 1);
266 assert(Index + 1 < NumTypes); 319 assert(Index + 1 < NumTypes);
267 return Signature[Index + 1]; 320 return Signature[Index + 1];
268 } 321 }
269 322
270 } // end of namespace Ice 323 } // 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