[PATCH] D62475: Change DIEnumerator payload type to APInt

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 15:38:04 PDT 2020


aprantl added inline comments.


================
Comment at: llvm/lib/Bitcode/Reader/MetadataLoader.cpp:1220
+      SmallVector<uint64_t, 8> Words(NumWords);
+      transform(makeArrayRef(&Record[3], NumWords), Words.begin(),
+                decodeSignRotatedValue);
----------------
LemonBoy wrote:
> aprantl wrote:
> > This needs some comments. It's not obvious what is being done here.
> `Record[1]` is repurposed to hold the bigint bit width (this is quite wasteful as it can be folded into the upper half of `Record[0]`), the "raw" data follows this header.
> 
> I'll add a comment to clarify this point.
It looks like BitcodeReader.cpp already defines `readWideAPInt()`. It's probably best to call that here.


================
Comment at: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1514
+  for (unsigned i = 0; i < NumWords; i++)
+    emitSignedInt64(Record, RawData[i]);
 
----------------
We could factor the code in line 2365 (from writeConstants) into a emitVariableLengthAPInt() helper and use it here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62475





More information about the llvm-commits mailing list