9#ifndef LLVM_LIB_TARGET_HEXAGON_BITTRACKER_H
10#define LLVM_LIB_TARGET_HEXAGON_BITTRACKER_H
47 void trace(
bool On =
false) { Trace = On; }
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);
111 MachineRegisterInfo &MRI;
114 EdgeSetType EdgeExec;
115 InstrSetType InstrExec;
118 DenseSet<unsigned> ReachedBB;
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)
static bool evaluate(const MCSpecifierExpr &Expr, MCValue &Res, const MCAssembler *Asm)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
raw_ostream & operator<<(raw_ostream &OS, const binary_le_impl< value_type > &BLE)
This file defines the DenseSet and SmallDenseSet classes.
bool operator==(const MergedFunctionsInfo &LHS, const MergedFunctionsInfo &RHS)
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...
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 namespace contains all of the command line option processing machinery.
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.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
@ Sub
Subtraction of integers.
BitMask(uint16_t b, uint16_t e)
BitRef(unsigned R=0, uint16_t P=0)
bool operator==(const BitRef &BR) const
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
uint16_t getRegBitWidth(const RegisterRef &RR) const
MachineRegisterInfo & MRI
virtual const TargetRegisterClass & composeWithSubRegIndex(const TargetRegisterClass &RC, unsigned Idx) const
virtual bool track(const TargetRegisterClass *RC) const
void putCell(const RegisterRef &RR, RegisterCell RC, CellMapType &M) const
RegisterCell getCell(const RegisterRef &RR, const CellMapType &M) 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)
SetVector< const MachineBasicBlock * > BranchTargetList
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)
BitTracker(const MachineEvaluator &E, MachineFunction &F)
void visit(const MachineInstr &MI)
RegisterCell get(RegisterRef RR) const