From 6672f86a4d9fe3c84c82aafbe8d4f6a43f3c2218 Mon Sep 17 00:00:00 2001 From: Brian Gaeke Date: Thu, 30 Sep 2004 19:44:32 +0000 Subject: [PATCH] I think this will handle double args. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16618 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Sparc/SparcV8ISelSimple.cpp | 17 +++++++++++++++-- lib/Target/SparcV8/SparcV8ISelSimple.cpp | 17 +++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/lib/Target/Sparc/SparcV8ISelSimple.cpp b/lib/Target/Sparc/SparcV8ISelSimple.cpp index fe11d84d506..2a240e2506c 100644 --- a/lib/Target/Sparc/SparcV8ISelSimple.cpp +++ b/lib/Target/Sparc/SparcV8ISelSimple.cpp @@ -349,9 +349,22 @@ void V8ISel::LoadArgumentsToVirtualRegs (Function *LF) { BuildMI (BB, V8::LDFri, 2, Reg).addFrameIndex (FI).addSImm (0); break; } + case cDouble: { + // Double-fp args are passed in pairs of integer registers; go through + // memory to get them into FP registers. (Double bleh!) + unsigned DblAlign = TM.getTargetData().getDoubleAlignment(); + int FI = F->getFrameInfo()->CreateStackObject(8, DblAlign); + BuildMI (BB, V8::ST, 3).addFrameIndex (FI).addSImm (0) + .addReg (IncomingArgRegs[ArgOffset]); + ++ArgOffset; + BuildMI (BB, V8::ST, 3).addFrameIndex (FI).addSImm (4) + .addReg (IncomingArgRegs[ArgOffset]); + BuildMI (BB, V8::LDDFri, 2, Reg).addFrameIndex (FI).addSImm (0); + break; + } default: - // FIXME: handle cDouble, cLong - assert (0 && "64-bit (double, long, etc.) function args not handled"); + // FIXME: handle cLong + assert (0 && "64-bit int (long/ulong) function args not handled"); return; } diff --git a/lib/Target/SparcV8/SparcV8ISelSimple.cpp b/lib/Target/SparcV8/SparcV8ISelSimple.cpp index fe11d84d506..2a240e2506c 100644 --- a/lib/Target/SparcV8/SparcV8ISelSimple.cpp +++ b/lib/Target/SparcV8/SparcV8ISelSimple.cpp @@ -349,9 +349,22 @@ void V8ISel::LoadArgumentsToVirtualRegs (Function *LF) { BuildMI (BB, V8::LDFri, 2, Reg).addFrameIndex (FI).addSImm (0); break; } + case cDouble: { + // Double-fp args are passed in pairs of integer registers; go through + // memory to get them into FP registers. (Double bleh!) + unsigned DblAlign = TM.getTargetData().getDoubleAlignment(); + int FI = F->getFrameInfo()->CreateStackObject(8, DblAlign); + BuildMI (BB, V8::ST, 3).addFrameIndex (FI).addSImm (0) + .addReg (IncomingArgRegs[ArgOffset]); + ++ArgOffset; + BuildMI (BB, V8::ST, 3).addFrameIndex (FI).addSImm (4) + .addReg (IncomingArgRegs[ArgOffset]); + BuildMI (BB, V8::LDDFri, 2, Reg).addFrameIndex (FI).addSImm (0); + break; + } default: - // FIXME: handle cDouble, cLong - assert (0 && "64-bit (double, long, etc.) function args not handled"); + // FIXME: handle cLong + assert (0 && "64-bit int (long/ulong) function args not handled"); return; }