Hi everyone,
I am doing a compilation project using ocaml, as I am not good in this
language, it's very hard to start.
My question is : Merge two functions in one
I explain
The first function's called : RTLabs.St_op2 : this one make a binary
operation. Parameters are the operation, the destination register, the two
argument registers and the label of the next statement , it adds the
register srcr1 with the registre srcr2 and stock the result in destr.
| RTLabs.St_op2 (op2, destr, srcr1, srcr2, lbl) ->
let v =
Eval.op2
(get_type lenv destr) (get_type lenv srcr1) (get_type lenv srcr2)
op2
(get_value lenv srcr1)
(get_value lenv srcr2) in
assign_state sfrs graph sp lbl lenv mem trace destr v
The second function is : RTLabs.St_cst : this function assign a constant to
a register .
| RTLabs.St_cst (destr, cst, lbl) ->
let v = Eval.cst mem sp (get_type lenv destr) cst in
assign_state sfrs graph sp lbl lenv mem trace destr v
I want to program a function which add a constant to the content of the
register srcr1 and stock the result in the register dstr using St_cst and
St_op2 ;
| RTLabs.St_cst (op2, destr, srcr1, src2, cst, lbl) ->
let x = RTLabs.St_cst (src1, cst, lbl) in ????????????
/* How to get the value of src1 !!!! */
thanks in advance.
--
You received this message because you are subscribed to the Google Groups
"ocaml-developer" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ocaml-developer?hl=en
For other OCaml forums, see http://caml.inria.fr/resources/forums.en.html