Don't abort if a MemOperand is missing a SourceValue; just print it

as <unknown>. And make some minor adjustments to the MemOperand
dump format.

llvm-svn: 46853
This commit is contained in:
Dan Gohman 2008-02-07 16:18:00 +00:00
parent 6936a08704
commit b781c79d2c
1 changed files with 13 additions and 9 deletions

View File

@ -631,30 +631,34 @@ void MachineInstr::print(std::ostream &OS, const TargetMachine *TM) const {
}
if (getNumMemOperands() > 0) {
OS << ", SV:";
OS << ", Mem:";
for (unsigned i = 0; i < getNumMemOperands(); i++) {
const MemOperand &MRO = getMemOperand(i);
const Value *V = MRO.getValue();
assert(V && "SV missing.");
assert((MRO.isLoad() || MRO.isStore()) &&
"SV has to be a load, store or both.");
if (MRO.isVolatile())
OS << "Volatile ";
if (MRO.isLoad())
OS << "LD ";
OS << "LD";
if (MRO.isStore())
OS << "ST ";
OS << "ST";
OS << MRO.getSize();
OS << "(" << MRO.getSize() << ") [";
if (!V->getName().empty())
OS << "[" << V->getName() << " + " << MRO.getOffset() << "]";
if (!V)
OS << "<unknown>";
else if (!V->getName().empty())
OS << V->getName();
else if (isa<PseudoSourceValue>(V))
OS << "[" << *V << " + " << MRO.getOffset() << "]";
OS << *V;
else
OS << "[" << V << " + " << MRO.getOffset() << "]";
OS << V;
OS << " + " << MRO.getOffset() << "]";
}
}