Skip to content

Commit

Permalink
remove parser support for the obsolete "multiple return values" synta…
Browse files Browse the repository at this point in the history
…x, 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
  • Loading branch information
lattner committed Jun 17, 2011
1 parent 6b7c89e commit 437544f
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 340 deletions.
36 changes: 2 additions & 34 deletions lib/AsmParser/LLParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}


Expand Down
2 changes: 1 addition & 1 deletion lib/AsmParser/LLParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
22 changes: 0 additions & 22 deletions test/Assembler/2008-02-20-MultipleReturnValue.ll

This file was deleted.

17 changes: 0 additions & 17 deletions test/CodeGen/PowerPC/multiple-return-values.ll

This file was deleted.

10 changes: 8 additions & 2 deletions test/CodeGen/X86/fp-stack-2results.ll
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
; RUN: llc < %s -march=x86 | grep fldz
; RUN: llc < %s -march=x86-64 | grep fld1

%0 = type { x86_fp80, x86_fp80 }

; This is basically this code on x86-64:
; _Complex long double test() { return 1.0; }
define {x86_fp80, x86_fp80} @test() {
%A = fpext double 1.0 to x86_fp80
%B = fpext double 0.0 to x86_fp80
ret x86_fp80 %A, x86_fp80 %B
%mrv = insertvalue %0 undef, x86_fp80 %A, 0
%mrv1 = insertvalue %0 %mrv, x86_fp80 %B, 1
ret %0 %mrv1
}


Expand All @@ -16,7 +20,9 @@ define {x86_fp80, x86_fp80} @test() {
; ret
define {x86_fp80, x86_fp80} @test2() {
%A = fpext double 1.0 to x86_fp80
ret x86_fp80 %A, x86_fp80 %A
%mrv = insertvalue %0 undef, x86_fp80 %A, 0
%mrv1 = insertvalue %0 %mrv, x86_fp80 %A, 1
ret %0 %mrv1
}

; Uses both values.
Expand Down
16 changes: 0 additions & 16 deletions test/CodeGen/X86/multiple-return-values.ll

This file was deleted.

57 changes: 31 additions & 26 deletions test/Transforms/IPConstantProp/return-constants.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,43 @@
;; Check that the second return values didn't get propagated
; RUN: cat %t | grep {%N = add i32 %B, %D}

define internal {i32, i32} @foo(i1 %Q) {
br i1 %Q, label %T, label %F
%0 = type { i32, i32 }

T: ; preds = %0
ret i32 21, i32 22
define internal %0 @foo(i1 %Q) {
br i1 %Q, label %T, label %F

F: ; preds = %0
ret i32 21, i32 23
T: ; preds = %0
%mrv = insertvalue %0 undef, i32 21, 0
%mrv1 = insertvalue %0 %mrv, i32 22, 1
ret %0 %mrv1

F: ; preds = %0
%mrv2 = insertvalue %0 undef, i32 21, 0
%mrv3 = insertvalue %0 %mrv2, i32 23, 1
ret %0 %mrv3
}

define internal {i32, i32} @bar(i1 %Q) {
%A = insertvalue { i32, i32 } undef, i32 21, 0
br i1 %Q, label %T, label %F
define internal %0 @bar(i1 %Q) {
%A = insertvalue %0 undef, i32 21, 0
br i1 %Q, label %T, label %F

T: ; preds = %0
%B = insertvalue { i32, i32 } %A, i32 22, 1
ret { i32, i32 } %B
T: ; preds = %0
%B = insertvalue %0 %A, i32 22, 1
ret %0 %B

F: ; preds = %0
%C = insertvalue { i32, i32 } %A, i32 23, 1
ret { i32, i32 } %C
F: ; preds = %0
%C = insertvalue %0 %A, i32 23, 1
ret %0 %C
}

define { i32, i32 } @caller(i1 %Q) {
%X = call {i32, i32} @foo( i1 %Q )
%A = getresult {i32, i32} %X, 0
%B = getresult {i32, i32} %X, 1
%Y = call {i32, i32} @bar( i1 %Q )
%C = extractvalue {i32, i32} %Y, 0
%D = extractvalue {i32, i32} %Y, 1
%M = add i32 %A, %C
%N = add i32 %B, %D
ret { i32, i32 } %X
define %0 @caller(i1 %Q) {
%X = call %0 @foo(i1 %Q)
%A = extractvalue %0 %X, 0
%B = extractvalue %0 %X, 1
%Y = call %0 @bar(i1 %Q)
%C = extractvalue %0 %Y, 0
%D = extractvalue %0 %Y, 1
%M = add i32 %A, %C
%N = add i32 %B, %D
ret %0 %X
}

28 changes: 0 additions & 28 deletions test/Transforms/Inline/2008-03-04-StructRet.ll

This file was deleted.

53 changes: 0 additions & 53 deletions test/Transforms/Inline/2008-03-07-Inline-2.ll

This file was deleted.

57 changes: 0 additions & 57 deletions test/Transforms/Inline/2008-03-07-Inline.ll

This file was deleted.

11 changes: 0 additions & 11 deletions test/Transforms/InstCombine/2011-02-16-InsertelementHang.ll

This file was deleted.

Loading

0 comments on commit 437544f

Please sign in to comment.