Ignore:
Timestamp:
Nov 25, 2011, 7:43:39 PM (8 years ago)
Author:
tranquil
Message:
  • Immediates introduced (but not fully used yet in RTLabs to RTL pass)
  • translation streamlined
  • BUGGY: interpretation fails in LTL, trying to fetch a function with incorrect address
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/src/RTL/RTLToERTL.ml

    r1542 r1568  
    3434  | ERTL.St_addrH (r, id, _) -> ERTL.St_addrH (r, id, lbl)
    3535  | ERTL.St_addrL (r, id, _) -> ERTL.St_addrL (r, id, lbl)
    36   | ERTL.St_int (r, i, _) -> ERTL.St_int (r, i, lbl)
    37   | ERTL.St_move (r1, r2, _) -> ERTL.St_move (r1, r2, lbl)
     36  | ERTL.St_move (r1, a, _) -> ERTL.St_move (r1, a, lbl)
    3837  | ERTL.St_opaccsA (opaccs, dstr, srcr1, srcr2, _) ->
    3938    ERTL.St_opaccsA (opaccs, dstr, srcr1, srcr2, lbl)
     
    102101let restore_hdws l =
    103102  let f (destr, srcr) start_lbl =
    104     adds_graph [ERTL.St_set_hdw (destr, srcr, start_lbl)] start_lbl in
     103    adds_graph [ERTL.St_set_hdw (destr, RTL.Reg srcr, start_lbl)] start_lbl in
    105104  List.map f (List.map (fun (x, y) -> (y, x)) l)
    106105
     
    118117  adds_graph
    119118    [ERTL.St_framesize (addr1, start_lbl) ;
    120      ERTL.St_int (tmpr, off+I8051.int_size, start_lbl) ;
    121      ERTL.St_op2 (I8051.Sub, addr1, addr1, tmpr, start_lbl) ;
     119     ERTL.St_op2 (I8051.Sub, addr1, addr1, RTL.Imm (off+I8051.int_size),
     120                 start_lbl) ;
    122121     ERTL.St_get_hdw (tmpr, I8051.spl, start_lbl) ;
    123      ERTL.St_op2 (I8051.Add, addr1, addr1, tmpr, start_lbl) ;
    124      ERTL.St_int (addr2, 0, start_lbl) ;
     122     ERTL.St_op2 (I8051.Add, addr1, addr1, RTL.Reg tmpr, start_lbl) ;
    125123     ERTL.St_get_hdw (tmpr, I8051.sph, start_lbl) ;
    126      ERTL.St_op2 (I8051.Addc, addr2, addr2, tmpr, start_lbl) ;
     124     ERTL.St_op2 (I8051.Addc, addr2, tmpr, RTL.Imm 0, start_lbl) ;
    127125     ERTL.St_load (destr, addr1, addr2, start_lbl)]
    128126    start_lbl dest_lbl def
     
    176174
    177175let save_return ret_regs start_lbl dest_lbl def =
    178   let (def, tmpr) = fresh_reg def in
    179176  let ((common1, rest1), (common2, _)) =
    180177    MiscPottier.reduce I8051.sts ret_regs in
    181   let init_tmpr = ERTL.St_int (tmpr, 0, start_lbl) in
    182   let f_save st r = ERTL.St_set_hdw (st, r, start_lbl) in
     178  let f_save st r = ERTL.St_set_hdw (st, RTL.Reg r, start_lbl) in
    183179  let saves = List.map2 f_save common1 common2 in
    184   let f_default st = ERTL.St_set_hdw (st, tmpr, start_lbl) in
     180  let f_default st = ERTL.St_set_hdw (st, RTL.Imm 0, start_lbl) in
    185181  let defaults = List.map f_default rest1 in
    186   adds_graph (init_tmpr :: saves @ defaults) start_lbl dest_lbl def
     182  adds_graph (saves @ defaults) start_lbl dest_lbl def
    187183
    188184let assign_result start_lbl =
     
    252248  let (def, tmpr) = fresh_reg def in
    253249  adds_graph
    254     [ERTL.St_int (addr1, off+I8051.int_size, start_lbl) ;
    255      ERTL.St_get_hdw (tmpr, I8051.spl, start_lbl) ;
     250    [ERTL.St_get_hdw (tmpr, I8051.spl, start_lbl) ;
    256251     ERTL.St_clear_carry start_lbl ;
    257      ERTL.St_op2 (I8051.Sub, addr1, tmpr, addr1, start_lbl) ;
     252     ERTL.St_op2 (I8051.Sub, addr1, tmpr, RTL.Imm (off+I8051.int_size),
     253                  start_lbl) ;
    258254     ERTL.St_get_hdw (tmpr, I8051.sph, start_lbl) ;
    259      ERTL.St_int (addr2, 0, start_lbl) ;
    260      ERTL.St_op2 (I8051.Sub, addr2, tmpr, addr2, start_lbl) ;
     255     ERTL.St_op2 (I8051.Sub, addr2, tmpr, RTL.Imm 0, start_lbl) ;
    261256     ERTL.St_store (addr1, addr2, srcr, start_lbl)]
    262257    start_lbl dest_lbl def
     
    338333      lbl lbl' def
    339334
    340   | RTL.St_int (r, i, lbl') ->
    341     add_graph lbl (ERTL.St_int (r, i, lbl')) def
     335  (* | RTL.St_int (r, i, lbl') -> *)
     336  (*   add_graph lbl (ERTL.St_int (r, i, lbl')) def *)
    342337
    343338  | RTL.St_move (r1, r2, lbl') ->
     
    444439    | ERTL.St_set_hdw (_, _, lbl) | ERTL.St_hdw_to_hdw (_, _, lbl)
    445440    | ERTL.St_pop (_, lbl) | ERTL.St_push (_, lbl) | ERTL.St_addrH (_, _, lbl)
    446     | ERTL.St_addrL (_, _, lbl) | ERTL.St_int (_, _, lbl)
     441    | ERTL.St_addrL (_, _, lbl) (* | ERTL.St_int (_, _, lbl) *)
    447442    | ERTL.St_move (_, _, lbl) | ERTL.St_opaccsA (_, _, _, _, lbl)
    448443    | ERTL.St_opaccsB (_, _, _, _, lbl)
Note: See TracChangeset for help on using the changeset viewer.