Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: src/IceConverter.cpp

Issue 577353003: Add call instructions to Subzero's bitcode reader. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix remaining issues raised. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/IceInst.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceConverter.cpp
diff --git a/src/IceConverter.cpp b/src/IceConverter.cpp
index 2db34e92793caf5c3a76e4e8de53199be9ab6d82..ec797c19144055955d68ea31958e737f385b5aa7 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,38 @@ 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.");
- }
+ Ice::SizeT ArgIndex = 0;
+ switch (I->validateCall(Call, ArgIndex)) {
+ 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";
- report_fatal_error("Mismatched # of args.");
+ case Ice::Intrinsics::WrongNumOfArgs: {
+ std::string Buffer;
+ raw_string_ostream StrBuf(Buffer);
+ StrBuf << "Intrinsic call expects " << I->getNumArgs()
+ << ". Found: " << Call->getNumArgs();
+ report_fatal_error(StrBuf.str());
+ break;
+ }
+ case Ice::Intrinsics::WrongCallArgType: {
+ std::string Buffer;
+ raw_string_ostream StrBuf(Buffer);
+ StrBuf << "Intrinsic call argument " << ArgIndex << " expects type "
+ << I->getArgType(ArgIndex)
+ << ". Found: " << Call->getArg(ArgIndex)->getType();
+ report_fatal_error(StrBuf.str());
+ break;
}
- for (size_t i = 1; i < I->NumTypes; ++i) {
- if (Call->getArg(i - 1)->getType() != I->Signature[i]) {
- report_fatal_error("Mismatched argument type.");
- }
}
}
« no previous file with comments | « no previous file | src/IceInst.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698