llvm.org GIT mirror llvm / 0e41094
Call frames for intel. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33490 91177308-0d34-0410-b5e6-96231b3b80d8 Jim Laskey 13 years ago
2 changed file(s) with 52 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
994994 const Function* Fn = MF.getFunction();
995995 const X86Subtarget* Subtarget = &MF.getTarget().getSubtarget();
996996 MachineInstr *MI;
997 MachineDebugInfo *DebugInfo = MFI->getMachineDebugInfo();
998
999 // Prepare for debug frame info.
1000 bool hasInfo = DebugInfo && DebugInfo->hasInfo();
1001 unsigned FrameLabelId = 0;
9971002
9981003 // Get the number of bytes to allocate from the FrameInfo
9991004 unsigned NumBytes = MFI->getStackSize();
10171022 }
10181023 }
10191024
1025 if (hasInfo) {
1026 // Mark effective beginning of when frame pointer becomes valid.
1027 FrameLabelId = DebugInfo->NextLabelID();
1028 BuildMI(MBB, MBBI, TII.get(X86::DWARF_LABEL)).addImm(FrameLabelId);
1029 }
1030
10201031 if (hasFP(MF)) {
10211032 // Get the offset of the stack slot for the EBP register... which is
10221033 // guaranteed to be the last slot by processFunctionBeforeFrameFinalized.
10391050 FramePtr), StackPtr, NumBytes-SlotSize);
10401051
10411052 MBB.insert(MBBI, MI);
1053 }
1054
1055 if (hasInfo) {
1056 std::vector &Moves = DebugInfo->getFrameMoves();
1057
1058 if (NumBytes) {
1059 // Show update of SP.
1060 MachineLocation SPDst(MachineLocation::VirtualFP);
1061 MachineLocation SPSrc(MachineLocation::VirtualFP, -NumBytes);
1062 Moves.push_back(MachineMove(FrameLabelId, SPDst, SPSrc));
1063 } else {
1064 MachineLocation SP(StackPtr);
1065 Moves.push_back(MachineMove(FrameLabelId, SP, SP));
1066 }
1067
1068 // Add callee saved registers to move list.
1069 const std::vector &CSI = MFI->getCalleeSavedInfo();
1070 for (unsigned I = 0, E = CSI.size(); I != E; ++I) {
1071 int Offset = MFI->getObjectOffset(CSI[I].getFrameIdx());
1072 unsigned Reg = CSI[I].getReg();
1073 MachineLocation CSDst(MachineLocation::VirtualFP, Offset);
1074 MachineLocation CSSrc(Reg);
1075 Moves.push_back(MachineMove(FrameLabelId, CSDst, CSSrc));
1076 }
1077
1078 // Mark effective beginning of when frame pointer is ready.
1079 unsigned ReadyLabelId = DebugInfo->NextLabelID();
1080 BuildMI(MBB, MBBI, TII.get(X86::DWARF_LABEL)).addImm(ReadyLabelId);
1081
1082 MachineLocation FPDst(hasFP(MF) ? FramePtr : StackPtr);
1083 MachineLocation FPSrc(MachineLocation::VirtualFP);
1084 Moves.push_back(MachineMove(ReadyLabelId, FPDst, FPSrc));
10421085 }
10431086
10441087 // If it's main() on Cygwin\Mingw32 we should align stack as well
11241167
11251168 unsigned X86RegisterInfo::getFrameRegister(MachineFunction &MF) const {
11261169 return hasFP(MF) ? FramePtr : StackPtr;
1170 }
1171
1172 void X86RegisterInfo::getInitialFrameState(std::vector &Moves)
1173 const {
1174 // Initial state of the frame pointer is esp.
1175 MachineLocation Dst(MachineLocation::VirtualFP);
1176 MachineLocation Src(StackPtr, 0);
1177 Moves.push_back(MachineMove(0, Dst, Src));
11271178 }
11281179
11291180 namespace llvm {
9393 // Debug information queries.
9494 unsigned getRARegister() const;
9595 unsigned getFrameRegister(MachineFunction &MF) const;
96 void getInitialFrameState(std::vector &Moves) const;
9697 };
9798
9899 // getX86SubSuperRegister - X86 utility function. It returns the sub or super