From b2c121ac14707db27d73169dab6c5d8592709843 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Thu, 27 Jul 2006 06:36:49 +0000 Subject: [PATCH] Let each target specific isel provide routine to check if a chain producing node is foldable by another. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29335 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/SelectionDAGISel.h | 6 +++++- utils/TableGen/DAGISelEmitter.cpp | 10 ++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/include/llvm/CodeGen/SelectionDAGISel.h b/include/llvm/CodeGen/SelectionDAGISel.h index 397a5d8043d..790f23ba6b0 100644 --- a/include/llvm/CodeGen/SelectionDAGISel.h +++ b/include/llvm/CodeGen/SelectionDAGISel.h @@ -62,6 +62,10 @@ public: SelectionDAG &DAG) { return true; } + + /// IsFoldableBy - Returns true if the specific operand node N of U can be + /// folded during instruction selection? + virtual bool IsFoldableBy(SDNode *N, SDNode *U) { return true; } /// CreateTargetHazardRecognizer - Return a newly allocated hazard recognizer /// to use for this target when scheduling the DAG. @@ -111,7 +115,7 @@ protected: /// by tblgen. Others should not call it. void SelectInlineAsmMemoryOperands(std::vector &Ops, SelectionDAG &DAG); - + private: SDOperand CopyValueToVirtualRegister(SelectionDAGLowering &SDL, Value *V, unsigned Reg); diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp index 8a62ed8bc33..c194c47987d 100644 --- a/utils/TableGen/DAGISelEmitter.cpp +++ b/utils/TableGen/DAGISelEmitter.cpp @@ -2280,14 +2280,8 @@ public: PInfo.hasProperty(SDNodeInfo::SDNPHasChain) || PInfo.hasProperty(SDNodeInfo::SDNPInFlag) || PInfo.hasProperty(SDNodeInfo::SDNPOptInFlag)) - if (PInfo.getNumOperands() > 1) { - emitCheck("!isNonImmUse(" + ParentName + ".Val, " + RootName + - ".Val)"); - } else { - emitCheck("(" + ParentName + ".getNumOperands() == 1 || !" + - "isNonImmUse(" + ParentName + ".Val, " + RootName + - ".Val))"); - } + emitCheck("IsFoldableBy(" + RootName + ".Val, " + ParentName + + ".Val)"); } } -- 2.34.1