From 61fc4cf7aa0b87ceab62082cee8ef5ce3f574ffc Mon Sep 17 00:00:00 2001 From: Bob Wilson Date: Tue, 11 Aug 2009 01:14:02 +0000 Subject: Add a new overloaded EVT::vAny type for use in TableGen to allow intrinsic arguments that are vectors of any size and element type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78631 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/CodeGenDAGPatterns.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'utils/TableGen/CodeGenDAGPatterns.cpp') diff --git a/utils/TableGen/CodeGenDAGPatterns.cpp b/utils/TableGen/CodeGenDAGPatterns.cpp index 05ede6cec6..af72b93fd3 100644 --- a/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/utils/TableGen/CodeGenDAGPatterns.cpp @@ -87,9 +87,16 @@ bool isExtIntegerInVTs(const std::vector &EVTs) { /// isExtFloatingPointInVTs - Return true if the specified extended value type /// vector contains isFP or a FP value type. bool isExtFloatingPointInVTs(const std::vector &EVTs) { - assert(!EVTs.empty() && "Cannot check for integer in empty ExtVT list!"); + assert(!EVTs.empty() && "Cannot check for FP in empty ExtVT list!"); return EVTs[0] == isFP || !(FilterEVTs(EVTs, isFloatingPoint).empty()); } + +/// isExtVectorInVTs - Return true if the specified extended value type +/// vector contains a vector value type. +bool isExtVectorInVTs(const std::vector &EVTs) { + assert(!EVTs.empty() && "Cannot check for vector in empty ExtVT list!"); + return !(FilterEVTs(EVTs, isVector).empty()); +} } // end namespace EEVT. } // end namespace llvm. @@ -495,6 +502,14 @@ bool TreePatternNode::UpdateNodeType(const std::vector &ExtVTs, setTypes(FVTs); return true; } + if (ExtVTs[0] == EVT::vAny && EEVT::isExtVectorInVTs(getExtTypes())) { + assert(hasTypeSet() && "should be handled above!"); + std::vector FVTs = FilterEVTs(getExtTypes(), isVector); + if (getExtTypes() == FVTs) + return false; + setTypes(FVTs); + return true; + } // If we know this is an int or fp type, and we are told it is a specific one, // take the advice. @@ -504,7 +519,9 @@ bool TreePatternNode::UpdateNodeType(const std::vector &ExtVTs, if (((getExtTypeNum(0) == EEVT::isInt || getExtTypeNum(0) == EVT::iAny) && EEVT::isExtIntegerInVTs(ExtVTs)) || ((getExtTypeNum(0) == EEVT::isFP || getExtTypeNum(0) == EVT::fAny) && - EEVT::isExtFloatingPointInVTs(ExtVTs))) { + EEVT::isExtFloatingPointInVTs(ExtVTs)) || + (getExtTypeNum(0) == EVT::vAny && + EEVT::isExtVectorInVTs(ExtVTs))) { setTypes(ExtVTs); return true; } -- cgit v1.2.3-18-g5258