<!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">
    On 20/10/2010 23:25, John McCall wrote:
    <blockquote
      cite="mid:86DABD63-A544-4CC6-B394-817F0836CE7C@apple.com"
      type="cite"><base href="x-msg://3826/">
      <div>
        <div>On Oct 20, 2010, at 2:56 PM, roger roger wrote:</div>
        <blockquote type="cite"><span class="Apple-style-span"
            style="border-collapse: separate; font-family: Helvetica;
            font-style: normal; font-variant: normal; font-weight:
            normal; letter-spacing: normal; line-height: normal;
            orphans: 2; text-indent: 0px; text-transform: none;
            white-space: normal; widows: 2; word-spacing: 0px;
            font-size: medium;">
            <div class="hmmessage" style="font-size: 10pt; font-family:
              Tahoma;">I notice that using the online demo, functions
              which return structures are converted to be void, and
              instead take an extra argument which is the a pointer to
              the returned structure, and the allocation is made by the
              caller.<br>
              Even declared, but undefined functions are converted like
              this, presumably this doesn't cause a problem during
              linking?<br>
            </div>
          </span></blockquote>
        <div><br>
        </div>
        Right now, conformance with the platform ABI calling convention
        is an intricate dance between the frontend (i.e. that which
        emits the IR) and the backend.  So if the ABI says that a
        particular structure return is implemented by passing a buffer
        pointer as an implicit first argument to the function, then the
        front-end is responsible for generating IR that follows that
        pattern if it wants ABI conformance.  The optimization pass you
        point out is potentially breaking ABI conformance, which means
        it (hopefully) only fires for functions with internal linkage.</div>
      <div><br>
      </div>
      <div>If you're writing a frontend that doesn't care about
        conformance with the platform ABI — generally because your
        functions aren't going to be called from C — then you're limited
        only by what the backends you're targeting actually support.
         Unfortunately, LLVM provides pretty limited promises here, and
        I wouldn't want to mis-state them.</div>
      <div><br>
      </div>
      <div>John.</div>
    </blockquote>
    <br>
    Thanks, I thought this might be the case. At the moment I don't care
    about ABI compatibility, but eventually I might. I was more
    concerned that the backends might not correctly handle the case of
    returning large structures, which as Kenneth points out, is
    partially true. I think I'll just follow by example for now.<br>
    <br>
    Roger<br>
  </body>
</html>