@@ -59,7 +59,8 @@ pub fn convert_rvalue_to_operand<'a>(
59
59
}
60
60
MirOperand :: Constant ( _) => {
61
61
// Constant is already an operand, no extra instructions
62
- result_operand = convert_operand ( mir_operand, tcx, mir, data_types) ;
62
+ result_operand =
63
+ convert_operand ( mir_operand, tcx, mir, data_types, & mut instructions) ;
63
64
}
64
65
}
65
66
}
@@ -71,7 +72,8 @@ pub fn convert_rvalue_to_operand<'a>(
71
72
72
73
if let rustc_middle:: ty:: TyKind :: Array ( elem_ty, _) = place_ty. kind ( ) {
73
74
let oomir_elem_type = ty_to_oomir_type ( elem_ty. clone ( ) , tcx, data_types) ;
74
- let oomir_elem_op = convert_operand ( element_op, tcx, mir, data_types) ;
75
+ let oomir_elem_op =
76
+ convert_operand ( element_op, tcx, mir, data_types, & mut instructions) ;
75
77
let array_size = match len_const. kind ( ) {
76
78
ConstKind :: Value ( val) => {
77
79
/* ... extract size ... */
@@ -80,6 +82,7 @@ pub fn convert_rvalue_to_operand<'a>(
80
82
tcx. valtree_to_const_val ( val) ,
81
83
& val. ty ( ) ,
82
84
tcx,
85
+ data_types,
83
86
) )
84
87
. unwrap_or ( 0 )
85
88
} // Simplified extraction
@@ -145,7 +148,7 @@ pub fn convert_rvalue_to_operand<'a>(
145
148
let oomir_target_type = ty_to_oomir_type ( * target_mir_ty, tcx, data_types) ;
146
149
let source_mir_ty = operand. ty ( & mir. local_decls , tcx) ;
147
150
let oomir_source_type = ty_to_oomir_type ( source_mir_ty, tcx, data_types) ;
148
- let oomir_operand = convert_operand ( operand, tcx, mir, data_types) ;
151
+ let oomir_operand = convert_operand ( operand, tcx, mir, data_types, & mut instructions ) ;
149
152
150
153
if oomir_target_type == oomir_source_type {
151
154
println ! ( "Info: Handling Rvalue::Cast (Same OOMIR Types) -> Temp Move." ) ;
@@ -169,8 +172,8 @@ pub fn convert_rvalue_to_operand<'a>(
169
172
170
173
Rvalue :: BinaryOp ( bin_op, box ( op1, op2) ) => {
171
174
let temp_binop_var = generate_temp_var_name ( & base_temp_name) ;
172
- let oomir_op1 = convert_operand ( op1, tcx, mir, data_types) ;
173
- let oomir_op2 = convert_operand ( op2, tcx, mir, data_types) ;
175
+ let oomir_op1 = convert_operand ( op1, tcx, mir, data_types, & mut instructions ) ;
176
+ let oomir_op2 = convert_operand ( op2, tcx, mir, data_types, & mut instructions ) ;
174
177
// Determine result type based on operands or destination hint
175
178
let oomir_result_type = get_place_type ( original_dest_place, mir, tcx, data_types) ;
176
179
@@ -349,7 +352,8 @@ pub fn convert_rvalue_to_operand<'a>(
349
352
350
353
Rvalue :: UnaryOp ( operation, operand) => {
351
354
let temp_unop_var = generate_temp_var_name ( & base_temp_name) ;
352
- let oomir_src_operand = convert_operand ( operand, tcx, mir, data_types) ;
355
+ let oomir_src_operand =
356
+ convert_operand ( operand, tcx, mir, data_types, & mut instructions) ;
353
357
// Determine result type (often same as operand, except for PtrMetadata)
354
358
let oomir_result_type = match operation {
355
359
UnOp :: PtrMetadata => oomir:: Type :: I32 ,
@@ -474,7 +478,8 @@ pub fn convert_rvalue_to_operand<'a>(
474
478
} ;
475
479
let element_oomir_type =
476
480
ty_to_oomir_type ( element_mir_ty. clone ( ) , tcx, data_types) ;
477
- let value_operand = convert_operand ( mir_op, tcx, mir, data_types) ;
481
+ let value_operand =
482
+ convert_operand ( mir_op, tcx, mir, data_types, & mut instructions) ;
478
483
instructions. push ( oomir:: Instruction :: SetField {
479
484
object_var : temp_aggregate_var. clone ( ) ,
480
485
field_name,
@@ -500,7 +505,8 @@ pub fn convert_rvalue_to_operand<'a>(
500
505
} ) ;
501
506
// Store elements into the temporary array
502
507
for ( i, mir_operand) in operands. iter ( ) . enumerate ( ) {
503
- let value_operand = convert_operand ( mir_operand, tcx, mir, data_types) ;
508
+ let value_operand =
509
+ convert_operand ( mir_operand, tcx, mir, data_types, & mut instructions) ;
504
510
let index_operand =
505
511
oomir:: Operand :: Constant ( oomir:: Constant :: I32 ( i as i32 ) ) ;
506
512
instructions. push ( oomir:: Instruction :: ArrayStore {
@@ -530,7 +536,13 @@ pub fn convert_rvalue_to_operand<'a>(
530
536
let field_name = field_def. ident ( tcx) . to_string ( ) ;
531
537
let field_mir_ty = field_def. ty ( tcx, substs) ;
532
538
let field_oomir_type = ty_to_oomir_type ( field_mir_ty, tcx, data_types) ;
533
- let value_operand = convert_operand ( mir_operand, tcx, mir, data_types) ;
539
+ let value_operand = convert_operand (
540
+ mir_operand,
541
+ tcx,
542
+ mir,
543
+ data_types,
544
+ & mut instructions,
545
+ ) ;
534
546
instructions. push ( oomir:: Instruction :: SetField {
535
547
object_var : temp_aggregate_var. clone ( ) ,
536
548
field_name,
@@ -671,6 +683,7 @@ pub fn convert_rvalue_to_operand<'a>(
671
683
tcx,
672
684
mir,
673
685
data_types,
686
+ & mut instructions,
674
687
) ;
675
688
instructions. push ( oomir:: Instruction :: SetField {
676
689
object_var : temp_aggregate_var. clone ( ) ,
0 commit comments