@@ -76,8 +76,8 @@ impl<'tree> Compiler<'tree> {
76
76
let ptr = Pointer :: Register ( IntRegister :: Fp , offset) ;
77
77
78
78
match size {
79
- Size :: Byte => self . insert_w_comment ( Instruction :: Sb ( reg, ptr) , comment) ,
80
- Size :: Dword => self . insert_w_comment ( Instruction :: Sd ( reg, ptr) , comment) ,
79
+ Size :: Byte => self . insert_with_comment ( Instruction :: Sb ( reg, ptr) , comment) ,
80
+ Size :: Dword => self . insert_with_comment ( Instruction :: Sd ( reg, ptr) , comment) ,
81
81
}
82
82
}
83
83
Register :: Float ( reg) => self . insert ( Instruction :: Fsd (
@@ -114,11 +114,11 @@ impl<'tree> Compiler<'tree> {
114
114
115
115
// perform different load operations depending on the size
116
116
match size {
117
- Size :: Byte => self . insert_w_comment (
117
+ Size :: Byte => self . insert_with_comment (
118
118
Instruction :: Lb ( reg, Pointer :: Register ( IntRegister :: Fp , offset) ) ,
119
119
comment,
120
120
) ,
121
- Size :: Dword => self . insert_w_comment (
121
+ Size :: Dword => self . insert_with_comment (
122
122
Instruction :: Ld ( reg, Pointer :: Register ( IntRegister :: Fp , offset) ) ,
123
123
comment,
124
124
) ,
@@ -136,7 +136,7 @@ impl<'tree> Compiler<'tree> {
136
136
self . insert ( Instruction :: Fmv ( new_res_reg, FloatRegister :: Fa0 ) ) ;
137
137
}
138
138
139
- self . insert_w_comment (
139
+ self . insert_with_comment (
140
140
Instruction :: Fld ( reg, Pointer :: Register ( IntRegister :: Fp , offset) ) ,
141
141
comment,
142
142
) ;
@@ -268,17 +268,17 @@ impl<'tree> Compiler<'tree> {
268
268
match type_ {
269
269
Type :: Bool ( 0 ) | Type :: Char ( 0 ) => {
270
270
let dest_reg = self . get_int_reg ( ) ;
271
- self . insert_w_comment ( Instruction :: Lb ( dest_reg, ptr) , ident. into ( ) ) ;
271
+ self . insert_with_comment ( Instruction :: Lb ( dest_reg, ptr) , ident. into ( ) ) ;
272
272
Register :: Int ( dest_reg)
273
273
}
274
274
Type :: Float ( 0 ) => {
275
275
let dest_reg = self . get_float_reg ( ) ;
276
- self . insert_w_comment ( Instruction :: Fld ( dest_reg, ptr) , ident. into ( ) ) ;
276
+ self . insert_with_comment ( Instruction :: Fld ( dest_reg, ptr) , ident. into ( ) ) ;
277
277
Register :: Float ( dest_reg)
278
278
}
279
279
Type :: Int ( _) | Type :: Float ( _) | Type :: Bool ( _) | Type :: Char ( _) => {
280
280
let dest_reg = self . get_int_reg ( ) ;
281
- self . insert_w_comment ( Instruction :: Ld ( dest_reg, ptr) , ident. into ( ) ) ;
281
+ self . insert_with_comment ( Instruction :: Ld ( dest_reg, ptr) , ident. into ( ) ) ;
282
282
Register :: Int ( dest_reg)
283
283
}
284
284
Type :: Unit | Type :: Never | Type :: Unknown => {
@@ -293,7 +293,7 @@ impl<'tree> Compiler<'tree> {
293
293
// only insert a jump if the current block is not already terminated
294
294
if !self . curr_block ( ) . is_terminated {
295
295
match comment {
296
- Some ( comment) => self . insert_w_comment ( Instruction :: Jmp ( label) , comment) ,
296
+ Some ( comment) => self . insert_with_comment ( Instruction :: Jmp ( label) , comment) ,
297
297
None => self . insert ( Instruction :: Jmp ( label) ) ,
298
298
}
299
299
self . curr_block_mut ( ) . is_terminated = true ;
@@ -320,7 +320,7 @@ impl<'tree> Compiler<'tree> {
320
320
321
321
/// Inserts an [`Instruction`] at the end of the current basic block.
322
322
/// Also inserts the specified comment at the end of the instruction.
323
- pub ( crate ) fn insert_w_comment ( & mut self , instruction : Instruction , comment : Cow < ' tree , str > ) {
323
+ pub ( crate ) fn insert_with_comment ( & mut self , instruction : Instruction , comment : Cow < ' tree , str > ) {
324
324
self . blocks [ self . curr_block ]
325
325
. instructions
326
326
. push ( ( instruction, Some ( comment) ) ) ;
0 commit comments