summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-03-26 01:12:32 +0000
committerRui Ueyama <ruiu@google.com>2015-03-26 01:12:32 +0000
commitc3d18f512054d8268d1e1a2e5935167cd3db6480 (patch)
treebbba5c909b78c38fc03457bee4e2e3f749662115 /lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
parent2c6e0597c68c8d51b9fced91803b329a13350e64 (diff)
downloadbcm5719-llvm-c3d18f512054d8268d1e1a2e5935167cd3db6480.tar.gz
bcm5719-llvm-c3d18f512054d8268d1e1a2e5935167cd3db6480.zip
Remove implicit constructor and operator int from PowerOf2.
This patch is to make instantiation and conversion to an integer explicit, so that we can mechanically replace all occurrences of the class with integer in the next step. Now get() returns an alignment value rather than its log2 value. llvm-svn: 233242
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp')
-rw-r--r--lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
index eda11726cc7..3f8a944494e 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
@@ -328,7 +328,7 @@ void Util::appendAtom(SectionInfo *sect, const DefinedAtom *atom) {
// Figure out offset for atom in this section given alignment constraints.
uint64_t offset = sect->size;
DefinedAtom::Alignment atomAlign = atom->alignment();
- uint64_t align2 = 1 << atomAlign.powerOf2;
+ uint64_t align2 = atomAlign.powerOf2.get();
uint64_t requiredModulus = atomAlign.modulus;
uint64_t currentModulus = (offset % align2);
if ( currentModulus != requiredModulus ) {
@@ -338,7 +338,7 @@ void Util::appendAtom(SectionInfo *sect, const DefinedAtom *atom) {
offset += align2+requiredModulus-currentModulus;
}
// Record max alignment of any atom in this section.
- if ( atomAlign.powerOf2 > sect->alignment )
+ if (align2 > sect->alignment.get())
sect->alignment = atomAlign.powerOf2;
// Assign atom to this section with this offset.
AtomInfo ai = {atom, offset};
@@ -454,7 +454,7 @@ void Util::organizeSections() {
}
uint64_t Util::alignTo(uint64_t value, PowerOf2 align2) {
- return llvm::RoundUpToAlignment(value, 1 << align2);
+ return llvm::RoundUpToAlignment(value, align2.get());
}
@@ -477,7 +477,7 @@ void Util::layoutSectionsInTextSegment(size_t hlcSize, SegmentInfo *seg,
for (auto it = seg->sections.rbegin(); it != seg->sections.rend(); ++it) {
SectionInfo *sect = *it;
taddr -= sect->size;
- taddr = taddr & (0 - (1 << sect->alignment));
+ taddr = taddr & (0 - sect->alignment.get());
}
int64_t padding = taddr - hlcSize;
while (padding < 0)
OpenPOWER on IntegriCloud