@@ -288,32 +288,6 @@ pub(crate) fn emit(
288
288
}
289
289
}
290
290
291
- Inst :: MovImmM { size, simm32, dst } => {
292
- let dst = & dst. finalize ( state. frame_layout ( ) , sink) . clone ( ) ;
293
- let default_rex = RexFlags :: clear_w ( ) ;
294
- let default_opcode = 0xC7 ;
295
- let bytes = size. to_bytes ( ) ;
296
- let prefix = LegacyPrefixes :: None ;
297
-
298
- let ( opcode, rex, size, prefix) = match * size {
299
- // In the 8-bit case, we don't need to enforce REX flags via
300
- // `always_emit_if_8bit_needed()` since the destination
301
- // operand is a memory operand, not a possibly 8-bit register.
302
- OperandSize :: Size8 => ( 0xC6 , default_rex, bytes, prefix) ,
303
- OperandSize :: Size16 => ( 0xC7 , default_rex, bytes, LegacyPrefixes :: _66) ,
304
- OperandSize :: Size64 => ( default_opcode, RexFlags :: from ( * size) , bytes, prefix) ,
305
-
306
- _ => ( default_opcode, default_rex, bytes, prefix) ,
307
- } ;
308
-
309
- // 8-bit C6 /0 ib
310
- // 16-bit 0x66 C7 /0 iw
311
- // 32-bit C7 /0 id
312
- // 64-bit REX.W C7 /0 id
313
- emit_std_enc_mem ( sink, prefix, opcode, 1 , /*subopcode*/ 0 , dst, rex, 0 ) ;
314
- emit_simm ( sink, size, * simm32 as u32 ) ;
315
- }
316
-
317
291
Inst :: MovRR { size, src, dst } => {
318
292
let src = src. to_reg ( ) ;
319
293
let dst = dst. to_reg ( ) . to_reg ( ) ;
@@ -429,32 +403,6 @@ pub(crate) fn emit(
429
403
} ;
430
404
}
431
405
432
- Inst :: MovRM { size, src, dst } => {
433
- let src = src. to_reg ( ) ;
434
- let dst = & dst. finalize ( state. frame_layout ( ) , sink) . clone ( ) ;
435
-
436
- let prefix = match size {
437
- OperandSize :: Size16 => LegacyPrefixes :: _66,
438
- _ => LegacyPrefixes :: None ,
439
- } ;
440
-
441
- let opcode = match size {
442
- OperandSize :: Size8 => 0x88 ,
443
- _ => 0x89 ,
444
- } ;
445
-
446
- // This is one of the few places where the presence of a
447
- // redundant REX prefix changes the meaning of the
448
- // instruction.
449
- let rex = RexFlags :: from ( ( * size, src) ) ;
450
-
451
- // 8-bit: MOV r8, r/m8 is (REX.W==0) 88 /r
452
- // 16-bit: MOV r16, r/m16 is 66 (REX.W==0) 89 /r
453
- // 32-bit: MOV r32, r/m32 is (REX.W==0) 89 /r
454
- // 64-bit: MOV r64, r/m64 is (REX.W==1) 89 /r
455
- emit_std_reg_mem ( sink, prefix, opcode, 1 , src, dst, rex, 0 ) ;
456
- }
457
-
458
406
Inst :: CmpRmiR {
459
407
size,
460
408
src1 : reg_g,
@@ -664,12 +612,12 @@ pub(crate) fn emit(
664
612
// Probe the stack! We don't use Inst::gen_store_stack here because we need a predictable
665
613
// instruction size.
666
614
// mov [rsp], rsp
667
- let inst = Inst :: mov_r_m (
668
- OperandSize :: Size32 , // Use Size32 since it saves us one byte
669
- regs:: rsp ( ) ,
670
- SyntheticAmode :: Real ( Amode :: imm_reg ( 0 , regs :: rsp ( ) ) ) ,
671
- ) ;
672
- inst. emit ( sink, info, state) ;
615
+ let inst = asm :: inst :: movl_mr :: new (
616
+ Amode :: imm_reg ( 0 , regs :: rsp ( ) ) ,
617
+ Gpr :: unwrap_new ( regs:: rsp ( ) ) ,
618
+ )
619
+ . into ( ) ;
620
+ Inst :: External { inst } . emit ( sink, info, state) ;
673
621
674
622
// Compare and jump if we are not done yet
675
623
// cmp rsp, tmp_reg
@@ -916,11 +864,12 @@ pub(crate) fn emit(
916
864
let inst = asm:: inst:: movq_rm:: new ( tmp1, addr) . into ( ) ;
917
865
Inst :: External { inst } . emit ( sink, info, state) ;
918
866
919
- let inst = Inst :: MovRM {
920
- size : OperandSize :: Size64 ,
921
- src : Gpr :: new ( reg) . unwrap ( ) ,
922
- dst : Amode :: imm_reg ( offset, * * store_context_ptr) . into ( ) ,
923
- } ;
867
+ let inst = asm:: inst:: movq_mr:: new (
868
+ Amode :: imm_reg ( offset, * * store_context_ptr) ,
869
+ Gpr :: new ( reg) . unwrap ( ) ,
870
+ )
871
+ . into ( ) ;
872
+ let inst = Inst :: External { inst } ;
924
873
emit ( & inst, sink, info, state) ;
925
874
926
875
let dst = Writable :: from_reg ( reg) ;
@@ -947,11 +896,12 @@ pub(crate) fn emit(
947
896
let inst = Inst :: lea ( amode, tmp2. map ( Reg :: from) ) ;
948
897
inst. emit ( sink, info, state) ;
949
898
950
- let inst = Inst :: MovRM {
951
- size : OperandSize :: Size64 ,
952
- src : tmp2. to_reg ( ) ,
953
- dst : Amode :: imm_reg ( pc_offset, * * store_context_ptr) . into ( ) ,
954
- } ;
899
+ let inst = asm:: inst:: movq_mr:: new (
900
+ Amode :: imm_reg ( pc_offset, * * store_context_ptr) ,
901
+ tmp2. to_reg ( ) ,
902
+ )
903
+ . into ( ) ;
904
+ let inst = Inst :: External { inst } ;
955
905
emit ( & inst, sink, info, state) ;
956
906
957
907
let inst = Inst :: JmpUnknown {
@@ -3298,12 +3248,12 @@ fn emit_return_call_common_sequence<T>(
3298
3248
let addr = Amode :: imm_reg ( 0 , regs:: rsp ( ) ) ;
3299
3249
let inst = asm:: inst:: movq_rm:: new ( tmp, addr) . into ( ) ;
3300
3250
Inst :: External { inst } . emit ( sink, info, state) ;
3301
- Inst :: mov_r_m (
3302
- OperandSize :: Size64 ,
3303
- tmp. to_reg ( ) ,
3251
+ let inst = asm:: inst:: movq_mr:: new (
3304
3252
Amode :: imm_reg ( i32:: try_from ( incoming_args_diff) . unwrap ( ) , regs:: rsp ( ) ) ,
3253
+ Gpr :: unwrap_new ( tmp. to_reg ( ) ) ,
3305
3254
)
3306
- . emit ( sink, info, state) ;
3255
+ . into ( ) ;
3256
+ Inst :: External { inst } . emit ( sink, info, state) ;
3307
3257
3308
3258
// Increment the stack pointer to shrink the argument area for the new
3309
3259
// call.
0 commit comments