[PATCH] ARM IAS: support .movsp

Logan Chien tzuhsiang.chien at gmail.com
Mon Jan 20 05:39:38 PST 2014


  Both .movsp and .setfp directives are a mechanism to recover the stack pointer $sp during the stack unwinding process.  Although we have to guarantee that the frame pointer is equal to the ARM::SP before emitting .movsp, it is not required to have a .setfp directive before .movsp directive. [1]

  For example, in your second test case, you have written:

      .fnstart
      .movsp ip
      mov ip, sp
      .save {fp, ip, lr}
      stmfd sp!, {fp, ip, lr}
      .fnend

  In this test case, there UsedFP is equal to false because there is no .setfp directive.  However, this is a valid assembly sequence, and we can recover the stack pointer from $ip during the stack unwinding process.

  [1] The frame pointer must be equal to ARM::SP because both directives will try to recover the stack pointer by adding the offset to the destination register ($sp = $dst + offset).  If the frame pointer is not equal to ARM::SP, then the offset tracked by .setfp directive might be invalid.

http://llvm-reviews.chandlerc.com/D2530



More information about the llvm-commits mailing list