Add getTypeToExpandTo() which recursively walks TransformToType to determine
authorEvan Cheng <evan.cheng@apple.com>
Wed, 13 Dec 2006 20:52:00 +0000 (20:52 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Wed, 13 Dec 2006 20:52:00 +0000 (20:52 +0000)
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

index c46995e5d2e82900c1dd4c70e67151da2662c65f..f3f4eda3b6a73446b9d1bc569634b2b7ad8eb661 100644 (file)
@@ -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.