<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Oct 14, 2015 at 1:43 PM, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">----- Original Message -----<br>
> From: "Rui Ueyama" <<a href="mailto:ruiu@google.com">ruiu@google.com</a>><br>
> To: "Rafael EspĂ­ndola" <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>><br>
> Cc: "Hal Finkel" <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>>, "llvm-commits" <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>><br>
> Sent: Wednesday, October 14, 2015 3:39:28 PM<br>
> Subject: Re: [lld] r250297 - [ELF2][mips] Support both big and little endian MIPS 32-bit targets<br>
><br>
><br>
> On Wed, Oct 14, 2015 at 1:25 PM, Rafael EspĂ­ndola <<br>
> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a> > wrote:<br>
><br>
><br>
> > One solution would be to define:<br>
> ><br>
> > template <endianness endian><br>
> > inline uint32_t read32(const void *p) { return *(const<br>
> > detail::packed_endian_specific_integral<uint32_t, endian,<br>
> > unaligned> *) p; }<br>
> ><br>
> > and similar for write32, and implement Endian-independent things in<br>
> > terms of those.<br>
><br>
> LGTM :-)<br>
><br>
><br>
> It doesn't look good to me. It looks more intricate than necessary. I<br>
> really prefer the current code over the suggested one.<br>
<br>
</div></div>I would not put that template code into lld, it would belong in the support header. Honestly, generic operations (add32be, etc.) should be there too. This way the code in lld (and any other user) can be simpler, not more complicated.<br></blockquote><div><br></div><div>That does make sense (and I also agree that addX should be moved from LLD to LLVM).</div></div></div></div>