Commit 79d342dc6bc04c3bc4c1141760ad6e241059b139

Authored by aurel32
1 parent 8215e914

tcg/x86_64: optimize register allocation order

The beginning of the register allocation order list on the TCG x86_64
target matches the list of clobbered registers. This means that when an
helper is called, there is almost always clobbered registers that have
to be spilled.

The same way register %rsi and %rdi are at the top of the register
allocation order list, while they can't be used for load/store
operations. This means the data and/or address registers are very often
%rsi and %rdi, and their values have to be spilled, and then moved back
to another register.

This patches changes to the allocation order to avoid those effects.
It results in a 8% gain speed in qemu-x86_64 to compress a bzip2 file,
and a 6% gain in qemu-system-mips64 to compile a small application.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7003 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 9 additions and 10 deletions
tcg/x86_64/tcg-target.c
@@ -44,22 +44,21 @@ static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { @@ -44,22 +44,21 @@ static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
44 #endif 44 #endif
45 45
46 static const int tcg_target_reg_alloc_order[] = { 46 static const int tcg_target_reg_alloc_order[] = {
47 - TCG_REG_RDI,  
48 - TCG_REG_RSI,  
49 - TCG_REG_RDX,  
50 - TCG_REG_RCX,  
51 - TCG_REG_R8,  
52 - TCG_REG_R9,  
53 - TCG_REG_RAX,  
54 - TCG_REG_R10,  
55 - TCG_REG_R11,  
56 -  
57 TCG_REG_RBP, 47 TCG_REG_RBP,
58 TCG_REG_RBX, 48 TCG_REG_RBX,
59 TCG_REG_R12, 49 TCG_REG_R12,
60 TCG_REG_R13, 50 TCG_REG_R13,
61 TCG_REG_R14, 51 TCG_REG_R14,
62 TCG_REG_R15, 52 TCG_REG_R15,
  53 + TCG_REG_R10,
  54 + TCG_REG_R11,
  55 + TCG_REG_R9,
  56 + TCG_REG_R8,
  57 + TCG_REG_RCX,
  58 + TCG_REG_RDX,
  59 + TCG_REG_RSI,
  60 + TCG_REG_RDI,
  61 + TCG_REG_RAX,
63 }; 62 };
64 63
65 static const int tcg_target_call_iarg_regs[6] = { 64 static const int tcg_target_call_iarg_regs[6] = {