summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MIRPrinter.cpp
diff options
context:
space:
mode:
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>2017-11-30 16:12:24 +0000
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>2017-11-30 16:12:24 +0000
commitc71cced0aae46ab4f27e2ea755819f308661670b (patch)
treee63f1794dd2fed8bf926665dc8aa53abc7e13048 /llvm/lib/CodeGen/MIRPrinter.cpp
parent0cdf7fdc48fd024a55df2afd773d0f7359a79736 (diff)
downloadbcm5719-llvm-c71cced0aae46ab4f27e2ea755819f308661670b.tar.gz
bcm5719-llvm-c71cced0aae46ab4f27e2ea755819f308661670b.zip
[CodeGen] Always use `printReg` to print registers in both MIR and debug
output As part of the unification of the debug format and the MIR format, always use `printReg` to print all kinds of registers. Updated the tests using '_' instead of '%noreg' until we decide which one we want to be the default one. Differential Revision: https://reviews.llvm.org/D40421 llvm-svn: 319445
Diffstat (limited to 'llvm/lib/CodeGen/MIRPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/MIRPrinter.cpp25
1 files changed, 6 insertions, 19 deletions
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp
index 989e0423abe..e437a528115 100644
--- a/llvm/lib/CodeGen/MIRPrinter.cpp
+++ b/llvm/lib/CodeGen/MIRPrinter.cpp
@@ -192,23 +192,10 @@ template <> struct BlockScalarTraits<Module> {
} // end namespace yaml
} // end namespace llvm
-static void printRegMIR(unsigned Reg, raw_ostream &OS,
- const TargetRegisterInfo *TRI) {
- // TODO: Print Stack Slots.
- if (!Reg)
- OS << '_';
- else if (TargetRegisterInfo::isVirtualRegister(Reg))
- OS << '%' << TargetRegisterInfo::virtReg2Index(Reg);
- else if (Reg < TRI->getNumRegs())
- OS << '%' << StringRef(TRI->getName(Reg)).lower();
- else
- llvm_unreachable("Can't print this kind of register yet");
-}
-
static void printRegMIR(unsigned Reg, yaml::StringValue &Dest,
const TargetRegisterInfo *TRI) {
raw_string_ostream OS(Dest.Value);
- printRegMIR(Reg, OS, TRI);
+ OS << printReg(Reg, TRI);
}
void MIRPrinter::print(const MachineFunction &MF) {
@@ -262,7 +249,7 @@ static void printCustomRegMask(const uint32_t *RegMask, raw_ostream &OS,
if (RegMask[I / 32] & (1u << (I % 32))) {
if (IsRegInRegMaskFound)
OS << ',';
- printRegMIR(I, OS, TRI);
+ OS << printReg(I, TRI);
IsRegInRegMaskFound = true;
}
}
@@ -648,7 +635,7 @@ void MIPrinter::print(const MachineBasicBlock &MBB) {
if (!First)
OS << ", ";
First = false;
- printRegMIR(LI.PhysReg, OS, &TRI);
+ OS << printReg(LI.PhysReg, &TRI);
if (!LI.LaneMask.all())
OS << ":0x" << PrintLaneMask(LI.LaneMask);
}
@@ -949,7 +936,7 @@ void MIPrinter::print(const MachineInstr &MI, unsigned OpIdx,
OS << "early-clobber ";
if (Op.isDebug())
OS << "debug-use ";
- printRegMIR(Reg, OS, TRI);
+ OS << printReg(Reg, TRI);
// Print the sub register.
if (Op.getSubReg() != 0)
OS << '.' << TRI->getSubRegIndexName(Op.getSubReg());
@@ -1041,7 +1028,7 @@ void MIPrinter::print(const MachineInstr &MI, unsigned OpIdx,
if (RegMask[Reg / 32] & (1U << (Reg % 32))) {
if (IsCommaNeeded)
OS << ", ";
- printRegMIR(Reg, OS, TRI);
+ OS << printReg(Reg, TRI);
IsCommaNeeded = true;
}
}
@@ -1212,7 +1199,7 @@ static void printCFIRegister(unsigned DwarfReg, raw_ostream &OS,
OS << "<badreg>";
return;
}
- printRegMIR(Reg, OS, TRI);
+ OS << printReg(Reg, TRI);
}
void MIPrinter::print(const MCCFIInstruction &CFI,
OpenPOWER on IntegriCloud