<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 3/7/13 5:38 PM, teja tamboli wrote:<br>
    </div>
    <blockquote
cite="mid:CABE5wVKPCLRGaTHELRCVaSenCoev1wnVzGqXK8m7JrD51+mVJQ@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <span class="Apple-style-span"
style="border-collapse:collapse;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px">
        <div><span class="Apple-style-span"
style="border-collapse:collapse;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px">Hi
            All,</span></div>
        <div><span class="Apple-style-span"
style="border-collapse:collapse;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px"><br>
          </span></div>
        I am working on writing pass in LLVM and interested in doing
        function permutation at intermediate representation byte code
        level?
        <div>
          <br>
        </div>
        <div>If I have lets say C program having three functions and its
          corresponding IR bytecode. </div>
        <div>
          <div>
            <div><br>
            </div>
            <div>void findLen(char a[10])</div>
            <div>{</div>
            <div>   int tmp = strlen(a);</div>
            <div>   printf("Len is : %d\n", tmp);</div>
            <div>}</div>
          </div>
          <div>void muladd(int a, int b, int c)</div>
          <div>{</div>
          <div>   int tmp = a + b;</div>
          <div>   int tmp1 = tmp * c;</div>
          <div>   printf("Addition is : %d Multiplication is : %d\n",
            tmp, tmp1);</div>
          <div>   char d[10] =  "abhd";</div>
          <div>   findLen(d);</div>
          <div>}</div>
          <div>void main()</div>
          <div>{</div>
          <div>   int x = 8, y = 5, z = 3;</div>
          <div>   muladd(x, y, z);</div>
          <div>}</div>
        </div>
        <div><br>
        </div>
        <div>
          In its corresponding .s [IR bytecode] file function sequence
          will be same first findLen() then muladd() and then main(). </div>
        <div>Suppose I want to change this sequence i.e. swap findLen()
          and muladd() function's positions. I am expecting to have IR
          bytecode of first muladd() then findLen() and then main() in
          the output file. </div>
        <div><br>
        </div>
        <div>Can you please tell me how can I achieve it ? <br>
        </div>
      </span></blockquote>
    <br>
    Have you tried changing the order in which the Functions are
    inserted into the Module?  That might work if the code generator
    generates functions in the order in which they appear in the Module.<br>
    <br>
    -- John T.<br>
    <br>
    <blockquote
cite="mid:CABE5wVKPCLRGaTHELRCVaSenCoev1wnVzGqXK8m7JrD51+mVJQ@mail.gmail.com"
      type="cite"><span class="Apple-style-span"
style="border-collapse:collapse;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px">
        <div><br>
        </div>
        <div>Thanks,</div>
        <div>Teja</div>
      </span>
      <div><br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>