|
22 | 22 |
|
23 | 23 | function cthulhu_llvm(io::IO, mi, optimize::Bool, debuginfo, world::UInt, |
24 | 24 | config::CthulhuConfig, dump_module::Bool=false, raw::Bool=false) |
25 | | - dump = @static if VERSION ≥ v"1.10.0-DEV.1386" |
26 | | - InteractiveUtils._dump_function_llvm( |
27 | | - mi, world, |
28 | | - #=wrapper=# false, !raw, |
29 | | - dump_module, optimize, debuginfo != DInfo.none ? :source : :none, |
30 | | - Base.CodegenParams()) |
31 | | - else |
32 | | - InteractiveUtils._dump_function_linfo_llvm( |
33 | | - mi, world, |
34 | | - #=wrapper=# false, #=strip_ir_metadata=# true, |
35 | | - dump_module, optimize, debuginfo != DInfo.none ? :source : :none, |
36 | | - Base.CodegenParams()) |
37 | | - end |
| 25 | + dump = InteractiveUtils._dump_function_llvm( |
| 26 | + mi, world, |
| 27 | + #=wrapper=# false, !raw, |
| 28 | + dump_module, optimize, debuginfo != DInfo.none ? :source : :none, |
| 29 | + Base.CodegenParams()) |
38 | 30 | highlight(io, dump, "llvm", config) |
39 | 31 | end |
40 | 32 |
|
41 | 33 | function cthulhu_native(io::IO, mi, ::Bool, debuginfo, world::UInt, |
42 | 34 | config::CthulhuConfig, dump_module::Bool=false, raw::Bool=false) |
43 | | - dump = @static if VERSION ≥ v"1.10.0-DEV.1386" |
44 | | - if dump_module |
45 | | - InteractiveUtils._dump_function_native_assembly( |
46 | | - mi, world, |
47 | | - #=wrapper=# false, #=syntax=# config.asm_syntax, |
48 | | - debuginfo != DInfo.none ? :source : :none, |
49 | | - #=binary=# false, raw, |
50 | | - Base.CodegenParams()) |
51 | | - else |
52 | | - InteractiveUtils._dump_function_native_disassembly( |
53 | | - mi, world, |
54 | | - #=wrapper=# false, #=syntax=# config.asm_syntax, |
55 | | - debuginfo != DInfo.none ? :source : :none, |
56 | | - #=binary=# false) |
57 | | - end |
| 35 | + if dump_module |
| 36 | + dump = InteractiveUtils._dump_function_native_assembly( |
| 37 | + mi, world, |
| 38 | + #=wrapper=# false, #=syntax=# config.asm_syntax, |
| 39 | + debuginfo != DInfo.none ? :source : :none, |
| 40 | + #=binary=# false, raw, |
| 41 | + Base.CodegenParams()) |
58 | 42 | else |
59 | | - InteractiveUtils._dump_function_linfo_native( |
| 43 | + dump = InteractiveUtils._dump_function_native_disassembly( |
60 | 44 | mi, world, |
61 | 45 | #=wrapper=# false, #=syntax=# config.asm_syntax, |
62 | 46 | debuginfo != DInfo.none ? :source : :none, |
@@ -221,10 +205,11 @@ function cthulhu_typed(io::IO, debuginfo::Symbol, |
221 | 205 | end |
222 | 206 | cst = Vector{Int}(undef, length(code)) |
223 | 207 | params = CC.OptimizationParams(interp) |
| 208 | + sparams = CC.VarState[CC.VarState(sparam, false) for sparam in mi.sparam_vals] |
224 | 209 | @static if VERSION ≥ v"1.11.0-DEV.32" |
225 | | - CC.statement_costs!(cst, code, src, sptypes(mi.sparam_vals), params) |
| 210 | + CC.statement_costs!(cst, code, src, sparams, params) |
226 | 211 | else |
227 | | - CC.statement_costs!(cst, code, src, sptypes(mi.sparam_vals), false, params) |
| 212 | + CC.statement_costs!(cst, code, src, sparams, false, params) |
228 | 213 | end |
229 | 214 | total_cost = sum(cst) |
230 | 215 | nd = ndigits(total_cost) |
@@ -386,13 +371,6 @@ function add_callsites!(d::AbstractDict, visited_mis::AbstractSet, diagnostics:: |
386 | 371 | end |
387 | 372 | end |
388 | 373 |
|
389 | | -@static if VERSION >= v"1.10.0-DEV.552" |
390 | | - using Core.Compiler: VarState |
391 | | - sptypes(sparams) = VarState[VarState.(sparams, false)...] |
392 | | -else |
393 | | - sptypes(sparams) = Any[sparams...] |
394 | | -end |
395 | | - |
396 | 374 | function show_variables(io, src, slotnames) |
397 | 375 | println(io, "Variables") |
398 | 376 | slottypes = src.slottypes |
@@ -465,12 +443,7 @@ function InteractiveUtils.code_typed(b::Bookmark; optimize::Bool=true) |
465 | 443 | (; src, rt, codeinf) = lookup(interp, mi, optimize) |
466 | 444 | src = preprocess_ci!(src, mi, optimize, CONFIG) |
467 | 445 | if src isa IRCode |
468 | | - @static if VERSION ≥ v"1.10.0-DEV.870" |
469 | | - CC.replace_code_newstyle!(codeinf, src) |
470 | | - else |
471 | | - nargs = Int((mi.def::Method).nargs) - 1 |
472 | | - CC.replace_code_newstyle!(codeinf, src, nargs) |
473 | | - end |
| 446 | + CC.replace_code_newstyle!(codeinf, src) |
474 | 447 | end |
475 | 448 | return codeinf => rt |
476 | 449 | end |
|
0 commit comments