Update bitcode reader and writer to handle multiple return values.

Take 2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47583 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2008-02-26 01:29:32 +00:00
parent aaeb60ae40
commit d9d99ff8e8
3 changed files with 35 additions and 19 deletions

View File

@@ -1337,17 +1337,24 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
}
case bitc::FUNC_CODE_INST_RET: // RET: [opty,opval<optional>]
if (Record.empty()) {
I = new ReturnInst();
break;
} else {
unsigned OpNum = 0;
Value *Op;
if (getValueTypePair(Record, OpNum, NextValueNo, Op) ||
OpNum != Record.size())
return Error("Invalid RET record");
I = new ReturnInst(Op);
break;
{
unsigned Size = Record.size();
if (Size == 0) {
I = new ReturnInst();
break;
} else {
unsigned OpNum = 0;
std::vector<Value *> Vs;
do {
Value *Op = NULL;
if (getValueTypePair(Record, OpNum, NextValueNo, Op))
return Error("Invalid RET record");
Vs.push_back(Op);
} while(OpNum != Record.size());
I = new ReturnInst(Vs);
break;
}
}
case bitc::FUNC_CODE_INST_BR: { // BR: [bb#, bb#, opval] or [bb#]
if (Record.size() != 1 && Record.size() != 3)