Source file meta_ast_cil.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
open Ast_cil
let vof_name (s, _) =
Ocaml.vof_string s
let vof_var x =
vof_name x
let vof_wrap ofa x =
ofa (fst x)
let vof_type_ x =
Meta_ast_c.vof_type_ x
let vof_lvalue =
function
| Id v1 -> let v1 = vof_name v1 in Ocaml.VSum (("Id", [ v1 ]))
| ObjField ((v1, v2)) ->
let v1 = vof_var v1
and v2 = vof_name v2
in Ocaml.VSum (("ObjField", [ v1; v2 ]))
| ArrayAccess ((v1, v2)) ->
let v1 = vof_var v1
and v2 = vof_var v2
in Ocaml.VSum (("ArrayAccess", [ v1; v2 ]))
| DeRef v1 -> let v1 = vof_var v1 in Ocaml.VSum (("DeRef", [ v1 ]))
let vof_rvalue =
function
| Int v1 ->
let v1 = vof_wrap Ocaml.vof_string v1 in Ocaml.VSum (("Int", [ v1 ]))
| Float v1 ->
let v1 = vof_wrap Ocaml.vof_string v1 in Ocaml.VSum (("Float", [ v1 ]))
| String v1 ->
let v1 = vof_wrap Ocaml.vof_string v1
in Ocaml.VSum (("String", [ v1 ]))
| StaticCall ((v1, v2)) ->
let v1 = vof_name v1
and v2 = Ocaml.vof_list vof_var v2
in Ocaml.VSum (("StaticCall", [ v1; v2 ]))
| DynamicCall ((v1, v2)) ->
let v1 = vof_var v1
and v2 = Ocaml.vof_list vof_var v2
in Ocaml.VSum (("DynamicCall", [ v1; v2 ]))
| BuiltinCall ((v1, v2)) ->
let v1 = vof_name v1
and v2 = Ocaml.vof_list vof_var v2
in Ocaml.VSum (("BuiltinCall", [ v1; v2 ]))
| Alloc v1 -> let v1 = vof_type_ v1 in Ocaml.VSum (("Alloc", [ v1 ]))
| AllocArray ((v1, v2)) ->
let v1 = vof_var v1
and v2 = vof_type_ v2
in Ocaml.VSum (("AllocArray", [ v1; v2 ]))
| Lv v1 -> let v1 = vof_lvalue v1 in Ocaml.VSum (("Lv", [ v1 ]))
let vof_instr =
function
| Assign ((v1, v2)) ->
let v1 = vof_var v1
and v2 = vof_rvalue v2
in Ocaml.VSum (("Assign", [ v1; v2 ]))
| AssignAddress ((v1, v2)) ->
let v1 = vof_var v1
and v2 = vof_lvalue v2
in Ocaml.VSum (("AssignAddress", [ v1; v2 ]))
| AssignLvalue ((v1, v2)) ->
let v1 = vof_lvalue v1
and v2 = vof_var v2
in Ocaml.VSum (("AssignLvalue", [ v1; v2 ]))