llvm.org GIT mirror llvm / 1df4397
Backing out r47521 for now. This has broken a number of tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47533 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 12 years ago
3 changed file(s) with 21 addition(s) and 42 deletion(s). Raw diff Collapse all Expand all
13361336 }
13371337
13381338 case bitc::FUNC_CODE_INST_RET: // RET: [opty,opval]
1339 {
1340 unsigned Size = Record.size();
1341 if (Size == 0) {
1342 I = new ReturnInst();
1343 break;
1344 } else if (Size == 1) {
1345 unsigned OpNum = 0;
1346 Value *Op;
1347 if (getValueTypePair(Record, OpNum, NextValueNo, Op) ||
1348 OpNum != Record.size())
1349 return Error("Invalid RET record");
1350 I = new ReturnInst(Op);
1351 break;
1352 } else {
1353 std::vector Vs;
1354 Value *Op;
1355 unsigned OpNum = 0;
1356 for (unsigned i = 0; i < Size; ++i) {
1357 getValueTypePair(Record, OpNum, NextValueNo, Op);
1358 Vs.push_back(Op);
1359 }
1360 I = new ReturnInst(Vs);
1361 break;
1362 }
1339 if (Record.empty()) {
1340 I = new ReturnInst();
1341 break;
1342 } else {
1343 unsigned OpNum = 0;
1344 Value *Op;
1345 if (getValueTypePair(Record, OpNum, NextValueNo, Op) ||
1346 OpNum != Record.size())
1347 return Error("Invalid RET record");
1348 I = new ReturnInst(Op);
1349 break;
13631350 }
13641351 case bitc::FUNC_CODE_INST_BR: { // BR: [bb#, bb#, opval] or [bb#]
13651352 if (Record.size() != 1 && Record.size() != 3)
746746 case Instruction::GetResult:
747747 Code = bitc::FUNC_CODE_INST_GETRESULT;
748748 PushValueAndType(I.getOperand(0), InstID, Vals, VE);
749 Vals.push_back(cast(I).getIndex());
750 break;
751
752 case Instruction::Ret:
753 {
754 Code = bitc::FUNC_CODE_INST_RET;
755 unsigned NumOperands = I.getNumOperands();
756 if (NumOperands == 0)
757 AbbrevToUse = FUNCTION_INST_RET_VOID_ABBREV;
758 else if (NumOperands == 1) {
759 if (!PushValueAndType(I.getOperand(0), InstID, Vals, VE))
760 AbbrevToUse = FUNCTION_INST_RET_VAL_ABBREV;
761 } else {
762 for (unsigned i = 0, e = NumOperands; i != e; ++i)
763 PushValueAndType(I.getOperand(i), InstID, Vals, VE);
764 }
765 }
749 Vals.push_back(Log2_32(cast(I).getIndex())+1);
750 break;
751
752 case Instruction::Ret:
753 Code = bitc::FUNC_CODE_INST_RET;
754 if (!I.getNumOperands())
755 AbbrevToUse = FUNCTION_INST_RET_VOID_ABBREV;
756 else if (!PushValueAndType(I.getOperand(0), InstID, Vals, VE))
757 AbbrevToUse = FUNCTION_INST_RET_VAL_ABBREV;
766758 break;
767759 case Instruction::Br:
768760 Code = bitc::FUNC_CODE_INST_BR;
None ; RUN: llvm-as < %s | opt -verify | llvm-dis | llvm-as -disable-output
0 ; RUN: llvm-as < %s -disable-output
11
22 define {i32, i8} @foo(i32 %p) {
33 ret i32 1, i8 2