44 case TargetOpcode::COPY: {
55 EM.insert(std::make_pair(DstR, SrcR));
58 case TargetOpcode::REG_SEQUENCE:
65 CopyMap.insert(std::make_pair(SA.
Id, EM));
66 Copies.push_back(SA.
Id);
84 Changed |= scanBlock(
I->getBlock());
106 dbgs() <<
"Copies:\n";
110 for (
auto J : CopyMap[
I])
117 bool Changed =
false;
119 bool HasLimit =
CpLimit.getNumOccurrences() > 0;
122 auto MinPhysReg = [
this] (
RegisterRef RR) ->
unsigned {
129 return S.getSubReg();
136 if (HasLimit && CpCount >=
CpLimit)
140 auto FS = CopyMap.find(SA.
Id);
141 if (FS == CopyMap.end())
147 auto FR = EM.find(DR);
154 NodeId AtCopy = getLocalReachingDef(SR, SA);
156 for (
NodeId N = DA.Addr->getReachedUse(), NextN;
N;
N = NextN) {
159 uint16_t
F = UA.Addr->getFlags();
162 if (UA.Addr->getRegRef(DFG) != DR)
167 NodeId AtUse = getLocalReachingDef(SR, IA);
180 unsigned NewReg = MinPhysReg(SR);
185 UA.Addr->linkToDef(UA.Id, DFG.
addr<
DefNode*>(AtCopy));
187 UA.Addr->setReachingDef(0);
188 UA.Addr->setSibling(0);
193 if (HasLimit && CpCount >=
CpLimit)
198 auto FC = CopyMap.find(IA.
Id);
199 if (
FC != CopyMap.end()) {
201 auto &M =
FC->second;
NodeAddr< BlockNode * > findBlock(MachineBasicBlock *BB) const
MachineFunction & getMF() const
MachineDomTreeNode * getNode(MachineBasicBlock *BB) const
getNode - return the (Post)DominatorTree node for the specified basic block.
This class represents lattice values for constants.
static cl::opt< unsigned > CpLimit("rdf-cp-limit", cl::init(0), cl::Hidden)
unsigned getReg() const
getReg - Returns the register number.
unsigned getSubReg() const
unsigned const TargetRegisterInfo * TRI
SI optimize exec mask operations pre RA
NodeAddr< RefNode * > getNearestAliasedRef(RegisterRef RefRR, NodeAddr< InstrNode *> IA)
Find the nearest ref node aliased to RefRR, going upwards in the data flow, starting from the instruc...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
void unlinkUse(NodeAddr< UseNode *> UA, bool RemoveFromOwner)
Base class for the actual dominator tree node.
RegisterRef makeRegRef(unsigned Reg, unsigned Sub) const
NodeAddr< NodeBase * > getOwner(const DataFlowGraph &G)
std::map< RegisterRef, RegisterRef > EqualityMap
initializer< Ty > init(const Ty &Val)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
NodeAddr< T > addr(NodeId N) const
Iterator that enumerates the sub-registers of a Reg and the associated sub-register indices...
const TargetRegisterInfo & getTRI() const
MachineInstr * getCode() const
NodeList members_if(Predicate P, const DataFlowGraph &G) const
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
const MachineBasicBlock & front() const
NodeList members(const DataFlowGraph &G) const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
virtual bool interpretAsCopy(const MachineInstr *MI, EqualityMap &EM)
bool isValid() const
Returns true if this iterator is not yet at the end.
MachineOperand class - Representation of each machine instruction operand.
LaneBitmask getSubRegIndexLaneMask(unsigned SubIdx) const
Return a bitmask representing the parts of a register that are covered by SubIdx. ...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Representation of each machine instruction.
NodeId getReachingDef() const
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
void setReg(unsigned Reg)
Change the register this operand corresponds to.
void setSubReg(unsigned subReg)
static bool IsCode(const NodeAddr< NodeBase *> BA)
const LaneBitmask LaneMask
const TargetRegisterClass * getMinimalPhysRegClass(unsigned Reg, MVT VT=MVT::Other) const
Returns the Register Class of a physical register of the given type, picking the most sub register cl...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool IsDef(const NodeAddr< NodeBase *> BA)
const MachineOperand & getOperand(unsigned i) const
NodeId getSibling() const