diff options
author | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2019-03-22 19:36:51 +0000 |
---|---|---|
committer | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2019-03-22 19:36:51 +0000 |
commit | 2f09ba541bf9dd177195ff4705f62146badcac94 (patch) | |
tree | df0524439c6fe03bec58fd5b6423134b261dad0a | |
parent | b6c4db9981ce8f8a9cec1e8608664c17ca099796 (diff) | |
download | bcm5719-llvm-2f09ba541bf9dd177195ff4705f62146badcac94.tar.gz bcm5719-llvm-2f09ba541bf9dd177195ff4705f62146badcac94.zip |
[KnownBits] Add const to some methods. NFC
Add "const" to the trunc, zext, sext and zextOrTrunc
methods to make it clear that they aren't updating
the object itself.
llvm-svn: 356797
-rw-r--r-- | llvm/include/llvm/Support/KnownBits.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/include/llvm/Support/KnownBits.h b/llvm/include/llvm/Support/KnownBits.h index 66c2129fe79..ed32cd2b576 100644 --- a/llvm/include/llvm/Support/KnownBits.h +++ b/llvm/include/llvm/Support/KnownBits.h @@ -109,7 +109,7 @@ public: /// Truncate the underlying known Zero and One bits. This is equivalent /// to truncating the value we're tracking. - KnownBits trunc(unsigned BitWidth) { + KnownBits trunc(unsigned BitWidth) const { return KnownBits(Zero.trunc(BitWidth), One.trunc(BitWidth)); } @@ -117,7 +117,7 @@ public: /// By setting ExtendedBitsAreKnownZero=true this will be equivalent to /// zero extending the value we're tracking. /// With ExtendedBitsAreKnownZero=false the extended bits are set to unknown. - KnownBits zext(unsigned BitWidth, bool ExtendedBitsAreKnownZero) { + KnownBits zext(unsigned BitWidth, bool ExtendedBitsAreKnownZero) const { unsigned OldBitWidth = getBitWidth(); APInt NewZero = Zero.zext(BitWidth); if (ExtendedBitsAreKnownZero) @@ -127,7 +127,7 @@ public: /// Sign extends the underlying known Zero and One bits. This is equivalent /// to sign extending the value we're tracking. - KnownBits sext(unsigned BitWidth) { + KnownBits sext(unsigned BitWidth) const { return KnownBits(Zero.sext(BitWidth), One.sext(BitWidth)); } @@ -135,7 +135,8 @@ public: /// extending the extended bits can either be set as known zero (if /// ExtendedBitsAreKnownZero=true) or as unknown (if /// ExtendedBitsAreKnownZero=false). - KnownBits zextOrTrunc(unsigned BitWidth, bool ExtendedBitsAreKnownZero) { + KnownBits zextOrTrunc(unsigned BitWidth, + bool ExtendedBitsAreKnownZero) const { if (BitWidth > getBitWidth()) return zext(BitWidth, ExtendedBitsAreKnownZero); return KnownBits(Zero.zextOrTrunc(BitWidth), One.zextOrTrunc(BitWidth)); |