Changes in directory llvm/utils/TableGen:
DAGISelEmitter.cpp updated: 1.83 -> 1.84 --- Log message: Implement PR673: http://llvm.cs.uiuc.edu/PR673 : for explicit register references, use type information if available --- Diffs of the changes: (+8 -15) DAGISelEmitter.cpp | 23 ++++++++--------------- 1 files changed, 8 insertions(+), 15 deletions(-) Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.83 llvm/utils/TableGen/DAGISelEmitter.cpp:1.84 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.83 Sun Dec 4 18:48:51 2005 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Sun Dec 4 20:36:37 2005 @@ -467,9 +467,12 @@ // Pattern fragment types will be resolved when they are inlined. return MVT::isUnknown; } else if (R->isSubClassOf("Register")) { - //const CodeGenTarget &T = TP.getDAGISelEmitter().getTargetInfo(); - // TODO: if a register appears in exactly one regclass, we could use that - // type info. + // If the register appears in exactly one regclass, and the regclass has one + // value type, use it as the known type. + const CodeGenTarget &T = TP.getDAGISelEmitter().getTargetInfo(); + if (const CodeGenRegisterClass *RC = T.getRegisterClassForRegister(R)) + if (RC->getNumValueTypes() == 1) + return RC->getValueTypeNum(0); return MVT::isUnknown; } else if (R->isSubClassOf("ValueType") || R->isSubClassOf("CondCode")) { // Using a VTSDNode or CondCodeSDNode. @@ -1719,18 +1722,8 @@ /// getRegisterValueType - Look up and return the first ValueType of specified /// RegisterClass record static MVT::ValueType getRegisterValueType(Record *R, const CodeGenTarget &T) { - const std::vector<CodeGenRegisterClass> &RegisterClasses = - T.getRegisterClasses(); - - for (unsigned i = 0, e = RegisterClasses.size(); i != e; ++i) { - const CodeGenRegisterClass &RC = RegisterClasses[i]; - for (unsigned ei = 0, ee = RC.Elements.size(); ei != ee; ++ei) { - if (R == RC.Elements[ei]) { - return RC.getValueTypeNum(0); - } - } - } - + if (const CodeGenRegisterClass *RC = T.getRegisterClassForRegister(R)) + return RC->getValueTypeNum(0); return MVT::Other; } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits