[PATCH] ARM IAS: add support for .unwind_raw directive

Logan Chien tzuhsiang.chien at gmail.com
Sun Jan 19 08:14:04 PST 2014



================
Comment at: include/llvm/MC/MCStreamer.h:93
@@ -92,1 +92,3 @@
                            bool isVector) = 0;
+  virtual void emitUnwind(int64_t StackOffset,
+                          const SmallVectorImpl<uint8_t> &Opcodes) = 0;
----------------
IMO, the better name will be emitUnwindRaw().

================
Comment at: lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp:1251
@@ +1250,3 @@
+  FlushPendingOffset();
+  FPOffset = SPOffset + Offset;
+  UnwindOpAsm.EmitRaw(Opcodes);
----------------
I feel this line is incorrect.  This should be replaced by:

    SPOffset -= Offset;

This directive is similar to the .save directive.  The offset stands for the difference of the $sp which might be modified by the unwind opcode.  For example,

    	.fnstart
    func1:
    	.setfp fp, sp, #32
    	.unwind_raw 24, 0xc2
    	.fnend

This input will result in following unwind opcode:

    0x0 <func1>: 0x809b45c2
      Compact model 0
      0x9b      vsp = r11
      0x45      vsp = vsp - 24
      0xc2      pop {wR10-wR12}

But the correct one should be:

    0x0 <func1>: 0x809b4dc2
      Compact model 0
      0x9b      vsp = r11
      0x4d      vsp = vsp - 56
      0xc2      pop {wR10-wR12}



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



More information about the llvm-commits mailing list