OSDN Git Service

Disable Callee Saved Registers
authorOren Ben Simhon <oren.ben.simhon@intel.com>
Tue, 14 Mar 2017 09:09:26 +0000 (09:09 +0000)
committerOren Ben Simhon <oren.ben.simhon@intel.com>
Tue, 14 Mar 2017 09:09:26 +0000 (09:09 +0000)
commit6095a7948d32d712811e8c2ab2190acf8e66a8bc
tree8b14b14808e5155649b30d591bf90732459f125d
parent89cd317805dc0ba4f39cd74d7a849f55ac6b8abe
Disable Callee Saved Registers

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.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297715 91177308-0d34-0410-b5e6-96231b3b80d8
19 files changed:
include/llvm/CodeGen/MachineRegisterInfo.h
include/llvm/CodeGen/RegisterClassInfo.h
include/llvm/Target/TargetRegisterInfo.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/PrologEpilogInserter.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 [new file with mode: 0644]
test/CodeGen/X86/avx512-regcall-NoMask.ll
test/CodeGen/X86/sse-regcall.ll