[llvm-commits] [llvm] r68813 - in /llvm/trunk: include/llvm/CodeGen/MachineModuleInfo.h lib/CodeGen/MachineModuleInfo.cpp

Evan Cheng evan.cheng at apple.com
Mon Apr 13 09:12:25 PDT 2009


Hi Devang,

Is this a temporary measure? We want to eliminate machinemoduleinfo.

Evan

Sent from my iPhone

On Apr 10, 2009, at 11:59 AM, Devang Patel <dpatel at apple.com> wrote:

> Author: dpatel
> Date: Fri Apr 10 13:58:59 2009
> New Revision: 68813
>
> URL: http://llvm.org/viewvc/llvm-project?rev=68813&view=rev
> Log:
> DebugLabelFolder ruthlessly deletes redundant labels. However,  
> sometimes the redundant labels is referenced by debug info somewhere  
> else. This patch provies a way so that dwarf writer can mark labels  
> as used.
>
> Modified:
>    llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
>    llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
>
> Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=68813&r1=68812&r2=68813&view=diff
>
> === 
> === 
> === 
> =====================================================================
> --- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Fri Apr 10  
> 13:58:59 2009
> @@ -37,6 +37,7 @@
> #include "llvm/ADT/DenseMap.h"
> #include "llvm/ADT/UniqueVector.h"
> #include "llvm/ADT/SmallPtrSet.h"
> +#include "llvm/ADT/SmallSet.h"
> #include "llvm/ADT/StringMap.h"
> #include "llvm/CodeGen/MachineLocation.h"
> #include "llvm/GlobalValue.h"
> @@ -115,6 +116,9 @@
>   // searchable format.
>   SmallPtrSet<const Function *, 32> UsedFunctions;
>
> +  /// UsedDbgLabels - labels are used by debug info entries.
> +  SmallSet<unsigned, 8> UsedDbgLabels;
> +
>   bool CallsEHReturn;
>   bool CallsUnwindInit;
>
> @@ -195,6 +199,19 @@
>     return LabelID ? LabelIDList[LabelID - 1] : 0;
>   }
>
> +  /// isDbgLabelUsed - Return true if label with LabelID is used by
> +  /// DwarfWriter.
> +  bool isDbgLabelUsed(unsigned LabelID) {
> +    return UsedDbgLabels.count(LabelID);
> +  }
> +
> +  /// RecordUsedDbgLabel - Mark label with LabelID as used. This is  
> used
> +  /// by DwarfWriter to inform DebugLabelFolder that certain labels  
> are
> +  /// not to be deleted.
> +  void RecordUsedDbgLabel(unsigned LabelID) {
> +    UsedDbgLabels.insert(LabelID);
> +  }
> +
>   /// getFrameMoves - Returns a reference to a list of moves done in  
> the current
>   /// function's prologue.  Used to construct frame maps for debug  
> and exception
>   /// handling comsumers.
>
> Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=68813&r1=68812&r2=68813&view=diff
>
> === 
> === 
> === 
> =====================================================================
> --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)
> +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Fri Apr 10 13:58:59  
> 2009
> @@ -333,7 +333,7 @@
>     // Iterate through instructions.
>     for (MachineBasicBlock::iterator I = BB->begin(), E = BB->end();  
> I != E; ) {
>       // Is it a label.
> -      if (I->isDebugLabel()) {
> +      if (I->isDebugLabel() && !MMI->isDbgLabelUsed(I->getOperand 
> (0).getImm())){
>         // The label ID # is always operand #0, an immediate.
>         unsigned NextLabel = I->getOperand(0).getImm();
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list