[PATCH] Implement restrictions on SP in register list on LDM, LDMIA, LDMFD for ARM v7m

Jyoti Allur jyoti.allur at samsung.com
Fri Oct 17 08:52:30 PDT 2014


Hi Tim,

I have replied inline again. LDMEA and STMEA stack operations are not included, should we consider them?

================
Comment at: llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp:6000
@@ -5997,1 +5999,3 @@
                    "writeback register not allowed in register list");
+    if (Opcode == ARM::t2LDMIA_UPD) {
+      if (listContainsReg(Inst, 4, ARM::SP))
----------------
jyoti.allur wrote:
> t.p.northover wrote:
> > This restriction seems to apply to all the Thumb2 instructions in this case, not just t2LDMIA_UPD (but watch out for the fallthrough from ARM above).
> > 
> > It also applies to the non-updating variants (you may have to add extra cases).
> yes, this restriction does apply to all thumb2 instructions in this case, i was planning on adding multiple patches for each set of instructions Section wise as mentioned in the ARM ARM, if that's okay with you?.
> 
okay, I will include non-updating variants namely ARM::t2LDMIA, ARM::t2LDMDB,ARM::t2STMIA,ARM::t2STMDB

What about thumb versions ARM::tLDMIA, ARM::tLDMDB,ARM::tSTMIA,ARM::tSTMDB
i should include them as well rite?


================
Comment at: llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp:6001
@@ +6000,3 @@
+    if (Opcode == ARM::t2LDMIA_UPD) {
+      if (listContainsReg(Inst, 4, ARM::SP))
+        return Error(Operands.back()->getStartLoc(),
----------------
jyoti.allur wrote:
> t.p.northover wrote:
> > The list doesn't start at operand 4 here, does it? It looks like it should be 3 again on my tests.
> in some calls to checkLowRegisterList ( though this is a different function from listContainsReg, logic to read registers from list is same for both) operand 4 is used whenever a writeback expression exists in the instruction, since this case covered *_UPD case, 4 was used, correct me if my understanding is wrong.
i will change it to operand number 3 when checking for SP, although i am not sure why 4 is used in checkLowRegisterList in some cases.

http://reviews.llvm.org/D5827






More information about the llvm-commits mailing list