[LLVMdev] Generating New Functions

Abhinash Jain omnia at mailinator.com
Mon Oct 14 03:53:41 PDT 2013


How can I generate a new function at compile time and insert some instruction
onto it, through llvm pass.
eg. 

1)  %y = alloca i32, align 4
2)  %z = alloca i32, align 4
3)  %t = alloca i32, align 4
4)  %2 = load i32* %y, align 4
5)  %3 = load i32* %z, align 4
6)  %add = add nsw i32 %2, %3
7)  %4 = load i32* %t, align 4
8)  %add1 = add nsw i32 %add, %4
9)  store i32 %add1, i32* %x, align 4

whenever I see a store instruction, I want to generate a new function and
insert/copy all instruction (from 1 to 9) on that generated function.



--
View this message in context: http://llvm.1065342.n5.nabble.com/Generating-New-Functions-tp62038.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.



More information about the llvm-dev mailing list