Extract operations as functions

Hi,
I am planning to extract every operation as function.

eg. z=x+y; ==> z=func(x,y,op);

I wish to write a custom definition of op. Which I would like to define in func.

It would be really helpful if someone could suggest passes already available in llvm to for or point some reference how should one proceed on it.

Is codeExtractor.cpp useful for this. I was also thinking of going like loop-extract way. any other suggestion would be extremely helpful