[PATCH] D119577: [BOLT][DWARF] Add ability to insert new entries in to DIE
Alexander Yermolovich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 15 16:36:11 PST 2022
ayermolo added inline comments.
================
Comment at: bolt/lib/Core/DebugData.cpp:422
+static std::string encodeLE(size_t ByteSize, uint64_t NewValue) {
+ std::string LE64(ByteSize, 0);
----------------
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.
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