sparc.h (SPARC_DEFAULT_CMODEL): Default to CM_32.
authorJakub Jelinek <jakub@redhat.com>
Tue, 14 Dec 1999 12:47:01 +0000 (13:47 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 14 Dec 1999 12:47:01 +0000 (13:47 +0100)
* 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

gcc/ChangeLog
gcc/config/sparc/linux64.h
gcc/config/sparc/sol2.h
gcc/config/sparc/sparc.c
gcc/config/sparc/sparc.h

index a4423d0cf18f032e6a21bb8ef98d04178cb02f3f..0019036434407ca08a0e34fcdeeb52e1cb2737e1 100644 (file)
@@ -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,
        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>
 
        * combine.c (combine_simplify_rtx): Don't make shared rtl.
index e5b88d22708068d966bd2ffdec50cc6df2635b54..1c6e62ab53a3d2fae9493c72f388bbc2c095066a 100644 (file)
@@ -356,6 +356,7 @@ do {                                                                        \
 #undef TARGET_BROKEN_SAVERESTORE
 #define TARGET_BROKEN_SAVERESTORE      0
 \f
+#if TARGET_ARCH32
 /* Override MACHINE_STATE_{SAVE,RESTORE} because we have special
    traps available which can get and set the condition codes
    reliably.  */
@@ -374,6 +375,7 @@ do {                                                                        \
               "ta      0x21\n\t"                       \
               : /* no outputs */                       \
               : "r" (ms_flags), "r" (ms_saveret));
+#endif /* sparc32 */
 
 /* A C statement (sans semicolon) to output an element in the table of
    global constructors.  */
index 72028fde2e736750e9f3e745a18d27476ea11253..0aecee2e1985d357621280a53743233d84dcf3e0 100644 (file)
@@ -215,6 +215,7 @@ Boston, MA 02111-1307, USA.  */
 #undef TARGET_DEFAULT
 #define TARGET_DEFAULT (MASK_EPILOGUE + MASK_FPU + MASK_V8PLUS)
 \f
+#if TARGET_ARCH32
 /* Override MACHINE_STATE_{SAVE,RESTORE} because we have special
    traps available which can get and set the condition codes
    reliably.  */
@@ -233,4 +234,4 @@ Boston, MA 02111-1307, USA.  */
               "ta      0x21\n\t"                       \
               : /* no outputs */                       \
               : "r" (ms_flags), "r" (ms_saveret));
-
+#endif /* sparc32 */
index 9c5380d574ad3164bf88f836f4cbe9d435e90366..2877844b8ec3890d6475a86ce3137f3906523403 100644 (file)
@@ -343,7 +343,7 @@ sparc_override_options ()
   sparc_init_modes ();
 
   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");
     }
@@ -8077,32 +8077,33 @@ sparc_block_profiler(file, blockno)
      int blockno;
 {
   char LPBX[32];
+  int bbreg = TARGET_ARCH64 ? 4 : 2;
 
   if (profile_block_flag == 2)
     {
       ASM_GENERATE_INTERNAL_LABEL (LPBX, "LPBX", 0);
 
       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%%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);
       assemble_name (file, LPBX);
-      fputs ("),%g2\n", file);
+      fprintf (file, "),%%g%d\n", bbreg);
   
       fputs ("\tor\t%o2,%lo(", file);
       assemble_name (file, LPBX);
-      fputs ("),%g2\n", file);
+      fprintf (file, "),%%g%d\n", bbreg);
   
-      fputs ("\tst\t%g2,[%g1+4]\n", file);
-      fputs ("\tmov\t%o7,%g2\n", file);
+      fprintf (file, "\tst\t%%g%d,[%%g1+4]\n", bbreg);
+      fprintf (file, "\tmov\t%%o7,%%g%d\n", bbreg);
 
       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)
     {
@@ -8114,13 +8115,19 @@ sparc_block_profiler(file, blockno)
 
       fputs ("\tld\t[%g1+%lo(", file);
       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);
-      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);
     }
 }
 
index c949c3eea2d2e4747411dca51006d917f131eebe..ad8db75c7d8e8f5edaf8f20a2ad1d2f8d387e144 100644 (file)
@@ -97,7 +97,7 @@ extern enum cmodel sparc_cmodel;
 #define TARGET_CM_MEDANY    (sparc_cmodel == CM_MEDANY)
 #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
    home grown (aka upward compatible) embedded ABI.  */
@@ -1077,10 +1077,10 @@ do                                                              \
       }                                                                \
     if (profile_block_flag)                                    \
       {                                                                \
-       /* %g1 and %g2 must be fixed, because BLOCK_PROFILER    \
-           uses them.  */                                      \
+       /* %g1 and %g2 (sparc32) resp. %g4 (sparc64) must be    \
+          fixed, because BLOCK_PROFILER uses them.  */         \
        fixed_regs[1] = 1;                                      \
-       fixed_regs[2] = 1;                                      \
+       fixed_regs[TARGET_ARCH64 ? 4 : 2] = 1;                  \
       }                                                                \
   }                                                            \
 while (0)
@@ -1985,7 +1985,7 @@ LFLGNN"ID":"                                      \
 #define MACHINE_STATE_SAVE(ID)                 \
   unsigned long ms_flags, ms_saveret;          \
   asm volatile(                                        \
-       "mov %%g2,%1\n\                         \
+       "mov %%g4,%1\n\
        rd %%ccr,%0"                            \
        : "=r"(ms_flags), "=r"(ms_saveret));
 
@@ -2066,9 +2066,9 @@ LFLGRET"ID":\n\
 #define MACHINE_STATE_RESTORE(ID)                              \
   asm volatile (                                               \
        "wr %0,0,%%ccr\n\
-       mov %1,%%g2"                                            \
+       mov %1,%%g4"                                            \
        : : "r"(ms_flags), "r"(ms_saveret)                      \
-       : "cc", "g2");
+       : "cc", "g4");
 
 #endif