This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
patch for 930513-1 on Darwin
- To: gcc-patches at gcc dot gnu dot org
- Subject: patch for 930513-1 on Darwin
- From: dalej at apple dot com
- Date: Thu, 31 May 2001 16:59:37 -0700
Background:
We have a longstanding failure on test execute/930513-1.c with -O3 for
Darwin. What happens is that a function name is passed to a callee,
which expects a pointer-to-function, which is dereferenced and called.
When the callee is expanded inline, the nested call becomes a direct
call to the function name. On Darwin, the required syntax for a
function name is different when you call it and when you pass its
address, so the inliner needs to change things to compensate. I don't
see any hooks for this in integrate.c (perhaps by coincidence, no other
machine I know of has such a requirement) so I added a macro. There
will be no functional change on any other target.
2001-05-31 Dale Johannesen <dalej@apple.com>
* integrate.c, config/rs6000/darwin.h: for Darwin, change
function name
syntax when function passed as parameter is called, due to
inlining. Macro
ADJUST_CALLEE_SYM_NAME added. Functional change on Darwin
only.
Index: tm.texi
===================================================================
RCS file: /cvs/repository/CoreTools/gcc3/gcc/tm.texi,v
retrieving revision 1.1.1.12
diff -u -d -b -w -r1.1.1.12 tm.texi
--- tm.texi 2001/05/29 21:46:26 1.1.1.12
+++ tm.texi 2001/05/31 23:56:58
@@ -3326,6 +3326,14 @@
argument is loaded first. This macro only affects arguments
passed in registers.
+@findex ADJUST_CALLEE_SYM_NAME
+@item ADJUST_CALLEE_SYM_NAME
+Some targets require a different syntax for a function name when it
+is called and when its address is taken. On such targets, when a
+function name is passed as an actual argument and the callee function
+is expanded inline, the function name may become called directly. This
+macro adjusts the name as required in this case.
+
@end table
@node Scalar Return
Index: integrate.c
===================================================================
RCS file: /cvs/repository/CoreTools/gcc3/gcc/integrate.c,v
retrieving revision 1.1.1.14
diff -u -d -b -w -r1.1.1.14 integrate.c
--- integrate.c 2001/05/29 21:45:58 1.1.1.14
+++ integrate.c 2001/05/31 21:51:57
@@ -2540,6 +2540,21 @@
}
return;
+ case CALL:
+ if (XEXP (x, 0))
+ {
+ subst_constants (&XEXP (x, 0), insn, map, memonly);
+#ifdef ADJUST_CALLEE_SYM_NAME
+ XEXP (x, 0) = ADJUST_CALLEE_SYM_NAME (XEXP (x,0));
+#endif
+ }
+ for (i = 1; i < GET_RTX_LENGTH (code); i++)
+ {
+ if (XEXP (x, i))
+ subst_constants (&XEXP (x, i), insn, map, memonly);
+ }
+ return;
+
default:
break;
}
Index: config/rs6000/darwin.h
===================================================================
RCS file: /cvs/repository/CoreTools/gcc3/gcc/config/rs6000/darwin.h,v
retrieving revision 1.12
diff -u -d -b -w -r1.12 darwin.h
--- darwin.h 2001/05/16 22:09:21 1.12
+++ darwin.h 2001/05/31 21:52:08
@@ -82,6 +82,14 @@
#define VECTOR_PIXEL_AND_BOOL_NOT_DISTINCT
+/* when expanding inline functions, if we pass a function symbol as an
+ actual parameter, and it is substituted for a call to the
corresponding
+ (pointer) formal argument, we must change the symbol name to use
+ MachO's "stub" format. */
+
+#define ADJUST_CALLEE_SYM_NAME(CALLEE) \
+ (machopic_indirect_call_target (CALLEE))
+
/* Always use the "debug" register names, they're what the assembler
wants to see. */
@@ -137,7 +145,6 @@
#define ASM_OUTPUT_SKIP(FILE,SIZE) \
fprintf (FILE, "\t.space %d\n", SIZE)
-
/* Generate insns to call the profiler. */
#define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)