Memory Consumption and Execution Time static Statistics in LLVM. Can llvm-mca help?

I am PhD student. My work deals with finding the memory (RAM) consumption as indicated by linux RSS output and execution time as indicated by linux time command at compile time using LLVM. How can I do this? Like if i pass dataset size and application to llvm compiler, it should tell the estimated memory consumption and time taken to execute given application with given dataset, but all at compile time? I am trying to avoid profiling here. I wont get accurate values, hence rough estimated values of memory consumption and time are enough…

Can llvm-mca help me in finding these statistics? or I need to write a new compiler analysis pass to find these values?

Please help how to proceed.

Thank You


It seems that you are asking whether LLVM can provide a time- and memory-complexity analysis of the source code, and then estimate how a specific given dataset would be handled by that source code.

It’s not the kind of thing that compilers do, and I cannot imagine that LLVM has any way to provide this analysis. The compiler’s task is to create a semantically equivalent transformation of the source code into machine code, it has no need to understand the algorithmic complexity of the input source code.

I don’t claim intimate knowledge of llvm-mca, but my understanding is that it looks at relatively small fragments of the compiled code; I’m not aware that it really understands control-flow, and it certainly has no understanding of memory consumption.

Best regards,