1263320SdimPull in r200509 from upstream llvm trunk (by Venkatraman Govindaraju):
2263320Sdim
3263320Sdim  [Sparc] Save and restore float registers that may be used for parameter passing.
4263320Sdim
5269012SemasteIntroduced here: http://svnweb.freebsd.org/changeset/base/262261
6263320Sdim
7263320SdimIndex: lib/Target/Sparc/SparcJITInfo.cpp
8263320Sdim===================================================================
9263320Sdim--- lib/Target/Sparc/SparcJITInfo.cpp
10263320Sdim+++ lib/Target/Sparc/SparcJITInfo.cpp
11263320Sdim@@ -28,6 +28,13 @@ extern "C" void SparcCompilationCallback();
12263320Sdim 
13263320Sdim extern "C" {
14263320Sdim #if defined (__sparc__)
15263320Sdim+
16263320Sdim+#if defined(__arch64__)
17263320Sdim+#define FRAME_PTR(X) #X "+2047"
18263320Sdim+#else
19263320Sdim+#define FRAME_PTR(X) #X
20263320Sdim+#endif
21263320Sdim+
22263320Sdim   asm(
23263320Sdim       ".text\n"
24263320Sdim       "\t.align 4\n"
25263320Sdim@@ -34,11 +41,46 @@ extern "C" {
26263320Sdim       "\t.global SparcCompilationCallback\n"
27263320Sdim       "\t.type SparcCompilationCallback, #function\n"
28263320Sdim       "SparcCompilationCallback:\n"
29263320Sdim-      // Save current register window.
30263320Sdim-      "\tsave %sp, -192, %sp\n"
31263320Sdim+      // Save current register window and create stack.
32263320Sdim+      // 128 (save area) + 6*8 (for arguments) + 16*8 (for float regfile) = 304
33263320Sdim+      "\tsave %sp, -304, %sp\n"
34263320Sdim+      // save float regfile to the stack.
35263320Sdim+      "\tstd %f0,  [" FRAME_PTR(%fp) "-0]\n"
36263320Sdim+      "\tstd %f2,  [" FRAME_PTR(%fp) "-8]\n"
37263320Sdim+      "\tstd %f4,  [" FRAME_PTR(%fp) "-16]\n"
38263320Sdim+      "\tstd %f6,  [" FRAME_PTR(%fp) "-24]\n"
39263320Sdim+      "\tstd %f8,  [" FRAME_PTR(%fp) "-32]\n"
40263320Sdim+      "\tstd %f10, [" FRAME_PTR(%fp) "-40]\n"
41263320Sdim+      "\tstd %f12, [" FRAME_PTR(%fp) "-48]\n"
42263320Sdim+      "\tstd %f14, [" FRAME_PTR(%fp) "-56]\n"
43263320Sdim+      "\tstd %f16, [" FRAME_PTR(%fp) "-64]\n"
44263320Sdim+      "\tstd %f18, [" FRAME_PTR(%fp) "-72]\n"
45263320Sdim+      "\tstd %f20, [" FRAME_PTR(%fp) "-80]\n"
46263320Sdim+      "\tstd %f22, [" FRAME_PTR(%fp) "-88]\n"
47263320Sdim+      "\tstd %f24, [" FRAME_PTR(%fp) "-96]\n"
48263320Sdim+      "\tstd %f26, [" FRAME_PTR(%fp) "-104]\n"
49263320Sdim+      "\tstd %f28, [" FRAME_PTR(%fp) "-112]\n"
50263320Sdim+      "\tstd %f30, [" FRAME_PTR(%fp) "-120]\n"
51263320Sdim       // stubaddr is in %g1.
52263320Sdim       "\tcall SparcCompilationCallbackC\n"
53263320Sdim       "\t  mov %g1, %o0\n"
54263320Sdim+      // restore float regfile from the stack.
55263320Sdim+      "\tldd [" FRAME_PTR(%fp) "-0],   %f0\n"
56263320Sdim+      "\tldd [" FRAME_PTR(%fp) "-8],   %f2\n"
57263320Sdim+      "\tldd [" FRAME_PTR(%fp) "-16],  %f4\n"
58263320Sdim+      "\tldd [" FRAME_PTR(%fp) "-24],  %f6\n"
59263320Sdim+      "\tldd [" FRAME_PTR(%fp) "-32],  %f8\n"
60263320Sdim+      "\tldd [" FRAME_PTR(%fp) "-40],  %f10\n"
61263320Sdim+      "\tldd [" FRAME_PTR(%fp) "-48],  %f12\n"
62263320Sdim+      "\tldd [" FRAME_PTR(%fp) "-56],  %f14\n"
63263320Sdim+      "\tldd [" FRAME_PTR(%fp) "-64],  %f16\n"
64263320Sdim+      "\tldd [" FRAME_PTR(%fp) "-72],  %f18\n"
65263320Sdim+      "\tldd [" FRAME_PTR(%fp) "-80],  %f20\n"
66263320Sdim+      "\tldd [" FRAME_PTR(%fp) "-88],  %f22\n"
67263320Sdim+      "\tldd [" FRAME_PTR(%fp) "-96],  %f24\n"
68263320Sdim+      "\tldd [" FRAME_PTR(%fp) "-104], %f26\n"
69263320Sdim+      "\tldd [" FRAME_PTR(%fp) "-112], %f28\n"
70263320Sdim+      "\tldd [" FRAME_PTR(%fp) "-120], %f30\n"
71263320Sdim       // restore original register window and
72263320Sdim       // copy %o0 to %g1
73263320Sdim       "\trestore %o0, 0, %g1\n"
74