Chromium Code Reviews| Index: src/IceConverter.cpp |
| diff --git a/src/IceConverter.cpp b/src/IceConverter.cpp |
| index 2db34e92793caf5c3a76e4e8de53199be9ab6d82..5387456d71a518300133958b1d7f2c10af512bfc 100644 |
| --- a/src/IceConverter.cpp |
| +++ b/src/IceConverter.cpp |
| @@ -537,7 +537,8 @@ private: |
| // Not an intrinsic call. |
| if (NewInst == NULL) { |
| - NewInst = Ice::InstCall::create(Func, NumArgs, Dest, CallTarget); |
| + NewInst = Ice::InstCall::create(Func, NumArgs, Dest, CallTarget, |
| + Inst->isTailCall()); |
| } |
| for (unsigned i = 0; i < NumArgs; ++i) { |
| NewInst->addArg(convertOperand(Inst, i)); |
| @@ -574,26 +575,26 @@ private: |
| void validateIntrinsicCall(const Ice::InstCall *Call, |
| const Ice::Intrinsics::FullIntrinsicInfo *I) { |
| - assert(I->NumTypes >= 1); |
| - if (I->Signature[0] == Ice::IceType_void) { |
| - if (Call->getDest() != NULL) { |
| - report_fatal_error( |
| - "Return value for intrinsic func w/ void return type."); |
| - } |
| - } else { |
| - if (I->Signature[0] != Call->getDest()->getType()) { |
| - report_fatal_error("Mismatched return types."); |
| - } |
| + switch (I->validateCall(Call)) { |
|
jvoung (off chromium)
2014/09/18 23:43:53
It would be okay to have the index outparam versio
Karl
2014/09/19 20:29:52
Done.
|
| + default: |
| + report_fatal_error("Unknown validation error for intrinsic call"); |
| + break; |
| + case Ice::Intrinsics::IsValidCall: |
| + break; |
| + case Ice::Intrinsics::BadReturnType: { |
| + std::string Buffer; |
| + raw_string_ostream StrBuf(Buffer); |
| + StrBuf << "Intrinsic call expects return type " << I->getReturnType() |
| + << ". Found: " << Call->getReturnType(); |
| + report_fatal_error(StrBuf.str()); |
| + break; |
| } |
| - if (Call->getNumArgs() + 1 != I->NumTypes) { |
| - std::cerr << "Call->getNumArgs() " << (int)Call->getNumArgs() |
| - << " I->NumTypes " << (int)I->NumTypes << "\n"; |
| + case Ice::Intrinsics::WrongNumOfArgs: |
| report_fatal_error("Mismatched # of args."); |
| - } |
| - for (size_t i = 1; i < I->NumTypes; ++i) { |
| - if (Call->getArg(i - 1)->getType() != I->Signature[i]) { |
| - report_fatal_error("Mismatched argument type."); |
| - } |
| + break; |
| + case Ice::Intrinsics::WrongCallArgType: |
| + report_fatal_error("Mismatched argument type."); |
| + break; |
| } |
| } |