forked from cil-project/cil
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathcabs2cil.mli
More file actions
137 lines (107 loc) · 6.38 KB
/
cabs2cil.mli
File metadata and controls
137 lines (107 loc) · 6.38 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
(*
Copyright (c) 2001-2002,
George C. Necula <necula@cs.berkeley.edu>
Scott McPeak <smcpeak@cs.berkeley.edu>
Wes Weimer <weimer@cs.berkeley.edu>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The names of the contributors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*)
(** The main entry point *)
val convFile: Cabs.file -> Cil.file
(** Turn on tranformation that forces correct parameter evaluation order *)
val forceRLArgEval: bool ref
(** By default, we warn as large constants cannot be appropriately represented as OCaml floats.
This can be set to true by tools that are aware of this problem and only use the string component of CReal
to avoid emitting warnings that are spurious in that context. *)
val silenceLongDoubleWarning: bool ref
(** Set this integer to the index of the global to be left in CABS form. Use
-1 to disable *)
val nocil: int ref
(** Add an attribute to all variables which are not declared at the top scope,
so tools building on CIL can know which variables were pulled up.
Should be disabled when printing CIL code, as compilers will warn about this attribute.
*)
val addNestedScopeAttr: bool ref
(** Add [__loop_condition] labels before syntactic loop conditions. *)
val addLoopConditionLabels: bool ref
(** Indicates whether we're allowed to duplicate small chunks of code. *)
val allowDuplication: bool ref
(** If false, the destination of a Call instruction should always have the
same type as the function's return type. Where needed, CIL will insert
a temporary to make this happen.
If true, the destination type may differ from the return type, so there
is an implicit cast. This is useful for analyses involving [malloc],
because the instruction "T* x = malloc(...);" won't be broken into
two instructions, so it's easy to find the allocation type.
This is false by default. Set to true to replicate the behavior
of CIL 1.3.5 and earlier.
*)
val doCollapseCallCast: bool ref
(** Disables caching of globals during parsing. This is handy when we want
to parse additional source files without hearing about confclits. *)
val cacheGlobals: bool ref
(** A hook into the code for processing typeof. *)
val typeForTypeof: (Cil.typ -> Cil.typ) ref
(** A hook into the code that creates temporary local vars. By default this
is the identity function, but you can overwrite it if you need to change the
types of cabs2cil-introduced temp variables. *)
val typeForInsertedVar: (Cil.typ -> Cil.typ) ref
(** Like [typeForInsertedVar], but for casts.
Casts in the source code are exempt from this hook. *)
val typeForInsertedCast: (Cil.typ -> Cil.typ) ref
(** A hook into the code that merges arguments in function types. *)
val typeForCombinedArg: ((string, string) Hashtbl.t -> Cil.typ -> Cil.typ) ref
(** A hook into the code that merges arguments in function attributes. *)
val attrsForCombinedArg: ((string, string) Hashtbl.t ->
Cil.attributes -> Cil.attributes) ref
val allTempVars: unit Inthash.t
type envdata =
EnvVar of Cil.varinfo (* The name refers to a variable
(which could also be a function) *)
| EnvEnum of Cil.exp * Cil.typ (* The name refers to an enumeration
tag for which we know the value
and the host type *)
| EnvTyp of Cil.typ (* The name is of the form "struct
foo", or "union foo" or "enum foo"
and refers to a type. Note that
the name of the actual type might
be different from foo due to alpha
conversion *)
| EnvLabel of string (* The name refers to a label. This
is useful for GCC's locally
declared labels. The lookup name
for this category is "label foo" *)
(** A hashtable containing a mapping of variables, enums, types and labels to varinfo, typ, etc. *)
(* It enables a lookup of the original variable names before the alpha conversion by cabs2cil *)
val environment : (string, envdata * Cil.location) Hashtbl.t
val genvironment : (string, envdata * Cil.location) Hashtbl.t
val convStandaloneExp: genv:(string, envdata * Cil.location) Hashtbl.t -> env:(string, envdata * Cil.location) Hashtbl.t -> Cabs.expression -> Cil.exp option
val currentFunctionFDEC: Cil.fundec ref
(** c.f. ISO 6.3.1.1. When [~width] is supplied (bit-field width in bits),
the promotion accounts for the narrower representable range. *)
val integralPromotion: ?width:int -> Cil.typ -> Cil.typ
(** c.f. ISO 6.3.1.8 *)
val arithmeticConversion: Cil.typ -> Cil.typ -> Cil.typ
(** Construct {!Cil.BinOp} with correct implicit casts inserted. *)
val doBinOp: Cil.binop -> Cil.exp -> Cil.typ -> Cil.exp -> Cil.typ -> Cil.typ * Cil.exp