From 59d7c14eeff8d2ad7f61aed86ce5a176113bc153 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sun, 19 Jun 2016 22:59:13 -0700 Subject: tcg: Optimize spills of constants While we can store constants via constrants on INDEX_op_st_i32 et al, we weren't able to spill constants to backing store. Add a new backend interface, tcg_out_sti, which may store the constant (and is allowed to fail). Rearrange the temp_* helpers so that we only attempt to directly store a constant when the temp is becoming dead/free. Signed-off-by: Richard Henderson --- tcg/mips/tcg-target.inc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tcg/mips') diff --git a/tcg/mips/tcg-target.inc.c b/tcg/mips/tcg-target.inc.c index 50e98ea63a..2f9be48139 100644 --- a/tcg/mips/tcg-target.inc.c +++ b/tcg/mips/tcg-target.inc.c @@ -576,6 +576,16 @@ static inline void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, tcg_out_ldst(s, OPC_SW, arg, arg1, arg2); } +static inline bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, + TCGReg base, intptr_t ofs) +{ + if (val == 0) { + tcg_out_st(s, type, TCG_REG_ZERO, base, ofs); + return true; + } + return false; +} + static inline void tcg_out_addi(TCGContext *s, TCGReg reg, TCGArg val) { if (val == (int16_t)val) { -- cgit v1.2.3