diff options
author | Cameron Zwarich <zwarich@apple.com> | 2011-03-16 00:13:28 +0000 |
---|---|---|
committer | Cameron Zwarich <zwarich@apple.com> | 2011-03-16 00:13:28 +0000 |
commit | 82bae7dafcada8c30df26befc724f625198666c0 (patch) | |
tree | d2db01a4cc06f7f8c505879158e56f183513e07a /include | |
parent | 276f6f9cf978fa7074687eead10a6db96c5afa6d (diff) | |
download | llvm-82bae7dafcada8c30df26befc724f625198666c0.tar.gz llvm-82bae7dafcada8c30df26befc724f625198666c0.tar.bz2 llvm-82bae7dafcada8c30df26befc724f625198666c0.tar.xz |
Add TargetData::fitsInLegalInteger().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127714 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Target/TargetData.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h index 25065d30bb..32e3e2b0b6 100644 --- a/include/llvm/Target/TargetData.h +++ b/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 |