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


3.9.7.3 Right 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 right operand) with the zero element.

The struct x1f4_1stscope_type operator definition extension is to include the X1f4_E4_POST_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_rdbo_type definition. That is, the extension1 field of the struct x1f4_operator_type operator description must point a struct x1f4_1stscope_type record, whose rdbo_data field must point a struct x1f4_rdbo_type record, in turn describing the optimization parameters.

See struct x1f4_1stscope_type.

See struct x1f4_rdbo_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 right operand type. Such, expressions like <real> * <integer zero> optimize as <real zero>.

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

The optimization transforms expressions like:

e * 0
e & 0
e | ~0
e || 2
e || 4
e && 0

into:

0
0
~0
1
1
0

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