diff options
| author | Tim Northover <tnorthover@apple.com> | 2016-09-09 11:46:34 +0000 |
|---|---|---|
| committer | Tim Northover <tnorthover@apple.com> | 2016-09-09 11:46:34 +0000 |
| commit | 0f140c769a75779991d0bb31c2e34907621d2386 (patch) | |
| tree | ee9ab7880246083d7fe91bd95f29a59a98e2e09f /llvm/lib/CodeGen/MIRPrinter.cpp | |
| parent | a3afe44d6c1499e7b11968ed502f3d5193479076 (diff) | |
| download | bcm5719-llvm-0f140c769a75779991d0bb31c2e34907621d2386.tar.gz bcm5719-llvm-0f140c769a75779991d0bb31c2e34907621d2386.zip | |
GlobalISel: move type information to MachineRegisterInfo.
We want each register to have a canonical type, which means the best place to
store this is in MachineRegisterInfo rather than on every MachineInstr that
happens to use or define that register.
Most changes following from this are pretty simple (you need an MRI anyway if
you're going to be doing any transformations, so just check the type there).
But legalization doesn't really want to check redundant operands (when, for
example, a G_ADD only ever has one type) so I've made use of MCInstrDesc's
operand type field to encode these constraints and limit legalization's work.
As an added bonus, more validation is possible, both in MachineVerifier and
MachineIRBuilder (coming soon).
llvm-svn: 281035
Diffstat (limited to 'llvm/lib/CodeGen/MIRPrinter.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/MIRPrinter.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp index 7b9baa7db0a..b981f597d57 100644 --- a/llvm/lib/CodeGen/MIRPrinter.cpp +++ b/llvm/lib/CodeGen/MIRPrinter.cpp @@ -223,7 +223,8 @@ void MIRPrinter::convert(yaml::MachineFunction &MF, VReg.Class = StringRef(RegInfo.getRegBankOrNull(Reg)->getName()).lower(); else { VReg.Class = std::string("_"); - assert(RegInfo.getSize(Reg) && "Generic registers must have a size"); + assert(RegInfo.getType(Reg).isValid() && + "Generic registers must have a valid type"); } unsigned PreferredReg = RegInfo.getSimpleHint(Reg); if (PreferredReg) @@ -568,17 +569,6 @@ void MIPrinter::print(const MachineInstr &MI) { if (MI.getFlag(MachineInstr::FrameSetup)) OS << "frame-setup "; OS << TII->getName(MI.getOpcode()); - if (isPreISelGenericOpcode(MI.getOpcode())) { - assert(MI.getType().isValid() && "Generic instructions must have a type"); - unsigned NumTypes = MI.getNumTypes(); - OS << (NumTypes > 1 ? " {" : "") << ' '; - for (unsigned i = 0; i < NumTypes; ++i) { - MI.getType(i).print(OS); - if (i + 1 != NumTypes) - OS << ", "; - } - OS << (NumTypes > 1 ? " }" : "") << ' '; - } if (I < E) OS << ' '; @@ -787,8 +777,8 @@ void MIPrinter::print(const MachineOperand &Op, const TargetRegisterInfo *TRI, if (ShouldPrintRegisterTies && Op.isTied() && !Op.isDef()) OS << "(tied-def " << Op.getParent()->findTiedOperandIdx(I) << ")"; assert((!IsDef || MRI) && "for IsDef, MRI must be provided"); - if (IsDef && MRI->getSize(Op.getReg())) - OS << '(' << MRI->getSize(Op.getReg()) << ')'; + if (IsDef && MRI->getType(Op.getReg()).isValid()) + OS << '(' << MRI->getType(Op.getReg()) << ')'; break; case MachineOperand::MO_Immediate: OS << Op.getImm(); |

