Replace all target specific implicit def instructions with a target independent one: TargetInstrInfo::IMPLICIT_DEF.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48380 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
index 4523775..d0d078a 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
@@ -467,8 +467,7 @@
   assert(isNew && "Node emitted out of order - early");
 }
 
-void ScheduleDAG::CreateVirtualRegisters(SDNode *Node,
-                                         MachineInstr *MI,
+void ScheduleDAG::CreateVirtualRegisters(SDNode *Node, MachineInstr *MI,
                                          const TargetInstrDesc &II,
                                      DenseMap<SDOperand, unsigned> &VRBaseMap) {
   for (unsigned i = 0; i < II.getNumDefs(); ++i) {
@@ -494,7 +493,13 @@
     // Create the result registers for this node and add the result regs to
     // the machine instruction.
     if (VRBase == 0) {
-      const TargetRegisterClass *RC = getInstrOperandRegClass(TRI, TII, II, i);
+      const TargetRegisterClass *RC;
+      if (Node->getTargetOpcode() == TargetInstrInfo::IMPLICIT_DEF)
+        // IMPLICIT_DEF can produce any type of result so its TargetInstrDesc
+        // does not include operand register class info.
+        RC = DAG.getTargetLoweringInfo().getRegClassFor(Node->getValueType(0));
+      else
+        RC = getInstrOperandRegClass(TRI, TII, II, i);
       assert(RC && "Isn't a register operand!");
       VRBase = MRI.createVirtualRegister(RC);
       MI->addOperand(MachineOperand::CreateReg(VRBase, true));