Question on GlobalISel Intermediate invariants

Hello,

I just started using the GlobalISel framework.

Is there a way to emit all intermediate invariants from IRTranslator to Instrution-Selection in a single instruction? It will be really handy. I mean something like ‘-save-temps’ in clang.

Best regards,

Kumail Ahmed

Hi Kumail,

I'm not aware of a clang option to dump out IR between specific passes.
I think the one way to do it is to let clang generate llvm-ir, and feed that into llc, and let llc print out the IR after the pass you're interested in, e.g.:
clang t.c -o- -S -emit-llvm | llc -global-isel -print-after=irtranslator

If you want to see how the IR evolves after each pass, you can use the llc command line option -print-after-all.

Is this what you were looking for?

Thanks,

Kristof

Hi,

There's also -print-machineinstrs which prints the MIR between each backend pass.

I'm not aware of a clang option to dump out IR between specific passes.

You can pass options to the backend using -mllvm followed by the backend option. For example:
   clang -S hello.cpp -mllvm -print-after-all

Hi Kristof and Daniel,

Thank you for your help. This is exactly what I was looking for. :slight_smile:

Best Regards,

Kumail Ahmed