<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 ? </div><div><br></div><div>Thanks,</div><div>Teja</div></span><div><br></div>