[llvm-commits] CVS: llvm/lib/Target/X86/X86RegisterInfo.h X86RegisterInfo.cpp
Jim Laskey
jlaskey at apple.com
Wed Jan 24 11:16:48 PST 2007
Evan and Reid - feel free to tweak this. It shouldn't introduce
problems.
On 24-Jan-07, at 03:15 PM, Jim Laskey wrote:
>
>
> Changes in directory llvm/lib/Target/X86:
>
> X86RegisterInfo.h updated: 1.44 -> 1.45
> X86RegisterInfo.cpp updated: 1.195 -> 1.196
> ---
> Log message:
>
> Call frames for intel.
>
> ---
> Diffs of the changes: (+52 -0)
>
> X86RegisterInfo.cpp | 51 ++++++++++++++++++++++++++++++++++++++++
> +++++++++++
> X86RegisterInfo.h | 1 +
> 2 files changed, 52 insertions(+)
>
>
> Index: llvm/lib/Target/X86/X86RegisterInfo.h
> diff -u llvm/lib/Target/X86/X86RegisterInfo.h:1.44 llvm/lib/Target/
> X86/X86RegisterInfo.h:1.45
> --- llvm/lib/Target/X86/X86RegisterInfo.h:1.44 Mon Jan 22 18:57:47
> 2007
> +++ llvm/lib/Target/X86/X86RegisterInfo.h Wed Jan 24 13:15:24 2007
> @@ -94,6 +94,7 @@
> // Debug information queries.
> unsigned getRARegister() const;
> unsigned getFrameRegister(MachineFunction &MF) const;
> + void getInitialFrameState(std::vector<MachineMove> &Moves) const;
> };
>
> // getX86SubSuperRegister - X86 utility function. It returns the
> sub or super
>
>
> Index: llvm/lib/Target/X86/X86RegisterInfo.cpp
> diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.195 llvm/lib/
> Target/X86/X86RegisterInfo.cpp:1.196
> --- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.195 Wed Jan 24
> 12:50:57 2007
> +++ llvm/lib/Target/X86/X86RegisterInfo.cpp Wed Jan 24 13:15:24 2007
> @@ -995,6 +995,11 @@
> const Function* Fn = MF.getFunction();
> const X86Subtarget* Subtarget = &MF.getTarget
> ().getSubtarget<X86Subtarget>();
> MachineInstr *MI;
> + MachineDebugInfo *DebugInfo = MFI->getMachineDebugInfo();
> +
> + // Prepare for debug frame info.
> + bool hasInfo = DebugInfo && DebugInfo->hasInfo();
> + unsigned FrameLabelId = 0;
>
> // Get the number of bytes to allocate from the FrameInfo
> unsigned NumBytes = MFI->getStackSize();
> @@ -1018,6 +1023,12 @@
> }
> }
>
> + if (hasInfo) {
> + // Mark effective beginning of when frame pointer becomes valid.
> + FrameLabelId = DebugInfo->NextLabelID();
> + BuildMI(MBB, MBBI, TII.get(X86::DWARF_LABEL)).addImm
> (FrameLabelId);
> + }
> +
> if (hasFP(MF)) {
> // Get the offset of the stack slot for the EBP register...
> which is
> // guaranteed to be the last slot by
> processFunctionBeforeFrameFinalized.
> @@ -1042,6 +1053,38 @@
> MBB.insert(MBBI, MI);
> }
>
> + if (hasInfo) {
> + std::vector<MachineMove> &Moves = DebugInfo->getFrameMoves();
> +
> + if (NumBytes) {
> + // Show update of SP.
> + MachineLocation SPDst(MachineLocation::VirtualFP);
> + MachineLocation SPSrc(MachineLocation::VirtualFP, -NumBytes);
> + Moves.push_back(MachineMove(FrameLabelId, SPDst, SPSrc));
> + } else {
> + MachineLocation SP(StackPtr);
> + Moves.push_back(MachineMove(FrameLabelId, SP, SP));
> + }
> +
> + // Add callee saved registers to move list.
> + const std::vector<CalleeSavedInfo> &CSI = MFI-
> >getCalleeSavedInfo();
> + for (unsigned I = 0, E = CSI.size(); I != E; ++I) {
> + int Offset = MFI->getObjectOffset(CSI[I].getFrameIdx());
> + unsigned Reg = CSI[I].getReg();
> + MachineLocation CSDst(MachineLocation::VirtualFP, Offset);
> + MachineLocation CSSrc(Reg);
> + Moves.push_back(MachineMove(FrameLabelId, CSDst, CSSrc));
> + }
> +
> + // Mark effective beginning of when frame pointer is ready.
> + unsigned ReadyLabelId = DebugInfo->NextLabelID();
> + BuildMI(MBB, MBBI, TII.get(X86::DWARF_LABEL)).addImm
> (ReadyLabelId);
> +
> + MachineLocation FPDst(hasFP(MF) ? FramePtr : StackPtr);
> + MachineLocation FPSrc(MachineLocation::VirtualFP);
> + Moves.push_back(MachineMove(ReadyLabelId, FPDst, FPSrc));
> + }
> +
> // If it's main() on Cygwin\Mingw32 we should align stack as well
> if (Fn->hasExternalLinkage() && Fn->getName() == "main" &&
> Subtarget->isTargetCygMing()) {
> @@ -1127,6 +1170,14 @@
> return hasFP(MF) ? FramePtr : StackPtr;
> }
>
> +void X86RegisterInfo::getInitialFrameState
> (std::vector<MachineMove> &Moves)
> +
> const {
> + // Initial state of the frame pointer is esp.
> + MachineLocation Dst(MachineLocation::VirtualFP);
> + MachineLocation Src(StackPtr, 0);
> + Moves.push_back(MachineMove(0, Dst, Src));
> +}
> +
> namespace llvm {
> unsigned getX86SubSuperRegister(unsigned Reg, MVT::ValueType VT,
> bool High) {
> switch (VT) {
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070124/d610df08/attachment.bin>
More information about the llvm-commits
mailing list