diff options
author | Rui Ueyama <ruiu@google.com> | 2015-03-26 02:20:25 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2015-03-26 02:20:25 +0000 |
commit | 629f964d50d140366edd129bc4368ba6bd918eea (patch) | |
tree | f1f4af79d81d6b1a2b097a6e696663761d1a0a82 /lld/include/lld | |
parent | f217ef0d75a4438f610764e582823ffd4807d75d (diff) | |
download | bcm5719-llvm-629f964d50d140366edd129bc4368ba6bd918eea.tar.gz bcm5719-llvm-629f964d50d140366edd129bc4368ba6bd918eea.zip |
Use arithmetic type to represent alignments (not in log2) everywhere.
This is the final step of conversion. Now log2 numbers are removed
from everywhere!
llvm-svn: 233246
Diffstat (limited to 'lld/include/lld')
-rw-r--r-- | lld/include/lld/Core/DefinedAtom.h | 22 | ||||
-rw-r--r-- | lld/include/lld/ReaderWriter/MachOLinkingContext.h | 6 |
2 files changed, 4 insertions, 24 deletions
diff --git a/lld/include/lld/Core/DefinedAtom.h b/lld/include/lld/Core/DefinedAtom.h index 211c9bd50c9..986c7ff5ad1 100644 --- a/lld/include/lld/Core/DefinedAtom.h +++ b/lld/include/lld/Core/DefinedAtom.h @@ -17,26 +17,6 @@ namespace lld { class File; class Reference; -// This class represents exponents of power-of-two numbers. -// Used to represent alignments. -// -// Currently we represent alignments both in log2 of a value or a -// value itself. That is confusing. We aim to use only real values -// only. Conversion is not easy, since both types are just arithmetic -// types, and thus the compiler doesn't help us find places we mix -// them. This class is to make all places where exponents are used -// explicit. -// -// Once the conversion is done, this class will be removed. -class PowerOf2 { -public: - PowerOf2(uint16_t v) : _v(v) {} - bool operator==(const PowerOf2 &other) const { return _v == other._v; } - operator uint16_t() const { return _v; } -private: - uint16_t _v; -}; - /// \brief The fundamental unit of linking. /// /// A C function or global variable is an atom. An atom has content and @@ -220,7 +200,7 @@ public: struct Alignment { Alignment(int v, int m = 0) : value(v), modulus(m) {} - PowerOf2 value; + uint16_t value; uint16_t modulus; bool operator==(const Alignment &rhs) const { diff --git a/lld/include/lld/ReaderWriter/MachOLinkingContext.h b/lld/include/lld/ReaderWriter/MachOLinkingContext.h index 9775aa5f8fb..f8239a48d82 100644 --- a/lld/include/lld/ReaderWriter/MachOLinkingContext.h +++ b/lld/include/lld/ReaderWriter/MachOLinkingContext.h @@ -228,10 +228,10 @@ public: const StringRefVector &rpaths() const { return _rpaths; } /// Add section alignment constraint on final layout. - void addSectionAlignment(StringRef seg, StringRef sect, PowerOf2 align2); + void addSectionAlignment(StringRef seg, StringRef sect, uint16_t align2); /// Returns true if specified section had alignment constraints. - bool sectionAligned(StringRef seg, StringRef sect, PowerOf2 &align2) const; + bool sectionAligned(StringRef seg, StringRef sect, uint16_t &align2) const; StringRef dyldPath() const { return "/usr/lib/dyld"; } @@ -312,7 +312,7 @@ private: struct SectionAlign { StringRef segmentName; StringRef sectionName; - PowerOf2 align2; + uint16_t align2; }; struct OrderFileNode { |