llvm.org GIT mirror llvm / 3a8ad62
First attempt at handling frame index elimination. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12728 91177308-0d34-0410-b5e6-96231b3b80d8 Brian Gaeke 15 years ago
2 changed file(s) with 22 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
3232 assert (RC == SparcV8::IntRegsRegisterClass
3333 && "Can only store 32-bit values to stack slots");
3434 MachineInstr *I =
35 BuildMI (V8::STrm, 2).addFrameIndex (FrameIdx).addReg (SrcReg);
35 BuildMI (V8::STrm, 3).addFrameIndex (FrameIdx).addSImm (0).addReg (SrcReg);
3636 MBB.insert(MBBI, I);
3737 return 1;
3838 }
4646 assert (RC == SparcV8::IntRegsRegisterClass
4747 && "Can only load 32-bit registers from stack slots");
4848 MachineInstr *I =
49 BuildMI (V8::LDmr, 2).addReg (DestReg).addFrameIndex (FrameIdx);
49 BuildMI (V8::LDmr, 2).addReg (DestReg).addFrameIndex (FrameIdx).addSImm (0);
5050 MBB.insert(MBBI, I);
5151 return 1;
5252 }
8383
8484 int FrameIndex = MI.getOperand(i).getFrameIndex();
8585
86 std::cerr
87 << "Sorry, I don't know how to eliminate frame indices yet\n"
88 << "Frame index was " << FrameIndex << ", in\n"
89 << __FUNCTION__ << "() at " << __FILE__ << ":" << __LINE__ << "\n";
90 abort();
86 // Replace frame index with a frame pointer reference
87 MI.SetMachineOperandReg (i, V8::FP);
88
89 // Addressable stack objects are accessed using neg. offsets from %fp
90 int Offset = MF.getFrameInfo()->getObjectOffset(FrameIndex) +
91 MI.getOperand(i+1).getImmedValue();
92 // note: Offset < 0
93 MI.SetMachineOperandConst (i+1, MachineOperand::MO_SignExtendedImmed, Offset);
9194 }
9295
9396 void SparcV8RegisterInfo::
98101 MachineFrameInfo *MFI = MF.getFrameInfo();
99102
100103 // Get the number of bytes to allocate from the FrameInfo
101 int NumBytes = (int) MFI->getStackSize();
104 int NumBytes = (int) MFI->getStackSize() + 4;
102105
103106 // Emit the correct save instruction based on the number of bytes in the frame.
104107 // Minimum stack frame size according to V8 ABI is:
3232 assert (RC == SparcV8::IntRegsRegisterClass
3333 && "Can only store 32-bit values to stack slots");
3434 MachineInstr *I =
35 BuildMI (V8::STrm, 2).addFrameIndex (FrameIdx).addReg (SrcReg);
35 BuildMI (V8::STrm, 3).addFrameIndex (FrameIdx).addSImm (0).addReg (SrcReg);
3636 MBB.insert(MBBI, I);
3737 return 1;
3838 }
4646 assert (RC == SparcV8::IntRegsRegisterClass
4747 && "Can only load 32-bit registers from stack slots");
4848 MachineInstr *I =
49 BuildMI (V8::LDmr, 2).addReg (DestReg).addFrameIndex (FrameIdx);
49 BuildMI (V8::LDmr, 2).addReg (DestReg).addFrameIndex (FrameIdx).addSImm (0);
5050 MBB.insert(MBBI, I);
5151 return 1;
5252 }
8383
8484 int FrameIndex = MI.getOperand(i).getFrameIndex();
8585
86 std::cerr
87 << "Sorry, I don't know how to eliminate frame indices yet\n"
88 << "Frame index was " << FrameIndex << ", in\n"
89 << __FUNCTION__ << "() at " << __FILE__ << ":" << __LINE__ << "\n";
90 abort();
86 // Replace frame index with a frame pointer reference
87 MI.SetMachineOperandReg (i, V8::FP);
88
89 // Addressable stack objects are accessed using neg. offsets from %fp
90 int Offset = MF.getFrameInfo()->getObjectOffset(FrameIndex) +
91 MI.getOperand(i+1).getImmedValue();
92 // note: Offset < 0
93 MI.SetMachineOperandConst (i+1, MachineOperand::MO_SignExtendedImmed, Offset);
9194 }
9295
9396 void SparcV8RegisterInfo::
98101 MachineFrameInfo *MFI = MF.getFrameInfo();
99102
100103 // Get the number of bytes to allocate from the FrameInfo
101 int NumBytes = (int) MFI->getStackSize();
104 int NumBytes = (int) MFI->getStackSize() + 4;
102105
103106 // Emit the correct save instruction based on the number of bytes in the frame.
104107 // Minimum stack frame size according to V8 ABI is: