9#ifndef LLVM_LIB_TARGET_HEXAGON_BITTRACKER_H
10#define LLVM_LIB_TARGET_HEXAGON_BITTRACKER_H
25class MachineRegisterInfo;
26class MachineBasicBlock;
29class TargetRegisterClass;
30class TargetRegisterInfo;
48 bool has(
unsigned Reg)
const;
49 const RegisterCell &
lookup(
unsigned Reg)
const;
50 RegisterCell
get(RegisterRef RR)
const;
51 void put(RegisterRef RR,
const RegisterCell &RC);
52 void subst(RegisterRef OldRR, RegisterRef NewRR);
64 using CFGEdge = std::pair<int, int>;
65 using EdgeSetType = std::set<CFGEdge>;
66 using InstrSetType = std::set<const MachineInstr *>;
67 using EdgeQueueType = std::queue<CFGEdge>;
72 UseQueueType() :
Uses(Dist) {}
74 unsigned size()
const {
80 MachineInstr *front()
const {
83 void push(MachineInstr *
MI) {
84 if (
Set.insert(
MI).second)
96 Cmp(DenseMap<const MachineInstr*,unsigned> &Map) : Dist(
Map) {}
97 bool operator()(
const MachineInstr *
MI,
const MachineInstr *MJ)
const;
98 DenseMap<const MachineInstr*,unsigned> &Dist;
100 DenseSet<const MachineInstr*>
Set;
101 DenseMap<const MachineInstr*,unsigned> Dist;
102 std::priority_queue<MachineInstr *, std::vector<MachineInstr *>,
Cmp>
Uses;
106 void runEdgeQueue(BitVector &BlockScanned);
109 const MachineEvaluator &ME;
111 MachineRegisterInfo &MRI;
114 EdgeSetType EdgeExec;
115 InstrSetType InstrExec;
118 DenseSet<unsigned> ReachedBB;
126 bool operator== (
const BitRef &BR)
const {
128 return Reg == BR.Reg && (
Reg == 0 ||
Pos == BR.Pos);
206 bool is(
unsigned T)
const {
272 return BitValue(V.RefI.Reg, V.RefI.Pos);
305 assert(BitN < Bits.size());
309 assert(BitN < Bits.size());
342 static const unsigned DefaultBitN = 32;
350 return Map.find(
Reg) != Map.end();
355 CellMapType::const_iterator
F = Map.find(
Reg);
363 for (
uint16_t i = 0; i < Width; ++i)
371 for (
uint16_t i = 0; i < Width; ++i)
380 for (
unsigned i = 0; i < W; ++i)
404 return RegisterCell::ref(RC);
unsigned const MachineRegisterInfo * MRI
static bool evaluate(const MCSpecifierExpr &Expr, MCValue &Res, const MCAssembler *Asm)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
raw_ostream & operator<<(raw_ostream &OS, const binary_le_impl< value_type > &BLE)
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
This file defines the DenseSet and SmallDenseSet classes.
Register const TargetRegisterInfo * TRI
static unsigned getReg(const MCDisassembler *D, unsigned RC, unsigned RegNo)
Remove Loads Into Fake Uses
static uint32_t rol(uint32_t Number, int Bits)
This file implements a set that has insertion order iteration characteristics.
This file defines the SmallVector class.
This is the shared class of boolean and integer constants.
Wrapper class representing physical registers. Should be passed by value.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Wrapper class representing virtual and physical registers.
A vector that has set insertion semantics.
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...
The instances of the Type class are immutable: once they are created, they are never changed.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
void fill(R &&Range, T &&Value)
Provide wrappers to std::fill which take ranges instead of having to pass begin/end explicitly.
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.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)
BitMask(uint16_t b, uint16_t e)
BitRef(unsigned R=0, uint16_t P=0)
bool operator!=(const BitValue &V) const
static BitValue ref(const BitValue &V)
bool operator==(const BitValue &V) const
BitValue(unsigned Reg, uint16_t Pos)
bool is(unsigned T) const
static BitValue self(const BitRef &Self=BitRef())
friend raw_ostream & operator<<(raw_ostream &OS, const BitValue &BV)
BitValue(ValueType T=Top)
bool meet(const BitValue &V, const BitRef &Self)
RegisterCell getRef(const RegisterRef &RR, const CellMapType &M) const
virtual bool evaluate(const MachineInstr &BI, const CellMapType &Inputs, BranchTargetList &Targets, bool &FallsThru) const =0
MachineEvaluator(const TargetRegisterInfo &T, MachineRegisterInfo &M)
const TargetRegisterInfo & TRI
MachineRegisterInfo & MRI
virtual const TargetRegisterClass & composeWithSubRegIndex(const TargetRegisterClass &RC, unsigned Idx) const
virtual bool track(const TargetRegisterClass *RC) const
virtual ~MachineEvaluator()=default
BitValue & operator[](uint16_t BitN)
static RegisterCell self(unsigned Reg, uint16_t Width)
static RegisterCell ref(const RegisterCell &C)
const BitValue & operator[](uint16_t BitN) const
static RegisterCell top(uint16_t Width)
RegisterCell(uint16_t Width=DefaultBitN)
RegisterRef(Register R=0, unsigned S=0)
RegisterRef(const MachineOperand &MO)
bool has(unsigned Reg) const
const RegisterCell & lookup(unsigned Reg) const
bool reached(const MachineBasicBlock *B) const
void trace(bool On=false)
void subst(RegisterRef OldRR, RegisterRef NewRR)
void print_cells(raw_ostream &OS) const
std::map< unsigned, RegisterCell > CellMapType
void put(RegisterRef RR, const RegisterCell &RC)
void visit(const MachineInstr &MI)
RegisterCell get(RegisterRef RR) const