fix a variety of issues were we'd start DebugTimer but
not stop it by using RAII. llvm-svn: 99832
This commit is contained in:
		
							parent
							
								
									fafa57a82a
								
							
						
					
					
						commit
						4787975994
					
				| 
						 | 
					@ -1777,12 +1777,11 @@ void DwarfDebug::constructSubprogramDIE(MDNode *N) {
 | 
				
			||||||
void DwarfDebug::beginModule(Module *M, MachineModuleInfo *mmi) {
 | 
					void DwarfDebug::beginModule(Module *M, MachineModuleInfo *mmi) {
 | 
				
			||||||
  this->M = M;
 | 
					  this->M = M;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (TimePassesIsEnabled)
 | 
					 | 
				
			||||||
    DebugTimer->startTimer();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (!MAI->doesSupportDebugInformation())
 | 
					  if (!MAI->doesSupportDebugInformation())
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  TimeRegion Timer(DebugTimer);
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  DebugInfoFinder DbgFinder;
 | 
					  DebugInfoFinder DbgFinder;
 | 
				
			||||||
  DbgFinder.processModule(*M);
 | 
					  DbgFinder.processModule(*M);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1830,9 +1829,6 @@ void DwarfDebug::beginModule(Module *M, MachineModuleInfo *mmi) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Emit initial sections
 | 
					  // Emit initial sections
 | 
				
			||||||
  emitInitial();
 | 
					  emitInitial();
 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (TimePassesIsEnabled)
 | 
					 | 
				
			||||||
    DebugTimer->stopTimer();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// endModule - Emit all Dwarf sections that should come after the content.
 | 
					/// endModule - Emit all Dwarf sections that should come after the content.
 | 
				
			||||||
| 
						 | 
					@ -1841,8 +1837,7 @@ void DwarfDebug::endModule() {
 | 
				
			||||||
  if (!ModuleCU)
 | 
					  if (!ModuleCU)
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (TimePassesIsEnabled)
 | 
					  TimeRegion Timer(DebugTimer);
 | 
				
			||||||
    DebugTimer->startTimer();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Attach DW_AT_inline attribute with inlined subprogram DIEs.
 | 
					  // Attach DW_AT_inline attribute with inlined subprogram DIEs.
 | 
				
			||||||
  for (SmallPtrSet<DIE *, 4>::iterator AI = InlinedSubprogramDIEs.begin(),
 | 
					  for (SmallPtrSet<DIE *, 4>::iterator AI = InlinedSubprogramDIEs.begin(),
 | 
				
			||||||
| 
						 | 
					@ -1926,9 +1921,6 @@ void DwarfDebug::endModule() {
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  delete ModuleCU;
 | 
					  delete ModuleCU;
 | 
				
			||||||
  ModuleCU = NULL;  // Reset for the next Module, if any.
 | 
					  ModuleCU = NULL;  // Reset for the next Module, if any.
 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (TimePassesIsEnabled)
 | 
					 | 
				
			||||||
    DebugTimer->stopTimer();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// findAbstractVariable - Find abstract variable, if any, associated with Var.
 | 
					/// findAbstractVariable - Find abstract variable, if any, associated with Var.
 | 
				
			||||||
| 
						 | 
					@ -2229,13 +2221,11 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
 | 
				
			||||||
  this->MF = MF;
 | 
					  this->MF = MF;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!ShouldEmitDwarfDebug()) return;
 | 
					  if (!ShouldEmitDwarfDebug()) return;
 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (TimePassesIsEnabled)
 | 
					 | 
				
			||||||
    DebugTimer->startTimer();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (!extractScopeInformation())
 | 
					  if (!extractScopeInformation())
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
					  TimeRegion Timer(DebugTimer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  collectVariableInfo();
 | 
					  collectVariableInfo();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Assumes in correct section after the entry point.
 | 
					  // Assumes in correct section after the entry point.
 | 
				
			||||||
| 
						 | 
					@ -2258,20 +2248,15 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    recordSourceLine(Line, Col, DLT.getScope().getNode());
 | 
					    recordSourceLine(Line, Col, DLT.getScope().getNode());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (TimePassesIsEnabled)
 | 
					 | 
				
			||||||
    DebugTimer->stopTimer();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// endFunction - Gather and emit post-function debug information.
 | 
					/// endFunction - Gather and emit post-function debug information.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
void DwarfDebug::endFunction(const MachineFunction *MF) {
 | 
					void DwarfDebug::endFunction(const MachineFunction *MF) {
 | 
				
			||||||
  if (!ShouldEmitDwarfDebug()) return;
 | 
					  if (!ShouldEmitDwarfDebug()) return;
 | 
				
			||||||
 | 
					  if (DbgScopeMap.empty()) return;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  if (TimePassesIsEnabled)
 | 
					  TimeRegion Timer(DebugTimer);
 | 
				
			||||||
    DebugTimer->startTimer();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (DbgScopeMap.empty())
 | 
					 | 
				
			||||||
    return;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (CurrentFnDbgScope) {
 | 
					  if (CurrentFnDbgScope) {
 | 
				
			||||||
    // Define end label for subprogram.
 | 
					    // Define end label for subprogram.
 | 
				
			||||||
| 
						 | 
					@ -2309,9 +2294,6 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
 | 
				
			||||||
  AbstractScopesList.clear();
 | 
					  AbstractScopesList.clear();
 | 
				
			||||||
  AbstractVariables.clear();
 | 
					  AbstractVariables.clear();
 | 
				
			||||||
  Lines.clear();
 | 
					  Lines.clear();
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  if (TimePassesIsEnabled)
 | 
					 | 
				
			||||||
    DebugTimer->stopTimer();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// recordSourceLine - Register a source line with debug info. Returns the
 | 
					/// recordSourceLine - Register a source line with debug info. Returns the
 | 
				
			||||||
| 
						 | 
					@ -2321,8 +2303,7 @@ MCSymbol *DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, MDNode *S) {
 | 
				
			||||||
  if (!MMI)
 | 
					  if (!MMI)
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (TimePassesIsEnabled)
 | 
					  TimeRegion Timer(DebugTimer);
 | 
				
			||||||
    DebugTimer->startTimer();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  StringRef Dir;
 | 
					  StringRef Dir;
 | 
				
			||||||
  StringRef Fn;
 | 
					  StringRef Fn;
 | 
				
			||||||
| 
						 | 
					@ -2347,9 +2328,6 @@ MCSymbol *DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, MDNode *S) {
 | 
				
			||||||
  MCSymbol *Label = MMI->getContext().CreateTempSymbol();
 | 
					  MCSymbol *Label = MMI->getContext().CreateTempSymbol();
 | 
				
			||||||
  Lines.push_back(SrcLineInfo(Line, Col, Src, Label));
 | 
					  Lines.push_back(SrcLineInfo(Line, Col, Src, Label));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (TimePassesIsEnabled)
 | 
					 | 
				
			||||||
    DebugTimer->stopTimer();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  Asm->OutStreamer.EmitLabel(Label);
 | 
					  Asm->OutStreamer.EmitLabel(Label);
 | 
				
			||||||
  return Label;
 | 
					  return Label;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -2361,15 +2339,8 @@ MCSymbol *DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, MDNode *S) {
 | 
				
			||||||
/// well.
 | 
					/// well.
 | 
				
			||||||
unsigned DwarfDebug::getOrCreateSourceID(const std::string &DirName,
 | 
					unsigned DwarfDebug::getOrCreateSourceID(const std::string &DirName,
 | 
				
			||||||
                                         const std::string &FileName) {
 | 
					                                         const std::string &FileName) {
 | 
				
			||||||
  if (TimePassesIsEnabled)
 | 
					  TimeRegion Timer(DebugTimer);
 | 
				
			||||||
    DebugTimer->startTimer();
 | 
					  return GetOrCreateSourceID(DirName.c_str(), FileName.c_str());
 | 
				
			||||||
 | 
					 | 
				
			||||||
  unsigned SrcId = GetOrCreateSourceID(DirName.c_str(), FileName.c_str());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (TimePassesIsEnabled)
 | 
					 | 
				
			||||||
    DebugTimer->stopTimer();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return SrcId;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//===----------------------------------------------------------------------===//
 | 
					//===----------------------------------------------------------------------===//
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue