Skip to content

Commit 5f6c59e

Browse files
committed
Pass only the Function to write_clif_file
1 parent f3b2d37 commit 5f6c59e

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/base.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,19 @@ pub(crate) fn codegen_fn<'tcx>(
105105

106106
fx.constants_cx.finalize(fx.tcx, &mut *fx.module);
107107

108-
// Store function in context
109-
let context = &mut cx.cached_context;
110-
context.func = func;
111-
112108
crate::pretty_clif::write_clif_file(
113109
tcx,
114110
"unopt",
115111
module.isa(),
116112
instance,
117-
&context,
113+
&func,
118114
&clif_comments,
119115
);
120116

117+
// Store function in context
118+
let context = &mut cx.cached_context;
119+
context.func = func;
120+
121121
// Verify function
122122
verify_func(tcx, &clif_comments, &context.func);
123123

@@ -156,7 +156,7 @@ pub(crate) fn codegen_fn<'tcx>(
156156
"opt",
157157
module.isa(),
158158
instance,
159-
&context,
159+
&context.func,
160160
&clif_comments,
161161
);
162162

src/optimize/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ pub(crate) fn optimize_function<'tcx>(
1515
) {
1616
// FIXME classify optimizations over opt levels once we have more
1717

18-
crate::pretty_clif::write_clif_file(tcx, "preopt", isa, instance, &ctx, &*clif_comments);
18+
crate::pretty_clif::write_clif_file(tcx, "preopt", isa, instance, &ctx.func, &*clif_comments);
1919
crate::base::verify_func(tcx, &*clif_comments, &ctx.func);
2020
}

src/pretty_clif.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ pub(crate) fn write_clif_file<'tcx>(
234234
postfix: &str,
235235
isa: &dyn cranelift_codegen::isa::TargetIsa,
236236
instance: Instance<'tcx>,
237-
context: &cranelift_codegen::Context,
237+
func: &cranelift_codegen::ir::Function,
238238
mut clif_comments: &CommentWriter,
239239
) {
240240
write_ir_file(
@@ -245,7 +245,7 @@ pub(crate) fn write_clif_file<'tcx>(
245245
cranelift_codegen::write::decorate_function(
246246
&mut clif_comments,
247247
&mut clif,
248-
&context.func,
248+
func,
249249
)
250250
.unwrap();
251251

0 commit comments

Comments
 (0)