aboutsummaryrefslogtreecommitdiff
path: root/tcg/optimize.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2020-03-29 18:55:52 -0700
committerRichard Henderson <richard.henderson@linaro.org>2021-01-13 08:39:08 -1000
commitc0522136adf550c7a0ef7c0755c1f9d1560d2757 (patch)
tree90372af801dd6a822e7be60b00a334e91f5d5845 /tcg/optimize.c
parent54795544e4cfb2fa198f7ca244b5ea9eaad322d4 (diff)
downloadqemu-c0522136adf550c7a0ef7c0755c1f9d1560d2757.zip
qemu-c0522136adf550c7a0ef7c0755c1f9d1560d2757.tar.gz
qemu-c0522136adf550c7a0ef7c0755c1f9d1560d2757.tar.bz2
tcg: Introduce TYPE_CONST temporaries
These will hold a single constant for the duration of the TB. They are hashed, so that each value has one temp across the TB. Not used yet, this is all infrastructure. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg/optimize.c')
-rw-r--r--tcg/optimize.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 433d254..16b0aa7 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -99,8 +99,17 @@ static void init_ts_info(TempOptInfo *infos,
ts->state_ptr = ti;
ti->next_copy = ts;
ti->prev_copy = ts;
- ti->is_const = false;
- ti->mask = -1;
+ if (ts->kind == TEMP_CONST) {
+ ti->is_const = true;
+ ti->val = ti->mask = ts->val;
+ if (TCG_TARGET_REG_BITS > 32 && ts->type == TCG_TYPE_I32) {
+ /* High bits of a 32-bit quantity are garbage. */
+ ti->mask |= ~0xffffffffull;
+ }
+ } else {
+ ti->is_const = false;
+ ti->mask = -1;
+ }
set_bit(idx, temps_used->l);
}
}