[lld] r329336 - [WebAssembly] Remove another trivial accessor.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 5 12:37:31 PDT 2018


Author: ruiu
Date: Thu Apr  5 12:37:31 2018
New Revision: 329336

URL: http://llvm.org/viewvc/llvm-project?rev=329336&view=rev
Log:
[WebAssembly] Remove another trivial accessor.

Differential Revision: https://reviews.llvm.org/D43725

Modified:
    lld/trunk/wasm/OutputSections.cpp
    lld/trunk/wasm/OutputSegment.h

Modified: lld/trunk/wasm/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/OutputSections.cpp?rev=329336&r1=329335&r2=329336&view=diff
==============================================================================
--- lld/trunk/wasm/OutputSections.cpp (original)
+++ lld/trunk/wasm/OutputSections.cpp Thu Apr  5 12:37:31 2018
@@ -140,12 +140,13 @@ DataSection::DataSection(ArrayRef<Output
     writeUleb128(OS, WASM_OPCODE_END, "opcode:end");
     writeUleb128(OS, Segment->Size, "segment size");
     OS.flush();
-    Segment->setSectionOffset(BodySize);
+
+    Segment->SectionOffset = BodySize;
     BodySize += Segment->Header.size() + Segment->Size;
     log("Data segment: size=" + Twine(Segment->Size));
+
     for (InputSegment *InputSeg : Segment->InputSegments)
-      InputSeg->OutputOffset = Segment->getSectionOffset() +
-                               Segment->Header.size() +
+      InputSeg->OutputOffset = Segment->SectionOffset + Segment->Header.size() +
                                InputSeg->OutputSegmentOffset;
   }
 
@@ -166,7 +167,7 @@ void DataSection::writeTo(uint8_t *Buf)
 
   parallelForEach(Segments, [&](const OutputSegment *Segment) {
     // Write data segment header
-    uint8_t *SegStart = Buf + Segment->getSectionOffset();
+    uint8_t *SegStart = Buf + Segment->SectionOffset;
     memcpy(SegStart, Segment->Header.data(), Segment->Header.size());
 
     // Write segment data payload

Modified: lld/trunk/wasm/OutputSegment.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/OutputSegment.h?rev=329336&r1=329335&r2=329336&view=diff
==============================================================================
--- lld/trunk/wasm/OutputSegment.h (original)
+++ lld/trunk/wasm/OutputSegment.h Thu Apr  5 12:37:31 2018
@@ -32,12 +32,9 @@ public:
     Size += InSeg->getSize();
   }
 
-  uint32_t getSectionOffset() const { return SectionOffset; }
-
-  void setSectionOffset(uint32_t Offset) { SectionOffset = Offset; }
-
   StringRef Name;
   const uint32_t Index;
+  uint32_t SectionOffset = 0;
   uint32_t Alignment = 0;
   uint32_t StartVA = 0;
   std::vector<InputSegment *> InputSegments;
@@ -47,9 +44,6 @@ public:
 
   // Segment header
   std::string Header;
-
-private:
-  uint32_t SectionOffset = 0;
 };
 
 } // namespace wasm




More information about the llvm-commits mailing list