| 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 // This file implements the Intrinsics utilities for matching and | 10 // This file implements the Intrinsics utilities for matching and |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 Map.insert(std::make_pair(IceString(Entry.IntrinsicName), Entry.Info)); | 210 Map.insert(std::make_pair(IceString(Entry.IntrinsicName), Entry.Info)); |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 | 213 |
| 214 Intrinsics::~Intrinsics() {} | 214 Intrinsics::~Intrinsics() {} |
| 215 | 215 |
| 216 const Intrinsics::FullIntrinsicInfo * | 216 const Intrinsics::FullIntrinsicInfo * |
| 217 Intrinsics::find(const IceString &Name) const { | 217 Intrinsics::find(const IceString &Name) const { |
| 218 auto it = Map.find(Name); | 218 auto it = Map.find(Name); |
| 219 if (it == Map.end()) | 219 if (it == Map.end()) |
| 220 return NULL; | 220 return nullptr; |
| 221 return &it->second; | 221 return &it->second; |
| 222 } | 222 } |
| 223 | 223 |
| 224 bool Intrinsics::VerifyMemoryOrder(uint64_t Order) { | 224 bool Intrinsics::VerifyMemoryOrder(uint64_t Order) { |
| 225 // There is only one memory ordering for atomics allowed right now. | 225 // There is only one memory ordering for atomics allowed right now. |
| 226 return Order == Intrinsics::MemoryOrderSequentiallyConsistent; | 226 return Order == Intrinsics::MemoryOrderSequentiallyConsistent; |
| 227 } | 227 } |
| 228 | 228 |
| 229 Intrinsics::ValidateCallValue | 229 Intrinsics::ValidateCallValue |
| 230 Intrinsics::FullIntrinsicInfo::validateCall(const Ice::InstCall *Call, | 230 Intrinsics::FullIntrinsicInfo::validateCall(const Ice::InstCall *Call, |
| 231 SizeT &ArgIndex) const { | 231 SizeT &ArgIndex) const { |
| 232 assert(NumTypes >= 1); | 232 assert(NumTypes >= 1); |
| 233 Variable *Result = Call->getDest(); | 233 Variable *Result = Call->getDest(); |
| 234 if (Result == NULL) { | 234 if (Result == nullptr) { |
| 235 if (Signature[0] != Ice::IceType_void) | 235 if (Signature[0] != Ice::IceType_void) |
| 236 return Intrinsics::BadReturnType; | 236 return Intrinsics::BadReturnType; |
| 237 } else if (Signature[0] != Result->getType()) { | 237 } else if (Signature[0] != Result->getType()) { |
| 238 return Intrinsics::BadReturnType; | 238 return Intrinsics::BadReturnType; |
| 239 } | 239 } |
| 240 if (Call->getNumArgs() + 1 != NumTypes) { | 240 if (Call->getNumArgs() + 1 != NumTypes) { |
| 241 return Intrinsics::WrongNumOfArgs; | 241 return Intrinsics::WrongNumOfArgs; |
| 242 } | 242 } |
| 243 for (size_t i = 1; i < NumTypes; ++i) { | 243 for (size_t i = 1; i < NumTypes; ++i) { |
| 244 if (Call->getArg(i - 1)->getType() != Signature[i]) { | 244 if (Call->getArg(i - 1)->getType() != Signature[i]) { |
| 245 ArgIndex = i; | 245 ArgIndex = i; |
| 246 return Intrinsics::WrongCallArgType; | 246 return Intrinsics::WrongCallArgType; |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 return Intrinsics::IsValidCall; | 249 return Intrinsics::IsValidCall; |
| 250 } | 250 } |
| 251 | 251 |
| 252 Type Intrinsics::FullIntrinsicInfo::getArgType(SizeT Index) const { | 252 Type Intrinsics::FullIntrinsicInfo::getArgType(SizeT Index) const { |
| 253 assert(NumTypes > 1); | 253 assert(NumTypes > 1); |
| 254 assert(Index + 1 < NumTypes); | 254 assert(Index + 1 < NumTypes); |
| 255 return Signature[Index + 1]; | 255 return Signature[Index + 1]; |
| 256 } | 256 } |
| 257 | 257 |
| 258 } // end of namespace Ice | 258 } // end of namespace Ice |
| OLD | NEW |