[PATCH] D72291: Reimplement BoundaryAlign mechanism (mostly, but not quite NFC)

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 16:33:13 PST 2020


MaskRay added inline comments.


================
Comment at: llvm/include/llvm/MC/MCFragment.h:541-542
   uint64_t getSize() const { return Size; }
-  void setSize(uint64_t Value) { Size = Value; }
+  void setSize(uint64_t Value) {
+    assert(Value == (uint64_t)((uint16_t)Value));
+    Size = Value;
----------------
skan wrote:
> I think using `uint64_t` as the type of `Size` is good enough here. And the maximum size of the BoundaryAlignFragment is 30 (15+15, 15 is the maximum of an instruction) indeed.  So if you really want `Size` is more space-saving, I suggest `uint8_t`.
```
uint8_t Size = 0;
Align AlignBoundary;
MCFragment *LastFragment = nullptr;
```

can make sizeof(MCBoundaryAlignFragment) 8 bytes smaller.

This patch does not apply on master. It needs a rebase.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72291/new/

https://reviews.llvm.org/D72291





More information about the llvm-commits mailing list