diff options
author | Tilmann Scheller <tilmann.scheller@googlemail.com> | 2013-09-27 13:28:17 +0000 |
---|---|---|
committer | Tilmann Scheller <tilmann.scheller@googlemail.com> | 2013-09-27 13:28:17 +0000 |
commit | 1aebfa0a9b97778712be9ee9b3d99545bece76e5 (patch) | |
tree | cfc68cf27aee12796bf0f1b0119c597f6cebb2d0 /llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | |
parent | c72593e69a8a0a2acc76312ea3f183a0fe18de83 (diff) | |
download | bcm5719-llvm-1aebfa0a9b97778712be9ee9b3d99545bece76e5.tar.gz bcm5719-llvm-1aebfa0a9b97778712be9ee9b3d99545bece76e5.zip |
ARM: Teach assembler to enforce constraints for ARM LDRD destination register operands.
As specified in A8.8.72/A8.8.73/A8.8.74 in the ARM ARM, all variants of the ARM LDRD instruction have the following two constraints:
LDRD<c> <Rt>, <Rt2>, ...
(a) Rt must be even-numbered and not r14
(b) Rt2 must be R(t+1)
If those two constraints are not met the result of executing the instruction will be unpredictable.
Constraint (b) was already enforced, this commit adds support for constraint (a).
Fixes rdar://14479793.
llvm-svn: 191520
Diffstat (limited to 'llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 14063eac1f5..6d6255f2cc2 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -5347,8 +5347,17 @@ validateInstruction(MCInst &Inst, case ARM::LDRD: case ARM::LDRD_PRE: case ARM::LDRD_POST: { + unsigned RtReg = Inst.getOperand(0).getReg(); + // Rt can't be R14. + if (RtReg == ARM::LR) + return Error(Operands[3]->getStartLoc(), + "Rt can't be R14"); + unsigned Rt = MRI->getEncodingValue(RtReg); + // Rt must be even-numbered. + if ((Rt & 1) == 1) + return Error(Operands[3]->getStartLoc(), + "Rt must be even-numbered"); // Rt2 must be Rt + 1. - unsigned Rt = MRI->getEncodingValue(Inst.getOperand(0).getReg()); unsigned Rt2 = MRI->getEncodingValue(Inst.getOperand(1).getReg()); if (Rt2 != Rt + 1) return Error(Operands[3]->getStartLoc(), |