[LLVMdev] anti-dependency breaking and mask/shift dependencies

Jakob Stoklund Olesen stoklund at 2pi.dk
Sun Jun 10 09:32:45 PDT 2012


On Jun 9, 2012, at 10:12 PM, Hal Finkel wrote:

> On PowerPC (at least versions which predate the mfocrf instruction),
> while there are multiple independent condition registers, the only way
> to move those registers into a general-purpose register is to use mfcr,
> which transfers all of the (concatenated) condition registers into one
> general purpose register, followed by a mask/shift operation to extract
> the desired pieces.
> 
> I would like to know if there is any way to model this which is
> compatible with using anti-dependency breaking on the associated
> condition-register class. I might be able to define a late-expanded
> pseudo-instruction which represents both the mfcr and the mask/shift
> operations, but then those two things would not be independently
> schedulable.

It's not exactly what you ask for, but you can set the hasExtraSrcRegAllocReq flag on the mfcr instruction. That will tell the anti-dep breaker to leave that instruction alone while still being able to break other anti-dependencies on condition code registers.

If that is not enough, you will very soon be able to inject a target-dependent pass between register allocation and virtual register rewriting. You can use the new LiveRegMatrix interface to change the virtual register assignments, for example to loosen anti-dependencies. I expect to have this ready within the next week.

/jakob





More information about the llvm-dev mailing list