[llvm-commits] [llvm] r127714 - /llvm/trunk/include/llvm/Target/TargetData.h

Cameron Zwarich zwarich at apple.com
Tue Mar 15 17:13:28 PDT 2011


Author: zwarich
Date: Tue Mar 15 19:13:28 2011
New Revision: 127714

URL: http://llvm.org/viewvc/llvm-project?rev=127714&view=rev
Log:
Add TargetData::fitsInLegalInteger().

Modified:
    llvm/trunk/include/llvm/Target/TargetData.h

Modified: llvm/trunk/include/llvm/Target/TargetData.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=127714&r1=127713&r2=127714&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetData.h (original)
+++ llvm/trunk/include/llvm/Target/TargetData.h Tue Mar 15 19:13:28 2011
@@ -160,7 +160,18 @@
   bool isIllegalInteger(unsigned Width) const {
     return !isLegalInteger(Width);
   }
-  
+
+  /// fitsInLegalInteger - This function returns true if the specified type fits
+  /// in a native integer type supported by the CPU.  For example, if the CPU
+  /// only supports i32 as a native integer type, then i27 fits in a legal
+  // integer type but i45 does not.
+  bool fitsInLegalInteger(unsigned Width) const {
+    for (unsigned i = 0, e = (unsigned)LegalIntWidths.size(); i != e; ++i)
+      if (Width <= LegalIntWidths[i])
+        return true;
+    return false;
+  }
+
   /// Target pointer alignment
   unsigned getPointerABIAlignment() const { return PointerABIAlign; }
   /// Return target's alignment for stack-based pointers





More information about the llvm-commits mailing list