1. 28 10月, 2012 9 次提交
    • A
      tcg: rewrite tcg_reg_alloc_mov() · c29c1d7e
      Aurelien Jarno 提交于
      Now that the liveness analysis provides more information, rewrite
      tcg_reg_alloc_mov(). This changes the behaviour about propagating
      constants and memory accesses. We now take the assumption that once
      a value is loaded into a register (from memory or from a constant),
      it's better to keep it there than to reload it later. This assumption
      is now always almost correct given that we are now sure the
      corresponding temp is going to be used later (otherwise it would have
      been synchronized and marked as dead already). The assumption is wrong
      if one of the op after clobbers some registers including the one
      of the holding the temp (this can be avoided by allocating clobbered
      registers last, which is what most TCG target do), or in case of lack
      of available register.
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
      c29c1d7e
    • A
      tcg: improve tcg_reg_alloc_movi() · 4c4e1ab2
      Aurelien Jarno 提交于
      Now that the liveness analysis might mark some output temps as dead, call
      temp_dead() if needed.
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
      4c4e1ab2
    • A
      tcg: rework liveness analysis · 9c43b68d
      Aurelien Jarno 提交于
      Rework the liveness analysis by tracking temps that need to go back to
      memory in addition to dead temps tracking. This allows to mark output
      arguments as "need sync", and to synchronize them back to memory as soon
      as they are not written anymore. This way even arguments mapping to
      globals can be marked as "dead", avoiding moves to a new register when
      input and outputs are aliased.
      
      In addition it means that registers are freed as soon as temps are not
      used anymore, instead of waiting for a basic block end or an op with side
      effects. This reduces register spilling especially on CPUs with few
      registers, and spread the mov over all the TB, increasing the
      performances on in-order CPUs.
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
      9c43b68d
    • A
      tcg: sync output arguments on liveness request · ec7a869d
      Aurelien Jarno 提交于
      Synchronize an output argument when requested by the liveness analysis.
      This is needed so that the temp can be declared dead later.
      
      For that, add a new op_sync_args table in which each bit tells if the
      corresponding output argument needs to be synchronized with the memory.
      Pass it to the tcg_reg_alloc_* functions, and honor this bit. We need to
      synchronize the argument before marking it as dead, and we have to make
      sure all the infos about the temp are correctly filled.
      
      At the same time change some types from unsigned int to uint16_t when
      passing op_dead_args.
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
      ec7a869d
    • A
      tcg: add temp_sync() · 1ad80729
      Aurelien Jarno 提交于
      Add a new function temp_sync() to synchronize the canonical location
      of a temp with the value in the corresponding register, but without
      freeing the associated register. Rewrite temp_save() to call
      temp_sync() followed by temp_dead().
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
      1ad80729
    • A
      tcg: add tcg_reg_sync() · 7f6ceedf
      Aurelien Jarno 提交于
      Add a new function tcg_reg_sync() to synchronize the canonical location
      of a temp with the value in the associated register, but without freeing
      it. Rewrite tcg_reg_free() to first call tcg_reg_sync() and then to free
      the register.
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
      7f6ceedf
    • A
      tcg: add temp_dead() · 639368dd
      Aurelien Jarno 提交于
      A lot of code is duplicated to mark a temporary as dead. Replace it
      by temp_dead(), which in addition marks the temp as saved in memory
      for globals and local temps, instead of doing this a posteriori in
      temp_save().
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
      639368dd
    • A
      tcg/i386: remove ld/st third argument register constraint · 17b91491
      Aurelien Jarno 提交于
      On x86_64, remove the constraint on the third argument register which
      is not needed:
       - For loads the helper arguments are env, addr, mem_idx. The addr
         value should not be in the two first argument registers as they are
         used in tcg_out_tlb_load().
       - For stores the helper arguments are env, addr, data, mem_idx.
         The addr and data values should not be in the two first argument
         registers as they are used in tcg_out_tlb_load(). The data value
         should also not be in the two first argument registers, but could
         be in the third argument register in which case it would be already
         loaded at the right location.
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
      17b91491
    • A
      tcg/i386: remove suboptimal register shifting · 166792f7
      Aurelien Jarno 提交于
      Now that CONFIG_TCG_PASS_AREG0 has been removed, it's easier to get
      an optimal code for the load/store functions.
      
      First swap the two registers used in tcg_out_tlb_load() so that the
      address end-up in the second register instead of the first one. Adjust
      tcg_out_qemu_ld() and tcg_out_qemu_st() to respectively call
      tcg_out_qemu_ld_direct() and tcg_out_qemu_st_direct() with the correct
      registers. Then replace the register shifting by direct load of the
      arguments.
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
      166792f7
  2. 27 10月, 2012 8 次提交
  3. 25 10月, 2012 1 次提交
  4. 24 10月, 2012 13 次提交
  5. 23 10月, 2012 9 次提交