This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -175,10 +175,37 @@ fn compile_fn<'tcx>(
175175 ) ;
176176 } ) ;
177177
178+ #[ cfg( any( ) ) ] // This is never true
179+ let _clif_guard = {
180+ use std:: fmt:: Write ;
181+
182+ let func_clone = context. func . clone ( ) ;
183+ let clif_comments_clone = clif_comments. clone ( ) ;
184+ let mut clif = String :: new ( ) ;
185+ for flag in module. isa ( ) . flags ( ) . iter ( ) {
186+ writeln ! ( clif, "set {}" , flag) . unwrap ( ) ;
187+ }
188+ write ! ( clif, "target {}" , module. isa( ) . triple( ) . architecture. to_string( ) ) . unwrap ( ) ;
189+ for isa_flag in module. isa ( ) . isa_flags ( ) . iter ( ) {
190+ write ! ( clif, " {}" , isa_flag) . unwrap ( ) ;
191+ }
192+ writeln ! ( clif, "\n " ) . unwrap ( ) ;
193+ crate :: PrintOnPanic ( move || {
194+ let mut clif = clif. clone ( ) ;
195+ :: cranelift_codegen:: write:: decorate_function (
196+ & mut & clif_comments_clone,
197+ & mut clif,
198+ & func_clone,
199+ )
200+ . unwrap ( ) ;
201+ clif
202+ } )
203+ } ;
204+
178205 // Define function
179206 tcx. sess . time ( "define function" , || {
180207 context. want_disasm = crate :: pretty_clif:: should_write_ir ( tcx) ;
181- module. define_function ( func_id, context) . unwrap ( )
208+ module. define_function ( func_id, context) . unwrap ( ) ;
182209 } ) ;
183210
184211 // Write optimized function to file for debugging
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ use rustc_session::config::OutputType;
6666
6767use crate :: prelude:: * ;
6868
69- #[ derive( Debug ) ]
69+ #[ derive( Clone , Debug ) ]
7070pub ( crate ) struct CommentWriter {
7171 enabled : bool ,
7272 global_comments : Vec < String > ,
@@ -237,6 +237,7 @@ pub(crate) fn write_clif_file<'tcx>(
237237 func : & cranelift_codegen:: ir:: Function ,
238238 mut clif_comments : & CommentWriter ,
239239) {
240+ // FIXME work around filename too long errors
240241 write_ir_file (
241242 tcx,
242243 || format ! ( "{}.{}.clif" , tcx. symbol_name( instance) . name, postfix) ,
You can’t perform that action at this time.
0 commit comments