[PATCH] D139206: [lld][NFC] Pack InputChunk / OutputSegment more tightly

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 2 08:37:00 PST 2022


gchatelet created this revision.
gchatelet added a reviewer: arichardson.
Herald added subscribers: pmatos, asb, sbc100.
Herald added a project: All.
gchatelet requested review of this revision.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.

This is a follow up on D139181 <https://reviews.llvm.org/D139181>.
Packing InputChunks going from 88B to 80B.
Packing OutputSegment going from 112B to 104B.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139206

Files:
  lld/wasm/InputChunks.h
  lld/wasm/OutputSegment.h


Index: lld/wasm/OutputSegment.h
===================================================================
--- lld/wasm/OutputSegment.h
+++ lld/wasm/OutputSegment.h
@@ -33,14 +33,14 @@
   bool isTLS() const { return name == ".tdata"; }
 
   StringRef name;
-  bool isBss = false;
   uint32_t index = 0;
   uint32_t linkingFlags = 0;
   uint32_t initFlags = 0;
   uint32_t sectionOffset = 0;
-  llvm::Align alignment;
   uint64_t startVA = 0;
   std::vector<InputChunk *> inputSegments;
+  bool isBss = false;
+  llvm::Align alignment;
 
   // Sum of the size of the all the input segments
   uint32_t size = 0;
Index: lld/wasm/InputChunks.h
===================================================================
--- lld/wasm/InputChunks.h
+++ lld/wasm/InputChunks.h
@@ -85,7 +85,6 @@
   OutputSection *outputSec = nullptr;
   uint32_t comdat = UINT32_MAX;
   uint32_t inputSectionOffset = 0;
-  llvm::Align alignment;
   uint32_t flags;
 
   // Only applies to data segments.
@@ -106,11 +105,14 @@
   // Signals the chunk was discarded by COMDAT handling.
   unsigned discarded : 1;
 
+
+  llvm::Align alignment;
+
 protected:
   InputChunk(ObjFile *f, Kind k, StringRef name, uint32_t alignment = 0,
              uint32_t flags = 0)
-      : name(name), file(f), alignment(1ULL << alignment), flags(flags),
-        sectionKind(k), live(!config->gcSections), discarded(false) {}
+      : name(name), file(f), flags(flags),
+        sectionKind(k), live(!config->gcSections), discarded(false), alignment(1ULL << alignment) {}
   ArrayRef<uint8_t> data() const { return rawData; }
   uint64_t getTombstone() const;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139206.479649.patch
Type: text/x-patch
Size: 1607 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221202/3ffc9c19/attachment.bin>


More information about the llvm-commits mailing list