[PATCH] D18046: [X86] Providing correct unwind info in function epilogue
Violeta Vukobrat via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 2 06:37:39 PDT 2017
violetav updated this revision to Diff 101198.
violetav added a comment.
Here is an implementation of the approach that was suggested.
The following set of changes is introduced:
1. Changes to CFI instructions:
- they are now marked as duplicable.
- they can compare as equal (they are compared based on operation/offset/register values, and not on CFIIndex).
- they do not count as instructions when tail-duplicating or tail-merging.
These changes ensure that CFI instructions in epilogue do not affect code generation.
2. Attached information about cfa offset and cfa register to MachineBasicBlock. Each basic block now has info about cfa offset and register valid at it's entry and exit. When a CFI instruction gets inserted into a basic block, it is checked whether block's outgoing cfa offset and register need to be updated. It is checked whether incoming and outgoing information of the block's successors needs to be updated as well. This information is also updated when blocks are split, merged, duplicated or created.
This information is used by a late pass that inserts CFI instructions in order to set correct cfa offset and register for basic blocks. This needs to be done if blocks get reordered in a way that some have incorrect cfa offset and register set by previous blocks.
A verification pass is added that checks that outgoing cfa offset and register of predecessor blocks match incoming offset and register of their successors.
The current implementation adds CFI instructions in epilogue for X86. However, the changes described above can be used for all platforms.
Repository:
rL LLVM
https://reviews.llvm.org/D18046
Files:
include/llvm/CodeGen/MachineBasicBlock.h
include/llvm/CodeGen/Passes.h
include/llvm/InitializePasses.h
include/llvm/Target/Target.td
include/llvm/Target/TargetFrameLowering.h
lib/CodeGen/BranchFolding.cpp
lib/CodeGen/CFIInfoVerifier.cpp
lib/CodeGen/CFIInstrInserter.cpp
lib/CodeGen/CMakeLists.txt
lib/CodeGen/CodeGen.cpp
lib/CodeGen/MachineBasicBlock.cpp
lib/CodeGen/MachineInstr.cpp
lib/CodeGen/PrologEpilogInserter.cpp
lib/CodeGen/TailDuplicator.cpp
lib/CodeGen/TargetPassConfig.cpp
lib/Target/X86/X86CallFrameOptimization.cpp
lib/Target/X86/X86FrameLowering.cpp
lib/Target/X86/X86FrameLowering.h
test/CodeGen/X86/2009-03-16-PHIElimInLPad.ll
test/CodeGen/X86/2011-10-19-widen_vselect.ll
test/CodeGen/X86/GlobalISel/add-scalar.ll
test/CodeGen/X86/GlobalISel/frameIndex.ll
test/CodeGen/X86/O0-pipeline.ll
test/CodeGen/X86/avg.ll
test/CodeGen/X86/avx512-vbroadcast.ll
test/CodeGen/X86/avx512bw-intrinsics-upgrade.ll
test/CodeGen/X86/avx512bw-intrinsics.ll
test/CodeGen/X86/avx512vl-intrinsics-fast-isel.ll
test/CodeGen/X86/avx512vl-vbroadcast.ll
test/CodeGen/X86/emutls-pie.ll
test/CodeGen/X86/emutls.ll
test/CodeGen/X86/epilogue-cfi-fp.ll
test/CodeGen/X86/epilogue-cfi-no-fp.ll
test/CodeGen/X86/fast-isel-store.ll
test/CodeGen/X86/frame-lowering-debug-intrinsic-2.ll
test/CodeGen/X86/frame-lowering-debug-intrinsic.ll
test/CodeGen/X86/haddsub-2.ll
test/CodeGen/X86/hipe-cc64.ll
test/CodeGen/X86/imul.ll
test/CodeGen/X86/legalize-shift-64.ll
test/CodeGen/X86/load-combine.ll
test/CodeGen/X86/masked_gather_scatter.ll
test/CodeGen/X86/memset-nonzero.ll
test/CodeGen/X86/merge-consecutive-loads-128.ll
test/CodeGen/X86/movtopush.ll
test/CodeGen/X86/mul-i256.ll
test/CodeGen/X86/pr21792.ll
test/CodeGen/X86/pr29112.ll
test/CodeGen/X86/pr30430.ll
test/CodeGen/X86/pr32241.ll
test/CodeGen/X86/pr32256.ll
test/CodeGen/X86/pr32284.ll
test/CodeGen/X86/pr32329.ll
test/CodeGen/X86/pr32345.ll
test/CodeGen/X86/pr32451.ll
test/CodeGen/X86/pr9743.ll
test/CodeGen/X86/push-cfi-debug.ll
test/CodeGen/X86/push-cfi-obj.ll
test/CodeGen/X86/push-cfi.ll
test/CodeGen/X86/return-ext.ll
test/CodeGen/X86/rtm.ll
test/CodeGen/X86/setcc-lowering.ll
test/CodeGen/X86/statepoint-call-lowering.ll
test/CodeGen/X86/statepoint-gctransition-call-lowering.ll
test/CodeGen/X86/statepoint-invoke.ll
test/CodeGen/X86/throws-cfi-fp.ll
test/CodeGen/X86/throws-cfi-no-fp.ll
test/CodeGen/X86/vector-sext.ll
test/CodeGen/X86/vector-shuffle-avx512.ll
test/CodeGen/X86/vector-shuffle-v1.ll
test/CodeGen/X86/wide-integer-cmp.ll
test/CodeGen/X86/x86-framelowering-trap.ll
test/CodeGen/X86/x86-no_caller_saved_registers-preserve.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18046.101198.patch
Type: text/x-patch
Size: 147984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170602/32d8fe30/attachment-0001.bin>
More information about the llvm-commits
mailing list