From 029ed0932300dde5262feb8e8cf5ffb457a15cf1 Mon Sep 17 00:00:00 2001 From: "Vikram S. Adve" Date: Tue, 12 Aug 2003 03:04:05 +0000 Subject: [PATCH] Fix va_arg to generate LDDFi for floating point values, instead of LDXi. All non-FP cases use LDXi as before. llvm-svn: 7765 --- llvm/lib/Target/Sparc/SparcInstrSelection.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Target/Sparc/SparcInstrSelection.cpp b/llvm/lib/Target/Sparc/SparcInstrSelection.cpp index 2bc9f8358687..970c5fdcf0ad 100644 --- a/llvm/lib/Target/Sparc/SparcInstrSelection.cpp +++ b/llvm/lib/Target/Sparc/SparcInstrSelection.cpp @@ -2807,13 +2807,15 @@ GetInstructionsByRule(InstructionNode* subtreeRoot, case 64: // reg: Phi(reg,reg) break; // don't forward the value - case 65: // reg: VaArg(reg) + case 65: // reg: VaArg(reg): the va_arg instruction { // Use value initialized by va_start as pointer to args on the stack. // Load argument via current pointer value, then increment pointer. int argSize = target.getFrameInfo().getSizeOfEachArgOnStack(); Instruction* vaArgI = subtreeRoot->getInstruction(); - mvec.push_back(BuildMI(V9::LDXi, 3).addReg(vaArgI->getOperand(0)). + MachineOpCode loadOp = vaArgI->getType()->isFloatingPoint()? V9::LDDFi + : V9::LDXi; + mvec.push_back(BuildMI(loadOp, 3).addReg(vaArgI->getOperand(0)). addSImm(0).addRegDef(vaArgI)); mvec.push_back(BuildMI(V9::ADDi, 3).addReg(vaArgI->getOperand(0)). addSImm(argSize).addRegDef(vaArgI->getOperand(0)));