ValueRangePropagator

ValueRangePropagator to figure out if it is safe to truncate a value to make it fit in a smaller type.

It does so by computing the range of possible values the expression can take and checking if that range fit in a given type.

It is only specialized for uint and ulong, as smaller integral type are promoted before any computation to 32bits values and above. As a result, smaller types do not really matter as long as we promote them properly. As a result, ranges computed from improperly promoted expression may be extremely pessimistics.

Constructors

this
this(SemanticPass pass)
Undocumented in source.

Alias This

pass

Members

Aliases

VR
alias VR = ValueRange!T
Undocumented in source.

Functions

canFit
bool canFit(Expression e, Type t)
Undocumented in source.
canFit
bool canFit(Expression e, BuiltinType t)
Undocumented in source.
visit
VR visit(Expression e)
Undocumented in source.
visit
VR visit(BooleanLiteral e)
Undocumented in source. Be warned that the author may not have intended to support it.
visit
VR visit(IntegerLiteral e)
Undocumented in source. Be warned that the author may not have intended to support it.
visit
VR visit(BinaryExpression e)
Undocumented in source. Be warned that the author may not have intended to support it.
visit
VR visit(UnaryExpression e)
Undocumented in source. Be warned that the author may not have intended to support it.
visit
VR visit(VariableExpression e)
Undocumented in source. Be warned that the author may not have intended to support it.
visit
VR visit(Variable v)
Undocumented in source.
visit
VR visit(CastExpression e)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta