mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-09 13:41:35 +00:00
simpilfy some register printing code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45458 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7da5313d3f
commit
e26dcfe6af
@ -267,26 +267,16 @@ void MachineInstr::dump() const {
|
||||
cerr << " " << *this;
|
||||
}
|
||||
|
||||
static void OutputReg(std::ostream &os, unsigned RegNo,
|
||||
const MRegisterInfo *MRI = 0) {
|
||||
if (MRegisterInfo::isPhysicalRegister(RegNo)) {
|
||||
if (MRI)
|
||||
os << "%" << MRI->get(RegNo).Name;
|
||||
else
|
||||
os << "%mreg" << RegNo;
|
||||
} else {
|
||||
os << "%reg" << RegNo;
|
||||
}
|
||||
}
|
||||
|
||||
static void print(const MachineOperand &MO, std::ostream &OS,
|
||||
const TargetMachine *TM) {
|
||||
const MRegisterInfo *MRI = 0;
|
||||
if (TM) MRI = TM->getRegisterInfo();
|
||||
|
||||
switch (MO.getType()) {
|
||||
case MachineOperand::MO_Register:
|
||||
OutputReg(OS, MO.getReg(), MRI);
|
||||
if (MO.getReg() == 0 || MRegisterInfo::isVirtualRegister(MO.getReg()))
|
||||
OS << "%reg" << MO.getReg();
|
||||
else if (TM)
|
||||
OS << "%" << TM->getRegisterInfo()->get(MO.getReg()).Name;
|
||||
else
|
||||
OS << "%mreg" << MO.getReg();
|
||||
if (MO.isDef()) OS << "<d>";
|
||||
break;
|
||||
case MachineOperand::MO_Immediate:
|
||||
|
Loading…
Reference in New Issue
Block a user