<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 6/20/14, 4:31 PM, sathvik wrote:<br>
    </div>
    <blockquote
cite="mid:CAA9Ha9FKyjsj7xt5WKxbHy4FOZQPrBvPz3kwy8G2BMf-pjgkaQ@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;font-size:small"><span
            style="font-family:tahoma,sans-serif">Hi John,<br>
            <br>
          </span></div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;font-size:small">
          <span style="font-family:tahoma,sans-serif">I don't think its
            possible to add/insert an inline assembly into the LLVM IR
            unless the IR interface provides some kind of stream writer
            into which inline instructions can be written into.<br>
          </span></div>
      </div>
    </blockquote>
    <br>
    The LLVM IR supports inline assembly instructions.  See the Language
    Reference Manual and the doxygen information on the llvm::InlineAsm
    class.<br>
    <br>
    <blockquote
cite="mid:CAA9Ha9FKyjsj7xt5WKxbHy4FOZQPrBvPz3kwy8G2BMf-pjgkaQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;font-size:small"><span
            style="font-family:tahoma,sans-serif">
            <br>
          </span></div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;font-size:small"><span
            style="font-family:tahoma,sans-serif">I was thinking having
            an LLVM intrinsic function could be a first step towards
            introducing PMU tool support in LLVM with which you can
            generate code with built-in instrumentation. What do you
            think ?<br>
          </span></div>
      </div>
    </blockquote>
    <br>
    If you wanted to build a processor-independent tool to collect the
    information that RDPMC provides, then I think an intrinsic would be
    the way to go.  However, that might be a greater goal than what you
    currently need.  It certainly seems like a difficult issue to make
    them portable given how different PMCs are across different Intel
    processors.<br>
    <br>
    Regards,<br>
    <br>
    John Criswell<br>
    <blockquote
cite="mid:CAA9Ha9FKyjsj7xt5WKxbHy4FOZQPrBvPz3kwy8G2BMf-pjgkaQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;font-size:small"><span
            style="font-family:tahoma,sans-serif">
            <br>
          </span></div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;font-size:small"><span
            style="font-family:tahoma,sans-serif">Sathvik <br>
          </span></div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;font-size:small">
          <span style="font-family:tahoma,sans-serif"><br>
              <br>
          </span></div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;font-size:small"><span
            style="font-family:tahoma,sans-serif"><br>
          </span><br>
        </div>
      </div>
      <div class="gmail_extra">
        <br>
        <br>
        <div class="gmail_quote">On Fri, Jun 20, 2014 at 8:21 AM, John
          Criswell <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:criswell@illinois.edu" target="_blank">criswell@illinois.edu</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div class="">
                <div>On 6/19/14, 7:12 PM, sathvik wrote:<br>
                </div>
                <blockquote type="cite">
                  <div dir="ltr">
                    <div class="gmail_default"
                      style="font-family:verdana,sans-serif;font-size:small">I
                      want to measure the performance of a JITed code
                      snippet on MCJIT. </div>
                    <div class="gmail_default"
                      style="font-family:verdana,sans-serif;font-size:small">
                      so I was planning to inject the RDPMC inst for the
                      code generated through a llvm IR builder. <br>
                    </div>
                  </div>
                </blockquote>
                <br>
              </div>
              I assume the easier way to do this is to add an inline
              assembly call that uses the RDPMC instruction.  I don't
              think there's an LLVM IR intrinsic function that does it.<br>
              <br>
              Regards,<br>
              <br>
              John Criswell<br>
              <br>
              <blockquote type="cite">
                <div class="">
                  <div dir="ltr">
                    <div class="gmail_default"
                      style="font-family:verdana,sans-serif;font-size:small"><br>
                    </div>
                    <div class="gmail_default"
                      style="font-family:verdana,sans-serif;font-size:small">
                      Is there a patch available ? If there's a better
                      way to do it please chime in.</div>
                    <div class="gmail_default"
                      style="font-family:verdana,sans-serif;font-size:small"><br>
                    </div>
                    <div class="gmail_default"
                      style="font-family:verdana,sans-serif;font-size:small">
                      Thanks</div>
                    <div class="gmail_default"
                      style="font-family:verdana,sans-serif;font-size:small">sathvik

                       </div>
                  </div>
                  <br>
                  <fieldset></fieldset>
                  <br>
                </div>
                <pre>_______________________________________________
LLVM Developers mailing list
<a moz-do-not-send="true" href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a moz-do-not-send="true" href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a>
<a moz-do-not-send="true" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
              </blockquote>
              <br>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>