[LLVMdev] Eliminate PHI for non-copyable registers
Chris Lattner
clattner at apple.com
Wed Feb 11 18:04:11 PST 2009
On Feb 11, 2009, at 4:07 AM, Alex wrote:
> In my hardware there are two special registers cannot be copied but
> can only be assigned and referenced (read) in the other instruction.
> They are allocatable also.
>
> br i1 %if_cond, label %then, label %else
> then:
> %x1 = fptosi float %y1 to i32
> br label %endif
> else:
> %x2 = fptosi float %y2 to i32
> br label %endif
> endif:
> %x3 = phi i32 [%x1, %then], [%x2, %else]
>
> PNE::LowerAtomiPHINode() fails because
> TargetInstrInfo::copyRegToReg() doesn't support the copy of this
> type of register.
>
> Most registers of this hardware are f32. These two special register
> of type i32 are provided to relative index the other f32 registers.
> The value of these i32 registers can only be written by a FP-to-INT
> conversion instruction. But these two i32 registers are not designed
> to be copied from one to the other.
>
This is a very interesting problem. If you have registers like this,
they should be non-allocatable (just like 'flags') which means that
you don't have to define copy operations for them.
-Chris
More information about the llvm-dev
mailing list