summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-03-25 01:03:24 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-03-25 01:03:24 +0000
commit5d988246155a50927b1e8d79e94b237efe95858e (patch)
tree95a6ce4a8028769d7d2ab72f622352b8b172542c
parent5caf2ff56173b12e3716ab09934bc6fb97c4e655 (diff)
downloadbcm5719-llvm-5d988246155a50927b1e8d79e94b237efe95858e.tar.gz
bcm5719-llvm-5d988246155a50927b1e8d79e94b237efe95858e.zip
MC: Eliminate MC{Fragment,{Section,Symbol}Data}::getAddress.
llvm-svn: 99467
-rw-r--r--llvm/include/llvm/MC/MCAssembler.h17
-rw-r--r--llvm/lib/MC/MCAssembler.cpp16
2 files changed, 11 insertions, 22 deletions
diff --git a/llvm/include/llvm/MC/MCAssembler.h b/llvm/include/llvm/MC/MCAssembler.h
index 54c91a2cb53..51fb88bf33a 100644
--- a/llvm/include/llvm/MC/MCAssembler.h
+++ b/llvm/include/llvm/MC/MCAssembler.h
@@ -57,6 +57,8 @@ public:
};
class MCFragment : public ilist_node<MCFragment> {
+ friend class MCAsmLayout;
+
MCFragment(const MCFragment&); // DO NOT IMPLEMENT
void operator=(const MCFragment&); // DO NOT IMPLEMENT
@@ -108,8 +110,6 @@ public:
//
// FIXME: This could all be kept private to the assembler implementation.
- uint64_t getAddress() const;
-
uint64_t getFileSize() const {
assert(FileSize != ~UINT64_C(0) && "File size not set!");
return FileSize;
@@ -390,6 +390,8 @@ public:
// we anticipate the fast path being through an MCAssembler, the only reason to
// keep it out is for API abstraction.
class MCSectionData : public ilist_node<MCSectionData> {
+ friend class MCAsmLayout;
+
MCSectionData(const MCSectionData&); // DO NOT IMPLEMENT
void operator=(const MCSectionData&); // DO NOT IMPLEMENT
@@ -469,12 +471,6 @@ public:
//
// FIXME: This could all be kept private to the assembler implementation.
- uint64_t getAddress() const {
- assert(Address != ~UINT64_C(0) && "Address not set!");
- return Address;
- }
- void setAddress(uint64_t Value) { Address = Value; }
-
uint64_t getSize() const {
assert(Size != ~UINT64_C(0) && "File size not set!");
return Size;
@@ -549,11 +545,6 @@ public:
uint64_t getOffset() const { return Offset; }
void setOffset(uint64_t Value) { Offset = Value; }
- uint64_t getAddress() const {
- assert(getFragment() && "Invalid getAddress() on undefined symbol!");
- return getFragment()->getAddress() + getOffset();
- }
-
/// @}
/// @name Symbol Attributes
/// @{
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index 4a5db8ce222..3fac6c83349 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -46,19 +46,22 @@ STATISTIC(ObjectBytes, "Number of emitted object file bytes");
/* *** */
uint64_t MCAsmLayout::getFragmentAddress(const MCFragment *F) const {
- return F->getAddress();
+ assert(F->getParent() && "Missing section()!");
+ return getSectionAddress(F->getParent()) + F->getOffset();
}
uint64_t MCAsmLayout::getSymbolAddress(const MCSymbolData *SD) const {
- return SD->getAddress();
+ assert(SD->getFragment() && "Invalid getAddress() on undefined symbol!");
+ return getFragmentAddress(SD->getFragment()) + SD->getOffset();
}
uint64_t MCAsmLayout::getSectionAddress(const MCSectionData *SD) const {
- return SD->getAddress();
+ assert(SD->Address != ~UINT64_C(0) && "Address not set!");
+ return SD->Address;
}
void MCAsmLayout::setSectionAddress(MCSectionData *SD, uint64_t Value) {
- SD->setAddress(Value);
+ SD->Address = Value;
}
/* *** */
@@ -78,11 +81,6 @@ MCFragment::MCFragment(FragmentType _Kind, MCSectionData *_Parent)
MCFragment::~MCFragment() {
}
-uint64_t MCFragment::getAddress() const {
- assert(getParent() && "Missing Section!");
- return getParent()->getAddress() + Offset;
-}
-
/* *** */
MCSectionData::MCSectionData() : Section(0) {}
OpenPOWER on IntegriCloud