codegen: Add llvm_options parameter to code_llvm for pass instrumentation (#60698)
Add the ability to pass LLVM pass manager options directly to
code_llvm() for debugging and analysis purposes. This allows users to
inspect IR at various stages of the optimization pipeline without
needing to set environment variables.
Supported options include:
- `-print-after-all`: Print IR after each pass
- `-print-before-all`: Print IR before each pass
- `-print-after=<passname>`: Print IR after a specific pass
- `-print-before=<passname>`: Print IR before a specific pass
- `-print-module-scope`: Print entire module instead of just the
function
- `-filter-print-funcs=<name>`: Filter output to specific functions
Example usage:
code_llvm(+, (Int, Int); llvm_options="-print-after=loop-vectorize")
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Dilum Aluthge <dilum@aluthge.com>