This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
SSA vs paradoxical subregs
- To: gcc-patches at gcc dot gnu dot org
- Subject: SSA vs paradoxical subregs
- From: law at redhat dot com
- Date: Wed, 25 Jul 2001 08:42:00 -0600
- Reply-to: law at redhat dot com
During translation into SSA form we turn certain problematical assignments
into a SEQUENCE.
Specifically we do this for assignments where the output operand is
implicitly used as an input. This happens when the LHS has a SUBREG,
ZERO_EXTRACT, SIGN_EXTRACT, or STRICT_LOW_PART.
However, in the case of a paradoxical subreg as an LHS it is not necessary
(or desirable) to translate the assignment into a SEQUENCE.
This patch (bootstrapped on ia64-linux) avoids creating a SEQUENCE for
paradoxical SUBREG assignments.
* ssa.c (rename_insn_1): Do not wrap an assignment to a
paradoxical SUBREG inside a SEQUENCE. Fix minor formatting
glitch.
Index: ssa.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/ssa.c,v
retrieving revision 1.21.16.5
diff -c -3 -p -r1.21.16.5 ssa.c
*** ssa.c 2001/07/13 15:05:22 1.21.16.5
--- ssa.c 2001/07/25 14:32:04
*************** rename_insn_1 (ptr, data)
*** 839,844 ****
--- 839,859 ----
rtx *destp = &SET_DEST (x);
rtx dest = SET_DEST (x);
+ /* An assignment to a paradoxical SUBREG does not read from
+ the destination operand, and thus does not need to be
+ wrapped into a SEQUENCE when translating into SSA form.
+ We merely strip off the SUBREG and proceed normally for
+ this case. */
+ if (GET_CODE (dest) == SUBREG
+ && (GET_MODE_SIZE (GET_MODE (dest))
+ > GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest))))
+ && GET_CODE (SUBREG_REG (dest)) == REG
+ && CONVERT_REGISTER_TO_SSA_P (REGNO (SUBREG_REG (dest))))
+ {
+ destp = &XEXP (dest, 0);
+ dest = XEXP (dest, 0);
+ }
+
/* Some SETs also use the REG specified in their LHS.
These can be detected by the presence of
STRICT_LOW_PART, SUBREG, SIGN_EXTRACT, and ZERO_EXTRACT
*************** rename_insn_1 (ptr, data)
*** 848,858 ****
(sequence [(set (reg foo_1) (reg foo))
(set (subreg (reg foo_1)) ...)])
! FIXME: Much of the time this is too much. For many libcalls,
! paradoxical SUBREGs, etc., the input register is dead. We should
! recognise this in rename_block or here and not make a false
dependency. */
-
if (GET_CODE (dest) == STRICT_LOW_PART
|| GET_CODE (dest) == SUBREG
|| GET_CODE (dest) == SIGN_EXTRACT
--- 863,874 ----
(sequence [(set (reg foo_1) (reg foo))
(set (subreg (reg foo_1)) ...)])
! FIXME: Much of the time this is too much. For some constructs
! we know that the output register is strictly an output
! (paradoxical SUBREGs and some libcalls for example).
!
! For those cases we are better off not making the false
dependency. */
if (GET_CODE (dest) == STRICT_LOW_PART
|| GET_CODE (dest) == SUBREG
|| GET_CODE (dest) == SIGN_EXTRACT
*************** rename_insn_1 (ptr, data)
*** 883,890 ****
context->new_renames = saved_new_renames;
}
}
! else if (GET_CODE (dest) == REG &&
! CONVERT_REGISTER_TO_SSA_P (REGNO (dest)))
{
/* We found a genuine set of an interesting register. Tag
it so that we can create a new name for it after we finish
--- 899,906 ----
context->new_renames = saved_new_renames;
}
}
! else if (GET_CODE (dest) == REG
! && CONVERT_REGISTER_TO_SSA_P (REGNO (dest)))
{
/* We found a genuine set of an interesting register. Tag
it so that we can create a new name for it after we finish