diff options
author | Mark Seaborn <mseaborn@chromium.org> | 2013-09-05 09:41:53 -0700 |
---|---|---|
committer | Mark Seaborn <mseaborn@chromium.org> | 2013-09-05 09:41:53 -0700 |
commit | cd4a14419f49fb236d65e5b69d871d6fc61fcb99 (patch) | |
tree | ddb320f736845f4aa93ef3ab42400f1fbf69584e /test | |
parent | 1180f259c88b1eb1000d0aaf5753b3da9f8e4e51 (diff) |
PNaCl bitcode: Indirect calls: Store return type instead of function type
For indirect call instructions (INST_CALL_INDIRECT), it's not
necessary to store the full function type. The argument types are
already known from the arguments in the instruction. We only need to
store the return type to be able to reconstruct the full function
type.
Storing only the return type ID will make the bitcode a little more
compact. Return type IDs will be frequently-used scalar types, which
can be given smaller type IDs than function types, which are less
frequently used.
This potentially makes the writer simpler: In principle, the writer no
longer needs to make a pass across all functions' bodies to determine
which function types are used in order to build the type table.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3544
TEST=*.ll tests
Review URL: https://codereview.chromium.org/23521005
Diffstat (limited to 'test')
-rw-r--r-- | test/NaCl/Bitcode/call-elide.ll | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/test/NaCl/Bitcode/call-elide.ll b/test/NaCl/Bitcode/call-elide.ll index adcd32a904..d7b93516cd 100644 --- a/test/NaCl/Bitcode/call-elide.ll +++ b/test/NaCl/Bitcode/call-elide.ll @@ -226,7 +226,7 @@ define void @IndirectCall(i32 %i) { ; PF2: <FUNCTION_BLOCK> ; PF2-NEXT: <DECLAREBLOCKS op0=1/> -; PF2-NEXT: <INST_CALL_INDIRECT op0=0 op1=1 op2=2 op3=1/> +; PF2-NEXT: <INST_CALL_INDIRECT op0=0 op1=1 op2=1 op3=1/> ; PF2-NEXT: <INST_RET/> ; PF2: </FUNCTION_BLOCK> @@ -260,16 +260,16 @@ define void @IndirectCallPtrToIntArg(i32 %i) { ; TD2: define void @IndirectCallPtrToIntArg(i32 %i) { ; TD2-NEXT: %1 = alloca i8, i32 4, align 8 -; TD2-NEXT: %2 = inttoptr i32 %i to void (i32)* -; TD2-NEXT: %3 = ptrtoint i8* %1 to i32 -; TD2-NEXT: call void %2(i32 %3) +; TD2-NEXT: %2 = ptrtoint i8* %1 to i32 +; TD2-NEXT: %3 = inttoptr i32 %i to void (i32)* +; TD2-NEXT: call void %3(i32 %2) ; TD2-NEXT: ret void ; TD2-NEXT: } ; PF2: <FUNCTION_BLOCK> ; PF2: </CONSTANTS_BLOCK> ; PF2-NEXT: <INST_ALLOCA op0=1 op1=4/> -; PF2-NEXT: <INST_CALL_INDIRECT op0=0 op1=3 op2=2 op3=1/> +; PF2-NEXT: <INST_CALL_INDIRECT op0=0 op1=3 op2=1 op3=1/> ; PF2-NEXT: <INST_RET/> ; PF2: </FUNCTION_BLOCK> @@ -299,15 +299,15 @@ define void @IndirectCallScalarArg(i32 %i, i32* %ptr) { ; PF1: </FUNCTION_BLOCK> ; TD2: define void @IndirectCallScalarArg(i32 %i, i32* %ptr) { -; TD2-NEXT: %1 = inttoptr i32 %i to void (i32)* -; TD2-NEXT: %2 = ptrtoint [4 x i8]* @bytes to i32 -; TD2-NEXT: call void %1(i32 %2) +; TD2-NEXT: %1 = ptrtoint [4 x i8]* @bytes to i32 +; TD2-NEXT: %2 = inttoptr i32 %i to void (i32)* +; TD2-NEXT: call void %2(i32 %1) ; TD2-NEXT: ret void ; TD2-NEXT: } ; PF2: <FUNCTION_BLOCK> ; PF2-NEXT: <DECLAREBLOCKS op0=1/> -; PF2-NEXT: <INST_CALL_INDIRECT op0=0 op1=2 op2=2 op3=3/> +; PF2-NEXT: <INST_CALL_INDIRECT op0=0 op1=2 op2=1 op3=3/> ; PF2-NEXT: <INST_RET/> ; PF2: </FUNCTION_BLOCK> |