31 #include "llvm/Target/TargetRegisterInfo.h"
32 #include "llvm/CodeGen/LiveIntervalAnalysis.h"
33 #include "llvm/CodeGen/MachineInstr.h"
34 #include "llvm/CodeGen/MachineFunction.h"
35 #include "llvm/Function.h"
36 #include "boost/graph/graphviz.hpp"
37 #include "VirtRegMap.h"
47 llvm::MachineFunction& mf, llvm::VirtRegMap& vrm) :
56 for (MachineInstrDDG::RegisterSet::const_iterator i = regs.begin();
57 i != regs.end(); ++i) {
60 if (llvm::TargetRegisterInfo::isPhysicalRegister(reg))
76 for (MachineInstrDDG::RegisterSet::const_iterator i = regs.begin();
77 i != regs.end(); ++i) {
80 for (MachineInstrDDG::RegisterSet::const_iterator u =
81 unhandledRegs.begin();
82 u != unhandledRegs.end(); ++u) {
87 <<
"could not find definer for " << otherReg << std::endl;
90 if (!tddg.
hasPath(*instrA, *instrB) &&
91 !tddg.
hasPath(*instrB, *instrA)) {
95 unhandledRegs.erase(reg);
102 std::string s(mf.getFunction()->getNameStr() +
"_fdpg.dot");
103 std::ofstream o(s.c_str());
104 boost::write_graphviz(
105 o,
fdpg_, make_label_writer(get(boost::vertex_name,
fdpg_)));
117 if (llvm::TargetRegisterInfo::isPhysicalRegister(interval->reg)) {
119 <<
"Should not see assigned intervals here. Got: "
128 int foundFalseDeps = 0;
129 std::set<MachineInstrDDG::Register> adjacent =
adjacentNodes(interval->reg);
130 for (std::set<MachineInstrDDG::Register>::const_iterator i =
131 adjacent.begin(); i != adjacent.end(); ++i) {
133 bool isPhysRegAssigned =
vrm_.hasPhys(virtReg);
134 if (isPhysRegAssigned &&
vrm_.getPhys(virtReg) == physReg) {
138 return foundFalseDeps;
154 std::set<MachineInstrDDG::Register>
156 std::set<MachineInstrDDG::Register> nodes;
158 boost::graph_traits<FDPG>::adjacency_iterator i, end;
161 for (; i != end; ++i) {
163 nodes.insert(virtReg);