[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 0/4] tcg: Remove unreachable code
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH 0/4] tcg: Remove unreachable code |
Date: |
Mon, 26 Nov 2018 15:04:46 -0800 |
I've been meaning to add a trivial cleanup pass like this for some time.
There have occasionally been instaces within front ends wherein we want
to raise an invalid operand exception (or some such) deep within a set
of subroutines. And without a longjmp (or some such) back to the top
level of the translator loop we must return a dummy value so that we
produce valid tcg code following the exception.
While we still probably have to return a dummy value, we can clean up
the dead code that follows the exception.
In addition, when optimization is able to fold a conditional branch,
the original code sequence:
brcond x,y,$L1
goto_tb
mov pc,foo
exit_tb $1
set_label $L1
goto_tb
mov pc,bar
exit_tb $2
The initial brcond is either folded to br, or removed as a never taken
branch, which leaves one of the two sets of goto_tb ... exit_tb unreachable.
With this we can completely remove the code for the dead branch.
While I do not expect this to have any noticable effect, this dead
code could get in the way of some other changes that I'm planning.
r~
Richard Henderson (4):
tcg: Renumber TCG_CALL_* flags
tcg: Add TCG_CALL_NO_RETURN
tcg: Reference count labels
tcg: Add reachable_code_pass
include/exec/helper-head.h | 13 ++++++
include/exec/helper-tcg.h | 21 ++++++---
tcg/tcg-op.h | 1 +
tcg/tcg.h | 11 +++--
tcg/tcg-op.c | 2 +
tcg/tcg.c | 96 ++++++++++++++++++++++++++++++++++++++
6 files changed, 133 insertions(+), 11 deletions(-)
--
2.17.2
- [Qemu-devel] [PATCH 0/4] tcg: Remove unreachable code,
Richard Henderson <=
- [Qemu-devel] [PATCH 1/4] tcg: Renumber TCG_CALL_* flags, Richard Henderson, 2018/11/26
- [Qemu-devel] [PATCH 2/4] tcg: Add TCG_CALL_NO_RETURN, Richard Henderson, 2018/11/26
- [Qemu-devel] [PATCH 3/4] tcg: Reference count labels, Richard Henderson, 2018/11/26
- [Qemu-devel] [PATCH 4/4] tcg: Add reachable_code_pass, Richard Henderson, 2018/11/26
- Re: [Qemu-devel] [PATCH 0/4] tcg: Remove unreachable code, no-reply, 2018/11/28