| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 Intrinsics::Intrinsics() { | 213 Intrinsics::Intrinsics() { |
| 214 for (size_t I = 0; I < IceIntrinsicsTableSize; ++I) { | 214 for (size_t I = 0; I < IceIntrinsicsTableSize; ++I) { |
| 215 const struct IceIntrinsicsEntry_ &Entry = IceIntrinsicsTable[I]; | 215 const struct IceIntrinsicsEntry_ &Entry = IceIntrinsicsTable[I]; |
| 216 assert(Entry.Info.NumTypes <= kMaxIntrinsicParameters); | 216 assert(Entry.Info.NumTypes <= kMaxIntrinsicParameters); |
| 217 Map.insert(std::make_pair(IceString(Entry.IntrinsicName), Entry.Info)); | 217 Map.insert(std::make_pair(IceString(Entry.IntrinsicName), Entry.Info)); |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 | 220 |
| 221 Intrinsics::~Intrinsics() {} | 221 Intrinsics::~Intrinsics() {} |
| 222 | 222 |
| 223 const Intrinsics::FullIntrinsicInfo * | 223 const Intrinsics::FullIntrinsicInfo *Intrinsics::find(const IceString &Name, |
| 224 Intrinsics::find(const IceString &Name) const { | 224 bool &Error) const { |
| 225 auto it = Map.find(Name); | 225 static const char LLVMPrefix[] = "llvm."; |
| 226 if (it == Map.end()) | 226 const size_t LLVMPrefixLen = strlen(LLVMPrefix); |
| 227 Error = false; |
| 228 if (Name.substr(0, LLVMPrefixLen) != LLVMPrefix) |
| 227 return nullptr; | 229 return nullptr; |
| 230 IceString NameSuffix = Name.substr(LLVMPrefixLen); |
| 231 auto it = Map.find(NameSuffix); |
| 232 if (it == Map.end()) { |
| 233 Error = true; |
| 234 return nullptr; |
| 235 } |
| 228 return &it->second; | 236 return &it->second; |
| 229 } | 237 } |
| 230 | 238 |
| 231 bool Intrinsics::VerifyMemoryOrder(uint64_t Order) { | 239 bool Intrinsics::VerifyMemoryOrder(uint64_t Order) { |
| 232 // There is only one memory ordering for atomics allowed right now. | 240 // There is only one memory ordering for atomics allowed right now. |
| 233 return Order == Intrinsics::MemoryOrderSequentiallyConsistent; | 241 return Order == Intrinsics::MemoryOrderSequentiallyConsistent; |
| 234 } | 242 } |
| 235 | 243 |
| 236 Intrinsics::ValidateCallValue | 244 Intrinsics::ValidateCallValue |
| 237 Intrinsics::FullIntrinsicInfo::validateCall(const Ice::InstCall *Call, | 245 Intrinsics::FullIntrinsicInfo::validateCall(const Ice::InstCall *Call, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 256 return Intrinsics::IsValidCall; | 264 return Intrinsics::IsValidCall; |
| 257 } | 265 } |
| 258 | 266 |
| 259 Type Intrinsics::FullIntrinsicInfo::getArgType(SizeT Index) const { | 267 Type Intrinsics::FullIntrinsicInfo::getArgType(SizeT Index) const { |
| 260 assert(NumTypes > 1); | 268 assert(NumTypes > 1); |
| 261 assert(Index + 1 < NumTypes); | 269 assert(Index + 1 < NumTypes); |
| 262 return Signature[Index + 1]; | 270 return Signature[Index + 1]; |
| 263 } | 271 } |
| 264 | 272 |
| 265 } // end of namespace Ice | 273 } // end of namespace Ice |
| OLD | NEW |