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 |
11 // then dispatching by name. | 11 // then dispatching by name. |
12 // | 12 // |
13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
14 | 14 |
15 #include "IceCfg.h" | 15 #include "IceCfg.h" |
16 #include "IceCfgNode.h" | 16 #include "IceCfgNode.h" |
| 17 #include "IceInst.h" |
17 #include "IceIntrinsics.h" | 18 #include "IceIntrinsics.h" |
18 #include "IceLiveness.h" | 19 #include "IceLiveness.h" |
19 #include "IceOperand.h" | 20 #include "IceOperand.h" |
20 | 21 |
21 #include <utility> | 22 #include <utility> |
22 | 23 |
23 namespace Ice { | 24 namespace Ice { |
24 | 25 |
25 namespace { | 26 namespace { |
26 | 27 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 if (it == map.end()) | 220 if (it == map.end()) |
220 return NULL; | 221 return NULL; |
221 return &it->second; | 222 return &it->second; |
222 } | 223 } |
223 | 224 |
224 bool Intrinsics::VerifyMemoryOrder(uint64_t Order) { | 225 bool Intrinsics::VerifyMemoryOrder(uint64_t Order) { |
225 // There is only one memory ordering for atomics allowed right now. | 226 // There is only one memory ordering for atomics allowed right now. |
226 return Order == Intrinsics::MemoryOrderSequentiallyConsistent; | 227 return Order == Intrinsics::MemoryOrderSequentiallyConsistent; |
227 } | 228 } |
228 | 229 |
| 230 Intrinsics::ValidateCallValue |
| 231 Intrinsics::FullIntrinsicInfo::validateCall(const Ice::InstCall *Call, |
| 232 SizeT &ArgIndex) const { |
| 233 assert(NumTypes >= 1); |
| 234 Variable *Result = Call->getDest(); |
| 235 if (Result == NULL) { |
| 236 if (Signature[0] != Ice::IceType_void) |
| 237 return Intrinsics::BadReturnType; |
| 238 } else if (Signature[0] != Result->getType()) { |
| 239 return Intrinsics::BadReturnType; |
| 240 } |
| 241 if (Call->getNumArgs() + 1 != NumTypes) { |
| 242 return Intrinsics::WrongNumOfArgs; |
| 243 } |
| 244 for (size_t i = 1; i < NumTypes; ++i) { |
| 245 if (Call->getArg(i - 1)->getType() != Signature[i]) { |
| 246 ArgIndex = i; |
| 247 return Intrinsics::WrongCallArgType; |
| 248 } |
| 249 } |
| 250 return Intrinsics::IsValidCall; |
| 251 } |
| 252 |
| 253 Type Intrinsics::FullIntrinsicInfo::getArgType(SizeT Index) const { |
| 254 assert(NumTypes > 1); |
| 255 assert(Index + 1 < NumTypes); |
| 256 return Signature[Index + 1]; |
| 257 } |
| 258 |
229 } // end of namespace Ice | 259 } // end of namespace Ice |
OLD | NEW |