[LLVMdev] Function permutation at IR bytecode level
teja tamboli
tamboli.teja at gmail.com
Thu Mar 7 15:38:02 PST 2013
Hi All,
I am working on writing pass in LLVM and interested in doing function
permutation at intermediate representation byte code level?
If I have lets say C program having three functions and its corresponding
IR bytecode.
void findLen(char a[10])
{
int tmp = strlen(a);
printf("Len is : %d\n", tmp);
}
void muladd(int a, int b, int c)
{
int tmp = a + b;
int tmp1 = tmp * c;
printf("Addition is : %d Multiplication is : %d\n", tmp, tmp1);
char d[10] = "abhd";
findLen(d);
}
void main()
{
int x = 8, y = 5, z = 3;
muladd(x, y, z);
}
In its corresponding .s [IR bytecode] file function sequence will be same
first findLen() then muladd() and then main().
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.
Can you please tell me how can I achieve it ?
Thanks,
Teja
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130307/4a911985/attachment.html>
More information about the llvm-dev
mailing list