[MachineOperand][Target] MachineOperand::isRenamable semantics changes
authorGeoff Berry <gberry@codeaurora.org>
Fri, 23 Feb 2018 18:25:08 +0000 (18:25 +0000)
committerGeoff Berry <gberry@codeaurora.org>
Fri, 23 Feb 2018 18:25:08 +0000 (18:25 +0000)
commitf8bf2ec0a82ed7c10b64102ea37c004e2865c378
tree8f8394b67c7a9e443ff11e363708cb59dfc9adac
parent9b1d63df375af6487f28c3cc47e81b32cba81bc2
[MachineOperand][Target] MachineOperand::isRenamable semantics changes

Summary:
Add a target option AllowRegisterRenaming that is used to opt in to
post-register-allocation renaming of registers.  This is set to 0 by
default, which causes the hasExtraSrcRegAllocReq/hasExtraDstRegAllocReq
fields of all opcodes to be set to 1, causing
MachineOperand::isRenamable to always return false.

Set the AllowRegisterRenaming flag to 1 for all in-tree targets that
have lit tests that were effected by enabling COPY forwarding in
MachineCopyPropagation (AArch64, AMDGPU, ARM, Hexagon, Mips, PowerPC,
RISCV, Sparc, SystemZ and X86).

Add some more comments describing the semantics of the
MachineOperand::isRenamable function and how it is set and maintained.

Change isRenamable to check the operand's opcode
hasExtraSrcRegAllocReq/hasExtraDstRegAllocReq bit directly instead of
relying on it being consistently reflected in the IsRenamable bit
setting.

Clear the IsRenamable bit when changing an operand's register value.

Remove target code that was clearing the IsRenamable bit when changing
registers/opcodes now that this is done conservatively by default.

Change setting of hasExtraSrcRegAllocReq in AMDGPU target to be done in
one place covering all opcodes that have constant pipe read limit
restrictions.

Reviewers: qcolombet, MatzeB

Subscribers: aemerson, arsenm, jyknight, mcrosier, sdardis, nhaehnle, javed.absar, tpr, arichardson, kristof.beyls, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, jordy.potman.lists, apazos, sabuasal, niosHD, escha, nemanjai, llvm-commits

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

llvm-svn: 325931
31 files changed:
llvm/include/llvm/CodeGen/MachineInstr.h
llvm/include/llvm/CodeGen/MachineOperand.h
llvm/include/llvm/Target/Target.td
llvm/lib/CodeGen/MachineInstr.cpp
llvm/lib/CodeGen/MachineOperand.cpp
llvm/lib/CodeGen/MachineVerifier.cpp
llvm/lib/CodeGen/RegAllocFast.cpp
llvm/lib/CodeGen/VirtRegMap.cpp
llvm/lib/Target/AArch64/AArch64.td
llvm/lib/Target/AMDGPU/AMDGPU.td
llvm/lib/Target/AMDGPU/SIInsertSkips.cpp
llvm/lib/Target/AMDGPU/SIInstrFormats.td
llvm/lib/Target/AMDGPU/SIOptimizeExecMasking.cpp
llvm/lib/Target/AMDGPU/VOPInstructions.td
llvm/lib/Target/ARM/ARM.td
llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/lib/Target/Hexagon/Hexagon.td
llvm/lib/Target/Hexagon/RDFCopy.cpp
llvm/lib/Target/Mips/Mips.td
llvm/lib/Target/PowerPC/PPC.td
llvm/lib/Target/RISCV/RISCV.td
llvm/lib/Target/Sparc/Sparc.td
llvm/lib/Target/SystemZ/SystemZ.td
llvm/lib/Target/X86/X86.td
llvm/lib/Target/X86/X86FloatingPoint.cpp
llvm/test/CodeGen/AMDGPU/postra-norename.mir [new file with mode: 0644]
llvm/utils/TableGen/CodeGenTarget.cpp
llvm/utils/TableGen/CodeGenTarget.h
llvm/utils/TableGen/InstrInfoEmitter.cpp