Index: src/IceIntrinsics.cpp |
diff --git a/src/IceIntrinsics.cpp b/src/IceIntrinsics.cpp |
index e941ff9b672e32c97f591049ebf012dc4af98d09..757455ff0753e4383bf8ccf6c37670fd387b2650 100644 |
--- a/src/IceIntrinsics.cpp |
+++ b/src/IceIntrinsics.cpp |
@@ -14,6 +14,7 @@ |
#include "IceCfg.h" |
#include "IceCfgNode.h" |
+#include "IceInst.h" |
#include "IceIntrinsics.h" |
#include "IceLiveness.h" |
#include "IceOperand.h" |
@@ -226,4 +227,33 @@ bool Intrinsics::VerifyMemoryOrder(uint64_t Order) { |
return Order == Intrinsics::MemoryOrderSequentiallyConsistent; |
} |
+Intrinsics::ValidateCallValue |
+Intrinsics::FullIntrinsicInfo::validateCall(const Ice::InstCall *Call, |
+ SizeT &ArgIndex) const { |
+ assert(NumTypes >= 1); |
+ Variable *Result = Call->getDest(); |
+ if (Result == NULL) { |
+ if (Signature[0] != Ice::IceType_void) |
+ return Intrinsics::BadReturnType; |
+ } else if (Signature[0] != Result->getType()) { |
+ return Intrinsics::BadReturnType; |
+ } |
+ if (Call->getNumArgs() + 1 != NumTypes) { |
+ return Intrinsics::WrongNumOfArgs; |
+ } |
+ for (size_t i = 1; i < NumTypes; ++i) { |
+ if (Call->getArg(i - 1)->getType() != Signature[i]) { |
+ ArgIndex = i; |
+ return Intrinsics::WrongCallArgType; |
+ } |
+ } |
+ return Intrinsics::IsValidCall; |
+} |
+ |
+Type Intrinsics::FullIntrinsicInfo::getArgType(SizeT Index) const { |
+ assert(NumTypes > 1); |
+ assert(Index + 1 < NumTypes); |
+ return Signature[Index + 1]; |
+} |
+ |
} // end of namespace Ice |