[llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp
Jim Laskey
jlaskey at apple.com
Tue Mar 28 06:58:45 PST 2006
Changes in directory llvm/lib/CodeGen:
DwarfWriter.cpp updated: 1.52 -> 1.53
---
Log message:
Refactor address attributes. Add base register to frame info.
---
Diffs of the changes: (+19 -13)
DwarfWriter.cpp | 32 +++++++++++++++++++-------------
1 files changed, 19 insertions(+), 13 deletions(-)
Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.52 llvm/lib/CodeGen/DwarfWriter.cpp:1.53
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.52 Fri Mar 24 15:10:36 2006
+++ llvm/lib/CodeGen/DwarfWriter.cpp Tue Mar 28 08:58:32 2006
@@ -1213,6 +1213,21 @@
}
}
+/// AddAddress - Add an address attribute to a die based on the location
+/// provided.
+void DwarfWriter::AddAddress(DIE *Die, unsigned Attribute,
+ MachineLocation &Location) {
+ DIEBlock *Block = new DIEBlock();
+ if (Location.isRegister()) {
+ Block->AddUInt(DW_FORM_data1, DW_OP_reg0 + Location.getRegister());
+ } else {
+ Block->AddUInt(DW_FORM_data1, DW_OP_breg0 + Location.getRegister());
+ Block->AddUInt(DW_FORM_sdata, Location.getOffset());
+ }
+ Block->ComputeSize(*this);
+ Die->AddBlock(Attribute, 0, Block);
+}
+
/// getDieMapSlotFor - Returns the debug information entry map slot for the
/// specified debug descriptor.
DIE *&DwarfWriter::getDieMapSlotFor(DebugInfoDesc *DD) {
@@ -1518,7 +1533,6 @@
return SubprogramDie;
}
-
/// NewScopeVariable - Create a new scope variable.
///
DIE *DwarfWriter::NewScopeVariable(DebugVariable *DV, CompileUnit *Unit) {
@@ -1545,20 +1559,10 @@
DIE *Type = NewType(Unit->getDie(), VD->getType(), Unit);
VariableDie->AddDIEntry(DW_AT_type, DW_FORM_ref4, Type);
- // Get variable address.
+ // Add variable address.
MachineLocation Location;
Asm->TM.getRegisterInfo()->getLocation(*MF, DV->getFrameIndex(), Location);
-
- // Add computation for variable.
- DIEBlock *Block = new DIEBlock();
- if (Location.isRegister()) {
- Block->AddUInt(DW_FORM_data1, DW_OP_reg0 + Location.getRegister());
- } else {
- Block->AddUInt(DW_FORM_data1, DW_OP_breg0 + Location.getRegister());
- Block->AddUInt(DW_FORM_sdata, Location.getOffset());
- }
- Block->ComputeSize(*this);
- VariableDie->AddBlock(DW_AT_location, 0, Block);
+ AddAddress(VariableDie, DW_AT_location, Location);
return VariableDie;
}
@@ -1628,6 +1632,8 @@
DWLabel("func_begin", SubprogramCount));
SPDie->AddLabel(DW_AT_high_pc, DW_FORM_addr,
DWLabel("func_end", SubprogramCount));
+ MachineLocation Location(Asm->TM.getRegisterInfo()->getFrameRegister(*MF));
+ AddAddress(SPDie, DW_AT_frame_base, Location);
ConstructScope(RootScope, SPDie, Unit);
}
More information about the llvm-commits
mailing list