|
1 | | -const AnySSAValue = Union{Core.Compiler.SSAValue,JuliaInterpreter.SSAValue} |
2 | | -const AnySlotNumber = Union{Core.Compiler.SlotNumber,JuliaInterpreter.SlotNumber} |
| 1 | +const AnySSAValue = Union{Core.IR.SSAValue,JuliaInterpreter.SSAValue} |
| 2 | +const AnySlotNumber = Union{Core.IR.SlotNumber,JuliaInterpreter.SlotNumber} |
3 | 3 |
|
4 | 4 | # to circumvent https://github.com/JuliaLang/julia/issues/37342, we inline these `isa` |
5 | 5 | # condition checks at surface AST level |
6 | 6 | # https://github.com/JuliaLang/julia/pull/38905 will get rid of the need of these hacks |
7 | 7 | macro isssa(stmt) |
8 | | - :($(GlobalRef(Core, :isa))($(esc(stmt)), $(GlobalRef(Core.Compiler, :SSAValue))) || |
| 8 | + :($(GlobalRef(Core, :isa))($(esc(stmt)), $(GlobalRef(Core.IR, :SSAValue))) || |
9 | 9 | $(GlobalRef(Core, :isa))($(esc(stmt)), $(GlobalRef(JuliaInterpreter, :SSAValue)))) |
10 | 10 | end |
11 | 11 | macro issslotnum(stmt) |
12 | | - :($(GlobalRef(Core, :isa))($(esc(stmt)), $(GlobalRef(Core.Compiler, :SlotNumber))) || |
| 12 | + :($(GlobalRef(Core, :isa))($(esc(stmt)), $(GlobalRef(Core.IR, :SlotNumber))) || |
13 | 13 | $(GlobalRef(Core, :isa))($(esc(stmt)), $(GlobalRef(JuliaInterpreter, :SlotNumber)))) |
14 | 14 | end |
15 | 15 |
|
|
211 | 211 |
|
212 | 212 | showempty(list) = isempty(list) ? '∅' : list |
213 | 213 |
|
214 | | -# Smooth the transition between Core.Compiler and Base |
215 | | -rng(bb::Core.Compiler.BasicBlock) = (r = bb.stmts; return Core.Compiler.first(r):Core.Compiler.last(r)) |
| 214 | +# Smooth the transition between CC and Base (not requried for v1.12 and above) |
| 215 | +rng(bb::BasicBlock) = (r = bb.stmts; return CC.first(r):CC.last(r)) |
216 | 216 |
|
217 | 217 | function pushall!(dest, src) |
218 | 218 | for item in src |
|
224 | 224 | # computes strongly connected components of a control flow graph `cfg` |
225 | 225 | # NOTE adapted from https://github.com/JuliaGraphs/Graphs.jl/blob/5878e7be4d68b2a1c179d1367aea670db115ebb5/src/connectivity.jl#L265-L357 |
226 | 226 | # since to load an entire Graphs.jl is a bit cost-ineffective in terms of a trade-off of latency vs. maintainability |
227 | | -function strongly_connected_components(g::Core.Compiler.CFG) |
| 227 | +function strongly_connected_components(g::CFG) |
228 | 228 | T = Int |
229 | 229 | zero_t = zero(T) |
230 | 230 | one_t = one(T) |
@@ -322,12 +322,12 @@ function strongly_connected_components(g::Core.Compiler.CFG) |
322 | 322 | end |
323 | 323 |
|
324 | 324 | # compatibility with Graphs.jl interfaces |
325 | | -@inline nv(cfg::Core.Compiler.CFG) = length(cfg.blocks) |
326 | | -@inline vertices(cfg::Core.Compiler.CFG) = 1:nv(cfg) |
327 | | -@inline outneighbors(cfg::Core.Compiler.CFG, v) = cfg.blocks[v].succs |
| 325 | +@inline nv(cfg::CFG) = length(cfg.blocks) |
| 326 | +@inline vertices(cfg::CFG) = 1:nv(cfg) |
| 327 | +@inline outneighbors(cfg::CFG, v) = cfg.blocks[v].succs |
328 | 328 |
|
329 | 329 | # using Graphs: SimpleDiGraph, add_edge!, strongly_connected_components as oracle_scc |
330 | | -# function cfg_to_sdg(cfg::Core.Compiler.CFG) |
| 330 | +# function cfg_to_sdg(cfg::CFG) |
331 | 331 | # g = SimpleDiGraph(length(cfg.blocks)) |
332 | 332 | # for (v, block) in enumerate(cfg.blocks) |
333 | 333 | # for succ in block.succs |
|
0 commit comments