28#define DEBUG_TYPE "regalloc"
34 assert(VReg.
isVirtual() &&
"Anti-hints are only for virtual registers");
41 if (AntiHintedRegUnits.
empty())
42 AntiHintedRegUnits.
resize(
TRI.getNumRegUnits());
43 for (MCRegUnit Unit :
TRI.regunits(VRM.
getPhys(AntiHintVReg)))
44 AntiHintedRegUnits.
set(
static_cast<unsigned>(Unit));
62 bool HardHints =
TRI->getRegAllocationHints(
63 VirtReg, Order, HintsAndCustomOrder, MF, &VRM,
Matrix);
64 const int NumHints =
static_cast<int>(HintsAndCustomOrder.size());
70 for (
MCPhysReg Hint : HintsAndCustomOrder)
81 if (AntiHintedRegUnits.any()) {
82 dbgs() <<
"anti-hints:";
92 if (AntiHintedRegUnits.any())
93 TRI->applyRegAllocationAntiHints(VirtReg, Order, HintsAndCustomOrder,
94 NumHints, AntiHintedRegUnits, MF,
Matrix,
102 [&](
MCPhysReg Hint) { return is_contained(AO.Order, Hint); }) &&
103 "Target hint is outside allocation order.");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static void getBitVecRegAntiHints(Register VReg, BitVector &AntiHintedRegUnits, const VirtRegMap &VRM, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI)
This file implements the BitVector class.
Register const TargetRegisterInfo * TRI
AllocationOrder(SmallVector< MCPhysReg, 16 > &&HintsAndCustomOrder, int NumHints, ArrayRef< MCPhysReg > Order, bool HardHints)
Create an AllocationOrder from HintsAndCustomOrder that contains NumHints Hints optionally followed b...
static AllocationOrder create(Register VirtReg, const VirtRegMap &VRM, const RegisterClassInfo &RegClassInfo, const LiveRegMatrix *Matrix)
Create a new AllocationOrder for VirtReg.
void resize(unsigned N, bool t=false)
Grow or shrink the bitvector.
BitVector & set()
Set all bits in the bitvector.
bool empty() const
Returns whether there are no bits in this bitvector.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
ArrayRef< Register > getRegAllocationAntiHints(Register VReg) const
Return the vector of anti-hints for VReg.
ArrayRef< MCPhysReg > getOrder(const TargetRegisterClass *RC) const
getOrder - Returns the preferred allocation order for RC.
Wrapper class representing virtual and physical registers.
constexpr bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
MachineFunction & getMachineFunction() const
MCRegister getPhys(Register virtReg) const
returns the physical register mapped to the specified virtual register
bool hasPhys(Register virtReg) const
returns true if the specified virtual register is mapped to a physical register
const TargetRegisterInfo & getTargetRegInfo() const
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
LLVM_ABI Printable printReg(Register Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.