<div dir="ltr">Thanks for taking care of this while I was away.<div><br></div><div>Curious why I haven't seen this locally...</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/3 NAKAMURA Takumi <span dir="ltr"><<a href="mailto:geek4civic@gmail.com" target="_blank">geek4civic@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: chapuni<br>
Date: Tue Dec 3 07:15:54 2013<br>
New Revision: 196272<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=196272&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=196272&view=rev</a><br>
Log:<br>
Revert r196270, "Generalize debug info / EH emission in AsmPrinter"<br>
<br>
It broke CodeGen/R600 tests with +Asserts.<br>
<br>
Removed:<br>
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterHandler.h<br>
Modified:<br>
llvm/trunk/include/llvm/CodeGen/AsmPrinter.h<br>
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h<br>
<br>
Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=196272&r1=196271&r2=196272&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=196272&r1=196271&r2=196272&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)<br>
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Dec 3 07:15:54 2013<br>
@@ -22,7 +22,6 @@<br>
#include "llvm/Support/ErrorHandling.h"<br>
<br>
namespace llvm {<br>
- class AsmPrinterHandler;<br>
class BlockAddress;<br>
class GCStrategy;<br>
class Constant;<br>
@@ -111,21 +110,13 @@ namespace llvm {<br>
/// function.<br>
MachineLoopInfo *LI;<br>
<br>
- struct HandlerInfo {<br>
- AsmPrinterHandler *Handler;<br>
- const char *TimerName, *TimerGroupName;<br>
- HandlerInfo(AsmPrinterHandler *Handler, const char *TimerName,<br>
- const char *TimerGroupName)<br>
- : Handler(Handler), TimerName(TimerName),<br>
- TimerGroupName(TimerGroupName) {}<br>
- };<br>
- /// Handlers - a vector of all debug/EH info emitters we should use.<br>
- /// This vector maintains ownership of the emitters.<br>
- SmallVector<HandlerInfo, 1> Handlers;<br>
-<br>
/// DD - If the target supports dwarf debug info, this pointer is non-null.<br>
DwarfDebug *DD;<br>
<br>
+ /// DE - If the target supports dwarf exception info, this pointer is<br>
+ /// non-null.<br>
+ DwarfException *DE;<br>
+<br>
protected:<br>
explicit AsmPrinter(TargetMachine &TM, MCStreamer &Streamer);<br>
<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=196272&r1=196271&r2=196272&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=196272&r1=196271&r2=196272&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Dec 3 07:15:54 2013<br>
@@ -99,14 +99,14 @@ AsmPrinter::AsmPrinter(TargetMachine &tm<br>
OutContext(Streamer.getContext()),<br>
OutStreamer(Streamer),<br>
LastMI(0), LastFn(0), Counter(~0U), SetCounter(0) {<br>
- DD = 0; MMI = 0; LI = 0; MF = 0;<br>
+ DD = 0; DE = 0; MMI = 0; LI = 0; MF = 0;<br>
CurrentFnSym = CurrentFnSymForSize = 0;<br>
GCMetadataPrinters = 0;<br>
VerboseAsm = Streamer.isVerboseAsm();<br>
}<br>
<br>
AsmPrinter::~AsmPrinter() {<br>
- assert(DD == 0 && Handlers.empty() && "Debug/EH info didn't get finalized");<br>
+ assert(DD == 0 && DE == 0 && "Debug/EH info didn't get finalized");<br>
<br>
if (GCMetadataPrinters != 0) {<br>
gcp_map_type &GCMap = getGCMap(GCMetadataPrinters);<br>
@@ -192,29 +192,25 @@ bool AsmPrinter::doInitialization(Module<br>
OutStreamer.AddBlankLine();<br>
}<br>
<br>
- if (MAI->doesSupportDebugInformation()) {<br>
+ if (MAI->doesSupportDebugInformation())<br>
DD = new DwarfDebug(this, &M);<br>
- Handlers.push_back(HandlerInfo(DD, DbgTimerName, DWARFGroupName));<br>
- }<br>
<br>
- DwarfException *DE = 0;<br>
switch (MAI->getExceptionHandlingType()) {<br>
case ExceptionHandling::None:<br>
- break;<br>
+ return false;<br>
case ExceptionHandling::SjLj:<br>
case ExceptionHandling::DwarfCFI:<br>
DE = new DwarfCFIException(this);<br>
- break;<br>
+ return false;<br>
case ExceptionHandling::ARM:<br>
DE = new ARMException(this);<br>
- break;<br>
+ return false;<br>
case ExceptionHandling::Win64:<br>
DE = new Win64Exception(this);<br>
- break;<br>
+ return false;<br>
}<br>
- if (DE)<br>
- Handlers.push_back(HandlerInfo(DE, EHTimerName, DWARFGroupName));<br>
- return false;<br>
+<br>
+ llvm_unreachable("Unknown exception type.");<br>
}<br>
<br>
void AsmPrinter::EmitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const {<br>
@@ -315,11 +311,8 @@ void AsmPrinter::EmitGlobalVariable(cons<br>
// sections and expected to be contiguous (e.g. ObjC metadata).<br>
unsigned AlignLog = getGVAlignmentLog2(GV, *DL);<br>
<br>
- for (unsigned I = 0, E = Handlers.size(); I != E; ++I) {<br>
- const HandlerInfo &OI = Handlers[I];<br>
- NamedRegionTimer T(OI.TimerName, OI.TimerGroupName, TimePassesIsEnabled);<br>
- OI.Handler->setSymbolSize(GVSym, Size);<br>
- }<br>
+ if (DD)<br>
+ DD->setSymbolSize(GVSym, Size);<br>
<br>
// Handle common and BSS local symbols (.lcomm).<br>
if (GVKind.isCommon() || GVKind.isBSSLocal()) {<br>
@@ -489,10 +482,13 @@ void AsmPrinter::EmitFunctionHeader() {<br>
}<br>
<br>
// Emit pre-function debug and/or EH information.<br>
- for (unsigned I = 0, E = Handlers.size(); I != E; ++I) {<br>
- const HandlerInfo &OI = Handlers[I];<br>
- NamedRegionTimer T(OI.TimerName, OI.TimerGroupName, TimePassesIsEnabled);<br>
- OI.Handler->beginFunction(MF);<br>
+ if (DE) {<br>
+ NamedRegionTimer T(EHTimerName, DWARFGroupName, TimePassesIsEnabled);<br>
+ DE->beginFunction(MF);<br>
+ }<br>
+ if (DD) {<br>
+ NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);<br>
+ DD->beginFunction(MF);<br>
}<br>
<br>
// Emit the prefix data.<br>
@@ -697,7 +693,7 @@ void AsmPrinter::EmitFunctionBody() {<br>
// Emit target-specific gunk before the function body.<br>
EmitFunctionBodyStart();<br>
<br>
- bool ShouldPrintDebugScopes = MMI->hasDebugInfo();<br>
+ bool ShouldPrintDebugScopes = DD && MMI->hasDebugInfo();<br>
<br>
// Print out code for the function.<br>
bool HasAnyRealCode = false;<br>
@@ -718,12 +714,8 @@ void AsmPrinter::EmitFunctionBody() {<br>
}<br>
<br>
if (ShouldPrintDebugScopes) {<br>
- for (unsigned III = 0, EEE = Handlers.size(); III != EEE; ++III) {<br>
- const HandlerInfo &OI = Handlers[III];<br>
- NamedRegionTimer T(OI.TimerName, OI.TimerGroupName,<br>
- TimePassesIsEnabled);<br>
- OI.Handler->beginInstruction(II);<br>
- }<br>
+ NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);<br>
+ DD->beginInstruction(II);<br>
}<br>
<br>
if (isVerbose())<br>
@@ -762,12 +754,8 @@ void AsmPrinter::EmitFunctionBody() {<br>
}<br>
<br>
if (ShouldPrintDebugScopes) {<br>
- for (unsigned III = 0, EEE = Handlers.size(); III != EEE; ++III) {<br>
- const HandlerInfo &OI = Handlers[III];<br>
- NamedRegionTimer T(OI.TimerName, OI.TimerGroupName,<br>
- TimePassesIsEnabled);<br>
- OI.Handler->endInstruction();<br>
- }<br>
+ NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);<br>
+ DD->endInstruction(II);<br>
}<br>
}<br>
}<br>
@@ -823,11 +811,14 @@ void AsmPrinter::EmitFunctionBody() {<br>
OutStreamer.EmitELFSize(CurrentFnSym, SizeExp);<br>
}<br>
<br>
- // Emit post-function debug and/or EH information.<br>
- for (unsigned I = 0, E = Handlers.size(); I != E; ++I) {<br>
- const HandlerInfo &OI = Handlers[I];<br>
- NamedRegionTimer T(OI.TimerName, OI.TimerGroupName, TimePassesIsEnabled);<br>
- OI.Handler->endFunction();<br>
+ // Emit post-function debug information.<br>
+ if (DD) {<br>
+ NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);<br>
+ DD->endFunction(MF);<br>
+ }<br>
+ if (DE) {<br>
+ NamedRegionTimer T(EHTimerName, DWARFGroupName, TimePassesIsEnabled);<br>
+ DE->endFunction();<br>
}<br>
MMI->EndFunction();<br>
<br>
@@ -916,15 +907,20 @@ bool AsmPrinter::doFinalization(Module &<br>
OutStreamer.Flush();<br>
<br>
// Finalize debug and EH information.<br>
- for (unsigned I = 0, E = Handlers.size(); I != E; ++I) {<br>
- const HandlerInfo &OI = Handlers[I];<br>
- NamedRegionTimer T(OI.TimerName, OI.TimerGroupName,<br>
- TimePassesIsEnabled);<br>
- OI.Handler->endModule();<br>
- delete OI.Handler;<br>
+ if (DE) {<br>
+ {<br>
+ NamedRegionTimer T(EHTimerName, DWARFGroupName, TimePassesIsEnabled);<br>
+ DE->endModule();<br>
+ }<br>
+ delete DE; DE = 0;<br>
+ }<br>
+ if (DD) {<br>
+ {<br>
+ NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);<br>
+ DD->endModule();<br>
+ }<br>
+ delete DD; DD = 0;<br>
}<br>
- Handlers.clear();<br>
- DD = 0;<br>
<br>
// If the target wants to know about weak references, print them all.<br>
if (MAI->getWeakRefDirective()) {<br>
<br>
Removed: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterHandler.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterHandler.h?rev=196271&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterHandler.h?rev=196271&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterHandler.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterHandler.h (removed)<br>
@@ -1,53 +0,0 @@<br>
-//===-- lib/CodeGen/AsmPrinter/AsmPrinterHandler.h -------------*- C++ -*--===//<br>
-//<br>
-// The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-//<br>
-// This file contains a generic interface for AsmPrinter handlers,<br>
-// like debug and EH info emitters.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#ifndef CODEGEN_ASMPRINTER_ASMPRINTERHANDLER_H__<br>
-#define CODEGEN_ASMPRINTER_ASMPRINTERHANDLER_H__<br>
-<br>
-#include "llvm/Support/DataTypes.h"<br>
-<br>
-namespace llvm {<br>
-<br>
-class MachineFunction;<br>
-class MachineInstr;<br>
-class MCSymbol;<br>
-<br>
-/// \brief Collects and handles AsmPrinter objects required to build debug<br>
-/// or EH information.<br>
-class AsmPrinterHandler {<br>
-public:<br>
- virtual ~AsmPrinterHandler() {}<br>
-<br>
- /// \brief For symbols that have a size designated (e.g. common symbols),<br>
- /// this tracks that size.<br>
- virtual void setSymbolSize(const MCSymbol *Sym, uint64_t Size) = 0;<br>
-<br>
- /// \brief Emit all sections that should come after the content.<br>
- virtual void endModule() = 0;<br>
-<br>
- /// \brief Gather pre-function debug information.<br>
- virtual void beginFunction(const MachineFunction *MF) = 0;<br>
-<br>
- /// \brief Gather post-function debug information.<br>
- virtual void endFunction() = 0;<br>
-<br>
- /// \brief Process beginning of an instruction.<br>
- virtual void beginInstruction(const MachineInstr *MI) = 0;<br>
-<br>
- /// \brief Process end of an instruction.<br>
- virtual void endInstruction() = 0;<br>
-};<br>
-} // End of namespace llvm<br>
-<br>
-#endif<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=196272&r1=196271&r2=196272&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=196272&r1=196271&r2=196272&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Tue Dec 3 07:15:54 2013<br>
@@ -390,9 +390,7 @@ unsigned DIEEntry::getRefAddrSize(AsmPri<br>
// specified to be four bytes in the DWARF 32-bit format and eight bytes<br>
// in the DWARF 64-bit format, while DWARF Version 2 specifies that such<br>
// references have the same size as an address on the target system.<br>
- const DwarfDebug *DD = AP->getDwarfDebug();<br>
- assert(DD && "Expected Dwarf Debug info to be available");<br>
- if (DD->getDwarfVersion() == 2)<br>
+ if (AP->getDwarfDebug()->getDwarfVersion() == 2)<br>
return AP->getDataLayout().getPointerSize();<br>
return sizeof(int32_t);<br>
}<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=196272&r1=196271&r2=196272&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=196272&r1=196271&r2=196272&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Dec 3 07:15:54 2013<br>
@@ -197,7 +197,6 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Mo<br>
DwarfAddrSectionSym = 0;<br>
DwarfAbbrevDWOSectionSym = DwarfStrDWOSectionSym = 0;<br>
FunctionBeginSym = FunctionEndSym = 0;<br>
- CurFn = 0; CurMI = 0;<br>
<br>
// Turn on accelerator tables for Darwin by default, pubnames by<br>
// default for non-Darwin, and handle split dwarf.<br>
@@ -1145,7 +1144,6 @@ void DwarfDebug::endSections() {<br>
<br>
// Emit all Dwarf sections that should come after the content.<br>
void DwarfDebug::endModule() {<br>
- assert(CurFn == 0);<br>
<br>
if (!FirstCU)<br>
return;<br>
@@ -1227,7 +1225,8 @@ DbgVariable *DwarfDebug::findAbstractVar<br>
}<br>
<br>
// If Var is a current function argument then add it to CurrentFnArguments list.<br>
-bool DwarfDebug::addCurrentFnArgument(DbgVariable *Var, LexicalScope *Scope) {<br>
+bool DwarfDebug::addCurrentFnArgument(const MachineFunction *MF,<br>
+ DbgVariable *Var, LexicalScope *Scope) {<br>
if (!LScopes.isCurrentFunctionScope(Scope))<br>
return false;<br>
DIVariable DV = Var->getVariable();<br>
@@ -1239,7 +1238,7 @@ bool DwarfDebug::addCurrentFnArgument(Db<br>
<br>
size_t Size = CurrentFnArguments.size();<br>
if (Size == 0)<br>
- CurrentFnArguments.resize(CurFn->getFunction()->arg_size());<br>
+ CurrentFnArguments.resize(MF->getFunction()->arg_size());<br>
// llvm::Function argument size is not good indicator of how many<br>
// arguments does the function have at source level.<br>
if (ArgNo > Size)<br>
@@ -1250,7 +1249,7 @@ bool DwarfDebug::addCurrentFnArgument(Db<br>
<br>
// Collect variable information from side table maintained by MMI.<br>
void DwarfDebug::collectVariableInfoFromMMITable(<br>
- SmallPtrSet<const MDNode *, 16> &Processed) {<br>
+ const MachineFunction *MF, SmallPtrSet<const MDNode *, 16> &Processed) {<br>
MachineModuleInfo::VariableDbgInfoMapTy &VMap = MMI->getVariableDbgInfo();<br>
for (MachineModuleInfo::VariableDbgInfoMapTy::iterator VI = VMap.begin(),<br>
VE = VMap.end();<br>
@@ -1271,7 +1270,7 @@ void DwarfDebug::collectVariableInfoFrom<br>
DbgVariable *AbsDbgVariable = findAbstractVariable(DV, VP.second);<br>
DbgVariable *RegVar = new DbgVariable(DV, AbsDbgVariable, this);<br>
RegVar->setFrameIndex(VP.first);<br>
- if (!addCurrentFnArgument(RegVar, Scope))<br>
+ if (!addCurrentFnArgument(MF, RegVar, Scope))<br>
addScopeVariable(Scope, RegVar);<br>
if (AbsDbgVariable)<br>
AbsDbgVariable->setFrameIndex(VP.first);<br>
@@ -1318,10 +1317,11 @@ static DotDebugLocEntry getDebugLocEntry<br>
<br>
// Find variables for each lexical scope.<br>
void<br>
-DwarfDebug::collectVariableInfo(SmallPtrSet<const MDNode *, 16> &Processed) {<br>
+DwarfDebug::collectVariableInfo(const MachineFunction *MF,<br>
+ SmallPtrSet<const MDNode *, 16> &Processed) {<br>
<br>
// Grab the variable info that was squirreled away in the MMI side-table.<br>
- collectVariableInfoFromMMITable(Processed);<br>
+ collectVariableInfoFromMMITable(MF, Processed);<br>
<br>
for (SmallVectorImpl<const MDNode *>::const_iterator<br>
UVI = UserVariables.begin(),<br>
@@ -1341,7 +1341,7 @@ DwarfDebug::collectVariableInfo(SmallPtr<br>
DIVariable DV(Var);<br>
LexicalScope *Scope = NULL;<br>
if (DV.getTag() == dwarf::DW_TAG_arg_variable &&<br>
- DISubprogram(DV.getContext()).describes(CurFn->getFunction()))<br>
+ DISubprogram(DV.getContext()).describes(MF->getFunction()))<br>
Scope = LScopes.getCurrentFunctionScope();<br>
else if (MDNode *IA = DV.getInlinedAt())<br>
Scope = LScopes.findInlinedScope(DebugLoc::getFromDILocation(IA));<br>
@@ -1355,7 +1355,7 @@ DwarfDebug::collectVariableInfo(SmallPtr<br>
assert(MInsn->isDebugValue() && "History must begin with debug value");<br>
DbgVariable *AbsVar = findAbstractVariable(DV, MInsn->getDebugLoc());<br>
DbgVariable *RegVar = new DbgVariable(DV, AbsVar, this);<br>
- if (!addCurrentFnArgument(RegVar, Scope))<br>
+ if (!addCurrentFnArgument(MF, RegVar, Scope))<br>
addScopeVariable(Scope, RegVar);<br>
if (AbsVar)<br>
AbsVar->setMInsn(MInsn);<br>
@@ -1437,8 +1437,6 @@ MCSymbol *DwarfDebug::getLabelAfterInsn(<br>
<br>
// Process beginning of an instruction.<br>
void DwarfDebug::beginInstruction(const MachineInstr *MI) {<br>
- assert(CurMI == 0);<br>
- CurMI = MI;<br>
// Check if source location changes, but ignore DBG_VALUE locations.<br>
if (!MI->isDebugValue()) {<br>
DebugLoc DL = MI->getDebugLoc();<br>
@@ -1480,16 +1478,14 @@ void DwarfDebug::beginInstruction(const<br>
}<br>
<br>
// Process end of an instruction.<br>
-void DwarfDebug::endInstruction() {<br>
- assert(CurMI != 0);<br>
+void DwarfDebug::endInstruction(const MachineInstr *MI) {<br>
// Don't create a new label after DBG_VALUE instructions.<br>
// They don't generate code.<br>
- if (!CurMI->isDebugValue())<br>
+ if (!MI->isDebugValue())<br>
PrevLabel = 0;<br>
<br>
DenseMap<const MachineInstr *, MCSymbol *>::iterator I =<br>
- LabelsAfterInsn.find(CurMI);<br>
- CurMI = 0;<br>
+ LabelsAfterInsn.find(MI);<br>
<br>
// No label needed.<br>
if (I == LabelsAfterInsn.end())<br>
@@ -1569,7 +1565,6 @@ static DebugLoc getFnDebugLoc(DebugLoc D<br>
// Gather pre-function debug information. Assumes being called immediately<br>
// after the function entry point has been emitted.<br>
void DwarfDebug::beginFunction(const MachineFunction *MF) {<br>
- CurFn = MF;<br>
<br>
// If there's no debug info for the function we're not going to do anything.<br>
if (!MMI->hasDebugInfo())<br>
@@ -1796,13 +1791,9 @@ void DwarfDebug::addScopeVariable(Lexica<br>
}<br>
<br>
// Gather and emit post-function debug information.<br>
-void DwarfDebug::endFunction() {<br>
- assert(CurFn != 0);<br>
-<br>
- if (!MMI->hasDebugInfo() || LScopes.empty()) {<br>
- CurFn = 0;<br>
+void DwarfDebug::endFunction(const MachineFunction *MF) {<br>
+ if (!MMI->hasDebugInfo() || LScopes.empty())<br>
return;<br>
- }<br>
<br>
// Define end label for subprogram.<br>
FunctionEndSym = Asm->GetTempSymbol("func_end", Asm->getFunctionNumber());<br>
@@ -1812,7 +1803,7 @@ void DwarfDebug::endFunction() {<br>
Asm->OutStreamer.getContext().setDwarfCompileUnitID(0);<br>
<br>
SmallPtrSet<const MDNode *, 16> ProcessedVars;<br>
- collectVariableInfo(ProcessedVars);<br>
+ collectVariableInfo(MF, ProcessedVars);<br>
<br>
LexicalScope *FnScope = LScopes.getCurrentFunctionScope();<br>
CompileUnit *TheCU = SPMap.lookup(FnScope->getScopeNode());<br>
@@ -1846,7 +1837,7 @@ void DwarfDebug::endFunction() {<br>
<br>
DIE *CurFnDIE = constructScopeDIE(TheCU, FnScope);<br>
<br>
- if (!CurFn->getTarget().Options.DisableFramePointerElim(*CurFn))<br>
+ if (!MF->getTarget().Options.DisableFramePointerElim(*MF))<br>
TheCU->addFlag(CurFnDIE, dwarf::DW_AT_APPLE_omit_frame_ptr);<br>
<br>
// Clear debug info<br>
@@ -1862,7 +1853,6 @@ void DwarfDebug::endFunction() {<br>
LabelsBeforeInsn.clear();<br>
LabelsAfterInsn.clear();<br>
PrevLabel = NULL;<br>
- CurFn = 0;<br>
}<br>
<br>
// Register a source line with debug info. Returns the unique label that was<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=196272&r1=196271&r2=196272&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=196272&r1=196271&r2=196272&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Tue Dec 3 07:15:54 2013<br>
@@ -14,7 +14,6 @@<br>
#ifndef CODEGEN_ASMPRINTER_DWARFDEBUG_H__<br>
#define CODEGEN_ASMPRINTER_DWARFDEBUG_H__<br>
<br>
-#include "AsmPrinterHandler.h"<br>
#include "DIE.h"<br>
#include "llvm/ADT/DenseMap.h"<br>
#include "llvm/ADT/FoldingSet.h"<br>
@@ -317,7 +316,7 @@ struct SymbolCU {<br>
};<br>
<br>
/// \brief Collects and handles dwarf debug information.<br>
-class DwarfDebug : public AsmPrinterHandler {<br>
+class DwarfDebug {<br>
// Target of Dwarf emission.<br>
AsmPrinter *Asm;<br>
<br>
@@ -419,12 +418,6 @@ class DwarfDebug : public AsmPrinterHand<br>
// body.<br>
DebugLoc PrologEndLoc;<br>
<br>
- // If nonnull, stores the current machine function we're processing.<br>
- const MachineFunction *CurFn;<br>
-<br>
- // If nonnull, stores the current machine instruction we're processing.<br>
- const MachineInstr *CurMI;<br>
-<br>
// Section Symbols: these are assembler temporary labels that are emitted at<br>
// the beginning of each supported dwarf section. These are used to form<br>
// section offsets and are created by EmitSectionLabels.<br>
@@ -655,14 +648,17 @@ class DwarfDebug : public AsmPrinterHand<br>
<br>
/// \brief If Var is an current function argument that add it in<br>
/// CurrentFnArguments list.<br>
- bool addCurrentFnArgument(DbgVariable *Var, LexicalScope *Scope);<br>
+ bool addCurrentFnArgument(const MachineFunction *MF,<br>
+ DbgVariable *Var, LexicalScope *Scope);<br>
<br>
/// \brief Populate LexicalScope entries with variables' info.<br>
- void collectVariableInfo(SmallPtrSet<const MDNode *, 16> &ProcessedVars);<br>
+ void collectVariableInfo(const MachineFunction *,<br>
+ SmallPtrSet<const MDNode *, 16> &ProcessedVars);<br>
<br>
/// \brief Collect variable information from the side table maintained<br>
/// by MMI.<br>
- void collectVariableInfoFromMMITable(SmallPtrSet<const MDNode *, 16> &P);<br>
+ void collectVariableInfoFromMMITable(const MachineFunction * MF,<br>
+ SmallPtrSet<const MDNode *, 16> &P);<br>
<br>
/// \brief Ensure that a label will be emitted before MI.<br>
void requestLabelBeforeInsn(const MachineInstr *MI) {<br>
@@ -704,13 +700,13 @@ public:<br>
void beginFunction(const MachineFunction *MF);<br>
<br>
/// \brief Gather and emit post-function debug information.<br>
- void endFunction();<br>
+ void endFunction(const MachineFunction *MF);<br>
<br>
/// \brief Process beginning of an instruction.<br>
void beginInstruction(const MachineInstr *MI);<br>
<br>
/// \brief Process end of an instruction.<br>
- void endInstruction();<br>
+ void endInstruction(const MachineInstr *MI);<br>
<br>
/// \brief Add a DIE to the set of types that we're going to pull into<br>
/// type units.<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h?rev=196272&r1=196271&r2=196272&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h?rev=196272&r1=196271&r2=196272&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h Tue Dec 3 07:15:54 2013<br>
@@ -14,7 +14,6 @@<br>
#ifndef LLVM_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H<br>
#define LLVM_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H<br>
<br>
-#include "AsmPrinterHandler.h"<br>
#include "llvm/ADT/DenseMap.h"<br>
#include "llvm/CodeGen/AsmPrinter.h"<br>
#include <vector><br>
@@ -36,7 +35,7 @@ class AsmPrinter;<br>
//===----------------------------------------------------------------------===//<br>
/// DwarfException - Emits Dwarf exception handling directives.<br>
///<br>
-class DwarfException : public AsmPrinterHandler {<br>
+class DwarfException {<br>
protected:<br>
/// Asm - Target of Dwarf emission.<br>
AsmPrinter *Asm;<br>
@@ -141,11 +140,6 @@ public:<br>
<br>
/// endFunction - Gather and emit post-function exception information.<br>
virtual void endFunction();<br>
-<br>
- // We don't need these.<br>
- virtual void setSymbolSize(const MCSymbol *Sym, uint64_t Size) {}<br>
- virtual void beginInstruction(const MachineInstr *MI) {}<br>
- virtual void endInstruction() {}<br>
};<br>
<br>
class DwarfCFIException : public DwarfException {<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>