@@ -144,9 +144,11 @@ impl ArchMips {
144144
145145 fn instruction_display_flags (
146146 & self ,
147- _diff_config : & DiffObjConfig ,
147+ diff_config : & DiffObjConfig ,
148148 ) -> rabbitizer:: InstructionDisplayFlags {
149- rabbitizer:: InstructionDisplayFlags :: default ( ) . with_unknown_instr_comment ( false )
149+ rabbitizer:: InstructionDisplayFlags :: default ( )
150+ . with_unknown_instr_comment ( false )
151+ . with_use_dollar ( diff_config. mips_register_prefix )
150152 }
151153
152154 fn parse_ins_ref (
@@ -207,7 +209,6 @@ impl Arch for ArchMips {
207209 function_range,
208210 resolved. section_index ,
209211 & display_flags,
210- diff_config,
211212 cb,
212213 ) ?;
213214 Ok ( ( ) )
@@ -301,7 +302,6 @@ fn push_args(
301302 function_range : Range < u64 > ,
302303 section_index : usize ,
303304 display_flags : & rabbitizer:: InstructionDisplayFlags ,
304- diff_config : & DiffObjConfig ,
305305 mut arg_cb : impl FnMut ( InstructionPart ) -> Result < ( ) > ,
306306) -> Result < ( ) > {
307307 let operands = instruction. valued_operands_iter ( ) ;
@@ -361,14 +361,11 @@ fn push_args(
361361 } ) ) ) ?;
362362 }
363363 arg_cb ( InstructionPart :: basic ( "(" ) ) ?;
364- let mut value =
365- base. either_name ( instruction. flags ( ) . abi ( ) , display_flags. named_gpr ( ) ) ;
366- if !diff_config. mips_register_prefix {
367- if let Some ( trimmed) = value. strip_prefix ( '$' ) {
368- value = trimmed;
369- }
370- }
371- arg_cb ( InstructionPart :: opaque ( value) ) ?;
364+ arg_cb ( InstructionPart :: opaque ( base. either_name (
365+ instruction. flags ( ) . abi ( ) ,
366+ display_flags. named_gpr ( ) ,
367+ !display_flags. use_dollar ( ) ,
368+ ) ) ) ?;
372369 arg_cb ( InstructionPart :: basic ( ")" ) ) ?;
373370 }
374371 // ValuedOperand::r5900_immediate15(..) => match relocation {
@@ -382,14 +379,9 @@ fn push_args(
382379 // }
383380 // },
384381 _ => {
385- let value = op. display ( instruction, display_flags, None :: < & str > ) . to_string ( ) ;
386- if !diff_config. mips_register_prefix {
387- if let Some ( value) = value. strip_prefix ( '$' ) {
388- arg_cb ( InstructionPart :: opaque ( value) ) ?;
389- continue ;
390- }
391- }
392- arg_cb ( InstructionPart :: opaque ( value) ) ?;
382+ arg_cb ( InstructionPart :: opaque (
383+ op. display ( instruction, display_flags, None :: < & str > ) . to_string ( ) ,
384+ ) ) ?;
393385 }
394386 }
395387 }
0 commit comments