aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/sparc/sparc.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@act-europe.fr>2004-05-07 13:40:42 +0200
committerEric Botcazou <ebotcazou@gcc.gnu.org>2004-05-07 11:40:42 +0000
commitbfb23806b83c3bc24f9ed6232974d783c00a2ebd (patch)
tree4af06369785f575d5e325c746eceec41ce3febdd /gcc/config/sparc/sparc.c
parent92ff0c419aee64c757481517b44043dbe7c6b501 (diff)
downloadgcc-bfb23806b83c3bc24f9ed6232974d783c00a2ebd.zip
gcc-bfb23806b83c3bc24f9ed6232974d783c00a2ebd.tar.gz
gcc-bfb23806b83c3bc24f9ed6232974d783c00a2ebd.tar.bz2
sparc-protos.h (sparc_skip_caller_unimp): New declaration.
* config/sparc/sparc-protos.h (sparc_skip_caller_unimp): New declaration. * config/sparc/sparc.c (SKIP_CALLERS_UNIMP_P): Delete. (sparc_skip_caller_unimp): New global variable. (sparc_function_epilogue): Set 'sparc_skip_caller_unimp'. Use it instead of SKIP_CALLERS_UNIMP_P. * config/sparc/sparc.md (call expander): Add sanity check. (call_address_struct_value_sp32): Re-sync with expander. (call_symbolic_struct_value_sp32): Likewise. (return peepholes): Use 'sparc_skip_caller_unimp' instead of custom predicate. From-SVN: r81617
Diffstat (limited to 'gcc/config/sparc/sparc.c')
-rw-r--r--gcc/config/sparc/sparc.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 76ccb34..2192d96 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -48,17 +48,6 @@ Boston, MA 02111-1307, USA. */
#include "target-def.h"
#include "cfglayout.h"
-/* 1 if the caller has placed an "unimp" insn immediately after the call.
- This is used in v8 code when calling a function that returns a structure.
- v9 doesn't have this. Be careful to have this test be the same as that
- used on the call. */
-
-#define SKIP_CALLERS_UNIMP_P \
-(!TARGET_ARCH64 && current_function_returns_struct \
- && ! integer_zerop (DECL_SIZE (DECL_RESULT (current_function_decl))) \
- && (TREE_CODE (DECL_SIZE (DECL_RESULT (current_function_decl))) \
- == INTEGER_CST))
-
/* Global variables for machine-dependent things. */
/* Size of frame. Need to know this to emit return insns from leaf procedures.
@@ -81,6 +70,7 @@ rtx sparc_compare_op0, sparc_compare_op1;
/* Coordinate with the md file wrt special insns created by
sparc_function_epilogue. */
bool sparc_emitting_epilogue;
+bool sparc_skip_caller_unimp;
/* Vector to say how input registers are mapped to output registers.
HARD_FRAME_POINTER_REGNUM cannot be remapped by this function to
@@ -4498,6 +4488,17 @@ sparc_function_epilogue (FILE *file,
{
const char *ret;
+ /* True if the caller has placed an "unimp" insn immediately after the call.
+ This insn is used in the 32-bit ABI when calling a function that returns
+ a non zero-sized structure. The 64-bit ABI doesn't have it. Be careful
+ to have this test be the same as that used on the call. */
+ sparc_skip_caller_unimp =
+ ! TARGET_ARCH64
+ && current_function_returns_struct
+ && (TREE_CODE (DECL_SIZE (DECL_RESULT (current_function_decl)))
+ == INTEGER_CST)
+ && ! integer_zerop (DECL_SIZE (DECL_RESULT (current_function_decl)));
+
if (current_function_epilogue_delay_list == 0)
{
/* If code does not drop into the epilogue, we need
@@ -4532,9 +4533,9 @@ sparc_function_epilogue (FILE *file,
/* Work out how to skip the caller's unimp instruction if required. */
if (leaf_function)
- ret = (SKIP_CALLERS_UNIMP_P ? "jmp\t%o7+12" : "retl");
+ ret = (sparc_skip_caller_unimp ? "jmp\t%o7+12" : "retl");
else
- ret = (SKIP_CALLERS_UNIMP_P ? "jmp\t%i7+12" : "ret");
+ ret = (sparc_skip_caller_unimp ? "jmp\t%i7+12" : "ret");
if (! leaf_function)
{
@@ -4542,7 +4543,7 @@ sparc_function_epilogue (FILE *file,
{
if (current_function_epilogue_delay_list)
abort ();
- if (SKIP_CALLERS_UNIMP_P)
+ if (sparc_skip_caller_unimp)
abort ();
fputs ("\trestore\n\tretl\n\tadd\t%sp, %g1, %sp\n", file);
@@ -4555,7 +4556,7 @@ sparc_function_epilogue (FILE *file,
if (TARGET_V9 && ! epilogue_renumber (&delay, 1))
{
epilogue_renumber (&delay, 0);
- fputs (SKIP_CALLERS_UNIMP_P
+ fputs (sparc_skip_caller_unimp
? "\treturn\t%i7+12\n"
: "\treturn\t%i7+8\n", file);
final_scan_insn (XEXP (current_function_epilogue_delay_list, 0),
@@ -4588,7 +4589,7 @@ sparc_function_epilogue (FILE *file,
sparc_emitting_epilogue = false;
}
}
- else if (TARGET_V9 && ! SKIP_CALLERS_UNIMP_P)
+ else if (TARGET_V9 && ! sparc_skip_caller_unimp)
fputs ("\treturn\t%i7+8\n\tnop\n", file);
else
fprintf (file, "\t%s\n\trestore\n", ret);