compiler: Don't generate unused functions

Add a FindUsedFunctions pass to the planner that discards unused
functions. This is useful to clean up Scheme procedures that are never
directly invoked due to inlining. This is fairly common with
(case-lambda) procedures