summaryrefslogtreecommitdiffstats
path: root/tcg/tcg.c
diff options
context:
space:
mode:
authorPeter Maydell2016-10-24 16:03:09 +0200
committerPeter Maydell2016-10-24 16:03:09 +0200
commita3ae21ec3fe036f536dc94cad735931777143103 (patch)
treeb8110b4ad3a2a21f68f9273acfb704c2c49ceb19 /tcg/tcg.c
parentMerge remote-tracking branch 'remotes/sstabellini/tags/xen-20161021-tag' into... (diff)
parentexec.c: workaround regression caused by alignment change in d2f39ad (diff)
downloadqemu-a3ae21ec3fe036f536dc94cad735931777143103.tar.gz
qemu-a3ae21ec3fe036f536dc94cad735931777143103.tar.xz
qemu-a3ae21ec3fe036f536dc94cad735931777143103.zip
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* KVM run_on_cpu fix (Alex) * atomic usage fixes (Emilio, me) * hugetlbfs alignment fix (Haozhong) * CharBackend refactoring (Marc-André) * test-i386 fixes (me) * MemoryListener optimizations (me) * Miscellaneous bugfixes (me) * iSER support (Roy) * --version formatting (Thomas) # gpg: Signature made Mon 24 Oct 2016 14:46:19 BST # gpg: using RSA key 0xBFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: (50 commits) exec.c: workaround regression caused by alignment change in d2f39ad char: remove explicit_be_open from CharDriverState char: use common error path in qmp_chardev_add char: replace avail_connections char: remove unused qemu_chr_fe_event char: use an enum for CHR_EVENT char: remove unused CHR_EVENT_FOCUS char: move fe_open in CharBackend char: remove explicit_fe_open, use a set_handlers argument char: rename chr_close/chr_free char: move front end handlers in CharBackend tests: start chardev unit tests char: make some qemu_chr_fe skip if no driver char: replace qemu_chr_claim/release with qemu_chr_fe_init/deinit vhost-user: only initialize queue 0 CharBackend char: fold qemu_chr_set_handlers in qemu_chr_fe_set_handlers char: use qemu_chr_fe* functions with CharBackend argument colo: claim in find_and_check_chardev char: rename some frontend functions char: remaining switch to CharBackend in frontend ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tcg/tcg.c')
-rw-r--r--tcg/tcg.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/tcg/tcg.c b/tcg/tcg.c
index c450c6273b..2d3e498bc2 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -2097,15 +2097,9 @@ static void tcg_reg_alloc_bb_end(TCGContext *s, TCGRegSet allocated_regs)
save_globals(s, allocated_regs);
}
-static void tcg_reg_alloc_movi(TCGContext *s, const TCGArg *args,
- TCGLifeData arg_life)
+static void tcg_reg_alloc_do_movi(TCGContext *s, TCGTemp *ots,
+ tcg_target_ulong val, TCGLifeData arg_life)
{
- TCGTemp *ots;
- tcg_target_ulong val;
-
- ots = &s->temps[args[0]];
- val = args[1];
-
if (ots->fixed_reg) {
/* For fixed registers, we do not do any constant propagation. */
tcg_out_movi(s, ots->type, ots->reg, val);
@@ -2126,6 +2120,15 @@ static void tcg_reg_alloc_movi(TCGContext *s, const TCGArg *args,
}
}
+static void tcg_reg_alloc_movi(TCGContext *s, const TCGArg *args,
+ TCGLifeData arg_life)
+{
+ TCGTemp *ots = &s->temps[args[0]];
+ tcg_target_ulong val = args[1];
+
+ tcg_reg_alloc_do_movi(s, ots, val, arg_life);
+}
+
static void tcg_reg_alloc_mov(TCGContext *s, const TCGOpDef *def,
const TCGArg *args, TCGLifeData arg_life)
{
@@ -2141,21 +2144,29 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOpDef *def,
otype = ots->type;
itype = ts->type;
- /* If the source value is not in a register, and we're going to be
- forced to have it in a register in order to perform the copy,
- then copy the SOURCE value into its own register first. That way
- we don't have to reload SOURCE the next time it is used. */
- if (((NEED_SYNC_ARG(0) || ots->fixed_reg) && ts->val_type != TEMP_VAL_REG)
- || ts->val_type == TEMP_VAL_MEM) {
+ if (ts->val_type == TEMP_VAL_CONST) {
+ /* propagate constant or generate sti */
+ tcg_target_ulong val = ts->val;
+ if (IS_DEAD_ARG(1)) {
+ temp_dead(s, ts);
+ }
+ tcg_reg_alloc_do_movi(s, ots, val, arg_life);
+ return;
+ }
+
+ /* If the source value is in memory we're going to be forced
+ to have it in a register in order to perform the copy. Copy
+ the SOURCE value into its own register first, that way we
+ don't have to reload SOURCE the next time it is used. */
+ if (ts->val_type == TEMP_VAL_MEM) {
temp_load(s, ts, tcg_target_available_regs[itype], allocated_regs);
}
+ tcg_debug_assert(ts->val_type == TEMP_VAL_REG);
if (IS_DEAD_ARG(0) && !ots->fixed_reg) {
/* mov to a non-saved dead register makes no sense (even with
liveness analysis disabled). */
tcg_debug_assert(NEED_SYNC_ARG(0));
- /* The code above should have moved the temp to a register. */
- tcg_debug_assert(ts->val_type == TEMP_VAL_REG);
if (!ots->mem_allocated) {
temp_allocate_frame(s, args[0]);
}
@@ -2164,20 +2175,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOpDef *def,
temp_dead(s, ts);
}
temp_dead(s, ots);
- } else if (ts->val_type == TEMP_VAL_CONST) {
- /* propagate constant */
- if (ots->val_type == TEMP_VAL_REG) {
- s->reg_to_temp[ots->reg] = NULL;
- }
- ots->val_type = TEMP_VAL_CONST;
- ots->val = ts->val;
- if (IS_DEAD_ARG(1)) {
- temp_dead(s, ts);
- }
} else {
- /* The code in the first if block should have moved the
- temp to a register. */
- tcg_debug_assert(ts->val_type == TEMP_VAL_REG);
if (IS_DEAD_ARG(1) && !ts->fixed_reg && !ots->fixed_reg) {
/* the mov can be suppressed */
if (ots->val_type == TEMP_VAL_REG) {