[PATCH] D43724: [WebAssembly] Remove trivial accessors.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 27 16:24:37 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL326276: [WebAssembly] Remove trivial accessors. (authored by ruiu, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43724?vs=135781&id=136180#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D43724

Files:
  lld/trunk/wasm/InputChunks.h
  lld/trunk/wasm/OutputSegment.h
  lld/trunk/wasm/Symbols.cpp


Index: lld/trunk/wasm/Symbols.cpp
===================================================================
--- lld/trunk/wasm/Symbols.cpp
+++ lld/trunk/wasm/Symbols.cpp
@@ -173,7 +173,7 @@
 
 uint32_t DefinedData::getOutputSegmentIndex() const {
   DEBUG(dbgs() << "getOutputSegmentIndex: " << getName() << "\n");
-  return Segment->getOutputSegment()->Index;
+  return Segment->OutputSeg->Index;
 }
 
 DefinedGlobal::DefinedGlobal(StringRef Name, uint32_t Flags, InputFile *File,
Index: lld/trunk/wasm/OutputSegment.h
===================================================================
--- lld/trunk/wasm/OutputSegment.h
+++ lld/trunk/wasm/OutputSegment.h
@@ -23,12 +23,13 @@
 public:
   OutputSegment(StringRef N, uint32_t Index) : Name(N), Index(Index) {}
 
-  void addInputSegment(InputSegment *Segment) {
-    Alignment = std::max(Alignment, Segment->getAlignment());
-    InputSegments.push_back(Segment);
-    Size = llvm::alignTo(Size, Segment->getAlignment());
-    Segment->setOutputSegment(this, Size);
-    Size += Segment->getSize();
+  void addInputSegment(InputSegment *InSeg) {
+    Alignment = std::max(Alignment, InSeg->getAlignment());
+    InputSegments.push_back(InSeg);
+    Size = llvm::alignTo(Size, InSeg->getAlignment());
+    InSeg->OutputSeg = this;
+    InSeg->OutputSegmentOffset = Size;
+    Size += InSeg->getSize();
   }
 
   uint32_t getSectionOffset() const { return SectionOffset; }
Index: lld/trunk/wasm/InputChunks.h
===================================================================
--- lld/trunk/wasm/InputChunks.h
+++ lld/trunk/wasm/InputChunks.h
@@ -100,17 +100,11 @@
   // segment.
   uint32_t translateVA(uint32_t Offset) const;
 
-  const OutputSegment *getOutputSegment() const { return OutputSeg; }
-
-  void setOutputSegment(const OutputSegment *Segment, uint32_t Offset) {
-    OutputSeg = Segment;
-    OutputSegmentOffset = Offset;
-  }
-
   uint32_t getAlignment() const { return Segment.Data.Alignment; }
   StringRef getName() const override { return Segment.Data.Name; }
   StringRef getComdat() const override { return Segment.Data.Comdat; }
 
+  const OutputSegment *OutputSeg = nullptr;
   int32_t OutputSegmentOffset = 0;
 
 protected:
@@ -120,7 +114,6 @@
   }
 
   const WasmSegment &Segment;
-  const OutputSegment *OutputSeg = nullptr;
 };
 
 // Represents a single wasm function within and input file.  These are


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43724.136180.patch
Type: text/x-patch
Size: 2372 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180228/f2cea98e/attachment.bin>


More information about the llvm-commits mailing list