diff mbox

[i386] : Tighten check for GP register in pro/epilogue register save/restore functions

Message ID CAFULd4ZoHFB0QR=8+k+VjRjpNNBb7nmpcnwzEqb_iA1OUtqhqg@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Oct. 4, 2015, 2:14 p.m. UTC
Hello!

Attached patch tightens the check for general purpose register in
prologue and epilogue register save/restore functions. These functions
handle GP regs exclusively.

2015-10-04  Uros Bizjak  <ubizjak@gmail.com>

    * config/i386/i386.c (ix86_nsaved_regs): Use GENERAL_REGNO_P to
    check for general register.
    (ix86_emit_save_regs): Ditto.
    (ix86_emit_save_regs_using_mov): Ditto.
    (ix86_emit_restore_regs_using_pop): Ditto.
    (ix86_emit_restore_regs_using_mov): Ditto.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Committed to mainline SVN.

Uros.
diff mbox

Patch

Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 228455)
+++ config/i386/i386.c	(working copy)
@@ -11083,7 +11083,7 @@  ix86_nsaved_regs (void)
   int regno;
 
   for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
-    if (!SSE_REGNO_P (regno) && ix86_save_reg (regno, true))
+    if (GENERAL_REGNO_P (regno) && ix86_save_reg (regno, true))
       nregs ++;
   return nregs;
 }
@@ -11493,7 +11493,7 @@  ix86_emit_save_regs (void)
   rtx_insn *insn;
 
   for (regno = FIRST_PSEUDO_REGISTER - 1; regno-- > 0; )
-    if (!SSE_REGNO_P (regno) && ix86_save_reg (regno, true))
+    if (GENERAL_REGNO_P (regno) && ix86_save_reg (regno, true))
       {
 	insn = emit_insn (gen_push (gen_rtx_REG (word_mode, regno)));
 	RTX_FRAME_RELATED_P (insn) = 1;
@@ -11573,7 +11573,7 @@  ix86_emit_save_regs_using_mov (HOST_WIDE_INT cfa_o
   unsigned int regno;
 
   for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
-    if (!SSE_REGNO_P (regno) && ix86_save_reg (regno, true))
+    if (GENERAL_REGNO_P (regno) && ix86_save_reg (regno, true))
       {
         ix86_emit_save_reg_using_mov (word_mode, regno, cfa_offset);
 	cfa_offset -= UNITS_PER_WORD;
@@ -12991,7 +12991,7 @@  ix86_emit_restore_regs_using_pop (void)
   unsigned int regno;
 
   for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
-    if (!SSE_REGNO_P (regno) && ix86_save_reg (regno, false))
+    if (GENERAL_REGNO_P (regno) && ix86_save_reg (regno, false))
       ix86_emit_restore_reg_using_pop (gen_rtx_REG (word_mode, regno));
 }
 
@@ -13034,7 +13034,7 @@  ix86_emit_restore_regs_using_mov (HOST_WIDE_INT cf
   unsigned int regno;
 
   for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
-    if (!SSE_REGNO_P (regno) && ix86_save_reg (regno, maybe_eh_return))
+    if (GENERAL_REGNO_P (regno) && ix86_save_reg (regno, maybe_eh_return))
       {
 	rtx reg = gen_rtx_REG (word_mode, regno);
 	rtx mem;