This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

SPARC libraries/runtime support should be build with -mno-app-regs



The SPARC ABI has a few reserved global registers that can be used as scratch
registers by an application; but also as special reserved global registers
that cache an important global (or per-thread) value.

Because on applications can define these registers as they please,
libraries and other run-time support must not use them.

Building libraries w/ -mno-app-regs works partly, but the libgcc2.c
assembly (_muldi3 and others) as well as _bb (MACHINE_STATE_{SAVE,RESTORE})
still use %g2, even w/ -mno-app-regs.

For SPARCV9 this is easy to fix: the basic block code (if it is even tested)
can save condition code using rd %ccr, %g1 and wr %g1, %ccr and the
long long multiply code isn't even used as direct instructions are generated.

I'll have to double check the SPARCv8 ABI whether another scratch register
can be usedinstead of %g2; %g1 is save; %g4 and %g5 can also be used in
SPARCv9; IIRC %g5 is also reserved for the system together w/ %g6 and %g7
in the V8 ABI.

(Patches to follow)

Casper


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]