#include "llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h"
#include "llvm/ADT/ArrayRef.h"
usingnamespacellvm::sandboxir;
#ifndef NDEBUG
void DGNode::print(raw_ostream &OS, bool PrintDeps) const {
I->dumpOS(OS);
if (PrintDeps) {
OS << "\n";
static constexpr const unsigned Indent = 4;
for (auto *Pred : MemPreds) {
OS.indent(Indent) << "<-";
Pred->print(OS, false);
OS << "\n";
}
}
}
void DGNode::dump() const {
print(dbgs());
dbgs() << "\n";
}
#endif
Interval<MemDGNode>
MemDGNodeIntervalBuilder::make(const Interval<Instruction> &Instrs,
DependencyGraph &DAG) { … }
Interval<Instruction> DependencyGraph::extend(ArrayRef<Instruction *> Instrs) { … }
#ifndef NDEBUG
void DependencyGraph::print(raw_ostream &OS) const {
SmallVector<DGNode *> Nodes;
Nodes.reserve(InstrToNodeMap.size());
for (const auto &Pair : InstrToNodeMap)
Nodes.push_back(Pair.second.get());
sort(Nodes, [](DGNode *N1, DGNode *N2) {
return N1->getInstruction()->comesBefore(N2->getInstruction());
});
for (auto *N : Nodes)
N->print(OS, true);
}
void DependencyGraph::dump() const {
print(dbgs());
dbgs() << "\n";
}
#endif