diff options
author | Andrew Trick <atrick@apple.com> | 2012-12-05 06:47:12 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2012-12-05 06:47:12 +0000 |
commit | eca1fcf3d2d8246c45648fea59bd21a4091f9115 (patch) | |
tree | 161b7200aec99b4d12f9cd6afa6d0fe93a292f9e /include/llvm/Target/TargetRegisterInfo.h | |
parent | 17cf53519905acb69c567173bedd2df1c8e45523 (diff) | |
download | llvm-eca1fcf3d2d8246c45648fea59bd21a4091f9115.tar.gz llvm-eca1fcf3d2d8246c45648fea59bd21a4091f9115.tar.bz2 llvm-eca1fcf3d2d8246c45648fea59bd21a4091f9115.tar.xz |
RegisterPressure API. Add support for physical register units.
At build-time register pressure was always computed in terms of
register units. But the compile-time API was expressed in terms of
register classes because it was intended for virtual registers (and
physical register units weren't yet used anywhere in codegen).
Now that the codegen uses physreg units consistently, prepare for
tracking register pressure also in terms of live units, not live
registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169360 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Target/TargetRegisterInfo.h')
-rw-r--r-- | include/llvm/Target/TargetRegisterInfo.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/llvm/Target/TargetRegisterInfo.h b/include/llvm/Target/TargetRegisterInfo.h index 4d69e4fef6..7cf3674625 100644 --- a/include/llvm/Target/TargetRegisterInfo.h +++ b/include/llvm/Target/TargetRegisterInfo.h @@ -599,6 +599,9 @@ public: virtual const RegClassWeight &getRegClassWeight( const TargetRegisterClass *RC) const = 0; + /// Get the weight in units of pressure for this register unit. + virtual unsigned getRegUnitWeight(unsigned RegUnit) const = 0; + /// Get the number of dimensions of register pressure. virtual unsigned getNumRegPressureSets() const = 0; @@ -614,6 +617,10 @@ public: virtual const int *getRegClassPressureSets( const TargetRegisterClass *RC) const = 0; + /// Get the dimensions of register pressure impacted by this register unit. + /// Returns a -1 terminated array of pressure set IDs. + virtual const int *getRegUnitPressureSets(unsigned RegUnit) const = 0; + /// Get a list of 'hint' registers that the register allocator should try /// first when allocating a physical register for the virtual register /// VirtReg. These registers are effectively moved to the front of the @@ -634,6 +641,28 @@ public: const MachineFunction &MF, const VirtRegMap *VRM = 0) const; + /// getRawAllocationOrder - Returns the register allocation order for a + /// specified register class with a target-dependent hint. The returned list + /// may contain reserved registers that cannot be allocated. + /// + /// Register allocators need only call this function to resolve + /// target-dependent hints, but it should work without hinting as well. + virtual ArrayRef<MCPhysReg> + getRawAllocationOrder(const TargetRegisterClass *RC, + unsigned HintType, unsigned HintReg, + const MachineFunction &MF) const { + return RC->getRawAllocationOrder(MF); + } + + /// ResolveRegAllocHint - Resolves the specified register allocation hint + /// to a physical register. Returns the physical register if it is successful. + virtual unsigned ResolveRegAllocHint(unsigned Type, unsigned Reg, + const MachineFunction &MF) const { + if (Type == 0 && Reg && isPhysicalRegister(Reg)) + return Reg; + return 0; + } + /// avoidWriteAfterWrite - Return true if the register allocator should avoid /// writing a register from RC in two consecutive instructions. /// This can avoid pipeline stalls on certain architectures. |