Hi all, first I wanna say thank you for everything you all do! LLVM has made possible my dream of creating my own programming language, and you all are a huge part of that.
My ultimate goal is to be able to measure the stack space needed for a function and all of its callees (excluding recursive calls and indirect function pointer calls), to know how much space I need to allocate for a virtual thread, as part of Vale’s concurrency plans.
This 2013 email thread says:
If you want something that includes stack-spill slots and the like, then you’d need to write a MachineFunctionPass and examine the generated machine instructions. Alternatively, there might be a way in a MachineFunctionPass to get a pointer to a MachineFrame object and to query its size.
However, this 2015 email thread says:
A MachineFunctionPass is run by the code generator, so you can only use
it in tools like llc, clang, and libLTO.
Does this mean that I can’t make a MachineFunctionPass and invoke it via a PassManager inside my compiler, after the optimization passes?
I was able to get a regular FunctionPass to run from inside my compiler this way (well, can’t anymore, some “typeinfo for llvm::FunctionPass” undefined symbols seem to be appearing now) but MachineFunctionPass never seemed to work.
Are we really not able to make a MachineFunctionPass inside a compiler?
Thank you so much!