summaryrefslogtreecommitdiff
path: root/tcg/sparc
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2016-06-19 22:59:13 -0700
committerRichard Henderson <rth@twiddle.net>2016-07-05 20:50:13 -0700
commit59d7c14eeff8d2ad7f61aed86ce5a176113bc153 (patch)
treea35fd8794ff364683cd31b650affc4f3d9289ce1 /tcg/sparc
parent120c1084ed53ba2967ba2a6e751cdfb00a17c246 (diff)
downloadqemu-59d7c14eeff8d2ad7f61aed86ce5a176113bc153.tar.gz
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 <rth@twiddle.net>
Diffstat (limited to 'tcg/sparc')
-rw-r--r--tcg/sparc/tcg-target.inc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tcg/sparc/tcg-target.inc.c b/tcg/sparc/tcg-target.inc.c
index 9938a5085e..8e98172ca0 100644
--- a/tcg/sparc/tcg-target.inc.c
+++ b/tcg/sparc/tcg-target.inc.c
@@ -504,6 +504,16 @@ static inline void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg,
tcg_out_ldst(s, arg, arg1, arg2, (type == TCG_TYPE_I32 ? STW : STX));
}
+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_G0, base, ofs);
+ return true;
+ }
+ return false;
+}
+
static void tcg_out_ld_ptr(TCGContext *s, TCGReg ret, uintptr_t arg)
{
tcg_out_movi(s, TCG_TYPE_PTR, ret, arg & ~0x3ff);