@@ -538,6 +538,12 @@ type local_realloc_call =
538
538
539
539
let local_realloc_sites = ref ([] : local_realloc_call list )
540
540
541
+ let file_emitter ~file_num ~file_name =
542
+ D. file ~file_num: (Some file_num) ~file_name
543
+
544
+ let emit_debug_info ?discriminator dbg =
545
+ Emitaux. emit_debug_info_gen ?discriminator dbg file_emitter D. loc
546
+
541
547
let emit_local_realloc lr =
542
548
D. define_label lr.lr_lbl;
543
549
emit_debug_info lr.lr_dbg;
@@ -685,7 +691,7 @@ let emit_stack_adjustment n =
685
691
let ml = m land 0xFFF and mh = m land 0xFFF_000 in
686
692
if mh <> 0 then DSL. ins instr [| DSL. sp; DSL. sp; DSL. imm mh |];
687
693
if ml <> 0 then DSL. ins instr [| DSL. sp; DSL. sp; DSL. imm ml |];
688
- if n <> 0 then cfi_adjust_cfa_offset (- n)
694
+ if n <> 0 then D. cfi_adjust_cfa_offset ~bytes: (- n)
689
695
690
696
(* Deallocate the stack frame and reload the return address before a return or
691
697
tail call *)
@@ -697,7 +703,7 @@ let output_epilogue f =
697
703
if n > 0 then emit_stack_adjustment n;
698
704
f () ;
699
705
(* reset CFA back because function body may continue *)
700
- if n > 0 then cfi_adjust_cfa_offset n
706
+ if n > 0 then D. cfi_adjust_cfa_offset ~bytes: n
701
707
702
708
(* Output add-immediate / sub-immediate / cmp-immediate instructions *)
703
709
@@ -1390,7 +1396,7 @@ let emit_instr i =
1390
1396
if n > 0 then emit_stack_adjustment (- n);
1391
1397
if ! contains_calls
1392
1398
then (
1393
- cfi_offset ~reg: 30 (* return address *) ~offset: (- 8 );
1399
+ D. cfi_offset ~reg: 30 (* return address *) ~offset: (- 8 );
1394
1400
DSL. ins I. STR [| DSL. reg_x_30; DSL. emit_mem_sp_offset (n - 8 ) |])
1395
1401
| Lop (Intop_atomic _ ) ->
1396
1402
(* Never generated; builtins are not yet translated to atomics *)
@@ -1489,8 +1495,8 @@ let emit_instr i =
1489
1495
if Config. runtime5
1490
1496
then (
1491
1497
DSL. ins I. MOV [| DSL. reg_x_29; DSL. sp |];
1492
- cfi_remember_state () ;
1493
- cfi_def_cfa_register ~reg: 29 ;
1498
+ D. cfi_remember_state () ;
1499
+ D. cfi_def_cfa_register ~reg: ( Int. to_string 29 ) ;
1494
1500
let offset = Domainstate. (idx_of_field Domain_c_stack ) * 8 in
1495
1501
DSL. ins I. LDR
1496
1502
[| DSL. emit_reg reg_tmp1;
@@ -1499,7 +1505,7 @@ let emit_instr i =
1499
1505
DSL. ins I. MOV [| DSL. sp; DSL. emit_reg reg_tmp1 |]);
1500
1506
DSL. ins I. BL [| DSL. emit_symbol (S. create func) |];
1501
1507
if Config. runtime5 then DSL. ins I. MOV [| DSL. sp; DSL. reg_x_29 |];
1502
- cfi_restore_state () )
1508
+ D. cfi_restore_state () )
1503
1509
| Lop (Stackoffset n ) ->
1504
1510
assert (n mod 16 = 0 );
1505
1511
emit_stack_adjustment (- n);
@@ -1959,7 +1965,7 @@ let emit_instr i =
1959
1965
*)
1960
1966
| Lentertrap -> ()
1961
1967
| Ladjust_stack_offset { delta_bytes } ->
1962
- cfi_adjust_cfa_offset delta_bytes;
1968
+ D. cfi_adjust_cfa_offset ~bytes: delta_bytes;
1963
1969
stack_offset := ! stack_offset + delta_bytes
1964
1970
| Lpushtrap { lbl_handler } ->
1965
1971
let lbl_handler = label_to_asm_label ~section: Text lbl_handler in
@@ -1970,14 +1976,14 @@ let emit_instr i =
1970
1976
DSL. emit_reg reg_tmp1;
1971
1977
DSL. mem_pre ~base: Arm64_ast.Reg. sp ~offset: (- 16 )
1972
1978
|];
1973
- cfi_adjust_cfa_offset 16 ;
1979
+ D. cfi_adjust_cfa_offset ~bytes: 16 ;
1974
1980
DSL. ins I. MOV [| DSL. emit_reg reg_trap_ptr; DSL. sp |]
1975
1981
| Lpoptrap ->
1976
1982
DSL. ins I. LDR
1977
1983
[| DSL. emit_reg reg_trap_ptr;
1978
1984
DSL. mem_post ~base: Arm64_ast.Reg. sp ~offset: 16
1979
1985
|];
1980
- cfi_adjust_cfa_offset (- 16 );
1986
+ D. cfi_adjust_cfa_offset ~bytes: (- 16 );
1981
1987
stack_offset := ! stack_offset - 16
1982
1988
| Lraise k -> (
1983
1989
match k with
@@ -2067,7 +2073,7 @@ let fundecl fundecl =
2067
2073
D. type_symbol ~ty: Function fun_sym;
2068
2074
D. define_symbol_label ~section: Text fun_sym;
2069
2075
emit_debug_info fundecl.fun_dbg;
2070
- cfi_startproc () ;
2076
+ D. cfi_startproc () ;
2071
2077
let num_call_gc = num_call_gc_points fundecl.fun_body in
2072
2078
let max_out_of_line_code_offset = max_out_of_line_code_offset ~num_call_gc in
2073
2079
BR. relax fundecl.fun_body ~max_out_of_line_code_offset ;
@@ -2081,7 +2087,7 @@ let fundecl fundecl =
2081
2087
| Some fun_end_label ->
2082
2088
let fun_end_label = label_to_asm_label ~section: Text fun_end_label in
2083
2089
D. define_label fun_end_label);
2084
- cfi_endproc () ;
2090
+ D. cfi_endproc () ;
2085
2091
(* The type symbol and the size are system specific. They are not output on
2086
2092
macOS. The asm directives take care of correctly handling this distinction.
2087
2093
For the size, they automatically emit the size [. - symbol], meaning "this
0 commit comments