I would like to replace an instruction X that uses Y class register with the same functionality instruction Z (for example, Y, Z = add… of the same types) that uses W class register. I’m currently using a Machine Function Pass at the state MachineSSAOptimization (addPass(myPass) inside addMachineSSAOptimization() in MyTargetMachine.cpp. Inside my MachineFunctionPass I am changing the opcode via setDesc.
I was hoping that I could just replace the instruction in this stage and the register allocator would pick up on the instruction and use the appropriate register class, but it is still producing Y class register instead of W?
Should I be using MachineInstrBuilder instead of setDesc and if so why?
Thanks.