From 975651ab98c16bbea05fa5357738056aa3c28818 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Wed, 13 Dec 2006 20:52:00 +0000 Subject: Add getTypeToExpandTo() which recursively walks TransformToType to determine the intrinsic type to expand to. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32558 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Target/TargetLowering.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'include/llvm/Target') diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index c46995e..f3f4eda 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -176,6 +176,26 @@ public: return TransformToType[VT]; } + /// getTypeToExpandTo - For types supported by the target, this is an + /// identity function. For types that must be expanded (i.e. integer types + /// that are larger than the largest integer register or illegal floating + /// point types), this returns the largest legal type it will be expanded to. + MVT::ValueType getTypeToExpandTo(MVT::ValueType VT) const { + while (true) { + switch (getTypeAction(VT)) { + case Legal: + return VT; + case Expand: + VT = TransformToType[VT]; + break; + default: + assert(false && "Type is not legal nor is it to be expanded!"); + return VT; + } + } + return VT; + } + /// getPackedTypeBreakdown - Packed types are broken down into some number of /// legal first class types. For example, <8 x float> maps to 2 MVT::v4f32 /// with Altivec or SSE1, or 8 promoted MVT::f64 values with the X86 FP stack. -- cgit v1.1