mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 07:24:25 +00:00
Add DwarfWriter interface to mainipulate source location info.
( May be this info should be directly handled by the dwarf writer ? ) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62096 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -30,6 +30,7 @@ class DwarfException;
|
|||||||
class MachineModuleInfo;
|
class MachineModuleInfo;
|
||||||
class MachineFunction;
|
class MachineFunction;
|
||||||
class Module;
|
class Module;
|
||||||
|
class GlobalVariable;
|
||||||
class TargetAsmInfo;
|
class TargetAsmInfo;
|
||||||
class raw_ostream;
|
class raw_ostream;
|
||||||
|
|
||||||
@ -73,6 +74,25 @@ public:
|
|||||||
/// EndFunction - Gather and emit post-function debug information.
|
/// EndFunction - Gather and emit post-function debug information.
|
||||||
///
|
///
|
||||||
void EndFunction(MachineFunction *MF);
|
void EndFunction(MachineFunction *MF);
|
||||||
|
|
||||||
|
|
||||||
|
/// label. Returns a unique label ID used to generate a label and provide
|
||||||
|
/// correspondence to the source line list.
|
||||||
|
unsigned RecordSourceLine(unsigned Line, unsigned Col, unsigned Src);
|
||||||
|
|
||||||
|
/// RecordSource - Register a source file with debug info. Returns an source
|
||||||
|
/// ID.
|
||||||
|
unsigned RecordSource(const std::string &Dir, const std::string &File);
|
||||||
|
|
||||||
|
/// RecordRegionStart - Indicate the start of a region.
|
||||||
|
unsigned RecordRegionStart(GlobalVariable *V);
|
||||||
|
|
||||||
|
/// RecordRegionEnd - Indicate the end of a region.
|
||||||
|
unsigned RecordRegionEnd(GlobalVariable *V);
|
||||||
|
|
||||||
|
/// getRecordSourceLineCount - Count source lines.
|
||||||
|
unsigned getRecordSourceLineCount();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -2538,51 +2538,6 @@ private:
|
|||||||
return VariableDie;
|
return VariableDie;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned RecordSourceLine(Value *V, unsigned Line, unsigned Col) {
|
|
||||||
CompileUnit *Unit = DW_CUs[V];
|
|
||||||
assert (Unit && "Unable to find CompileUnit");
|
|
||||||
unsigned ID = MMI->NextLabelID();
|
|
||||||
Lines.push_back(SrcLineInfo(Line, Col, Unit->getID(), ID));
|
|
||||||
return ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned getRecordSourceLineCount() {
|
|
||||||
return Lines.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned RecordSource(const std::string &Directory,
|
|
||||||
const std::string &File) {
|
|
||||||
unsigned DID = Directories.insert(Directory);
|
|
||||||
return SrcFiles.insert(SrcFileInfo(DID,File));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// RecordRegionStart - Indicate the start of a region.
|
|
||||||
///
|
|
||||||
unsigned RecordRegionStart(GlobalVariable *V) {
|
|
||||||
DbgScope *Scope = getOrCreateScope(V);
|
|
||||||
unsigned ID = MMI->NextLabelID();
|
|
||||||
if (!Scope->getStartLabelID()) Scope->setStartLabelID(ID);
|
|
||||||
return ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// RecordRegionEnd - Indicate the end of a region.
|
|
||||||
///
|
|
||||||
unsigned RecordRegionEnd(GlobalVariable *V) {
|
|
||||||
DbgScope *Scope = getOrCreateScope(V);
|
|
||||||
unsigned ID = MMI->NextLabelID();
|
|
||||||
Scope->setEndLabelID(ID);
|
|
||||||
return ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// RecordVariable - Indicate the declaration of a local variable.
|
|
||||||
///
|
|
||||||
void RecordVariable(GlobalVariable *GV, unsigned FrameIndex) {
|
|
||||||
DbgScope *Scope = getOrCreateScope(GV);
|
|
||||||
DIVariable *VD = new DIVariable(GV);
|
|
||||||
DbgVariable *DV = new DbgVariable(VD, FrameIndex);
|
|
||||||
Scope->AddVariable(DV);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// getOrCreateScope - Returns the scope associated with the given descriptor.
|
/// getOrCreateScope - Returns the scope associated with the given descriptor.
|
||||||
///
|
///
|
||||||
DbgScope *getOrCreateScope(GlobalVariable *V) {
|
DbgScope *getOrCreateScope(GlobalVariable *V) {
|
||||||
@ -3833,6 +3788,67 @@ public:
|
|||||||
}
|
}
|
||||||
Lines.clear();
|
Lines.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/// RecordSourceLine - Records location information and associates it with a
|
||||||
|
/// label. Returns a unique label ID used to generate a label and provide
|
||||||
|
/// correspondence to the source line list.
|
||||||
|
unsigned RecordSourceLine(Value *V, unsigned Line, unsigned Col) {
|
||||||
|
CompileUnit *Unit = DW_CUs[V];
|
||||||
|
assert (Unit && "Unable to find CompileUnit");
|
||||||
|
unsigned ID = MMI->NextLabelID();
|
||||||
|
Lines.push_back(SrcLineInfo(Line, Col, Unit->getID(), ID));
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// RecordSourceLine - Records location information and associates it with a
|
||||||
|
/// label. Returns a unique label ID used to generate a label and provide
|
||||||
|
/// correspondence to the source line list.
|
||||||
|
unsigned RecordSourceLine(unsigned Line, unsigned Col, unsigned Src) {
|
||||||
|
unsigned ID = MMI->NextLabelID();
|
||||||
|
Lines.push_back(SrcLineInfo(Line, Col, Src, ID));
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned getRecordSourceLineCount() {
|
||||||
|
return Lines.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// RecordSource - Register a source file with debug info. Returns an source
|
||||||
|
/// ID.
|
||||||
|
unsigned RecordSource(const std::string &Directory,
|
||||||
|
const std::string &File) {
|
||||||
|
unsigned DID = Directories.insert(Directory);
|
||||||
|
return SrcFiles.insert(SrcFileInfo(DID,File));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// RecordRegionStart - Indicate the start of a region.
|
||||||
|
///
|
||||||
|
unsigned RecordRegionStart(GlobalVariable *V) {
|
||||||
|
DbgScope *Scope = getOrCreateScope(V);
|
||||||
|
unsigned ID = MMI->NextLabelID();
|
||||||
|
if (!Scope->getStartLabelID()) Scope->setStartLabelID(ID);
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// RecordRegionEnd - Indicate the end of a region.
|
||||||
|
///
|
||||||
|
unsigned RecordRegionEnd(GlobalVariable *V) {
|
||||||
|
DbgScope *Scope = getOrCreateScope(V);
|
||||||
|
unsigned ID = MMI->NextLabelID();
|
||||||
|
Scope->setEndLabelID(ID);
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// RecordVariable - Indicate the declaration of a local variable.
|
||||||
|
///
|
||||||
|
void RecordVariable(GlobalVariable *GV, unsigned FrameIndex) {
|
||||||
|
DbgScope *Scope = getOrCreateScope(GV);
|
||||||
|
DIVariable *VD = new DIVariable(GV);
|
||||||
|
DbgVariable *DV = new DbgVariable(VD, FrameIndex);
|
||||||
|
Scope->AddVariable(DV);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -4927,3 +4943,33 @@ void DwarfWriter::EndFunction(MachineFunction *MF) {
|
|||||||
// Clear function debug information.
|
// Clear function debug information.
|
||||||
MMI->EndFunction();
|
MMI->EndFunction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// RecordSourceLine - Records location information and associates it with a
|
||||||
|
/// label. Returns a unique label ID used to generate a label and provide
|
||||||
|
/// correspondence to the source line list.
|
||||||
|
unsigned DwarfWriter::RecordSourceLine(unsigned Line, unsigned Col,
|
||||||
|
unsigned Src) {
|
||||||
|
return DD->RecordSourceLine(Line, Col, Src);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// RecordSource - Register a source file with debug info. Returns an source
|
||||||
|
/// ID.
|
||||||
|
unsigned DwarfWriter::RecordSource(const std::string &Dir,
|
||||||
|
const std::string &File) {
|
||||||
|
return DD->RecordSource(Dir, File);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// RecordRegionStart - Indicate the start of a region.
|
||||||
|
unsigned DwarfWriter::RecordRegionStart(GlobalVariable *V) {
|
||||||
|
return DD->RecordRegionStart(V);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// RecordRegionEnd - Indicate the end of a region.
|
||||||
|
unsigned DwarfWriter::RecordRegionEnd(GlobalVariable *V) {
|
||||||
|
return DD->RecordRegionEnd(V);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// getRecordSourceLineCount - Count source lines.
|
||||||
|
unsigned DwarfWriter::getRecordSourceLineCount() {
|
||||||
|
return DD->getRecordSourceLineCount();
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user