[PATCH] D47032: Support: Simplify endian stream interface. NFCI.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Fri May 18 13:34:28 PDT 2018


On Fri, May 18, 2018 at 1:19 PM, Zachary Turner <zturner at google.com> wrote:

> Note that the endianness values can be passed in to the llvm functions at
> runtime, there are non template versions of the write functions that accept
> endianness as arguments (that may be exactly what you used, btw, I didn’t
> read the patch in detail).
>

Yes, there are functions in Endian.h that take a pointer and an endianness,
in this patch I added functions that take a stream instead of a pointer.

It’s a shame this object hierarchy was developed separately from the
> BinaryStream / StreamReader / StreamWriter interfaces, because it seems
> like there’s some overlap and it would serve this use case nicely
>

At some point we might want to investigate using memory mapped I/O instead
of raw_ostream to write out object files. At that point we can decide if we
want to use BinaryStream or something more lightweight.

Peter

On Fri, May 18, 2018 at 12:50 PM Peter Collingbourne via Phabricator via
> llvm-commits <llvm-commits at lists.llvm.org> wrote:
>
>> This revision was automatically updated to reflect the committed changes.
>> Closed by commit rLLD332757: Support: Simplify endian stream interface.
>> NFCI. (authored by pcc, committed by ).
>>
>> Changed prior to commit:
>>   https://reviews.llvm.org/D47032?vs=147396&id=147573#toc
>>
>> Repository:
>>   rLLD LLVM Linker
>>
>> https://reviews.llvm.org/D47032
>>
>> Files:
>>   wasm/WriterUtils.cpp
>>
>>
>> Index: wasm/WriterUtils.cpp
>> ===================================================================
>> --- wasm/WriterUtils.cpp
>> +++ wasm/WriterUtils.cpp
>> @@ -70,7 +70,7 @@
>>
>>  void wasm::writeU32(raw_ostream &OS, uint32_t Number, const Twine &Msg) {
>>    debugWrite(OS.tell(), Msg + "[0x" + utohexstr(Number) + "]");
>> -  support::endian::Writer<support::little>(OS).write(Number);
>> +  support::endian::write(OS, Number, support::little);
>>  }
>>
>>  void wasm::writeValueType(raw_ostream &OS, uint8_t Type, const Twine
>> &Msg) {
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>


-- 
-- 
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180518/ab0152c8/attachment.html>


More information about the llvm-commits mailing list