[PATCH] D13767: [X86] Fix more -Os + EH issues
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 16 10:45:20 PDT 2015
rnk added inline comments.
================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp:231-233
@@ -230,2 +230,5 @@
break;
+ case MCCFIInstruction::OpAdjustCfaOffset:
+ OutStreamer->EmitCFIAdjustCfaOffset(Inst.getOffset());
+ break;
case MCCFIInstruction::OpDefCfa:
----------------
Hah, I guess we have MC support for .cfi_adjust_offset, but never used if from the compiler. :)
================
Comment at: lib/Target/X86/X86CallFrameOptimization.cpp:140
@@ -137,1 +139,3 @@
+ (MF.getFunction()->needsUnwindTableEntry() &&
+ !STI.getFrameLowering()->hasFP(MF))))
return false;
----------------
Isn't `STI.getFrameLowering()` just `TFL`?
================
Comment at: lib/Target/X86/X86FrameLowering.cpp:2097
@@ -2096,3 +2096,3 @@
bool HasDwarfEHHandlers =
!MF.getTarget().getMCAsmInfo()->usesWindowsCFI() &&
!MF.getMMI().getLandingPads().empty();
----------------
Can we just assert up front that we don't need to produce UNWIND_INFO .xdata for Windows? This call frame optimization stuff only fires for 32-bit x86, which doesn't use UNWIND_INFO.
================
Comment at: lib/Target/X86/X86FrameLowering.cpp:2110-2111
@@ +2109,4 @@
+ // we need to set the correct CFA offset at every call site.
+ // TODO: Debug info really needs precise CFA offsets after each stack
+ // adjustment, it's not enough for it to be correct at callsites.
+ if (MF.getFunction()->needsUnwindTableEntry() && !hasFP(MF))
----------------
I think we should address this now. We know exactly where we're inserting the pushes in `X86CallFrameOptimization::adjustCallSequence`, so all we have to do is:
- Insert `.cfi_adjust_cfa_offset 4` after each push
- Insert `.cfi_adjust_cfa_offset InternalAmt` for frame destruction here
- Insert `.cfi_adjust_cfa_offset Amount` after `BuildStackAdjustment` below
http://reviews.llvm.org/D13767
More information about the llvm-commits
mailing list