<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 2, 2015 at 2:19 AM, Simon Atanasyan via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, Dec 2, 2015 at 12:51 AM, Hal Finkel <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>> wrote:<br>
> ----- Original Message -----<br>
>> From: "Simon Atanasyan via llvm-commits" <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>><br>
>> To: <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
>> Sent: Tuesday, December 1, 2015 3:24:46 PM<br>
>> Subject: [lld] r254461 - [ELF] MIPS paired R_MIPS_HI16/LO16 relocations support<br>
>><br>
>> Author: atanasyan<br>
>> Date: Tue Dec  1 15:24:45 2015<br>
>> New Revision: 254461<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=254461&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=254461&view=rev</a><br>
>> Log:<br>
>> [ELF] MIPS paired R_MIPS_HI16/LO16 relocations support<br>
<br>
</span>[...]<br>
<span class=""><br>
> If I'm reading this correctly, this search is O(N^2/2) in the worst case.<br>
> Is there some reason you don't get that behavior in practice?<br>
><br>
> It seems like if we presorted a list by <type, offset>, we could easily<br>
> make this O(N*ln(N)) instead.<br>
<br>
</span>Usually a distance between R_MIPS_HI16 and corresponding R_MIPS_LO16<br>
relocation are 1-3 steps. So for each R_MIPS_HI16 relocation we need<br>
to check a few next entries in a relocation list. If think a cost of<br>
building and maintaining complete sorted relocations list is much<br>
higher than this lookup.<br></blockquote><div><br></div><div>This makes sense. I think it is worth commenting.</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
There is one more method of handling R_MIPS_HI16/LO16 pairs. We can<br>
save R_MIPS_HI16 relocations in a container and postpone calculation<br>
When we get R_MIPS_LO16 relocation, we iterate over the list and handle<br>
all postponed HI16 relocations. This method does not require lookup<br>
at all. But in this case it might be difficult to organize relocations<br>
handling in parallel.<br>
<br>
I am going to return to this point of the code later, measure performance<br>
of various approaches on a real data and select the best variant.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Simon Atanasyan<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div></div>