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

Saleem Abdulrasool compnerd at compnerd.org
Sun Jan 19 12:26:32 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;
----------------
Logan Chien wrote:
> IMO, the better name will be emitUnwindRaw().
What I was thinking when I wrote this was wrong, Im fine with the name you are suggesting, changed.

================
Comment at: lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp:1251
@@ +1250,3 @@
+  FlushPendingOffset();
+  FPOffset = SPOffset + Offset;
+  UnwindOpAsm.EmitRaw(Opcodes);
----------------
Logan Chien wrote:
> 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}
> 
After re-reading the documentation, you are correct, I had this wrong and it should be SPOffset -= Offset.  Ive updated it and added the additional test case that demonstrated this.


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



More information about the llvm-commits mailing list