1Pull in r200509 from upstream llvm trunk (by Venkatraman Govindaraju): 2 3 [Sparc] Save and restore float registers that may be used for parameter passing. 4 5Introduced here: http://svnweb.freebsd.org/changeset/base/262261 6 7Index: lib/Target/Sparc/SparcJITInfo.cpp 8=================================================================== 9--- lib/Target/Sparc/SparcJITInfo.cpp 10+++ lib/Target/Sparc/SparcJITInfo.cpp 11@@ -28,6 +28,13 @@ extern "C" void SparcCompilationCallback(); 12 13 extern "C" { 14 #if defined (__sparc__) 15+ 16+#if defined(__arch64__) 17+#define FRAME_PTR(X) #X "+2047" 18+#else 19+#define FRAME_PTR(X) #X 20+#endif 21+ 22 asm( 23 ".text\n" 24 "\t.align 4\n" 25@@ -34,11 +41,46 @@ extern "C" { 26 "\t.global SparcCompilationCallback\n" 27 "\t.type SparcCompilationCallback, #function\n" 28 "SparcCompilationCallback:\n" 29- // Save current register window. 30- "\tsave %sp, -192, %sp\n" 31+ // Save current register window and create stack. 32+ // 128 (save area) + 6*8 (for arguments) + 16*8 (for float regfile) = 304 33+ "\tsave %sp, -304, %sp\n" 34+ // save float regfile to the stack. 35+ "\tstd %f0, [" FRAME_PTR(%fp) "-0]\n" 36+ "\tstd %f2, [" FRAME_PTR(%fp) "-8]\n" 37+ "\tstd %f4, [" FRAME_PTR(%fp) "-16]\n" 38+ "\tstd %f6, [" FRAME_PTR(%fp) "-24]\n" 39+ "\tstd %f8, [" FRAME_PTR(%fp) "-32]\n" 40+ "\tstd %f10, [" FRAME_PTR(%fp) "-40]\n" 41+ "\tstd %f12, [" FRAME_PTR(%fp) "-48]\n" 42+ "\tstd %f14, [" FRAME_PTR(%fp) "-56]\n" 43+ "\tstd %f16, [" FRAME_PTR(%fp) "-64]\n" 44+ "\tstd %f18, [" FRAME_PTR(%fp) "-72]\n" 45+ "\tstd %f20, [" FRAME_PTR(%fp) "-80]\n" 46+ "\tstd %f22, [" FRAME_PTR(%fp) "-88]\n" 47+ "\tstd %f24, [" FRAME_PTR(%fp) "-96]\n" 48+ "\tstd %f26, [" FRAME_PTR(%fp) "-104]\n" 49+ "\tstd %f28, [" FRAME_PTR(%fp) "-112]\n" 50+ "\tstd %f30, [" FRAME_PTR(%fp) "-120]\n" 51 // stubaddr is in %g1. 52 "\tcall SparcCompilationCallbackC\n" 53 "\t mov %g1, %o0\n" 54+ // restore float regfile from the stack. 55+ "\tldd [" FRAME_PTR(%fp) "-0], %f0\n" 56+ "\tldd [" FRAME_PTR(%fp) "-8], %f2\n" 57+ "\tldd [" FRAME_PTR(%fp) "-16], %f4\n" 58+ "\tldd [" FRAME_PTR(%fp) "-24], %f6\n" 59+ "\tldd [" FRAME_PTR(%fp) "-32], %f8\n" 60+ "\tldd [" FRAME_PTR(%fp) "-40], %f10\n" 61+ "\tldd [" FRAME_PTR(%fp) "-48], %f12\n" 62+ "\tldd [" FRAME_PTR(%fp) "-56], %f14\n" 63+ "\tldd [" FRAME_PTR(%fp) "-64], %f16\n" 64+ "\tldd [" FRAME_PTR(%fp) "-72], %f18\n" 65+ "\tldd [" FRAME_PTR(%fp) "-80], %f20\n" 66+ "\tldd [" FRAME_PTR(%fp) "-88], %f22\n" 67+ "\tldd [" FRAME_PTR(%fp) "-96], %f24\n" 68+ "\tldd [" FRAME_PTR(%fp) "-104], %f26\n" 69+ "\tldd [" FRAME_PTR(%fp) "-112], %f28\n" 70+ "\tldd [" FRAME_PTR(%fp) "-120], %f30\n" 71 // restore original register window and 72 // copy %o0 to %g1 73 "\trestore %o0, 0, %g1\n" 74