[LLVMdev] Definition of RegisterClass for load instruction in Thumb2
junbums at gmail.com
Fri May 24 09:09:07 PDT 2013
Thank you for the answer.
What is the main reason of allowing this inconsistency in the td file? I guess that's because of the "some" distinction between the writeback and non-writeback versions. Is there any benefit from the inconsistency by using GRP in .td file and freezing lr and pc during register allocation in writeback version?
On May 23, 2013, at 11:51 AM, Tim Northover <tnorthover at apple.com> wrote:
> Hi Junbum,
>> I was aware that the definitions of target RegisterClass (outs) are different in t2LDRSB and t2LDRSB_PRE. While t2LDRSB uses rGPR, t2LDRSB_PRE uses GPR. I wonder if lr and pc are already prevented from being allocated in pre-indexing case, because of some register hint that is being enforced?
> They're not allocated during CodeGen because of the Reserved.set(…) calls in ARMBaseRegisterInfo.cpp.
> That said, this inconsistency is probably wrong anyway (or at best an approximation to reality) because it affects what the assembler supports. For example
> ldrsb sp, [r0]!
> is allowed, but
> ldrsb sp, [r0]
> is forbidden. I think they should both be UNPREDICTABLE (though this is an understandable error; support for unpredictable is in its early stages).
> Annoyingly, there is *some* distinction between the writeback and non-writeback versions. Fixing it properly might get hairy rather quickly.
More information about the llvm-dev