diff mbox

[lra] patch to discourage some register usage on x86/x86-64

Message ID 4F677F99.8060501@redhat.com
State New
Headers show

Commit Message

Vladimir Makarov March 19, 2012, 6:48 p.m. UTC
The following patch discourages usage of BP, R12, and R13 as it results 
in larger addresses on x86/x86-64.

Committed as rev. 185533.

2012-03-19  Vladimir Makarov <vmakarov@redhat.com>

         * config/i386/i386.c (ix86_register_bank): Add special treatment
         for BP, R12, and R13.
diff mbox

Patch

Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 185531)
+++ config/i386/i386.c	(working copy)
@@ -30508,14 +30508,21 @@  ix86_free_from_memory (enum machine_mode
 static int
 ix86_register_bank (int hard_regno)
 {
+  /* ebp and r13 as the base always wants a displacement, r12 as the
+     base always wants an index.  So discourage their usage in an
+     address.  */
+  if (hard_regno == R12_REG || hard_regno == R13_REG)
+    return 4;
+  if (hard_regno == BP_REG)
+    return 2;
   /* New x86-64 int registers result in bigger code size.  Discourage
      them.  */
   if (FIRST_REX_INT_REG <= hard_regno && hard_regno <= LAST_REX_INT_REG)
-    return 2;
+    return 3;
   /* New x86-64 SSE registers result in bigger code size.  Discourage
      them.  */
   if (FIRST_REX_SSE_REG <= hard_regno && hard_regno <= LAST_REX_SSE_REG)
-    return 2;
+    return 3;
   /* Usage of AX register results in smaller code.  Prefer it.  */
   if (hard_regno == 0)
     return 0;