9#ifndef LLVM_CODEGEN_RDFREGISTERS_H
10#define LLVM_CODEGEN_RDFREGISTERS_H
35bool disjoint(
const std::set<T> &
A,
const std::set<T> &
B) {
36 auto ItA =
A.begin(), EndA =
A.end();
37 auto ItB =
B.begin(), EndB =
B.end();
38 while (ItA != EndA && ItB != EndB) {
53template <
typename T,
unsigned N = 32>
struct IndexedSet {
58 assert(
Idx != 0 && !Map.empty() &&
Idx - 1 < Map.size());
66 return F - Map.begin() + 1;
74 return F - Map.begin() + 1;
104 constexpr operator bool()
const {
109 return std::hash<RegisterId>{}(
Reg) ^
169 return AliasInfos[U].Regs;
196 const TargetRegisterInfo &TRI;
197 IndexedSet<const uint32_t *> RegMasks;
198 std::vector<RegInfo> RegInfos;
199 std::vector<UnitInfo> UnitInfos;
200 std::vector<MaskInfo> MaskInfos;
201 std::vector<AliasInfo> AliasInfos;
206 : Units(pri.getTRI().getNumRegUnits()), PRI(pri) {}
239 using MapType = std::map<RegisterId, LaneBitmask>;
243 MapType::iterator Pos;
263 return Index ==
I.Index;
294 return Map.emplace(Key, Empty).first->second;
297 auto begin() {
return Map.begin(); }
298 auto end() {
return Map.end(); }
299 auto begin()
const {
return Map.begin(); }
300 auto end()
const {
return Map.end(); }
301 auto find(
const KeyType &Key)
const {
return Map.find(Key); }
305 std::map<KeyType, RegisterAggr> Map;
327template <>
struct hash<
llvm::rdf::RegisterRef> {
333template <>
struct hash<
llvm::rdf::RegisterAggr> {
339template <>
struct equal_to<
llvm::rdf::RegisterRef> {
343 return PRI->equal_to(
A,
B);
351template <>
struct equal_to<
llvm::rdf::RegisterAggr> {
358template <>
struct less<
llvm::rdf::RegisterRef> {
362 return PRI->less(
A,
B);
374using RegisterSet = std::set<RegisterRef, std::less<RegisterRef>>;
This file implements the BitVector class.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
A common definition of LaneBitmask for use in TableGen and CodeGen.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
SI optimize exec mask operations pre RA
size_type count() const
count - Returns the number of bits which are set.
const_set_bits_iterator set_bits_end() const
const_set_bits_iterator_impl< BitVector > const_set_bits_iterator
bool none() const
none - Returns true if none of the bits are set.
const_set_bits_iterator set_bits_begin() const
Wrapper class representing physical registers. Should be passed by value.
static constexpr unsigned VirtualRegFlag
static constexpr bool isStackSlot(unsigned Reg)
isStackSlot - Sometimes it is useful to be able to store a non-negative frame index in a variable tha...
static int stackSlot2Index(Register Reg)
Compute the frame index from a register value representing a stack slot.
static Register index2StackSlot(int FI)
Convert a non-negative frame index to a stack slot register value.
static constexpr bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
static constexpr bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
std::set< RegisterRef > RegisterSet
raw_ostream & operator<<(raw_ostream &OS, const Print< RegisterRef > &P)
bool disjoint(const std::set< T > &A, const std::set< T > &B)
This is an optimization pass for GlobalISel generic memory operations.
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Implement std::hash so that hash_code can be used in STL containers.
An information struct used to provide DenseMap with the various necessary components for a given valu...
static constexpr LaneBitmask getAll()
constexpr bool any() const
static constexpr LaneBitmask getNone()
constexpr Type getAsInteger() const
const_iterator end() const
typename std::vector< T >::const_iterator const_iterator
T get(uint32_t Idx) const
const_iterator begin() const
uint32_t find(T Val) const
const BitVector & getMaskUnits(RegisterId MaskId) const
RegisterId getRegMaskId(const uint32_t *RM) const
void print(raw_ostream &OS, RegisterRef A) const
const TargetRegisterInfo & getTRI() const
const uint32_t * getRegMaskBits(RegisterId R) const
std::set< RegisterId > getAliasSet(RegisterId Reg) const
const BitVector & getUnitAliases(uint32_t U) const
bool equal_to(RegisterRef A, RegisterRef B) const
bool alias(RegisterRef RA, RegisterRef RB) const
RegisterRef mapTo(RegisterRef RR, unsigned R) const
bool less(RegisterRef A, RegisterRef B) const
std::set< RegisterId > getUnits(RegisterRef RR) const
RegisterRef getRefForUnit(uint32_t U) const
PrintLaneMaskShort(LaneBitmask M)
RegisterAggrMap(const PhysicalRegisterInfo &pri)
auto find(const KeyType &Key) const
typename decltype(Map)::mapped_type mapped_type
typename decltype(Map)::key_type key_type
RegisterAggr & operator[](KeyType Key)
typename decltype(Map)::value_type value_type
RegisterRef operator*() const
ref_iterator & operator++()
std::map< RegisterId, LaneBitmask > MapType
bool operator!=(const ref_iterator &I) const
bool operator==(const ref_iterator &I) const
iterator_range< ref_iterator > refs() const
RegisterAggr & insert(RegisterRef RR)
iterator_range< unit_iterator > units() const
RegisterAggr(const PhysicalRegisterInfo &pri)
const PhysicalRegisterInfo & getPRI() const
RegisterRef clearIn(RegisterRef RR) const
unit_iterator unit_end() const
RegisterAggr(const RegisterAggr &RG)=default
RegisterAggr & clear(RegisterRef RR)
ref_iterator ref_begin() const
RegisterRef makeRegRef() const
RegisterAggr & intersect(RegisterRef RR)
bool hasAliasOf(RegisterRef RR) const
RegisterRef intersectWith(RegisterRef RR) const
bool operator==(const RegisterAggr &A) const
bool hasCoverOf(RegisterRef RR) const
unit_iterator unit_begin() const
static bool isCoverOf(RegisterRef RA, RegisterRef RB, const PhysicalRegisterInfo &PRI)
ref_iterator ref_end() const
typename BitVector::const_set_bits_iterator unit_iterator
constexpr unsigned idx() const
constexpr RegisterRef(RegisterId R, LaneBitmask M=LaneBitmask::getAll())
bool operator!=(RegisterRef) const =delete
static constexpr RegisterId toUnitId(unsigned Idx)
constexpr RegisterRef()=default
constexpr bool isReg() const
constexpr bool isMask() const
static constexpr bool isMaskId(unsigned Id)
static constexpr bool isRegId(unsigned Id)
static constexpr bool isUnitId(unsigned Id)
constexpr bool isUnit() const
static constexpr unsigned toIdx(RegisterId Id)
bool operator<(RegisterRef) const =delete
bool operator==(RegisterRef) const =delete
bool operator()(const llvm::rdf::RegisterAggr &A, const llvm::rdf::RegisterAggr &B) const
bool operator()(llvm::rdf::RegisterRef A, llvm::rdf::RegisterRef B) const
constexpr equal_to(const llvm::rdf::PhysicalRegisterInfo &pri)
size_t operator()(const llvm::rdf::RegisterAggr &A) const
size_t operator()(llvm::rdf::RegisterRef A) const
bool operator()(llvm::rdf::RegisterRef A, llvm::rdf::RegisterRef B) const
constexpr less(const llvm::rdf::PhysicalRegisterInfo &pri)