This patch does the following:
- Adds the infrastructure to convert instructions that have a reg+imm form into that form
- Does that conversion in the MI Peephole on SSA form (off by default to allow some testing in the wild). This is done in a fixed-point transformation (controlled by an option)
- Does the same conversion again in a pre-emit peephole since a number of opportunities are created late - in block placement, etc. (off by default to allow some testing in the wild).
- Adds mir test cases for both peepholes that cover all the converted opcodes
Please note that this patch also moves the initialization of PPCMIPeepholePass to allow mir testing.
In current LLVM bootstrap, this converts 19,600 instructions to r+i form (SSA) and 2,600 (post RA). It also removes 96 cmp+isel sequences as they were comparing a constant to a constant. This allows us to eliminate 16,400 instructions (SSA) and 1,200 (post RA).
I see why you did this, but I don't like the interface to this function: it is unintuitive that it might return non-null, and yet, you also need to check that the ConstantOp is not -1 to know if the return value is valid. Can you please change this so that it uniformly returns non-null only if it succeeds (and, thus, the constant is valid).