aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-03-07 15:51:33 +0000
committerJim Laskey <jlaskey@mac.com>2006-03-07 15:51:33 +0000
commit20c3ed8166d3eb436ac4edc33b33b4538ff75073 (patch)
treef30feaa9c34078b48bf30566dbada4ea1e00e90e /lib/CodeGen
parent6f8aaf2cb0f2e4d01680e67d365137cf731ad809 (diff)
downloadexternal_llvm-20c3ed8166d3eb436ac4edc33b33b4538ff75073.zip
external_llvm-20c3ed8166d3eb436ac4edc33b33b4538ff75073.tar.gz
external_llvm-20c3ed8166d3eb436ac4edc33b33b4538ff75073.tar.bz2
Bitfield support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26593 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/DwarfWriter.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp
index 9dba236..99beaf3 100644
--- a/lib/CodeGen/DwarfWriter.cpp
+++ b/lib/CodeGen/DwarfWriter.cpp
@@ -1334,20 +1334,32 @@ DIE *DwarfWriter::NewType(DIE *Context, TypeDesc *TyDesc) {
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);