[PATCH] D77939: [MC] Use subclass data for MCExpr to reduce memory usage

Jinsong Ji via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 13 20:06:12 PDT 2020


jsji accepted this revision.
jsji added inline comments.


================
Comment at: include/llvm/MC/MCExpr.h:143
+    assert(SizeInBytes <= 8 && "Excessive size");
+    return SizeInBytes | (PrintInHex ? PrintInHexBit : 0);
+  }
----------------
nikic wrote:
> jsji wrote:
> > Should we avoid clobberring by `SizeInBytes & SizeInBytesBits` as well?
> The assertion here is intended to make sure that clobbering can't happen.
Yes, but how about non-assert build?


================
Comment at: include/llvm/MC/MCExpr.h:46
 private:
+  enum { NumSubclassDataBits = 24 };
+
----------------
Why we choose enum here? 
Can we set it to const calculated from `sizeof(unsigned int)`?


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

https://reviews.llvm.org/D77939





More information about the llvm-commits mailing list