diff options
| author | Tim Northover <tnorthover@apple.com> | 2013-11-12 21:32:41 +0000 |
|---|---|---|
| committer | Tim Northover <tnorthover@apple.com> | 2013-11-12 21:32:41 +0000 |
| commit | 8eaf1543e58b6d0832bb9852ee6fa93915c2aa3b (patch) | |
| tree | 9c7e656936fba5ace4b4bdde6b1f806e63ffaaa9 /llvm/lib/Target/ARM | |
| parent | d748e29cd9f2eb7809ddb49eeee731ab0f5ec098 (diff) | |
| download | bcm5719-llvm-8eaf1543e58b6d0832bb9852ee6fa93915c2aa3b.tar.gz bcm5719-llvm-8eaf1543e58b6d0832bb9852ee6fa93915c2aa3b.zip | |
ARM: diagnose invalid system LDM/STM
The system LDM and STM instructions can't usually writeback to the base
register. The one exception is when an LDM is actually an exception-return
(i.e. contains PC in the register list).
(There's already a test that "ldm sp!, {r0-r3, pc}^" works, which is why there
is no positive test).
rdar://problem/15223374
llvm-svn: 194512
Diffstat (limited to 'llvm/lib/Target/ARM')
| -rw-r--r-- | llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 727bd26369c..e3f9e0dc609 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -5481,6 +5481,22 @@ validateInstruction(MCInst &Inst, "writeback register not allowed in register list"); break; } + case ARM::sysLDMIA_UPD: + case ARM::sysLDMDA_UPD: + case ARM::sysLDMDB_UPD: + case ARM::sysLDMIB_UPD: + if (!listContainsReg(Inst, 3, ARM::PC)) + return Error(Operands[4]->getStartLoc(), + "writeback register only allowed on system LDM " + "if PC in register-list"); + break; + case ARM::sysSTMIA_UPD: + case ARM::sysSTMDA_UPD: + case ARM::sysSTMDB_UPD: + case ARM::sysSTMIB_UPD: + return Error(Operands[2]->getStartLoc(), + "system STM cannot have writeback register"); + break; case ARM::tMUL: { // The second source operand must be the same register as the destination // operand. |

