Use TargetMachine hooks to properly print debug variable locations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130997 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen 2011-05-06 17:59:59 +00:00
parent cf5e5f3cc0
commit e77150bbcb

View File

@ -228,7 +228,7 @@ public:
/// Only first one needs DebugLoc to identify variable's lexical scope /// Only first one needs DebugLoc to identify variable's lexical scope
/// in source file. /// in source file.
DebugLoc findDebugLoc(); DebugLoc findDebugLoc();
void print(raw_ostream&, const TargetRegisterInfo*); void print(raw_ostream&, const TargetMachine*);
}; };
} // namespace } // namespace
@ -300,7 +300,7 @@ public:
}; };
} // namespace } // namespace
void UserValue::print(raw_ostream &OS, const TargetRegisterInfo *TRI) { void UserValue::print(raw_ostream &OS, const TargetMachine *TM) {
if (const MDString *MDS = dyn_cast<MDString>(variable->getOperand(2))) if (const MDString *MDS = dyn_cast<MDString>(variable->getOperand(2)))
OS << "!\"" << MDS->getString() << "\"\t"; OS << "!\"" << MDS->getString() << "\"\t";
if (offset) if (offset)
@ -312,15 +312,17 @@ void UserValue::print(raw_ostream &OS, const TargetRegisterInfo *TRI) {
else else
OS << I.value(); OS << I.value();
} }
for (unsigned i = 0, e = locations.size(); i != e; ++i) for (unsigned i = 0, e = locations.size(); i != e; ++i) {
OS << " Loc" << i << '=' << locations[i]; OS << " Loc" << i << '=';
locations[i].print(OS, TM);
}
OS << '\n'; OS << '\n';
} }
void LDVImpl::print(raw_ostream &OS) { void LDVImpl::print(raw_ostream &OS) {
OS << "********** DEBUG VARIABLES **********\n"; OS << "********** DEBUG VARIABLES **********\n";
for (unsigned i = 0, e = userValues.size(); i != e; ++i) for (unsigned i = 0, e = userValues.size(); i != e; ++i)
userValues[i]->print(OS, TRI); userValues[i]->print(OS, &MF->getTarget());
} }
void UserValue::coalesceLocation(unsigned LocNo) { void UserValue::coalesceLocation(unsigned LocNo) {
@ -701,7 +703,6 @@ UserValue::rewriteLocations(VirtRegMap &VRM, const TargetRegisterInfo &TRI) {
} }
coalesceLocation(LocNo); coalesceLocation(LocNo);
} }
DEBUG(print(dbgs(), &TRI));
} }
/// findInsertLocation - Find an iterator for inserting a DBG_VALUE /// findInsertLocation - Find an iterator for inserting a DBG_VALUE