@ -864,6 +864,9 @@ let rec xlate_func_name x llv =
let ignored_callees = Hash_set . create ( module String )
let ignored_callees = Hash_set . create ( module String )
let exp_size_of exp =
Exp . integer Typ . siz ( Z . of_int ( Typ . size_of ( Exp . typ exp ) ) )
let xlate_instr :
let xlate_instr :
pop_thunk
pop_thunk
-> x
-> x
@ -902,12 +905,12 @@ let xlate_instr :
match opcode with
match opcode with
| Load ->
| Load ->
let reg = xlate_name x instr in
let reg = xlate_name x instr in
let len = Exp . size_of ( Exp . reg reg ) in
let len = exp_ size_of ( Exp . reg reg ) in
let ptr = xlate_value x ( Llvm . operand instr 0 ) in
let ptr = xlate_value x ( Llvm . operand instr 0 ) in
emit_inst ( Llair . Inst . load ~ reg ~ ptr ~ len ~ loc )
emit_inst ( Llair . Inst . load ~ reg ~ ptr ~ len ~ loc )
| Store ->
| Store ->
let exp = xlate_value x ( Llvm . operand instr 0 ) in
let exp = xlate_value x ( Llvm . operand instr 0 ) in
let len = Exp . size_of exp in
let len = exp_ size_of exp in
let ptr = xlate_value x ( Llvm . operand instr 1 ) in
let ptr = xlate_value x ( Llvm . operand instr 1 ) in
emit_inst ( Llair . Inst . store ~ ptr ~ exp ~ len ~ loc )
emit_inst ( Llair . Inst . store ~ ptr ~ exp ~ len ~ loc )
| Alloca ->
| Alloca ->
@ -919,7 +922,7 @@ let xlate_instr :
( xlate_value x rand )
( xlate_value x rand )
in
in
assert ( Poly . ( Llvm . classify_type ( Llvm . type_of instr ) = Pointer ) ) ;
assert ( Poly . ( Llvm . classify_type ( Llvm . type_of instr ) = Pointer ) ) ;
let len = Exp . size_of ( Exp . reg reg ) in
let len = exp_ size_of ( Exp . reg reg ) in
emit_inst ( Llair . Inst . alloc ~ reg ~ num ~ len ~ loc )
emit_inst ( Llair . Inst . alloc ~ reg ~ num ~ len ~ loc )
| Call -> (
| Call -> (
let maybe_llfunc = Llvm . operand instr ( Llvm . num_operands instr - 1 ) in
let maybe_llfunc = Llvm . operand instr ( Llvm . num_operands instr - 1 ) in
@ -970,7 +973,7 @@ let xlate_instr :
(* operator new ( unsigned long, std::align_val_t ) *) ] ->
(* operator new ( unsigned long, std::align_val_t ) *) ] ->
let reg = xlate_name x instr in
let reg = xlate_name x instr in
let num = xlate_value x ( Llvm . operand instr 0 ) in
let num = xlate_value x ( Llvm . operand instr 0 ) in
let len = Exp . size_of ( Exp . reg reg ) in
let len = exp_ size_of ( Exp . reg reg ) in
emit_inst ( Llair . Inst . alloc ~ reg ~ num ~ len ~ loc )
emit_inst ( Llair . Inst . alloc ~ reg ~ num ~ len ~ loc )
| [ " _ZdlPv " (* operator delete ( void * ptr ) *) ]
| [ " _ZdlPv " (* operator delete ( void * ptr ) *) ]
| [ " _ZdlPvSt11align_val_t "
| [ " _ZdlPvSt11align_val_t "
@ -1086,7 +1089,7 @@ let xlate_instr :
when num_actuals > 0 ->
when num_actuals > 0 ->
let reg = xlate_name x instr in
let reg = xlate_name x instr in
let num = xlate_value x ( Llvm . operand instr 0 ) in
let num = xlate_value x ( Llvm . operand instr 0 ) in
let len = Exp . size_of ( Exp . reg reg ) in
let len = exp_ size_of ( Exp . reg reg ) in
let dst , blocks = xlate_jump x instr return_blk loc [] in
let dst , blocks = xlate_jump x instr return_blk loc [] in
emit_term
emit_term
~ prefix : [ Llair . Inst . alloc ~ reg ~ num ~ len ~ loc ]
~ prefix : [ Llair . Inst . alloc ~ reg ~ num ~ len ~ loc ]