16#ifndef LLVM_LIB_CODEGEN_ALLOCATIONORDER_H
17#define LLVM_LIB_CODEGEN_ALLOCATIONORDER_H
45 const int IterationLimit;
61 bool isHint()
const {
return Pos < 0; }
66 return AO.HintsAndCustomOrder[AO.NumHints + Pos];
67 assert(Pos < AO.IterationLimit);
74 if (Pos < AO.IterationLimit)
76 while (Pos >= 0 && Pos < AO.IterationLimit && AO.isHint(AO.Order[Pos]))
83 return Pos ==
Other.Pos;
102 : HintsAndCustomOrder(
std::
move(HintsAndCustomOrder)), NumHints(NumHints),
103 Order(static_cast<int>(this->HintsAndCustomOrder.
size()) > NumHints
105 .drop_front(NumHints)
107 IterationLimit(HardHints ? 0 : static_cast<int>(this->Order.
size())) {}
121 assert(OrderLimit <= Order.size());
125 std::min(
static_cast<int>(OrderLimit) - 1, IterationLimit));
134 return static_cast<int>(HintsAndCustomOrder.size()) > NumHints;
141 static_cast<uint32_t>(std::numeric_limits<MCPhysReg>::max()));
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_LIBRARY_VISIBILITY
This file defines the SmallVector class.
Forward iterator for an AllocationOrder.
bool isHint() const
Return true if the current position is that of a preferred register.
bool operator==(const Iterator &Other) const
Iterator(const AllocationOrder &AO, int Pos)
Iterator & operator++()
Advance the iterator to the next position.
bool operator!=(const Iterator &Other) const
MCRegister operator*() const
Return the next physical register in the allocation order.
bool isHint(Register Reg) const
Return true if Reg is a preferred physical register.
ArrayRef< MCPhysReg > getOrder() const
Get the allocation order without reordered hints.
AllocationOrder(SmallVector< MCPhysReg, 16 > &&HintsAndCustomOrder, int NumHints, ArrayRef< MCPhysReg > Order, bool HardHints)
Create an AllocationOrder from HintsAndCustomOrder that contains NumHints Hints optionally followed b...
bool hasCustomOrder() const
Return true if a custom order replaced the RegisterClassInfo order.
Iterator getOrderLimitEnd(unsigned OrderLimit) const
AllocationOrder(SmallVector< MCPhysReg, 16 > &&Hints, ArrayRef< MCPhysReg > Order, bool HardHints)
Create an AllocationOrder given the Hints, Order, and HardHints values.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
ArrayRef< T > take_front(size_t N=1) const
Return a copy of *this with only the first N elements.
Wrapper class representing physical registers. Should be passed by value.
Wrapper class representing virtual and physical registers.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This is an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Implement std::hash so that hash_code can be used in STL containers.