43 case TargetOpcode::COPY: {
54 EM.insert(std::make_pair(DstR, SrcR));
57 case TargetOpcode::REG_SEQUENCE:
64 CopyMap.insert(std::make_pair(SA.
Id, EM));
65 Copies.push_back(SA.
Id);
83 Changed |= scanBlock(
I->getBlock());
105 dbgs() <<
"Copies:\n";
109 for (
auto J : CopyMap[
I])
116 bool Changed =
false;
118 bool HasLimit =
CpLimit.getNumOccurrences() > 0;
121 auto MinPhysReg = [
this] (
RegisterRef RR) ->
unsigned {
128 return S.getSubReg();
135 if (HasLimit && CpCount >=
CpLimit)
139 auto FS = CopyMap.find(SA.
Id);
140 if (FS == CopyMap.end())
146 auto FR = EM.find(DR);
153 NodeId AtCopy = getLocalReachingDef(SR, SA);
155 for (
NodeId N = DA.Addr->getReachedUse(), NextN;
N;
N = NextN) {
161 if (UA.Addr->getRegRef(DFG) != DR)
166 NodeId AtUse = getLocalReachingDef(SR, IA);
179 unsigned NewReg = MinPhysReg(SR);
184 UA.Addr->linkToDef(UA.Id, DFG.
addr<
DefNode*>(AtCopy));
186 UA.Addr->setReachingDef(0);
187 UA.Addr->setSibling(0);
192 if (HasLimit && CpCount >=
CpLimit)
197 auto FC = CopyMap.find(IA.
Id);
198 if (
FC != CopyMap.end()) {
200 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)
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
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.
void setReg(Register Reg)
Change the register this operand corresponds to.
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
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)
Register getReg() const
getReg - Returns the register number.
const MachineOperand & getOperand(unsigned i) const
NodeId getSibling() const