| OLD | NEW |
| 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 /// \file | 10 /// \file |
| 11 /// This file implements the Intrinsics utilities for matching and | 11 /// This file implements the Intrinsics utilities for matching and then |
| 12 /// then dispatching by name. | 12 /// dispatching by name. |
| 13 /// | 13 /// |
| 14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
| 15 | 15 |
| 16 #include "IceIntrinsics.h" | 16 #include "IceIntrinsics.h" |
| 17 | 17 |
| 18 #include "IceCfg.h" | 18 #include "IceCfg.h" |
| 19 #include "IceCfgNode.h" | 19 #include "IceCfgNode.h" |
| 20 #include "IceInst.h" | 20 #include "IceInst.h" |
| 21 #include "IceLiveness.h" | 21 #include "IceLiveness.h" |
| 22 #include "IceOperand.h" | 22 #include "IceOperand.h" |
| 23 | 23 |
| 24 #include <utility> | 24 #include <utility> |
| 25 | 25 |
| 26 namespace Ice { | 26 namespace Ice { |
| 27 | 27 |
| 28 static_assert(sizeof(Intrinsics::IntrinsicInfo) == 4, | 28 static_assert(sizeof(Intrinsics::IntrinsicInfo) == 4, |
| 29 "Unexpected sizeof(IntrinsicInfo)"); | 29 "Unexpected sizeof(IntrinsicInfo)"); |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 #define INTRIN(ID, SE, RT) \ | 33 #define INTRIN(ID, SE, RT) \ |
| 34 { Intrinsics::ID, Intrinsics::SE, Intrinsics::RT } | 34 { Intrinsics::ID, Intrinsics::SE, Intrinsics::RT } |
| 35 | 35 |
| 36 // Build list of intrinsics with their attributes and expected prototypes. | 36 // Build list of intrinsics with their attributes and expected prototypes. List |
| 37 // List is sorted alphabetically. | 37 // is sorted alphabetically. |
| 38 const struct IceIntrinsicsEntry_ { | 38 const struct IceIntrinsicsEntry_ { |
| 39 Intrinsics::FullIntrinsicInfo Info; | 39 Intrinsics::FullIntrinsicInfo Info; |
| 40 const char *IntrinsicName; | 40 const char *IntrinsicName; |
| 41 } IceIntrinsicsTable[] = { | 41 } IceIntrinsicsTable[] = { |
| 42 | 42 |
| 43 #define AtomicCmpxchgInit(Overload, NameSuffix) \ | 43 #define AtomicCmpxchgInit(Overload, NameSuffix) \ |
| 44 { \ | 44 { \ |
| 45 { \ | 45 { \ |
| 46 INTRIN(AtomicCmpxchg, SideEffects_T, ReturnsTwice_F), {Overload, \ | 46 INTRIN(AtomicCmpxchg, SideEffects_T, ReturnsTwice_F), {Overload, \ |
| 47 IceType_i32, \ | 47 IceType_i32, \ |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 // Reject orderings not allowed by C++11. | 272 // Reject orderings not allowed by C++11. |
| 273 switch (ID) { | 273 switch (ID) { |
| 274 default: | 274 default: |
| 275 llvm_unreachable("isMemoryOrderValid: Unknown IntrinsicID"); | 275 llvm_unreachable("isMemoryOrderValid: Unknown IntrinsicID"); |
| 276 return false; | 276 return false; |
| 277 case AtomicFence: | 277 case AtomicFence: |
| 278 case AtomicFenceAll: | 278 case AtomicFenceAll: |
| 279 case AtomicRMW: | 279 case AtomicRMW: |
| 280 return true; | 280 return true; |
| 281 case AtomicCmpxchg: | 281 case AtomicCmpxchg: |
| 282 // Reject orderings that are disallowed by C++11 as invalid | 282 // Reject orderings that are disallowed by C++11 as invalid combinations |
| 283 // combinations for cmpxchg. | 283 // for cmpxchg. |
| 284 switch (OrderOther) { | 284 switch (OrderOther) { |
| 285 case MemoryOrderRelaxed: | 285 case MemoryOrderRelaxed: |
| 286 case MemoryOrderConsume: | 286 case MemoryOrderConsume: |
| 287 case MemoryOrderAcquire: | 287 case MemoryOrderAcquire: |
| 288 case MemoryOrderSequentiallyConsistent: | 288 case MemoryOrderSequentiallyConsistent: |
| 289 if (OrderOther > Order) | 289 if (OrderOther > Order) |
| 290 return false; | 290 return false; |
| 291 if (Order == MemoryOrderRelease && OrderOther != MemoryOrderRelaxed) | 291 if (Order == MemoryOrderRelease && OrderOther != MemoryOrderRelaxed) |
| 292 return false; | 292 return false; |
| 293 return true; | 293 return true; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 return Intrinsics::IsValidCall; | 337 return Intrinsics::IsValidCall; |
| 338 } | 338 } |
| 339 | 339 |
| 340 Type Intrinsics::FullIntrinsicInfo::getArgType(SizeT Index) const { | 340 Type Intrinsics::FullIntrinsicInfo::getArgType(SizeT Index) const { |
| 341 assert(NumTypes > 1); | 341 assert(NumTypes > 1); |
| 342 assert(Index + 1 < NumTypes); | 342 assert(Index + 1 < NumTypes); |
| 343 return Signature[Index + 1]; | 343 return Signature[Index + 1]; |
| 344 } | 344 } |
| 345 | 345 |
| 346 } // end of namespace Ice | 346 } // end of namespace Ice |
| OLD | NEW |