<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 10/23/12 7:19 PM, Craig Topper
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAF7ks-NxKPT2pM-AeUO5pJO3AUtejXojyJDerb6jy66Vq-zCNA@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      What function provides the encoding length? X86 in particular is
      so difficult to encode that only the old style JIT and the MC Code
      Emitter could possibly know how many bytes something takes.<br>
    </blockquote>
    <br>
    The getSize() method of MCInstrDesc which can be fetched from a
    MachineInstr using the getDesc() method:<br>
    <br>
<a class="moz-txt-link-freetext" href="http://llvm.org/doxygen/classllvm_1_1MCInstrDesc.html#ae8a17b854d9787d11797d9334a22647d">http://llvm.org/doxygen/classllvm_1_1MCInstrDesc.html#ae8a17b854d9787d11797d9334a22647d</a><br>
    <br>
    Does this method not work as advertised in Doxygen?<br>
    <br>
    -- John T.<br>
    <br>
    <blockquote
cite="mid:CAF7ks-NxKPT2pM-AeUO5pJO3AUtejXojyJDerb6jy66Vq-zCNA@mail.gmail.com"
      type="cite"><br>
      <div class="gmail_quote">
        On Tue, Oct 23, 2012 at 11:58 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">
          Dear All,<br>
          <br>
          I'm enhancing a MachineFunctionPass that enforces control-flow
          integrity.  One of the things I want to do is to set the
          alignment of an instruction (by adding NOPs before it in the
          MachineBasicBlock or by emitting an alignment directive to the
          assembler) if it causes a specific sequence of bytes to be
          generated at a specific alignment.  The goal is to ensure that
          sequences of bytes used to label valid targets of an indirect
          branch (e.g., a return instruction) do not appear at a given
          alignment anywhere in a program other than for where I
          inserted them explicitly.<br>
          <br>
          It looks like MachineInstr has a method for finding the length
          of the instruction's binary encoding, but I didn't see a
          method for finding the exact bytes that would be emitted from
          the MachineInstr.  Is there a way to do this in the
          MachineFunctionPass/MachineInstr infrastructure, or do I need
          to use something like the MC classes?<br>
          <br>
          Thanks in advance for any help provided.<br>
          <br>
          -- John T.<br>
          <br>
          _______________________________________________<br>
          LLVM Developers mailing list<br>
          <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><br>
          <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><br>
        </blockquote>
      </div>
      <br>
      <br clear="all">
      <br>
      -- <br>
      ~Craig<br>
    </blockquote>
    <br>
  </body>
</html>