<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Another approach that we use - we just wipe the DataLayout on the
    module about to be handed to the ExecutionEngine, and in MCJIT.cpp
    there is a line that says 'if datalayout isDefault() (eg. empty
    string representation "") set it to the datalayout of the Target
    Machine'.<br>
    <br>
    Cheers,<br>
    <br>
    -Neil.<br>
    <br>
    <div class="moz-cite-prefix">On 05/05/16 13:48, Josh Klontz via
      llvm-dev wrote:<br>
    </div>
    <blockquote
cite="mid:CAKNzQVa8xPPbZr=QtBt=HkvL5E6c8-sVyXstivAFPTbYYOAMmA@mail.gmail.com"
      type="cite">
      <div dir="ltr">Pawel,
        <div><br>
        </div>
        <div>Hopefully this provides a partial answer: when using MCJIT
          I set the data layout for every module. My code looks roughly
          like:</div>
        <div><br>
        </div>
        <div>   
          TargetRegistry::lookupTarget(sys::getProcessTriple())-><span
            style="color:rgb(0,0,0)">createTargetMachine</span><span
            style="color:rgb(0,0,0)">()-></span>createDataLayout<span
            style="color:rgb(0,0,0)">();</span><br>
        </div>
        <div><span style="color:rgb(0,0,0)"><br>
          </span></div>
        <div><span style="color:rgb(0,0,0)">-Josh</span></div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Thu, May 5, 2016 at 5:34 AM, Paweł
          Bylica <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-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">
            <div dir="ltr">Hi everyone,
              <div><br>
              </div>
              <div>I was happily using MCJIT for over a year until
                yesterday when I created a function call with an
                argument of a struct type. That caused a crash in
                SelectionDAG around DataLayout::getAlignment().</div>
              <div><br>
              </div>
              <div>I remember the noise about the DataLayout started
                being mandatory. But I cannot find precise information.</div>
              <div><br>
              </div>
              <div>Should I set the DataLayout in every Module created?</div>
              <div><br>
              </div>
              <div>Where can I get the DataLayout for the host process
                from?</div>
              <div><br>
              </div>
              <div>Can a DataLayout instance be shared between modules?</div>
              <span class="HOEnZb"><font color="#888888">
                  <div><br>
                  </div>
                  <div>- Paweł</div>
                </font></span></div>
            <br>
            _______________________________________________<br>
            LLVM Developers mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev"
              rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>