use crate::prelude::*;
-#[derive(Debug)]
+#[derive(Clone, Debug)]
pub(crate) struct CommentWriter {
enabled: bool,
global_comments: Vec<String>,
postfix: &str,
isa: &dyn cranelift_codegen::isa::TargetIsa,
instance: Instance<'tcx>,
- context: &cranelift_codegen::Context,
+ func: &cranelift_codegen::ir::Function,
mut clif_comments: &CommentWriter,
) {
+ // FIXME work around filename too long errors
write_ir_file(
tcx,
|| format!("{}.{}.clif", tcx.symbol_name(instance).name, postfix),
|file| {
let mut clif = String::new();
- cranelift_codegen::write::decorate_function(
- &mut clif_comments,
- &mut clif,
- &context.func,
- )
- .unwrap();
+ cranelift_codegen::write::decorate_function(&mut clif_comments, &mut clif, func)
+ .unwrap();
for flag in isa.flags().iter() {
writeln!(file, "set {}", flag)?;