|
7 | 7 | #include "../shady/rewrite.h" |
8 | 8 | #include "../shady/type.h" |
9 | 9 | #include "../shady/ir_private.h" |
10 | | -#include "../shady/analysis/scope.h" |
| 10 | +#include "../shady/analysis/cfg.h" |
11 | 11 |
|
12 | 12 | typedef struct { |
13 | 13 | Rewriter rewriter; |
14 | 14 | const CompilerConfig* config; |
15 | 15 | Parser* p; |
16 | | - Scope* curr_scope; |
| 16 | + CFG* cfg; |
17 | 17 | const Node* old_fn_or_bb; |
18 | 18 | struct Dict* controls; |
19 | 19 | } Context; |
@@ -127,7 +127,7 @@ static const Node* process_op(Context* ctx, NodeClass op_class, String op_name, |
127 | 127 | } |
128 | 128 | case Function_TAG: { |
129 | 129 | Context fn_ctx = *ctx; |
130 | | - fn_ctx.curr_scope = new_scope(node); |
| 130 | + fn_ctx.cfg = build_fn_cfg(node); |
131 | 131 | fn_ctx.old_fn_or_bb = node; |
132 | 132 | Controls controls; |
133 | 133 | initialize_controls(ctx, &controls, node); |
@@ -165,7 +165,7 @@ static const Node* process_op(Context* ctx, NodeClass op_class, String op_name, |
165 | 165 | }); |
166 | 166 | } else |
167 | 167 | decl->payload.fun.body = rewrite_node(&fn_ctx.rewriter, node->payload.fun.body); |
168 | | - destroy_scope(fn_ctx.curr_scope); |
| 168 | + destroy_cfg(fn_ctx.cfg); |
169 | 169 | return decl; |
170 | 170 | } |
171 | 171 | case BasicBlock_TAG: { |
@@ -198,9 +198,9 @@ static const Node* process_op(Context* ctx, NodeClass op_class, String op_name, |
198 | 198 | } else if (lexical_scope_is_nested(*src_lexical_scope, *dst_lexical_scope)) { |
199 | 199 | debug_print("Jump from %s to %s exits one or more nested lexical scopes, it might reconverge.\n", get_abstraction_name(src), get_abstraction_name(dst)); |
200 | 200 |
|
201 | | - CFNode* src_cfnode = scope_lookup(ctx->curr_scope, src); |
| 201 | + CFNode* src_cfnode = cfg_lookup(ctx->cfg, src); |
202 | 202 | assert(src_cfnode->node); |
203 | | - CFNode* target_cfnode = scope_lookup(ctx->curr_scope, dst); |
| 203 | + CFNode* target_cfnode = cfg_lookup(ctx->cfg, dst); |
204 | 204 | assert(src_cfnode && target_cfnode); |
205 | 205 | CFNode* dom = src_cfnode->idom; |
206 | 206 | while (dom) { |
|
0 commit comments