remove parser support for the obsolete "multiple return values" syntax, which

was replaced with return of a "first class aggregate".



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133245 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2011-06-17 06:49:41 +00:00
parent 6b7c89ee09
commit 437544f25c
13 changed files with 42 additions and 340 deletions

View File

@@ -3079,9 +3079,7 @@ bool LLParser::ParseCmpPredicate(unsigned &P, unsigned Opc) {
/// ParseRet - Parse a return instruction.
/// ::= 'ret' void (',' !dbg, !1)*
/// ::= 'ret' TypeAndValue (',' !dbg, !1)*
/// ::= 'ret' TypeAndValue (',' TypeAndValue)+ (',' !dbg, !1)*
/// [[obsolete: LLVM 3.0]]
int LLParser::ParseRet(Instruction *&Inst, BasicBlock *BB,
bool LLParser::ParseRet(Instruction *&Inst, BasicBlock *BB,
PerFunctionState &PFS) {
PATypeHolder Ty(Type::getVoidTy(Context));
if (ParseType(Ty, true /*void allowed*/)) return true;
@@ -3094,38 +3092,8 @@ int LLParser::ParseRet(Instruction *&Inst, BasicBlock *BB,
Value *RV;
if (ParseValue(Ty, RV, PFS)) return true;
bool ExtraComma = false;
if (EatIfPresent(lltok::comma)) {
// Parse optional custom metadata, e.g. !dbg
if (Lex.getKind() == lltok::MetadataVar) {
ExtraComma = true;
} else {
// The normal case is one return value.
// FIXME: LLVM 3.0 remove MRV support for 'ret i32 1, i32 2', requiring
// use of 'ret {i32,i32} {i32 1, i32 2}'
SmallVector<Value*, 8> RVs;
RVs.push_back(RV);
do {
// If optional custom metadata, e.g. !dbg is seen then this is the
// end of MRV.
if (Lex.getKind() == lltok::MetadataVar)
break;
if (ParseTypeAndValue(RV, PFS)) return true;
RVs.push_back(RV);
} while (EatIfPresent(lltok::comma));
RV = UndefValue::get(PFS.getFunction().getReturnType());
for (unsigned i = 0, e = RVs.size(); i != e; ++i) {
Instruction *I = InsertValueInst::Create(RV, RVs[i], i, "mrv");
BB->getInstList().push_back(I);
RV = I;
}
}
}
Inst = ReturnInst::Create(Context, RV);
return ExtraComma ? InstExtraComma : InstNormal;
return false;
}

View File

@@ -340,7 +340,7 @@ namespace llvm {
PerFunctionState &PFS);
bool ParseCmpPredicate(unsigned &Pred, unsigned Opc);
int ParseRet(Instruction *&Inst, BasicBlock *BB, PerFunctionState &PFS);
bool ParseRet(Instruction *&Inst, BasicBlock *BB, PerFunctionState &PFS);
bool ParseBr(Instruction *&Inst, PerFunctionState &PFS);
bool ParseSwitch(Instruction *&Inst, PerFunctionState &PFS);
bool ParseIndirectBr(Instruction *&Inst, PerFunctionState &PFS);