remove asmparser support for the old getresult instruction, which has been subsumed by extractvalue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133247 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2011-06-17 06:57:15 +00:00
parent 437544f25c
commit 424545e950
13 changed files with 19 additions and 66 deletions

View File

@ -635,7 +635,6 @@ lltok::Kind LLLexer::LexIdentifier() {
INSTKEYWORD(extractelement, ExtractElement);
INSTKEYWORD(insertelement, InsertElement);
INSTKEYWORD(shufflevector, ShuffleVector);
INSTKEYWORD(getresult, ExtractValue);
INSTKEYWORD(extractvalue, ExtractValue);
INSTKEYWORD(insertvalue, InsertValue);
#undef INSTKEYWORD

View File

@ -3024,7 +3024,6 @@ int LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB,
return ParseStore(Inst, PFS, true);
else
return TokError("expected 'load' or 'store'");
case lltok::kw_getresult: return ParseGetResult(Inst, PFS);
case lltok::kw_getelementptr: return ParseGetElementPtr(Inst, PFS);
case lltok::kw_extractvalue: return ParseExtractValue(Inst, PFS);
case lltok::kw_insertvalue: return ParseInsertValue(Inst, PFS);
@ -3717,25 +3716,6 @@ int LLParser::ParseStore(Instruction *&Inst, PerFunctionState &PFS,
return AteExtraComma ? InstExtraComma : InstNormal;
}
/// ParseGetResult
/// ::= 'getresult' TypeAndValue ',' i32
/// FIXME: Remove support for getresult in LLVM 3.0
bool LLParser::ParseGetResult(Instruction *&Inst, PerFunctionState &PFS) {
Value *Val; LocTy ValLoc, EltLoc;
unsigned Element;
if (ParseTypeAndValue(Val, ValLoc, PFS) ||
ParseToken(lltok::comma, "expected ',' after getresult operand") ||
ParseUInt32(Element, EltLoc))
return true;
if (!Val->getType()->isStructTy() && !Val->getType()->isArrayTy())
return Error(ValLoc, "getresult inst requires an aggregate operand");
if (!ExtractValueInst::getIndexedType(Val->getType(), Element))
return Error(EltLoc, "invalid getresult index for value");
Inst = ExtractValueInst::Create(Val, Element);
return false;
}
/// ParseGetElementPtr
/// ::= 'getelementptr' 'inbounds'? TypeAndValue (',' TypeAndValue)*
int LLParser::ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) {

View File

@ -361,7 +361,6 @@ namespace llvm {
int ParseAlloc(Instruction *&I, PerFunctionState &PFS);
int ParseLoad(Instruction *&I, PerFunctionState &PFS, bool isVolatile);
int ParseStore(Instruction *&I, PerFunctionState &PFS, bool isVolatile);
bool ParseGetResult(Instruction *&I, PerFunctionState &PFS);
int ParseGetElementPtr(Instruction *&I, PerFunctionState &PFS);
int ParseExtractValue(Instruction *&I, PerFunctionState &PFS);
int ParseInsertValue(Instruction *&I, PerFunctionState &PFS);

View File

@ -123,7 +123,7 @@ namespace lltok {
kw_alloca, kw_load, kw_store, kw_getelementptr,
kw_extractelement, kw_insertelement, kw_shufflevector, kw_getresult,
kw_extractelement, kw_insertelement, kw_shufflevector,
kw_extractvalue, kw_insertvalue, kw_blockaddress,
// Unsigned Valued tokens (UIntVal).

View File

@ -1,19 +0,0 @@
; RUN: llc < %s -march=c
declare {i32, i32} @foo()
define i32 @test() {
%A = call {i32, i32} @foo()
%B = getresult {i32, i32} %A, 0
%C = getresult {i32, i32} %A, 1
%D = add i32 %B, %C
ret i32 %D
}
define i32 @test2() {
%A = call {i32, i32} asm sideeffect "...", "={cx},={di},~{dirflag},~{fpsr},~{flags},~{memory}"()
%B = getresult {i32, i32} %A, 0
%C = getresult {i32, i32} %A, 1
%D = add i32 %B, %C
ret i32 %D
}

View File

@ -1,6 +0,0 @@
; RUN: llc < %s
define double @foo() {
%t = getresult {double, double} undef, 1
ret double %t
}

View File

@ -6,9 +6,9 @@ define void @foo(i64* %p, double* %q) nounwind {
%t = invoke { i64, double } @wild() to label %normal unwind label %handler
normal:
%mrv_gr = getresult { i64, double } %t, 0
%mrv_gr = extractvalue { i64, double } %t, 0
store i64 %mrv_gr, i64* %p
%mrv_gr12681 = getresult { i64, double } %t, 1
%mrv_gr12681 = extractvalue { i64, double } %t, 1
store double %mrv_gr12681, double* %q
ret void

View File

@ -28,10 +28,10 @@ define {x86_fp80, x86_fp80} @test2() {
; Uses both values.
define void @call1(x86_fp80 *%P1, x86_fp80 *%P2) {
%a = call {x86_fp80,x86_fp80} @test()
%b = getresult {x86_fp80,x86_fp80} %a, 0
%b = extractvalue {x86_fp80,x86_fp80} %a, 0
store x86_fp80 %b, x86_fp80* %P1
%c = getresult {x86_fp80,x86_fp80} %a, 1
%c = extractvalue {x86_fp80,x86_fp80} %a, 1
store x86_fp80 %c, x86_fp80* %P2
ret void
}
@ -39,10 +39,10 @@ define void @call1(x86_fp80 *%P1, x86_fp80 *%P2) {
; Uses both values, requires fxch
define void @call2(x86_fp80 *%P1, x86_fp80 *%P2) {
%a = call {x86_fp80,x86_fp80} @test()
%b = getresult {x86_fp80,x86_fp80} %a, 1
%b = extractvalue {x86_fp80,x86_fp80} %a, 1
store x86_fp80 %b, x86_fp80* %P1
%c = getresult {x86_fp80,x86_fp80} %a, 0
%c = extractvalue {x86_fp80,x86_fp80} %a, 0
store x86_fp80 %c, x86_fp80* %P2
ret void
}
@ -50,7 +50,7 @@ define void @call2(x86_fp80 *%P1, x86_fp80 *%P2) {
; Uses ST(0), ST(1) is dead but must be popped.
define void @call3(x86_fp80 *%P1, x86_fp80 *%P2) {
%a = call {x86_fp80,x86_fp80} @test()
%b = getresult {x86_fp80,x86_fp80} %a, 0
%b = extractvalue {x86_fp80,x86_fp80} %a, 0
store x86_fp80 %b, x86_fp80* %P1
ret void
}
@ -59,7 +59,7 @@ define void @call3(x86_fp80 *%P1, x86_fp80 *%P2) {
define void @call4(x86_fp80 *%P1, x86_fp80 *%P2) {
%a = call {x86_fp80,x86_fp80} @test()
%c = getresult {x86_fp80,x86_fp80} %a, 1
%c = extractvalue {x86_fp80,x86_fp80} %a, 1
store x86_fp80 %c, x86_fp80* %P2
ret void
}

View File

@ -11,7 +11,7 @@ define i32 @test1(i8* %v, i8* %blk2, i8* %blk1, i32 %stride, i32 %h) nounwind {
%tmp12 = sext i32 %stride to i64 ; <i64> [#uses=1]
%mrv = call {i32, i8*, i8*} asm sideeffect "$0 $1 $2 $3 $4 $5 $6",
"=r,=r,=r,r,r,r,r"( i64 %tmp12, i32 %h, i8* %blk1, i8* %blk2 ) nounwind
%tmp6 = getresult {i32, i8*, i8*} %mrv, 0
%tmp6 = extractvalue {i32, i8*, i8*} %mrv, 0
%tmp7 = call i32 asm sideeffect "set $0",
"=r,~{dirflag},~{fpsr},~{flags}"( ) nounwind
ret i32 %tmp7
@ -19,16 +19,16 @@ define i32 @test1(i8* %v, i8* %blk2, i8* %blk1, i32 %stride, i32 %h) nounwind {
define <4 x float> @test2() nounwind {
%mrv = call {<4 x float>, <4 x float>} asm "set $0, $1", "=x,=x"()
%a = getresult {<4 x float>, <4 x float>} %mrv, 0
%b = getresult {<4 x float>, <4 x float>} %mrv, 1
%a = extractvalue {<4 x float>, <4 x float>} %mrv, 0
%b = extractvalue {<4 x float>, <4 x float>} %mrv, 1
%c = fadd <4 x float> %a, %b
ret <4 x float> %c
}
define <4 x i32> @test3() nounwind {
%mrv = call {<4 x i32>, <4 x i32>} asm "set $0, $1", "=x,=x"()
%a = getresult {<4 x i32>, <4 x i32>} %mrv, 0
%b = getresult {<4 x i32>, <4 x i32>} %mrv, 1
%a = extractvalue {<4 x i32>, <4 x i32>} %mrv, 0
%b = extractvalue {<4 x i32>, <4 x i32>} %mrv, 1
%c = add <4 x i32> %a, %b
ret <4 x i32> %c
}

View File

@ -4,12 +4,12 @@ declare {x86_fp80, x86_fp80} @test()
define void @call2(x86_fp80 *%P1, x86_fp80 *%P2) {
%a = call {x86_fp80,x86_fp80} @test()
%b = getresult {x86_fp80,x86_fp80} %a, 1
%b = extractvalue {x86_fp80,x86_fp80} %a, 1
store x86_fp80 %b, x86_fp80* %P1
br label %L
L:
%c = getresult {x86_fp80,x86_fp80} %a, 0
%c = extractvalue {x86_fp80,x86_fp80} %a, 0
store x86_fp80 %c, x86_fp80* %P2
ret void
}

View File

@ -18,7 +18,7 @@ bb13: ; preds = %bb
br label %bb
bb110: ; preds = %bb
%mrv_gr124 = getresult %struct.system__secondary_stack__mark_id %tmp120, 1 ; <i64> [#uses=0]
%mrv_gr124 = extractvalue %struct.system__secondary_stack__mark_id %tmp120, 1 ; <i64> [#uses=0]
unreachable
}

View File

@ -113,7 +113,7 @@ bb116: ; preds = %bb131, %entry
br i1 false, label %bb141, label %bb131
bb131: ; preds = %bb116
%mrv_gr125 = getresult %struct.NSRange %tmp123, 1 ; <i64> [#uses=0]
%mrv_gr125 = extractvalue %struct.NSRange %tmp123, 1 ; <i64> [#uses=0]
br label %bb116
bb141: ; preds = %bb116

View File

@ -5,7 +5,7 @@ declare {i32, i32} @bar(i32 %A)
define i32 @foo() {
%X = call {i32, i32} @bar(i32 17)
%Y = getresult {i32, i32} %X, 0
%Y = extractvalue {i32, i32} %X, 0
%Z = add i32 %Y, %Y
ret i32 %Z
}