summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2011-03-16 00:13:28 +0000
committerCameron Zwarich <zwarich@apple.com>2011-03-16 00:13:28 +0000
commit51e76763c7083c3d8622c6cd73acddbd633b327a (patch)
tree8f3361c7590f4664687ac0e922e5b83ca8100105 /llvm/include
parentfe28f1bff906b9e9d6dfeaba9ad434671c6d9783 (diff)
downloadbcm5719-llvm-51e76763c7083c3d8622c6cd73acddbd633b327a.tar.gz
bcm5719-llvm-51e76763c7083c3d8622c6cd73acddbd633b327a.zip
Add TargetData::fitsInLegalInteger().
llvm-svn: 127714
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Target/TargetData.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/include/llvm/Target/TargetData.h b/llvm/include/llvm/Target/TargetData.h
index 25065d30bb6..32e3e2b0b61 100644
--- a/llvm/include/llvm/Target/TargetData.h
+++ b/llvm/include/llvm/Target/TargetData.h
@@ -160,7 +160,18 @@ public:
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
OpenPOWER on IntegriCloud