mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-29 10:25:12 +00:00
add zextOrTrunc and sextOrTrunc methods, that are similar to the ones in APInt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86549 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -492,6 +492,30 @@ ConstantRange ConstantRange::truncate(uint32_t DstTySize) const {
|
||||
return ConstantRange(L, U);
|
||||
}
|
||||
|
||||
/// zextOrTrunc - make this range have the bit width given by \p DstTySize. The
|
||||
/// value is zero extended, truncated, or left alone to make it that width.
|
||||
ConstantRange ConstantRange::zextOrTrunc(uint32_t DstTySize) const {
|
||||
unsigned SrcTySize = getBitWidth();
|
||||
if (SrcTySize > DstTySize)
|
||||
return truncate(DstTySize);
|
||||
else if (SrcTySize < DstTySize)
|
||||
return zeroExtend(DstTySize);
|
||||
else
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// sextOrTrunc - make this range have the bit width given by \p DstTySize. The
|
||||
/// value is sign extended, truncated, or left alone to make it that width.
|
||||
ConstantRange ConstantRange::sextOrTrunc(uint32_t DstTySize) const {
|
||||
unsigned SrcTySize = getBitWidth();
|
||||
if (SrcTySize > DstTySize)
|
||||
return truncate(DstTySize);
|
||||
else if (SrcTySize < DstTySize)
|
||||
return signExtend(DstTySize);
|
||||
else
|
||||
return *this;
|
||||
}
|
||||
|
||||
ConstantRange
|
||||
ConstantRange::add(const ConstantRange &Other) const {
|
||||
if (isEmptySet() || Other.isEmptySet())
|
||||
|
Reference in New Issue
Block a user