llvm.org GIT mirror llvm / 424545e
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 Chris Lattner 9 years ago
13 changed file(s) with 19 addition(s) and 66 deletion(s). Raw diff Collapse all Expand all
634634 INSTKEYWORD(extractelement, ExtractElement);
635635 INSTKEYWORD(insertelement, InsertElement);
636636 INSTKEYWORD(shufflevector, ShuffleVector);
637 INSTKEYWORD(getresult, ExtractValue);
638637 INSTKEYWORD(extractvalue, ExtractValue);
639638 INSTKEYWORD(insertvalue, InsertValue);
640639 #undef INSTKEYWORD
30233023 return ParseStore(Inst, PFS, true);
30243024 else
30253025 return TokError("expected 'load' or 'store'");
3026 case lltok::kw_getresult: return ParseGetResult(Inst, PFS);
30273026 case lltok::kw_getelementptr: return ParseGetElementPtr(Inst, PFS);
30283027 case lltok::kw_extractvalue: return ParseExtractValue(Inst, PFS);
30293028 case lltok::kw_insertvalue: return ParseInsertValue(Inst, PFS);
37163715 return AteExtraComma ? InstExtraComma : InstNormal;
37173716 }
37183717
3719 /// ParseGetResult
3720 /// ::= 'getresult' TypeAndValue ',' i32
3721 /// FIXME: Remove support for getresult in LLVM 3.0
3722 bool LLParser::ParseGetResult(Instruction *&Inst, PerFunctionState &PFS) {
3723 Value *Val; LocTy ValLoc, EltLoc;
3724 unsigned Element;
3725 if (ParseTypeAndValue(Val, ValLoc, PFS) ||
3726 ParseToken(lltok::comma, "expected ',' after getresult operand") ||
3727 ParseUInt32(Element, EltLoc))
3728 return true;
3729
3730 if (!Val->getType()->isStructTy() && !Val->getType()->isArrayTy())
3731 return Error(ValLoc, "getresult inst requires an aggregate operand");
3732 if (!ExtractValueInst::getIndexedType(Val->getType(), Element))
3733 return Error(EltLoc, "invalid getresult index for value");
3734 Inst = ExtractValueInst::Create(Val, Element);
3735 return false;
3736 }
3737
37383718 /// ParseGetElementPtr
37393719 /// ::= 'getelementptr' 'inbounds'? TypeAndValue (',' TypeAndValue)*
37403720 int LLParser::ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) {
360360 int ParseAlloc(Instruction *&I, PerFunctionState &PFS);
361361 int ParseLoad(Instruction *&I, PerFunctionState &PFS, bool isVolatile);
362362 int ParseStore(Instruction *&I, PerFunctionState &PFS, bool isVolatile);
363 bool ParseGetResult(Instruction *&I, PerFunctionState &PFS);
364363 int ParseGetElementPtr(Instruction *&I, PerFunctionState &PFS);
365364 int ParseExtractValue(Instruction *&I, PerFunctionState &PFS);
366365 int ParseInsertValue(Instruction *&I, PerFunctionState &PFS);
122122
123123 kw_alloca, kw_load, kw_store, kw_getelementptr,
124124
125 kw_extractelement, kw_insertelement, kw_shufflevector, kw_getresult,
125 kw_extractelement, kw_insertelement, kw_shufflevector,
126126 kw_extractvalue, kw_insertvalue, kw_blockaddress,
127127
128128 // Unsigned Valued tokens (UIntVal).
+0
-19
test/CodeGen/CBackend/2008-05-21-MRV-InlineAsm.ll less more
None ; RUN: llc < %s -march=c
1
2 declare {i32, i32} @foo()
3
4 define i32 @test() {
5 %A = call {i32, i32} @foo()
6 %B = getresult {i32, i32} %A, 0
7 %C = getresult {i32, i32} %A, 1
8 %D = add i32 %B, %C
9 ret i32 %D
10 }
11
12 define i32 @test2() {
13 %A = call {i32, i32} asm sideeffect "...", "={cx},={di},~{dirflag},~{fpsr},~{flags},~{memory}"()
14 %B = getresult {i32, i32} %A, 0
15 %C = getresult {i32, i32} %A, 1
16 %D = add i32 %B, %C
17 ret i32 %D
18 }
+0
-6
test/CodeGen/Generic/getresult-undef.ll less more
None ; RUN: llc < %s
1
2 define double @foo() {
3 %t = getresult {double, double} undef, 1
4 ret double %t
5 }
55 %t = invoke { i64, double } @wild() to label %normal unwind label %handler
66
77 normal:
8 %mrv_gr = getresult { i64, double } %t, 0
8 %mrv_gr = extractvalue { i64, double } %t, 0
99 store i64 %mrv_gr, i64* %p
10 %mrv_gr12681 = getresult { i64, double } %t, 1
10 %mrv_gr12681 = extractvalue { i64, double } %t, 1
1111 store double %mrv_gr12681, double* %q
1212 ret void
1313
2727 ; Uses both values.
2828 define void @call1(x86_fp80 *%P1, x86_fp80 *%P2) {
2929 %a = call {x86_fp80,x86_fp80} @test()
30 %b = getresult {x86_fp80,x86_fp80} %a, 0
30 %b = extractvalue {x86_fp80,x86_fp80} %a, 0
3131 store x86_fp80 %b, x86_fp80* %P1
3232
33 %c = getresult {x86_fp80,x86_fp80} %a, 1
33 %c = extractvalue {x86_fp80,x86_fp80} %a, 1
3434 store x86_fp80 %c, x86_fp80* %P2
3535 ret void
3636 }
3838 ; Uses both values, requires fxch
3939 define void @call2(x86_fp80 *%P1, x86_fp80 *%P2) {
4040 %a = call {x86_fp80,x86_fp80} @test()
41 %b = getresult {x86_fp80,x86_fp80} %a, 1
41 %b = extractvalue {x86_fp80,x86_fp80} %a, 1
4242 store x86_fp80 %b, x86_fp80* %P1
4343
44 %c = getresult {x86_fp80,x86_fp80} %a, 0
44 %c = extractvalue {x86_fp80,x86_fp80} %a, 0
4545 store x86_fp80 %c, x86_fp80* %P2
4646 ret void
4747 }
4949 ; Uses ST(0), ST(1) is dead but must be popped.
5050 define void @call3(x86_fp80 *%P1, x86_fp80 *%P2) {
5151 %a = call {x86_fp80,x86_fp80} @test()
52 %b = getresult {x86_fp80,x86_fp80} %a, 0
52 %b = extractvalue {x86_fp80,x86_fp80} %a, 0
5353 store x86_fp80 %b, x86_fp80* %P1
5454 ret void
5555 }
5858 define void @call4(x86_fp80 *%P1, x86_fp80 *%P2) {
5959 %a = call {x86_fp80,x86_fp80} @test()
6060
61 %c = getresult {x86_fp80,x86_fp80} %a, 1
61 %c = extractvalue {x86_fp80,x86_fp80} %a, 1
6262 store x86_fp80 %c, x86_fp80* %P2
6363 ret void
6464 }
1010 %tmp12 = sext i32 %stride to i64 ; [#uses=1]
1111 %mrv = call {i32, i8*, i8*} asm sideeffect "$0 $1 $2 $3 $4 $5 $6",
1212 "=r,=r,=r,r,r,r,r"( i64 %tmp12, i32 %h, i8* %blk1, i8* %blk2 ) nounwind
13 %tmp6 = getresult {i32, i8*, i8*} %mrv, 0
13 %tmp6 = extractvalue {i32, i8*, i8*} %mrv, 0
1414 %tmp7 = call i32 asm sideeffect "set $0",
1515 "=r,~{dirflag},~{fpsr},~{flags}"( ) nounwind
1616 ret i32 %tmp7
1818
1919 define <4 x float> @test2() nounwind {
2020 %mrv = call {<4 x float>, <4 x float>} asm "set $0, $1", "=x,=x"()
21 %a = getresult {<4 x float>, <4 x float>} %mrv, 0
22 %b = getresult {<4 x float>, <4 x float>} %mrv, 1
21 %a = extractvalue {<4 x float>, <4 x float>} %mrv, 0
22 %b = extractvalue {<4 x float>, <4 x float>} %mrv, 1
2323 %c = fadd <4 x float> %a, %b
2424 ret <4 x float> %c
2525 }
2626
2727 define <4 x i32> @test3() nounwind {
2828 %mrv = call {<4 x i32>, <4 x i32>} asm "set $0, $1", "=x,=x"()
29 %a = getresult {<4 x i32>, <4 x i32>} %mrv, 0
30 %b = getresult {<4 x i32>, <4 x i32>} %mrv, 1
29 %a = extractvalue {<4 x i32>, <4 x i32>} %mrv, 0
30 %b = extractvalue {<4 x i32>, <4 x i32>} %mrv, 1
3131 %c = add <4 x i32> %a, %b
3232 ret <4 x i32> %c
3333 }
33
44 define void @call2(x86_fp80 *%P1, x86_fp80 *%P2) {
55 %a = call {x86_fp80,x86_fp80} @test()
6 %b = getresult {x86_fp80,x86_fp80} %a, 1
6 %b = extractvalue {x86_fp80,x86_fp80} %a, 1
77 store x86_fp80 %b, x86_fp80* %P1
88 br label %L
99
1010 L:
11 %c = getresult {x86_fp80,x86_fp80} %a, 0
11 %c = extractvalue {x86_fp80,x86_fp80} %a, 0
1212 store x86_fp80 %c, x86_fp80* %P2
1313 ret void
1414 }
1717 br label %bb
1818
1919 bb110: ; preds = %bb
20 %mrv_gr124 = getresult %struct.system__secondary_stack__mark_id %tmp120, 1 ; [#uses=0]
20 %mrv_gr124 = extractvalue %struct.system__secondary_stack__mark_id %tmp120, 1 ; [#uses=0]
2121 unreachable
2222 }
2323
112112 br i1 false, label %bb141, label %bb131
113113
114114 bb131: ; preds = %bb116
115 %mrv_gr125 = getresult %struct.NSRange %tmp123, 1 ; [#uses=0]
115 %mrv_gr125 = extractvalue %struct.NSRange %tmp123, 1 ; [#uses=0]
116116 br label %bb116
117117
118118 bb141: ; preds = %bb116
44
55 define i32 @foo() {
66 %X = call {i32, i32} @bar(i32 17)
7 %Y = getresult {i32, i32} %X, 0
7 %Y = extractvalue {i32, i32} %X, 0
88 %Z = add i32 %Y, %Y
99 ret i32 %Z
1010 }