Next: , Previous: , Up: Optimizing Infix Binary Operators   [Index]


3.9.7.4 Left Zero Element Promotion

The zero (or absorbing) element is the element that with respect to a binary operation absorbs other elements when combined with them, i.e. the result of combining some element with the zero element is the zero element itself.

The optimization replaces the zero element combining operations (for which the identity element is the left operand) with the zero element.

The struct x1f4_1stscope_type operator definition extension is to include the X1f4_E4_LEFT_KILL bit in its bits1 bits list field. The remaining optimization parameters, including the description (value) of the identity element, are to be introduced via the struct x1f4_operator_type first extension, in a struct x1f4_rdbl_type definition. That is, the extension1 field of the struct x1f4_operator_type operator description must point a struct x1f4_1stscope_type record, whose rdbl_data field must point a struct x1f4_rdbl_type record, in turn describing the optimization parameters.

See struct x1f4_1stscope_type.

See struct x1f4_rdbl_type.

See struct x1f4_operator_type.

See Operator First Extension Scope Flags.

The zero element must be of one of the intrinsic scalar types (integer, real or cardinal).

See Intrinsic Types.

It may be of a defined value (zero for multiplication) or of any but a defined value (any but zero for logical OR).

The substituting value may coincide the tested value or may not. The substituting value is of the operator type, the tested zero element value is of the left operand type. Such, expressions like <integer zero> * <real> optimize as <real zero>.

It applies for such operators as the C binary ‘*’, ‘&’.

The optimization transforms expressions like:

0
0
~0
2 || e
4 || e
0 && e
0 << e

into:

0
0
~0
1
1
0
0

Next: Absorbing Right Unary, Previous: Right Zero Element Promotion, Up: Optimizing Infix Binary Operators   [Index]