[llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp
Jim Laskey
jlaskey at apple.com
Tue Mar 7 07:51:45 PST 2006
Changes in directory llvm/lib/CodeGen:
DwarfWriter.cpp updated: 1.42 -> 1.43
---
Log message:
Bitfield support.
---
Diffs of the changes: (+14 -2)
DwarfWriter.cpp | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.42 llvm/lib/CodeGen/DwarfWriter.cpp:1.43
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.42 Fri Mar 3 15:00:14 2006
+++ llvm/lib/CodeGen/DwarfWriter.cpp Tue Mar 7 09:51:33 2006
@@ -1334,20 +1334,32 @@
if (CompileUnitDesc *File = MemberDesc->getFile()) {
CompileUnit *FileUnit = FindCompileUnit(File);
unsigned FileID = FileUnit->getID();
- int Line = TyDesc->getLine();
+ int Line = MemberDesc->getLine();
Member->AddUInt(DW_AT_decl_file, 0, FileID);
Member->AddUInt(DW_AT_decl_line, 0, Line);
}
+ // FIXME - Bitfields not quite right but getting there.
+ uint64_t ByteSize = Size;
+ uint64_t ByteOffset = Offset;
+
if (TypeDesc *FromTy = MemberDesc->getFromType()) {
Member->AddDIEntry(DW_AT_type, DW_FORM_ref4,
NewType(Context, FromTy));
+ ByteSize = FromTy->getSize();
+ }
+
+ if (ByteSize != Size) {
+ ByteOffset -= Offset % ByteSize;
+ Member->AddUInt(DW_AT_byte_size, 0, ByteSize >> 3);
+ Member->AddUInt(DW_AT_bit_size, 0, Size % ByteSize);
+ Member->AddUInt(DW_AT_bit_offset, 0, Offset - ByteOffset);
}
// Add computation for offset.
DIEBlock *Block = new DIEBlock();
Block->AddUInt(DW_FORM_data1, DW_OP_plus_uconst);
- Block->AddUInt(DW_FORM_udata, Offset >> 3);
+ Block->AddUInt(DW_FORM_udata, ByteOffset >> 3);
Block->ComputeSize(*this);
Member->AddBlock(DW_AT_data_member_location, 0, Block);
More information about the llvm-commits
mailing list