Skip to content

Use Compiler.IRShow instead of Base.IRShow #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "LoweredCodeUtils"
uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b"
version = "3.4.0"
version = "3.4.1"
authors = ["Tim Holy <tim.holy@gmail.com>"]

[deps]
Expand Down
8 changes: 4 additions & 4 deletions src/codeedges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,16 @@ function print_with_code(preprint, postprint, io::IO, src::CodeInfo)
CC.EMPTY_SPTYPES
end
end
line_info_preprinter = Base.IRShow.lineinfo_disabled
line_info_postprinter = Base.IRShow.default_expr_type_printer
line_info_preprinter = IRShow.lineinfo_disabled
line_info_postprinter = IRShow.default_expr_type_printer
preprint(io)
bb_idx_prev = bb_idx = 1
for idx = 1:length(src.code)
preprint(io, idx)
@static if isdefined(Base, :__has_internal_change) && Base.__has_internal_change(v"1.12-alpha", :printcodeinfocalls)
bb_idx = Base.IRShow.show_ir_stmt(io, src, idx, line_info_preprinter, line_info_postprinter, sptypes, used, cfg, bb_idx)
bb_idx = IRShow.show_ir_stmt(io, src, idx, line_info_preprinter, line_info_postprinter, sptypes, used, cfg, bb_idx)
else
bb_idx = Base.IRShow.show_ir_stmt(io, src, idx, line_info_preprinter, line_info_postprinter, used, cfg, bb_idx)
bb_idx = IRShow.show_ir_stmt(io, src, idx, line_info_preprinter, line_info_postprinter, used, cfg, bb_idx)
end
postprint(io, idx, bb_idx != bb_idx_prev)
bb_idx_prev = bb_idx
Expand Down
7 changes: 7 additions & 0 deletions src/packagedef.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ using .CC:
BasicBlock, CFG,
compute_basic_blocks, construct_domtree, construct_postdomtree,
nearest_common_dominator, postdominates

@static if isdefined(CC, :IRShow)
using .CC: IRShow
else
using Base: IRShow
end
Comment on lines +14 to +18
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just use CC.IRShow now? CC.IRShow === Base.IRShow when CC === Base.Compiler.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought so as well, but AFAIK pre-1.11 (before making Compiler its own package) IRShow was defined in Base but not in Compiler.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Let's move as is then.


using Base.Meta: isexpr

const SSAValues = Union{Core.IR.SSAValue, JuliaInterpreter.SSAValue}
Expand Down
Loading