mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-27 04:18:42 +00:00
Add completely hokey binary-and and binary-or operations to ConstantRange and
teach LazyValueInfo to use them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113196 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
1 parent
2b6c01b40b
commit
198381e542
3 files changed
+40
No files matched your search
@@ -607,6 +607,32 @@ ConstantRange::udiv(const ConstantRange &RHS) const {
|
||||
return ConstantRange(Lower, Upper);
|
||||
}
|
||||
|
||||
ConstantRange
|
||||
ConstantRange::binaryAnd(const ConstantRange &Other) const {
|
||||
if (isEmptySet() || Other.isEmptySet())
|
||||
return ConstantRange(getBitWidth(), /*isFullSet=*/false);
|
||||
|
||||
// TODO: replace this with something less conservative
|
||||
|
||||
APInt umin = APIntOps::umin(Other.getUnsignedMax(), getUnsignedMax());
|
||||
if (umin.isAllOnesValue())
|
||||
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
|
||||
return ConstantRange(APInt::getNullValue(getBitWidth()), umin + 1);
|
||||
}
|
||||
|
||||
ConstantRange
|
||||
ConstantRange::binaryOr(const ConstantRange &Other) const {
|
||||
if (isEmptySet() || Other.isEmptySet())
|
||||
return ConstantRange(getBitWidth(), /*isFullSet=*/false);
|
||||
|
||||
// TODO: replace this with something less conservative
|
||||
|
||||
APInt umax = APIntOps::umax(getUnsignedMin(), Other.getUnsignedMin());
|
||||
if (umax.isMinValue())
|
||||
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
|
||||
return ConstantRange(umax, APInt::getNullValue(getBitWidth()));
|
||||
}
|
||||
|
||||
ConstantRange
|
||||
ConstantRange::shl(const ConstantRange &Other) const {
|
||||
if (isEmptySet() || Other.isEmptySet())
|
||||
|
||||
Reference in new issue
Block a user