Compute cached

I have a couple more things to do, but I think it is worth starting the review process on the new memoize scheduling directive.
Almost the same as the logic as in FindCalls.cpp. Might be nice to promote visit_function to a method in IRVisitor and use it in both places.