[PATCH] D119577: [BOLT][DWARF] Add ability to insert new entries in to DIE

Maksim Panchenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 15 18:01:36 PST 2022


maksfb accepted this revision.
maksfb added inline comments.
This revision is now accepted and ready to land.


================
Comment at: bolt/lib/Core/DebugData.cpp:422
 
+static std::string encodeLE(size_t ByteSize, uint64_t NewValue) {
+  std::string LE64(ByteSize, 0);
----------------
ayermolo wrote:
> yota9 wrote:
> > maksfb wrote:
> > > We need a proper way to handle endianness.
> > You can take a look to support::endian::Writer, here is an example I'm using in golang support:
> > 
> > ```
> > template <typename T>
> > static T writeEndian(BinaryContext &BC, T Val) {
> >   T ret;
> >   SmallVector<char, sizeof(T)> Tmp;
> >   raw_svector_ostream OS(Tmp);
> > 
> >   if (BC.AsmInfo->isLittleEndian())
> >     support::endian::Writer<support::little>(OS).write<T>(Val);
> >   else
> >     support::endian::Writer<support::big>(OS).write<T>(Val);
> > 
> >   memcpy(&ret, OS.str().data(), sizeof(T));
> >   return ret;
> > }
> > ```
> I think it should be part of a different commit thought.
Since it's moved code, it makes sense.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119577



More information about the llvm-commits mailing list