Changing the Function Prototype of all functions in the bitcode

Hi all,

I am trying to change the prototype of all functions in the bitcode.
Specifically I want to add an extra argument to all functions
definitions and call sites. What is the best way to accomplish this
using the LLVM API?

Currently I accomplish this by using a module pass which iterates
over all the functions in the module.
For each function, I create a new function with an extra argument.
Subsequently I iterate over all the uses of the function and change
the callsites to pass an extra argument.

Currently I am facing two problems.

1) Handling indirect function calls this way causes inconsistency in
the bitcode.
2) I need to change every function pointer type in the program.
For ex a struct with function pointer needs to have the new function
pointer type
I don't know if there is a good way to do this.

I was wondering if there is any better way to accomplish the same.