7.7.2.8. Module axivion.ir.common.expressions.casts

Functions

c_style_casts(ir_graph)

Yields C-style casts in the IR.

strip_casts(node)

Look through casts: if given a PIR cast node, returns its operand.

strip_casts_upwards(node)

Look through casts: if given a PIR cast node, returns its parent.

unpack_implicit_conversion(node)

Given a PIR Implicit_Conversion, returns its operand.

unpack_implicit_conversion_upwards(node)

Given a PIR Implicit_Conversion, returns its parent.

c_style_casts

casts.c_style_casts()

Yields C-style casts in the IR. This returns all PIR Conversion nodes that were using C cast syntax.

Parameters:

ir_graph (axivion.ir.Graph)

Return type:

typing.Iterable[C_Cast]

strip_casts

casts.strip_casts()

Look through casts: if given a PIR cast node, returns its operand. This is applied recursively: this function returns the first nested operand that is not a cast node.

Parameters:

node (typing.Union[Expression, axivion.ir.NoNode[Expression]])

Return type:

typing.Union[Expression, axivion.ir.NoNode[Expression]]

strip_casts_upwards

casts.strip_casts_upwards()

Look through casts: if given a PIR cast node, returns its parent. This is applied recursively: this function returns the first ancestor that is not a cast node.

Parameters:

node (typing.Union[Physical_IR_Root, axivion.ir.NoNode[Physical_IR_Root]])

Return type:

typing.Union[Physical_IR_Root, axivion.ir.NoNode[Physical_IR_Root]]

unpack_implicit_conversion

casts.unpack_implicit_conversion()

Given a PIR Implicit_Conversion, returns its operand. Otherwise, returns the node itself. This is the same as strip_casts(), but only applies to implicit conversions inserted by the compiler.

Parameters:

node (typing.Union[Expression, axivion.ir.NoNode[Expression]])

Return type:

typing.Union[Expression, axivion.ir.NoNode[Expression]]

unpack_implicit_conversion_upwards

casts.unpack_implicit_conversion_upwards()

Given a PIR Implicit_Conversion, returns its parent. Otherwise, returns the node itself. This is the same as strip_casts_upwards(), but only applies to implicit conversions inserted by the compiler.

Parameters:

node (typing.Union[Physical_IR_Root, axivion.ir.NoNode[Physical_IR_Root]])

Return type:

typing.Union[Physical_IR_Root, axivion.ir.NoNode[Physical_IR_Root]]