summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCAssembler.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-05-13 01:10:22 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-05-13 01:10:22 +0000
commit4dac59dcb7725df200d35a5ae64335f84c0e7c6a (patch)
tree17fe0d9430219bc65cdd332d08eddebdc6e69231 /llvm/lib/MC/MCAssembler.cpp
parentc96f1fbd8d7867938716374067e63b6fa822d066 (diff)
downloadbcm5719-llvm-4dac59dcb7725df200d35a5ae64335f84c0e7c6a.tar.gz
bcm5719-llvm-4dac59dcb7725df200d35a5ae64335f84c0e7c6a.zip
MC: Add MCSectionData::AddressSize, which is the size of the address space consumed by the section. This can differ from both the section logical size, and the section size on disk (although the current code handles this without making an explicit distinction).
llvm-svn: 103689
Diffstat (limited to 'llvm/lib/MC/MCAssembler.cpp')
-rw-r--r--llvm/lib/MC/MCAssembler.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index 0bab34e4b21..ced395c5170 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -126,6 +126,14 @@ void MCAsmLayout::setSectionFileSize(MCSectionData *SD, uint64_t Value) {
SD->FileSize = Value;
}
+uint64_t MCAsmLayout::getSectionAddressSize(const MCSectionData *SD) const {
+ assert(SD->AddressSize != ~UINT64_C(0) && "Address size not set!");
+ return SD->AddressSize;
+}
+void MCAsmLayout::setSectionAddressSize(MCSectionData *SD, uint64_t Value) {
+ SD->AddressSize = Value;
+}
+
/* *** */
MCFragment::MCFragment() : Kind(FragmentType(~0)) {
@@ -150,6 +158,7 @@ MCSectionData::MCSectionData(const MCSection &_Section, MCAssembler *A)
Alignment(1),
Address(~UINT64_C(0)),
Size(~UINT64_C(0)),
+ AddressSize(~UINT64_C(0)),
FileSize(~UINT64_C(0)),
HasInstructions(false)
{
@@ -434,7 +443,8 @@ void MCAssembler::LayoutSection(MCAsmLayout &Layout,
uint64_t StartAddress = 0;
if (SectionOrderIndex) {
MCSectionData *Prev = Layout.getSectionOrder()[SectionOrderIndex - 1];
- StartAddress = Layout.getSectionAddress(Prev) + Layout.getSectionSize(Prev);
+ StartAddress = (Layout.getSectionAddress(Prev) +
+ Layout.getSectionAddressSize(Prev));
}
// Align this section if necessary by adding padding bytes to the previous
@@ -465,6 +475,7 @@ void MCAssembler::LayoutSection(MCAsmLayout &Layout,
Size = Layout.getFragmentOffset(F) + Layout.getFragmentEffectiveSize(F);
}
Layout.setSectionSize(&SD, Size);
+ Layout.setSectionAddressSize(&SD, Size);
Layout.setSectionFileSize(&SD, IsVirtual ? 0 : Size);
}
@@ -837,9 +848,7 @@ void MCFragment::dump() {
raw_ostream &OS = llvm::errs();
OS << "<MCFragment " << (void*) this << " Offset:" << Offset
- << " EffectiveSize:" << EffectiveSize;
-
- OS << ">";
+ << " EffectiveSize:" << EffectiveSize << ">";
}
void MCAlignFragment::dump() {
@@ -914,8 +923,8 @@ void MCSectionData::dump() {
OS << "<MCSectionData";
OS << " Alignment:" << getAlignment() << " Address:" << Address
- << " Size:" << Size << " FileSize:" << FileSize
- << " Fragments:[\n ";
+ << " Size:" << Size << " AddressSize:" << AddressSize
+ << " FileSize:" << FileSize << " Fragments:[\n ";
for (iterator it = begin(), ie = end(); it != ie; ++it) {
if (it != begin()) OS << ",\n ";
it->dump();
OpenPOWER on IntegriCloud