I implement the following function,which gets CallInst * and should perform the following:
-
Change the value of the argument if condition1 takes place
-
Change the type of the argument if condition2 takes place
-
Add addition argument/s if condition3 takes place
void argChange(CallInst * I)
{
for (unsigned index = 0; index < I->getNumOperands(); ++index) {
do_something_with (I->getOperand(index),condition);
}
}
I think that the 1. can be implemented using I->setOperand(index,newValue)
Can anyone advice me how 2. & 3. could be implemented.