qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/4] tcg: Remove unreachable code
@ 2018-11-26 23:04 Richard Henderson
  2018-11-26 23:04 ` [Qemu-devel] [PATCH 1/4] tcg: Renumber TCG_CALL_* flags Richard Henderson
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Richard Henderson @ 2018-11-26 23:04 UTC (permalink / raw)
  To: qemu-devel

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-12-24 22:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-26 23:04 [Qemu-devel] [PATCH 0/4] tcg: Remove unreachable code Richard Henderson
2018-11-26 23:04 ` [Qemu-devel] [PATCH 1/4] tcg: Renumber TCG_CALL_* flags Richard Henderson
2018-11-26 23:04 ` [Qemu-devel] [PATCH 2/4] tcg: Add TCG_CALL_NO_RETURN Richard Henderson
2018-11-26 23:04 ` [Qemu-devel] [PATCH 3/4] tcg: Reference count labels Richard Henderson
2018-11-26 23:04 ` [Qemu-devel] [PATCH 4/4] tcg: Add reachable_code_pass Richard Henderson
2018-12-24 22:10   ` Emilio G. Cota
2018-11-28 15:27 ` [Qemu-devel] [PATCH 0/4] tcg: Remove unreachable code no-reply

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).