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
diff --git a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
index 0940e31..c8bf7a6 100644
--- a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
@@ -731,13 +731,13 @@
 
 
 void MachOLinkingContext::addSectionAlignment(StringRef seg, StringRef sect,
-                                              PowerOf2 align2) {
+                                              uint16_t align2) {
   SectionAlign entry = { seg, sect, align2 };
   _sectAligns.push_back(entry);
 }
 
 bool MachOLinkingContext::sectionAligned(StringRef seg, StringRef sect,
-                                         PowerOf2 &align2) const {
+                                         uint16_t &align2) const {
   for (const SectionAlign &entry : _sectAligns) {
     if (seg.equals(entry.segmentName) && sect.equals(entry.sectionName)) {
       align2 = entry.align2;
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h b/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h
index 449d619..134c28d 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h
@@ -114,7 +114,7 @@
   StringRef       sectionName;
   SectionType     type;
   SectionAttr     attributes;
-  PowerOf2        alignment;
+  uint16_t        alignment;
   Hex64           address;
   ArrayRef<uint8_t> content;
   Relocations     relocations;
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
index 9d9d94b..75cdaef 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
@@ -58,7 +58,7 @@
   uint32_t                  attributes;
   uint64_t                  address;
   uint64_t                  size;
-  PowerOf2                  alignment;
+  uint16_t                  alignment;
   std::vector<AtomInfo>     atomsAndOffsets;
   uint32_t                  normalizedSectionIndex;
   uint32_t                  finalSectionIndex;
@@ -69,7 +69,7 @@
  : segmentName(sg), sectionName(sct), type(t), attributes(attrs),
                  address(0), size(0), alignment(1),
                  normalizedSectionIndex(0), finalSectionIndex(0) {
-  PowerOf2 align = 1;
+  uint16_t align = 1;
   if (ctxt.sectionAligned(segmentName, sectionName, align)) {
     alignment = align;
   }
@@ -142,7 +142,6 @@
   void         appendSection(SectionInfo *si, NormalizedFile &file);
   uint32_t     sectionIndexForAtom(const Atom *atom);
 
-  static uint64_t alignTo(uint64_t value, PowerOf2 align2);
   typedef llvm::DenseMap<const Atom*, uint32_t> AtomToIndex;
   struct AtomAndIndex { const Atom *atom; uint32_t index; SymbolScope scope; };
   struct AtomSorter {
@@ -453,15 +452,11 @@
 
 }
 
-uint64_t Util::alignTo(uint64_t value, PowerOf2 align2) {
-  return llvm::RoundUpToAlignment(value, align2);
-}
-
 
 void Util::layoutSectionsInSegment(SegmentInfo *seg, uint64_t &addr) {
   seg->address = addr;
   for (SectionInfo *sect : seg->sections) {
-    sect->address = alignTo(addr, sect->alignment);
+    sect->address = llvm::RoundUpToAlignment(addr, sect->alignment);
     addr = sect->address + sect->size;
   }
   seg->size = llvm::RoundUpToAlignment(addr - seg->address,_context.pageSize());
@@ -485,7 +480,7 @@
   // Start assigning section address starting at padded offset.
   addr += (padding + hlcSize);
   for (SectionInfo *sect : seg->sections) {
-    sect->address = alignTo(addr, sect->alignment);
+    sect->address = llvm::RoundUpToAlignment(addr, sect->alignment);
     addr = sect->address + sect->size;
   }
   seg->size = llvm::RoundUpToAlignment(addr - seg->address,_context.pageSize());
@@ -528,7 +523,7 @@
     );
   } else {
     for (SectionInfo *sect : _sectionInfos) {
-      sect->address = alignTo(address, sect->alignment);
+      sect->address = llvm::RoundUpToAlignment(address, sect->alignment);
       address = sect->address + sect->size;
     }
     DEBUG_WITH_TYPE("WriterMachO-norm",
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
index 5d71c75..8335911 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
@@ -53,20 +53,6 @@
 namespace llvm {
 namespace yaml {
 
-template <>
-struct ScalarTraits<lld::PowerOf2> {
-  static void output(const lld::PowerOf2 &value, void*, raw_ostream &out) {
-    out << llvm::format("%d", value);
-  }
-  static StringRef input(StringRef scalar, void*, lld::PowerOf2 &result) {
-    uint32_t value;
-    scalar.getAsInteger(10, value);
-    result = 1 << value;
-    return StringRef();
-  }
-  static bool mustQuote(StringRef) { return false; }
-};
-
 // A vector of Sections is a sequence.
 template<>
 struct SequenceTraits< std::vector<Section> > {
@@ -290,7 +276,7 @@
     io.mapRequired("section",         sect.sectionName);
     io.mapRequired("type",            sect.type);
     io.mapOptional("attributes",      sect.attributes);
-    io.mapOptional("alignment",       sect.alignment, lld::PowerOf2(1));
+    io.mapOptional("alignment",       sect.alignment, (uint16_t)1);
     io.mapRequired("address",         sect.address);
     if (sect.type == llvm::MachO::S_ZEROFILL) {
       // S_ZEROFILL sections use "size:" instead of "content:"