mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Make -print-machineinstrs more readable.
- Be consistent when referring to MachineBasicBlocks: BB#0. - Be consistent when referring to virtual registers: %reg1024. - Be consistent when referring to unknown physical registers: %physreg10. - Be consistent when referring to known physical registers: %RAX - Be consistent when referring to register 0: %reg0 - Be consistent when printing alignments: align=16 - Print jump table contents. - Don't print host addresses, in general. - and various other cleanups. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85682 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -52,7 +52,7 @@ namespace {
|
||||
}
|
||||
|
||||
bool runOnMachineFunction(MachineFunction &MF) {
|
||||
OS << Banner;
|
||||
OS << "# " << Banner << ":\n";
|
||||
MF.print(OS);
|
||||
return false;
|
||||
}
|
||||
@ -303,7 +303,7 @@ void MachineFunction::dump() const {
|
||||
}
|
||||
|
||||
void MachineFunction::print(raw_ostream &OS) const {
|
||||
OS << "# Machine code for " << Fn->getName() << "():\n";
|
||||
OS << "# Machine code for function " << Fn->getName() << ":\n";
|
||||
|
||||
// Print Frame Information
|
||||
FrameInfo->print(*this, OS);
|
||||
@ -317,34 +317,43 @@ void MachineFunction::print(raw_ostream &OS) const {
|
||||
const TargetRegisterInfo *TRI = getTarget().getRegisterInfo();
|
||||
|
||||
if (RegInfo && !RegInfo->livein_empty()) {
|
||||
OS << "Live Ins:";
|
||||
OS << "Function Live Ins: ";
|
||||
for (MachineRegisterInfo::livein_iterator
|
||||
I = RegInfo->livein_begin(), E = RegInfo->livein_end(); I != E; ++I) {
|
||||
if (TRI)
|
||||
OS << " " << TRI->getName(I->first);
|
||||
OS << "%" << TRI->getName(I->first);
|
||||
else
|
||||
OS << " Reg #" << I->first;
|
||||
OS << " %physreg" << I->first;
|
||||
|
||||
if (I->second)
|
||||
OS << " in VR#" << I->second << ' ';
|
||||
OS << " in reg%" << I->second;
|
||||
|
||||
if (next(I) != E)
|
||||
OS << ", ";
|
||||
}
|
||||
OS << '\n';
|
||||
}
|
||||
if (RegInfo && !RegInfo->liveout_empty()) {
|
||||
OS << "Live Outs:";
|
||||
OS << "Function Live Outs: ";
|
||||
for (MachineRegisterInfo::liveout_iterator
|
||||
I = RegInfo->liveout_begin(), E = RegInfo->liveout_end(); I != E; ++I)
|
||||
I = RegInfo->liveout_begin(), E = RegInfo->liveout_end(); I != E; ++I){
|
||||
if (TRI)
|
||||
OS << ' ' << TRI->getName(*I);
|
||||
OS << '%' << TRI->getName(*I);
|
||||
else
|
||||
OS << " Reg #" << *I;
|
||||
OS << "%physreg" << *I;
|
||||
|
||||
if (next(I) != E)
|
||||
OS << " ";
|
||||
}
|
||||
OS << '\n';
|
||||
}
|
||||
|
||||
for (const_iterator BB = begin(), E = end(); BB != E; ++BB)
|
||||
for (const_iterator BB = begin(), E = end(); BB != E; ++BB) {
|
||||
OS << '\n';
|
||||
BB->print(OS);
|
||||
}
|
||||
|
||||
OS << "\n# End machine code for " << Fn->getName() << "().\n\n";
|
||||
OS << "\n# End machine code for function " << Fn->getName() << ".\n\n";
|
||||
}
|
||||
|
||||
namespace llvm {
|
||||
@ -471,12 +480,16 @@ MachineFrameInfo::getPristineRegs(const MachineBasicBlock *MBB) const {
|
||||
|
||||
|
||||
void MachineFrameInfo::print(const MachineFunction &MF, raw_ostream &OS) const{
|
||||
if (Objects.empty()) return;
|
||||
|
||||
const TargetFrameInfo *FI = MF.getTarget().getFrameInfo();
|
||||
int ValOffset = (FI ? FI->getOffsetOfLocalArea() : 0);
|
||||
|
||||
OS << "Frame Objects:\n";
|
||||
|
||||
for (unsigned i = 0, e = Objects.size(); i != e; ++i) {
|
||||
const StackObject &SO = Objects[i];
|
||||
OS << " <fi#" << (int)(i-NumFixedObjects) << ">: ";
|
||||
OS << " fi#" << (int)(i-NumFixedObjects) << ": ";
|
||||
if (SO.Size == ~0ULL) {
|
||||
OS << "dead\n";
|
||||
continue;
|
||||
@ -484,15 +497,14 @@ void MachineFrameInfo::print(const MachineFunction &MF, raw_ostream &OS) const{
|
||||
if (SO.Size == 0)
|
||||
OS << "variable sized";
|
||||
else
|
||||
OS << "size is " << SO.Size << " byte" << (SO.Size != 1 ? "s," : ",");
|
||||
OS << " alignment is " << SO.Alignment << " byte"
|
||||
<< (SO.Alignment != 1 ? "s," : ",");
|
||||
OS << "size=" << SO.Size;
|
||||
OS << ", align=" << SO.Alignment;
|
||||
|
||||
if (i < NumFixedObjects)
|
||||
OS << " fixed";
|
||||
OS << ", fixed";
|
||||
if (i < NumFixedObjects || SO.SPOffset != -1) {
|
||||
int64_t Off = SO.SPOffset - ValOffset;
|
||||
OS << " at location [SP";
|
||||
OS << ", at location [SP";
|
||||
if (Off > 0)
|
||||
OS << "+" << Off;
|
||||
else if (Off < 0)
|
||||
@ -501,9 +513,6 @@ void MachineFrameInfo::print(const MachineFunction &MF, raw_ostream &OS) const{
|
||||
}
|
||||
OS << "\n";
|
||||
}
|
||||
|
||||
if (HasVarSizedObjects)
|
||||
OS << " Stack frame contains variable sized objects\n";
|
||||
}
|
||||
|
||||
void MachineFrameInfo::dump(const MachineFunction &MF) const {
|
||||
@ -547,12 +556,17 @@ MachineJumpTableInfo::ReplaceMBBInJumpTables(MachineBasicBlock *Old,
|
||||
}
|
||||
|
||||
void MachineJumpTableInfo::print(raw_ostream &OS) const {
|
||||
// FIXME: this is lame, maybe we could print out the MBB numbers or something
|
||||
// like {1, 2, 4, 5, 3, 0}
|
||||
if (JumpTables.empty()) return;
|
||||
|
||||
OS << "Jump Tables:\n";
|
||||
|
||||
for (unsigned i = 0, e = JumpTables.size(); i != e; ++i) {
|
||||
OS << " <jt#" << i << "> has " << JumpTables[i].MBBs.size()
|
||||
<< " entries\n";
|
||||
OS << " jt#" << i << ": ";
|
||||
for (unsigned j = 0, f = JumpTables[i].MBBs.size(); j != f; ++j)
|
||||
OS << " BB#" << JumpTables[i].MBBs[j]->getNumber();
|
||||
}
|
||||
|
||||
OS << '\n';
|
||||
}
|
||||
|
||||
void MachineJumpTableInfo::dump() const { print(errs()); }
|
||||
@ -664,13 +678,16 @@ unsigned MachineConstantPool::getConstantPoolIndex(MachineConstantPoolValue *V,
|
||||
}
|
||||
|
||||
void MachineConstantPool::print(raw_ostream &OS) const {
|
||||
if (Constants.empty()) return;
|
||||
|
||||
OS << "Constant Pool:\n";
|
||||
for (unsigned i = 0, e = Constants.size(); i != e; ++i) {
|
||||
OS << " <cp#" << i << "> is";
|
||||
OS << " cp#" << i << ": ";
|
||||
if (Constants[i].isMachineConstantPoolEntry())
|
||||
Constants[i].Val.MachineCPVal->print(OS);
|
||||
else
|
||||
OS << *(Value*)Constants[i].Val.ConstVal;
|
||||
OS << " , alignment=" << Constants[i].getAlignment();
|
||||
OS << ", align=" << Constants[i].getAlignment();
|
||||
OS << "\n";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user