Save the date! Google I/O returns May 18-20 Register now


Iterates over all intrinsic bodies, inlining the intrinsics in comp.

This function operates on the AST level; meaning, it takes in a building_blocks.ComputationBuildingBlock as an argument and returns one as well. replace_intrinsics_with_bodies is intended to be the standard reduction function, which will reduce all currently implemented intrinsics to their bodies.

Notice that the success of this function depends on the contract of intrinsic_bodies.get_intrinsic_bodies, that the dict returned by that function is ordered from more complex intrinsic to less complex intrinsics.

comp Instance of building_blocks.ComputationBuildingBlock in which we wish to replace all intrinsics with their bodies.
context_stack Instance of context_stack_base.ContextStack, the context stack to use for the bodies of the intrinsics.

Instance of building_blocks.ComputationBuildingBlock with all the intrinsics from inlined with their bodies, along with a Boolean indicating whether there was any inlining in fact done.

TypeError If the types don't match.