Hi All Here at Icron we are using the Leon SPARC CPU in a very minimal setting with no operating system. We have set the CPU for a large number of register windows, and have defined register window overflow and underflow traps as fatal conditions that do not need to be supported. This model of operation has no need to reserve stack space for the register overflow and underflow trap handlers, so we have created a new SPARC ABI to reduce the stack space allocation in our system. We have called this ABI metal, as it is for programs running close to the bare metal without an operating system.
We're not sure if there is interest in this change outside of Icron. If so this is the patch that we apply on 4.7.1. Please note that we are not GCC developers, we are not entirely sure how to make the three options (-mflat, -mnoflat, and -mmetal) mutually exclusive. We would appreciate any feedback on this change, especially if it has any consequences that is not obvious to us. diff -urN gcc-4.7.1.orig/gcc/config/sparc/sparc.h gcc-4.7.1/gcc/config/sparc/sparc.h --- gcc-4.7.1.orig/gcc/config/sparc/sparc.h 2012-03-24 11:47:55.000000000 -0700 +++ gcc-4.7.1/gcc/config/sparc/sparc.h 2012-06-15 10:39:16.000000000 -0700 @@ -309,6 +309,7 @@ #define CPP_OTHER_SPEC "\ %{mflat:-D_FLAT} \ %{msoft-float:-D_SOFT_FLOAT} \ +%{mmetal:-D_METAL} \ " /* Macros to distinguish the particular subtarget. */ @@ -801,7 +802,7 @@ Must reserve 64 bytes for the in and local registers. v9: Functions which return large structures get the address to place the wanted value from an invisible first argument. */ -#define STRUCT_VALUE_OFFSET 64 +#define STRUCT_VALUE_OFFSET (TARGET_METAL ? 0 : 64) /* Define the classes of registers for register constraints in the machine description. Also define ranges of constants. diff -urN gcc-4.7.1.orig/gcc/config/sparc/sparc.opt gcc-4.7.1/gcc/config/sparc/sparc.opt --- gcc-4.7.1.orig/gcc/config/sparc/sparc.opt 2011-11-30 08:10:24.000000000 -0800 +++ gcc-4.7.1/gcc/config/sparc/sparc.opt 2012-06-15 10:37:15.000000000 -0700 @@ -38,9 +38,17 @@ Do not use hardware FP mflat -Target Report Mask(FLAT) +Target Report Mask(FLAT) RejectNegative Negative(mno-flat) Use flat register window model +mno-flat +Target Report InverseMask(FLAT) RejectNegative Negative(mmetal) +Do not use flat register window model + +mmetal +Target Report Mask(METAL) RejectNegative Negative(mflat) +Use metal register window model + munaligned-doubles Target Report Mask(UNALIGNED_DOUBLES) Assume possible double misalignment Thanks for the excellent compiler David