<div dir="ltr"><div><div><div>I'm assuming you are looking to "not reload edi", but that's not going to work if f1 or f2 makes any call that takes an argument [or edi is used for something else in the function!].<br><br></div>e.g. <br><br><br></div>void f1(long x)<br>{<br></div> f3(42);<br><div>}<br><br><br></div><div>which would lead to <br><br></div><div> mov edi, 42<br></div><div> call _f3;<br><br></div><div>so now edi is not the same any longer. <br><br></div><div>If you can inline the code (and f1 doesn't make any calls or use edi for any other purpose), then the optimiser will remove the second load anyway.<br><br></div><div>Note that perhaps you are confusing the 32-bit calling convention where edi is a callee preserved register - but then it's also not used to pass arguments either.<br></div><div><br>--<br></div><div>Mats<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 14 September 2015 at 09:49, Nat! via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@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">Assuming you use a x86_64, when you compile<br>
<br>
extern void f1( long x);<br>
extern void f2( void *x);<br>
<br>
void g( void)<br>
{<br>
f1( 1848);<br>
f2( (void *) 1848);<br>
}<br>
<br>
it compiles into identical argument passing code<br>
<br>
mov edi, 1848<br>
call _f1<br>
mov edi, 1848<br>
call _f2<br>
<br>
<br>
This would not happen on a 680x0, because integers are passed in Dx registers and pointers in Ax registers (if I remember correctly).<br>
<br>
Is there a way to figure out, given two types, if they are both passed using the same register ? [^1]<br>
<br>
<br>
Ciao<br>
Nat!<br>
<br>
[^1] It's given, that all preceeding argument types are known and same.<br>
<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>