Raise a warning/error when a procedure that is marked for inlining in the source code is (mutually-)recursive
As the title says.
This should be straightforward to detect--if a proc is in a cyclic SCC and is marked for inlining raise the appropriate error/warning.
Without this in place, the inlining pass, if we ever choose to reach a fixed point (can we ever with recursion?) will loop forever
Actually, it is possible to inline a mutually recursive proc. Suppose p calls q an q calls p. If you inline the call from p to q, you have a proc p that calls itself. There are cases like this in the test suite (where it infers that it should inline), and the optimiser handles it. Even if p also calls itself this is OK. It's only a problem if q also calls itself.
So there is still a need for a warning, but it's not as simple as just warning about marking a proc in a cyclic SCC for inlining, as I thought at first.
Inlining of tail recursive procs could be made to work if the inlining is done at the LLVM compilation level, rather than when optimising the LPVM. This would essentially turn a call to a recursive proc into an in-place loop in the caller. The LLVM compiler might just handle this for us if we mark the recursive calls as a tail call and mark the LLVM function for inlining. This could even work for mutual tail recursion, but it would not work for recursive but not tail recursive procs.