summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>1997-12-21 20:44:33 +0000
committerJeff Law <law@gcc.gnu.org>1997-12-21 13:44:33 -0700
commit665888b2b665c654faa86bc8aafbad2397204739 (patch)
tree0ec9e4a052c9d583478dcc85a8f87712e9c92d08
parent0ecab26a2381964c734196340d36354f83ad75f3 (diff)
downloadgcc-665888b2b665c654faa86bc8aafbad2397204739.tar.gz
pa.c (emit_move_sequence): Handle a function label source operand.
* pa.c (emit_move_sequence): Handle a function label source operand. From-SVN: r17173
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/pa/pa.c40
2 files changed, 34 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7f55170485c..8d092aa0bc1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Sun Dec 21 21:47:38 1997 Jeffrey A Law (law@cygnus.com)
+
+ * pa.c (emit_move_sequence): Handle a function label source
+ operand.
+
Sat Dec 20 16:14:50 1997 David Edelsohn <edelsohn@mhpcc.edu>
* rs6000.h (FUNCTION_ARG_PADDING): Define.
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 5729fb8220e..31188f92fe8 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -1244,8 +1244,12 @@ emit_move_sequence (operands, mode, scratch_reg)
}
}
- /* Simplify the source if we need to. */
+ /* Simplify the source if we need to.
+ Note we do have to handle function labels here, even though we do
+ not consider them legitimate constants. Loop optimizations can
+ call the emit_move_xxx with one a function as a source. */
if ((GET_CODE (operand1) != HIGH && immediate_operand (operand1, mode))
+ || function_label_operand (operand1, mode)
|| (GET_CODE (operand1) == HIGH
&& symbolic_operand (XEXP (operand1, 0), mode)))
{
@@ -1263,9 +1267,10 @@ emit_move_sequence (operands, mode, scratch_reg)
So we force the plabel into memory, load operand0 from
the memory location, then add in the constant part. */
- if (GET_CODE (operand1) == CONST
- && GET_CODE (XEXP (operand1, 0)) == PLUS
- && function_label_operand (XEXP (XEXP (operand1, 0), 0), Pmode))
+ if ((GET_CODE (operand1) == CONST
+ && GET_CODE (XEXP (operand1, 0)) == PLUS
+ && function_label_operand (XEXP (XEXP (operand1, 0), 0), Pmode))
+ || function_label_operand (operand1, mode))
{
rtx temp, const_part;
@@ -1275,13 +1280,25 @@ emit_move_sequence (operands, mode, scratch_reg)
else if (flag_pic)
scratch_reg = gen_reg_rtx (Pmode);
- /* Save away the constant part of the expression. */
- const_part = XEXP (XEXP (operand1, 0), 1);
- if (GET_CODE (const_part) != CONST_INT)
- abort ();
+ if (GET_CODE (operand1) == CONST)
+ {
+ /* Save away the constant part of the expression. */
+ const_part = XEXP (XEXP (operand1, 0), 1);
+ if (GET_CODE (const_part) != CONST_INT)
+ abort ();
+
+ /* Force the function label into memory. */
+ temp = force_const_mem (mode, XEXP (XEXP (operand1, 0), 0));
+ }
+ else
+ {
+ /* No constant part. */
+ const_part = NULL_RTX;
- /* Force the function label into memory. */
- temp = force_const_mem (mode, XEXP (XEXP (operand1, 0), 0));
+ /* Force the function label into memory. */
+ temp = force_const_mem (mode, operand1);
+ }
+
/* Get the address of the memory location. PIC-ify it if
necessary. */
@@ -1300,7 +1317,8 @@ emit_move_sequence (operands, mode, scratch_reg)
emit_move_sequence (operands, mode, scratch_reg);
/* And add back in the constant part. */
- expand_inc (operand0, const_part);
+ if (const_part != NULL_RTX)
+ expand_inc (operand0, const_part);
return 1;
}