[PATCH] D28566: Dynamic Callee Saved Registers

Oren Ben Simhon via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 08:21:00 PST 2017


oren_ben_simhon created this revision.
oren_ben_simhon added reviewers: stoklund, craig.topper, MatzeB, qcolombet, aaboud, kparzysz, aadg, hliao.
oren_ben_simhon added a subscriber: llvm-commits.
oren_ben_simhon set the repository for this revision to rL LLVM.

Each Calling convention (CC) defines a static list of registers that should be preserved by a callee function. All other registers should be saved by the caller.
Some CCs use additional condition: If the register is used for passing/returning arguments – the caller needs to save it - even if it is part of the Callee Saved Registers (CSR) list.

The current LLVM implementation doesn’t support it. It will save a register if it is part of the static CSR list and will not care if the register is passed/returned by the callee.

The solution is to dynamically allocate the CSR lists (Only for these CCs). The lists will be updated with actual registers that should be saved by the callee.

Since we need the allocated lists to live as long as the function exists, the list should reside inside the Machine Register Info (MRI) which is a property of the Machine Function and managed by it (and has the same life span).

The lists should be saved in the MRI and populated upon LowerCall and LowerFormalArguments.

The patch will also assist to implement future no_caller_saved_regsiters attribute intended for interrupt handler CC.


Repository:
  rL LLVM

https://reviews.llvm.org/D28566

Files:
  include/llvm/CodeGen/MachineRegisterInfo.h
  include/llvm/CodeGen/RegisterClassInfo.h
  lib/CodeGen/AggressiveAntiDepBreaker.cpp
  lib/CodeGen/CriticalAntiDepBreaker.cpp
  lib/CodeGen/LivePhysRegs.cpp
  lib/CodeGen/MachineFunction.cpp
  lib/CodeGen/MachineInstr.cpp
  lib/CodeGen/MachineRegisterInfo.cpp
  lib/CodeGen/RegAllocPBQP.cpp
  lib/CodeGen/RegisterClassInfo.cpp
  lib/CodeGen/TargetFrameLoweringImpl.cpp
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86ISelLowering.h
  lib/Target/X86/X86MachineFunctionInfo.cpp
  test/CodeGen/X86/DynamicCalleeSavedRegisters.ll
  test/CodeGen/X86/avx512-regcall-NoMask.ll
  test/CodeGen/X86/sse-regcall.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28566.83979.patch
Type: text/x-patch
Size: 28498 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170111/b075a292/attachment.bin>


More information about the llvm-commits mailing list