Strip bytecode for particular graph
It should be possible to strip the bytecode for a particular graph. Then a serialized expression can contain the stripped version of the bytecode.
The stripper can be implemented with the following pseudocode:
strip:
descs = (set of descriptors used in graph, given by graph_copy_with_names)
seen = (empty set)
while descs is not empty:
pick desc from descs
add desc to seen
add reachable descriptors from desc to descs unless in seen
return reachable code from labels in seen (most difficult here are the relocations)
reachable descriptors from desc:
all labels in instructions reachable from desc
reachable instructions from label:
all instructions until a rtn/jmp/etc.