* caller-save.c (restore_referenced_regs): When restoring a
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 31 Aug 1992 14:05:07 +0000 (14:05 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 31 Aug 1992 14:05:07 +0000 (14:05 +0000)
referenced hard register, use CEIL instead of truncating
divide to determine the maximum number of registers to
restore.
(insert_save_restore): Document maxrestore parameter.
(CEIL): Define.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@2003 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/caller-save.c

index c0ebb27..ed4c781 100644 (file)
@@ -28,6 +28,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "reload.h"
 #include "expr.h"
 
+#define CEIL(x,y) (((x) + (y) - 1) / (y))
+
 /* Modes for each hard register that we can save.  The smallest mode is wide
    enough to save the entire contents of the register.  When saving the
    register because it is live we first try to save in multi-register modes.
@@ -593,7 +595,7 @@ restore_referenced_regs (x, insn, insn_mode)
          for (i = regno; i < endregno; i++)
            if (TEST_HARD_REG_BIT (hard_regs_need_restore, i))
              i += insert_save_restore (insn, 0, i, insn_mode, 
-                               GET_MODE_SIZE (GET_MODE (x)) / UNITS_PER_WORD);
+                  CEIL (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD));
        }
 
       return;
@@ -612,7 +614,9 @@ restore_referenced_regs (x, insn, insn_mode)
 \f
 /* Insert a sequence of insns to save or restore, SAVE_P says which,
    REGNO.  Place these insns in front of INSN.  INSN_MODE is the mode
-   to assign to these insns. 
+   to assign to these insns.   MAXRESTORE is the maximum number of registers
+   which should be restored during this call (when SAVE_P == 0).  It should
+   never be less than 1 since we only work with entire registers.
 
    Note that we have verified in init_caller_save that we can do this
    with a simple SET, so use it.  Set INSN_CODE to what we save there