<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Hi Duncan,<br>
<br>
Firstly, I changed:<br>
<pre wrap="">>  case CallingConv::HiPE:
>    // TailCallOpt doesn't fit our case because Erlang/OTP X86/AMD64 ABI cleary
>    // specifies that callee <b class="moz-txt-star"><span
 class="moz-txt-tag">*</span>always<span class="moz-txt-tag">*</span></b> pops the arguments.
>    return true;

</pre>
to:<br>
<pre>> case CallingConv::HiPE:
>     return TailCallOpt;</pre>
in the attached as this works fine for us, too.<br>
<br>
On 11/02/2012 03:01 PM, Duncan Sands wrote:<br>
<blockquote cite="mid:5093C41E.7020907@free.fr" type="cite">can you
please add some tests checking that indirect calls work properly.  </blockquote>
Yes, of course. Which scenario do you want to test? Is something like
that:<br>
<pre>> define cc 11 void @baz() nounwind {
>  %tmp_clos = load i64* @clos
>  %tmp_clos2 = inttoptr i64 %tmp_clos to i64*
>  %indirect_call = bitcast i64* %tmp_clos2 to void (i64)*
>  tail call cc 11 void %indirect_call( i64 42 ) nounwind
>  ret void
>}
>
>@clos = external constant i64

</pre>
ok for u? Actually, this is very similar to how we generate code for
indirect<br>
calls (mostly closures) in our backend. I'm not sure that it's optimal,
<br>
so if anyone has any suggestion, please say! :)<br>
<br>
<blockquote cite="mid:5093C41E.7020907@free.fr" type="cite">Also,
  <br>
I noticed the following typo:
  <br>
--- a/lib/Target/X86/X86ISelLowering.cpp
  <br>
+++ b/lib/Target/X86/X86ISelLowering.cpp
  <br>
...
  <br>
@@ -3092,6 +3093,10 @@ bool X86::isCalleePop(CallingConv::ID
CallingConv,
  <br>
     return TailCallOpt;
  <br>
   case CallingConv::GHC:
  <br>
     return TailCallOpt;
  <br>
+  case CallingConv::HiPE:
  <br>
+    // TailCallOpt doesn't fit our case because Erlang/OTP X86/AMD64
ABI cleary
  <br>
  <br>
cleary -> clearly
  <br>
</blockquote>
Good catch!<br>
<br>
Re-attaching current state.<br>
<br>
Best,<br>
Yiannis<br>
<pre class="moz-signature" cols="80">-- 
Yiannis Tsiouris
Ph.D. student,
Software Engineering Laboratory,
National Technical University of Athens
WWW: <a class="moz-txt-link-freetext" href="http://www.softlab.ntua.gr/~gtsiour">http://www.softlab.ntua.gr/~gtsiour</a></pre>
</body>
</html>