From 9a15a3558e807df1fe941be0554baa20253938cf Mon Sep 17 00:00:00 2001 From: Simeon Schaub Date: Tue, 10 Aug 2021 13:09:54 +0200 Subject: [PATCH] [IRShow] expose index information to postprinter (#41828) I am experimenting with showing some other information besides just the types here as well and I think this would be generally useful. This passes that information as an `IOContext` as to not break any downstream uses of this code. (cherry picked from commit c2b4b382c11b5668cb9091138b1fa9178c47bff5) --- base/compiler/ssair/show.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/compiler/ssair/show.jl b/base/compiler/ssair/show.jl index 1f1c838c62ae7..a327de623bb09 100644 --- a/base/compiler/ssair/show.jl +++ b/base/compiler/ssair/show.jl @@ -628,7 +628,7 @@ function show_ir_stmt(io::IO, code::Union{IRCode, CodeInfo}, idx::Int, line_info if new_node_type === UNDEF # try to be robust against errors printstyled(io, "::#UNDEF", color=:red) elseif show_type - line_info_postprinter(io, new_node_type, node_idx in used) + line_info_postprinter(IOContext(io, :idx => node_idx), new_node_type, node_idx in used) end println(io) i += 1 @@ -643,7 +643,7 @@ function show_ir_stmt(io::IO, code::Union{IRCode, CodeInfo}, idx::Int, line_info # This is an error, but can happen if passes don't update their type information printstyled(io, "::#UNDEF", color=:red) elseif show_type - line_info_postprinter(io, type, idx in used) + line_info_postprinter(IOContext(io, :idx => idx), type, idx in used) end end println(io)