[LLVMdev] Identifying recursive functions in a backend

Anton Korobeynikov anton at korobeynikov.info
Wed Jan 13 10:26:43 PST 2010

Hello, Robert

> I was wondering if it was possible to detect if a function is recursive in a back-end. For instance, I'd like to be able to say: "If this function we are about to call is recursive, store the return address to the stack, if it isn't we don't need a stack so do nothing". Does anyone know if this is possible?
Well, in general - no. Think about the function which does an indirect call...

If you want some approximation - find all call sites in the function
and check the destinations.

With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University

More information about the llvm-dev mailing list