[PATCH] D143285: X86: completely refactor `X86FrameLowering::emitPrologue`

Saleem Abdulrasool via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 3 10:18:02 PST 2023


compnerd created this revision.
compnerd added reviewers: rnk, t.p.northover.
compnerd added a project: LLVM.
Herald added subscribers: pengfei, mstorsjo, hiraditya.
Herald added a project: All.
compnerd requested review of this revision.

This function has had a long overdue need for refactoring.  The current implementation works across the matrix of:

{IP32, IP64, I64P32} x {Function,Funclet x {Managed,Unmanaged}}

This makes the code extremely brittle and difficult to follow.  Introduce the `FrameBuilder` that constructs the shared context to emit the various operations.  The builder has a number of emitters which follow the general pattern of a series of guard statements preventing the emission if the conditions do not hold.  We then perform the build.  This allows the build operation to become entirely free of control flow - we perform the operations unconditionally.  Furthermore, it allows us to split up the operations so that we no longer have a single 600-line function that emits the prologue for every configuration.

This was initially started in D104557 <https://reviews.llvm.org/D104557>.  This applies the full transformation as a single patch (though it was perform through ~42 individual commits).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143285

Files:
  llvm/lib/Target/X86/X86FrameLowering.cpp
  llvm/lib/Target/X86/X86FrameLowering.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143285.494681.patch
Type: text/x-patch
Size: 60325 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230203/fd78a3e7/attachment.bin>


More information about the llvm-commits mailing list