Only gather frame info if debug or eh.
authorJim Laskey <jlaskey@mac.com>
Mon, 29 Jan 2007 23:20:22 +0000 (23:20 +0000)
committerJim Laskey <jlaskey@mac.com>
Mon, 29 Jan 2007 23:20:22 +0000 (23:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33639 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/MachineModuleInfo.h
lib/CodeGen/DwarfWriter.cpp
lib/Target/PowerPC/PPCRegisterInfo.cpp
lib/Target/X86/X86RegisterInfo.cpp

index a1c69083be1f88560894389a9bf0780e7a712fee..25a74e8451711594b860adb6f41af2eacdfc61e9 100644 (file)
@@ -36,6 +36,7 @@
 #include "llvm/ADT/UniqueVector.h"
 #include "llvm/GlobalValue.h"
 #include "llvm/Pass.h"
+#include "llvm/Target/TargetOptions.h"
 
 namespace llvm {
 
@@ -1025,6 +1026,10 @@ public:
   ///
   bool hasDebugInfo() const { return !CompileUnits.empty(); }
   
+  /// needsFrameInfo - Returns true if we need to gather callee-saved register
+  /// move info for the frame.
+  bool needsFrameInfo() const { return hasDebugInfo() || ExceptionHandling; }
+  
   /// NextLabelID - Return the next unique label id.
   ///
   unsigned NextLabelID() {
index 2b9cf74f88af614db82ae8c3ed73f8460bb9afd5..412bd6aa6cb8a63c70b44c867eb194e64d8c906d 100644 (file)
@@ -31,7 +31,6 @@
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetFrameInfo.h"
 #include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetOptions.h"
 #include <ostream>
 #include <string>
 using namespace llvm;
index 565cbce7f9b8ca32077e462772910a233fdedd36..4324b9d598e6237bdc72e15e1f6e7cef0678ba75 100644 (file)
@@ -818,7 +818,7 @@ void PPCRegisterInfo::emitPrologue(MachineFunction &MF) const {
   unsigned TargetAlign = MF.getTarget().getFrameInfo()->getStackAlignment();
   unsigned MaxAlign = MFI->getMaxAlignment();
 
-  if (MMI) {
+  if (MMI && MMI->needsFrameInfo()) {
     // Mark effective beginning of when frame pointer becomes valid.
     FrameLabelId = MMI->NextLabelID();
     BuildMI(MBB, MBBI, TII.get(PPC::LABEL)).addImm(FrameLabelId);
@@ -869,7 +869,7 @@ void PPCRegisterInfo::emitPrologue(MachineFunction &MF) const {
     }
   }
   
-  if (MMI) {
+  if (MMI && MMI->needsFrameInfo()) {
     std::vector<MachineMove> &Moves = MMI->getFrameMoves();
     
     if (NegFrameSize) {
index c49fffcb8635abd65783d767e06cae720c16a817..50fb09172725cc48018e84a025e08c568eef8797 100644 (file)
@@ -1022,7 +1022,7 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
     }
   }
 
-  if (MMI) {
+  if (MMI && MMI->needsFrameInfo()) {
     // Mark effective beginning of when frame pointer becomes valid.
     FrameLabelId = MMI->NextLabelID();
     BuildMI(MBB, MBBI, TII.get(X86::LABEL)).addImm(FrameLabelId);
@@ -1052,7 +1052,7 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
     MBB.insert(MBBI, MI);
   }
 
-  if (MMI) {
+  if (MMI && MMI->needsFrameInfo()) {
     std::vector<MachineMove> &Moves = MMI->getFrameMoves();
     
     if (NumBytes) {