Changeset 1589 for Deliverables/D2.2/8051/src/RTLabs/RTLabsToRTL.ml
 Timestamp:
 Dec 6, 2011, 5:04:13 PM (10 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Deliverables/D2.2/8051/src/RTLabs/RTLabsToRTL.ml
r1585 r1589 11 11 let error_shift () = error "Shift operations not supported." 12 12 13 let dummy = Label.dummy 13 14 14 15 let add_graph lbl stmt def = … … 174 175 translate_cst (AST.Cst_int 0) destrs start_lbl dest_lbl def 175 176 176 let translate_cast_signed destrs srcr start_lbl dest_lbl def = 177 let (def, tmpr) = fresh_reg def in 178 let insts = 177 let sign_mask destr srcr = 179 178 (* this sets tmpr to 0xFF if s is neg, 0x00 o.w. Done like that: 180 179 byte in tmpr if srcr is: neg  pos … … 185 184 186 185 *) 187 [RTL.St_op2 (I8051.Or, tmpr, srcr, RTL.Imm 127, start_lbl) ; 188 RTL.St_op1 (I8051.Rl, tmpr, tmpr, start_lbl) ; 189 RTL.St_op1 (I8051.Inc, tmpr, tmpr, start_lbl) ; 190 RTL.St_op1 (I8051.Cmpl, tmpr, tmpr, start_lbl) ] in 186 [RTL.St_op2 (I8051.Or, destr, srcr, RTL.Imm 127, dummy) ; 187 RTL.St_op1 (I8051.Rl, destr, destr, dummy) ; 188 RTL.St_op1 (I8051.Inc, destr, destr, dummy) ; 189 RTL.St_op1 (I8051.Cmpl, destr, destr, dummy) ] 190 191 192 let translate_cast_signed destrs srcr start_lbl dest_lbl def = 193 let (def, tmpr) = fresh_reg def in 191 194 let srcrs = MiscPottier.make (RTL.Reg tmpr) (List.length destrs) in 192 add_translates [adds_graph insts; translate_move destrs srcrs]195 add_translates [adds_graph (sign_mask tmpr srcr); translate_move destrs srcrs] 193 196 start_lbl dest_lbl def 194 197 … … 477 480 478 481  AST.Op_add  AST.Op_addp > 479 translate_op I8051.Add cdestrs srcrs1 srcrs2 start_lbl dest_lbl def482 translate_op I8051.Add destrs srcrs1 srcrs2 start_lbl dest_lbl def 480 483 481 484  AST.Op_sub  AST.Op_subp  AST.Op_subpp > … … 666 669 error "Jump tables not supported yet." 667 670 668  RTLabs.St_return None > 669 add_graph lbl (RTL.St_return []) def 670 671  RTLabs.St_return (Some r) > 672 add_graph lbl (RTL.St_return (find_local_env r lenv)) def 671  RTLabs.St_return > 672 add_graph lbl RTL.St_return def 673 674 open BList.Notation 673 675 674 676 open BList.Notation … … 708 710 load_args args (fun args > 709 711 RTLabs.St_tailcall_ptr (f, args, s) ^:: bnil) 710  RTLabs.St_return (Some a) >711 load_arg a (fun a >712 RTLabs.St_return (Some a) ^:: bnil)713 712  stmt > stmt ^:: bnil in 714 713 let module T = GraphUtilities.Trans(RTLabsGraph)(RTLabsGraph) in
Note: See TracChangeset
for help on using the changeset viewer.