58 bool DeadCodeElimination::isLiveInstr(
const MachineInstr *
MI)
const {
67 if (
Op.isReg() &&
MRI.isReserved(
Op.getReg()))
71 for (
unsigned R = 0,
RN = DFG.getTRI().getNumRegs(); R !=
RN; ++R) {
72 if (BM[R/32] & (1u << (R%32)))
74 if (
MRI.isReserved(R))
89 if (!LiveNodes.count(
RA.Id))
98 if (!LiveNodes.count(UA.Id))
102 LiveNodes.insert(
TA.Id);
108 if (!LiveNodes.count(DA.
Id))
127 SetQueue<NodeId> WorkQ;
130 scanInstr(IA, WorkQ);
132 while (!WorkQ.empty()) {
137 processDef(
RA, WorkQ);
139 processUse(
RA, WorkQ);
143 dbgs() <<
"Live nodes:\n";
152 if (LiveNodes.count(DA.
Id))
160 if (!LiveNodes.count(
RA.Id))
161 DeadNodes.insert(
RA.Id);
166 DeadInstrs.insert(IA.
Id);
173 return !DeadNodes.empty();
187 for (
auto I : Nodes) {
189 uint16_t
Type = BA.Addr->getType();
196 uint16_t
Kind = BA.Addr->getKind();
210 uint16_t KindA = A.
Addr->
getKind(), KindB =
B.Addr->getKind();
220 dbgs() <<
"Removing dead ref nodes:\n";
225 DFG.unlinkUse(RA,
true);
226 else if (DFG.IsDef(RA))
227 DFG.unlinkDef(RA,
true);
239 dbgs() <<
"erasing: " << *
MI;
bool isCall(QueryType Type=AnyInBundle) const
This class represents lattice values for constants.
void push_back(const T &Elt)
iterator_range< mop_iterator > operands()
SI optimize exec mask operations pre RA
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
NodeAddr< NodeBase * > getOwner(const DataFlowGraph &G)
bool isBranch(QueryType Type=AnyInBundle) const
Returns true if this is a conditional, unconditional, or indirect branch.
bool isReturn(QueryType Type=AnyInBundle) const
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
unsigned const MachineRegisterInfo * MRI
The instances of the Type class are immutable: once they are created, they are never changed...
NodeList members_if(Predicate P, const DataFlowGraph &G) const
NodeList members(const DataFlowGraph &G) const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void sort(IteratorTy Start, IteratorTy End)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
bool hasOrderedMemoryRef() const
Return true if this instruction may have an ordered or volatile memory reference, or if the informati...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void removeMember(NodeAddr< NodeBase *> NA, const DataFlowGraph &G)
Representation of each machine instruction.
NodeAddr< NodeBase * > getOwner(const DataFlowGraph &G)
bool empty() const
Determine if the SetVector is empty or not.
bool erase(const SetVector< NodeId > &Nodes)
A vector that has set insertion semantics.
bool hasUnmodeledSideEffects() const
Return true if this instruction has side effects that are not modeled by mayLoad / mayStore...