[all-commits] [llvm/llvm-project] a9968c: [NFC][CodeGen] Tidy up TargetRegisterInfo stack re...

tmatheson-arm via All-commits all-commits at lists.llvm.org
Tue Mar 30 09:32:03 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a9968c0a339ab47f5d6da1c513b2754f1e98a596
      https://github.com/llvm/llvm-project/commit/a9968c0a339ab47f5d6da1c513b2754f1e98a596
  Author: Tomas Matheson <tomas.matheson at arm.com>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M llvm/include/llvm/CodeGen/TargetRegisterInfo.h
    M llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
    M llvm/lib/CodeGen/GCRootLowering.cpp
    M llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
    M llvm/lib/CodeGen/MachineFrameInfo.cpp
    M llvm/lib/CodeGen/PrologEpilogInserter.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/lib/CodeGen/StackMaps.cpp
    M llvm/lib/CodeGen/TargetRegisterInfo.cpp
    M llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
    M llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
    M llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
    M llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
    M llvm/lib/Target/AMDGPU/SIRegisterInfo.h
    M llvm/lib/Target/ARC/ARCFrameLowering.cpp
    M llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
    M llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
    M llvm/lib/Target/ARM/ARMFrameLowering.cpp
    M llvm/lib/Target/ARM/Thumb1FrameLowering.cpp
    M llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
    M llvm/lib/Target/Lanai/LanaiFrameLowering.cpp
    M llvm/lib/Target/Lanai/LanaiRegisterInfo.cpp
    M llvm/lib/Target/M68k/M68kFrameLowering.cpp
    M llvm/lib/Target/M68k/M68kISelLowering.cpp
    M llvm/lib/Target/M68k/M68kRegisterInfo.cpp
    M llvm/lib/Target/Mips/MipsFrameLowering.cpp
    M llvm/lib/Target/Mips/MipsRegisterInfo.cpp
    M llvm/lib/Target/Mips/MipsSEFrameLowering.cpp
    M llvm/lib/Target/Mips/MipsSERegisterInfo.cpp
    M llvm/lib/Target/NVPTX/NVPTXPrologEpilogPass.cpp
    M llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
    M llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
    M llvm/lib/Target/Sparc/SparcFrameLowering.cpp
    M llvm/lib/Target/VE/VEFrameLowering.cpp
    M llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp
    M llvm/lib/Target/X86/X86FrameLowering.cpp
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/lib/Target/X86/X86InstrInfo.cpp
    M llvm/lib/Target/X86/X86RegisterInfo.cpp

  Log Message:
  -----------
  [NFC][CodeGen] Tidy up TargetRegisterInfo stack realignment functions

Currently needsStackRealignment returns false if canRealignStack returns false.
This means that the behavior of needsStackRealignment does not correspond to
it's name and description; a function might need stack realignment, but if it
is not possible then this function returns false. Furthermore,
needsStackRealignment is not virtual and therefore some backends have made use
of canRealignStack to indicate whether a function needs stack realignment.

This patch attempts to clarify the situation by separating them and introducing
new names:

 - shouldRealignStack - true if there is any reason the stack should be
   realigned

 - canRealignStack - true if we are still able to realign the stack (e.g. we
   can still reserve/have reserved a frame pointer)

 - hasStackRealignment = shouldRealignStack && canRealignStack (not target
   customisable)

Targets can now override shouldRealignStack to indicate that stack realignment
is required.

This change will make it easier in a future change to handle the case where we
need to realign the stack but can't do so (for example when the register
allocator creates an aligned spill after the frame pointer has been
eliminated).

Differential Revision: https://reviews.llvm.org/D98716

Change-Id: Ib9a4d21728bf9d08a545b4365418d3ffe1af4d87




More information about the All-commits mailing list