This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Fix sema check of ARM special register names
ClosedPublic

Authored by iid_iunknown on Nov 9 2016, 10:27 AM.

Details

Summary

This is a simple sema check patch for arguments of __builtin_arm_rsr and the related builtins, which currently do not allow special registers with indexes >7.

Some of the possible register name formats these builtins accept are:

{c}p<coprocessor>:<op1>:c<CRn>:c<CRm>:<op2>
o0:op1:CRn:CRm:op2

where op1 / op2 are integers in the range [0, 7] and CRn / CRm are integers in the range [0, 15].

The current sema check does not allow CRn > 7 and accepts op2 up to 15.

Diff Detail

Repository
rL LLVM

Event Timeline

iid_iunknown retitled this revision from to [ARM] Fix sema check of ARM special register names.
iid_iunknown updated this object.
iid_iunknown added a reviewer: LukeCheeseman.
iid_iunknown set the repository for this revision to rL LLVM.
iid_iunknown added a subscriber: cfe-commits.

Looks like an oversight. Aren't there any tests for this? Maybe there should be one.

Tests added.

Tests extended to check for more corner cases.

Looks like an oversight. Aren't there any tests for this? Maybe there should be one.

Thanks Renato!
I updated the tests to check the upper bounds for CRn/CRm/Op.

rengolin accepted this revision.Nov 15 2016, 10:14 AM
rengolin added a reviewer: rengolin.

LGTM. Thanks!

This revision is now accepted and ready to land.Nov 15 2016, 10:14 AM
asl added a subscriber: asl.Nov 18 2016, 11:23 AM
iid_iunknown closed this revision.Nov 18 2016, 1:09 PM