Print machine frame objects with the frame offset intrinsic to the machine
authorChris Lattner <sabre@nondot.org>
Thu, 16 Jan 2003 18:35:57 +0000 (18:35 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 16 Jan 2003 18:35:57 +0000 (18:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5329 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/MachineFrameInfo.h
lib/CodeGen/MachineFunction.cpp

index 45a24cc70beba97f52fb02f73e7b3dab5a40b3b6..6f907e1ff36ecc1ecfa6d19f9fb9e1430b05a591 100644 (file)
@@ -33,6 +33,7 @@
 
 class TargetData;
 class TargetRegisterClass;
+class MachineFunction;
 #include <vector>
 
 class MachineFrameInfo {
@@ -205,10 +206,10 @@ public:
   /// print - Used by the MachineFunction printer to print information about
   /// stack objects.  Implemented in MachineFunction.cpp
   ///
-  void print(std::ostream &OS) const;
+  void print(const MachineFunction &MF, std::ostream &OS) const;
 
-  /// dump - Call print(std::cerr) to be called from the debugger.
-  void dump() const;
+  /// dump - Call print(MF, std::cerr) to be called from the debugger.
+  void dump(const MachineFunction &MF) const;
 };
 
 #endif
index 46036d0b58d8618621208d3b097b26587a3d291b..7ee2dcf457877054f05ec62ba025f2fa2dc16f6d 100644 (file)
@@ -120,7 +120,7 @@ void MachineFunction::print(std::ostream &OS) const {
      << "\"\n";
 
   // Print Frame Information
-  getFrameInfo()->print(OS);
+  getFrameInfo()->print(*this, OS);
 
   // Print Constant Pool
   getConstantPool()->print(OS);
@@ -188,7 +188,9 @@ int MachineFrameInfo::CreateStackObject(const TargetRegisterClass *RC) {
 }
 
 
-void MachineFrameInfo::print(std::ostream &OS) const {
+void MachineFrameInfo::print(const MachineFunction &MF, std::ostream &OS) const{
+  int ValOffset = MF.getTarget().getFrameInfo().getOffsetOfLocalArea();
+
   for (unsigned i = 0, e = Objects.size(); i != e; ++i) {
     const StackObject &SO = Objects[i];
     OS << "  <fi #" << (int)(i-NumFixedObjects) << "> is ";
@@ -200,11 +202,12 @@ void MachineFrameInfo::print(std::ostream &OS) const {
     if (i < NumFixedObjects)
       OS << " fixed";
     if (i < NumFixedObjects || SO.SPOffset != -1) {
+      int Off = SO.SPOffset + ValOffset;
       OS << " at location [SP";
-      if (SO.SPOffset > 0)
-       OS << "+" << SO.SPOffset;
-      else if (SO.SPOffset < 0)
-       OS << SO.SPOffset;
+      if (Off > 0)
+       OS << "+" << Off;
+      else if (Off < 0)
+       OS << Off;
       OS << "]";
     }
     OS << "\n";
@@ -214,7 +217,9 @@ void MachineFrameInfo::print(std::ostream &OS) const {
     OS << "  Stack frame contains variable sized objects\n";
 }
 
-void MachineFrameInfo::dump() const { print(std::cerr); }
+void MachineFrameInfo::dump(const MachineFunction &MF) const {
+  print(MF, std::cerr);
+}
 
 
 //===----------------------------------------------------------------------===//