[llvm-commits] [llvm] r166751 - in /llvm/trunk: include/llvm/Target/TargetTransformImpl.h include/llvm/TargetTransformInfo.h lib/Target/TargetTransformImpl.cpp
Hal Finkel
hfinkel at anl.gov
Thu Oct 25 21:28:02 PDT 2012
Author: hfinkel
Date: Thu Oct 25 23:28:02 2012
New Revision: 166751
URL: http://llvm.org/viewvc/llvm-project?rev=166751&view=rev
Log:
Add VectorTargetTransform::getNumberOfParts.
As discussed on IRC, add VectorTargetTransform::getNumberOfParts
to provide a stable interface to the vector legalization splitting factor.
Modified:
llvm/trunk/include/llvm/Target/TargetTransformImpl.h
llvm/trunk/include/llvm/TargetTransformInfo.h
llvm/trunk/lib/Target/TargetTransformImpl.cpp
Modified: llvm/trunk/include/llvm/Target/TargetTransformImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetTransformImpl.h?rev=166751&r1=166750&r2=166751&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetTransformImpl.h (original)
+++ llvm/trunk/include/llvm/Target/TargetTransformImpl.h Thu Oct 25 23:28:02 2012
@@ -68,6 +68,8 @@
virtual unsigned getMemoryOpCost(unsigned Opcode, Type *Src,
unsigned Alignment,
unsigned AddressSpace) const;
+
+ virtual unsigned getNumberOfParts(Type *Tp) const;
};
} // end llvm namespace
Modified: llvm/trunk/include/llvm/TargetTransformInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TargetTransformInfo.h?rev=166751&r1=166750&r2=166751&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TargetTransformInfo.h (original)
+++ llvm/trunk/include/llvm/TargetTransformInfo.h Thu Oct 25 23:28:02 2012
@@ -156,6 +156,11 @@
return 1;
}
+ /// Returns the number of pieces into which the provided type must be
+ /// split during legalization. Zero is returned when the answer is unknown.
+ virtual unsigned getNumberOfParts(Type *Tp) const {
+ return 0;
+ }
};
} // End llvm namespace
Modified: llvm/trunk/lib/Target/TargetTransformImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetTransformImpl.cpp?rev=166751&r1=166750&r2=166751&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetTransformImpl.cpp (original)
+++ llvm/trunk/lib/Target/TargetTransformImpl.cpp Thu Oct 25 23:28:02 2012
@@ -196,3 +196,11 @@
// Assume that all loads of legal types cost 1.
return LT.first;
}
+
+unsigned
+VectorTargetTransformImpl::getNumberOfParts(Type *Tp) const {
+ std::pair<unsigned, EVT> LT =
+ getTypeLegalizationCost(Tp->getContext(), TLI->getValueType(Tp));
+ return LT.first;
+}
+
More information about the llvm-commits
mailing list