Commit a330e73b by Jakub Jelinek Committed by Jakub Jelinek

sparc.h (SPARC_DEFAULT_CMODEL): Default to CM_32.

	* config/sparc/sparc.h (SPARC_DEFAULT_CMODEL): Default to CM_32.
	(CONDITIONAL_REGISTER_USAGE): For block profiling fix %g4 on sparc64,
	not %g2.
	(MACHINE_STATE_SAVE, MACHINE_STATE_RESTORE): Use %g4 instead of %g2
	as sparc64 block profiling register.
	* config/sparc/sparc.c (sparc_override_options): Allow block
	profiling with -m32.
	(sparc_block_profiler): Use %g4 instead of %g2 as sparc64 block
	profiling register.
	* config/sparc/linux64.h (MACHINE_STATE_*): Only provide these
	macros on TARGET_ARCH32. sparc.h has macros good enough for sparc64.
	* config/sparc/sol2.h (MACHINE_STATE_*): Likewise.

From-SVN: r30916
parent e483bf9c
...@@ -26,6 +26,19 @@ Tue Dec 14 12:07:29 MET 1999 Jan Hubicka <hubicka@freesoft.cz> ...@@ -26,6 +26,19 @@ Tue Dec 14 12:07:29 MET 1999 Jan Hubicka <hubicka@freesoft.cz>
* config/sparc/linux-aout.h (TARGET_LIVE_G0, * config/sparc/linux-aout.h (TARGET_LIVE_G0,
TARGET_BROKEN_SAVERESTORE): Likewise. TARGET_BROKEN_SAVERESTORE): Likewise.
* config/sparc/sparc.h (SPARC_DEFAULT_CMODEL): Default to CM_32.
(CONDITIONAL_REGISTER_USAGE): For block profiling fix %g4 on sparc64,
not %g2.
(MACHINE_STATE_SAVE, MACHINE_STATE_RESTORE): Use %g4 instead of %g2
as sparc64 block profiling register.
* config/sparc/sparc.c (sparc_override_options): Allow block
profiling with -m32.
(sparc_block_profiler): Use %g4 instead of %g2 as sparc64 block
profiling register.
* config/sparc/linux64.h (MACHINE_STATE_*): Only provide these
macros on TARGET_ARCH32. sparc.h has macros good enough for sparc64.
* config/sparc/sol2.h (MACHINE_STATE_*): Likewise.
1999-12-14 Bernd Schmidt <bernds@cygnus.co.uk> 1999-12-14 Bernd Schmidt <bernds@cygnus.co.uk>
* combine.c (combine_simplify_rtx): Don't make shared rtl. * combine.c (combine_simplify_rtx): Don't make shared rtl.
......
...@@ -356,6 +356,7 @@ do { \ ...@@ -356,6 +356,7 @@ do { \
#undef TARGET_BROKEN_SAVERESTORE #undef TARGET_BROKEN_SAVERESTORE
#define TARGET_BROKEN_SAVERESTORE 0 #define TARGET_BROKEN_SAVERESTORE 0
#if TARGET_ARCH32
/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special /* Override MACHINE_STATE_{SAVE,RESTORE} because we have special
traps available which can get and set the condition codes traps available which can get and set the condition codes
reliably. */ reliably. */
...@@ -374,6 +375,7 @@ do { \ ...@@ -374,6 +375,7 @@ do { \
"ta 0x21\n\t" \ "ta 0x21\n\t" \
: /* no outputs */ \ : /* no outputs */ \
: "r" (ms_flags), "r" (ms_saveret)); : "r" (ms_flags), "r" (ms_saveret));
#endif /* sparc32 */
/* A C statement (sans semicolon) to output an element in the table of /* A C statement (sans semicolon) to output an element in the table of
global constructors. */ global constructors. */
......
...@@ -215,6 +215,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -215,6 +215,7 @@ Boston, MA 02111-1307, USA. */
#undef TARGET_DEFAULT #undef TARGET_DEFAULT
#define TARGET_DEFAULT (MASK_EPILOGUE + MASK_FPU + MASK_V8PLUS) #define TARGET_DEFAULT (MASK_EPILOGUE + MASK_FPU + MASK_V8PLUS)
#if TARGET_ARCH32
/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special /* Override MACHINE_STATE_{SAVE,RESTORE} because we have special
traps available which can get and set the condition codes traps available which can get and set the condition codes
reliably. */ reliably. */
...@@ -233,4 +234,4 @@ Boston, MA 02111-1307, USA. */ ...@@ -233,4 +234,4 @@ Boston, MA 02111-1307, USA. */
"ta 0x21\n\t" \ "ta 0x21\n\t" \
: /* no outputs */ \ : /* no outputs */ \
: "r" (ms_flags), "r" (ms_saveret)); : "r" (ms_flags), "r" (ms_saveret));
#endif /* sparc32 */
...@@ -343,7 +343,7 @@ sparc_override_options () ...@@ -343,7 +343,7 @@ sparc_override_options ()
sparc_init_modes (); sparc_init_modes ();
if ((profile_flag || profile_block_flag) if ((profile_flag || profile_block_flag)
&& sparc_cmodel != CM_MEDLOW) && sparc_cmodel != CM_32 && sparc_cmodel != CM_MEDLOW)
{ {
error ("profiling does not support code models other than medlow"); error ("profiling does not support code models other than medlow");
} }
...@@ -8077,32 +8077,33 @@ sparc_block_profiler(file, blockno) ...@@ -8077,32 +8077,33 @@ sparc_block_profiler(file, blockno)
int blockno; int blockno;
{ {
char LPBX[32]; char LPBX[32];
int bbreg = TARGET_ARCH64 ? 4 : 2;
if (profile_block_flag == 2) if (profile_block_flag == 2)
{ {
ASM_GENERATE_INTERNAL_LABEL (LPBX, "LPBX", 0); ASM_GENERATE_INTERNAL_LABEL (LPBX, "LPBX", 0);
fprintf (file, "\tsethi\t%%hi(%s__bb),%%g1\n", user_label_prefix); fprintf (file, "\tsethi\t%%hi(%s__bb),%%g1\n", user_label_prefix);
fprintf (file, "\tsethi\t%%hi(%d),%%g2\n", blockno); fprintf (file, "\tsethi\t%%hi(%d),%%g%d\n", blockno, bbreg);
fprintf (file, "\tor\t%%g1,%%lo(%s__bb),%%g1\n", user_label_prefix); fprintf (file, "\tor\t%%g1,%%lo(%s__bb),%%g1\n", user_label_prefix);
fprintf (file, "\tor\t%%g2,%%lo(%d),%%g2\n", blockno); fprintf (file, "\tor\t%%g%d,%%lo(%d),%%g%d\n", bbreg, blockno, bbreg);
fputs ("\tst\t%g2,[%g1]\n", file); fprintf (file, "\tst\t%%g%d,[%%g1]\n", bbreg);
fputs ("\tsethi\t%hi(", file); fputs ("\tsethi\t%hi(", file);
assemble_name (file, LPBX); assemble_name (file, LPBX);
fputs ("),%g2\n", file); fprintf (file, "),%%g%d\n", bbreg);
fputs ("\tor\t%o2,%lo(", file); fputs ("\tor\t%o2,%lo(", file);
assemble_name (file, LPBX); assemble_name (file, LPBX);
fputs ("),%g2\n", file); fprintf (file, "),%%g%d\n", bbreg);
fputs ("\tst\t%g2,[%g1+4]\n", file); fprintf (file, "\tst\t%%g%d,[%%g1+4]\n", bbreg);
fputs ("\tmov\t%o7,%g2\n", file); fprintf (file, "\tmov\t%%o7,%%g%d\n", bbreg);
fprintf (file, "\tcall\t%s__bb_trace_func\n\t nop\n", user_label_prefix); fprintf (file, "\tcall\t%s__bb_trace_func\n\t nop\n", user_label_prefix);
fputs ("\tmov\t%g2,%o7\n", file); fprintf (file, "\tmov\t%%g%d,%%o7\n", bbreg);
} }
else if (profile_block_flag != 0) else if (profile_block_flag != 0)
{ {
...@@ -8114,13 +8115,19 @@ sparc_block_profiler(file, blockno) ...@@ -8114,13 +8115,19 @@ sparc_block_profiler(file, blockno)
fputs ("\tld\t[%g1+%lo(", file); fputs ("\tld\t[%g1+%lo(", file);
assemble_name (file, LPBX); assemble_name (file, LPBX);
fprintf (file, "+%d)],%%g2\n", blockno*4); if (TARGET_ARCH64 && USE_AS_OFFSETABLE_LO10)
fprintf (file, ")+%d],%%g%d\n", blockno*4, bbreg);
else
fprintf (file, "+%d)],%%g%d\n", blockno*4, bbreg);
fputs ("\tadd\t%g2,1,%g2\n", file); fprintf (file, "\tadd\t%%g%d,1,%%g%d\n", bbreg, bbreg);
fputs ("\tst\t%g2,[%g1+%lo(", file); fprintf (file, "\tst\t%%g%d,[%%g1+%%lo(", bbreg);
assemble_name (file, LPBX); assemble_name (file, LPBX);
fprintf (file, "+%d)]\n", blockno*4); if (TARGET_ARCH64 && USE_AS_OFFSETABLE_LO10)
fprintf (file, ")+%d]\n", blockno*4);
else
fprintf (file, "+%d)]\n", blockno*4);
} }
} }
......
...@@ -97,7 +97,7 @@ extern enum cmodel sparc_cmodel; ...@@ -97,7 +97,7 @@ extern enum cmodel sparc_cmodel;
#define TARGET_CM_MEDANY (sparc_cmodel == CM_MEDANY) #define TARGET_CM_MEDANY (sparc_cmodel == CM_MEDANY)
#define TARGET_CM_EMBMEDANY (sparc_cmodel == CM_EMBMEDANY) #define TARGET_CM_EMBMEDANY (sparc_cmodel == CM_EMBMEDANY)
#define SPARC_DEFAULT_CMODEL CM_MEDLOW #define SPARC_DEFAULT_CMODEL CM_32
/* This is call-clobbered in the normal ABI, but is reserved in the /* This is call-clobbered in the normal ABI, but is reserved in the
home grown (aka upward compatible) embedded ABI. */ home grown (aka upward compatible) embedded ABI. */
...@@ -1077,10 +1077,10 @@ do \ ...@@ -1077,10 +1077,10 @@ do \
} \ } \
if (profile_block_flag) \ if (profile_block_flag) \
{ \ { \
/* %g1 and %g2 must be fixed, because BLOCK_PROFILER \ /* %g1 and %g2 (sparc32) resp. %g4 (sparc64) must be \
uses them. */ \ fixed, because BLOCK_PROFILER uses them. */ \
fixed_regs[1] = 1; \ fixed_regs[1] = 1; \
fixed_regs[2] = 1; \ fixed_regs[TARGET_ARCH64 ? 4 : 2] = 1; \
} \ } \
} \ } \
while (0) while (0)
...@@ -1985,7 +1985,7 @@ LFLGNN"ID":" \ ...@@ -1985,7 +1985,7 @@ LFLGNN"ID":" \
#define MACHINE_STATE_SAVE(ID) \ #define MACHINE_STATE_SAVE(ID) \
unsigned long ms_flags, ms_saveret; \ unsigned long ms_flags, ms_saveret; \
asm volatile( \ asm volatile( \
"mov %%g2,%1\n\ \ "mov %%g4,%1\n\
rd %%ccr,%0" \ rd %%ccr,%0" \
: "=r"(ms_flags), "=r"(ms_saveret)); : "=r"(ms_flags), "=r"(ms_saveret));
...@@ -2066,9 +2066,9 @@ LFLGRET"ID":\n\ ...@@ -2066,9 +2066,9 @@ LFLGRET"ID":\n\
#define MACHINE_STATE_RESTORE(ID) \ #define MACHINE_STATE_RESTORE(ID) \
asm volatile ( \ asm volatile ( \
"wr %0,0,%%ccr\n\ "wr %0,0,%%ccr\n\
mov %1,%%g2" \ mov %1,%%g4" \
: : "r"(ms_flags), "r"(ms_saveret) \ : : "r"(ms_flags), "r"(ms_saveret) \
: "cc", "g2"); : "cc", "g4");
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment