diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2009-03-29 09:47:11 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2009-03-29 09:47:11 +0000 |
commit | a5f03d96eee482cd84861fc8cefff9eb451c0cad (patch) | |
tree | cbc66cbc183a7c5ef2c044ed9ed04b8011df9cd4 /cil/doc | |
parent | a9621943087a5578c995d88b06f87c5158eb5d00 (diff) |
Cleaned up configure script.
Distribution of CIL as an expanded source tree with changes applied
(instead of original .tar.gz + patches to be applied at config time).
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1020 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cil/doc')
135 files changed, 18646 insertions, 0 deletions
diff --git a/cil/doc/CIL-API.pdf b/cil/doc/CIL-API.pdf Binary files differnew file mode 100644 index 0000000..240ff49 --- /dev/null +++ b/cil/doc/CIL-API.pdf diff --git a/cil/doc/CIL.pdf b/cil/doc/CIL.pdf Binary files differnew file mode 100644 index 0000000..34554fa --- /dev/null +++ b/cil/doc/CIL.pdf diff --git a/cil/doc/api/Alpha.html b/cil/doc/api/Alpha.html new file mode 100644 index 0000000..699fac0 --- /dev/null +++ b/cil/doc/api/Alpha.html @@ -0,0 +1,79 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="previous" href="Formatcil.html"> +<link rel="next" href="Cillower.html"> +<link rel="Up" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Alpha</title> +</head> +<body> +<div class="navbar"><a href="Formatcil.html">Previous</a> + <a href="index.html">Up</a> + <a href="Cillower.html">Next</a> +</div> +<center><h1>Module <a href="type_Alpha.html">Alpha</a></h1></center> +<br> +<pre><span class="keyword">module</span> Alpha: <code class="code">sig</code> <a href="Alpha.html">..</a> <code class="code">end</code></pre><b>ALPHA conversion</b><br> +<hr width="100%"> +<pre><span class="keyword">type</span> <a name="TYPEundoAlphaElement"></a><code class="type">'a</code> undoAlphaElement </pre> +<div class="info"> +This is the type of the elements that are recorded by the alpha + conversion functions in order to be able to undo changes to the tables + they modify. Useful for implementing + scoping<br> +</div> + +<pre><span class="keyword">type</span> <a name="TYPEalphaTableData"></a><code class="type">'a</code> alphaTableData </pre> +<div class="info"> +This is the type of the elements of the alpha renaming table. These + elements can carry some data associated with each occurrence of the name.<br> +</div> + +<pre><span class="keyword">val</span> <a name="VALnewAlphaName"></a>newAlphaName : <code class="type">alphaTable:(string, 'a <a href="Alpha.html#TYPEalphaTableData">alphaTableData</a> Pervasives.ref) Hashtbl.t -><br> undolist:'a <a href="Alpha.html#TYPEundoAlphaElement">undoAlphaElement</a> list Pervasives.ref option -><br> lookupname:string -> data:'a -> string * 'a</code></pre><div class="info"> +Create a new name based on a given name. The new name is formed from a + prefix (obtained from the given name by stripping a suffix consisting of _ + followed by only digits), followed by a special separator and then by a + positive integer suffix. The first argument is a table mapping name + prefixes to some data that specifies what suffixes have been used and how + to create the new one. This function updates the table with the new + largest suffix generated. The "undolist" argument, when present, will be + used by the function to record information that can be used by + <a href="Alpha.html#VALundoAlphaChanges"><code class="code">Alpha.undoAlphaChanges</code></a> to undo those changes. Note that the undo + information will be in reverse order in which the action occurred. Returns + the new name and, if different from the lookupname, the location of the + previous occurrence. This function knows about the location implicitly + from the <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a>.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALregisterAlphaName"></a>registerAlphaName : <code class="type">alphaTable:(string, 'a <a href="Alpha.html#TYPEalphaTableData">alphaTableData</a> Pervasives.ref) Hashtbl.t -><br> undolist:'a <a href="Alpha.html#TYPEundoAlphaElement">undoAlphaElement</a> list Pervasives.ref option -><br> lookupname:string -> data:'a -> unit</code></pre><div class="info"> +Register a name with an alpha conversion table to ensure that when later + we call newAlphaName we do not end up generating this one<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdocAlphaTable"></a>docAlphaTable : <code class="type">unit -><br> (string, 'a <a href="Alpha.html#TYPEalphaTableData">alphaTableData</a> Pervasives.ref) Hashtbl.t -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Split the name in preparation for newAlphaName. The prefix returned is + used to index into the hashtable. The next result value is a separator + (either empty or the separator chosen to separate the original name from + the index)<br> +</div> +<pre><span class="keyword">val</span> <a name="VALgetAlphaPrefix"></a>getAlphaPrefix : <code class="type">lookupname:string -> string</code></pre><pre><span class="keyword">val</span> <a name="VALundoAlphaChanges"></a>undoAlphaChanges : <code class="type">alphaTable:(string, 'a <a href="Alpha.html#TYPEalphaTableData">alphaTableData</a> Pervasives.ref) Hashtbl.t -><br> undolist:'a <a href="Alpha.html#TYPEundoAlphaElement">undoAlphaElement</a> list -> unit</code></pre><div class="info"> +Undo the changes to a table<br> +</div> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Cfg.html b/cil/doc/api/Cfg.html new file mode 100644 index 0000000..142de8a --- /dev/null +++ b/cil/doc/api/Cfg.html @@ -0,0 +1,69 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="previous" href="Cillower.html"> +<link rel="next" href="Dataflow.html"> +<link rel="Up" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Cfg</title> +</head> +<body> +<div class="navbar"><a href="Cillower.html">Previous</a> + <a href="index.html">Up</a> + <a href="Dataflow.html">Next</a> +</div> +<center><h1>Module <a href="type_Cfg.html">Cfg</a></h1></center> +<br> +<pre><span class="keyword">module</span> Cfg: <code class="code">sig</code> <a href="Cfg.html">..</a> <code class="code">end</code></pre>Code to compute the control-flow graph of a function or file. + This will fill in the <code class="code">preds</code> and <code class="code">succs</code> fields of <a href="Cil.html#TYPEstmt"><code class="code">Cil.stmt</code></a> +<p> + + This is required for several other extensions, such as <a href="Dataflow.html"><code class="code">Dataflow</code></a>.<br> +<hr width="100%"> +<pre><span class="keyword">val</span> <a name="VALcomputeFileCFG"></a>computeFileCFG : <code class="type"><a href="Cil.html#TYPEfile">Cil.file</a> -> unit</code></pre><div class="info"> +Compute the CFG for an entire file, by calling cfgFun on each function.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALclearFileCFG"></a>clearFileCFG : <code class="type"><a href="Cil.html#TYPEfile">Cil.file</a> -> unit</code></pre><div class="info"> +clear the sid, succs, and preds fields of each statement.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcfgFun"></a>cfgFun : <code class="type"><a href="Cil.html#TYPEfundec">Cil.fundec</a> -> int</code></pre><div class="info"> +Compute a control flow graph for fd. Stmts in fd have preds and succs + filled in<br> +</div> +<pre><span class="keyword">val</span> <a name="VALclearCFGinfo"></a>clearCFGinfo : <code class="type"><a href="Cil.html#TYPEfundec">Cil.fundec</a> -> unit</code></pre><div class="info"> +clear the sid, succs, and preds fields of each statment in a function<br> +</div> +<pre><span class="keyword">val</span> <a name="VALprintCfgChannel"></a>printCfgChannel : <code class="type">Pervasives.out_channel -> <a href="Cil.html#TYPEfundec">Cil.fundec</a> -> unit</code></pre><div class="info"> +print control flow graph (in dot form) for fundec to channel<br> +</div> +<pre><span class="keyword">val</span> <a name="VALprintCfgFilename"></a>printCfgFilename : <code class="type">string -> <a href="Cil.html#TYPEfundec">Cil.fundec</a> -> unit</code></pre><div class="info"> +Print control flow graph (in dot form) for fundec to file<br> +</div> +<pre><span class="keyword">val</span> <a name="VALstart_id"></a>start_id : <code class="type">int Pervasives.ref</code></pre><div class="info"> +Next statement id that will be assigned.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALnodeList"></a>nodeList : <code class="type"><a href="Cil.html#TYPEstmt">Cil.stmt</a> list Pervasives.ref</code></pre><div class="info"> +All of the nodes in a file.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALnumNodes"></a>numNodes : <code class="type">int Pervasives.ref</code></pre><div class="info"> +number of nodes in the CFG<br> +</div> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Cil.cilPrinter.html b/cil/doc/api/Cil.cilPrinter.html new file mode 100644 index 0000000..1b9511f --- /dev/null +++ b/cil/doc/api/Cil.cilPrinter.html @@ -0,0 +1,118 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="previous" href="Cil.cilVisitor.html"> +<link rel="Up" href="Cil.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Cil.cilPrinter</title> +</head> +<body> +<div class="navbar"><a href="Cil.cilVisitor.html">Previous</a> + <a href="Cil.html">Up</a> + </div> +<center><h1>Class type <a href="type_Cil.cilPrinter.html">Cil.cilPrinter</a></h1></center> +<br> +<pre><span class="keyword">class type</span> <a name="TYPEcilPrinter"></a>cilPrinter = <code class="code">object</code> <a href="Cil.cilPrinter.html">..</a> <code class="code">end</code></pre>A printer interface for CIL trees. Create instantiations of + this type by specializing the class <a href="Cil.defaultCilPrinterClass.html"><code class="code">Cil.defaultCilPrinterClass</code></a>.<br> +<hr width="100%"> +<pre><span class="keyword">method</span> <a name="METHODpVDecl"></a>pVDecl : <code class="type">unit -> <a href="Cil.html#TYPEvarinfo">varinfo</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Invoked for each variable declaration. Note that variable + declarations are all the <code class="code">GVar</code>, <code class="code">GVarDecl</code>, <code class="code">GFun</code>, all the <code class="code">varinfo</code> + in formals of function types, and the formals and locals for function + definitions.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODpVar"></a>pVar : <code class="type"><a href="Cil.html#TYPEvarinfo">varinfo</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Invoked on each variable use.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODpLval"></a>pLval : <code class="type">unit -> <a href="Cil.html#TYPElval">lval</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Invoked on each lvalue occurrence<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODpOffset"></a>pOffset : <code class="type"><a href="Pretty.html#TYPEdoc">Pretty.doc</a> -> <a href="Cil.html#TYPEoffset">offset</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Invoked on each offset occurrence. The second argument is the base.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODpInstr"></a>pInstr : <code class="type">unit -> <a href="Cil.html#TYPEinstr">instr</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Invoked on each instruction occurrence.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODpLabel"></a>pLabel : <code class="type">unit -> <a href="Cil.html#TYPElabel">label</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Print a label.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODpStmt"></a>pStmt : <code class="type">unit -> <a href="Cil.html#TYPEstmt">stmt</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Control-flow statement. This is used by + <a href="Cil.html#VALprintGlobal"><code class="code">Cil.printGlobal</code></a> and by <a href="Cil.html#VALdumpGlobal"><code class="code">Cil.dumpGlobal</code></a>.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODdStmt"></a>dStmt : <code class="type">Pervasives.out_channel -> int -> <a href="Cil.html#TYPEstmt">stmt</a> -> unit</code></pre><div class="info"> +Dump a control-flow statement to a file with a given indentation. + This is used by <a href="Cil.html#VALdumpGlobal"><code class="code">Cil.dumpGlobal</code></a>.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODdBlock"></a>dBlock : <code class="type">Pervasives.out_channel -> int -> <a href="Cil.html#TYPEblock">block</a> -> unit</code></pre><div class="info"> +Dump a control-flow block to a file with a given indentation. + This is used by <a href="Cil.html#VALdumpGlobal"><code class="code">Cil.dumpGlobal</code></a>.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODpBlock"></a>pBlock : <code class="type">unit -> <a href="Cil.html#TYPEblock">block</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><pre><span class="keyword">method</span> <a name="METHODpBlock"></a>pBlock : <code class="type">unit -> <a href="Cil.html#TYPEblock">block</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Print a block.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODpGlobal"></a>pGlobal : <code class="type">unit -> <a href="Cil.html#TYPEglobal">global</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Global (vars, types, etc.). This can be slow and is used only by + <a href="Cil.html#VALprintGlobal"><code class="code">Cil.printGlobal</code></a> but not by <a href="Cil.html#VALdumpGlobal"><code class="code">Cil.dumpGlobal</code></a>.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODdGlobal"></a>dGlobal : <code class="type">Pervasives.out_channel -> <a href="Cil.html#TYPEglobal">global</a> -> unit</code></pre><div class="info"> +Dump a global to a file with a given indentation. This is used by + <a href="Cil.html#VALdumpGlobal"><code class="code">Cil.dumpGlobal</code></a><br> +</div> +<pre><span class="keyword">method</span> <a name="METHODpFieldDecl"></a>pFieldDecl : <code class="type">unit -> <a href="Cil.html#TYPEfieldinfo">fieldinfo</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +A field declaration<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODpType"></a>pType : <code class="type"><a href="Pretty.html#TYPEdoc">Pretty.doc</a> option -> unit -> <a href="Cil.html#TYPEtyp">typ</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><pre><span class="keyword">method</span> <a name="METHODpAttr"></a>pAttr : <code class="type"><a href="Cil.html#TYPEattribute">attribute</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a> * bool</code></pre><div class="info"> +Attribute. Also return an indication whether this attribute must be + printed inside the __attribute__ list or not.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODpAttrParam"></a>pAttrParam : <code class="type">unit -> <a href="Cil.html#TYPEattrparam">attrparam</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Attribute parameter<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODpAttrs"></a>pAttrs : <code class="type">unit -> <a href="Cil.html#TYPEattributes">attributes</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Attribute lists<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODpLineDirective"></a>pLineDirective : <code class="type">?forcefile:bool -> <a href="Cil.html#TYPElocation">location</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Print a line-number. This is assumed to come always on an empty line. + If the forcefile argument is present and is true then the file name + will be printed always. Otherwise the file name is printed only if it + is different from the last time time this function is called. The last + file name is stored in a private field inside the cilPrinter object.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODpStmtKind"></a>pStmtKind : <code class="type"><a href="Cil.html#TYPEstmt">stmt</a> -> unit -> <a href="Cil.html#TYPEstmtkind">stmtkind</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Print a statement kind. The code to be printed is given in the + <a href="Cil.html#TYPEstmtkind"><code class="code">Cil.stmtkind</code></a> argument. The initial <a href="Cil.html#TYPEstmt"><code class="code">Cil.stmt</code></a> argument + records the statement which follows the one being printed; + <a href="Cil.defaultCilPrinterClass.html"><code class="code">Cil.defaultCilPrinterClass</code></a> uses this information to prettify + statement printing in certain special cases.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODpExp"></a>pExp : <code class="type">unit -> <a href="Cil.html#TYPEexp">exp</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Print expressions<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODpInit"></a>pInit : <code class="type">unit -> <a href="Cil.html#TYPEinit">init</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Print initializers. This can be slow and is used by + <a href="Cil.html#VALprintGlobal"><code class="code">Cil.printGlobal</code></a> but not by <a href="Cil.html#VALdumpGlobal"><code class="code">Cil.dumpGlobal</code></a>.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODdInit"></a>dInit : <code class="type">Pervasives.out_channel -> int -> <a href="Cil.html#TYPEinit">init</a> -> unit</code></pre><div class="info"> +Dump a global to a file with a given indentation. This is used by + <a href="Cil.html#VALdumpGlobal"><code class="code">Cil.dumpGlobal</code></a><br> +</div> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Cil.cilVisitor.html b/cil/doc/api/Cil.cilVisitor.html new file mode 100644 index 0000000..f8c6496 --- /dev/null +++ b/cil/doc/api/Cil.cilVisitor.html @@ -0,0 +1,125 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="next" href="Cil.cilPrinter.html"> +<link rel="Up" href="Cil.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Cil.cilVisitor</title> +</head> +<body> +<div class="navbar"> <a href="Cil.html">Up</a> + <a href="Cil.cilPrinter.html">Next</a> +</div> +<center><h1>Class type <a href="type_Cil.cilVisitor.html">Cil.cilVisitor</a></h1></center> +<br> +<pre><span class="keyword">class type</span> <a name="TYPEcilVisitor"></a>cilVisitor = <code class="code">object</code> <a href="Cil.cilVisitor.html">..</a> <code class="code">end</code></pre>A visitor interface for traversing CIL trees. Create instantiations of + this type by specializing the class <a href="Cil.nopCilVisitor.html"><code class="code">Cil.nopCilVisitor</code></a>. Each of the + specialized visiting functions can also call the <code class="code">queueInstr</code> to specify + that some instructions should be inserted before the current instruction + or statement. Use syntax like <code class="code">self#queueInstr</code> to call a method + associated with the current object.<br> +<hr width="100%"> +<pre><span class="keyword">method</span> <a name="METHODvvdec"></a>vvdec : <code class="type"><a href="Cil.html#TYPEvarinfo">varinfo</a> -> <a href="Cil.html#TYPEvarinfo">varinfo</a> <a href="Cil.html#TYPEvisitAction">visitAction</a></code></pre><div class="info"> +Invoked for each variable declaration. The subtrees to be traversed + are those corresponding to the type and attributes of the variable. + Note that variable declarations are all the <code class="code">GVar</code>, <code class="code">GVarDecl</code>, <code class="code">GFun</code>, + all the <code class="code">varinfo</code> in formals of function types, and the formals and + locals for function definitions. This means that the list of formals + in a function definition will be traversed twice, once as part of the + function type and second as part of the formals in a function + definition.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODvvrbl"></a>vvrbl : <code class="type"><a href="Cil.html#TYPEvarinfo">varinfo</a> -> <a href="Cil.html#TYPEvarinfo">varinfo</a> <a href="Cil.html#TYPEvisitAction">visitAction</a></code></pre><div class="info"> +Invoked on each variable use. Here only the <code class="code">SkipChildren</code> and + <code class="code">ChangeTo</code> actions make sense since there are no subtrees. Note that + the type and attributes of the variable are not traversed for a + variable use<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODvexpr"></a>vexpr : <code class="type"><a href="Cil.html#TYPEexp">exp</a> -> <a href="Cil.html#TYPEexp">exp</a> <a href="Cil.html#TYPEvisitAction">visitAction</a></code></pre><div class="info"> +Invoked on each expression occurrence. The subtrees are the + subexpressions, the types (for a <code class="code">Cast</code> or <code class="code">SizeOf</code> expression) or the + variable use.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODvlval"></a>vlval : <code class="type"><a href="Cil.html#TYPElval">lval</a> -> <a href="Cil.html#TYPElval">lval</a> <a href="Cil.html#TYPEvisitAction">visitAction</a></code></pre><div class="info"> +Invoked on each lvalue occurrence<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODvoffs"></a>voffs : <code class="type"><a href="Cil.html#TYPEoffset">offset</a> -> <a href="Cil.html#TYPEoffset">offset</a> <a href="Cil.html#TYPEvisitAction">visitAction</a></code></pre><div class="info"> +Invoked on each offset occurrence that is *not* as part + of an initializer list specification, i.e. in an lval or + recursively inside an offset.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODvinitoffs"></a>vinitoffs : <code class="type"><a href="Cil.html#TYPEoffset">offset</a> -> <a href="Cil.html#TYPEoffset">offset</a> <a href="Cil.html#TYPEvisitAction">visitAction</a></code></pre><div class="info"> +Invoked on each offset appearing in the list of a + CompoundInit initializer.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODvinst"></a>vinst : <code class="type"><a href="Cil.html#TYPEinstr">instr</a> -> <a href="Cil.html#TYPEinstr">instr</a> list <a href="Cil.html#TYPEvisitAction">visitAction</a></code></pre><div class="info"> +Invoked on each instruction occurrence. The <code class="code">ChangeTo</code> action can + replace this instruction with a list of instructions<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODvstmt"></a>vstmt : <code class="type"><a href="Cil.html#TYPEstmt">stmt</a> -> <a href="Cil.html#TYPEstmt">stmt</a> <a href="Cil.html#TYPEvisitAction">visitAction</a></code></pre><div class="info"> +Control-flow statement. The default <code class="code">DoChildren</code> action does not + create a new statement when the components change. Instead it updates + the contents of the original statement. This is done to preserve the + sharing with <code class="code">Goto</code> and <code class="code">Case</code> statements that point to the original + statement. If you use the <code class="code">ChangeTo</code> action then you should take care + of preserving that sharing yourself.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODvblock"></a>vblock : <code class="type"><a href="Cil.html#TYPEblock">block</a> -> <a href="Cil.html#TYPEblock">block</a> <a href="Cil.html#TYPEvisitAction">visitAction</a></code></pre><div class="info"> +Block.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODvfunc"></a>vfunc : <code class="type"><a href="Cil.html#TYPEfundec">fundec</a> -> <a href="Cil.html#TYPEfundec">fundec</a> <a href="Cil.html#TYPEvisitAction">visitAction</a></code></pre><div class="info"> +Function definition. + Replaced in place.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODvglob"></a>vglob : <code class="type"><a href="Cil.html#TYPEglobal">global</a> -> <a href="Cil.html#TYPEglobal">global</a> list <a href="Cil.html#TYPEvisitAction">visitAction</a></code></pre><div class="info"> +Global (vars, types, + etc.)<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODvinit"></a>vinit : <code class="type"><a href="Cil.html#TYPEinit">init</a> -> <a href="Cil.html#TYPEinit">init</a> <a href="Cil.html#TYPEvisitAction">visitAction</a></code></pre><div class="info"> +Initializers for globals<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODvtype"></a>vtype : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEtyp">typ</a> <a href="Cil.html#TYPEvisitAction">visitAction</a></code></pre><div class="info"> +Use of some type. Note + that for structure/union + and enumeration types the + definition of the + composite type is not + visited. Use <code class="code">vglob</code> to + visit it.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODvattr"></a>vattr : <code class="type"><a href="Cil.html#TYPEattribute">attribute</a> -> <a href="Cil.html#TYPEattribute">attribute</a> list <a href="Cil.html#TYPEvisitAction">visitAction</a></code></pre><div class="info"> +Attribute. Each attribute can be replaced by a list<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODvattrparam"></a>vattrparam : <code class="type"><a href="Cil.html#TYPEattrparam">attrparam</a> -> <a href="Cil.html#TYPEattrparam">attrparam</a> <a href="Cil.html#TYPEvisitAction">visitAction</a></code></pre><div class="info"> +Attribute parameters.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODqueueInstr"></a>queueInstr : <code class="type"><a href="Cil.html#TYPEinstr">instr</a> list -> unit</code></pre><div class="info"> +Add here instructions while visiting to queue them to preceede the + current statement or instruction being processed. Use this method only + when you are visiting an expression that is inside a function body, or + a statement, because otherwise there will no place for the visitor to + place your instructions.<br> +</div> +<pre><span class="keyword">method</span> <a name="METHODunqueueInstr"></a>unqueueInstr : <code class="type">unit -> <a href="Cil.html#TYPEinstr">instr</a> list</code></pre><div class="info"> +Gets the queue of instructions and resets the queue. This is done + automatically for you when you visit statments.<br> +</div> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Cil.defaultCilPrinterClass.html b/cil/doc/api/Cil.defaultCilPrinterClass.html new file mode 100644 index 0000000..d859559 --- /dev/null +++ b/cil/doc/api/Cil.defaultCilPrinterClass.html @@ -0,0 +1,36 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="previous" href="Cil.nopCilVisitor.html"> +<link rel="next" href="Cil.plainCilPrinterClass.html"> +<link rel="Up" href="Cil.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Cil.defaultCilPrinterClass</title> +</head> +<body> +<div class="navbar"><a href="Cil.nopCilVisitor.html">Previous</a> + <a href="Cil.html">Up</a> + <a href="Cil.plainCilPrinterClass.html">Next</a> +</div> +<center><h1>Class <a href="type_Cil.defaultCilPrinterClass.html">Cil.defaultCilPrinterClass</a></h1></center> +<br> +<pre><span class="keyword">class</span> <a name="TYPEdefaultCilPrinterClass"></a>defaultCilPrinterClass : <code class="type"></code><code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a></code></pre><hr width="100%"> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Cil.html b/cil/doc/api/Cil.html new file mode 100644 index 0000000..f2e09c2 --- /dev/null +++ b/cil/doc/api/Cil.html @@ -0,0 +1,3337 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="previous" href="Stats.html"> +<link rel="next" href="Formatcil.html"> +<link rel="Up" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Cil</title> +</head> +<body> +<div class="navbar"><a href="Stats.html">Previous</a> + <a href="index.html">Up</a> + <a href="Formatcil.html">Next</a> +</div> +<center><h1>Module <a href="type_Cil.html">Cil</a></h1></center> +<br> +<pre><span class="keyword">module</span> Cil: <code class="code">sig</code> <a href="Cil.html">..</a> <code class="code">end</code></pre>CIL API Documentation. An html version of this document can be found at + http://manju.cs.berkeley.edu/cil.<br> +<hr width="100%"> +<pre><span class="keyword">val</span> <a name="VALinitCIL"></a>initCIL : <code class="type">unit -> unit</code></pre><div class="info"> +Call this function to perform some initialization. Call if after you have + set <a href="Cil.html#VALmsvcMode"><code class="code">Cil.msvcMode</code></a>.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcilVersion"></a>cilVersion : <code class="type">string</code></pre><div class="info"> +This are the CIL version numbers. A CIL version is a number of the form + M.m.r (major, minor and release)<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcilVersionMajor"></a>cilVersionMajor : <code class="type">int</code></pre><pre><span class="keyword">val</span> <a name="VALcilVersionMinor"></a>cilVersionMinor : <code class="type">int</code></pre><pre><span class="keyword">val</span> <a name="VALcilVersionRevision"></a>cilVersionRevision : <code class="type">int</code></pre><br> +This module defines the abstract syntax of CIL. It also provides utility + functions for traversing the CIL data structures, and pretty-printing + them. The parser for both the GCC and MSVC front-ends can be invoked as + <code class="code">Frontc.parse: string -> unit -></code> <a href="Cil.html#TYPEfile"><code class="code">Cil.file</code></a>. This function must be given + the name of a preprocessed C file and will return the top-level data + structure that describes a whole source file. By default the parsing and + elaboration into CIL is done as for GCC source. If you want to use MSVC + source you must set the <a href="Cil.html#VALmsvcMode"><code class="code">Cil.msvcMode</code></a> to <code class="code">true</code> and must also invoke the + function <code class="code">Frontc.setMSVCMode: unit -> unit</code>.<br> +<br> +<b>The Abstract Syntax of CIL</b><br> +<br> +The top-level representation of a CIL source file (and the result of the + parsing and elaboration). Its main contents is the list of global + declarations and definitions. You can iterate over the globals in a + <a href="Cil.html#TYPEfile"><code class="code">Cil.file</code></a> using the following iterators: <a href="Cil.html#VALmapGlobals"><code class="code">Cil.mapGlobals</code></a>, + <a href="Cil.html#VALiterGlobals"><code class="code">Cil.iterGlobals</code></a> and <a href="Cil.html#VALfoldGlobals"><code class="code">Cil.foldGlobals</code></a>. You can also use the + <a href="Cil.html#VALdummyFile"><code class="code">Cil.dummyFile</code></a> when you need a <a href="Cil.html#TYPEfile"><code class="code">Cil.file</code></a> as a placeholder. For each + global item CIL stores the source location where it appears (using the + type <a href="Cil.html#TYPElocation"><code class="code">Cil.location</code></a>)<br> +<br><code><span class="keyword">type</span> <a name="TYPEfile"></a><code class="type"></code>file = {</code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>fileName : <code class="type">string</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The complete file name</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>globals : <code class="type"><a href="Cil.html#TYPEglobal">global</a> list</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>List of globals as they will appear + in the printed file</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>globinit : <code class="type"><a href="Cil.html#TYPEfundec">fundec</a> option</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>An optional global initializer function. This is a function where + you can put stuff that must be executed before the program is + started. This function, is conceptually at the end of the file, + although it is not part of the globals list. Use <a href="Cil.html#VALgetGlobInit"><code class="code">Cil.getGlobInit</code></a> + to create/get one.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>globinitcalled : <code class="type">bool</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Whether the global initialization function is called in main. This + should always be false if there is no global initializer. When you + create a global initialization CIL will try to insert code in main + to call it. This will not happen if your file does not contain a + function called "main"</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> +} + +<div class="info"> +Top-level representation of a C source file<br> +</div> + +<pre><span class="keyword">type</span> <a name="TYPEcomment"></a><code class="type"></code>comment = <code class="type"><a href="Cil.html#TYPElocation">location</a> * string</code> </pre> + +<br> +<b>Globals</b>. The main type for representing global declarations and + definitions. A list of these form a CIL file. The order of globals in the + file is generally important.<br> +<br><code><span class="keyword">type</span> <a name="TYPEglobal"></a><code class="type"></code>global = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">GType</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtypeinfo">typeinfo</a> * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A typedef. All uses of type names (through the <code class="code">TNamed</code> constructor) + must be preceded in the file by a definition of the name. The string + is the defined name and always not-empty.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">GCompTag</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEcompinfo">compinfo</a> * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Defines a struct/union tag with some fields. There must be one of + these for each struct/union tag that you use (through the <code class="code">TComp</code> + constructor) since this is the only context in which the fields are + printed. Consequently nested structure tag definitions must be + broken into individual definitions with the innermost structure + defined first.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">GCompTagDecl</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEcompinfo">compinfo</a> * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Declares a struct/union tag. Use as a forward declaration. This is + printed without the fields.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">GEnumTag</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEenuminfo">enuminfo</a> * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Declares an enumeration tag with some fields. There must be one of + these for each enumeration tag that you use (through the <code class="code">TEnum</code> + constructor) since this is the only context in which the items are + printed.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">GEnumTagDecl</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEenuminfo">enuminfo</a> * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Declares an enumeration tag. Use as a forward declaration. This is + printed without the items.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">GVarDecl</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEvarinfo">varinfo</a> * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A variable declaration (not a definition). If the variable has a + function type then this is a prototype. There can be several + declarations and at most one definition for a given variable. If both + forms appear then they must share the same varinfo structure. A + prototype shares the varinfo with the fundec of the definition. Either + has storage Extern or there must be a definition in this file</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">GVar</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEvarinfo">varinfo</a> * <a href="Cil.html#TYPEinitinfo">initinfo</a> * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A variable definition. Can have an initializer. The initializer is + updateable so that you can change it without requiring to recreate + the list of globals. There can be at most one definition for a + variable in an entire program. Cannot have storage Extern or function + type.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">GFun</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEfundec">fundec</a> * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A function definition.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">GAsm</span> <span class="keyword">of</span> <code class="type">string * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Global asm statement. These ones + can contain only a template</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">GPragma</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEattribute">attribute</a> * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Pragmas at top level. Use the same + syntax as attributes</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">GText</span> <span class="keyword">of</span> <code class="type">string</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Some text (printed verbatim) at + top level. E.g., this way you can + put comments in the output.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + +<div class="info"> +A global declaration or definition<br> +</div> + +<br> +<b>Types</b>. A C type is represented in CIL using the type <a href="Cil.html#TYPEtyp"><code class="code">Cil.typ</code></a>. + Among types we differentiate the integral types (with different kinds + denoting the sign and precision), floating point types, enumeration types, + array and pointer types, and function types. Every type is associated with + a list of attributes, which are always kept in sorted order. Use + <a href="Cil.html#VALaddAttribute"><code class="code">Cil.addAttribute</code></a> and <a href="Cil.html#VALaddAttributes"><code class="code">Cil.addAttributes</code></a> to construct list of + attributes. If you want to inspect a type, you should use + <a href="Cil.html#VALunrollType"><code class="code">Cil.unrollType</code></a> or <a href="Cil.html#VALunrollTypeDeep"><code class="code">Cil.unrollTypeDeep</code></a> to see through the uses of + named types.<br> +<br> +CIL is configured at build-time with the sizes and alignments of the + underlying compiler (GCC or MSVC). CIL contains functions that can compute + the size of a type (in bits) <a href="Cil.html#VALbitsSizeOf"><code class="code">Cil.bitsSizeOf</code></a>, the alignment of a type + (in bytes) <a href="Cil.html#VALalignOf_int"><code class="code">Cil.alignOf_int</code></a>, and can convert an offset into a start and + width (both in bits) using the function <a href="Cil.html#VALbitsOffset"><code class="code">Cil.bitsOffset</code></a>. At the moment + these functions do not take into account the <code class="code">packed</code> attributes and + pragmas.<br> +<br><code><span class="keyword">type</span> <a name="TYPEtyp"></a><code class="type"></code>typ = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TVoid</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEattributes">attributes</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Void type. Also predefined as <a href="Cil.html#VALvoidType"><code class="code">Cil.voidType</code></a></code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TInt</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEikind">ikind</a> * <a href="Cil.html#TYPEattributes">attributes</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>An integer type. The kind specifies the sign and width. Several + useful variants are predefined as <a href="Cil.html#VALintType"><code class="code">Cil.intType</code></a>, <a href="Cil.html#VALuintType"><code class="code">Cil.uintType</code></a>, + <a href="Cil.html#VALlongType"><code class="code">Cil.longType</code></a>, <a href="Cil.html#VALcharType"><code class="code">Cil.charType</code></a>.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TFloat</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEfkind">fkind</a> * <a href="Cil.html#TYPEattributes">attributes</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A floating-point type. The kind specifies the precision. You can + also use the predefined constant <a href="Cil.html#VALdoubleType"><code class="code">Cil.doubleType</code></a>.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TPtr</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtyp">typ</a> * <a href="Cil.html#TYPEattributes">attributes</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Pointer type. Several useful variants are predefined as + <a href="Cil.html#VALcharPtrType"><code class="code">Cil.charPtrType</code></a>, <a href="Cil.html#VALcharConstPtrType"><code class="code">Cil.charConstPtrType</code></a> (pointer to a + constant character), <a href="Cil.html#VALvoidPtrType"><code class="code">Cil.voidPtrType</code></a>, + <a href="Cil.html#VALintPtrType"><code class="code">Cil.intPtrType</code></a></code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TArray</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtyp">typ</a> * <a href="Cil.html#TYPEexp">exp</a> option * <a href="Cil.html#TYPEattributes">attributes</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Array type. It indicates the base type and the array length.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TFun</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtyp">typ</a> * (string * <a href="Cil.html#TYPEtyp">typ</a> * <a href="Cil.html#TYPEattributes">attributes</a>) list option * bool<br> * <a href="Cil.html#TYPEattributes">attributes</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Function type. Indicates the type of the result, the name, type + and name attributes of the formal arguments (<code class="code">None</code> if no + arguments were specified, as in a function whose definition or + prototype we have not seen; <code class="code">Some []</code> means void). Use + <a href="Cil.html#VALargsToList"><code class="code">Cil.argsToList</code></a> to obtain a list of arguments. The boolean + indicates if it is a variable-argument function. If this is the + type of a varinfo for which we have a function declaration then + the information for the formals must match that in the + function's sformals. Use <a href="Cil.html#VALsetFormals"><code class="code">Cil.setFormals</code></a>, or + <a href="Cil.html#VALsetFunctionType"><code class="code">Cil.setFunctionType</code></a>, or <a href="Cil.html#VALmakeFormalVar"><code class="code">Cil.makeFormalVar</code></a> for this + purpose.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TNamed</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtypeinfo">typeinfo</a> * <a href="Cil.html#TYPEattributes">attributes</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TComp</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEcompinfo">compinfo</a> * <a href="Cil.html#TYPEattributes">attributes</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The most delicate issue for C types is that recursion that is possible by + using structures and pointers. To address this issue we have a more + complex representation for structured types (struct and union). Each such + type is represented using the <a href="Cil.html#TYPEcompinfo"><code class="code">Cil.compinfo</code></a> type. For each composite + type the <a href="Cil.html#TYPEcompinfo"><code class="code">Cil.compinfo</code></a> structure must be declared at top level using + <code class="code">GCompTag</code> and all references to it must share the same copy of the + structure. The attributes given are those pertaining to this use of the + type and are in addition to the attributes that were given at the + definition of the type and which are stored in the <a href="Cil.html#TYPEcompinfo"><code class="code">Cil.compinfo</code></a>.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TEnum</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEenuminfo">enuminfo</a> * <a href="Cil.html#TYPEattributes">attributes</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A reference to an enumeration type. All such references must + share the enuminfo among them and with a <code class="code">GEnumTag</code> global that + precedes all uses. The attributes refer to this use of the + enumeration and are in addition to the attributes of the + enumeration itself, which are stored inside the enuminfo</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TBuiltin_va_list</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEattributes">attributes</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>This is the same as the gcc's type with the same name</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + + +<br> +There are a number of functions for querying the kind of a type. These are + <a href="Cil.html#VALisIntegralType"><code class="code">Cil.isIntegralType</code></a>, + <a href="Cil.html#VALisArithmeticType"><code class="code">Cil.isArithmeticType</code></a>, + <a href="Cil.html#VALisPointerType"><code class="code">Cil.isPointerType</code></a>, + <a href="Cil.html#VALisFunctionType"><code class="code">Cil.isFunctionType</code></a>, + <a href="Cil.html#VALisArrayType"><code class="code">Cil.isArrayType</code></a>. +<p> + + There are two easy ways to scan a type. First, you can use the +<a href="Cil.html#VALexistsType"><code class="code">Cil.existsType</code></a> to return a boolean answer about a type. This function +is controlled by a user-provided function that is queried for each type that is +used to construct the current type. The function can specify whether to +terminate the scan with a boolean result or to continue the scan for the +nested types. +<p> + + The other method for scanning types is provided by the visitor interface (see + <a href="Cil.cilVisitor.html"><code class="code">Cil.cilVisitor</code></a>). +<p> + + If you want to compare types (or to use them as hash-values) then you should +use instead type signatures (represented as <a href="Cil.html#TYPEtypsig"><code class="code">Cil.typsig</code></a>). These +contain the same information as types but canonicalized such that simple Ocaml +structural equality will tell whether two types are equal. Use +<a href="Cil.html#VALtypeSig"><code class="code">Cil.typeSig</code></a> to compute the signature of a type. If you want to ignore +certain type attributes then use <a href="Cil.html#VALtypeSigWithAttrs"><code class="code">Cil.typeSigWithAttrs</code></a>.<br> +<br><code><span class="keyword">type</span> <a name="TYPEikind"></a><code class="type"></code>ikind = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">IChar</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code><code class="code">char</code></code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">ISChar</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code><code class="code">signed char</code></code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">IUChar</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code><code class="code">unsigned char</code></code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">IInt</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code><code class="code">int</code></code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">IUInt</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code><code class="code">unsigned int</code></code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">IShort</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code><code class="code">short</code></code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">IUShort</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code><code class="code">unsigned short</code></code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">ILong</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code><code class="code">long</code></code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">IULong</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code><code class="code">unsigned long</code></code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">ILongLong</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code><code class="code">long long</code> (or <code class="code">_int64</code> on Microsoft Visual C)</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">IULongLong</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code><code class="code">unsigned long long</code> (or <code class="code">unsigned _int64</code> on Microsoft + Visual C)</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + +<div class="info"> +Various kinds of integers<br> +</div> + +<br><code><span class="keyword">type</span> <a name="TYPEfkind"></a><code class="type"></code>fkind = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">FFloat</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code><code class="code">float</code></code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">FDouble</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code><code class="code">double</code></code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">FLongDouble</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code><code class="code">long double</code></code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + +<div class="info"> +Various kinds of floating-point numbers<br> +</div> + +<br> +<b>Attributes.</b><br> +<br><code><span class="keyword">type</span> <a name="TYPEattribute"></a><code class="type"></code>attribute = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Attr</span> <span class="keyword">of</span> <code class="type">string * <a href="Cil.html#TYPEattrparam">attrparam</a> list</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>An attribute has a name and some optional parameters. The name should not + start or end with underscore. When CIL parses attribute names it will + strip leading and ending underscores (to ensure that the multitude of GCC + attributes such as const, __const and __const__ all mean the same thing.)</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + + +<pre><span class="keyword">type</span> <a name="TYPEattributes"></a><code class="type"></code>attributes = <code class="type"><a href="Cil.html#TYPEattribute">attribute</a> list</code> </pre> +<div class="info"> +Attributes are lists sorted by the attribute name. Use the functions + <a href="Cil.html#VALaddAttribute"><code class="code">Cil.addAttribute</code></a> and <a href="Cil.html#VALaddAttributes"><code class="code">Cil.addAttributes</code></a> to insert attributes in an + attribute list and maintain the sortedness.<br> +</div> + +<br><code><span class="keyword">type</span> <a name="TYPEattrparam"></a><code class="type"></code>attrparam = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">AInt</span> <span class="keyword">of</span> <code class="type">int</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>An integer constant</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">AStr</span> <span class="keyword">of</span> <code class="type">string</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A string constant</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">ACons</span> <span class="keyword">of</span> <code class="type">string * <a href="Cil.html#TYPEattrparam">attrparam</a> list</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Constructed attributes. These + are printed <code class="code">foo(a1,a2,...,an)</code>. + The list of parameters can be + empty and in that case the + parentheses are not printed.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">ASizeOf</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A way to talk about types</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">ASizeOfE</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEattrparam">attrparam</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">ASizeOfS</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtypsig">typsig</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Replacement for ASizeOf in type + signatures. Only used for + attributes inside typsigs.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">AAlignOf</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">AAlignOfE</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEattrparam">attrparam</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">AAlignOfS</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtypsig">typsig</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">AUnOp</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEunop">unop</a> * <a href="Cil.html#TYPEattrparam">attrparam</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">ABinOp</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEbinop">binop</a> * <a href="Cil.html#TYPEattrparam">attrparam</a> * <a href="Cil.html#TYPEattrparam">attrparam</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">ADot</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEattrparam">attrparam</a> * string</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>a.foo *</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + +<div class="info"> +The type of parameters of attributes<br> +</div> + +<br> +<b>Structures.</b> The <a href="Cil.html#TYPEcompinfo"><code class="code">Cil.compinfo</code></a> describes the definition of a + structure or union type. Each such <a href="Cil.html#TYPEcompinfo"><code class="code">Cil.compinfo</code></a> must be defined at the + top-level using the <code class="code">GCompTag</code> constructor and must be shared by all + references to this type (using either the <code class="code">TComp</code> type constructor or from + the definition of the fields. +<p> + + If all you need is to scan the definition of each + composite type once, you can do that by scanning all top-level <code class="code">GCompTag</code>. +<p> + + Constructing a <a href="Cil.html#TYPEcompinfo"><code class="code">Cil.compinfo</code></a> can be tricky since it must contain fields + that might refer to the host <a href="Cil.html#TYPEcompinfo"><code class="code">Cil.compinfo</code></a> and furthermore the type of + the field might need to refer to the <a href="Cil.html#TYPEcompinfo"><code class="code">Cil.compinfo</code></a> for recursive types. + Use the <a href="Cil.html#VALmkCompInfo"><code class="code">Cil.mkCompInfo</code></a> function to create a <a href="Cil.html#TYPEcompinfo"><code class="code">Cil.compinfo</code></a>. You can + easily fetch the <a href="Cil.html#TYPEfieldinfo"><code class="code">Cil.fieldinfo</code></a> for a given field in a structure with + <a href="Cil.html#VALgetCompField"><code class="code">Cil.getCompField</code></a>.<br> +<br><code><span class="keyword">type</span> <a name="TYPEcompinfo"></a><code class="type"></code>compinfo = {</code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>cstruct : <code class="type">bool</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>True if struct, False if union</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>cname : <code class="type">string</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The name. Always non-empty. Use <a href="Cil.html#VALcompFullName"><code class="code">Cil.compFullName</code></a> to get the full + name of a comp (along with the struct or union)</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>ckey : <code class="type">int</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A unique integer. This is assigned by <a href="Cil.html#VALmkCompInfo"><code class="code">Cil.mkCompInfo</code></a> using a + global variable in the Cil module. Thus two identical structs in two + different files might have different keys. Use <a href="Cil.html#VALcopyCompInfo"><code class="code">Cil.copyCompInfo</code></a> to + copy structures so that a new key is assigned.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>cfields : <code class="type"><a href="Cil.html#TYPEfieldinfo">fieldinfo</a> list</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Information about the fields. Notice that each fieldinfo has a + pointer back to the host compinfo. This means that you should not + share fieldinfo's between two compinfo's</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>cattr : <code class="type"><a href="Cil.html#TYPEattributes">attributes</a></code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The attributes that are defined at the same time as the composite + type. These attributes can be supplemented individually at each + reference to this <code class="code">compinfo</code> using the <code class="code">TComp</code> type constructor.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>cdefined : <code class="type">bool</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>This boolean flag can be used to distinguish between structures + that have not been defined and those that have been defined but have + no fields (such things are allowed in gcc).</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>creferenced : <code class="type">bool</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>True if used. Initially set to false.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> +} + +<div class="info"> +The definition of a structure or union type. Use <a href="Cil.html#VALmkCompInfo"><code class="code">Cil.mkCompInfo</code></a> to + make one and use <a href="Cil.html#VALcopyCompInfo"><code class="code">Cil.copyCompInfo</code></a> to copy one (this ensures that a new + key is assigned and that the fields have the right pointers to parents.).<br> +</div> + +<br> +<b>Structure fields.</b> The <a href="Cil.html#TYPEfieldinfo"><code class="code">Cil.fieldinfo</code></a> structure is used to describe + a structure or union field. Fields, just like variables, can have + attributes associated with the field itself or associated with the type of + the field (stored along with the type of the field).<br> +<br><code><span class="keyword">type</span> <a name="TYPEfieldinfo"></a><code class="type"></code>fieldinfo = {</code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>fcomp : <code class="type"><a href="Cil.html#TYPEcompinfo">compinfo</a></code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The host structure that contains this field. There can be only one + <code class="code">compinfo</code> that contains the field.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>fname : <code class="type">string</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The name of the field. Might be the value of <a href="Cil.html#VALmissingFieldName"><code class="code">Cil.missingFieldName</code></a> + in which case it must be a bitfield and is not printed and it does not + participate in initialization</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>ftype : <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The type</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>fbitfield : <code class="type">int option</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>If a bitfield then ftype should be an integer type and the width of + the bitfield must be 0 or a positive integer smaller or equal to the + width of the integer type. A field of width 0 is used in C to control + the alignment of fields.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>fattr : <code class="type"><a href="Cil.html#TYPEattributes">attributes</a></code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The attributes for this field (not for its type)</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>floc : <code class="type"><a href="Cil.html#TYPElocation">location</a></code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The location where this field is defined</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> +} + +<div class="info"> +Information about a struct/union field<br> +</div> + +<br> +<b>Enumerations.</b> Information about an enumeration. This is shared by all + references to an enumeration. Make sure you have a <code class="code">GEnumTag</code> for each of + of these.<br> +<br><code><span class="keyword">type</span> <a name="TYPEenuminfo"></a><code class="type"></code>enuminfo = {</code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>ename : <code class="type">string</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The name. Always non-empty.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>eitems : <code class="type">(string * <a href="Cil.html#TYPEexp">exp</a> * <a href="Cil.html#TYPElocation">location</a>) list</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Items with names and values. This list should be non-empty. The item + values must be compile-time constants.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>eattr : <code class="type"><a href="Cil.html#TYPEattributes">attributes</a></code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The attributes that are defined at the same time as the enumeration + type. These attributes can be supplemented individually at each + reference to this <code class="code">enuminfo</code> using the <code class="code">TEnum</code> type constructor.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>ereferenced : <code class="type">bool</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>True if used. Initially set to false</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> +} + +<div class="info"> +Information about an enumeration<br> +</div> + +<br> +<b>Enumerations.</b> Information about an enumeration. This is shared by all + references to an enumeration. Make sure you have a <code class="code">GEnumTag</code> for each of + of these.<br> +<br><code><span class="keyword">type</span> <a name="TYPEtypeinfo"></a><code class="type"></code>typeinfo = {</code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>tname : <code class="type">string</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The name. Can be empty only in a <code class="code">GType</code> when introducing a composite + or enumeration tag. If empty cannot be referred to from the file</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>ttype : <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The actual type. This includes the attributes that were present in + the typedef</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>treferenced : <code class="type">bool</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>True if used. Initially set to false</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> +} + +<div class="info"> +Information about a defined type<br> +</div> + +<br> +<b>Variables.</b> + Each local or global variable is represented by a unique <a href="Cil.html#TYPEvarinfo"><code class="code">Cil.varinfo</code></a> +structure. A global <a href="Cil.html#TYPEvarinfo"><code class="code">Cil.varinfo</code></a> can be introduced with the <code class="code">GVarDecl</code> or +<code class="code">GVar</code> or <code class="code">GFun</code> globals. A local varinfo can be introduced as part of a +function definition <a href="Cil.html#TYPEfundec"><code class="code">Cil.fundec</code></a>. +<p> + + All references to a given global or local variable must refer to the same +copy of the <code class="code">varinfo</code>. Each <code class="code">varinfo</code> has a globally unique identifier that +can be used to index maps and hashtables (the name can also be used for this +purpose, except for locals from different functions). This identifier is +constructor using a global counter. +<p> + + It is very important that you construct <code class="code">varinfo</code> structures using only one + of the following functions:<ul> +<li><a href="Cil.html#VALmakeGlobalVar"><code class="code">Cil.makeGlobalVar</code></a> : to make a global variable</li> +<li><a href="Cil.html#VALmakeTempVar"><code class="code">Cil.makeTempVar</code></a> : to make a temporary local variable whose name +will be generated so that to avoid conflict with other locals. </li> +<li><a href="Cil.html#VALmakeLocalVar"><code class="code">Cil.makeLocalVar</code></a> : like <a href="Cil.html#VALmakeTempVar"><code class="code">Cil.makeTempVar</code></a> but you can specify the +exact name to be used. </li> +<li><a href="Cil.html#VALcopyVarinfo"><code class="code">Cil.copyVarinfo</code></a>: make a shallow copy of a varinfo assigning a new name +and a new unique identifier</li> +</ul> + + A <code class="code">varinfo</code> is also used in a function type to denote the list of formals.<br> +<br><code><span class="keyword">type</span> <a name="TYPEvarinfo"></a><code class="type"></code>varinfo = {</code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>vname : <code class="type">string</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The name of the variable. Cannot be empty. It is primarily your + responsibility to ensure the uniqueness of a variable name. For local + variables <a href="Cil.html#VALmakeTempVar"><code class="code">Cil.makeTempVar</code></a> helps you ensure that the name is unique.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>vtype : <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The declared type of the variable.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>vattr : <code class="type"><a href="Cil.html#TYPEattributes">attributes</a></code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A list of attributes associated with the variable.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>vstorage : <code class="type"><a href="Cil.html#TYPEstorage">storage</a></code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The storage-class</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>vglob : <code class="type">bool</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>True if this is a global variable</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>vinline : <code class="type">bool</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Whether this varinfo is for an inline function.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>vdecl : <code class="type"><a href="Cil.html#TYPElocation">location</a></code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Location of variable declaration.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>vid : <code class="type">int</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A unique integer identifier. This field will be + set for you if you use one of the <a href="Cil.html#VALmakeFormalVar"><code class="code">Cil.makeFormalVar</code></a>, + <a href="Cil.html#VALmakeLocalVar"><code class="code">Cil.makeLocalVar</code></a>, <a href="Cil.html#VALmakeTempVar"><code class="code">Cil.makeTempVar</code></a>, <a href="Cil.html#VALmakeGlobalVar"><code class="code">Cil.makeGlobalVar</code></a>, or + <a href="Cil.html#VALcopyVarinfo"><code class="code">Cil.copyVarinfo</code></a>.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>vaddrof : <code class="type">bool</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>True if the address of this variable is taken. CIL will set these + flags when it parses C, but you should make sure to set the flag + whenever your transformation create <code class="code">AddrOf</code> expression.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>vreferenced : <code class="type">bool</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>True if this variable is ever referenced. This is computed by + <code class="code">removeUnusedVars</code>. It is safe to just initialize this to False</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> +} + +<div class="info"> +Information about a variable.<br> +</div> + +<br><code><span class="keyword">type</span> <a name="TYPEstorage"></a><code class="type"></code>storage = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">NoStorage</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The default storage. Nothing is printed</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Static</span></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Register</span></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Extern</span></code></td> + +</tr></table> + +<div class="info"> +Storage-class information<br> +</div> + +<br> +<b>Expressions.</b> The CIL expression language contains only the side-effect free expressions of +C. They are represented as the type <a href="Cil.html#TYPEexp"><code class="code">Cil.exp</code></a>. There are several +interesting aspects of CIL expressions: +<p> + + Integer and floating point constants can carry their textual representation. +This way the integer 15 can be printed as 0xF if that is how it occurred in the +source. +<p> + + CIL uses 64 bits to represent the integer constants and also stores the width +of the integer type. Care must be taken to ensure that the constant is +representable with the given width. Use the functions <a href="Cil.html#VALkinteger"><code class="code">Cil.kinteger</code></a>, +<a href="Cil.html#VALkinteger64"><code class="code">Cil.kinteger64</code></a> and <a href="Cil.html#VALinteger"><code class="code">Cil.integer</code></a> to construct constant +expressions. CIL predefines the constants <a href="Cil.html#VALzero"><code class="code">Cil.zero</code></a>, +<a href="Cil.html#VALone"><code class="code">Cil.one</code></a> and <a href="Cil.html#VALmone"><code class="code">Cil.mone</code></a> (for -1). +<p> + + Use the functions <a href="Cil.html#VALisConstant"><code class="code">Cil.isConstant</code></a> and <a href="Cil.html#VALisInteger"><code class="code">Cil.isInteger</code></a> to test if +an expression is a constant and a constant integer respectively. +<p> + + CIL keeps the type of all unary and binary expressions. You can think of that +type qualifying the operator. Furthermore there are different operators for +arithmetic and comparisons on arithmetic types and on pointers. +<p> + + Another unusual aspect of CIL is that the implicit conversion between an +expression of array type and one of pointer type is made explicit, using the +<code class="code">StartOf</code> expression constructor (which is not printed). If you apply the +<code class="code">AddrOf}</code>constructor to an lvalue of type <code class="code">T</code> then you will be getting an +expression of type <code class="code">TPtr(T)</code>. +<p> + + You can find the type of an expression with <a href="Cil.html#VALtypeOf"><code class="code">Cil.typeOf</code></a>. +<p> + + You can perform constant folding on expressions using the function +<a href="Cil.html#VALconstFold"><code class="code">Cil.constFold</code></a>.<br> +<br><code><span class="keyword">type</span> <a name="TYPEexp"></a><code class="type"></code>exp = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Const</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEconstant">constant</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Constant</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Lval</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPElval">lval</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Lvalue</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">SizeOf</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>sizeof(<type>). Has <code class="code">unsigned int</code> type (ISO 6.5.3.4). This is not + turned into a constant because some transformations might want to + change types</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">SizeOfE</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEexp">exp</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>sizeof(<expression>)</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">SizeOfStr</span> <span class="keyword">of</span> <code class="type">string</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>sizeof(string_literal). We separate this case out because this is the + only instance in which a string literal should not be treated as + having type pointer to character.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">AlignOf</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>This corresponds to the GCC __alignof_. Has <code class="code">unsigned int</code> type</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">AlignOfE</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEexp">exp</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">UnOp</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEunop">unop</a> * <a href="Cil.html#TYPEexp">exp</a> * <a href="Cil.html#TYPEtyp">typ</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Unary operation. Includes the type of the result.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">BinOp</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEbinop">binop</a> * <a href="Cil.html#TYPEexp">exp</a> * <a href="Cil.html#TYPEexp">exp</a> * <a href="Cil.html#TYPEtyp">typ</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Binary operation. Includes the type of the result. The arithmetic + conversions are made explicit for the arguments.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">CastE</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtyp">typ</a> * <a href="Cil.html#TYPEexp">exp</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Use <a href="Cil.html#VALmkCast"><code class="code">Cil.mkCast</code></a> to make casts.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">AddrOf</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPElval">lval</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Always use <a href="Cil.html#VALmkAddrOf"><code class="code">Cil.mkAddrOf</code></a> to construct one of these. Apply to an + lvalue of type <code class="code">T</code> yields an expression of type <code class="code">TPtr(T)</code></code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">StartOf</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPElval">lval</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Conversion from an array to a pointer to the beginning of the array. + Given an lval of type <code class="code">TArray(T)</code> produces an expression of type + <code class="code">TPtr(T)</code>. In C this operation is implicit, the <code class="code">StartOf</code> operator is + not printed. We have it in CIL because it makes the typing rules + simpler.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + +<div class="info"> +Expressions (Side-effect free)<br> +</div> + +<br> +<b>Constants.</b><br> +<br><code><span class="keyword">type</span> <a name="TYPEconstant"></a><code class="type"></code>constant = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">CInt64</span> <span class="keyword">of</span> <code class="type">int64 * <a href="Cil.html#TYPEikind">ikind</a> * string option</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Integer constant. Give the ikind (see ISO9899 6.1.3.2) and the + textual representation, if available. (This allows us to print a + constant as, for example, 0xF instead of 15.) Use <a href="Cil.html#VALinteger"><code class="code">Cil.integer</code></a> or + <a href="Cil.html#VALkinteger"><code class="code">Cil.kinteger</code></a> to create these. Watch out for integers that cannot be + represented on 64 bits. OCAML does not give Overflow exceptions.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">CStr</span> <span class="keyword">of</span> <code class="type">string</code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">CWStr</span> <span class="keyword">of</span> <code class="type">int64 list</code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">CChr</span> <span class="keyword">of</span> <code class="type">char</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Character constant. This has type int, so use charConstToInt + to read the value in case sign-extension is needed.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">CReal</span> <span class="keyword">of</span> <code class="type">float * <a href="Cil.html#TYPEfkind">fkind</a> * string option</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Floating point constant. Give the fkind (see ISO 6.4.4.2) and also + the textual representation, if available.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">CEnum</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEexp">exp</a> * string * <a href="Cil.html#TYPEenuminfo">enuminfo</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>An enumeration constant with the given value, name, from the given + enuminfo. This is used only if <a href="Cil.html#VALlowerConstants"><code class="code">Cil.lowerConstants</code></a> is true + (default). Use <a href="Cil.html#VALconstFoldVisitor"><code class="code">Cil.constFoldVisitor</code></a> to replace these with integer + constants.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + +<div class="info"> +Literal constants<br> +</div> + +<br><code><span class="keyword">type</span> <a name="TYPEunop"></a><code class="type"></code>unop = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Neg</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Unary minus</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">BNot</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Bitwise complement (~)</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">LNot</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Logical Not (!)</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + +<div class="info"> +Unary operators<br> +</div> + +<br><code><span class="keyword">type</span> <a name="TYPEbinop"></a><code class="type"></code>binop = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">PlusA</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>arithmetic +</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">PlusPI</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>pointer + integer</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">IndexPI</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>pointer + integer but only when + it arises from an expression + <code class="code">e[i]</code> when <code class="code">e</code> is a pointer and + not an array. This is semantically + the same as PlusPI but CCured uses + this as a hint that the integer is + probably positive.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">MinusA</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>arithmetic -</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">MinusPI</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>pointer - integer</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">MinusPP</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>pointer - pointer</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Mult</span></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Div</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>/</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Mod</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>%</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Shiftlt</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>shift left</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Shiftrt</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>shift right</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Lt</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>< (arithmetic comparison)</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Gt</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>> (arithmetic comparison)</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Le</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code><= (arithmetic comparison)</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Ge</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>> (arithmetic comparison)</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Eq</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>== (arithmetic comparison)</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Ne</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>!= (arithmetic comparison)</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">BAnd</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>bitwise and</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">BXor</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>exclusive-or</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">BOr</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>inclusive-or</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">LAnd</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>logical and. Unlike other + expressions this one does not + always evaluate both operands. If + you want to use these, you must + set <a href="Cil.html#VALuseLogicalOperators"><code class="code">Cil.useLogicalOperators</code></a>.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">LOr</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>logical or. Unlike other + expressions this one does not + always evaluate both operands. If + you want to use these, you must + set <a href="Cil.html#VALuseLogicalOperators"><code class="code">Cil.useLogicalOperators</code></a>.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + +<div class="info"> +Binary operations<br> +</div> + +<br> +<b>Lvalues.</b> Lvalues are the sublanguage of expressions that can appear at the left of an assignment or as operand to the address-of operator. +In C the syntax for lvalues is not always a good indication of the meaning +of the lvalue. For example the C value +<pre> +a[0][1][2] +</pre> + might involve 1, 2 or 3 memory reads when used in an expression context, +depending on the declared type of the variable <code class="code">a</code>. If <code class="code">a</code> has type <code class="code">int +[4][4][4]</code> then we have one memory read from somewhere inside the area +that stores the array <code class="code">a</code>. On the other hand if <code class="code">a</code> has type <code class="code">int ***</code> then +the expression really means <code class="code">* ( * ( * (a + 0) + 1) + 2)</code>, in which case it is +clear that it involves three separate memory operations. +<p> + +An lvalue denotes the contents of a range of memory addresses. This range +is denoted as a host object along with an offset within the object. The +host object can be of two kinds: a local or global variable, or an object +whose address is in a pointer expression. We distinguish the two cases so +that we can tell quickly whether we are accessing some component of a +variable directly or we are accessing a memory location through a pointer. +To make it easy to +tell what an lvalue means CIL represents lvalues as a host object and an +offset (see <a href="Cil.html#TYPElval"><code class="code">Cil.lval</code></a>). The host object (represented as +<a href="Cil.html#TYPElhost"><code class="code">Cil.lhost</code></a>) can be a local or global variable or can be the object +pointed-to by a pointer expression. The offset (represented as +<a href="Cil.html#TYPEoffset"><code class="code">Cil.offset</code></a>) is a sequence of field or array index designators. +<p> + + Both the typing rules and the meaning of an lvalue is very precisely +specified in CIL. +<p> + + The following are a few useful function for operating on lvalues:<ul> +<li><a href="Cil.html#VALmkMem"><code class="code">Cil.mkMem</code></a> - makes an lvalue of <code class="code">Mem</code> kind. Use this to ensure +that certain equivalent forms of lvalues are canonized. +For example, <code class="code">*&x = x</code>. </li> +<li><a href="Cil.html#VALtypeOfLval"><code class="code">Cil.typeOfLval</code></a> - the type of an lvalue</li> +<li><a href="Cil.html#VALtypeOffset"><code class="code">Cil.typeOffset</code></a> - the type of an offset, given the type of the +host. </li> +<li><a href="Cil.html#VALaddOffset"><code class="code">Cil.addOffset</code></a> and <a href="Cil.html#VALaddOffsetLval"><code class="code">Cil.addOffsetLval</code></a> - extend sequences +of offsets.</li> +<li><a href="Cil.html#VALremoveOffset"><code class="code">Cil.removeOffset</code></a> and <a href="Cil.html#VALremoveOffsetLval"><code class="code">Cil.removeOffsetLval</code></a> - shrink sequences +of offsets.</li> +</ul> + +The following equivalences hold <pre> +Mem(AddrOf(Mem a, aoff)), off = Mem a, aoff + off +Mem(AddrOf(Var v, aoff)), off = Var v, aoff + off +AddrOf (Mem a, NoOffset) = a +</pre><br> +<pre><span class="keyword">type</span> <a name="TYPElval"></a><code class="type"></code>lval = <code class="type"><a href="Cil.html#TYPElhost">lhost</a> * <a href="Cil.html#TYPEoffset">offset</a></code> </pre> +<div class="info"> +An lvalue<br> +</div> + +<br><code><span class="keyword">type</span> <a name="TYPElhost"></a><code class="type"></code>lhost = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Var</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEvarinfo">varinfo</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The host is a variable.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Mem</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEexp">exp</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The host is an object of type <code class="code">T</code> when the expression has pointer + <code class="code">TPtr(T)</code>.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + +<div class="info"> +The host part of an <a href="Cil.html#TYPElval"><code class="code">Cil.lval</code></a>.<br> +</div> + +<br><code><span class="keyword">type</span> <a name="TYPEoffset"></a><code class="type"></code>offset = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">NoOffset</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>No offset. Can be applied to any lvalue and does + not change either the starting address or the type. + This is used when the lval consists of just a host + or as a terminator in a list of other kinds of + offsets.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Field</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEfieldinfo">fieldinfo</a> * <a href="Cil.html#TYPEoffset">offset</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A field offset. Can be applied only to an lvalue + that denotes a structure or a union that contains + the mentioned field. This advances the offset to the + beginning of the mentioned field and changes the + type to the type of the mentioned field.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Index</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEexp">exp</a> * <a href="Cil.html#TYPEoffset">offset</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>An array index offset. Can be applied only to an + lvalue that denotes an array. This advances the + starting address of the lval to the beginning of the + mentioned array element and changes the denoted type + to be the type of the array element</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + +<div class="info"> +The offset part of an <a href="Cil.html#TYPElval"><code class="code">Cil.lval</code></a>. Each offset can be applied to certain + kinds of lvalues and its effect is that it advances the starting address + of the lvalue and changes the denoted type, essentially focusing to some + smaller lvalue that is contained in the original one.<br> +</div> + +<br> +<b>Initializers.</b> +A special kind of expressions are those that can appear as initializers for +global variables (initialization of local variables is turned into +assignments). The initializers are represented as type <a href="Cil.html#TYPEinit"><code class="code">Cil.init</code></a>. You +can create initializers with <a href="Cil.html#VALmakeZeroInit"><code class="code">Cil.makeZeroInit</code></a> and you can conveniently +scan compound initializers them with <a href="Cil.html#VALfoldLeftCompound"><code class="code">Cil.foldLeftCompound</code></a> or with <a href="Cil.html#VALfoldLeftCompoundAll"><code class="code">Cil.foldLeftCompoundAll</code></a>.<br> +<br><code><span class="keyword">type</span> <a name="TYPEinit"></a><code class="type"></code>init = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">SingleInit</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEexp">exp</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A single initializer</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">CompoundInit</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtyp">typ</a> * (<a href="Cil.html#TYPEoffset">offset</a> * <a href="Cil.html#TYPEinit">init</a>) list</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Used only for initializers of structures, unions and arrays. The + offsets are all of the form <code class="code">Field(f, NoOffset)</code> or <code class="code">Index(i, + NoOffset)</code> and specify the field or the index being initialized. For + structures all fields must have an initializer (except the unnamed + bitfields), in the proper order. This is necessary since the offsets + are not printed. For unions there must be exactly one initializer. If + the initializer is not for the first field then a field designator is + printed, so you better be on GCC since MSVC does not understand this. + For arrays, however, we allow you to give only a prefix of the + initializers. You can scan an initializer list with + <a href="Cil.html#VALfoldLeftCompound"><code class="code">Cil.foldLeftCompound</code></a> or with <a href="Cil.html#VALfoldLeftCompoundAll"><code class="code">Cil.foldLeftCompoundAll</code></a>.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + +<div class="info"> +Initializers for global variables.<br> +</div> + +<br><code><span class="keyword">type</span> <a name="TYPEinitinfo"></a><code class="type"></code>initinfo = {</code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>init : <code class="type"><a href="Cil.html#TYPEinit">init</a> option</code>;</code></td> + +</tr></table> +} + +<div class="info"> +We want to be able to update an initializer in a global variable, so we + define it as a mutable field<br> +</div> + +<br> +<b>Function definitions.</b> +A function definition is always introduced with a <code class="code">GFun</code> constructor at the +top level. All the information about the function is stored into a +<a href="Cil.html#TYPEfundec"><code class="code">Cil.fundec</code></a>. Some of the information (e.g. its name, type, +storage, attributes) is stored as a <a href="Cil.html#TYPEvarinfo"><code class="code">Cil.varinfo</code></a> that is a field of the +<code class="code">fundec</code>. To refer to the function from the expression language you must use +the <code class="code">varinfo</code>. +<p> + + The function definition contains, in addition to the body, a list of all the +local variables and separately a list of the formals. Both kind of variables +can be referred to in the body of the function. The formals must also be shared +with the formals that appear in the function type. For that reason, to +manipulate formals you should use the provided functions +<a href="Cil.html#VALmakeFormalVar"><code class="code">Cil.makeFormalVar</code></a> and <a href="Cil.html#VALsetFormals"><code class="code">Cil.setFormals</code></a> and <a href="Cil.html#VALmakeFormalVar"><code class="code">Cil.makeFormalVar</code></a>.<br> +<br><code><span class="keyword">type</span> <a name="TYPEfundec"></a><code class="type"></code>fundec = {</code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>svar : <code class="type"><a href="Cil.html#TYPEvarinfo">varinfo</a></code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Holds the name and type as a variable, so we can refer to it + easily from the program. All references to this function either + in a function call or in a prototype must point to the same + <code class="code">varinfo</code>.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>sformals : <code class="type"><a href="Cil.html#TYPEvarinfo">varinfo</a> list</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Formals. These must be in the same order and with the same + information as the formal information in the type of the function. + Use <a href="Cil.html#VALsetFormals"><code class="code">Cil.setFormals</code></a> or + <a href="Cil.html#VALsetFunctionType"><code class="code">Cil.setFunctionType</code></a> or <a href="Cil.html#VALmakeFormalVar"><code class="code">Cil.makeFormalVar</code></a> + to set these formals and ensure that they + are reflected in the function type. Do not make copies of these + because the body refers to them.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>slocals : <code class="type"><a href="Cil.html#TYPEvarinfo">varinfo</a> list</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Locals. Does NOT include the sformals. Do not make copies of + these because the body refers to them.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>smaxid : <code class="type">int</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Max local id. Starts at 0. Used for + creating the names of new temporary + variables. Updated by + <a href="Cil.html#VALmakeLocalVar"><code class="code">Cil.makeLocalVar</code></a> and + <a href="Cil.html#VALmakeTempVar"><code class="code">Cil.makeTempVar</code></a>. You can also use + <a href="Cil.html#VALsetMaxId"><code class="code">Cil.setMaxId</code></a> to set it after you + have added the formals and locals.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>sbody : <code class="type"><a href="Cil.html#TYPEblock">block</a></code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The function body.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>smaxstmtid : <code class="type">int option</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>max id of a (reachable) statement + in this function, if we have + computed it. range = 0 ... + (smaxstmtid-1). This is computed by + <a href="Cil.html#VALcomputeCFGInfo"><code class="code">Cil.computeCFGInfo</code></a>.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>sallstmts : <code class="type"><a href="Cil.html#TYPEstmt">stmt</a> list</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>After you call <a href="Cil.html#VALcomputeCFGInfo"><code class="code">Cil.computeCFGInfo</code></a> + this field is set to contain all + statements in the function</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> +} + +<div class="info"> +Function definitions.<br> +</div> + +<br><code><span class="keyword">type</span> <a name="TYPEblock"></a><code class="type"></code>block = {</code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>battrs : <code class="type"><a href="Cil.html#TYPEattributes">attributes</a></code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Attributes for the block</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>bstmts : <code class="type"><a href="Cil.html#TYPEstmt">stmt</a> list</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The statements comprising the block</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> +} + +<div class="info"> +A block is a sequence of statements with the control falling through from + one element to the next<br> +</div> + +<br> +<b>Statements</b>. +CIL statements are the structural elements that make the CFG. They are +represented using the type <a href="Cil.html#TYPEstmt"><code class="code">Cil.stmt</code></a>. Every +statement has a (possibly empty) list of labels. The +<a href="Cil.html#TYPEstmtkind"><code class="code">Cil.stmtkind</code></a> field of a statement indicates what kind of statement it +is. +<p> + + Use <a href="Cil.html#VALmkStmt"><code class="code">Cil.mkStmt</code></a> to make a statement and the fill-in the fields. +<p> + +CIL also comes with support for control-flow graphs. The <code class="code">sid</code> field in +<code class="code">stmt</code> can be used to give unique numbers to statements, and the <code class="code">succs</code> +and <code class="code">preds</code> fields can be used to maintain a list of successors and +predecessors for every statement. The CFG information is not computed by +default. Instead you must explicitly use the functions +<a href="Cil.html#VALprepareCFG"><code class="code">Cil.prepareCFG</code></a> and <a href="Cil.html#VALcomputeCFGInfo"><code class="code">Cil.computeCFGInfo</code></a> to do it.<br> +<br><code><span class="keyword">type</span> <a name="TYPEstmt"></a><code class="type"></code>stmt = {</code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>labels : <code class="type"><a href="Cil.html#TYPElabel">label</a> list</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Whether the statement starts with some labels, case statements or + default statements.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>skind : <code class="type"><a href="Cil.html#TYPEstmtkind">stmtkind</a></code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The kind of statement</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>sid : <code class="type">int</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A number (>= 0) that is unique in a function. Filled in only after + the CFG is computed.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>succs : <code class="type"><a href="Cil.html#TYPEstmt">stmt</a> list</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The successor statements. They can always be computed from the skind + and the context in which this statement appears. Filled in only after + the CFG is computed.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code><span class="keyword">mutable </span>preds : <code class="type"><a href="Cil.html#TYPEstmt">stmt</a> list</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The inverse of the succs function.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> +} + +<div class="info"> +Statements.<br> +</div> + +<br><code><span class="keyword">type</span> <a name="TYPElabel"></a><code class="type"></code>label = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Label</span> <span class="keyword">of</span> <code class="type">string * <a href="Cil.html#TYPElocation">location</a> * bool</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A real label. If the bool is "true", the label is from the + input source program. If the bool is "false", the label was + created by CIL or some other transformation</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Case</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEexp">exp</a> * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A case statement. This expression + is lowered into a constant if + <a href="Cil.html#VALlowerConstants"><code class="code">Cil.lowerConstants</code></a> is set to + true.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Default</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A default statement</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + +<div class="info"> +Labels<br> +</div> + +<br><code><span class="keyword">type</span> <a name="TYPEstmtkind"></a><code class="type"></code>stmtkind = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Instr</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEinstr">instr</a> list</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A group of instructions that do not contain control flow. Control + implicitly falls through.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Return</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEexp">exp</a> option * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The return statement. This is a leaf in the CFG.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Goto</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEstmt">stmt</a> Pervasives.ref * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A goto statement. Appears from actual goto's in the code or from + goto's that have been inserted during elaboration. The reference + points to the statement that is the target of the Goto. This means that + you have to update the reference whenever you replace the target + statement. The target statement MUST have at least a label.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Break</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A break to the end of the nearest enclosing Loop or Switch</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Continue</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A continue to the start of the nearest enclosing <code class="code">Loop</code></code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">If</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEexp">exp</a> * <a href="Cil.html#TYPEblock">block</a> * <a href="Cil.html#TYPEblock">block</a> * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A conditional. Two successors, the "then" and the "else" branches. + Both branches fall-through to the successor of the If statement.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Switch</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEexp">exp</a> * <a href="Cil.html#TYPEblock">block</a> * <a href="Cil.html#TYPEstmt">stmt</a> list * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A switch statement. The statements that implement the cases can be + reached through the provided list. For each such target you can find + among its labels what cases it implements. The statements that + implement the cases are somewhere within the provided <code class="code">block</code>.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Loop</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEblock">block</a> * <a href="Cil.html#TYPElocation">location</a> * <a href="Cil.html#TYPEstmt">stmt</a> option * <a href="Cil.html#TYPEstmt">stmt</a> option</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A <code class="code">while(1)</code> loop. The termination test is implemented in the body of + a loop using a <code class="code">Break</code> statement. If prepareCFG has been called, + the first stmt option will point to the stmt containing the continue + label for this loop and the second will point to the stmt containing + the break label for this loop.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Block</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEblock">block</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Just a block of statements. Use it as a way to keep some block + attributes local</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TryFinally</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEblock">block</a> * <a href="Cil.html#TYPEblock">block</a> * <a href="Cil.html#TYPElocation">location</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TryExcept</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEblock">block</a> * (<a href="Cil.html#TYPEinstr">instr</a> list * <a href="Cil.html#TYPEexp">exp</a>) * <a href="Cil.html#TYPEblock">block</a> * <a href="Cil.html#TYPElocation">location</a></code></code></td> + +</tr></table> + +<div class="info"> +The various kinds of control-flow statements statements<br> +</div> + +<br> +<b>Instructions</b>. + An instruction <a href="Cil.html#TYPEinstr"><code class="code">Cil.instr</code></a> is a statement that has no local +(intraprocedural) control flow. It can be either an assignment, +function call, or an inline assembly instruction.<br> +<br><code><span class="keyword">type</span> <a name="TYPEinstr"></a><code class="type"></code>instr = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Set</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPElval">lval</a> * <a href="Cil.html#TYPEexp">exp</a> * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>An assignment. The type of the expression is guaranteed to be the same + with that of the lvalue</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Call</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPElval">lval</a> option * <a href="Cil.html#TYPEexp">exp</a> * <a href="Cil.html#TYPEexp">exp</a> list * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>A function call with the (optional) result placed in an lval. It is + possible that the returned type of the function is not identical to + that of the lvalue. In that case a cast is printed. The type of the + actual arguments are identical to those of the declared formals. The + number of arguments is the same as that of the declared formals, except + for vararg functions. This construct is also used to encode a call to + "__builtin_va_arg". In this case the second argument (which should be a + type T) is encoded SizeOf(T)</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Asm</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEattributes">attributes</a> * string list * (string * <a href="Cil.html#TYPElval">lval</a>) list<br> * (string * <a href="Cil.html#TYPEexp">exp</a>) list * string list * <a href="Cil.html#TYPElocation">location</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>There are for storing inline assembly. They follow the GCC + specification: +<pre> + asm [volatile] ("...template..." "..template.." + : "c1" (o1), "c2" (o2), ..., "cN" (oN) + : "d1" (i1), "d2" (i2), ..., "dM" (iM) + : "r1", "r2", ..., "nL" ); +</pre> +<p> + +where the parts are +<p> +<ul> +<li><code class="code">volatile</code> (optional): when present, the assembler instruction + cannot be removed, moved, or otherwise optimized</li> +<li>template: a sequence of strings, with %0, %1, %2, etc. in the string to + refer to the input and output expressions. I think they're numbered + consecutively, but the docs don't specify. Each string is printed on + a separate line. This is the only part that is present for MSVC inline + assembly.</li> +<li>"ci" (oi): pairs of constraint-string and output-lval; the + constraint specifies that the register used must have some + property, like being a floating-point register; the constraint + string for outputs also has "=" to indicate it is written, or + "+" to indicate it is both read and written; 'oi' is the + name of a C lvalue (probably a variable name) to be used as + the output destination</li> +<li>"dj" (ij): pairs of constraint and input expression; the constraint + is similar to the "ci"s. the 'ij' is an arbitrary C expression + to be loaded into the corresponding register</li> +<li>"rk": registers to be regarded as "clobbered" by the instruction; + "memory" may be specified for arbitrary memory effects</li> +</ul> + +an example (from gcc manual): +<pre> + asm volatile ("movc3 %0,%1,%2" + : /* no outputs */ + : "g" (from), "g" (to), "g" (count) + : "r0", "r1", "r2", "r3", "r4", "r5"); +</pre></code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + +<div class="info"> +Instructions.<br> +</div> + +<br><code><span class="keyword">type</span> <a name="TYPElocation"></a><code class="type"></code>location = {</code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code>line : <code class="type">int</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The line number. -1 means "do not know"</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code>file : <code class="type">string</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The name of the source file</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code>byte : <code class="type">int</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The byte position in the source file</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> +} + +<div class="info"> +Describes a location in a source file.<br> +</div> + +<br><code><span class="keyword">type</span> <a name="TYPEtypsig"></a><code class="type"></code>typsig = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TSArray</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtypsig">typsig</a> * int64 option * <a href="Cil.html#TYPEattribute">attribute</a> list</code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TSPtr</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtypsig">typsig</a> * <a href="Cil.html#TYPEattribute">attribute</a> list</code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TSComp</span> <span class="keyword">of</span> <code class="type">bool * string * <a href="Cil.html#TYPEattribute">attribute</a> list</code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TSFun</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtypsig">typsig</a> * <a href="Cil.html#TYPEtypsig">typsig</a> list * bool * <a href="Cil.html#TYPEattribute">attribute</a> list</code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TSEnum</span> <span class="keyword">of</span> <code class="type">string * <a href="Cil.html#TYPEattribute">attribute</a> list</code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TSBase</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></code></td> + +</tr></table> + +<div class="info"> +Type signatures. Two types are identical iff they have identical + signatures. These contain the same information as types but canonicalized. + For example, two function types that are identical except for the name of + the formal arguments are given the same signature. Also, <code class="code">TNamed</code> + constructors are unrolled.<br> +</div> + +<br> +<b>Lowering Options</b><br> +<pre><span class="keyword">val</span> <a name="VALlowerConstants"></a>lowerConstants : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +Do lower constants (default true)<br> +</div> +<pre><span class="keyword">val</span> <a name="VALinsertImplicitCasts"></a>insertImplicitCasts : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +Do insert implicit casts (default true)<br> +</div> +<br><code><span class="keyword">type</span> <a name="TYPEfeatureDescr"></a><code class="type"></code>featureDescr = {</code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code>fd_enabled : <code class="type">bool Pervasives.ref</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The enable flag. Set to default value</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code>fd_name : <code class="type">string</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>This is used to construct an option "--doxxx" and "--dontxxx" that + enable and disable the feature</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code>fd_description : <code class="type">string</code>;</code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code>fd_extraopt : <code class="type">(string * Arg.spec * string) list</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Additional command line options</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code>fd_doit : <code class="type"><a href="Cil.html#TYPEfile">file</a> -> unit</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>This performs the transformation</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code>fd_post_check : <code class="type">bool</code>;</code></td> + +</tr></table> +} + +<div class="info"> +To be able to add/remove features easily, each feature should be package + as an interface with the following interface. These features should be<br> +</div> + +<pre><span class="keyword">val</span> <a name="VALcompareLoc"></a>compareLoc : <code class="type"><a href="Cil.html#TYPElocation">location</a> -> <a href="Cil.html#TYPElocation">location</a> -> int</code></pre><div class="info"> +Comparison function for locations. +* Compares first by filename, then line, then byte<br> +</div> +<br> +<b>Values for manipulating globals</b><br> +<pre><span class="keyword">val</span> <a name="VALemptyFunction"></a>emptyFunction : <code class="type">string -> <a href="Cil.html#TYPEfundec">fundec</a></code></pre><div class="info"> +Make an empty function<br> +</div> +<pre><span class="keyword">val</span> <a name="VALsetFormals"></a>setFormals : <code class="type"><a href="Cil.html#TYPEfundec">fundec</a> -> <a href="Cil.html#TYPEvarinfo">varinfo</a> list -> unit</code></pre><div class="info"> +Update the formals of a <code class="code">fundec</code> and make sure that the function type + has the same information. Will copy the name as well into the type.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALsetFunctionType"></a>setFunctionType : <code class="type"><a href="Cil.html#TYPEfundec">fundec</a> -> <a href="Cil.html#TYPEtyp">typ</a> -> unit</code></pre><div class="info"> +Set the types of arguments and results as given by the function type + passed as the second argument. Will not copy the names from the function + type to the formals<br> +</div> +<pre><span class="keyword">val</span> <a name="VALsetFunctionTypeMakeFormals"></a>setFunctionTypeMakeFormals : <code class="type"><a href="Cil.html#TYPEfundec">fundec</a> -> <a href="Cil.html#TYPEtyp">typ</a> -> unit</code></pre><div class="info"> +Set the type of the function and make formal arguments for them<br> +</div> +<pre><span class="keyword">val</span> <a name="VALsetMaxId"></a>setMaxId : <code class="type"><a href="Cil.html#TYPEfundec">fundec</a> -> unit</code></pre><div class="info"> +Update the smaxid after you have populated with locals and formals + (unless you constructed those using <a href="Cil.html#VALmakeLocalVar"><code class="code">Cil.makeLocalVar</code></a> or + <a href="Cil.html#VALmakeTempVar"><code class="code">Cil.makeTempVar</code></a>.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdummyFunDec"></a>dummyFunDec : <code class="type"><a href="Cil.html#TYPEfundec">fundec</a></code></pre><div class="info"> +A dummy function declaration handy when you need one as a placeholder. It + contains inside a dummy varinfo.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdummyFile"></a>dummyFile : <code class="type"><a href="Cil.html#TYPEfile">file</a></code></pre><div class="info"> +A dummy file<br> +</div> +<pre><span class="keyword">val</span> <a name="VALsaveBinaryFile"></a>saveBinaryFile : <code class="type"><a href="Cil.html#TYPEfile">file</a> -> string -> unit</code></pre><div class="info"> +Write a <a href="Cil.html#TYPEfile"><code class="code">Cil.file</code></a> in binary form to the filesystem. The file can be + read back in later using <a href="Cil.html#VALloadBinaryFile"><code class="code">Cil.loadBinaryFile</code></a>, possibly saving parsing + time. The second argument is the name of the file that should be + created.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALsaveBinaryFileChannel"></a>saveBinaryFileChannel : <code class="type"><a href="Cil.html#TYPEfile">file</a> -> Pervasives.out_channel -> unit</code></pre><div class="info"> +Write a <a href="Cil.html#TYPEfile"><code class="code">Cil.file</code></a> in binary form to the filesystem. The file can be + read back in later using <a href="Cil.html#VALloadBinaryFile"><code class="code">Cil.loadBinaryFile</code></a>, possibly saving parsing + time. Does not close the channel.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALloadBinaryFile"></a>loadBinaryFile : <code class="type">string -> <a href="Cil.html#TYPEfile">file</a></code></pre><div class="info"> +Read a <a href="Cil.html#TYPEfile"><code class="code">Cil.file</code></a> in binary form from the filesystem. The first + argument is the name of a file previously created by + <a href="Cil.html#VALsaveBinaryFile"><code class="code">Cil.saveBinaryFile</code></a>.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALgetGlobInit"></a>getGlobInit : <code class="type">?main_name:string -> <a href="Cil.html#TYPEfile">file</a> -> <a href="Cil.html#TYPEfundec">fundec</a></code></pre><div class="info"> +Get the global initializer and create one if it does not already exist. + When it creates a global initializer it attempts to place a call to it in + the main function named by the optional argument (default "main")<br> +</div> +<pre><span class="keyword">val</span> <a name="VALiterGlobals"></a>iterGlobals : <code class="type"><a href="Cil.html#TYPEfile">file</a> -> (<a href="Cil.html#TYPEglobal">global</a> -> unit) -> unit</code></pre><div class="info"> +Iterate over all globals, including the global initializer<br> +</div> +<pre><span class="keyword">val</span> <a name="VALfoldGlobals"></a>foldGlobals : <code class="type"><a href="Cil.html#TYPEfile">file</a> -> ('a -> <a href="Cil.html#TYPEglobal">global</a> -> 'a) -> 'a -> 'a</code></pre><div class="info"> +Fold over all globals, including the global initializer<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmapGlobals"></a>mapGlobals : <code class="type"><a href="Cil.html#TYPEfile">file</a> -> (<a href="Cil.html#TYPEglobal">global</a> -> <a href="Cil.html#TYPEglobal">global</a>) -> unit</code></pre><div class="info"> +Map over all globals, including the global initializer and change things + in place<br> +</div> +<pre><span class="keyword">val</span> <a name="VALnew_sid"></a>new_sid : <code class="type">unit -> int</code></pre><pre><span class="keyword">val</span> <a name="VALprepareCFG"></a>prepareCFG : <code class="type"><a href="Cil.html#TYPEfundec">fundec</a> -> unit</code></pre><div class="info"> +Prepare a function for CFG information computation by + <a href="Cil.html#VALcomputeCFGInfo"><code class="code">Cil.computeCFGInfo</code></a>. This function converts all <code class="code">Break</code>, <code class="code">Switch</code>, + <code class="code">Default</code> and <code class="code">Continue</code> <a href="Cil.html#TYPEstmtkind"><code class="code">Cil.stmtkind</code></a>s and <a href="Cil.html#TYPElabel"><code class="code">Cil.label</code></a>s into <code class="code">If</code>s + and <code class="code">Goto</code>s, giving the function body a very CFG-like character. This + function modifies its argument in place.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcomputeCFGInfo"></a>computeCFGInfo : <code class="type"><a href="Cil.html#TYPEfundec">fundec</a> -> bool -> unit</code></pre><div class="info"> +Compute the CFG information for all statements in a fundec and return a + list of the statements. The input fundec cannot have <code class="code">Break</code>, <code class="code">Switch</code>, + <code class="code">Default</code>, or <code class="code">Continue</code> <a href="Cil.html#TYPEstmtkind"><code class="code">Cil.stmtkind</code></a>s or <a href="Cil.html#TYPElabel"><code class="code">Cil.label</code></a>s. Use + <a href="Cil.html#VALprepareCFG"><code class="code">Cil.prepareCFG</code></a> to transform them away. The second argument should + be <code class="code">true</code> if you wish a global statement number, <code class="code">false</code> if you wish a + local (per-function) statement numbering. The list of statements is set + in the sallstmts field of a fundec. +<p> + + NOTE: unless you want the simpler control-flow graph provided by + prepareCFG, or you need the function's smaxstmtid and sallstmt fields + filled in, we recommend you use <a href="Cfg.html#VALcomputeFileCFG"><code class="code">Cfg.computeFileCFG</code></a> instead of this + function to compute control-flow information. + <a href="Cfg.html#VALcomputeFileCFG"><code class="code">Cfg.computeFileCFG</code></a> is newer and will handle switch, break, and + continue correctly.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcopyFunction"></a>copyFunction : <code class="type"><a href="Cil.html#TYPEfundec">fundec</a> -> string -> <a href="Cil.html#TYPEfundec">fundec</a></code></pre><div class="info"> +Create a deep copy of a function. There should be no sharing between the + copy and the original function<br> +</div> +<pre><span class="keyword">val</span> <a name="VALpushGlobal"></a>pushGlobal : <code class="type"><a href="Cil.html#TYPEglobal">global</a> -><br> types:<a href="Cil.html#TYPEglobal">global</a> list Pervasives.ref -><br> variables:<a href="Cil.html#TYPEglobal">global</a> list Pervasives.ref -> unit</code></pre><div class="info"> +CIL keeps the types at the beginning of the file and the variables at the + end of the file. This function will take a global and add it to the + corresponding stack. Its operation is actually more complicated because if + the global declares a type that contains references to variables (e.g. in + sizeof in an array length) then it will also add declarations for the + variables to the types stack<br> +</div> +<pre><span class="keyword">val</span> <a name="VALinvalidStmt"></a>invalidStmt : <code class="type"><a href="Cil.html#TYPEstmt">stmt</a></code></pre><div class="info"> +An empty statement. Used in pretty printing<br> +</div> +<pre><span class="keyword">val</span> <a name="VALgccBuiltins"></a>gccBuiltins : <code class="type">(string, <a href="Cil.html#TYPEtyp">typ</a> * <a href="Cil.html#TYPEtyp">typ</a> list * bool) Hashtbl.t</code></pre><div class="info"> +A list of the GCC built-in functions. Maps the name to the result and + argument types, and whether it is vararg<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmsvcBuiltins"></a>msvcBuiltins : <code class="type">(string, <a href="Cil.html#TYPEtyp">typ</a> * <a href="Cil.html#TYPEtyp">typ</a> list * bool) Hashtbl.t</code></pre><div class="info"> +A list of the MSVC built-in functions. Maps the name to the result and + argument types, and whether it is vararg<br> +</div> +<br> +<b>Values for manipulating initializers</b><br> +<pre><span class="keyword">val</span> <a name="VALmakeZeroInit"></a>makeZeroInit : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEinit">init</a></code></pre><div class="info"> +Make a initializer for zero-ing a data type<br> +</div> +<pre><span class="keyword">val</span> <a name="VALfoldLeftCompound"></a>foldLeftCompound : <code class="type">doinit:(<a href="Cil.html#TYPEoffset">offset</a> -> <a href="Cil.html#TYPEinit">init</a> -> <a href="Cil.html#TYPEtyp">typ</a> -> 'a -> 'a) -><br> ct:<a href="Cil.html#TYPEtyp">typ</a> -> initl:(<a href="Cil.html#TYPEoffset">offset</a> * <a href="Cil.html#TYPEinit">init</a>) list -> acc:'a -> 'a</code></pre><div class="info"> +Fold over the list of initializers in a Compound. <code class="code">doinit</code> is called on + every present initializer, even if it is of compound type. In the case of + arrays there might be missing zero-initializers at the end of the list. + These are not scanned. This is much like <code class="code">List.fold_left</code> except we also + pass the type of the initializer<br> +</div> +<pre><span class="keyword">val</span> <a name="VALfoldLeftCompoundAll"></a>foldLeftCompoundAll : <code class="type">doinit:(<a href="Cil.html#TYPEoffset">offset</a> -> <a href="Cil.html#TYPEinit">init</a> -> <a href="Cil.html#TYPEtyp">typ</a> -> 'a -> 'a) -><br> ct:<a href="Cil.html#TYPEtyp">typ</a> -> initl:(<a href="Cil.html#TYPEoffset">offset</a> * <a href="Cil.html#TYPEinit">init</a>) list -> acc:'a -> 'a</code></pre><div class="info"> +Fold over the list of initializers in a Compound, like + <a href="Cil.html#VALfoldLeftCompound"><code class="code">Cil.foldLeftCompound</code></a> but in the case of an array it scans even missing + zero initializers at the end of the array<br> +</div> +<br> +<b>Values for manipulating types</b><br> +<pre><span class="keyword">val</span> <a name="VALvoidType"></a>voidType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +void<br> +</div> +<pre><span class="keyword">val</span> <a name="VALisVoidType"></a>isVoidType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> bool</code></pre><pre><span class="keyword">val</span> <a name="VALisVoidPtrType"></a>isVoidPtrType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> bool</code></pre><pre><span class="keyword">val</span> <a name="VALintType"></a>intType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +int<br> +</div> +<pre><span class="keyword">val</span> <a name="VALuintType"></a>uintType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +unsigned int<br> +</div> +<pre><span class="keyword">val</span> <a name="VALlongType"></a>longType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +long<br> +</div> +<pre><span class="keyword">val</span> <a name="VALulongType"></a>ulongType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +unsigned long<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcharType"></a>charType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +char<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcharPtrType"></a>charPtrType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +char *<br> +</div> +<pre><span class="keyword">val</span> <a name="VALwcharKind"></a>wcharKind : <code class="type"><a href="Cil.html#TYPEikind">ikind</a> Pervasives.ref</code></pre><div class="info"> +wchar_t (depends on architecture) and is set when you call + <a href="Cil.html#VALinitCIL"><code class="code">Cil.initCIL</code></a>.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALwcharType"></a>wcharType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> Pervasives.ref</code></pre><pre><span class="keyword">val</span> <a name="VALcharConstPtrType"></a>charConstPtrType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +char const *<br> +</div> +<pre><span class="keyword">val</span> <a name="VALvoidPtrType"></a>voidPtrType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +void *<br> +</div> +<pre><span class="keyword">val</span> <a name="VALintPtrType"></a>intPtrType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +int *<br> +</div> +<pre><span class="keyword">val</span> <a name="VALuintPtrType"></a>uintPtrType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +unsigned int *<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdoubleType"></a>doubleType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +double<br> +</div> +<pre><span class="keyword">val</span> <a name="VALupointType"></a>upointType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> Pervasives.ref</code></pre><pre><span class="keyword">val</span> <a name="VALtypeOfSizeOf"></a>typeOfSizeOf : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> Pervasives.ref</code></pre><pre><span class="keyword">val</span> <a name="VALisSigned"></a>isSigned : <code class="type"><a href="Cil.html#TYPEikind">ikind</a> -> bool</code></pre><div class="info"> +Returns true if and only if the given integer type is signed.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmkCompInfo"></a>mkCompInfo : <code class="type">bool -><br> string -><br> (<a href="Cil.html#TYPEcompinfo">compinfo</a> -><br> (string * <a href="Cil.html#TYPEtyp">typ</a> * int option * <a href="Cil.html#TYPEattributes">attributes</a> * <a href="Cil.html#TYPElocation">location</a>) list) -><br> <a href="Cil.html#TYPEattributes">attributes</a> -> <a href="Cil.html#TYPEcompinfo">compinfo</a></code></pre><div class="info"> +Creates a a (potentially recursive) composite type. The arguments are: + (1) a boolean indicating whether it is a struct or a union, (2) the name + (always non-empty), (3) a function that when given a representation of the + structure type constructs the type of the fields recursive type (the first + argument is only useful when some fields need to refer to the type of the + structure itself), and (4) a list of attributes to be associated with the + composite type. The resulting compinfo has the field "cdefined" only if + the list of fields is non-empty.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcopyCompInfo"></a>copyCompInfo : <code class="type"><a href="Cil.html#TYPEcompinfo">compinfo</a> -> string -> <a href="Cil.html#TYPEcompinfo">compinfo</a></code></pre><div class="info"> +Makes a shallow copy of a <a href="Cil.html#TYPEcompinfo"><code class="code">Cil.compinfo</code></a> changing the name and the key.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmissingFieldName"></a>missingFieldName : <code class="type">string</code></pre><div class="info"> +This is a constant used as the name of an unnamed bitfield. These fields + do not participate in initialization and their name is not printed.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcompFullName"></a>compFullName : <code class="type"><a href="Cil.html#TYPEcompinfo">compinfo</a> -> string</code></pre><div class="info"> +Get the full name of a comp<br> +</div> +<pre><span class="keyword">val</span> <a name="VALisCompleteType"></a>isCompleteType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> bool</code></pre><div class="info"> +Returns true if this is a complete type. + This means that sizeof(t) makes sense. + Incomplete types are not yet defined + structures and empty arrays.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALunrollType"></a>unrollType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +Unroll a type until it exposes a non + <code class="code">TNamed</code>. Will collect all attributes appearing in <code class="code">TNamed</code>!!!<br> +</div> +<pre><span class="keyword">val</span> <a name="VALunrollTypeDeep"></a>unrollTypeDeep : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +Unroll all the TNamed in a type (even under type constructors such as + <code class="code">TPtr</code>, <code class="code">TFun</code> or <code class="code">TArray</code>. Does not unroll the types of fields in <code class="code">TComp</code> + types. Will collect all attributes<br> +</div> +<pre><span class="keyword">val</span> <a name="VALseparateStorageModifiers"></a>separateStorageModifiers : <code class="type"><a href="Cil.html#TYPEattribute">attribute</a> list -> <a href="Cil.html#TYPEattribute">attribute</a> list * <a href="Cil.html#TYPEattribute">attribute</a> list</code></pre><div class="info"> +Separate out the storage-modifier name attributes<br> +</div> +<pre><span class="keyword">val</span> <a name="VALisIntegralType"></a>isIntegralType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> bool</code></pre><div class="info"> +True if the argument is an integral type (i.e. integer or enum)<br> +</div> +<pre><span class="keyword">val</span> <a name="VALisArithmeticType"></a>isArithmeticType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> bool</code></pre><div class="info"> +True if the argument is an arithmetic type (i.e. integer, enum or + floating point<br> +</div> +<pre><span class="keyword">val</span> <a name="VALisPointerType"></a>isPointerType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> bool</code></pre><div class="info"> +True if the argument is a pointer type<br> +</div> +<pre><span class="keyword">val</span> <a name="VALisFunctionType"></a>isFunctionType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> bool</code></pre><div class="info"> +True if the argument is a function type<br> +</div> +<pre><span class="keyword">val</span> <a name="VALargsToList"></a>argsToList : <code class="type">(string * <a href="Cil.html#TYPEtyp">typ</a> * <a href="Cil.html#TYPEattributes">attributes</a>) list option -><br> (string * <a href="Cil.html#TYPEtyp">typ</a> * <a href="Cil.html#TYPEattributes">attributes</a>) list</code></pre><div class="info"> +Obtain the argument list ([] if None)<br> +</div> +<pre><span class="keyword">val</span> <a name="VALisArrayType"></a>isArrayType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> bool</code></pre><div class="info"> +True if the argument is an array type<br> +</div> +<pre><span class="keyword">exception</span> <a name="EXCEPTIONLenOfArray"></a>LenOfArray</pre> +<div class="info"> +Raised when <a href="Cil.html#VALlenOfArray"><code class="code">Cil.lenOfArray</code></a> fails either because the length is <code class="code">None</code> + or because it is a non-constant expression<br> +</div> +<pre><span class="keyword">val</span> <a name="VALlenOfArray"></a>lenOfArray : <code class="type"><a href="Cil.html#TYPEexp">exp</a> option -> int</code></pre><div class="info"> +Call to compute the array length as present in the array type, to an + integer. Raises <a href="Cil.html#EXCEPTIONLenOfArray"><code class="code">Cil.LenOfArray</code></a> if not able to compute the length, such + as when there is no length or the length is not a constant.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALgetCompField"></a>getCompField : <code class="type"><a href="Cil.html#TYPEcompinfo">compinfo</a> -> string -> <a href="Cil.html#TYPEfieldinfo">fieldinfo</a></code></pre><div class="info"> +Return a named fieldinfo in compinfo, or raise Not_found<br> +</div> +<br><code><span class="keyword">type</span> <a name="TYPEexistsAction"></a><code class="type"></code>existsAction = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">ExistsTrue</span></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">ExistsFalse</span></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">ExistsMaybe</span></code></td> + +</tr></table> + +<div class="info"> +A datatype to be used in conjunction with <code class="code">existsType</code><br> +</div> + +<pre><span class="keyword">val</span> <a name="VALexistsType"></a>existsType : <code class="type">(<a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEexistsAction">existsAction</a>) -> <a href="Cil.html#TYPEtyp">typ</a> -> bool</code></pre><div class="info"> +Scans a type by applying the function on all elements. + When the function returns ExistsTrue, the scan stops with + true. When the function returns ExistsFalse then the current branch is not + scanned anymore. Care is taken to + apply the function only once on each composite type, thus avoiding + circularity. When the function returns ExistsMaybe then the types that + construct the current type are scanned (e.g. the base type for TPtr and + TArray, the type of fields for a TComp, etc).<br> +</div> +<pre><span class="keyword">val</span> <a name="VALsplitFunctionType"></a>splitFunctionType : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -><br> <a href="Cil.html#TYPEtyp">typ</a> * (string * <a href="Cil.html#TYPEtyp">typ</a> * <a href="Cil.html#TYPEattributes">attributes</a>) list option * bool *<br> <a href="Cil.html#TYPEattributes">attributes</a></code></pre><div class="info"> +Given a function type split it into return type, + arguments, is_vararg and attributes. An error is raised if the type is not + a function type +<p> +Same as <a href="Cil.html#VALsplitFunctionType"><code class="code">Cil.splitFunctionType</code></a> but takes a varinfo. Prints a nicer + error message if the varinfo is not for a function<br> +</div> +<pre><span class="keyword">val</span> <a name="VALsplitFunctionTypeVI"></a>splitFunctionTypeVI : <code class="type"><a href="Cil.html#TYPEvarinfo">varinfo</a> -><br> <a href="Cil.html#TYPEtyp">typ</a> * (string * <a href="Cil.html#TYPEtyp">typ</a> * <a href="Cil.html#TYPEattributes">attributes</a>) list option * bool *<br> <a href="Cil.html#TYPEattributes">attributes</a></code></pre><br> +<b>Type signatures</b><br> +<br> +Type signatures. Two types are identical iff they have identical + signatures. These contain the same information as types but canonicalized. + For example, two function types that are identical except for the name of + the formal arguments are given the same signature. Also, <code class="code">TNamed</code> + constructors are unrolled. You shoud use <code class="code">Util.equals</code> to compare type + signatures because they might still contain circular structures (through + attributes, and sizeof)<br> +<pre><span class="keyword">val</span> <a name="VALd_typsig"></a>d_typsig : <code class="type">unit -> <a href="Cil.html#TYPEtypsig">typsig</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Print a type signature<br> +</div> +<pre><span class="keyword">val</span> <a name="VALtypeSig"></a>typeSig : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEtypsig">typsig</a></code></pre><div class="info"> +Compute a type signature<br> +</div> +<pre><span class="keyword">val</span> <a name="VALtypeSigWithAttrs"></a>typeSigWithAttrs : <code class="type">?ignoreSign:bool -><br> (<a href="Cil.html#TYPEattributes">attributes</a> -> <a href="Cil.html#TYPEattributes">attributes</a>) -> <a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEtypsig">typsig</a></code></pre><div class="info"> +Like <a href="Cil.html#VALtypeSig"><code class="code">Cil.typeSig</code></a> but customize the incorporation of attributes. + Use ~ignoreSign:true to convert all signed integer types to unsigned, + so that signed and unsigned will compare the same.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALsetTypeSigAttrs"></a>setTypeSigAttrs : <code class="type"><a href="Cil.html#TYPEattributes">attributes</a> -> <a href="Cil.html#TYPEtypsig">typsig</a> -> <a href="Cil.html#TYPEtypsig">typsig</a></code></pre><div class="info"> +Replace the attributes of a signature (only at top level)<br> +</div> +<pre><span class="keyword">val</span> <a name="VALtypeSigAttrs"></a>typeSigAttrs : <code class="type"><a href="Cil.html#TYPEtypsig">typsig</a> -> <a href="Cil.html#TYPEattributes">attributes</a></code></pre><div class="info"> +Get the top-level attributes of a signature<br> +</div> +<br> +LVALUES<br> +<pre><span class="keyword">val</span> <a name="VALmakeVarinfo"></a>makeVarinfo : <code class="type">bool -> string -> <a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEvarinfo">varinfo</a></code></pre><div class="info"> +Make a varinfo. Use this (rarely) to make a raw varinfo. Use other + functions to make locals (<a href="Cil.html#VALmakeLocalVar"><code class="code">Cil.makeLocalVar</code></a> or <a href="Cil.html#VALmakeFormalVar"><code class="code">Cil.makeFormalVar</code></a> or + <a href="Cil.html#VALmakeTempVar"><code class="code">Cil.makeTempVar</code></a>) and globals (<a href="Cil.html#VALmakeGlobalVar"><code class="code">Cil.makeGlobalVar</code></a>). Note that this + function will assign a new identifier. The first argument specifies + whether the varinfo is for a global.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmakeFormalVar"></a>makeFormalVar : <code class="type"><a href="Cil.html#TYPEfundec">fundec</a> -> ?where:string -> string -> <a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEvarinfo">varinfo</a></code></pre><div class="info"> +Make a formal variable for a function. Insert it in both the sformals + and the type of the function. You can optionally specify where to insert + this one. If where = "^" then it is inserted first. If where = "$" then + it is inserted last. Otherwise where must be the name of a formal after + which to insert this. By default it is inserted at the end.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmakeLocalVar"></a>makeLocalVar : <code class="type"><a href="Cil.html#TYPEfundec">fundec</a> -> ?insert:bool -> string -> <a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEvarinfo">varinfo</a></code></pre><div class="info"> +Make a local variable and add it to a function's slocals (only if insert = + true, which is the default). Make sure you know what you are doing if you + set insert=false.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmakeTempVar"></a>makeTempVar : <code class="type"><a href="Cil.html#TYPEfundec">fundec</a> -> ?name:string -> <a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEvarinfo">varinfo</a></code></pre><div class="info"> +Make a temporary variable and add it to a function's slocals. The name of + the temporary variable will be generated based on the given name hint so + that to avoid conflicts with other locals.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmakeGlobalVar"></a>makeGlobalVar : <code class="type">string -> <a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEvarinfo">varinfo</a></code></pre><div class="info"> +Make a global variable. Your responsibility to make sure that the name + is unique<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcopyVarinfo"></a>copyVarinfo : <code class="type"><a href="Cil.html#TYPEvarinfo">varinfo</a> -> string -> <a href="Cil.html#TYPEvarinfo">varinfo</a></code></pre><div class="info"> +Make a shallow copy of a <code class="code">varinfo</code> and assign a new identifier<br> +</div> +<pre><span class="keyword">val</span> <a name="VALnewVID"></a>newVID : <code class="type">unit -> int</code></pre><div class="info"> +Generate a new variable ID. This will be different than any variable ID + that is generated by <a href="Cil.html#VALmakeLocalVar"><code class="code">Cil.makeLocalVar</code></a> and friends<br> +</div> +<pre><span class="keyword">val</span> <a name="VALaddOffsetLval"></a>addOffsetLval : <code class="type"><a href="Cil.html#TYPEoffset">offset</a> -> <a href="Cil.html#TYPElval">lval</a> -> <a href="Cil.html#TYPElval">lval</a></code></pre><div class="info"> +Add an offset at the end of an lvalue. Make sure the type of the lvalue + and the offset are compatible.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALaddOffset"></a>addOffset : <code class="type"><a href="Cil.html#TYPEoffset">offset</a> -> <a href="Cil.html#TYPEoffset">offset</a> -> <a href="Cil.html#TYPEoffset">offset</a></code></pre><div class="info"> +<code class="code">addOffset o1 o2</code> adds <code class="code">o1</code> to the end of <code class="code">o2</code>.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALremoveOffsetLval"></a>removeOffsetLval : <code class="type"><a href="Cil.html#TYPElval">lval</a> -> <a href="Cil.html#TYPElval">lval</a> * <a href="Cil.html#TYPEoffset">offset</a></code></pre><div class="info"> +Remove ONE offset from the end of an lvalue. Returns the lvalue with the + trimmed offset and the final offset. If the final offset is <code class="code">NoOffset</code> + then the original <code class="code">lval</code> did not have an offset.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALremoveOffset"></a>removeOffset : <code class="type"><a href="Cil.html#TYPEoffset">offset</a> -> <a href="Cil.html#TYPEoffset">offset</a> * <a href="Cil.html#TYPEoffset">offset</a></code></pre><div class="info"> +Remove ONE offset from the end of an offset sequence. Returns the + trimmed offset and the final offset. If the final offset is <code class="code">NoOffset</code> + then the original <code class="code">lval</code> did not have an offset.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALtypeOfLval"></a>typeOfLval : <code class="type"><a href="Cil.html#TYPElval">lval</a> -> <a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +Compute the type of an lvalue<br> +</div> +<pre><span class="keyword">val</span> <a name="VALtypeOffset"></a>typeOffset : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEoffset">offset</a> -> <a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +Compute the type of an offset from a base type<br> +</div> +<br> +<b>Values for manipulating expressions</b><br> +<pre><span class="keyword">val</span> <a name="VALzero"></a>zero : <code class="type"><a href="Cil.html#TYPEexp">exp</a></code></pre><div class="info"> +0<br> +</div> +<pre><span class="keyword">val</span> <a name="VALone"></a>one : <code class="type"><a href="Cil.html#TYPEexp">exp</a></code></pre><div class="info"> +1<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmone"></a>mone : <code class="type"><a href="Cil.html#TYPEexp">exp</a></code></pre><div class="info"> +-1<br> +</div> +<pre><span class="keyword">val</span> <a name="VALkinteger64"></a>kinteger64 : <code class="type"><a href="Cil.html#TYPEikind">ikind</a> -> int64 -> <a href="Cil.html#TYPEexp">exp</a></code></pre><div class="info"> +Construct an integer of a given kind, using OCaml's int64 type. If needed + it will truncate the integer to be within the representable range for the + given kind.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALkinteger"></a>kinteger : <code class="type"><a href="Cil.html#TYPEikind">ikind</a> -> int -> <a href="Cil.html#TYPEexp">exp</a></code></pre><div class="info"> +Construct an integer of a given kind. Converts the integer to int64 and + then uses kinteger64. This might truncate the value if you use a kind + that cannot represent the given integer. This can only happen for one of + the Char or Short kinds<br> +</div> +<pre><span class="keyword">val</span> <a name="VALinteger"></a>integer : <code class="type">int -> <a href="Cil.html#TYPEexp">exp</a></code></pre><div class="info"> +Construct an integer of kind IInt. You can use this always since the + OCaml integers are 31 bits and are guaranteed to fit in an IInt<br> +</div> +<pre><span class="keyword">val</span> <a name="VALisInteger"></a>isInteger : <code class="type"><a href="Cil.html#TYPEexp">exp</a> -> int64 option</code></pre><div class="info"> +True if the given expression is a (possibly cast'ed) + character or an integer constant<br> +</div> +<pre><span class="keyword">val</span> <a name="VALisConstant"></a>isConstant : <code class="type"><a href="Cil.html#TYPEexp">exp</a> -> bool</code></pre><div class="info"> +True if the expression is a compile-time constant<br> +</div> +<pre><span class="keyword">val</span> <a name="VALisZero"></a>isZero : <code class="type"><a href="Cil.html#TYPEexp">exp</a> -> bool</code></pre><div class="info"> +True if the given expression is a (possibly cast'ed) integer or character + constant with value zero<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcharConstToInt"></a>charConstToInt : <code class="type">char -> <a href="Cil.html#TYPEconstant">constant</a></code></pre><div class="info"> +Given the character c in a (CChr c), sign-extend it to 32 bits. + (This is the official way of interpreting character constants, according to + ISO C 6.4.4.4.10, which says that character constants are chars cast to ints) + Returns CInt64(sign-extened c, IInt, None)<br> +</div> +<pre><span class="keyword">val</span> <a name="VALconstFold"></a>constFold : <code class="type">bool -> <a href="Cil.html#TYPEexp">exp</a> -> <a href="Cil.html#TYPEexp">exp</a></code></pre><div class="info"> +Do constant folding on an expression. If the first argument is true then + will also compute compiler-dependent expressions such as sizeof<br> +</div> +<pre><span class="keyword">val</span> <a name="VALconstFoldBinOp"></a>constFoldBinOp : <code class="type">bool -> <a href="Cil.html#TYPEbinop">binop</a> -> <a href="Cil.html#TYPEexp">exp</a> -> <a href="Cil.html#TYPEexp">exp</a> -> <a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEexp">exp</a></code></pre><div class="info"> +Do constant folding on a binary operation. The bulk of the work done by + <code class="code">constFold</code> is done here. If the first argument is true then + will also compute compiler-dependent expressions such as sizeof<br> +</div> +<pre><span class="keyword">val</span> <a name="VALincrem"></a>increm : <code class="type"><a href="Cil.html#TYPEexp">exp</a> -> int -> <a href="Cil.html#TYPEexp">exp</a></code></pre><div class="info"> +Increment an expression. Can be arithmetic or pointer type<br> +</div> +<pre><span class="keyword">val</span> <a name="VALvar"></a>var : <code class="type"><a href="Cil.html#TYPEvarinfo">varinfo</a> -> <a href="Cil.html#TYPElval">lval</a></code></pre><div class="info"> +Makes an lvalue out of a given variable<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmkAddrOf"></a>mkAddrOf : <code class="type"><a href="Cil.html#TYPElval">lval</a> -> <a href="Cil.html#TYPEexp">exp</a></code></pre><div class="info"> +Make an AddrOf. Given an lvalue of type T will give back an expression of + type ptr(T). It optimizes somewhat expressions like "& v" and "& v<code class="code">0</code>"<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmkAddrOrStartOf"></a>mkAddrOrStartOf : <code class="type"><a href="Cil.html#TYPElval">lval</a> -> <a href="Cil.html#TYPEexp">exp</a></code></pre><div class="info"> +Like mkAddrOf except if the type of lval is an array then it uses + StartOf. This is the right operation for getting a pointer to the start + of the storage denoted by lval.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmkMem"></a>mkMem : <code class="type">addr:<a href="Cil.html#TYPEexp">exp</a> -> off:<a href="Cil.html#TYPEoffset">offset</a> -> <a href="Cil.html#TYPElval">lval</a></code></pre><div class="info"> +Make a Mem, while optimizing AddrOf. The type of the addr must be + TPtr(t) and the type of the resulting lval is t. Note that in CIL the + implicit conversion between an array and the pointer to the first + element does not apply. You must do the conversion yourself using + StartOf<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmkString"></a>mkString : <code class="type">string -> <a href="Cil.html#TYPEexp">exp</a></code></pre><div class="info"> +Make an expression that is a string constant (of pointer type)<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmkCastT"></a>mkCastT : <code class="type">e:<a href="Cil.html#TYPEexp">exp</a> -> oldt:<a href="Cil.html#TYPEtyp">typ</a> -> newt:<a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEexp">exp</a></code></pre><div class="info"> +Construct a cast when having the old type of the expression. If the new + type is the same as the old type, then no cast is added.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmkCast"></a>mkCast : <code class="type">e:<a href="Cil.html#TYPEexp">exp</a> -> newt:<a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEexp">exp</a></code></pre><div class="info"> +Like <a href="Cil.html#VALmkCastT"><code class="code">Cil.mkCastT</code></a> but uses typeOf to get <code class="code">oldt</code><br> +</div> +<pre><span class="keyword">val</span> <a name="VALstripCasts"></a>stripCasts : <code class="type"><a href="Cil.html#TYPEexp">exp</a> -> <a href="Cil.html#TYPEexp">exp</a></code></pre><div class="info"> +Removes casts from this expression, but ignores casts within + other expression constructs. So we delete the (A) and (B) casts from + "(A)(B)(x + (C)y)", but leave the (C) cast.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALtypeOf"></a>typeOf : <code class="type"><a href="Cil.html#TYPEexp">exp</a> -> <a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +Compute the type of an expression<br> +</div> +<pre><span class="keyword">val</span> <a name="VALparseInt"></a>parseInt : <code class="type">string -> <a href="Cil.html#TYPEexp">exp</a></code></pre><div class="info"> +Convert a string representing a C integer literal to an expression. + Handles the prefixes 0x and 0 and the suffixes L, U, UL, LL, ULL<br> +</div> +<br> +<b>Values for manipulating statements</b><br> +<pre><span class="keyword">val</span> <a name="VALmkStmt"></a>mkStmt : <code class="type"><a href="Cil.html#TYPEstmtkind">stmtkind</a> -> <a href="Cil.html#TYPEstmt">stmt</a></code></pre><div class="info"> +Construct a statement, given its kind. Initialize the <code class="code">sid</code> field to -1, + and <code class="code">labels</code>, <code class="code">succs</code> and <code class="code">preds</code> to the empty list<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmkBlock"></a>mkBlock : <code class="type"><a href="Cil.html#TYPEstmt">stmt</a> list -> <a href="Cil.html#TYPEblock">block</a></code></pre><div class="info"> +Construct a block with no attributes, given a list of statements<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmkStmtOneInstr"></a>mkStmtOneInstr : <code class="type"><a href="Cil.html#TYPEinstr">instr</a> -> <a href="Cil.html#TYPEstmt">stmt</a></code></pre><div class="info"> +Construct a statement consisting of just one instruction<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcompactStmts"></a>compactStmts : <code class="type"><a href="Cil.html#TYPEstmt">stmt</a> list -> <a href="Cil.html#TYPEstmt">stmt</a> list</code></pre><div class="info"> +Try to compress statements so as to get maximal basic blocks<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmkEmptyStmt"></a>mkEmptyStmt : <code class="type">unit -> <a href="Cil.html#TYPEstmt">stmt</a></code></pre><div class="info"> +Returns an empty statement (of kind <code class="code">Instr</code>)<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdummyInstr"></a>dummyInstr : <code class="type"><a href="Cil.html#TYPEinstr">instr</a></code></pre><div class="info"> +A instr to serve as a placeholder<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdummyStmt"></a>dummyStmt : <code class="type"><a href="Cil.html#TYPEstmt">stmt</a></code></pre><div class="info"> +A statement consisting of just <code class="code">dummyInstr</code><br> +</div> +<pre><span class="keyword">val</span> <a name="VALmkWhile"></a>mkWhile : <code class="type">guard:<a href="Cil.html#TYPEexp">exp</a> -> body:<a href="Cil.html#TYPEstmt">stmt</a> list -> <a href="Cil.html#TYPEstmt">stmt</a> list</code></pre><div class="info"> +Make a while loop. Can contain Break or Continue<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmkForIncr"></a>mkForIncr : <code class="type">iter:<a href="Cil.html#TYPEvarinfo">varinfo</a> -><br> first:<a href="Cil.html#TYPEexp">exp</a> -><br> stopat:<a href="Cil.html#TYPEexp">exp</a> -> incr:<a href="Cil.html#TYPEexp">exp</a> -> body:<a href="Cil.html#TYPEstmt">stmt</a> list -> <a href="Cil.html#TYPEstmt">stmt</a> list</code></pre><div class="info"> +Make a for loop for(i=start; i<past; i += incr) { ... }. The body + can contain Break but not Continue. Can be used with i a pointer + or an integer. Start and done must have the same type but incr + must be an integer<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmkFor"></a>mkFor : <code class="type">start:<a href="Cil.html#TYPEstmt">stmt</a> list -><br> guard:<a href="Cil.html#TYPEexp">exp</a> -> next:<a href="Cil.html#TYPEstmt">stmt</a> list -> body:<a href="Cil.html#TYPEstmt">stmt</a> list -> <a href="Cil.html#TYPEstmt">stmt</a> list</code></pre><div class="info"> +Make a for loop for(start; guard; next) { ... }. The body can + contain Break but not Continue !!!<br> +</div> +<br> +<b>Values for manipulating attributes</b><br> +<br><code><span class="keyword">type</span> <a name="TYPEattributeClass"></a><code class="type"></code>attributeClass = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">AttrName</span> <span class="keyword">of</span> <code class="type">bool</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Attribute of a name. If argument is true and we are on MSVC then + the attribute is printed using __declspec as part of the storage + specifier</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">AttrFunType</span> <span class="keyword">of</span> <code class="type">bool</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Attribute of a function type. If argument is true and we are on + MSVC then the attribute is printed just before the function name</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">AttrType</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Attribute of a type</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + +<div class="info"> +Various classes of attributes<br> +</div> + +<pre><span class="keyword">val</span> <a name="VALattributeHash"></a>attributeHash : <code class="type">(string, <a href="Cil.html#TYPEattributeClass">attributeClass</a>) Hashtbl.t</code></pre><div class="info"> +This table contains the mapping of predefined attributes to classes. + Extend this table with more attributes as you need. This table is used to + determine how to associate attributes with names or types<br> +</div> +<pre><span class="keyword">val</span> <a name="VALpartitionAttributes"></a>partitionAttributes : <code class="type">default:<a href="Cil.html#TYPEattributeClass">attributeClass</a> -><br> <a href="Cil.html#TYPEattributes">attributes</a> -><br> <a href="Cil.html#TYPEattribute">attribute</a> list * <a href="Cil.html#TYPEattribute">attribute</a> list * <a href="Cil.html#TYPEattribute">attribute</a> list</code></pre><div class="info"> +Partition the attributes into classes:name attributes, function type, + and type attributes<br> +</div> +<pre><span class="keyword">val</span> <a name="VALaddAttribute"></a>addAttribute : <code class="type"><a href="Cil.html#TYPEattribute">attribute</a> -> <a href="Cil.html#TYPEattributes">attributes</a> -> <a href="Cil.html#TYPEattributes">attributes</a></code></pre><div class="info"> +Add an attribute. Maintains the attributes in sorted order of the second + argument<br> +</div> +<pre><span class="keyword">val</span> <a name="VALaddAttributes"></a>addAttributes : <code class="type"><a href="Cil.html#TYPEattribute">attribute</a> list -> <a href="Cil.html#TYPEattributes">attributes</a> -> <a href="Cil.html#TYPEattributes">attributes</a></code></pre><div class="info"> +Add a list of attributes. Maintains the attributes in sorted order. The + second argument must be sorted, but not necessarily the first<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdropAttribute"></a>dropAttribute : <code class="type">string -> <a href="Cil.html#TYPEattributes">attributes</a> -> <a href="Cil.html#TYPEattributes">attributes</a></code></pre><div class="info"> +Remove all attributes with the given name. Maintains the attributes in + sorted order.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdropAttributes"></a>dropAttributes : <code class="type">string list -> <a href="Cil.html#TYPEattributes">attributes</a> -> <a href="Cil.html#TYPEattributes">attributes</a></code></pre><div class="info"> +Remove all attributes with names appearing in the string list. + Maintains the attributes in sorted order<br> +</div> +<pre><span class="keyword">val</span> <a name="VALfilterAttributes"></a>filterAttributes : <code class="type">string -> <a href="Cil.html#TYPEattributes">attributes</a> -> <a href="Cil.html#TYPEattributes">attributes</a></code></pre><div class="info"> +Retains attributes with the given name<br> +</div> +<pre><span class="keyword">val</span> <a name="VALhasAttribute"></a>hasAttribute : <code class="type">string -> <a href="Cil.html#TYPEattributes">attributes</a> -> bool</code></pre><div class="info"> +True if the named attribute appears in the attribute list. The list of + attributes must be sorted.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALtypeAttrs"></a>typeAttrs : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEattribute">attribute</a> list</code></pre><div class="info"> +Returns all the attributes contained in a type. This requires a traversal + of the type structure, in case of composite, enumeration and named types<br> +</div> +<pre><span class="keyword">val</span> <a name="VALsetTypeAttrs"></a>setTypeAttrs : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEattributes">attributes</a> -> <a href="Cil.html#TYPEtyp">typ</a></code></pre><pre><span class="keyword">val</span> <a name="VALtypeAddAttributes"></a>typeAddAttributes : <code class="type"><a href="Cil.html#TYPEattribute">attribute</a> list -> <a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +Add some attributes to a type<br> +</div> +<pre><span class="keyword">val</span> <a name="VALtypeRemoveAttributes"></a>typeRemoveAttributes : <code class="type">string list -> <a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +Remove all attributes with the given names from a type. Note that this + does not remove attributes from typedef and tag definitions, just from + their uses<br> +</div> +<br> +<b>The visitor</b><br> +<br><code><span class="keyword">type</span> <a name="TYPEvisitAction"></a><code class="type">'a</code> visitAction = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">SkipChildren</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Do not visit the children. Return + the node as it is.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">DoChildren</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Continue with the children of this + node. Rebuild the node on return + if any of the children changes + (use == test)</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">ChangeTo</span> <span class="keyword">of</span> <code class="type">'a</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Replace the expression with the + given one</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">ChangeDoChildrenPost</span> <span class="keyword">of</span> <code class="type">'a * ('a -> 'a)</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>First consider that the entire + exp is replaced by the first + parameter. Then continue with + the children. On return rebuild + the node if any of the children + has changed and then apply the + function on the node</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + +<div class="info"> +Different visiting actions. 'a will be instantiated with <code class="code">exp</code>, <code class="code">instr</code>, + etc.<br> +</div> + +<pre><span class="keyword">class type</span> <a name="TYPEcilVisitor"></a><a href="Cil.cilVisitor.html">cilVisitor</a> = <code class="code">object</code> <a href="Cil.cilVisitor.html">..</a> <code class="code">end</code></pre><div class="info"> +A visitor interface for traversing CIL trees. +</div> +<pre><span class="keyword">class</span> <a name="TYPEnopCilVisitor"></a><a href="Cil.nopCilVisitor.html">nopCilVisitor</a> : <code class="type"></code><code class="type"><a href="Cil.cilVisitor.html">cilVisitor</a></code></pre><div class="info"> +Default Visitor. +</div> +<pre><span class="keyword">val</span> <a name="VALvisitCilFile"></a>visitCilFile : <code class="type"><a href="Cil.cilVisitor.html">cilVisitor</a> -> <a href="Cil.html#TYPEfile">file</a> -> unit</code></pre><div class="info"> +Visit a file. This will will re-cons all globals TWICE (so that it is + tail-recursive). Use <a href="Cil.html#VALvisitCilFileSameGlobals"><code class="code">Cil.visitCilFileSameGlobals</code></a> if your visitor will + not change the list of globals.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALvisitCilFileSameGlobals"></a>visitCilFileSameGlobals : <code class="type"><a href="Cil.cilVisitor.html">cilVisitor</a> -> <a href="Cil.html#TYPEfile">file</a> -> unit</code></pre><div class="info"> +A visitor for the whole file that does not change the globals (but maybe + changes things inside the globals). Use this function instead of + <a href="Cil.html#VALvisitCilFile"><code class="code">Cil.visitCilFile</code></a> whenever appropriate because it is more efficient for + long files.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALvisitCilGlobal"></a>visitCilGlobal : <code class="type"><a href="Cil.cilVisitor.html">cilVisitor</a> -> <a href="Cil.html#TYPEglobal">global</a> -> <a href="Cil.html#TYPEglobal">global</a> list</code></pre><div class="info"> +Visit a global<br> +</div> +<pre><span class="keyword">val</span> <a name="VALvisitCilFunction"></a>visitCilFunction : <code class="type"><a href="Cil.cilVisitor.html">cilVisitor</a> -> <a href="Cil.html#TYPEfundec">fundec</a> -> <a href="Cil.html#TYPEfundec">fundec</a></code></pre><div class="info"> +Visit a function definition<br> +</div> +<pre><span class="keyword">val</span> <a name="VALvisitCilExpr"></a>visitCilExpr : <code class="type"><a href="Cil.cilVisitor.html">cilVisitor</a> -> <a href="Cil.html#TYPEexp">exp</a> -> <a href="Cil.html#TYPEexp">exp</a></code></pre><pre><span class="keyword">val</span> <a name="VALvisitCilLval"></a>visitCilLval : <code class="type"><a href="Cil.cilVisitor.html">cilVisitor</a> -> <a href="Cil.html#TYPElval">lval</a> -> <a href="Cil.html#TYPElval">lval</a></code></pre><div class="info"> +Visit an lvalue<br> +</div> +<pre><span class="keyword">val</span> <a name="VALvisitCilOffset"></a>visitCilOffset : <code class="type"><a href="Cil.cilVisitor.html">cilVisitor</a> -> <a href="Cil.html#TYPEoffset">offset</a> -> <a href="Cil.html#TYPEoffset">offset</a></code></pre><div class="info"> +Visit an lvalue or recursive offset<br> +</div> +<pre><span class="keyword">val</span> <a name="VALvisitCilInitOffset"></a>visitCilInitOffset : <code class="type"><a href="Cil.cilVisitor.html">cilVisitor</a> -> <a href="Cil.html#TYPEoffset">offset</a> -> <a href="Cil.html#TYPEoffset">offset</a></code></pre><div class="info"> +Visit an initializer offset<br> +</div> +<pre><span class="keyword">val</span> <a name="VALvisitCilInstr"></a>visitCilInstr : <code class="type"><a href="Cil.cilVisitor.html">cilVisitor</a> -> <a href="Cil.html#TYPEinstr">instr</a> -> <a href="Cil.html#TYPEinstr">instr</a> list</code></pre><div class="info"> +Visit an instruction<br> +</div> +<pre><span class="keyword">val</span> <a name="VALvisitCilStmt"></a>visitCilStmt : <code class="type"><a href="Cil.cilVisitor.html">cilVisitor</a> -> <a href="Cil.html#TYPEstmt">stmt</a> -> <a href="Cil.html#TYPEstmt">stmt</a></code></pre><div class="info"> +Visit a statement<br> +</div> +<pre><span class="keyword">val</span> <a name="VALvisitCilBlock"></a>visitCilBlock : <code class="type"><a href="Cil.cilVisitor.html">cilVisitor</a> -> <a href="Cil.html#TYPEblock">block</a> -> <a href="Cil.html#TYPEblock">block</a></code></pre><div class="info"> +Visit a block<br> +</div> +<pre><span class="keyword">val</span> <a name="VALvisitCilType"></a>visitCilType : <code class="type"><a href="Cil.cilVisitor.html">cilVisitor</a> -> <a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEtyp">typ</a></code></pre><div class="info"> +Visit a type<br> +</div> +<pre><span class="keyword">val</span> <a name="VALvisitCilVarDecl"></a>visitCilVarDecl : <code class="type"><a href="Cil.cilVisitor.html">cilVisitor</a> -> <a href="Cil.html#TYPEvarinfo">varinfo</a> -> <a href="Cil.html#TYPEvarinfo">varinfo</a></code></pre><div class="info"> +Visit a variable declaration<br> +</div> +<pre><span class="keyword">val</span> <a name="VALvisitCilInit"></a>visitCilInit : <code class="type"><a href="Cil.cilVisitor.html">cilVisitor</a> -> <a href="Cil.html#TYPEinit">init</a> -> <a href="Cil.html#TYPEinit">init</a></code></pre><div class="info"> +Visit an initializer<br> +</div> +<pre><span class="keyword">val</span> <a name="VALvisitCilAttributes"></a>visitCilAttributes : <code class="type"><a href="Cil.cilVisitor.html">cilVisitor</a> -> <a href="Cil.html#TYPEattribute">attribute</a> list -> <a href="Cil.html#TYPEattribute">attribute</a> list</code></pre><div class="info"> +Visit a list of attributes<br> +</div> +<br> +<b>Utility functions</b><br> +<pre><span class="keyword">val</span> <a name="VALmsvcMode"></a>msvcMode : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +Whether the pretty printer should print output for the MS VC compiler. + Default is GCC. After you set this function you should call <a href="Cil.html#VALinitCIL"><code class="code">Cil.initCIL</code></a>.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALuseLogicalOperators"></a>useLogicalOperators : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +Whether to use the logical operands LAnd and LOr. By default, do not use + them because they are unlike other expressions and do not evaluate both of + their operands<br> +</div> +<pre><span class="keyword">val</span> <a name="VALconstFoldVisitor"></a>constFoldVisitor : <code class="type">bool -> <a href="Cil.cilVisitor.html">cilVisitor</a></code></pre><div class="info"> +A visitor that does constant folding. Pass as argument whether you want + machine specific simplifications to be done, or not.<br> +</div> +<br><code><span class="keyword">type</span> <a name="TYPElineDirectiveStyle"></a><code class="type"></code>lineDirectiveStyle = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">LineComment</span></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">LinePreprocessorInput</span></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">LinePreprocessorOutput</span></code></td> + +</tr></table> + +<div class="info"> +Styles of printing line directives<br> +</div> + +<pre><span class="keyword">val</span> <a name="VALlineDirectiveStyle"></a>lineDirectiveStyle : <code class="type"><a href="Cil.html#TYPElineDirectiveStyle">lineDirectiveStyle</a> option Pervasives.ref</code></pre><div class="info"> +How to print line directives<br> +</div> +<pre><span class="keyword">val</span> <a name="VALprint_CIL_Input"></a>print_CIL_Input : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +Whether we print something that will only be used as input to our own + parser. In that case we are a bit more liberal in what we print<br> +</div> +<pre><span class="keyword">val</span> <a name="VALprintCilAsIs"></a>printCilAsIs : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +Whether to print the CIL as they are, without trying to be smart and + print nicer code. Normally this is false, in which case the pretty + printer will turn the while(1) loops of CIL into nicer loops, will not + print empty "else" blocks, etc. These is one case howewer in which if you + turn this on you will get code that does not compile: if you use varargs + the __builtin_va_arg function will be printed in its internal form.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALlineLength"></a>lineLength : <code class="type">int Pervasives.ref</code></pre><div class="info"> +The length used when wrapping output lines. Setting this variable to + a large integer will prevent wrapping and make #line directives more + accurate.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALforgcc"></a>forgcc : <code class="type">string -> string</code></pre><div class="info"> +Return the string 's' if we're printing output for gcc, suppres + it if we're printing for CIL to parse back in. the purpose is to + hide things from gcc that it complains about, but still be able + to do lossless transformations when CIL is the consumer<br> +</div> +<br> +<b>Debugging support</b><br> +<pre><span class="keyword">val</span> <a name="VALcurrentLoc"></a>currentLoc : <code class="type"><a href="Cil.html#TYPElocation">location</a> Pervasives.ref</code></pre><div class="info"> +A reference to the current location. If you are careful to set this to + the current location then you can use some built-in logging functions that + will print the location.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcurrentGlobal"></a>currentGlobal : <code class="type"><a href="Cil.html#TYPEglobal">global</a> Pervasives.ref</code></pre><div class="info"> +A reference to the current global being visited<br> +</div> +<br> +CIL has a fairly easy to use mechanism for printing error messages. This + mechanism is built on top of the pretty-printer mechanism (see + <a href="Pretty.html#TYPEdoc"><code class="code">Pretty.doc</code></a>) and the error-message modules (see <a href="Errormsg.html#VALerror"><code class="code">Errormsg.error</code></a>). +<p> + + Here is a typical example for printing a log message: <pre> +ignore (Errormsg.log "Expression %a is not positive (at %s:%i)\n" + d_exp e loc.file loc.line) +</pre> +<p> + + and here is an example of how you print a fatal error message that stop the + execution: <pre> +Errormsg.s (Errormsg.bug "Why am I here?") +</pre> +<p> + + Notice that you can use C format strings with some extension. The most +useful extension is "%a" that means to consumer the next two argument from +the argument list and to apply the first to <code class="code">unit</code> and then to the second +and to print the resulting <a href="Pretty.html#TYPEdoc"><code class="code">Pretty.doc</code></a>. For each major type in CIL there is +a corresponding function that pretty-prints an element of that type:<br> +<pre><span class="keyword">val</span> <a name="VALd_loc"></a>d_loc : <code class="type">unit -> <a href="Cil.html#TYPElocation">location</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print a location<br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_thisloc"></a>d_thisloc : <code class="type">unit -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print the <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a><br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_ikind"></a>d_ikind : <code class="type">unit -> <a href="Cil.html#TYPEikind">ikind</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print an integer of a given kind<br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_fkind"></a>d_fkind : <code class="type">unit -> <a href="Cil.html#TYPEfkind">fkind</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print a floating-point kind<br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_storage"></a>d_storage : <code class="type">unit -> <a href="Cil.html#TYPEstorage">storage</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print storage-class information<br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_const"></a>d_const : <code class="type">unit -> <a href="Cil.html#TYPEconstant">constant</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print a constant<br> +</div> +<pre><span class="keyword">val</span> <a name="VALderefStarLevel"></a>derefStarLevel : <code class="type">int</code></pre><pre><span class="keyword">val</span> <a name="VALindexLevel"></a>indexLevel : <code class="type">int</code></pre><pre><span class="keyword">val</span> <a name="VALarrowLevel"></a>arrowLevel : <code class="type">int</code></pre><pre><span class="keyword">val</span> <a name="VALaddrOfLevel"></a>addrOfLevel : <code class="type">int</code></pre><pre><span class="keyword">val</span> <a name="VALadditiveLevel"></a>additiveLevel : <code class="type">int</code></pre><pre><span class="keyword">val</span> <a name="VALcomparativeLevel"></a>comparativeLevel : <code class="type">int</code></pre><pre><span class="keyword">val</span> <a name="VALbitwiseLevel"></a>bitwiseLevel : <code class="type">int</code></pre><pre><span class="keyword">val</span> <a name="VALgetParenthLevel"></a>getParenthLevel : <code class="type"><a href="Cil.html#TYPEexp">exp</a> -> int</code></pre><div class="info"> +Parentheses level. An expression "a op b" is printed parenthesized if its + parentheses level is >= that that of its context. Identifiers have the + lowest level and weakly binding operators (e.g. |) have the largest level. + The correctness criterion is that a smaller level MUST correspond to a + stronger precedence!<br> +</div> +<pre><span class="keyword">class type</span> <a name="TYPEcilPrinter"></a><a href="Cil.cilPrinter.html">cilPrinter</a> = <code class="code">object</code> <a href="Cil.cilPrinter.html">..</a> <code class="code">end</code></pre><div class="info"> +A printer interface for CIL trees. +</div> +<pre><span class="keyword">class</span> <a name="TYPEdefaultCilPrinterClass"></a><a href="Cil.defaultCilPrinterClass.html">defaultCilPrinterClass</a> : <code class="type"></code><code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a></code></pre><pre><span class="keyword">val</span> <a name="VALdefaultCilPrinter"></a>defaultCilPrinter : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a></code></pre><pre><span class="keyword">class</span> <a name="TYPEplainCilPrinterClass"></a><a href="Cil.plainCilPrinterClass.html">plainCilPrinterClass</a> : <code class="type"></code><code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a></code></pre><div class="info"> +These are pretty-printers that will show you more details on the internal + CIL representation, without trying hard to make it look like C +</div> +<pre><span class="keyword">val</span> <a name="VALplainCilPrinter"></a>plainCilPrinter : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a></code></pre><pre><span class="keyword">val</span> <a name="VALprinterForMaincil"></a>printerForMaincil : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a> Pervasives.ref</code></pre><pre><span class="keyword">val</span> <a name="VALprintType"></a>printType : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a> -> unit -> <a href="Cil.html#TYPEtyp">typ</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Print a type given a pretty printer<br> +</div> +<pre><span class="keyword">val</span> <a name="VALprintExp"></a>printExp : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a> -> unit -> <a href="Cil.html#TYPEexp">exp</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Print an expression given a pretty printer<br> +</div> +<pre><span class="keyword">val</span> <a name="VALprintLval"></a>printLval : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a> -> unit -> <a href="Cil.html#TYPElval">lval</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Print an lvalue given a pretty printer<br> +</div> +<pre><span class="keyword">val</span> <a name="VALprintGlobal"></a>printGlobal : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a> -> unit -> <a href="Cil.html#TYPEglobal">global</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Print a global given a pretty printer<br> +</div> +<pre><span class="keyword">val</span> <a name="VALprintAttr"></a>printAttr : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a> -> unit -> <a href="Cil.html#TYPEattribute">attribute</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Print an attribute given a pretty printer<br> +</div> +<pre><span class="keyword">val</span> <a name="VALprintAttrs"></a>printAttrs : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a> -> unit -> <a href="Cil.html#TYPEattributes">attributes</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Print a set of attributes given a pretty printer<br> +</div> +<pre><span class="keyword">val</span> <a name="VALprintInstr"></a>printInstr : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a> -> unit -> <a href="Cil.html#TYPEinstr">instr</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Print an instruction given a pretty printer<br> +</div> +<pre><span class="keyword">val</span> <a name="VALprintStmt"></a>printStmt : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a> -> unit -> <a href="Cil.html#TYPEstmt">stmt</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Print a statement given a pretty printer. This can take very long + (or even overflow the stack) for huge statements. Use <a href="Cil.html#VALdumpStmt"><code class="code">Cil.dumpStmt</code></a> + instead.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALprintBlock"></a>printBlock : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a> -> unit -> <a href="Cil.html#TYPEblock">block</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Print a block given a pretty printer. This can take very long + (or even overflow the stack) for huge block. Use <a href="Cil.html#VALdumpBlock"><code class="code">Cil.dumpBlock</code></a> + instead.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdumpStmt"></a>dumpStmt : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a> -> Pervasives.out_channel -> int -> <a href="Cil.html#TYPEstmt">stmt</a> -> unit</code></pre><div class="info"> +Dump a statement to a file using a given indentation. Use this instead of + <a href="Cil.html#VALprintStmt"><code class="code">Cil.printStmt</code></a> whenever possible.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdumpBlock"></a>dumpBlock : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a> -> Pervasives.out_channel -> int -> <a href="Cil.html#TYPEblock">block</a> -> unit</code></pre><div class="info"> +Dump a block to a file using a given indentation. Use this instead of + <a href="Cil.html#VALprintBlock"><code class="code">Cil.printBlock</code></a> whenever possible.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALprintInit"></a>printInit : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a> -> unit -> <a href="Cil.html#TYPEinit">init</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Print an initializer given a pretty printer. This can take very long + (or even overflow the stack) for huge initializers. Use <a href="Cil.html#VALdumpInit"><code class="code">Cil.dumpInit</code></a> + instead.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdumpInit"></a>dumpInit : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a> -> Pervasives.out_channel -> int -> <a href="Cil.html#TYPEinit">init</a> -> unit</code></pre><div class="info"> +Dump an initializer to a file using a given indentation. Use this instead of + <a href="Cil.html#VALprintInit"><code class="code">Cil.printInit</code></a> whenever possible.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_type"></a>d_type : <code class="type">unit -> <a href="Cil.html#TYPEtyp">typ</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print a type using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a><br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_exp"></a>d_exp : <code class="type">unit -> <a href="Cil.html#TYPEexp">exp</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print an expression using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a><br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_lval"></a>d_lval : <code class="type">unit -> <a href="Cil.html#TYPElval">lval</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print an lvalue using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a><br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_offset"></a>d_offset : <code class="type"><a href="Pretty.html#TYPEdoc">Pretty.doc</a> -> unit -> <a href="Cil.html#TYPEoffset">offset</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print an offset using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a>, given the pretty + printing for the base.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_init"></a>d_init : <code class="type">unit -> <a href="Cil.html#TYPEinit">init</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print an initializer using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a>. This can be + extremely slow (or even overflow the stack) for huge initializers. Use + <a href="Cil.html#VALdumpInit"><code class="code">Cil.dumpInit</code></a> instead.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_binop"></a>d_binop : <code class="type">unit -> <a href="Cil.html#TYPEbinop">binop</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print a binary operator<br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_unop"></a>d_unop : <code class="type">unit -> <a href="Cil.html#TYPEunop">unop</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print a unary operator<br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_attr"></a>d_attr : <code class="type">unit -> <a href="Cil.html#TYPEattribute">attribute</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print an attribute using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a><br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_attrparam"></a>d_attrparam : <code class="type">unit -> <a href="Cil.html#TYPEattrparam">attrparam</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print an argument of an attribute using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a><br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_attrlist"></a>d_attrlist : <code class="type">unit -> <a href="Cil.html#TYPEattributes">attributes</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print a list of attributes using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a><br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_instr"></a>d_instr : <code class="type">unit -> <a href="Cil.html#TYPEinstr">instr</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print an instruction using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a><br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_label"></a>d_label : <code class="type">unit -> <a href="Cil.html#TYPElabel">label</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print a label using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a><br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_stmt"></a>d_stmt : <code class="type">unit -> <a href="Cil.html#TYPEstmt">stmt</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print a statement using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a>. This can be + extremely slow (or even overflow the stack) for huge statements. Use + <a href="Cil.html#VALdumpStmt"><code class="code">Cil.dumpStmt</code></a> instead.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_block"></a>d_block : <code class="type">unit -> <a href="Cil.html#TYPEblock">block</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print a block using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a>. This can be + extremely slow (or even overflow the stack) for huge blocks. Use + <a href="Cil.html#VALdumpBlock"><code class="code">Cil.dumpBlock</code></a> instead.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_global"></a>d_global : <code class="type">unit -> <a href="Cil.html#TYPEglobal">global</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print the internal representation of a global using + <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a>. This can be extremely slow (or even overflow the + stack) for huge globals (such as arrays with lots of initializers). Use + <a href="Cil.html#VALdumpGlobal"><code class="code">Cil.dumpGlobal</code></a> instead.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdn_exp"></a>dn_exp : <code class="type">unit -> <a href="Cil.html#TYPEexp">exp</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Versions of the above pretty printers, that don't print #line directives<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdn_lval"></a>dn_lval : <code class="type">unit -> <a href="Cil.html#TYPElval">lval</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><pre><span class="keyword">val</span> <a name="VALdn_init"></a>dn_init : <code class="type">unit -> <a href="Cil.html#TYPEinit">init</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><pre><span class="keyword">val</span> <a name="VALdn_type"></a>dn_type : <code class="type">unit -> <a href="Cil.html#TYPEtyp">typ</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><pre><span class="keyword">val</span> <a name="VALdn_global"></a>dn_global : <code class="type">unit -> <a href="Cil.html#TYPEglobal">global</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><pre><span class="keyword">val</span> <a name="VALdn_attrlist"></a>dn_attrlist : <code class="type">unit -> <a href="Cil.html#TYPEattributes">attributes</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><pre><span class="keyword">val</span> <a name="VALdn_attr"></a>dn_attr : <code class="type">unit -> <a href="Cil.html#TYPEattribute">attribute</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><pre><span class="keyword">val</span> <a name="VALdn_attrparam"></a>dn_attrparam : <code class="type">unit -> <a href="Cil.html#TYPEattrparam">attrparam</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><pre><span class="keyword">val</span> <a name="VALdn_stmt"></a>dn_stmt : <code class="type">unit -> <a href="Cil.html#TYPEstmt">stmt</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><pre><span class="keyword">val</span> <a name="VALdn_instr"></a>dn_instr : <code class="type">unit -> <a href="Cil.html#TYPEinstr">instr</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><pre><span class="keyword">val</span> <a name="VALd_shortglobal"></a>d_shortglobal : <code class="type">unit -> <a href="Cil.html#TYPEglobal">global</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print a short description of the global. This is useful for error + messages<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdumpGlobal"></a>dumpGlobal : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a> -> Pervasives.out_channel -> <a href="Cil.html#TYPEglobal">global</a> -> unit</code></pre><div class="info"> +Pretty-print a global. Here you give the channel where the printout + should be sent.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdumpFile"></a>dumpFile : <code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a> -> Pervasives.out_channel -> string -> <a href="Cil.html#TYPEfile">file</a> -> unit</code></pre><div class="info"> +Pretty-print an entire file. Here you give the channel where the printout + should be sent.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALbug"></a>bug : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) Pervasives.format -> 'a</code></pre><div class="info"> +Like <a href="Errormsg.html#VALbug"><code class="code">Errormsg.bug</code></a> except that <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> is also printed<br> +</div> +<pre><span class="keyword">val</span> <a name="VALunimp"></a>unimp : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) Pervasives.format -> 'a</code></pre><div class="info"> +Like <a href="Errormsg.html#VALunimp"><code class="code">Errormsg.unimp</code></a> except that <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a>is also printed<br> +</div> +<pre><span class="keyword">val</span> <a name="VALerror"></a>error : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) Pervasives.format -> 'a</code></pre><div class="info"> +Like <a href="Errormsg.html#VALerror"><code class="code">Errormsg.error</code></a> except that <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> is also printed<br> +</div> +<pre><span class="keyword">val</span> <a name="VALerrorLoc"></a>errorLoc : <code class="type"><a href="Cil.html#TYPElocation">location</a> -> ('a, unit, <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) Pervasives.format -> 'a</code></pre><div class="info"> +Like <a href="Cil.html#VALerror"><code class="code">Cil.error</code></a> except that it explicitly takes a location argument, + instead of using the <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a><br> +</div> +<pre><span class="keyword">val</span> <a name="VALwarn"></a>warn : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) Pervasives.format -> 'a</code></pre><div class="info"> +Like <a href="Errormsg.html#VALwarn"><code class="code">Errormsg.warn</code></a> except that <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> is also printed<br> +</div> +<pre><span class="keyword">val</span> <a name="VALwarnOpt"></a>warnOpt : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) Pervasives.format -> 'a</code></pre><div class="info"> +Like <a href="Errormsg.html#VALwarnOpt"><code class="code">Errormsg.warnOpt</code></a> except that <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> is also printed. + This warning is printed only of <a href="Errormsg.html#VALwarnFlag"><code class="code">Errormsg.warnFlag</code></a> is set.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALwarnContext"></a>warnContext : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) Pervasives.format -> 'a</code></pre><div class="info"> +Like <a href="Errormsg.html#VALwarn"><code class="code">Errormsg.warn</code></a> except that <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> and context + is also printed<br> +</div> +<pre><span class="keyword">val</span> <a name="VALwarnContextOpt"></a>warnContextOpt : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) Pervasives.format -> 'a</code></pre><div class="info"> +Like <a href="Errormsg.html#VALwarn"><code class="code">Errormsg.warn</code></a> except that <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> and context is also + printed. This warning is printed only of <a href="Errormsg.html#VALwarnFlag"><code class="code">Errormsg.warnFlag</code></a> is set.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALwarnLoc"></a>warnLoc : <code class="type"><a href="Cil.html#TYPElocation">location</a> -> ('a, unit, <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) Pervasives.format -> 'a</code></pre><div class="info"> +Like <a href="Cil.html#VALwarn"><code class="code">Cil.warn</code></a> except that it explicitly takes a location argument, + instead of using the <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a><br> +</div> +<br> +Sometimes you do not want to see the syntactic sugar that the above + pretty-printing functions add. In that case you can use the following + pretty-printing functions. But note that the output of these functions is + not valid C<br> +<pre><span class="keyword">val</span> <a name="VALd_plainexp"></a>d_plainexp : <code class="type">unit -> <a href="Cil.html#TYPEexp">exp</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print the internal representation of an expression<br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_plaininit"></a>d_plaininit : <code class="type">unit -> <a href="Cil.html#TYPEinit">init</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print the internal representation of an integer<br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_plainlval"></a>d_plainlval : <code class="type">unit -> <a href="Cil.html#TYPElval">lval</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print the internal representation of an lvalue<br> +</div> +<br> +Pretty-print the internal representation of an lvalue offset +val d_plainoffset: unit -> offset -> Pretty.doc<br> +<pre><span class="keyword">val</span> <a name="VALd_plaintype"></a>d_plaintype : <code class="type">unit -> <a href="Cil.html#TYPEtyp">typ</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print the internal representation of a type<br> +</div> +<br> +<b>ALPHA conversion</b> has been moved to the Alpha module.<br> +<pre><span class="keyword">val</span> <a name="VALuniqueVarNames"></a>uniqueVarNames : <code class="type"><a href="Cil.html#TYPEfile">file</a> -> unit</code></pre><div class="info"> +Assign unique names to local variables. This might be necessary after you + transformed the code and added or renamed some new variables. Names are + not used by CIL internally, but once you print the file out the compiler + downstream might be confused. You might + have added a new global that happens to have the same name as a local in + some function. Rename the local to ensure that there would never be + confusioin. Or, viceversa, you might have added a local with a name that + conflicts with a global<br> +</div> +<br> +<b>Optimization Passes</b><br> +<pre><span class="keyword">val</span> <a name="VALpeepHole2"></a>peepHole2 : <code class="type">(<a href="Cil.html#TYPEinstr">instr</a> * <a href="Cil.html#TYPEinstr">instr</a> -> <a href="Cil.html#TYPEinstr">instr</a> list option) -> <a href="Cil.html#TYPEstmt">stmt</a> list -> unit</code></pre><div class="info"> +A peephole optimizer that processes two adjacent statements and possibly + replaces them both. If some replacement happens, then the new statements + are themselves subject to optimization<br> +</div> +<pre><span class="keyword">val</span> <a name="VALpeepHole1"></a>peepHole1 : <code class="type">(<a href="Cil.html#TYPEinstr">instr</a> -> <a href="Cil.html#TYPEinstr">instr</a> list option) -> <a href="Cil.html#TYPEstmt">stmt</a> list -> unit</code></pre><div class="info"> +Similar to <code class="code">peepHole2</code> except that the optimization window consists of + one statement, not two<br> +</div> +<br> +<b>Machine dependency</b><br> +<pre><span class="keyword">exception</span> <a name="EXCEPTIONSizeOfError"></a>SizeOfError <span class="keyword">of</span> <code class="type">string * <a href="Cil.html#TYPEtyp">typ</a></code></pre> +<div class="info"> +Raised when one of the bitsSizeOf functions cannot compute the size of a + type. This can happen because the type contains array-length expressions + that we don't know how to compute or because it is a type whose size is + not defined (e.g. TFun or an undefined compinfo). The string is an + explanation of the error<br> +</div> +<pre><span class="keyword">val</span> <a name="VALbitsSizeOf"></a>bitsSizeOf : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> int</code></pre><div class="info"> +The size of a type, in bits. Trailing padding is added for structs and + arrays. Raises <a href="Cil.html#EXCEPTIONSizeOfError"><code class="code">Cil.SizeOfError</code></a> when it cannot compute the size. This + function is architecture dependent, so you should only call this after you + call <a href="Cil.html#VALinitCIL"><code class="code">Cil.initCIL</code></a>. Remember that on GCC sizeof(void) is 1!<br> +</div> +<pre><span class="keyword">val</span> <a name="VALsizeOf"></a>sizeOf : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEexp">exp</a></code></pre><pre><span class="keyword">val</span> <a name="VALalignOf_int"></a>alignOf_int : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> int</code></pre><div class="info"> +The minimum alignment (in bytes) for a type. This function is + architecture dependent, so you should only call this after you call + <a href="Cil.html#VALinitCIL"><code class="code">Cil.initCIL</code></a>.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALbitsOffset"></a>bitsOffset : <code class="type"><a href="Cil.html#TYPEtyp">typ</a> -> <a href="Cil.html#TYPEoffset">offset</a> -> int * int</code></pre><div class="info"> +Give a type of a base and an offset, returns the number of bits from the + base address and the width (also expressed in bits) for the subobject + denoted by the offset. Raises <a href="Cil.html#EXCEPTIONSizeOfError"><code class="code">Cil.SizeOfError</code></a> when it cannot compute + the size. This function is architecture dependent, so you should only call + this after you call <a href="Cil.html#VALinitCIL"><code class="code">Cil.initCIL</code></a>.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALchar_is_unsigned"></a>char_is_unsigned : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +Whether "char" is unsigned. Set after you call <a href="Cil.html#VALinitCIL"><code class="code">Cil.initCIL</code></a><br> +</div> +<pre><span class="keyword">val</span> <a name="VALlittle_endian"></a>little_endian : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +Whether the machine is little endian. Set after you call <a href="Cil.html#VALinitCIL"><code class="code">Cil.initCIL</code></a><br> +</div> +<pre><span class="keyword">val</span> <a name="VALunderscore_name"></a>underscore_name : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +Whether the compiler generates assembly labels by prepending "_" to the + identifier. That is, will function foo() have the label "foo", or "_foo"? + Set after you call <a href="Cil.html#VALinitCIL"><code class="code">Cil.initCIL</code></a><br> +</div> +<pre><span class="keyword">val</span> <a name="VALlocUnknown"></a>locUnknown : <code class="type"><a href="Cil.html#TYPElocation">location</a></code></pre><div class="info"> +Represents a location that cannot be determined<br> +</div> +<pre><span class="keyword">val</span> <a name="VALget_instrLoc"></a>get_instrLoc : <code class="type"><a href="Cil.html#TYPEinstr">instr</a> -> <a href="Cil.html#TYPElocation">location</a></code></pre><div class="info"> +Return the location of an instruction<br> +</div> +<pre><span class="keyword">val</span> <a name="VALget_globalLoc"></a>get_globalLoc : <code class="type"><a href="Cil.html#TYPEglobal">global</a> -> <a href="Cil.html#TYPElocation">location</a></code></pre><div class="info"> +Return the location of a global, or locUnknown<br> +</div> +<pre><span class="keyword">val</span> <a name="VALget_stmtLoc"></a>get_stmtLoc : <code class="type"><a href="Cil.html#TYPEstmtkind">stmtkind</a> -> <a href="Cil.html#TYPElocation">location</a></code></pre><div class="info"> +Return the location of a statement, or locUnknown<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdExp"></a>dExp : <code class="type"><a href="Pretty.html#TYPEdoc">Pretty.doc</a> -> <a href="Cil.html#TYPEexp">exp</a></code></pre><div class="info"> +Generate an <a href="Cil.html#TYPEexp"><code class="code">Cil.exp</code></a> to be used in case of errors.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdInstr"></a>dInstr : <code class="type"><a href="Pretty.html#TYPEdoc">Pretty.doc</a> -> <a href="Cil.html#TYPElocation">location</a> -> <a href="Cil.html#TYPEinstr">instr</a></code></pre><div class="info"> +Generate an <a href="Cil.html#TYPEinstr"><code class="code">Cil.instr</code></a> to be used in case of errors.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdGlobal"></a>dGlobal : <code class="type"><a href="Pretty.html#TYPEdoc">Pretty.doc</a> -> <a href="Cil.html#TYPElocation">location</a> -> <a href="Cil.html#TYPEglobal">global</a></code></pre><div class="info"> +Generate a <a href="Cil.html#TYPEglobal"><code class="code">Cil.global</code></a> to be used in case of errors.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmapNoCopy"></a>mapNoCopy : <code class="type">('a -> 'a) -> 'a list -> 'a list</code></pre><div class="info"> +Like map but try not to make a copy of the list<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmapNoCopyList"></a>mapNoCopyList : <code class="type">('a -> 'a list) -> 'a list -> 'a list</code></pre><div class="info"> +Like map but each call can return a list. Try not to make a copy of the + list<br> +</div> +<pre><span class="keyword">val</span> <a name="VALstartsWith"></a>startsWith : <code class="type">string -> string -> bool</code></pre><div class="info"> +sm: return true if the first is a prefix of the second string<br> +</div> +<br> +<b>An Interpreter for constructing CIL constructs</b><br> +<br><code><span class="keyword">type</span> <a name="TYPEformatArg"></a><code class="type"></code>formatArg = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Fe</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEexp">exp</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Feo</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEexp">exp</a> option</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>For array lengths</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Fu</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEunop">unop</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Fb</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEbinop">binop</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Fk</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEikind">ikind</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">FE</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEexp">exp</a> list</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>For arguments in a function call</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Ff</span> <span class="keyword">of</span> <code class="type">(string * <a href="Cil.html#TYPEtyp">typ</a> * <a href="Cil.html#TYPEattributes">attributes</a>)</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>For a formal argument</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">FF</span> <span class="keyword">of</span> <code class="type">(string * <a href="Cil.html#TYPEtyp">typ</a> * <a href="Cil.html#TYPEattributes">attributes</a>) list</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>For formal argument lists</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Fva</span> <span class="keyword">of</span> <code class="type">bool</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>For the ellipsis in a function type</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Fv</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEvarinfo">varinfo</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Fl</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPElval">lval</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Flo</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPElval">lval</a> option</code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Fo</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEoffset">offset</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Fc</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEcompinfo">compinfo</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Fi</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEinstr">instr</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">FI</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEinstr">instr</a> list</code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Ft</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEtyp">typ</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Fd</span> <span class="keyword">of</span> <code class="type">int</code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Fg</span> <span class="keyword">of</span> <code class="type">string</code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Fs</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEstmt">stmt</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">FS</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEstmt">stmt</a> list</code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">FA</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEattributes">attributes</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Fp</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEattrparam">attrparam</a></code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">FP</span> <span class="keyword">of</span> <code class="type"><a href="Cil.html#TYPEattrparam">attrparam</a> list</code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">FX</span> <span class="keyword">of</span> <code class="type">string</code></code></td> + +</tr></table> + +<div class="info"> +The type of argument for the interpreter<br> +</div> + +<pre><span class="keyword">val</span> <a name="VALd_formatarg"></a>d_formatarg : <code class="type">unit -> <a href="Cil.html#TYPEformatArg">formatArg</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-prints a format arg<br> +</div> +<pre><span class="keyword">val</span> <a name="VALlowerConstants"></a>lowerConstants : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +Do lower constant expressions into constants (default true)<br> +</div> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Cil.nopCilVisitor.html b/cil/doc/api/Cil.nopCilVisitor.html new file mode 100644 index 0000000..868e79d --- /dev/null +++ b/cil/doc/api/Cil.nopCilVisitor.html @@ -0,0 +1,35 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="next" href="Cil.defaultCilPrinterClass.html"> +<link rel="Up" href="Cil.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Cil.nopCilVisitor</title> +</head> +<body> +<div class="navbar"> <a href="Cil.html">Up</a> + <a href="Cil.defaultCilPrinterClass.html">Next</a> +</div> +<center><h1>Class <a href="type_Cil.nopCilVisitor.html">Cil.nopCilVisitor</a></h1></center> +<br> +<pre><span class="keyword">class</span> <a name="TYPEnopCilVisitor"></a>nopCilVisitor : <code class="type"></code><code class="type"><a href="Cil.cilVisitor.html">cilVisitor</a></code></pre>Default Visitor. Traverses the CIL tree without modifying anything<br> +<hr width="100%"> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Cil.plainCilPrinterClass.html b/cil/doc/api/Cil.plainCilPrinterClass.html new file mode 100644 index 0000000..0d5fca5 --- /dev/null +++ b/cil/doc/api/Cil.plainCilPrinterClass.html @@ -0,0 +1,36 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="previous" href="Cil.defaultCilPrinterClass.html"> +<link rel="Up" href="Cil.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Cil.plainCilPrinterClass</title> +</head> +<body> +<div class="navbar"><a href="Cil.defaultCilPrinterClass.html">Previous</a> + <a href="Cil.html">Up</a> + </div> +<center><h1>Class <a href="type_Cil.plainCilPrinterClass.html">Cil.plainCilPrinterClass</a></h1></center> +<br> +<pre><span class="keyword">class</span> <a name="TYPEplainCilPrinterClass"></a>plainCilPrinterClass : <code class="type"></code><code class="type"><a href="Cil.cilPrinter.html">cilPrinter</a></code></pre>These are pretty-printers that will show you more details on the internal + CIL representation, without trying hard to make it look like C<br> +<hr width="100%"> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Cillower.html b/cil/doc/api/Cillower.html new file mode 100644 index 0000000..d8fa8dd --- /dev/null +++ b/cil/doc/api/Cillower.html @@ -0,0 +1,40 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="previous" href="Alpha.html"> +<link rel="next" href="Cfg.html"> +<link rel="Up" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Cillower</title> +</head> +<body> +<div class="navbar"><a href="Alpha.html">Previous</a> + <a href="index.html">Up</a> + <a href="Cfg.html">Next</a> +</div> +<center><h1>Module <a href="type_Cillower.html">Cillower</a></h1></center> +<br> +<pre><span class="keyword">module</span> Cillower: <code class="code">sig</code> <a href="Cillower.html">..</a> <code class="code">end</code></pre>A number of lowering passes over CIL<br> +<hr width="100%"> +<pre><span class="keyword">val</span> <a name="VALlowerEnumVisitor"></a>lowerEnumVisitor : <code class="type"><a href="Cil.cilVisitor.html">Cil.cilVisitor</a></code></pre><div class="info"> +Replace enumeration constants with integer constants<br> +</div> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Clist.html b/cil/doc/api/Clist.html new file mode 100644 index 0000000..27f373e --- /dev/null +++ b/cil/doc/api/Clist.html @@ -0,0 +1,118 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="previous" href="Errormsg.html"> +<link rel="next" href="Stats.html"> +<link rel="Up" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Clist</title> +</head> +<body> +<div class="navbar"><a href="Errormsg.html">Previous</a> + <a href="index.html">Up</a> + <a href="Stats.html">Next</a> +</div> +<center><h1>Module <a href="type_Clist.html">Clist</a></h1></center> +<br> +<pre><span class="keyword">module</span> Clist: <code class="code">sig</code> <a href="Clist.html">..</a> <code class="code">end</code></pre>Utilities for managing "concatenable lists" (clists). We often need to + concatenate sequences, and using lists for this purpose is expensive. This + module provides routines to manage such lists more efficiently. In this + model, we never do cons or append explicitly. Instead we maintain + the elements of the list in a special data structure. Routines are provided + to convert to/from ordinary lists, and carry out common list operations.<br> +<hr width="100%"> +<br><code><span class="keyword">type</span> <a name="TYPEclist"></a><code class="type">'a</code> clist = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">CList</span> <span class="keyword">of</span> <code class="type">'a list</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The only representation for the empty + list. Try to use sparingly.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">CConsL</span> <span class="keyword">of</span> <code class="type">'a * 'a <a href="Clist.html#TYPEclist">clist</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Do not use this a lot because scanning + it is not tail recursive</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">CConsR</span> <span class="keyword">of</span> <code class="type">'a <a href="Clist.html#TYPEclist">clist</a> * 'a</code></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">CSeq</span> <span class="keyword">of</span> <code class="type">'a <a href="Clist.html#TYPEclist">clist</a> * 'a <a href="Clist.html#TYPEclist">clist</a></code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>We concatenate only two of them at this + time. Neither is the empty clist. To be + sure always use append to make these</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + +<div class="info"> +The clist datatype. A clist can be an ordinary list, or a clist preceded + or followed by an element, or two clists implicitly appended together<br> +</div> + +<pre><span class="keyword">val</span> <a name="VALtoList"></a>toList : <code class="type">'a <a href="Clist.html#TYPEclist">clist</a> -> 'a list</code></pre><div class="info"> +Convert a clist to an ordinary list<br> +</div> +<pre><span class="keyword">val</span> <a name="VALfromList"></a>fromList : <code class="type">'a list -> 'a <a href="Clist.html#TYPEclist">clist</a></code></pre><div class="info"> +Convert an ordinary list to a clist<br> +</div> +<pre><span class="keyword">val</span> <a name="VALsingle"></a>single : <code class="type">'a -> 'a <a href="Clist.html#TYPEclist">clist</a></code></pre><div class="info"> +Create a clist containing one element<br> +</div> +<pre><span class="keyword">val</span> <a name="VALempty"></a>empty : <code class="type">'a <a href="Clist.html#TYPEclist">clist</a></code></pre><div class="info"> +The empty clist<br> +</div> +<pre><span class="keyword">val</span> <a name="VALappend"></a>append : <code class="type">'a <a href="Clist.html#TYPEclist">clist</a> -> 'a <a href="Clist.html#TYPEclist">clist</a> -> 'a <a href="Clist.html#TYPEclist">clist</a></code></pre><div class="info"> +Append two clists<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcheckBeforeAppend"></a>checkBeforeAppend : <code class="type">'a <a href="Clist.html#TYPEclist">clist</a> -> 'a <a href="Clist.html#TYPEclist">clist</a> -> bool</code></pre><div class="info"> +A useful check to assert before an append. It checks that the two lists + are not identically the same (Except if they are both empty)<br> +</div> +<pre><span class="keyword">val</span> <a name="VALlength"></a>length : <code class="type">'a <a href="Clist.html#TYPEclist">clist</a> -> int</code></pre><div class="info"> +Find the length of a clist<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmap"></a>map : <code class="type">('a -> 'b) -> 'a <a href="Clist.html#TYPEclist">clist</a> -> 'b <a href="Clist.html#TYPEclist">clist</a></code></pre><div class="info"> +Map a function over a clist. Returns another clist<br> +</div> +<pre><span class="keyword">val</span> <a name="VALfold_left"></a>fold_left : <code class="type">('a -> 'b -> 'a) -> 'a -> 'b <a href="Clist.html#TYPEclist">clist</a> -> 'a</code></pre><div class="info"> +A version of fold_left that works on clists<br> +</div> +<pre><span class="keyword">val</span> <a name="VALiter"></a>iter : <code class="type">('a -> unit) -> 'a <a href="Clist.html#TYPEclist">clist</a> -> unit</code></pre><div class="info"> +A version of iter that works on clists<br> +</div> +<pre><span class="keyword">val</span> <a name="VALrev"></a>rev : <code class="type">('a -> 'a) -> 'a <a href="Clist.html#TYPEclist">clist</a> -> 'a <a href="Clist.html#TYPEclist">clist</a></code></pre><div class="info"> +Reverse a clist. The first function reverses an element.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdocCList"></a>docCList : <code class="type"><a href="Pretty.html#TYPEdoc">Pretty.doc</a> -> ('a -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) -> unit -> 'a <a href="Clist.html#TYPEclist">clist</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +A document for printing a clist (similar to <code class="code">docList</code>)<br> +</div> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Dataflow.BackwardsDataFlow.html b/cil/doc/api/Dataflow.BackwardsDataFlow.html new file mode 100644 index 0000000..782d318 --- /dev/null +++ b/cil/doc/api/Dataflow.BackwardsDataFlow.html @@ -0,0 +1,54 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="previous" href="Dataflow.ForwardsDataFlow.html"> +<link rel="Up" href="Dataflow.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Dataflow.BackwardsDataFlow</title> +</head> +<body> +<div class="navbar"><a href="Dataflow.ForwardsDataFlow.html">Previous</a> + <a href="Dataflow.html">Up</a> + </div> +<center><h1>Functor <a href="type_Dataflow.BackwardsDataFlow.html">Dataflow.BackwardsDataFlow</a></h1></center> +<br> +<pre><span class="keyword">module</span> BackwardsDataFlow: <div class="sig_block"><code class="code">functor (</code><code class="code">T</code><code class="code"> : </code><code class="type"><a href="Dataflow.BackwardsTransfer.html">BackwardsTransfer</a></code><code class="code">) -> </code><code class="code">sig</code> <a href="Dataflow.BackwardsDataFlow.html">..</a> <code class="code">end</code></div></pre><table border="0" cellpadding="3" width="100%"> +<tr> +<td align="left" valign="top" width="1%%"><b>Parameters: </b></td> +<td> +<table class="paramstable"> +<tr> +<td align="center" valign="top" width="15%"> +<code>T</code></td> +<td align="center" valign="top">:</td> +<td><code class="type"><a href="Dataflow.BackwardsTransfer.html">BackwardsTransfer</a></code> +</table> +</td> +</tr> +</table> +<hr width="100%"> +<pre><span class="keyword">val</span> <a name="VALcompute"></a>compute : <code class="type"><a href="Cil.html#TYPEstmt">Cil.stmt</a> list -> unit</code></pre><div class="info"> +Fill in the T.stmtStartData, given a number of initial statements to + start from (the sinks for the backwards data flow). All of the statements + (not just the initial ones!) must have some entry in T.stmtStartData + (i.e., the initial data should not be bottom)<br> +</div> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Dataflow.BackwardsTransfer.html b/cil/doc/api/Dataflow.BackwardsTransfer.html new file mode 100644 index 0000000..0ff812d --- /dev/null +++ b/cil/doc/api/Dataflow.BackwardsTransfer.html @@ -0,0 +1,83 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="previous" href="Dataflow.ForwardsTransfer.html"> +<link rel="Up" href="Dataflow.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Dataflow.BackwardsTransfer</title> +</head> +<body> +<div class="navbar"><a href="Dataflow.ForwardsTransfer.html">Previous</a> + <a href="Dataflow.html">Up</a> + </div> +<center><h1>Module type <a href="type_Dataflow.BackwardsTransfer.html">Dataflow.BackwardsTransfer</a></h1></center> +<br> +<pre><span class="keyword">module type</span> BackwardsTransfer = <code class="code">sig</code> <a href="Dataflow.BackwardsTransfer.html">..</a> <code class="code">end</code></pre><hr width="100%"> +<pre><span class="keyword">val</span> <a name="VALname"></a>name : <code class="type">string</code></pre><div class="info"> +For debugging purposes, the name of the analysis<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdebug"></a>debug : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +Whether to turn on debugging<br> +</div> +<pre><span class="keyword">type</span> <a name="TYPEt"></a><code class="type"></code>t </pre> +<div class="info"> +The type of the data we compute for each block start. In many + presentations of backwards data flow analysis we maintain the + data at the block end. This is not easy to do with JVML because + a block has many exceptional ends. So we maintain the data for + the statement start.<br> +</div> + +<pre><span class="keyword">val</span> <a name="VALpretty"></a>pretty : <code class="type">unit -> <a href="Dataflow.BackwardsTransfer.html#TYPEt">t</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print the state<br> +</div> +<pre><span class="keyword">val</span> <a name="VALstmtStartData"></a>stmtStartData : <code class="type"><a href="Dataflow.BackwardsTransfer.html#TYPEt">t</a> Inthash.t</code></pre><div class="info"> +For each block id, the data at the start. This data structure must be + initialized with the initial data for each block<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcombineStmtStartData"></a>combineStmtStartData : <code class="type"><a href="Cil.html#TYPEstmt">Cil.stmt</a> -><br> old:<a href="Dataflow.BackwardsTransfer.html#TYPEt">t</a> -><br> <a href="Dataflow.BackwardsTransfer.html#TYPEt">t</a> -> <a href="Dataflow.BackwardsTransfer.html#TYPEt">t</a> option</code></pre><div class="info"> +When the analysis reaches the start of a block, combine the old data + with the one we have just computed. Return None if the combination is + the same as the old data, otherwise return the combination. In the + latter case, the predecessors of the statement are put on the working + list.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcombineSuccessors"></a>combineSuccessors : <code class="type"><a href="Dataflow.BackwardsTransfer.html#TYPEt">t</a> -><br> <a href="Dataflow.BackwardsTransfer.html#TYPEt">t</a> -> <a href="Dataflow.BackwardsTransfer.html#TYPEt">t</a></code></pre><div class="info"> +Take the data from two successors and combine it<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdoStmt"></a>doStmt : <code class="type"><a href="Cil.html#TYPEstmt">Cil.stmt</a> -> <a href="Dataflow.BackwardsTransfer.html#TYPEt">t</a> <a href="Dataflow.html#TYPEaction">Dataflow.action</a></code></pre><div class="info"> +The (backwards) transfer function for a branch. The <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> is + set before calling this. If it returns None, then we have some default + handling. Otherwise, the returned data is the data before the branch + (not considering the exception handlers)<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdoInstr"></a>doInstr : <code class="type"><a href="Cil.html#TYPEinstr">Cil.instr</a> -><br> <a href="Dataflow.BackwardsTransfer.html#TYPEt">t</a> -> <a href="Dataflow.BackwardsTransfer.html#TYPEt">t</a> <a href="Dataflow.html#TYPEaction">Dataflow.action</a></code></pre><div class="info"> +The (backwards) transfer function for an instruction. The + <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> is set before calling this. If it returns None, then we + have some default handling. Otherwise, the returned data is the data + before the branch (not considering the exception handlers)<br> +</div> +<pre><span class="keyword">val</span> <a name="VALfilterStmt"></a>filterStmt : <code class="type"><a href="Cil.html#TYPEstmt">Cil.stmt</a> -> <a href="Cil.html#TYPEstmt">Cil.stmt</a> -> bool</code></pre><div class="info"> +Whether to put this predecessor block in the worklist. We give the + predecessor and the block whose predecessor we are (and whose data has + changed)<br> +</div> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Dataflow.ForwardsDataFlow.html b/cil/doc/api/Dataflow.ForwardsDataFlow.html new file mode 100644 index 0000000..760dc2b --- /dev/null +++ b/cil/doc/api/Dataflow.ForwardsDataFlow.html @@ -0,0 +1,53 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="next" href="Dataflow.BackwardsDataFlow.html"> +<link rel="Up" href="Dataflow.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Dataflow.ForwardsDataFlow</title> +</head> +<body> +<div class="navbar"> <a href="Dataflow.html">Up</a> + <a href="Dataflow.BackwardsDataFlow.html">Next</a> +</div> +<center><h1>Functor <a href="type_Dataflow.ForwardsDataFlow.html">Dataflow.ForwardsDataFlow</a></h1></center> +<br> +<pre><span class="keyword">module</span> ForwardsDataFlow: <div class="sig_block"><code class="code">functor (</code><code class="code">T</code><code class="code"> : </code><code class="type"><a href="Dataflow.ForwardsTransfer.html">ForwardsTransfer</a></code><code class="code">) -> </code><code class="code">sig</code> <a href="Dataflow.ForwardsDataFlow.html">..</a> <code class="code">end</code></div></pre><table border="0" cellpadding="3" width="100%"> +<tr> +<td align="left" valign="top" width="1%%"><b>Parameters: </b></td> +<td> +<table class="paramstable"> +<tr> +<td align="center" valign="top" width="15%"> +<code>T</code></td> +<td align="center" valign="top">:</td> +<td><code class="type"><a href="Dataflow.ForwardsTransfer.html">ForwardsTransfer</a></code> +</table> +</td> +</tr> +</table> +<hr width="100%"> +<pre><span class="keyword">val</span> <a name="VALcompute"></a>compute : <code class="type"><a href="Cil.html#TYPEstmt">Cil.stmt</a> list -> unit</code></pre><div class="info"> +Fill in the T.stmtStartData, given a number of initial statements to + start from. All of the initial statements must have some entry in + T.stmtStartData (i.e., the initial data should not be bottom)<br> +</div> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Dataflow.ForwardsTransfer.html b/cil/doc/api/Dataflow.ForwardsTransfer.html new file mode 100644 index 0000000..dbefaa0 --- /dev/null +++ b/cil/doc/api/Dataflow.ForwardsTransfer.html @@ -0,0 +1,88 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="next" href="Dataflow.BackwardsTransfer.html"> +<link rel="Up" href="Dataflow.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Dataflow.ForwardsTransfer</title> +</head> +<body> +<div class="navbar"> <a href="Dataflow.html">Up</a> + <a href="Dataflow.BackwardsTransfer.html">Next</a> +</div> +<center><h1>Module type <a href="type_Dataflow.ForwardsTransfer.html">Dataflow.ForwardsTransfer</a></h1></center> +<br> +<pre><span class="keyword">module type</span> ForwardsTransfer = <code class="code">sig</code> <a href="Dataflow.ForwardsTransfer.html">..</a> <code class="code">end</code></pre><hr width="100%"> +<pre><span class="keyword">val</span> <a name="VALname"></a>name : <code class="type">string</code></pre><div class="info"> +For debugging purposes, the name of the analysis<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdebug"></a>debug : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +Whether to turn on debugging<br> +</div> +<pre><span class="keyword">type</span> <a name="TYPEt"></a><code class="type"></code>t </pre> +<div class="info"> +The type of the data we compute for each block start. May be + imperative.<br> +</div> + +<pre><span class="keyword">val</span> <a name="VALcopy"></a>copy : <code class="type"><a href="Dataflow.ForwardsTransfer.html#TYPEt">t</a> -> <a href="Dataflow.ForwardsTransfer.html#TYPEt">t</a></code></pre><div class="info"> +Make a deep copy of the data<br> +</div> +<pre><span class="keyword">val</span> <a name="VALstmtStartData"></a>stmtStartData : <code class="type"><a href="Dataflow.ForwardsTransfer.html#TYPEt">t</a> Inthash.t</code></pre><div class="info"> +For each statement id, the data at the start. Not found in the hash + table means nothing is known about the state at this point. At the end + of the analysis this means that the block is not reachable.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALpretty"></a>pretty : <code class="type">unit -> <a href="Dataflow.ForwardsTransfer.html#TYPEt">t</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Pretty-print the state<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcomputeFirstPredecessor"></a>computeFirstPredecessor : <code class="type"><a href="Cil.html#TYPEstmt">Cil.stmt</a> -> <a href="Dataflow.ForwardsTransfer.html#TYPEt">t</a> -> <a href="Dataflow.ForwardsTransfer.html#TYPEt">t</a></code></pre><div class="info"> +Give the first value for a predecessors, compute the value to be set + for the block<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcombinePredecessors"></a>combinePredecessors : <code class="type"><a href="Cil.html#TYPEstmt">Cil.stmt</a> -><br> old:<a href="Dataflow.ForwardsTransfer.html#TYPEt">t</a> -><br> <a href="Dataflow.ForwardsTransfer.html#TYPEt">t</a> -> <a href="Dataflow.ForwardsTransfer.html#TYPEt">t</a> option</code></pre><div class="info"> +Take some old data for the start of a statement, and some new data for + the same point. Return None if the combination is identical to the old + data. Otherwise, compute the combination, and return it.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdoInstr"></a>doInstr : <code class="type"><a href="Cil.html#TYPEinstr">Cil.instr</a> -><br> <a href="Dataflow.ForwardsTransfer.html#TYPEt">t</a> -> <a href="Dataflow.ForwardsTransfer.html#TYPEt">t</a> <a href="Dataflow.html#TYPEaction">Dataflow.action</a></code></pre><div class="info"> +The (forwards) transfer function for an instruction. The + <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> is set before calling this. The default action is to + continue with the state unchanged.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdoStmt"></a>doStmt : <code class="type"><a href="Cil.html#TYPEstmt">Cil.stmt</a> -><br> <a href="Dataflow.ForwardsTransfer.html#TYPEt">t</a> -><br> <a href="Dataflow.ForwardsTransfer.html#TYPEt">t</a> <a href="Dataflow.html#TYPEstmtaction">Dataflow.stmtaction</a></code></pre><div class="info"> +The (forwards) transfer function for a statement. The <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> + is set before calling this. The default action is to do the instructions + in this statement, if applicable, and continue with the successors.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdoGuard"></a>doGuard : <code class="type"><a href="Cil.html#TYPEexp">Cil.exp</a> -><br> <a href="Dataflow.ForwardsTransfer.html#TYPEt">t</a> -><br> <a href="Dataflow.ForwardsTransfer.html#TYPEt">t</a> <a href="Dataflow.html#TYPEguardaction">Dataflow.guardaction</a></code></pre><div class="info"> +Generate the successor to an If statement assuming the given expression + is nonzero. Analyses that don't need guard information can return + GDefault; this is equivalent to returning GUse of the input. + A return value of GUnreachable indicates that this half of the branch + will not be taken and should not be explored. This will be called + twice per If, once for "then" and once for "else".<br> +</div> +<pre><span class="keyword">val</span> <a name="VALfilterStmt"></a>filterStmt : <code class="type"><a href="Cil.html#TYPEstmt">Cil.stmt</a> -> bool</code></pre><div class="info"> +Whether to put this statement in the worklist. This is called when a + block would normally be put in the worklist.<br> +</div> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Dataflow.html b/cil/doc/api/Dataflow.html new file mode 100644 index 0000000..9f744ea --- /dev/null +++ b/cil/doc/api/Dataflow.html @@ -0,0 +1,114 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="previous" href="Cfg.html"> +<link rel="next" href="Dominators.html"> +<link rel="Up" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Dataflow</title> +</head> +<body> +<div class="navbar"><a href="Cfg.html">Previous</a> + <a href="index.html">Up</a> + <a href="Dominators.html">Next</a> +</div> +<center><h1>Module <a href="type_Dataflow.html">Dataflow</a></h1></center> +<br> +<pre><span class="keyword">module</span> Dataflow: <code class="code">sig</code> <a href="Dataflow.html">..</a> <code class="code">end</code></pre>A framework for data flow analysis for CIL code. Before using + this framework, you must initialize the Control-flow Graph for your + program, e.g using <a href="Cfg.html#VALcomputeFileCFG"><code class="code">Cfg.computeFileCFG</code></a><br> +<hr width="100%"> +<br><code><span class="keyword">type</span> <a name="TYPEaction"></a><code class="type">'a</code> action = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Default</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The default action</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Done</span> <span class="keyword">of</span> <code class="type">'a</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Do not do the default action. Use this result</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">Post</span> <span class="keyword">of</span> <code class="type">('a -> 'a)</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The default action, followed by the given + transformer</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + + +<br><code><span class="keyword">type</span> <a name="TYPEstmtaction"></a><code class="type">'a</code> stmtaction = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">SDefault</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The default action</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">SDone</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Do not visit this statement or its successors</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">SUse</span> <span class="keyword">of</span> <code class="type">'a</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Visit the instructions and successors of this statement + as usual, but use the specified state instead of the + one that was passed to doStmt</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + + +<br><code><span class="keyword">type</span> <a name="TYPEguardaction"></a><code class="type">'a</code> guardaction = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">GDefault</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The default state</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">GUse</span> <span class="keyword">of</span> <code class="type">'a</code></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Use this data for the branch</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">GUnreachable</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The branch will never be taken.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + + +<pre><span class="keyword">module type</span> <a href="Dataflow.ForwardsTransfer.html">ForwardsTransfer</a> = <code class="code">sig</code> <a href="Dataflow.ForwardsTransfer.html">..</a> <code class="code">end</code></pre><pre><span class="keyword">module</span> <a href="Dataflow.ForwardsDataFlow.html">ForwardsDataFlow</a>: <div class="sig_block"><code class="code">functor (</code><code class="code">T</code><code class="code"> : </code><code class="type"><a href="Dataflow.ForwardsTransfer.html">ForwardsTransfer</a></code><code class="code">) -> </code><code class="code">sig</code> <a href="Dataflow.ForwardsDataFlow.html">..</a> <code class="code">end</code></div></pre><pre><span class="keyword">module type</span> <a href="Dataflow.BackwardsTransfer.html">BackwardsTransfer</a> = <code class="code">sig</code> <a href="Dataflow.BackwardsTransfer.html">..</a> <code class="code">end</code></pre><pre><span class="keyword">module</span> <a href="Dataflow.BackwardsDataFlow.html">BackwardsDataFlow</a>: <div class="sig_block"><code class="code">functor (</code><code class="code">T</code><code class="code"> : </code><code class="type"><a href="Dataflow.BackwardsTransfer.html">BackwardsTransfer</a></code><code class="code">) -> </code><code class="code">sig</code> <a href="Dataflow.BackwardsDataFlow.html">..</a> <code class="code">end</code></div></pre></body></html>
\ No newline at end of file diff --git a/cil/doc/api/Dominators.html b/cil/doc/api/Dominators.html new file mode 100644 index 0000000..4d8eaf9 --- /dev/null +++ b/cil/doc/api/Dominators.html @@ -0,0 +1,58 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="previous" href="Dataflow.html"> +<link rel="Up" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Dominators</title> +</head> +<body> +<div class="navbar"><a href="Dataflow.html">Previous</a> + <a href="index.html">Up</a> + </div> +<center><h1>Module <a href="type_Dominators.html">Dominators</a></h1></center> +<br> +<pre><span class="keyword">module</span> Dominators: <code class="code">sig</code> <a href="Dominators.html">..</a> <code class="code">end</code></pre>Compute dominators using data flow analysis<br> +<hr width="100%"> +<br> +Author: George Necula + 5/28/2004 +<br> +<pre><span class="keyword">val</span> <a name="VALcomputeIDom"></a>computeIDom : <code class="type"><a href="Cil.html#TYPEfundec">Cil.fundec</a> -> <a href="Cil.html#TYPEstmt">Cil.stmt</a> option Inthash.t</code></pre><div class="info"> +Invoke on a code after filling in the CFG info and it computes the + immediate dominator information. We map each statement to its immediate + dominator (None for the start statement, and for the unreachable + statements).<br> +</div> +<pre><span class="keyword">val</span> <a name="VALgetIdom"></a>getIdom : <code class="type"><a href="Cil.html#TYPEstmt">Cil.stmt</a> option Inthash.t -> <a href="Cil.html#TYPEstmt">Cil.stmt</a> -> <a href="Cil.html#TYPEstmt">Cil.stmt</a> option</code></pre><div class="info"> +This is like Inthash.find but gives an error if the information is + Not_found<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdominates"></a>dominates : <code class="type"><a href="Cil.html#TYPEstmt">Cil.stmt</a> option Inthash.t -> <a href="Cil.html#TYPEstmt">Cil.stmt</a> -> <a href="Cil.html#TYPEstmt">Cil.stmt</a> -> bool</code></pre><div class="info"> +Check whether one statement dominates another.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALfindNaturalLoops"></a>findNaturalLoops : <code class="type"><a href="Cil.html#TYPEfundec">Cil.fundec</a> -> <a href="Cil.html#TYPEstmt">Cil.stmt</a> option Inthash.t -> (<a href="Cil.html#TYPEstmt">Cil.stmt</a> * <a href="Cil.html#TYPEstmt">Cil.stmt</a> list) list</code></pre><div class="info"> +Compute the start of the natural loops. This assumes that the "idom" + field has been computed. For each start, keep a list of origin of a back + edge. The loop consists of the loop start and all predecessors of the + origins of back edges, up to and including the loop start<br> +</div> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Errormsg.html b/cil/doc/api/Errormsg.html new file mode 100644 index 0000000..bc19472 --- /dev/null +++ b/cil/doc/api/Errormsg.html @@ -0,0 +1,141 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="previous" href="Pretty.html"> +<link rel="next" href="Clist.html"> +<link rel="Up" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Errormsg</title> +</head> +<body> +<div class="navbar"><a href="Pretty.html">Previous</a> + <a href="index.html">Up</a> + <a href="Clist.html">Next</a> +</div> +<center><h1>Module <a href="type_Errormsg.html">Errormsg</a></h1></center> +<br> +<pre><span class="keyword">module</span> Errormsg: <code class="code">sig</code> <a href="Errormsg.html">..</a> <code class="code">end</code></pre>Utility functions for error-reporting<br> +<hr width="100%"> +<pre><span class="keyword">val</span> <a name="VALlogChannel"></a>logChannel : <code class="type">Pervasives.out_channel Pervasives.ref</code></pre><div class="info"> +A channel for printing log messages<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdebugFlag"></a>debugFlag : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +If set then print debugging info<br> +</div> +<pre><span class="keyword">val</span> <a name="VALverboseFlag"></a>verboseFlag : <code class="type">bool Pervasives.ref</code></pre><pre><span class="keyword">val</span> <a name="VALwarnFlag"></a>warnFlag : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +Set to true if you want to see all warnings.<br> +</div> +<pre><span class="keyword">exception</span> <a name="EXCEPTIONError"></a>Error</pre> +<div class="info"> +Error reporting functions raise this exception<br> +</div> +<pre><span class="keyword">val</span> <a name="VALerror"></a>error : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">Pretty.doc</a>, unit) format4 -> 'a</code></pre><div class="info"> +Prints an error message of the form <code class="code">Error: ...</code>. + Use in conjunction with s, for example: <code class="code">E.s (E.error ... )</code>.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALbug"></a>bug : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">Pretty.doc</a>, unit) format4 -> 'a</code></pre><div class="info"> +Similar to <code class="code">error</code> except that its output has the form <code class="code">Bug: ...</code><br> +</div> +<pre><span class="keyword">val</span> <a name="VALunimp"></a>unimp : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">Pretty.doc</a>, unit) format4 -> 'a</code></pre><div class="info"> +Similar to <code class="code">error</code> except that its output has the form <code class="code">Unimplemented: ...</code><br> +</div> +<pre><span class="keyword">val</span> <a name="VALs"></a>s : <code class="type">'a -> 'b</code></pre><div class="info"> +Stop the execution by raising an Error.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALhadErrors"></a>hadErrors : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +This is set whenever one of the above error functions are called. It must + be cleared manually<br> +</div> +<pre><span class="keyword">val</span> <a name="VALwarn"></a>warn : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">Pretty.doc</a>, unit) format4 -> 'a</code></pre><div class="info"> +Like <a href="Errormsg.html#VALerror"><code class="code">Errormsg.error</code></a> but does not raise the <a href="Errormsg.html#EXCEPTIONError"><code class="code">Errormsg.Error</code></a> + exception. Return type is unit.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALwarnOpt"></a>warnOpt : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">Pretty.doc</a>, unit) format4 -> 'a</code></pre><div class="info"> +Like <a href="Errormsg.html#VALwarn"><code class="code">Errormsg.warn</code></a> but optional. Printed only if the + <a href="Errormsg.html#VALwarnFlag"><code class="code">Errormsg.warnFlag</code></a> is set<br> +</div> +<pre><span class="keyword">val</span> <a name="VALlog"></a>log : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">Pretty.doc</a>, unit) format4 -> 'a</code></pre><div class="info"> +Print something to <code class="code">logChannel</code><br> +</div> +<pre><span class="keyword">val</span> <a name="VALlogg"></a>logg : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">Pretty.doc</a>, unit) format4 -> 'a</code></pre><div class="info"> +same as <a href="Errormsg.html#VALlog"><code class="code">Errormsg.log</code></a> but do not wrap lines<br> +</div> +<pre><span class="keyword">val</span> <a name="VALnull"></a>null : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">Pretty.doc</a>, unit) format4 -> 'a</code></pre><div class="info"> +Do not actually print (i.e. print to /dev/null)<br> +</div> +<pre><span class="keyword">val</span> <a name="VALpushContext"></a>pushContext : <code class="type">(unit -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) -> unit</code></pre><div class="info"> +Registers a context printing function<br> +</div> +<pre><span class="keyword">val</span> <a name="VALpopContext"></a>popContext : <code class="type">unit -> unit</code></pre><div class="info"> +Removes the last registered context printing function<br> +</div> +<pre><span class="keyword">val</span> <a name="VALshowContext"></a>showContext : <code class="type">unit -> unit</code></pre><div class="info"> +Show the context stack to stderr<br> +</div> +<pre><span class="keyword">val</span> <a name="VALwithContext"></a>withContext : <code class="type">(unit -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) -> ('a -> 'b) -> 'a -> 'b</code></pre><div class="info"> +To ensure that the context is registered and removed properly, use the + function below<br> +</div> +<pre><span class="keyword">val</span> <a name="VALnewline"></a>newline : <code class="type">unit -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALnewHline"></a>newHline : <code class="type">unit -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALgetPosition"></a>getPosition : <code class="type">unit -> int * string * int</code></pre><pre><span class="keyword">val</span> <a name="VALgetHPosition"></a>getHPosition : <code class="type">unit -> int * string</code></pre><div class="info"> +high-level position<br> +</div> +<pre><span class="keyword">val</span> <a name="VALsetHLine"></a>setHLine : <code class="type">int -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALsetHFile"></a>setHFile : <code class="type">string -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALsetCurrentLine"></a>setCurrentLine : <code class="type">int -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALsetCurrentFile"></a>setCurrentFile : <code class="type">string -> unit</code></pre><br><code><span class="keyword">type</span> <a name="TYPElocation"></a><code class="type"></code>location = {</code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code>file : <code class="type">string</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The file name</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code>line : <code class="type">int</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The line number</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code>hfile : <code class="type">string</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The high-level file name, or "" if not present</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code> </code></td> +<td align="left" valign="top" > +<code>hline : <code class="type">int</code>;</code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The high-level line number, or 0 if not present</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> +} + +<div class="info"> +Type for source-file locations<br> +</div> + +<pre><span class="keyword">val</span> <a name="VALd_loc"></a>d_loc : <code class="type">unit -> <a href="Errormsg.html#TYPElocation">location</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><pre><span class="keyword">val</span> <a name="VALd_hloc"></a>d_hloc : <code class="type">unit -> <a href="Errormsg.html#TYPElocation">location</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><pre><span class="keyword">val</span> <a name="VALgetLocation"></a>getLocation : <code class="type">unit -> <a href="Errormsg.html#TYPElocation">location</a></code></pre><pre><span class="keyword">val</span> <a name="VALparse_error"></a>parse_error : <code class="type">string -> 'a</code></pre><pre><span class="keyword">val</span> <a name="VALlocUnknown"></a>locUnknown : <code class="type"><a href="Errormsg.html#TYPElocation">location</a></code></pre><div class="info"> +An unknown location for use when you need one but you don't have one<br> +</div> +<pre><span class="keyword">val</span> <a name="VALreadingFromStdin"></a>readingFromStdin : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +Records whether the stdin is open for reading the goal *<br> +</div> +<pre><span class="keyword">val</span> <a name="VALstartParsing"></a>startParsing : <code class="type">?useBasename:bool -> string -> Lexing.lexbuf</code></pre><pre><span class="keyword">val</span> <a name="VALstartParsingFromString"></a>startParsingFromString : <code class="type">?file:string -> ?line:int -> string -> Lexing.lexbuf</code></pre><pre><span class="keyword">val</span> <a name="VALfinishParsing"></a>finishParsing : <code class="type">unit -> unit</code></pre></body></html>
\ No newline at end of file diff --git a/cil/doc/api/Formatcil.html b/cil/doc/api/Formatcil.html new file mode 100644 index 0000000..8dee76d --- /dev/null +++ b/cil/doc/api/Formatcil.html @@ -0,0 +1,84 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="previous" href="Cil.html"> +<link rel="next" href="Alpha.html"> +<link rel="Up" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Formatcil</title> +</head> +<body> +<div class="navbar"><a href="Cil.html">Previous</a> + <a href="index.html">Up</a> + <a href="Alpha.html">Next</a> +</div> +<center><h1>Module <a href="type_Formatcil.html">Formatcil</a></h1></center> +<br> +<pre><span class="keyword">module</span> Formatcil: <code class="code">sig</code> <a href="Formatcil.html">..</a> <code class="code">end</code></pre><b>An Interpreter for constructing CIL constructs</b><br> +<hr width="100%"> +<pre><span class="keyword">val</span> <a name="VALcExp"></a>cExp : <code class="type">string -> (string * <a href="Cil.html#TYPEformatArg">Cil.formatArg</a>) list -> <a href="Cil.html#TYPEexp">Cil.exp</a></code></pre><div class="info"> +Constructs an expression based on the program and the list of arguments. + Each argument consists of a name followed by the actual data. This + argument will be placed instead of occurrences of "%v:name" in the pattern + (where the "v" is dependent on the type of the data). The parsing of the + string is memoized. * Only the first expression is parsed.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcLval"></a>cLval : <code class="type">string -> (string * <a href="Cil.html#TYPEformatArg">Cil.formatArg</a>) list -> <a href="Cil.html#TYPElval">Cil.lval</a></code></pre><div class="info"> +Constructs an lval based on the program and the list of arguments. + Only the first lvalue is parsed. + The parsing of the string is memoized.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcType"></a>cType : <code class="type">string -> (string * <a href="Cil.html#TYPEformatArg">Cil.formatArg</a>) list -> <a href="Cil.html#TYPEtyp">Cil.typ</a></code></pre><div class="info"> +Constructs a type based on the program and the list of arguments. + Only the first type is parsed. + The parsing of the string is memoized.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcInstr"></a>cInstr : <code class="type">string -> <a href="Cil.html#TYPElocation">Cil.location</a> -> (string * <a href="Cil.html#TYPEformatArg">Cil.formatArg</a>) list -> <a href="Cil.html#TYPEinstr">Cil.instr</a></code></pre><div class="info"> +Constructs an instruction based on the program and the list of arguments. + Only the first instruction is parsed. + The parsing of the string is memoized.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcStmt"></a>cStmt : <code class="type">string -><br> (string -> <a href="Cil.html#TYPEtyp">Cil.typ</a> -> <a href="Cil.html#TYPEvarinfo">Cil.varinfo</a>) -><br> <a href="Cil.html#TYPElocation">Cil.location</a> -> (string * <a href="Cil.html#TYPEformatArg">Cil.formatArg</a>) list -> <a href="Cil.html#TYPEstmt">Cil.stmt</a></code></pre><pre><span class="keyword">val</span> <a name="VALcStmts"></a>cStmts : <code class="type">string -><br> (string -> <a href="Cil.html#TYPEtyp">Cil.typ</a> -> <a href="Cil.html#TYPEvarinfo">Cil.varinfo</a>) -><br> <a href="Cil.html#TYPElocation">Cil.location</a> -> (string * <a href="Cil.html#TYPEformatArg">Cil.formatArg</a>) list -> <a href="Cil.html#TYPEstmt">Cil.stmt</a> list</code></pre><div class="info"> +Constructs a list of statements<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdExp"></a>dExp : <code class="type">string -> <a href="Cil.html#TYPEexp">Cil.exp</a> -> <a href="Cil.html#TYPEformatArg">Cil.formatArg</a> list option</code></pre><div class="info"> +Deconstructs an expression based on the program. Produces an optional + list of format arguments. The parsing of the string is memoized.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdLval"></a>dLval : <code class="type">string -> <a href="Cil.html#TYPElval">Cil.lval</a> -> <a href="Cil.html#TYPEformatArg">Cil.formatArg</a> list option</code></pre><div class="info"> +Deconstructs an lval based on the program. Produces an optional + list of format arguments. The parsing of the string is memoized.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdType"></a>dType : <code class="type">string -> <a href="Cil.html#TYPEtyp">Cil.typ</a> -> <a href="Cil.html#TYPEformatArg">Cil.formatArg</a> list option</code></pre><div class="info"> +Deconstructs a type based on the program. Produces an optional list of + format arguments. The parsing of the string is memoized.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdInstr"></a>dInstr : <code class="type">string -> <a href="Cil.html#TYPEinstr">Cil.instr</a> -> <a href="Cil.html#TYPEformatArg">Cil.formatArg</a> list option</code></pre><div class="info"> +Deconstructs an instruction based on the program. Produces an optional + list of format arguments. The parsing of the string is memoized.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALnoMemoize"></a>noMemoize : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +If set then will not memoize the parsed patterns<br> +</div> +<pre><span class="keyword">val</span> <a name="VALtest"></a>test : <code class="type">unit -> unit</code></pre><div class="info"> +Just a testing function<br> +</div> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Pretty.MakeMapPrinter.html b/cil/doc/api/Pretty.MakeMapPrinter.html new file mode 100644 index 0000000..9693a68 --- /dev/null +++ b/cil/doc/api/Pretty.MakeMapPrinter.html @@ -0,0 +1,63 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="next" href="Pretty.MakeSetPrinter.html"> +<link rel="Up" href="Pretty.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Pretty.MakeMapPrinter</title> +</head> +<body> +<div class="navbar"> <a href="Pretty.html">Up</a> + <a href="Pretty.MakeSetPrinter.html">Next</a> +</div> +<center><h1>Functor <a href="type_Pretty.MakeMapPrinter.html">Pretty.MakeMapPrinter</a></h1></center> +<br> +<pre><span class="keyword">module</span> MakeMapPrinter: <div class="sig_block"><code class="code">functor (</code><code class="code">Map</code><code class="code"> : </code><code class="code">sig</code><div class="sig_block"><pre><span class="keyword">type</span> <a name="TYPEkey"></a><code class="type"></code>key </pre> + +<pre><span class="keyword">type</span> <a name="TYPEt"></a><code class="type">'a</code> t </pre> + +<pre><span class="keyword">val</span> <a name="VALfold"></a>fold : <code class="type">(key -> 'a -> 'b -> 'b) -><br> 'a t -> 'b -> 'b</code></pre></div><code class="code">end</code><code class="code">) -> </code><code class="code">sig</code> <a href="Pretty.MakeMapPrinter.html">..</a> <code class="code">end</code></div></pre>Format maps.<br> +<table border="0" cellpadding="3" width="100%"> +<tr> +<td align="left" valign="top" width="1%%"><b>Parameters: </b></td> +<td> +<table class="paramstable"> +<tr> +<td align="center" valign="top" width="15%"> +<code>Map</code></td> +<td align="center" valign="top">:</td> +<td><code class="type">sig + type key + type 'a t + val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b + end</code> +</table> +</td> +</tr> +</table> +<hr width="100%"> +<pre><span class="keyword">val</span> <a name="VALdocMap"></a>docMap : <code class="type">?sep:<a href="Pretty.html#TYPEdoc">Pretty.doc</a> -><br> (Map.key -> 'a -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) -> unit -> 'a Map.t -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Format a map, analogous to docList.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_map"></a>d_map : <code class="type">?dmaplet:(<a href="Pretty.html#TYPEdoc">Pretty.doc</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) -><br> string -><br> (unit -> Map.key -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) -><br> (unit -> 'a -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) -> unit -> 'a Map.t -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Format a map, analogous to d_list.<br> +</div> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Pretty.MakeSetPrinter.html b/cil/doc/api/Pretty.MakeSetPrinter.html new file mode 100644 index 0000000..e9343b2 --- /dev/null +++ b/cil/doc/api/Pretty.MakeSetPrinter.html @@ -0,0 +1,63 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="previous" href="Pretty.MakeMapPrinter.html"> +<link rel="Up" href="Pretty.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Pretty.MakeSetPrinter</title> +</head> +<body> +<div class="navbar"><a href="Pretty.MakeMapPrinter.html">Previous</a> + <a href="Pretty.html">Up</a> + </div> +<center><h1>Functor <a href="type_Pretty.MakeSetPrinter.html">Pretty.MakeSetPrinter</a></h1></center> +<br> +<pre><span class="keyword">module</span> MakeSetPrinter: <div class="sig_block"><code class="code">functor (</code><code class="code">Set</code><code class="code"> : </code><code class="code">sig</code><div class="sig_block"><pre><span class="keyword">type</span> <a name="TYPEelt"></a><code class="type"></code>elt </pre> + +<pre><span class="keyword">type</span> <a name="TYPEt"></a><code class="type"></code>t </pre> + +<pre><span class="keyword">val</span> <a name="VALfold"></a>fold : <code class="type">(elt -> 'a -> 'a) -><br> t -> 'a -> 'a</code></pre></div><code class="code">end</code><code class="code">) -> </code><code class="code">sig</code> <a href="Pretty.MakeSetPrinter.html">..</a> <code class="code">end</code></div></pre>Format sets.<br> +<table border="0" cellpadding="3" width="100%"> +<tr> +<td align="left" valign="top" width="1%%"><b>Parameters: </b></td> +<td> +<table class="paramstable"> +<tr> +<td align="center" valign="top" width="15%"> +<code>Set</code></td> +<td align="center" valign="top">:</td> +<td><code class="type">sig + type elt + type t + val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a + end</code> +</table> +</td> +</tr> +</table> +<hr width="100%"> +<pre><span class="keyword">val</span> <a name="VALdocSet"></a>docSet : <code class="type">?sep:<a href="Pretty.html#TYPEdoc">Pretty.doc</a> -> (Set.elt -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) -> unit -> Set.t -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Format a set, analogous to docList.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_set"></a>d_set : <code class="type">string -> (unit -> Set.elt -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) -> unit -> Set.t -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info"> +Format a set, analogous to d_list.<br> +</div> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Pretty.html b/cil/doc/api/Pretty.html new file mode 100644 index 0000000..c9c48c8 --- /dev/null +++ b/cil/doc/api/Pretty.html @@ -0,0 +1,268 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="next" href="Errormsg.html"> +<link rel="Up" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Pretty</title> +</head> +<body> +<div class="navbar"> <a href="index.html">Up</a> + <a href="Errormsg.html">Next</a> +</div> +<center><h1>Module <a href="type_Pretty.html">Pretty</a></h1></center> +<br> +<pre><span class="keyword">module</span> Pretty: <code class="code">sig</code> <a href="Pretty.html">..</a> <code class="code">end</code></pre>Utility functions for pretty-printing. The major features provided by + this module are <ul> +<li>An <code class="code">fprintf</code>-style interface with support for user-defined printers</li> +<li>The printout is fit to a width by selecting some of the optional newlines</li> +<li>Constructs for alignment and indentation</li> +<li>Print ellipsis starting at a certain nesting depth</li> +<li>Constructs for printing lists and arrays</li> +</ul> + + Pretty-printing occurs in two stages:<ul> +<li>Construct a <a href="Pretty.html#TYPEdoc"><code class="code">Pretty.doc</code></a> object that encodes all of the elements to be + printed + along with alignment specifiers and optional and mandatory newlines</li> +<li>Format the <a href="Pretty.html#TYPEdoc"><code class="code">Pretty.doc</code></a> to a certain width and emit it as a string, to an + output stream or pass it to a user-defined function</li> +</ul> + + The formatting algorithm is not optimal but it does a pretty good job while + still operating in linear time. The original version was based on a pretty + printer by Philip Wadler which turned out to not scale to large jobs.<br> +<hr width="100%"> +<br> +API<br> +<pre><span class="keyword">type</span> <a name="TYPEdoc"></a><code class="type"></code>doc </pre> +<div class="info"> +The type of unformated documents. Elements of this type can be + constructed in two ways. Either with a number of constructor shown below, + or using the <a href="Pretty.html#VALdprintf"><code class="code">Pretty.dprintf</code></a> function with a <code class="code">printf</code>-like interface. + The <a href="Pretty.html#VALdprintf"><code class="code">Pretty.dprintf</code></a> method is slightly slower so we do not use it for + large jobs such as the output routines for a compiler. But we use it for + small jobs such as logging and error messages.<br> +</div> + +<br> +Constructors for the doc type.<br> +<pre><span class="keyword">val</span> <a name="VALnil"></a>nil : <code class="type"><a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +Constructs an empty document<br> +</div> +<pre><span class="keyword">val</span> <a name="VAL(++)"></a>(++) : <code class="type"><a href="Pretty.html#TYPEdoc">doc</a> -> <a href="Pretty.html#TYPEdoc">doc</a> -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +Concatenates two documents. This is an infix operator that associates to + the left.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALconcat"></a>concat : <code class="type"><a href="Pretty.html#TYPEdoc">doc</a> -> <a href="Pretty.html#TYPEdoc">doc</a> -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><pre><span class="keyword">val</span> <a name="VALtext"></a>text : <code class="type">string -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +A document that prints the given string<br> +</div> +<pre><span class="keyword">val</span> <a name="VALnum"></a>num : <code class="type">int -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +A document that prints an integer in decimal form<br> +</div> +<pre><span class="keyword">val</span> <a name="VALreal"></a>real : <code class="type">float -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +A document that prints a real number<br> +</div> +<pre><span class="keyword">val</span> <a name="VALchr"></a>chr : <code class="type">char -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +A document that prints a character. This is just like <a href="Pretty.html#VALtext"><code class="code">Pretty.text</code></a> + with a one-character string.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALline"></a>line : <code class="type"><a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +A document that consists of a mandatory newline. This is just like <code class="code">(text + "\n")</code>. The new line will be indented to the current indentation level, + unless you use <a href="Pretty.html#VALleftflush"><code class="code">Pretty.leftflush</code></a> right after this.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALleftflush"></a>leftflush : <code class="type"><a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +Use after a <a href="Pretty.html#VALline"><code class="code">Pretty.line</code></a> to prevent the indentation. Whatever follows + next will be flushed left. Indentation resumes on the next line.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALbreak"></a>break : <code class="type"><a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +A document that consists of either a space or a line break. Also called + an optional line break. Such a break will be + taken only if necessary to fit the document in a given width. If the break + is not taken a space is printed instead.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALalign"></a>align : <code class="type"><a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +Mark the current column as the current indentation level. Does not print + anything. All taken line breaks will align to this column. The previous + alignment level is saved on a stack.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALunalign"></a>unalign : <code class="type"><a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +Reverts to the last saved indentation level.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmark"></a>mark : <code class="type"><a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +Mark the beginning of a markup section. The width of a markup section is + considered 0 for the purpose of computing identation<br> +</div> +<pre><span class="keyword">val</span> <a name="VALunmark"></a>unmark : <code class="type"><a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +The end of a markup section<br> +</div> +<br> +Syntactic sugar<br> +<pre><span class="keyword">val</span> <a name="VALindent"></a>indent : <code class="type">int -> <a href="Pretty.html#TYPEdoc">doc</a> -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +Indents the document. Same as <code class="code">((text " ") ++ align ++ doc ++ unalign)</code>, + with the specified number of spaces.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALmarkup"></a>markup : <code class="type"><a href="Pretty.html#TYPEdoc">doc</a> -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +Prints a document as markup. The marked document cannot contain line + breaks or alignment constructs.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALseq"></a>seq : <code class="type">sep:<a href="Pretty.html#TYPEdoc">doc</a> -> doit:('a -> <a href="Pretty.html#TYPEdoc">doc</a>) -> elements:'a list -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +Formats a sequence. <code class="code">sep</code> is a separator, <code class="code">doit</code> is a function that + converts an element to a document.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdocList"></a>docList : <code class="type">?sep:<a href="Pretty.html#TYPEdoc">doc</a> -> ('a -> <a href="Pretty.html#TYPEdoc">doc</a>) -> unit -> 'a list -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +An alternative function for printing a list. The <code class="code">unit</code> argument is there + to make this function more easily usable with the <a href="Pretty.html#VALdprintf"><code class="code">Pretty.dprintf</code></a> + interface. The first argument is a separator, by default a comma.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_list"></a>d_list : <code class="type">string -> (unit -> 'a -> <a href="Pretty.html#TYPEdoc">doc</a>) -> unit -> 'a list -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +sm: Yet another list printer. This one accepts the same kind of + printing function that <a href="Pretty.html#VALdprintf"><code class="code">Pretty.dprintf</code></a> does, and itself works + in the dprintf context. Also accepts + a string as the separator since that's by far the most common.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdocArray"></a>docArray : <code class="type">?sep:<a href="Pretty.html#TYPEdoc">doc</a> -><br> (int -> 'a -> <a href="Pretty.html#TYPEdoc">doc</a>) -> unit -> 'a array -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +Formats an array. A separator and a function that prints an array + element. The default separator is a comma.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdocOpt"></a>docOpt : <code class="type">('a -> <a href="Pretty.html#TYPEdoc">doc</a>) -> unit -> 'a option -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +Prints an <code class="code">'a option</code> with <code class="code">None</code> or <code class="code">Some</code><br> +</div> +<pre><span class="keyword">val</span> <a name="VALd_int32"></a>d_int32 : <code class="type">int32 -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +Print an int32<br> +</div> +<pre><span class="keyword">val</span> <a name="VALf_int32"></a>f_int32 : <code class="type">unit -> int32 -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><pre><span class="keyword">val</span> <a name="VALd_int64"></a>d_int64 : <code class="type">int64 -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><pre><span class="keyword">val</span> <a name="VALf_int64"></a>f_int64 : <code class="type">unit -> int64 -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><pre><span class="keyword">module</span> <a href="Pretty.MakeMapPrinter.html">MakeMapPrinter</a>: <div class="sig_block"><code class="code">functor (</code><code class="code">Map</code><code class="code"> : </code><code class="code">sig</code><div class="sig_block"><pre><span class="keyword">type</span> <a name="TYPEkey"></a><code class="type"></code>key </pre> + +<pre><span class="keyword">type</span> <a name="TYPEt"></a><code class="type">'a</code> t </pre> + +<pre><span class="keyword">val</span> <a name="VALfold"></a>fold : <code class="type">(key -> 'a -> 'b -> 'b) -><br> 'a t -> 'b -> 'b</code></pre></div><code class="code">end</code><code class="code">) -> </code><code class="code">sig</code> <a href="Pretty.MakeMapPrinter.html">..</a> <code class="code">end</code></div></pre><div class="info"> +Format maps. +</div> +<pre><span class="keyword">module</span> <a href="Pretty.MakeSetPrinter.html">MakeSetPrinter</a>: <div class="sig_block"><code class="code">functor (</code><code class="code">Set</code><code class="code"> : </code><code class="code">sig</code><div class="sig_block"><pre><span class="keyword">type</span> <a name="TYPEelt"></a><code class="type"></code>elt </pre> + +<pre><span class="keyword">type</span> <a name="TYPEt"></a><code class="type"></code>t </pre> + +<pre><span class="keyword">val</span> <a name="VALfold"></a>fold : <code class="type">(elt -> 'a -> 'a) -><br> t -> 'a -> 'a</code></pre></div><code class="code">end</code><code class="code">) -> </code><code class="code">sig</code> <a href="Pretty.MakeSetPrinter.html">..</a> <code class="code">end</code></div></pre><div class="info"> +Format sets. +</div> +<pre><span class="keyword">val</span> <a name="VALinsert"></a>insert : <code class="type">unit -> <a href="Pretty.html#TYPEdoc">doc</a> -> <a href="Pretty.html#TYPEdoc">doc</a></code></pre><div class="info"> +A function that is useful with the <code class="code">printf</code>-like interface<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdprintf"></a>dprintf : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">doc</a>, <a href="Pretty.html#TYPEdoc">doc</a>) format4 -> 'a</code></pre><div class="info"> +This function provides an alternative method for constructing + <code class="code">doc</code> objects. The first argument for this function is a format string + argument (of type <code class="code">('a, unit, doc) format</code>; if you insist on + understanding what that means see the module <code class="code">Printf</code>). The format string + is like that for the <code class="code">printf</code> function in C, except that it understands a + few more formatting controls, all starting with the @ character. +<p> + + See the gprintf function if you want to pipe the result of dprintf into + some other functions. +<p> + + The following special formatting characters are understood (these do not + correspond to arguments of the function):<ul> +<li> @[ Inserts an <a href="Pretty.html#VALalign"><code class="code">Pretty.align</code></a>. Every format string must have matching + <a href="Pretty.html#VALalign"><code class="code">Pretty.align</code></a> and <a href="Pretty.html#VALunalign"><code class="code">Pretty.unalign</code></a>. </li> +<li> @] Inserts an <a href="Pretty.html#VALunalign"><code class="code">Pretty.unalign</code></a>.</li> +<li> @! Inserts a <a href="Pretty.html#VALline"><code class="code">Pretty.line</code></a>. Just like "\n"</li> +<li> @? Inserts a <a href="Pretty.html#VALbreak"><code class="code">Pretty.break</code></a>.</li> +<li> @< Inserts a <a href="Pretty.html#VALmark"><code class="code">Pretty.mark</code></a>. </li> +<li> @> Inserts a <a href="Pretty.html#VALunmark"><code class="code">Pretty.unmark</code></a>.</li> +<li> @^ Inserts a <a href="Pretty.html#VALleftflush"><code class="code">Pretty.leftflush</code></a> + Should be used immediately after @! or "\n".</li> +<li> @@ : inserts a @ character</li> +</ul> + + In addition to the usual <code class="code">printf</code> % formatting characters the following two + new characters are supported:<ul> +<li>%t Corresponds to an argument of type <code class="code">unit -> doc</code>. This argument is + invoked to produce a document</li> +<li>%a Corresponds to <b>two</b> arguments. The first of type <code class="code">unit -> 'a -> doc</code> + and the second of type <code class="code">'a</code>. (The extra <code class="code">unit</code> is do to the + peculiarities of the built-in support for format strings in Ocaml. It + turns out that it is not a major problem.) Here is an example of how + you use this:</li> +</ul> + +<pre>dprintf "Name=%s, SSN=%7d, Children=@[%a@]\n" + pers.name pers.ssn (docList (chr ',' ++ break) text) + pers.children</pre> +<p> + + The result of <code class="code">dprintf</code> is a <a href="Pretty.html#TYPEdoc"><code class="code">Pretty.doc</code></a>. You can format the document and + emit it using the functions <a href="Pretty.html#VALfprint"><code class="code">Pretty.fprint</code></a> and <a href="Pretty.html#VALsprint"><code class="code">Pretty.sprint</code></a>.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALgprintf"></a>gprintf : <code class="type">(<a href="Pretty.html#TYPEdoc">doc</a> -> 'a) -> ('b, unit, <a href="Pretty.html#TYPEdoc">doc</a>, 'a) format4 -> 'b</code></pre><div class="info"> +Like <a href="Pretty.html#VALdprintf"><code class="code">Pretty.dprintf</code></a> but more general. It also takes a function that is + invoked on the constructed document but before any formatting is done. The + type of the format argument means that 'a is the type of the parameters of + this function, unit is the type of the first argument to %a and %t + formats, doc is the type of the intermediate result, and 'b is the type of + the result of gprintf.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALfprint"></a>fprint : <code class="type">Pervasives.out_channel -> width:int -> <a href="Pretty.html#TYPEdoc">doc</a> -> unit</code></pre><div class="info"> +Format the document to the given width and emit it to the given channel<br> +</div> +<pre><span class="keyword">val</span> <a name="VALsprint"></a>sprint : <code class="type">width:int -> <a href="Pretty.html#TYPEdoc">doc</a> -> string</code></pre><div class="info"> +Format the document to the given width and emit it as a string<br> +</div> +<pre><span class="keyword">val</span> <a name="VALfprintf"></a>fprintf : <code class="type">Pervasives.out_channel -> ('a, unit, <a href="Pretty.html#TYPEdoc">doc</a>) Pervasives.format -> 'a</code></pre><div class="info"> +Like <a href="Pretty.html#VALdprintf"><code class="code">Pretty.dprintf</code></a> followed by <a href="Pretty.html#VALfprint"><code class="code">Pretty.fprint</code></a><br> +</div> +<pre><span class="keyword">val</span> <a name="VALprintf"></a>printf : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">doc</a>) Pervasives.format -> 'a</code></pre><div class="info"> +Like <a href="Pretty.html#VALfprintf"><code class="code">Pretty.fprintf</code></a> applied to <code class="code">stdout</code><br> +</div> +<pre><span class="keyword">val</span> <a name="VALeprintf"></a>eprintf : <code class="type">('a, unit, <a href="Pretty.html#TYPEdoc">doc</a>) Pervasives.format -> 'a</code></pre><div class="info"> +Like <a href="Pretty.html#VALfprintf"><code class="code">Pretty.fprintf</code></a> applied to <code class="code">stderr</code><br> +</div> +<pre><span class="keyword">val</span> <a name="VALwithPrintDepth"></a>withPrintDepth : <code class="type">int -> (unit -> unit) -> unit</code></pre><div class="info"> +Invokes a thunk, with printDepth temporarily set to the specified value<br> +</div> +<br> +The following variables can be used to control the operation of the printer<br> +<pre><span class="keyword">val</span> <a name="VALprintDepth"></a>printDepth : <code class="type">int Pervasives.ref</code></pre><div class="info"> +Specifies the nesting depth of the <code class="code">align</code>/<code class="code">unalign</code> pairs at which + everything is replaced with ellipsis<br> +</div> +<pre><span class="keyword">val</span> <a name="VALprintIndent"></a>printIndent : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +If false then does not indent<br> +</div> +<pre><span class="keyword">val</span> <a name="VALfastMode"></a>fastMode : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +If set to <code class="code">true</code> then optional breaks are taken only when the document + has exceeded the given width. This means that the printout will looked + more ragged but it will be faster<br> +</div> +<pre><span class="keyword">val</span> <a name="VALflushOften"></a>flushOften : <code class="type">bool Pervasives.ref</code></pre><div class="info"> +If true the it flushes after every print<br> +</div> +<pre><span class="keyword">val</span> <a name="VALcountNewLines"></a>countNewLines : <code class="type">int Pervasives.ref</code></pre><div class="info"> +Keep a running count of the taken newlines. You can read and write this + from the client code if you want<br> +</div> +<pre><span class="keyword">val</span> <a name="VALauto_printer"></a>auto_printer : <code class="type">string -> 'a</code></pre><div class="info"> +A function that when used at top-level in a module will direct + the pa_prtype module generate automatically the printing functions for a + type<br> +</div> +</body></html>
\ No newline at end of file diff --git a/cil/doc/api/Stats.html b/cil/doc/api/Stats.html new file mode 100644 index 0000000..b3f8aa4 --- /dev/null +++ b/cil/doc/api/Stats.html @@ -0,0 +1,69 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link rel="previous" href="Clist.html"> +<link rel="next" href="Cil.html"> +<link rel="Up" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Stats</title> +</head> +<body> +<div class="navbar"><a href="Clist.html">Previous</a> + <a href="index.html">Up</a> + <a href="Cil.html">Next</a> +</div> +<center><h1>Module <a href="type_Stats.html">Stats</a></h1></center> +<br> +<pre><span class="keyword">module</span> Stats: <code class="code">sig</code> <a href="Stats.html">..</a> <code class="code">end</code></pre>Utilities for maintaining timing statistics<br> +<hr width="100%"> +<pre><span class="keyword">val</span> <a name="VALreset"></a>reset : <code class="type">bool -> unit</code></pre><div class="info"> +Resets all the timings. Invoke with "true" if you want to switch to using + the hardware performance counters from now on. You get an exception if + there are not performance counters available<br> +</div> +<pre><span class="keyword">exception</span> <a name="EXCEPTIONNoPerfCount"></a>NoPerfCount</pre> +<pre><span class="keyword">val</span> <a name="VALhas_performance_counters"></a>has_performance_counters : <code class="type">unit -> bool</code></pre><div class="info"> +Check if we have performance counters<br> +</div> +<pre><span class="keyword">val</span> <a name="VALsample_pentium_perfcount_20"></a>sample_pentium_perfcount_20 : <code class="type">unit -> int</code></pre><div class="info"> +Sample the current cycle count, in megacycles.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALsample_pentium_perfcount_10"></a>sample_pentium_perfcount_10 : <code class="type">unit -> int</code></pre><div class="info"> +Sample the current cycle count, in kilocycles.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALtime"></a>time : <code class="type">string -> ('a -> 'b) -> 'a -> 'b</code></pre><div class="info"> +Time a function and associate the time with the given string. If some + timing information is already associated with that string, then accumulate + the times. If this function is invoked within another timed function then + you can have a hierarchy of timings<br> +</div> +<pre><span class="keyword">val</span> <a name="VALrepeattime"></a>repeattime : <code class="type">float -> string -> ('a -> 'b) -> 'a -> 'b</code></pre><div class="info"> +repeattime is like time but runs the function several times until the total + running time is greater or equal to the first argument. The total time is + then divided by the number of times the function was run.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALprint"></a>print : <code class="type">Pervasives.out_channel -> string -> unit</code></pre><div class="info"> +Print the current stats preceeded by a message<br> +</div> +<pre><span class="keyword">val</span> <a name="VALlastTime"></a>lastTime : <code class="type">float Pervasives.ref</code></pre><div class="info"> +Time a function and set lastTime to the time it took<br> +</div> +<pre><span class="keyword">val</span> <a name="VALtimethis"></a>timethis : <code class="type">('a -> 'b) -> 'a -> 'b</code></pre></body></html>
\ No newline at end of file diff --git a/cil/doc/api/index.html b/cil/doc/api/index.html new file mode 100644 index 0000000..f9636b2 --- /dev/null +++ b/cil/doc/api/index.html @@ -0,0 +1,83 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5)</title> +</head> +<body> +<center><h1>CIL API Documentation (version 1.3.5)</h1></center> +<a href="index_types.html">Index of types</a><br> +<a href="index_exceptions.html">Index of exceptions</a><br> +<a href="index_values.html">Index of values</a><br> +<a href="index_methods.html">Index of class methods</a><br> +<a href="index_classes.html">Index of classes</a><br> +<a href="index_class_types.html">Index of class types</a><br> +<a href="index_modules.html">Index of modules</a><br> +<a href="index_module_types.html">Index of module types</a><br> +<br/><br> +<table class="indextable"> +<tr><td><a href="Pretty.html">Pretty</a></td><td><div class="info"> +Utility functions for pretty-printing. +</div> +</td></tr> +<tr><td><a href="Errormsg.html">Errormsg</a></td><td><div class="info"> +Utility functions for error-reporting +</div> +</td></tr> +<tr><td><a href="Clist.html">Clist</a></td><td><div class="info"> +Utilities for managing "concatenable lists" (clists). +</div> +</td></tr> +<tr><td><a href="Stats.html">Stats</a></td><td><div class="info"> +Utilities for maintaining timing statistics +</div> +</td></tr> +<tr><td><a href="Cil.html">Cil</a></td><td><div class="info"> +CIL API Documentation. +</div> +</td></tr> +<tr><td><a href="Formatcil.html">Formatcil</a></td><td><div class="info"> +<b>An Interpreter for constructing CIL constructs</b> +</div> +</td></tr> +<tr><td><a href="Alpha.html">Alpha</a></td><td><div class="info"> +<b>ALPHA conversion</b> +</div> +</td></tr> +<tr><td><a href="Cillower.html">Cillower</a></td><td><div class="info"> +A number of lowering passes over CIL +</div> +</td></tr> +<tr><td><a href="Cfg.html">Cfg</a></td><td><div class="info"> +Code to compute the control-flow graph of a function or file. +</div> +</td></tr> +<tr><td><a href="Dataflow.html">Dataflow</a></td><td><div class="info"> +A framework for data flow analysis for CIL code. +</div> +</td></tr> +<tr><td><a href="Dominators.html">Dominators</a></td><td><div class="info"> +Compute dominators using data flow analysis +</div> +</td></tr> +</table> +</body> +</html>
\ No newline at end of file diff --git a/cil/doc/api/index_attributes.html b/cil/doc/api/index_attributes.html new file mode 100644 index 0000000..347bfa9 --- /dev/null +++ b/cil/doc/api/index_attributes.html @@ -0,0 +1,30 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Index of class attributes</title> +</head> +<body> +<center><h1>Index of class attributes</h1></center> +<table> +</table><br> +</body> +</html>
\ No newline at end of file diff --git a/cil/doc/api/index_class_types.html b/cil/doc/api/index_class_types.html new file mode 100644 index 0000000..4c7faef --- /dev/null +++ b/cil/doc/api/index_class_types.html @@ -0,0 +1,41 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Index of class types</title> +</head> +<body> +<center><h1>Index of class types</h1></center> +<table> +<tr><td align="left"><br>C</td></tr> +<tr><td><a href="Cil.cilPrinter.html">cilPrinter</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +A printer interface for CIL trees. +</div> +</td></tr> +<tr><td><a href="Cil.cilVisitor.html">cilVisitor</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +A visitor interface for traversing CIL trees. +</div> +</td></tr> +</table><br> +</body> +</html>
\ No newline at end of file diff --git a/cil/doc/api/index_classes.html b/cil/doc/api/index_classes.html new file mode 100644 index 0000000..1a5ba7d --- /dev/null +++ b/cil/doc/api/index_classes.html @@ -0,0 +1,46 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Index of classes</title> +</head> +<body> +<center><h1>Index of classes</h1></center> +<table> +<tr><td align="left"><br>D</td></tr> +<tr><td><a href="Cil.defaultCilPrinterClass.html">defaultCilPrinterClass</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td align="left"><br>N</td></tr> +<tr><td><a href="Cil.nopCilVisitor.html">nopCilVisitor</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Default Visitor. +</div> +</td></tr> +<tr><td align="left"><br>P</td></tr> +<tr><td><a href="Cil.plainCilPrinterClass.html">plainCilPrinterClass</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +These are pretty-printers that will show you more details on the internal + CIL representation, without trying hard to make it look like C +</div> +</td></tr> +</table><br> +</body> +</html>
\ No newline at end of file diff --git a/cil/doc/api/index_exceptions.html b/cil/doc/api/index_exceptions.html new file mode 100644 index 0000000..e774a65 --- /dev/null +++ b/cil/doc/api/index_exceptions.html @@ -0,0 +1,53 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Index of exceptions</title> +</head> +<body> +<center><h1>Index of exceptions</h1></center> +<table> +<tr><td align="left"><br>E</td></tr> +<tr><td><a href="Errormsg.html#EXCEPTIONError">Error</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +Error reporting functions raise this exception +</div> +</td></tr> +<tr><td align="left"><br>L</td></tr> +<tr><td><a href="Cil.html#EXCEPTIONLenOfArray">LenOfArray</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Raised when <a href="Cil.html#VALlenOfArray"><code class="code">Cil.lenOfArray</code></a> fails either because the length is <code class="code">None</code> + or because it is a non-constant expression +</div> +</td></tr> +<tr><td align="left"><br>N</td></tr> +<tr><td><a href="Stats.html#EXCEPTIONNoPerfCount">NoPerfCount</a> [<a href="Stats.html">Stats</a>]</td> +<td></td></tr> +<tr><td align="left"><br>S</td></tr> +<tr><td><a href="Cil.html#EXCEPTIONSizeOfError">SizeOfError</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Raised when one of the bitsSizeOf functions cannot compute the size of a + type. +</div> +</td></tr> +</table><br> +</body> +</html>
\ No newline at end of file diff --git a/cil/doc/api/index_methods.html b/cil/doc/api/index_methods.html new file mode 100644 index 0000000..1558de3 --- /dev/null +++ b/cil/doc/api/index_methods.html @@ -0,0 +1,228 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Index of class methods</title> +</head> +<body> +<center><h1>Index of class methods</h1></center> +<table> +<tr><td align="left"><br>D</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODdBlock">dBlock</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Dump a control-flow block to a file with a given indentation. +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODdGlobal">dGlobal</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Dump a global to a file with a given indentation. +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODdInit">dInit</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Dump a global to a file with a given indentation. +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODdStmt">dStmt</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Dump a control-flow statement to a file with a given indentation. +</div> +</td></tr> +<tr><td align="left"><br>P</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpAttr">pAttr</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Attribute. +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpAttrParam">pAttrParam</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Attribute parameter +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpAttrs">pAttrs</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Attribute lists +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpBlock">pBlock</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpExp">pExp</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Print expressions +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpFieldDecl">pFieldDecl</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +A field declaration +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpGlobal">pGlobal</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Global (vars, types, etc.). +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpInit">pInit</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Print initializers. +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpInstr">pInstr</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Invoked on each instruction occurrence. +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpLabel">pLabel</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Print a label. +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpLineDirective">pLineDirective</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Print a line-number. +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpLval">pLval</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Invoked on each lvalue occurrence +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpOffset">pOffset</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Invoked on each offset occurrence. +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpStmt">pStmt</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Control-flow statement. +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpStmtKind">pStmtKind</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Print a statement kind. +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpType">pType</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpVDecl">pVDecl</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Invoked for each variable declaration. +</div> +</td></tr> +<tr><td><a href="Cil.cilPrinter.html#METHODpVar">pVar</a> [<a href="Cil.cilPrinter.html">Cil.cilPrinter</a>]</td> +<td><div class="info"> +Invoked on each variable use. +</div> +</td></tr> +<tr><td align="left"><br>Q</td></tr> +<tr><td><a href="Cil.cilVisitor.html#METHODqueueInstr">queueInstr</a> [<a href="Cil.cilVisitor.html">Cil.cilVisitor</a>]</td> +<td><div class="info"> +Add here instructions while visiting to queue them to preceede the + current statement or instruction being processed. +</div> +</td></tr> +<tr><td align="left"><br>U</td></tr> +<tr><td><a href="Cil.cilVisitor.html#METHODunqueueInstr">unqueueInstr</a> [<a href="Cil.cilVisitor.html">Cil.cilVisitor</a>]</td> +<td><div class="info"> +Gets the queue of instructions and resets the queue. +</div> +</td></tr> +<tr><td align="left"><br>V</td></tr> +<tr><td><a href="Cil.cilVisitor.html#METHODvattr">vattr</a> [<a href="Cil.cilVisitor.html">Cil.cilVisitor</a>]</td> +<td><div class="info"> +Attribute. +</div> +</td></tr> +<tr><td><a href="Cil.cilVisitor.html#METHODvattrparam">vattrparam</a> [<a href="Cil.cilVisitor.html">Cil.cilVisitor</a>]</td> +<td><div class="info"> +Attribute parameters. +</div> +</td></tr> +<tr><td><a href="Cil.cilVisitor.html#METHODvblock">vblock</a> [<a href="Cil.cilVisitor.html">Cil.cilVisitor</a>]</td> +<td><div class="info"> +Block. +</div> +</td></tr> +<tr><td><a href="Cil.cilVisitor.html#METHODvexpr">vexpr</a> [<a href="Cil.cilVisitor.html">Cil.cilVisitor</a>]</td> +<td><div class="info"> +Invoked on each expression occurrence. +</div> +</td></tr> +<tr><td><a href="Cil.cilVisitor.html#METHODvfunc">vfunc</a> [<a href="Cil.cilVisitor.html">Cil.cilVisitor</a>]</td> +<td><div class="info"> +Function definition. +</div> +</td></tr> +<tr><td><a href="Cil.cilVisitor.html#METHODvglob">vglob</a> [<a href="Cil.cilVisitor.html">Cil.cilVisitor</a>]</td> +<td><div class="info"> +Global (vars, types, + etc.) +</div> +</td></tr> +<tr><td><a href="Cil.cilVisitor.html#METHODvinit">vinit</a> [<a href="Cil.cilVisitor.html">Cil.cilVisitor</a>]</td> +<td><div class="info"> +Initializers for globals +</div> +</td></tr> +<tr><td><a href="Cil.cilVisitor.html#METHODvinitoffs">vinitoffs</a> [<a href="Cil.cilVisitor.html">Cil.cilVisitor</a>]</td> +<td><div class="info"> +Invoked on each offset appearing in the list of a + CompoundInit initializer. +</div> +</td></tr> +<tr><td><a href="Cil.cilVisitor.html#METHODvinst">vinst</a> [<a href="Cil.cilVisitor.html">Cil.cilVisitor</a>]</td> +<td><div class="info"> +Invoked on each instruction occurrence. +</div> +</td></tr> +<tr><td><a href="Cil.cilVisitor.html#METHODvlval">vlval</a> [<a href="Cil.cilVisitor.html">Cil.cilVisitor</a>]</td> +<td><div class="info"> +Invoked on each lvalue occurrence +</div> +</td></tr> +<tr><td><a href="Cil.cilVisitor.html#METHODvoffs">voffs</a> [<a href="Cil.cilVisitor.html">Cil.cilVisitor</a>]</td> +<td><div class="info"> +Invoked on each offset occurrence that is *not* as part + of an initializer list specification, i.e. +</div> +</td></tr> +<tr><td><a href="Cil.cilVisitor.html#METHODvstmt">vstmt</a> [<a href="Cil.cilVisitor.html">Cil.cilVisitor</a>]</td> +<td><div class="info"> +Control-flow statement. +</div> +</td></tr> +<tr><td><a href="Cil.cilVisitor.html#METHODvtype">vtype</a> [<a href="Cil.cilVisitor.html">Cil.cilVisitor</a>]</td> +<td><div class="info"> +Use of some type. +</div> +</td></tr> +<tr><td><a href="Cil.cilVisitor.html#METHODvvdec">vvdec</a> [<a href="Cil.cilVisitor.html">Cil.cilVisitor</a>]</td> +<td><div class="info"> +Invoked for each variable declaration. +</div> +</td></tr> +<tr><td><a href="Cil.cilVisitor.html#METHODvvrbl">vvrbl</a> [<a href="Cil.cilVisitor.html">Cil.cilVisitor</a>]</td> +<td><div class="info"> +Invoked on each variable use. +</div> +</td></tr> +</table><br> +</body> +</html>
\ No newline at end of file diff --git a/cil/doc/api/index_module_types.html b/cil/doc/api/index_module_types.html new file mode 100644 index 0000000..244d402 --- /dev/null +++ b/cil/doc/api/index_module_types.html @@ -0,0 +1,36 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Index of module types</title> +</head> +<body> +<center><h1>Index of module types</h1></center> +<table> +<tr><td align="left"><br>B</td></tr> +<tr><td><a href="Dataflow.BackwardsTransfer.html">BackwardsTransfer</a> [<a href="Dataflow.html">Dataflow</a>]</td> +<td></td></tr> +<tr><td align="left"><br>F</td></tr> +<tr><td><a href="Dataflow.ForwardsTransfer.html">ForwardsTransfer</a> [<a href="Dataflow.html">Dataflow</a>]</td> +<td></td></tr> +</table><br> +</body> +</html>
\ No newline at end of file diff --git a/cil/doc/api/index_modules.html b/cil/doc/api/index_modules.html new file mode 100644 index 0000000..090693f --- /dev/null +++ b/cil/doc/api/index_modules.html @@ -0,0 +1,108 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Index of modules</title> +</head> +<body> +<center><h1>Index of modules</h1></center> +<table> +<tr><td align="left"><br>A</td></tr> +<tr><td><a href="Alpha.html">Alpha</a> </td> +<td><div class="info"> +<b>ALPHA conversion</b> +</div> +</td></tr> +<tr><td align="left"><br>B</td></tr> +<tr><td><a href="Dataflow.BackwardsDataFlow.html">BackwardsDataFlow</a> [<a href="Dataflow.html">Dataflow</a>]</td> +<td></td></tr> +<tr><td align="left"><br>C</td></tr> +<tr><td><a href="Cfg.html">Cfg</a> </td> +<td><div class="info"> +Code to compute the control-flow graph of a function or file. +</div> +</td></tr> +<tr><td><a href="Cil.html">Cil</a> </td> +<td><div class="info"> +CIL API Documentation. +</div> +</td></tr> +<tr><td><a href="Cillower.html">Cillower</a> </td> +<td><div class="info"> +A number of lowering passes over CIL +</div> +</td></tr> +<tr><td><a href="Clist.html">Clist</a> </td> +<td><div class="info"> +Utilities for managing "concatenable lists" (clists). +</div> +</td></tr> +<tr><td align="left"><br>D</td></tr> +<tr><td><a href="Dataflow.html">Dataflow</a> </td> +<td><div class="info"> +A framework for data flow analysis for CIL code. +</div> +</td></tr> +<tr><td><a href="Dominators.html">Dominators</a> </td> +<td><div class="info"> +Compute dominators using data flow analysis +</div> +</td></tr> +<tr><td align="left"><br>E</td></tr> +<tr><td><a href="Errormsg.html">Errormsg</a> </td> +<td><div class="info"> +Utility functions for error-reporting +</div> +</td></tr> +<tr><td align="left"><br>F</td></tr> +<tr><td><a href="Formatcil.html">Formatcil</a> </td> +<td><div class="info"> +<b>An Interpreter for constructing CIL constructs</b> +</div> +</td></tr> +<tr><td><a href="Dataflow.ForwardsDataFlow.html">ForwardsDataFlow</a> [<a href="Dataflow.html">Dataflow</a>]</td> +<td></td></tr> +<tr><td align="left"><br>M</td></tr> +<tr><td><a href="Pretty.MakeMapPrinter.html">MakeMapPrinter</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Format maps. +</div> +</td></tr> +<tr><td><a href="Pretty.MakeSetPrinter.html">MakeSetPrinter</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Format sets. +</div> +</td></tr> +<tr><td align="left"><br>P</td></tr> +<tr><td><a href="Pretty.html">Pretty</a> </td> +<td><div class="info"> +Utility functions for pretty-printing. +</div> +</td></tr> +<tr><td align="left"><br>S</td></tr> +<tr><td><a href="Stats.html">Stats</a> </td> +<td><div class="info"> +Utilities for maintaining timing statistics +</div> +</td></tr> +</table><br> +</body> +</html>
\ No newline at end of file diff --git a/cil/doc/api/index_types.html b/cil/doc/api/index_types.html new file mode 100644 index 0000000..1974acd --- /dev/null +++ b/cil/doc/api/index_types.html @@ -0,0 +1,271 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Index of types</title> +</head> +<body> +<center><h1>Index of types</h1></center> +<table> +<tr><td align="left"><br>A</td></tr> +<tr><td><a href="Dataflow.html#TYPEaction">action</a> [<a href="Dataflow.html">Dataflow</a>]</td> +<td></td></tr> +<tr><td><a href="Alpha.html#TYPEalphaTableData">alphaTableData</a> [<a href="Alpha.html">Alpha</a>]</td> +<td><div class="info"> +This is the type of the elements of the alpha renaming table. +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEattribute">attribute</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#TYPEattributeClass">attributeClass</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Various classes of attributes +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEattributes">attributes</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Attributes are lists sorted by the attribute name. +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEattrparam">attrparam</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +The type of parameters of attributes +</div> +</td></tr> +<tr><td align="left"><br>B</td></tr> +<tr><td><a href="Cil.html#TYPEbinop">binop</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Binary operations +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEblock">block</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +A block is a sequence of statements with the control falling through from + one element to the next +</div> +</td></tr> +<tr><td align="left"><br>C</td></tr> +<tr><td><a href="Clist.html#TYPEclist">clist</a> [<a href="Clist.html">Clist</a>]</td> +<td><div class="info"> +The clist datatype. +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEcomment">comment</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#TYPEcompinfo">compinfo</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +The definition of a structure or union type. +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEconstant">constant</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Literal constants +</div> +</td></tr> +<tr><td align="left"><br>D</td></tr> +<tr><td><a href="Pretty.html#TYPEdoc">doc</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +The type of unformated documents. +</div> +</td></tr> +<tr><td align="left"><br>E</td></tr> +<tr><td><a href="Cil.html#TYPEenuminfo">enuminfo</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Information about an enumeration +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEexistsAction">existsAction</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +A datatype to be used in conjunction with <code class="code">existsType</code> +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEexp">exp</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Expressions (Side-effect free) +</div> +</td></tr> +<tr><td align="left"><br>F</td></tr> +<tr><td><a href="Cil.html#TYPEfeatureDescr">featureDescr</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +To be able to add/remove features easily, each feature should be package + as an interface with the following interface. +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEfieldinfo">fieldinfo</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Information about a struct/union field +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEfile">file</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Top-level representation of a C source file +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEfkind">fkind</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Various kinds of floating-point numbers +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEformatArg">formatArg</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +The type of argument for the interpreter +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEfundec">fundec</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Function definitions. +</div> +</td></tr> +<tr><td align="left"><br>G</td></tr> +<tr><td><a href="Cil.html#TYPEglobal">global</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +A global declaration or definition +</div> +</td></tr> +<tr><td><a href="Dataflow.html#TYPEguardaction">guardaction</a> [<a href="Dataflow.html">Dataflow</a>]</td> +<td></td></tr> +<tr><td align="left"><br>I</td></tr> +<tr><td><a href="Cil.html#TYPEikind">ikind</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Various kinds of integers +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEinit">init</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Initializers for global variables. +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEinitinfo">initinfo</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +We want to be able to update an initializer in a global variable, so we + define it as a mutable field +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEinstr">instr</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Instructions. +</div> +</td></tr> +<tr><td align="left"><br>L</td></tr> +<tr><td><a href="Cil.html#TYPElabel">label</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Labels +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPElhost">lhost</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +The host part of an <a href="Cil.html#TYPElval"><code class="code">Cil.lval</code></a>. +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPElineDirectiveStyle">lineDirectiveStyle</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Styles of printing line directives +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPElocation">location</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Describes a location in a source file. +</div> +</td></tr> +<tr><td><a href="Errormsg.html#TYPElocation">location</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +Type for source-file locations +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPElval">lval</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +An lvalue +</div> +</td></tr> +<tr><td align="left"><br>O</td></tr> +<tr><td><a href="Cil.html#TYPEoffset">offset</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +The offset part of an <a href="Cil.html#TYPElval"><code class="code">Cil.lval</code></a>. +</div> +</td></tr> +<tr><td align="left"><br>S</td></tr> +<tr><td><a href="Cil.html#TYPEstmt">stmt</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Statements. +</div> +</td></tr> +<tr><td><a href="Dataflow.html#TYPEstmtaction">stmtaction</a> [<a href="Dataflow.html">Dataflow</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#TYPEstmtkind">stmtkind</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +The various kinds of control-flow statements statements +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEstorage">storage</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Storage-class information +</div> +</td></tr> +<tr><td align="left"><br>T</td></tr> +<tr><td><a href="Dataflow.BackwardsTransfer.html#TYPEt">t</a> [<a href="Dataflow.BackwardsTransfer.html">Dataflow.BackwardsTransfer</a>]</td> +<td><div class="info"> +The type of the data we compute for each block start. +</div> +</td></tr> +<tr><td><a href="Dataflow.ForwardsTransfer.html#TYPEt">t</a> [<a href="Dataflow.ForwardsTransfer.html">Dataflow.ForwardsTransfer</a>]</td> +<td><div class="info"> +The type of the data we compute for each block start. +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEtyp">typ</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#TYPEtypeinfo">typeinfo</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Information about a defined type +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEtypsig">typsig</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Type signatures. +</div> +</td></tr> +<tr><td align="left"><br>U</td></tr> +<tr><td><a href="Alpha.html#TYPEundoAlphaElement">undoAlphaElement</a> [<a href="Alpha.html">Alpha</a>]</td> +<td><div class="info"> +This is the type of the elements that are recorded by the alpha + conversion functions in order to be able to undo changes to the tables + they modify. +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEunop">unop</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Unary operators +</div> +</td></tr> +<tr><td align="left"><br>V</td></tr> +<tr><td><a href="Cil.html#TYPEvarinfo">varinfo</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Information about a variable. +</div> +</td></tr> +<tr><td><a href="Cil.html#TYPEvisitAction">visitAction</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Different visiting actions. +</div> +</td></tr> +</table><br> +</body> +</html>
\ No newline at end of file diff --git a/cil/doc/api/index_values.html b/cil/doc/api/index_values.html new file mode 100644 index 0000000..799daaf --- /dev/null +++ b/cil/doc/api/index_values.html @@ -0,0 +1,1964 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Index of values</title> +</head> +<body> +<center><h1>Index of values</h1></center> +<table> +<tr><td align="left"><br></td></tr> +<tr><td><a href="Pretty.html#VAL(++)">(++)</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Concatenates two documents. +</div> +</td></tr> +<tr><td align="left"><br>A</td></tr> +<tr><td><a href="Cil.html#VALaddAttribute">addAttribute</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Add an attribute. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALaddAttributes">addAttributes</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Add a list of attributes. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALaddOffset">addOffset</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +<code class="code">addOffset o1 o2</code> adds <code class="code">o1</code> to the end of <code class="code">o2</code>. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALaddOffsetLval">addOffsetLval</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Add an offset at the end of an lvalue. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALadditiveLevel">additiveLevel</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALaddrOfLevel">addrOfLevel</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Pretty.html#VALalign">align</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Mark the current column as the current indentation level. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALalignOf_int">alignOf_int</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +The minimum alignment (in bytes) for a type. +</div> +</td></tr> +<tr><td><a href="Clist.html#VALappend">append</a> [<a href="Clist.html">Clist</a>]</td> +<td><div class="info"> +Append two clists +</div> +</td></tr> +<tr><td><a href="Cil.html#VALargsToList">argsToList</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Obtain the argument list ([] if None) +</div> +</td></tr> +<tr><td><a href="Cil.html#VALarrowLevel">arrowLevel</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALattributeHash">attributeHash</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +This table contains the mapping of predefined attributes to classes. +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALauto_printer">auto_printer</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +A function that when used at top-level in a module will direct + the pa_prtype module generate automatically the printing functions for a + type +</div> +</td></tr> +<tr><td align="left"><br>B</td></tr> +<tr><td><a href="Cil.html#VALbitsOffset">bitsOffset</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Give a type of a base and an offset, returns the number of bits from the + base address and the width (also expressed in bits) for the subobject + denoted by the offset. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALbitsSizeOf">bitsSizeOf</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +The size of a type, in bits. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALbitwiseLevel">bitwiseLevel</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Pretty.html#VALbreak">break</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +A document that consists of either a space or a line break. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALbug">bug</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Like <a href="Errormsg.html#VALbug"><code class="code">Errormsg.bug</code></a> except that <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> is also printed +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALbug">bug</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +Similar to <code class="code">error</code> except that its output has the form <code class="code">Bug: ...</code> +</div> +</td></tr> +<tr><td align="left"><br>C</td></tr> +<tr><td><a href="Formatcil.html#VALcExp">cExp</a> [<a href="Formatcil.html">Formatcil</a>]</td> +<td><div class="info"> +Constructs an expression based on the program and the list of arguments. +</div> +</td></tr> +<tr><td><a href="Formatcil.html#VALcInstr">cInstr</a> [<a href="Formatcil.html">Formatcil</a>]</td> +<td><div class="info"> +Constructs an instruction based on the program and the list of arguments. +</div> +</td></tr> +<tr><td><a href="Formatcil.html#VALcLval">cLval</a> [<a href="Formatcil.html">Formatcil</a>]</td> +<td><div class="info"> +Constructs an lval based on the program and the list of arguments. +</div> +</td></tr> +<tr><td><a href="Formatcil.html#VALcStmt">cStmt</a> [<a href="Formatcil.html">Formatcil</a>]</td> +<td></td></tr> +<tr><td><a href="Formatcil.html#VALcStmts">cStmts</a> [<a href="Formatcil.html">Formatcil</a>]</td> +<td><div class="info"> +Constructs a list of statements +</div> +</td></tr> +<tr><td><a href="Formatcil.html#VALcType">cType</a> [<a href="Formatcil.html">Formatcil</a>]</td> +<td><div class="info"> +Constructs a type based on the program and the list of arguments. +</div> +</td></tr> +<tr><td><a href="Cfg.html#VALcfgFun">cfgFun</a> [<a href="Cfg.html">Cfg</a>]</td> +<td><div class="info"> +Compute a control flow graph for fd. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALcharConstPtrType">charConstPtrType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +char const * +</div> +</td></tr> +<tr><td><a href="Cil.html#VALcharConstToInt">charConstToInt</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Given the character c in a (CChr c), sign-extend it to 32 bits. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALcharPtrType">charPtrType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +char * +</div> +</td></tr> +<tr><td><a href="Cil.html#VALcharType">charType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +char +</div> +</td></tr> +<tr><td><a href="Cil.html#VALchar_is_unsigned">char_is_unsigned</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Whether "char" is unsigned. +</div> +</td></tr> +<tr><td><a href="Clist.html#VALcheckBeforeAppend">checkBeforeAppend</a> [<a href="Clist.html">Clist</a>]</td> +<td><div class="info"> +A useful check to assert before an append. +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALchr">chr</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +A document that prints a character. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALcilVersion">cilVersion</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +This are the CIL version numbers. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALcilVersionMajor">cilVersionMajor</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALcilVersionMinor">cilVersionMinor</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALcilVersionRevision">cilVersionRevision</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cfg.html#VALclearCFGinfo">clearCFGinfo</a> [<a href="Cfg.html">Cfg</a>]</td> +<td><div class="info"> +clear the sid, succs, and preds fields of each statment in a function +</div> +</td></tr> +<tr><td><a href="Cfg.html#VALclearFileCFG">clearFileCFG</a> [<a href="Cfg.html">Cfg</a>]</td> +<td><div class="info"> +clear the sid, succs, and preds fields of each statement. +</div> +</td></tr> +<tr><td><a href="Dataflow.ForwardsTransfer.html#VALcombinePredecessors">combinePredecessors</a> [<a href="Dataflow.ForwardsTransfer.html">Dataflow.ForwardsTransfer</a>]</td> +<td><div class="info"> +Take some old data for the start of a statement, and some new data for + the same point. +</div> +</td></tr> +<tr><td><a href="Dataflow.BackwardsTransfer.html#VALcombineStmtStartData">combineStmtStartData</a> [<a href="Dataflow.BackwardsTransfer.html">Dataflow.BackwardsTransfer</a>]</td> +<td><div class="info"> +When the analysis reaches the start of a block, combine the old data + with the one we have just computed. +</div> +</td></tr> +<tr><td><a href="Dataflow.BackwardsTransfer.html#VALcombineSuccessors">combineSuccessors</a> [<a href="Dataflow.BackwardsTransfer.html">Dataflow.BackwardsTransfer</a>]</td> +<td><div class="info"> +Take the data from two successors and combine it +</div> +</td></tr> +<tr><td><a href="Cil.html#VALcompFullName">compFullName</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Get the full name of a comp +</div> +</td></tr> +<tr><td><a href="Cil.html#VALcompactStmts">compactStmts</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Try to compress statements so as to get maximal basic blocks +</div> +</td></tr> +<tr><td><a href="Cil.html#VALcomparativeLevel">comparativeLevel</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALcompareLoc">compareLoc</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Comparison function for locations. +</div> +</td></tr> +<tr><td><a href="Dataflow.BackwardsDataFlow.html#VALcompute">compute</a> [<a href="Dataflow.BackwardsDataFlow.html">Dataflow.BackwardsDataFlow</a>]</td> +<td><div class="info"> +Fill in the T.stmtStartData, given a number of initial statements to + start from (the sinks for the backwards data flow). +</div> +</td></tr> +<tr><td><a href="Dataflow.ForwardsDataFlow.html#VALcompute">compute</a> [<a href="Dataflow.ForwardsDataFlow.html">Dataflow.ForwardsDataFlow</a>]</td> +<td><div class="info"> +Fill in the T.stmtStartData, given a number of initial statements to + start from. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALcomputeCFGInfo">computeCFGInfo</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Compute the CFG information for all statements in a fundec and return a + list of the statements. +</div> +</td></tr> +<tr><td><a href="Cfg.html#VALcomputeFileCFG">computeFileCFG</a> [<a href="Cfg.html">Cfg</a>]</td> +<td><div class="info"> +Compute the CFG for an entire file, by calling cfgFun on each function. +</div> +</td></tr> +<tr><td><a href="Dataflow.ForwardsTransfer.html#VALcomputeFirstPredecessor">computeFirstPredecessor</a> [<a href="Dataflow.ForwardsTransfer.html">Dataflow.ForwardsTransfer</a>]</td> +<td><div class="info"> +Give the first value for a predecessors, compute the value to be set + for the block +</div> +</td></tr> +<tr><td><a href="Dominators.html#VALcomputeIDom">computeIDom</a> [<a href="Dominators.html">Dominators</a>]</td> +<td><div class="info"> +Invoke on a code after filling in the CFG info and it computes the + immediate dominator information. +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALconcat">concat</a> [<a href="Pretty.html">Pretty</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALconstFold">constFold</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Do constant folding on an expression. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALconstFoldBinOp">constFoldBinOp</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Do constant folding on a binary operation. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALconstFoldVisitor">constFoldVisitor</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +A visitor that does constant folding. +</div> +</td></tr> +<tr><td><a href="Dataflow.ForwardsTransfer.html#VALcopy">copy</a> [<a href="Dataflow.ForwardsTransfer.html">Dataflow.ForwardsTransfer</a>]</td> +<td><div class="info"> +Make a deep copy of the data +</div> +</td></tr> +<tr><td><a href="Cil.html#VALcopyCompInfo">copyCompInfo</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Makes a shallow copy of a <a href="Cil.html#TYPEcompinfo"><code class="code">Cil.compinfo</code></a> changing the name and the key. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALcopyFunction">copyFunction</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Create a deep copy of a function. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALcopyVarinfo">copyVarinfo</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Make a shallow copy of a <code class="code">varinfo</code> and assign a new identifier +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALcountNewLines">countNewLines</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Keep a running count of the taken newlines. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALcurrentGlobal">currentGlobal</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +A reference to the current global being visited +</div> +</td></tr> +<tr><td><a href="Cil.html#VALcurrentLoc">currentLoc</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +A reference to the current location. +</div> +</td></tr> +<tr><td align="left"><br>D</td></tr> +<tr><td><a href="Formatcil.html#VALdExp">dExp</a> [<a href="Formatcil.html">Formatcil</a>]</td> +<td><div class="info"> +Deconstructs an expression based on the program. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALdExp">dExp</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Generate an <a href="Cil.html#TYPEexp"><code class="code">Cil.exp</code></a> to be used in case of errors. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALdGlobal">dGlobal</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Generate a <a href="Cil.html#TYPEglobal"><code class="code">Cil.global</code></a> to be used in case of errors. +</div> +</td></tr> +<tr><td><a href="Formatcil.html#VALdInstr">dInstr</a> [<a href="Formatcil.html">Formatcil</a>]</td> +<td><div class="info"> +Deconstructs an instruction based on the program. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALdInstr">dInstr</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Generate an <a href="Cil.html#TYPEinstr"><code class="code">Cil.instr</code></a> to be used in case of errors. +</div> +</td></tr> +<tr><td><a href="Formatcil.html#VALdLval">dLval</a> [<a href="Formatcil.html">Formatcil</a>]</td> +<td><div class="info"> +Deconstructs an lval based on the program. +</div> +</td></tr> +<tr><td><a href="Formatcil.html#VALdType">dType</a> [<a href="Formatcil.html">Formatcil</a>]</td> +<td><div class="info"> +Deconstructs a type based on the program. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_attr">d_attr</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print an attribute using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a> +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_attrlist">d_attrlist</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print a list of attributes using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a> +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_attrparam">d_attrparam</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print an argument of an attribute using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a> +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_binop">d_binop</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print a binary operator +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_block">d_block</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print a block using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a>. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_const">d_const</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print a constant +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_exp">d_exp</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print an expression using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a> +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_fkind">d_fkind</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print a floating-point kind +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_formatarg">d_formatarg</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-prints a format arg +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_global">d_global</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print the internal representation of a global using + <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a>. +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALd_hloc">d_hloc</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALd_ikind">d_ikind</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print an integer of a given kind +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_init">d_init</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print an initializer using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a>. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_instr">d_instr</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print an instruction using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a> +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALd_int32">d_int32</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Print an int32 +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALd_int64">d_int64</a> [<a href="Pretty.html">Pretty</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALd_label">d_label</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print a label using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a> +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALd_list">d_list</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +sm: Yet another list printer. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_loc">d_loc</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print a location +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALd_loc">d_loc</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALd_lval">d_lval</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print an lvalue using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a> +</div> +</td></tr> +<tr><td><a href="Pretty.MakeMapPrinter.html#VALd_map">d_map</a> [<a href="Pretty.MakeMapPrinter.html">Pretty.MakeMapPrinter</a>]</td> +<td><div class="info"> +Format a map, analogous to d_list. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_offset">d_offset</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print an offset using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a>, given the pretty + printing for the base. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_plainexp">d_plainexp</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print the internal representation of an expression +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_plaininit">d_plaininit</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print the internal representation of an integer +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_plainlval">d_plainlval</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print the internal representation of an lvalue +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_plaintype">d_plaintype</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print the internal representation of a type +</div> +</td></tr> +<tr><td><a href="Pretty.MakeSetPrinter.html#VALd_set">d_set</a> [<a href="Pretty.MakeSetPrinter.html">Pretty.MakeSetPrinter</a>]</td> +<td><div class="info"> +Format a set, analogous to d_list. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_shortglobal">d_shortglobal</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print a short description of the global. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_stmt">d_stmt</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print a statement using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a>. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_storage">d_storage</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print storage-class information +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_thisloc">d_thisloc</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print the <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_type">d_type</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print a type using <a href="Cil.html#VALdefaultCilPrinter"><code class="code">Cil.defaultCilPrinter</code></a> +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_typsig">d_typsig</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Print a type signature +</div> +</td></tr> +<tr><td><a href="Cil.html#VALd_unop">d_unop</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print a unary operator +</div> +</td></tr> +<tr><td><a href="Dataflow.BackwardsTransfer.html#VALdebug">debug</a> [<a href="Dataflow.BackwardsTransfer.html">Dataflow.BackwardsTransfer</a>]</td> +<td><div class="info"> +Whether to turn on debugging +</div> +</td></tr> +<tr><td><a href="Dataflow.ForwardsTransfer.html#VALdebug">debug</a> [<a href="Dataflow.ForwardsTransfer.html">Dataflow.ForwardsTransfer</a>]</td> +<td><div class="info"> +Whether to turn on debugging +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALdebugFlag">debugFlag</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +If set then print debugging info +</div> +</td></tr> +<tr><td><a href="Cil.html#VALdefaultCilPrinter">defaultCilPrinter</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALderefStarLevel">derefStarLevel</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALdn_attr">dn_attr</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALdn_attrlist">dn_attrlist</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALdn_attrparam">dn_attrparam</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALdn_exp">dn_exp</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Versions of the above pretty printers, that don't print #line directives +</div> +</td></tr> +<tr><td><a href="Cil.html#VALdn_global">dn_global</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALdn_init">dn_init</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALdn_instr">dn_instr</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALdn_lval">dn_lval</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALdn_stmt">dn_stmt</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALdn_type">dn_type</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Dataflow.ForwardsTransfer.html#VALdoGuard">doGuard</a> [<a href="Dataflow.ForwardsTransfer.html">Dataflow.ForwardsTransfer</a>]</td> +<td><div class="info"> +Generate the successor to an If statement assuming the given expression + is nonzero. +</div> +</td></tr> +<tr><td><a href="Dataflow.BackwardsTransfer.html#VALdoInstr">doInstr</a> [<a href="Dataflow.BackwardsTransfer.html">Dataflow.BackwardsTransfer</a>]</td> +<td><div class="info"> +The (backwards) transfer function for an instruction. +</div> +</td></tr> +<tr><td><a href="Dataflow.ForwardsTransfer.html#VALdoInstr">doInstr</a> [<a href="Dataflow.ForwardsTransfer.html">Dataflow.ForwardsTransfer</a>]</td> +<td><div class="info"> +The (forwards) transfer function for an instruction. +</div> +</td></tr> +<tr><td><a href="Dataflow.BackwardsTransfer.html#VALdoStmt">doStmt</a> [<a href="Dataflow.BackwardsTransfer.html">Dataflow.BackwardsTransfer</a>]</td> +<td><div class="info"> +The (backwards) transfer function for a branch. +</div> +</td></tr> +<tr><td><a href="Dataflow.ForwardsTransfer.html#VALdoStmt">doStmt</a> [<a href="Dataflow.ForwardsTransfer.html">Dataflow.ForwardsTransfer</a>]</td> +<td><div class="info"> +The (forwards) transfer function for a statement. +</div> +</td></tr> +<tr><td><a href="Alpha.html#VALdocAlphaTable">docAlphaTable</a> [<a href="Alpha.html">Alpha</a>]</td> +<td><div class="info"> +Split the name in preparation for newAlphaName. +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALdocArray">docArray</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Formats an array. +</div> +</td></tr> +<tr><td><a href="Clist.html#VALdocCList">docCList</a> [<a href="Clist.html">Clist</a>]</td> +<td><div class="info"> +A document for printing a clist (similar to <code class="code">docList</code>) +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALdocList">docList</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +An alternative function for printing a list. +</div> +</td></tr> +<tr><td><a href="Pretty.MakeMapPrinter.html#VALdocMap">docMap</a> [<a href="Pretty.MakeMapPrinter.html">Pretty.MakeMapPrinter</a>]</td> +<td><div class="info"> +Format a map, analogous to docList. +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALdocOpt">docOpt</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Prints an <code class="code">'a option</code> with <code class="code">None</code> or <code class="code">Some</code> +</div> +</td></tr> +<tr><td><a href="Pretty.MakeSetPrinter.html#VALdocSet">docSet</a> [<a href="Pretty.MakeSetPrinter.html">Pretty.MakeSetPrinter</a>]</td> +<td><div class="info"> +Format a set, analogous to docList. +</div> +</td></tr> +<tr><td><a href="Dominators.html#VALdominates">dominates</a> [<a href="Dominators.html">Dominators</a>]</td> +<td><div class="info"> +Check whether one statement dominates another. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALdoubleType">doubleType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +double +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALdprintf">dprintf</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +This function provides an alternative method for constructing + <code class="code">doc</code> objects. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALdropAttribute">dropAttribute</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Remove all attributes with the given name. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALdropAttributes">dropAttributes</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Remove all attributes with names appearing in the string list. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALdummyFile">dummyFile</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +A dummy file +</div> +</td></tr> +<tr><td><a href="Cil.html#VALdummyFunDec">dummyFunDec</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +A dummy function declaration handy when you need one as a placeholder. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALdummyInstr">dummyInstr</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +A instr to serve as a placeholder +</div> +</td></tr> +<tr><td><a href="Cil.html#VALdummyStmt">dummyStmt</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +A statement consisting of just <code class="code">dummyInstr</code> +</div> +</td></tr> +<tr><td><a href="Cil.html#VALdumpBlock">dumpBlock</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Dump a block to a file using a given indentation. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALdumpFile">dumpFile</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print an entire file. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALdumpGlobal">dumpGlobal</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Pretty-print a global. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALdumpInit">dumpInit</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Dump an initializer to a file using a given indentation. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALdumpStmt">dumpStmt</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Dump a statement to a file using a given indentation. +</div> +</td></tr> +<tr><td align="left"><br>E</td></tr> +<tr><td><a href="Clist.html#VALempty">empty</a> [<a href="Clist.html">Clist</a>]</td> +<td><div class="info"> +The empty clist +</div> +</td></tr> +<tr><td><a href="Cil.html#VALemptyFunction">emptyFunction</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Make an empty function +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALeprintf">eprintf</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Like <a href="Pretty.html#VALfprintf"><code class="code">Pretty.fprintf</code></a> applied to <code class="code">stderr</code> +</div> +</td></tr> +<tr><td><a href="Cil.html#VALerror">error</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Like <a href="Errormsg.html#VALerror"><code class="code">Errormsg.error</code></a> except that <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> is also printed +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALerror">error</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +Prints an error message of the form <code class="code">Error: ...</code>. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALerrorLoc">errorLoc</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Like <a href="Cil.html#VALerror"><code class="code">Cil.error</code></a> except that it explicitly takes a location argument, + instead of using the <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> +</div> +</td></tr> +<tr><td><a href="Cil.html#VALexistsType">existsType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Scans a type by applying the function on all elements. +</div> +</td></tr> +<tr><td align="left"><br>F</td></tr> +<tr><td><a href="Pretty.html#VALf_int32">f_int32</a> [<a href="Pretty.html">Pretty</a>]</td> +<td></td></tr> +<tr><td><a href="Pretty.html#VALf_int64">f_int64</a> [<a href="Pretty.html">Pretty</a>]</td> +<td></td></tr> +<tr><td><a href="Pretty.html#VALfastMode">fastMode</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +If set to <code class="code">true</code> then optional breaks are taken only when the document + has exceeded the given width. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALfilterAttributes">filterAttributes</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Retains attributes with the given name +</div> +</td></tr> +<tr><td><a href="Dataflow.BackwardsTransfer.html#VALfilterStmt">filterStmt</a> [<a href="Dataflow.BackwardsTransfer.html">Dataflow.BackwardsTransfer</a>]</td> +<td><div class="info"> +Whether to put this predecessor block in the worklist. +</div> +</td></tr> +<tr><td><a href="Dataflow.ForwardsTransfer.html#VALfilterStmt">filterStmt</a> [<a href="Dataflow.ForwardsTransfer.html">Dataflow.ForwardsTransfer</a>]</td> +<td><div class="info"> +Whether to put this statement in the worklist. +</div> +</td></tr> +<tr><td><a href="Dominators.html#VALfindNaturalLoops">findNaturalLoops</a> [<a href="Dominators.html">Dominators</a>]</td> +<td><div class="info"> +Compute the start of the natural loops. +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALfinishParsing">finishParsing</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td></td></tr> +<tr><td><a href="Pretty.html#VALflushOften">flushOften</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +If true the it flushes after every print +</div> +</td></tr> +<tr><td><a href="Cil.html#VALfoldGlobals">foldGlobals</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Fold over all globals, including the global initializer +</div> +</td></tr> +<tr><td><a href="Cil.html#VALfoldLeftCompound">foldLeftCompound</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Fold over the list of initializers in a Compound. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALfoldLeftCompoundAll">foldLeftCompoundAll</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Fold over the list of initializers in a Compound, like + <a href="Cil.html#VALfoldLeftCompound"><code class="code">Cil.foldLeftCompound</code></a> but in the case of an array it scans even missing + zero initializers at the end of the array +</div> +</td></tr> +<tr><td><a href="Clist.html#VALfold_left">fold_left</a> [<a href="Clist.html">Clist</a>]</td> +<td><div class="info"> +A version of fold_left that works on clists +</div> +</td></tr> +<tr><td><a href="Cil.html#VALforgcc">forgcc</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Return the string 's' if we're printing output for gcc, suppres + it if we're printing for CIL to parse back in. +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALfprint">fprint</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Format the document to the given width and emit it to the given channel +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALfprintf">fprintf</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Like <a href="Pretty.html#VALdprintf"><code class="code">Pretty.dprintf</code></a> followed by <a href="Pretty.html#VALfprint"><code class="code">Pretty.fprint</code></a> +</div> +</td></tr> +<tr><td><a href="Clist.html#VALfromList">fromList</a> [<a href="Clist.html">Clist</a>]</td> +<td><div class="info"> +Convert an ordinary list to a clist +</div> +</td></tr> +<tr><td align="left"><br>G</td></tr> +<tr><td><a href="Cil.html#VALgccBuiltins">gccBuiltins</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +A list of the GCC built-in functions. +</div> +</td></tr> +<tr><td><a href="Alpha.html#VALgetAlphaPrefix">getAlphaPrefix</a> [<a href="Alpha.html">Alpha</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALgetCompField">getCompField</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Return a named fieldinfo in compinfo, or raise Not_found +</div> +</td></tr> +<tr><td><a href="Cil.html#VALgetGlobInit">getGlobInit</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Get the global initializer and create one if it does not already exist. +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALgetHPosition">getHPosition</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +high-level position +</div> +</td></tr> +<tr><td><a href="Dominators.html#VALgetIdom">getIdom</a> [<a href="Dominators.html">Dominators</a>]</td> +<td><div class="info"> +This is like Inthash.find but gives an error if the information is + Not_found +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALgetLocation">getLocation</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALgetParenthLevel">getParenthLevel</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Parentheses level. +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALgetPosition">getPosition</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALget_globalLoc">get_globalLoc</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Return the location of a global, or locUnknown +</div> +</td></tr> +<tr><td><a href="Cil.html#VALget_instrLoc">get_instrLoc</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Return the location of an instruction +</div> +</td></tr> +<tr><td><a href="Cil.html#VALget_stmtLoc">get_stmtLoc</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Return the location of a statement, or locUnknown +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALgprintf">gprintf</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Like <a href="Pretty.html#VALdprintf"><code class="code">Pretty.dprintf</code></a> but more general. +</div> +</td></tr> +<tr><td align="left"><br>H</td></tr> +<tr><td><a href="Errormsg.html#VALhadErrors">hadErrors</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +This is set whenever one of the above error functions are called. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALhasAttribute">hasAttribute</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +True if the named attribute appears in the attribute list. +</div> +</td></tr> +<tr><td><a href="Stats.html#VALhas_performance_counters">has_performance_counters</a> [<a href="Stats.html">Stats</a>]</td> +<td><div class="info"> +Check if we have performance counters +</div> +</td></tr> +<tr><td align="left"><br>I</td></tr> +<tr><td><a href="Cil.html#VALincrem">increm</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Increment an expression. +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALindent">indent</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Indents the document. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALindexLevel">indexLevel</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALinitCIL">initCIL</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Call this function to perform some initialization. +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALinsert">insert</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +A function that is useful with the <code class="code">printf</code>-like interface +</div> +</td></tr> +<tr><td><a href="Cil.html#VALinsertImplicitCasts">insertImplicitCasts</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Do insert implicit casts (default true) +</div> +</td></tr> +<tr><td><a href="Cil.html#VALintPtrType">intPtrType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +int * +</div> +</td></tr> +<tr><td><a href="Cil.html#VALintType">intType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +int +</div> +</td></tr> +<tr><td><a href="Cil.html#VALinteger">integer</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Construct an integer of kind IInt. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALinvalidStmt">invalidStmt</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +An empty statement. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALisArithmeticType">isArithmeticType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +True if the argument is an arithmetic type (i.e. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALisArrayType">isArrayType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +True if the argument is an array type +</div> +</td></tr> +<tr><td><a href="Cil.html#VALisCompleteType">isCompleteType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Returns true if this is a complete type. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALisConstant">isConstant</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +True if the expression is a compile-time constant +</div> +</td></tr> +<tr><td><a href="Cil.html#VALisFunctionType">isFunctionType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +True if the argument is a function type +</div> +</td></tr> +<tr><td><a href="Cil.html#VALisInteger">isInteger</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +True if the given expression is a (possibly cast'ed) + character or an integer constant +</div> +</td></tr> +<tr><td><a href="Cil.html#VALisIntegralType">isIntegralType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +True if the argument is an integral type (i.e. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALisPointerType">isPointerType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +True if the argument is a pointer type +</div> +</td></tr> +<tr><td><a href="Cil.html#VALisSigned">isSigned</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Returns true if and only if the given integer type is signed. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALisVoidPtrType">isVoidPtrType</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALisVoidType">isVoidType</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALisZero">isZero</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +True if the given expression is a (possibly cast'ed) integer or character + constant with value zero +</div> +</td></tr> +<tr><td><a href="Clist.html#VALiter">iter</a> [<a href="Clist.html">Clist</a>]</td> +<td><div class="info"> +A version of iter that works on clists +</div> +</td></tr> +<tr><td><a href="Cil.html#VALiterGlobals">iterGlobals</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Iterate over all globals, including the global initializer +</div> +</td></tr> +<tr><td align="left"><br>K</td></tr> +<tr><td><a href="Cil.html#VALkinteger">kinteger</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Construct an integer of a given kind. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALkinteger64">kinteger64</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Construct an integer of a given kind, using OCaml's int64 type. +</div> +</td></tr> +<tr><td align="left"><br>L</td></tr> +<tr><td><a href="Stats.html#VALlastTime">lastTime</a> [<a href="Stats.html">Stats</a>]</td> +<td><div class="info"> +Time a function and set lastTime to the time it took +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALleftflush">leftflush</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Use after a <a href="Pretty.html#VALline"><code class="code">Pretty.line</code></a> to prevent the indentation. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALlenOfArray">lenOfArray</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Call to compute the array length as present in the array type, to an + integer. +</div> +</td></tr> +<tr><td><a href="Clist.html#VALlength">length</a> [<a href="Clist.html">Clist</a>]</td> +<td><div class="info"> +Find the length of a clist +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALline">line</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +A document that consists of a mandatory newline. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALlineDirectiveStyle">lineDirectiveStyle</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +How to print line directives +</div> +</td></tr> +<tr><td><a href="Cil.html#VALlineLength">lineLength</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +The length used when wrapping output lines. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALlittle_endian">little_endian</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Whether the machine is little endian. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALloadBinaryFile">loadBinaryFile</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Read a <a href="Cil.html#TYPEfile"><code class="code">Cil.file</code></a> in binary form from the filesystem. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALlocUnknown">locUnknown</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Represents a location that cannot be determined +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALlocUnknown">locUnknown</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +An unknown location for use when you need one but you don't have one +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALlog">log</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +Print something to <code class="code">logChannel</code> +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALlogChannel">logChannel</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +A channel for printing log messages +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALlogg">logg</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +same as <a href="Errormsg.html#VALlog"><code class="code">Errormsg.log</code></a> but do not wrap lines +</div> +</td></tr> +<tr><td><a href="Cil.html#VALlongType">longType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +long +</div> +</td></tr> +<tr><td><a href="Cil.html#VALlowerConstants">lowerConstants</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Do lower constants (default true) +</div> +</td></tr> +<tr><td><a href="Cillower.html#VALlowerEnumVisitor">lowerEnumVisitor</a> [<a href="Cillower.html">Cillower</a>]</td> +<td><div class="info"> +Replace enumeration constants with integer constants +</div> +</td></tr> +<tr><td align="left"><br>M</td></tr> +<tr><td><a href="Cil.html#VALmakeFormalVar">makeFormalVar</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Make a formal variable for a function. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmakeGlobalVar">makeGlobalVar</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Make a global variable. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmakeLocalVar">makeLocalVar</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Make a local variable and add it to a function's slocals (only if insert = + true, which is the default). +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmakeTempVar">makeTempVar</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Make a temporary variable and add it to a function's slocals. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmakeVarinfo">makeVarinfo</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Make a varinfo. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmakeZeroInit">makeZeroInit</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Make a initializer for zero-ing a data type +</div> +</td></tr> +<tr><td><a href="Clist.html#VALmap">map</a> [<a href="Clist.html">Clist</a>]</td> +<td><div class="info"> +Map a function over a clist. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmapGlobals">mapGlobals</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Map over all globals, including the global initializer and change things + in place +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmapNoCopy">mapNoCopy</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Like map but try not to make a copy of the list +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmapNoCopyList">mapNoCopyList</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Like map but each call can return a list. +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALmark">mark</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Mark the beginning of a markup section. +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALmarkup">markup</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Prints a document as markup. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmissingFieldName">missingFieldName</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +This is a constant used as the name of an unnamed bitfield. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmkAddrOf">mkAddrOf</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Make an AddrOf. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmkAddrOrStartOf">mkAddrOrStartOf</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Like mkAddrOf except if the type of lval is an array then it uses + StartOf. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmkBlock">mkBlock</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Construct a block with no attributes, given a list of statements +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmkCast">mkCast</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Like <a href="Cil.html#VALmkCastT"><code class="code">Cil.mkCastT</code></a> but uses typeOf to get <code class="code">oldt</code> +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmkCastT">mkCastT</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Construct a cast when having the old type of the expression. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmkCompInfo">mkCompInfo</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Creates a a (potentially recursive) composite type. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmkEmptyStmt">mkEmptyStmt</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Returns an empty statement (of kind <code class="code">Instr</code>) +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmkFor">mkFor</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Make a for loop for(start; guard; next) { ... +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmkForIncr">mkForIncr</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Make a for loop for(i=start; i<past; i += incr) { ... +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmkMem">mkMem</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Make a Mem, while optimizing AddrOf. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmkStmt">mkStmt</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Construct a statement, given its kind. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmkStmtOneInstr">mkStmtOneInstr</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Construct a statement consisting of just one instruction +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmkString">mkString</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Make an expression that is a string constant (of pointer type) +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmkWhile">mkWhile</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Make a while loop. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmone">mone</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +-1 +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmsvcBuiltins">msvcBuiltins</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +A list of the MSVC built-in functions. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALmsvcMode">msvcMode</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Whether the pretty printer should print output for the MS VC compiler. +</div> +</td></tr> +<tr><td align="left"><br>N</td></tr> +<tr><td><a href="Dataflow.BackwardsTransfer.html#VALname">name</a> [<a href="Dataflow.BackwardsTransfer.html">Dataflow.BackwardsTransfer</a>]</td> +<td><div class="info"> +For debugging purposes, the name of the analysis +</div> +</td></tr> +<tr><td><a href="Dataflow.ForwardsTransfer.html#VALname">name</a> [<a href="Dataflow.ForwardsTransfer.html">Dataflow.ForwardsTransfer</a>]</td> +<td><div class="info"> +For debugging purposes, the name of the analysis +</div> +</td></tr> +<tr><td><a href="Alpha.html#VALnewAlphaName">newAlphaName</a> [<a href="Alpha.html">Alpha</a>]</td> +<td><div class="info"> +Create a new name based on a given name. +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALnewHline">newHline</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALnewVID">newVID</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Generate a new variable ID. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALnew_sid">new_sid</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Errormsg.html#VALnewline">newline</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td></td></tr> +<tr><td><a href="Pretty.html#VALnil">nil</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Constructs an empty document +</div> +</td></tr> +<tr><td><a href="Formatcil.html#VALnoMemoize">noMemoize</a> [<a href="Formatcil.html">Formatcil</a>]</td> +<td><div class="info"> +If set then will not memoize the parsed patterns +</div> +</td></tr> +<tr><td><a href="Cfg.html#VALnodeList">nodeList</a> [<a href="Cfg.html">Cfg</a>]</td> +<td><div class="info"> +All of the nodes in a file. +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALnull">null</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +Do not actually print (i.e. +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALnum">num</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +A document that prints an integer in decimal form +</div> +</td></tr> +<tr><td><a href="Cfg.html#VALnumNodes">numNodes</a> [<a href="Cfg.html">Cfg</a>]</td> +<td><div class="info"> +number of nodes in the CFG +</div> +</td></tr> +<tr><td align="left"><br>O</td></tr> +<tr><td><a href="Cil.html#VALone">one</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +1 +</div> +</td></tr> +<tr><td align="left"><br>P</td></tr> +<tr><td><a href="Cil.html#VALparseInt">parseInt</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Convert a string representing a C integer literal to an expression. +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALparse_error">parse_error</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALpartitionAttributes">partitionAttributes</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Partition the attributes into classes:name attributes, function type, + and type attributes +</div> +</td></tr> +<tr><td><a href="Cil.html#VALpeepHole1">peepHole1</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Similar to <code class="code">peepHole2</code> except that the optimization window consists of + one statement, not two +</div> +</td></tr> +<tr><td><a href="Cil.html#VALpeepHole2">peepHole2</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +A peephole optimizer that processes two adjacent statements and possibly + replaces them both. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALplainCilPrinter">plainCilPrinter</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Errormsg.html#VALpopContext">popContext</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +Removes the last registered context printing function +</div> +</td></tr> +<tr><td><a href="Cil.html#VALprepareCFG">prepareCFG</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Prepare a function for CFG information computation by + <a href="Cil.html#VALcomputeCFGInfo"><code class="code">Cil.computeCFGInfo</code></a>. +</div> +</td></tr> +<tr><td><a href="Dataflow.BackwardsTransfer.html#VALpretty">pretty</a> [<a href="Dataflow.BackwardsTransfer.html">Dataflow.BackwardsTransfer</a>]</td> +<td><div class="info"> +Pretty-print the state +</div> +</td></tr> +<tr><td><a href="Dataflow.ForwardsTransfer.html#VALpretty">pretty</a> [<a href="Dataflow.ForwardsTransfer.html">Dataflow.ForwardsTransfer</a>]</td> +<td><div class="info"> +Pretty-print the state +</div> +</td></tr> +<tr><td><a href="Stats.html#VALprint">print</a> [<a href="Stats.html">Stats</a>]</td> +<td><div class="info"> +Print the current stats preceeded by a message +</div> +</td></tr> +<tr><td><a href="Cil.html#VALprintAttr">printAttr</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Print an attribute given a pretty printer +</div> +</td></tr> +<tr><td><a href="Cil.html#VALprintAttrs">printAttrs</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Print a set of attributes given a pretty printer +</div> +</td></tr> +<tr><td><a href="Cil.html#VALprintBlock">printBlock</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Print a block given a pretty printer. +</div> +</td></tr> +<tr><td><a href="Cfg.html#VALprintCfgChannel">printCfgChannel</a> [<a href="Cfg.html">Cfg</a>]</td> +<td><div class="info"> +print control flow graph (in dot form) for fundec to channel +</div> +</td></tr> +<tr><td><a href="Cfg.html#VALprintCfgFilename">printCfgFilename</a> [<a href="Cfg.html">Cfg</a>]</td> +<td><div class="info"> +Print control flow graph (in dot form) for fundec to file +</div> +</td></tr> +<tr><td><a href="Cil.html#VALprintCilAsIs">printCilAsIs</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Whether to print the CIL as they are, without trying to be smart and + print nicer code. +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALprintDepth">printDepth</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Specifies the nesting depth of the <code class="code">align</code>/<code class="code">unalign</code> pairs at which + everything is replaced with ellipsis +</div> +</td></tr> +<tr><td><a href="Cil.html#VALprintExp">printExp</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Print an expression given a pretty printer +</div> +</td></tr> +<tr><td><a href="Cil.html#VALprintGlobal">printGlobal</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Print a global given a pretty printer +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALprintIndent">printIndent</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +If false then does not indent +</div> +</td></tr> +<tr><td><a href="Cil.html#VALprintInit">printInit</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Print an initializer given a pretty printer. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALprintInstr">printInstr</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Print an instruction given a pretty printer +</div> +</td></tr> +<tr><td><a href="Cil.html#VALprintLval">printLval</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Print an lvalue given a pretty printer +</div> +</td></tr> +<tr><td><a href="Cil.html#VALprintStmt">printStmt</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Print a statement given a pretty printer. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALprintType">printType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Print a type given a pretty printer +</div> +</td></tr> +<tr><td><a href="Cil.html#VALprint_CIL_Input">print_CIL_Input</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Whether we print something that will only be used as input to our own + parser. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALprinterForMaincil">printerForMaincil</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Pretty.html#VALprintf">printf</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Like <a href="Pretty.html#VALfprintf"><code class="code">Pretty.fprintf</code></a> applied to <code class="code">stdout</code> +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALpushContext">pushContext</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +Registers a context printing function +</div> +</td></tr> +<tr><td><a href="Cil.html#VALpushGlobal">pushGlobal</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +CIL keeps the types at the beginning of the file and the variables at the + end of the file. +</div> +</td></tr> +<tr><td align="left"><br>R</td></tr> +<tr><td><a href="Errormsg.html#VALreadingFromStdin">readingFromStdin</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +Records whether the stdin is open for reading the goal * +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALreal">real</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +A document that prints a real number +</div> +</td></tr> +<tr><td><a href="Alpha.html#VALregisterAlphaName">registerAlphaName</a> [<a href="Alpha.html">Alpha</a>]</td> +<td><div class="info"> +Register a name with an alpha conversion table to ensure that when later + we call newAlphaName we do not end up generating this one +</div> +</td></tr> +<tr><td><a href="Cil.html#VALremoveOffset">removeOffset</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Remove ONE offset from the end of an offset sequence. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALremoveOffsetLval">removeOffsetLval</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Remove ONE offset from the end of an lvalue. +</div> +</td></tr> +<tr><td><a href="Stats.html#VALrepeattime">repeattime</a> [<a href="Stats.html">Stats</a>]</td> +<td><div class="info"> +repeattime is like time but runs the function several times until the total + running time is greater or equal to the first argument. +</div> +</td></tr> +<tr><td><a href="Stats.html#VALreset">reset</a> [<a href="Stats.html">Stats</a>]</td> +<td><div class="info"> +Resets all the timings. +</div> +</td></tr> +<tr><td><a href="Clist.html#VALrev">rev</a> [<a href="Clist.html">Clist</a>]</td> +<td><div class="info"> +Reverse a clist. +</div> +</td></tr> +<tr><td align="left"><br>S</td></tr> +<tr><td><a href="Errormsg.html#VALs">s</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +Stop the execution by raising an Error. +</div> +</td></tr> +<tr><td><a href="Stats.html#VALsample_pentium_perfcount_10">sample_pentium_perfcount_10</a> [<a href="Stats.html">Stats</a>]</td> +<td><div class="info"> +Sample the current cycle count, in kilocycles. +</div> +</td></tr> +<tr><td><a href="Stats.html#VALsample_pentium_perfcount_20">sample_pentium_perfcount_20</a> [<a href="Stats.html">Stats</a>]</td> +<td><div class="info"> +Sample the current cycle count, in megacycles. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALsaveBinaryFile">saveBinaryFile</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Write a <a href="Cil.html#TYPEfile"><code class="code">Cil.file</code></a> in binary form to the filesystem. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALsaveBinaryFileChannel">saveBinaryFileChannel</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Write a <a href="Cil.html#TYPEfile"><code class="code">Cil.file</code></a> in binary form to the filesystem. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALseparateStorageModifiers">separateStorageModifiers</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Separate out the storage-modifier name attributes +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALseq">seq</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Formats a sequence. +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALsetCurrentFile">setCurrentFile</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td></td></tr> +<tr><td><a href="Errormsg.html#VALsetCurrentLine">setCurrentLine</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALsetFormals">setFormals</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Update the formals of a <code class="code">fundec</code> and make sure that the function type + has the same information. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALsetFunctionType">setFunctionType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Set the types of arguments and results as given by the function type + passed as the second argument. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALsetFunctionTypeMakeFormals">setFunctionTypeMakeFormals</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Set the type of the function and make formal arguments for them +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALsetHFile">setHFile</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td></td></tr> +<tr><td><a href="Errormsg.html#VALsetHLine">setHLine</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALsetMaxId">setMaxId</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Update the smaxid after you have populated with locals and formals + (unless you constructed those using <a href="Cil.html#VALmakeLocalVar"><code class="code">Cil.makeLocalVar</code></a> or + <a href="Cil.html#VALmakeTempVar"><code class="code">Cil.makeTempVar</code></a>. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALsetTypeAttrs">setTypeAttrs</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALsetTypeSigAttrs">setTypeSigAttrs</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Replace the attributes of a signature (only at top level) +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALshowContext">showContext</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +Show the context stack to stderr +</div> +</td></tr> +<tr><td><a href="Clist.html#VALsingle">single</a> [<a href="Clist.html">Clist</a>]</td> +<td><div class="info"> +Create a clist containing one element +</div> +</td></tr> +<tr><td><a href="Cil.html#VALsizeOf">sizeOf</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALsplitFunctionType">splitFunctionType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Given a function type split it into return type, + arguments, is_vararg and attributes. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALsplitFunctionTypeVI">splitFunctionTypeVI</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Pretty.html#VALsprint">sprint</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Format the document to the given width and emit it as a string +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALstartParsing">startParsing</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td></td></tr> +<tr><td><a href="Errormsg.html#VALstartParsingFromString">startParsingFromString</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td></td></tr> +<tr><td><a href="Cfg.html#VALstart_id">start_id</a> [<a href="Cfg.html">Cfg</a>]</td> +<td><div class="info"> +Next statement id that will be assigned. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALstartsWith">startsWith</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +sm: return true if the first is a prefix of the second string +</div> +</td></tr> +<tr><td><a href="Dataflow.BackwardsTransfer.html#VALstmtStartData">stmtStartData</a> [<a href="Dataflow.BackwardsTransfer.html">Dataflow.BackwardsTransfer</a>]</td> +<td><div class="info"> +For each block id, the data at the start. +</div> +</td></tr> +<tr><td><a href="Dataflow.ForwardsTransfer.html#VALstmtStartData">stmtStartData</a> [<a href="Dataflow.ForwardsTransfer.html">Dataflow.ForwardsTransfer</a>]</td> +<td><div class="info"> +For each statement id, the data at the start. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALstripCasts">stripCasts</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Removes casts from this expression, but ignores casts within + other expression constructs. +</div> +</td></tr> +<tr><td align="left"><br>T</td></tr> +<tr><td><a href="Formatcil.html#VALtest">test</a> [<a href="Formatcil.html">Formatcil</a>]</td> +<td><div class="info"> +Just a testing function +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALtext">text</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +A document that prints the given string +</div> +</td></tr> +<tr><td><a href="Stats.html#VALtime">time</a> [<a href="Stats.html">Stats</a>]</td> +<td><div class="info"> +Time a function and associate the time with the given string. +</div> +</td></tr> +<tr><td><a href="Stats.html#VALtimethis">timethis</a> [<a href="Stats.html">Stats</a>]</td> +<td></td></tr> +<tr><td><a href="Clist.html#VALtoList">toList</a> [<a href="Clist.html">Clist</a>]</td> +<td><div class="info"> +Convert a clist to an ordinary list +</div> +</td></tr> +<tr><td><a href="Cil.html#VALtypeAddAttributes">typeAddAttributes</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Add some attributes to a type +</div> +</td></tr> +<tr><td><a href="Cil.html#VALtypeAttrs">typeAttrs</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Returns all the attributes contained in a type. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALtypeOf">typeOf</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Compute the type of an expression +</div> +</td></tr> +<tr><td><a href="Cil.html#VALtypeOfLval">typeOfLval</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Compute the type of an lvalue +</div> +</td></tr> +<tr><td><a href="Cil.html#VALtypeOfSizeOf">typeOfSizeOf</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALtypeOffset">typeOffset</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Compute the type of an offset from a base type +</div> +</td></tr> +<tr><td><a href="Cil.html#VALtypeRemoveAttributes">typeRemoveAttributes</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Remove all attributes with the given names from a type. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALtypeSig">typeSig</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Compute a type signature +</div> +</td></tr> +<tr><td><a href="Cil.html#VALtypeSigAttrs">typeSigAttrs</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Get the top-level attributes of a signature +</div> +</td></tr> +<tr><td><a href="Cil.html#VALtypeSigWithAttrs">typeSigWithAttrs</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Like <a href="Cil.html#VALtypeSig"><code class="code">Cil.typeSig</code></a> but customize the incorporation of attributes. +</div> +</td></tr> +<tr><td align="left"><br>U</td></tr> +<tr><td><a href="Cil.html#VALuintPtrType">uintPtrType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +unsigned int * +</div> +</td></tr> +<tr><td><a href="Cil.html#VALuintType">uintType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +unsigned int +</div> +</td></tr> +<tr><td><a href="Cil.html#VALulongType">ulongType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +unsigned long +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALunalign">unalign</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Reverts to the last saved indentation level. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALunderscore_name">underscore_name</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Whether the compiler generates assembly labels by prepending "_" to the + identifier. +</div> +</td></tr> +<tr><td><a href="Alpha.html#VALundoAlphaChanges">undoAlphaChanges</a> [<a href="Alpha.html">Alpha</a>]</td> +<td><div class="info"> +Undo the changes to a table +</div> +</td></tr> +<tr><td><a href="Cil.html#VALunimp">unimp</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Like <a href="Errormsg.html#VALunimp"><code class="code">Errormsg.unimp</code></a> except that <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a>is also printed +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALunimp">unimp</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +Similar to <code class="code">error</code> except that its output has the form <code class="code">Unimplemented: ...</code> +</div> +</td></tr> +<tr><td><a href="Cil.html#VALuniqueVarNames">uniqueVarNames</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Assign unique names to local variables. +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALunmark">unmark</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +The end of a markup section +</div> +</td></tr> +<tr><td><a href="Cil.html#VALunrollType">unrollType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Unroll a type until it exposes a non + <code class="code">TNamed</code>. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALunrollTypeDeep">unrollTypeDeep</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Unroll all the TNamed in a type (even under type constructors such as + <code class="code">TPtr</code>, <code class="code">TFun</code> or <code class="code">TArray</code>. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALupointType">upointType</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALuseLogicalOperators">useLogicalOperators</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Whether to use the logical operands LAnd and LOr. +</div> +</td></tr> +<tr><td align="left"><br>V</td></tr> +<tr><td><a href="Cil.html#VALvar">var</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Makes an lvalue out of a given variable +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALverboseFlag">verboseFlag</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALvisitCilAttributes">visitCilAttributes</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Visit a list of attributes +</div> +</td></tr> +<tr><td><a href="Cil.html#VALvisitCilBlock">visitCilBlock</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Visit a block +</div> +</td></tr> +<tr><td><a href="Cil.html#VALvisitCilExpr">visitCilExpr</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Cil.html#VALvisitCilFile">visitCilFile</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Visit a file. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALvisitCilFileSameGlobals">visitCilFileSameGlobals</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +A visitor for the whole file that does not change the globals (but maybe + changes things inside the globals). +</div> +</td></tr> +<tr><td><a href="Cil.html#VALvisitCilFunction">visitCilFunction</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Visit a function definition +</div> +</td></tr> +<tr><td><a href="Cil.html#VALvisitCilGlobal">visitCilGlobal</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Visit a global +</div> +</td></tr> +<tr><td><a href="Cil.html#VALvisitCilInit">visitCilInit</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Visit an initializer +</div> +</td></tr> +<tr><td><a href="Cil.html#VALvisitCilInitOffset">visitCilInitOffset</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Visit an initializer offset +</div> +</td></tr> +<tr><td><a href="Cil.html#VALvisitCilInstr">visitCilInstr</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Visit an instruction +</div> +</td></tr> +<tr><td><a href="Cil.html#VALvisitCilLval">visitCilLval</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Visit an lvalue +</div> +</td></tr> +<tr><td><a href="Cil.html#VALvisitCilOffset">visitCilOffset</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Visit an lvalue or recursive offset +</div> +</td></tr> +<tr><td><a href="Cil.html#VALvisitCilStmt">visitCilStmt</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Visit a statement +</div> +</td></tr> +<tr><td><a href="Cil.html#VALvisitCilType">visitCilType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Visit a type +</div> +</td></tr> +<tr><td><a href="Cil.html#VALvisitCilVarDecl">visitCilVarDecl</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Visit a variable declaration +</div> +</td></tr> +<tr><td><a href="Cil.html#VALvoidPtrType">voidPtrType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +void * +</div> +</td></tr> +<tr><td><a href="Cil.html#VALvoidType">voidType</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +void +</div> +</td></tr> +<tr><td align="left"><br>W</td></tr> +<tr><td><a href="Cil.html#VALwarn">warn</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Like <a href="Errormsg.html#VALwarn"><code class="code">Errormsg.warn</code></a> except that <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> is also printed +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALwarn">warn</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +Like <a href="Errormsg.html#VALerror"><code class="code">Errormsg.error</code></a> but does not raise the <a href="Errormsg.html#EXCEPTIONError"><code class="code">Errormsg.Error</code></a> + exception. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALwarnContext">warnContext</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Like <a href="Errormsg.html#VALwarn"><code class="code">Errormsg.warn</code></a> except that <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> and context + is also printed +</div> +</td></tr> +<tr><td><a href="Cil.html#VALwarnContextOpt">warnContextOpt</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Like <a href="Errormsg.html#VALwarn"><code class="code">Errormsg.warn</code></a> except that <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> and context is also + printed. +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALwarnFlag">warnFlag</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +Set to true if you want to see all warnings. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALwarnLoc">warnLoc</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Like <a href="Cil.html#VALwarn"><code class="code">Cil.warn</code></a> except that it explicitly takes a location argument, + instead of using the <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> +</div> +</td></tr> +<tr><td><a href="Cil.html#VALwarnOpt">warnOpt</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +Like <a href="Errormsg.html#VALwarnOpt"><code class="code">Errormsg.warnOpt</code></a> except that <a href="Cil.html#VALcurrentLoc"><code class="code">Cil.currentLoc</code></a> is also printed. +</div> +</td></tr> +<tr><td><a href="Errormsg.html#VALwarnOpt">warnOpt</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +Like <a href="Errormsg.html#VALwarn"><code class="code">Errormsg.warn</code></a> but optional. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALwcharKind">wcharKind</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +wchar_t (depends on architecture) and is set when you call + <a href="Cil.html#VALinitCIL"><code class="code">Cil.initCIL</code></a>. +</div> +</td></tr> +<tr><td><a href="Cil.html#VALwcharType">wcharType</a> [<a href="Cil.html">Cil</a>]</td> +<td></td></tr> +<tr><td><a href="Errormsg.html#VALwithContext">withContext</a> [<a href="Errormsg.html">Errormsg</a>]</td> +<td><div class="info"> +To ensure that the context is registered and removed properly, use the + function below +</div> +</td></tr> +<tr><td><a href="Pretty.html#VALwithPrintDepth">withPrintDepth</a> [<a href="Pretty.html">Pretty</a>]</td> +<td><div class="info"> +Invokes a thunk, with printDepth temporarily set to the specified value +</div> +</td></tr> +<tr><td align="left"><br>Z</td></tr> +<tr><td><a href="Cil.html#VALzero">zero</a> [<a href="Cil.html">Cil</a>]</td> +<td><div class="info"> +0 +</div> +</td></tr> +</table><br> +</body> +</html>
\ No newline at end of file diff --git a/cil/doc/api/style.css b/cil/doc/api/style.css new file mode 100644 index 0000000..11ed40c --- /dev/null +++ b/cil/doc/api/style.css @@ -0,0 +1,32 @@ +a:visited {color : #416DFF; text-decoration : none; } +a:link {color : #416DFF; text-decoration : none;} +a:hover {color : Red; text-decoration : none; background-color: #5FFF88} +a:active {color : Red; text-decoration : underline; } +.keyword { font-weight : bold ; color : Red } +.keywordsign { color : #C04600 } +.superscript { font-size : 4 } +.subscript { font-size : 4 } +.comment { color : Green } +.constructor { color : Blue } +.type { color : #5C6585 } +.string { color : Maroon } +.warning { color : Red ; font-weight : bold } +.info { margin-left : 3em; margin-right : 3em } +.code { color : #465F91 ; } +h1 { font-size : 20pt ; text-align: center; } +h2 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #90BDFF ;padding: 2px; } +h3 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #90DDFF ;padding: 2px; } +h4 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #90EDFF ;padding: 2px; } +h5 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #90FDFF ;padding: 2px; } +h6 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #C0FFFF ; padding: 2px; } +div.h7 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #E0FFFF ; padding: 2px; } +div.h8 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #F0FFFF ; padding: 2px; } +div.h9 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #FFFFFF ; padding: 2px; } +.typetable { border-style : hidden } +.indextable { border-style : hidden } +.paramstable { border-style : hidden ; padding: 5pt 5pt} +body { background-color : White } +tr { background-color : White } +td.typefieldcomment { background-color : #FFFFFF } +pre { margin-bottom: 4px } +div.sig_block {margin-left: 2em}
\ No newline at end of file diff --git a/cil/doc/api/type_Alpha.html b/cil/doc/api/type_Alpha.html new file mode 100644 index 0000000..b97c835 --- /dev/null +++ b/cil/doc/api/type_Alpha.html @@ -0,0 +1,43 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Alpha</title> +</head> +<body> +<code class="code"><span class="keyword">sig</span><br> + <span class="keyword">type</span> <span class="keywordsign">'</span>a undoAlphaElement<br> + <span class="keyword">type</span> <span class="keywordsign">'</span>a alphaTableData<br> + <span class="keyword">val</span> newAlphaName :<br> + alphaTable:(string, <span class="keywordsign">'</span>a <span class="constructor">Alpha</span>.alphaTableData <span class="constructor">Pervasives</span>.ref) <span class="constructor">Hashtbl</span>.t <span class="keywordsign">-></span><br> + undolist:<span class="keywordsign">'</span>a <span class="constructor">Alpha</span>.undoAlphaElement list <span class="constructor">Pervasives</span>.ref option <span class="keywordsign">-></span><br> + lookupname:string <span class="keywordsign">-></span> data:<span class="keywordsign">'</span>a <span class="keywordsign">-></span> string * <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> registerAlphaName :<br> + alphaTable:(string, <span class="keywordsign">'</span>a <span class="constructor">Alpha</span>.alphaTableData <span class="constructor">Pervasives</span>.ref) <span class="constructor">Hashtbl</span>.t <span class="keywordsign">-></span><br> + undolist:<span class="keywordsign">'</span>a <span class="constructor">Alpha</span>.undoAlphaElement list <span class="constructor">Pervasives</span>.ref option <span class="keywordsign">-></span><br> + lookupname:string <span class="keywordsign">-></span> data:<span class="keywordsign">'</span>a <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> docAlphaTable :<br> + unit <span class="keywordsign">-></span><br> + (string, <span class="keywordsign">'</span>a <span class="constructor">Alpha</span>.alphaTableData <span class="constructor">Pervasives</span>.ref) <span class="constructor">Hashtbl</span>.t <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> getAlphaPrefix : lookupname:string <span class="keywordsign">-></span> string<br> + <span class="keyword">val</span> undoAlphaChanges :<br> + alphaTable:(string, <span class="keywordsign">'</span>a <span class="constructor">Alpha</span>.alphaTableData <span class="constructor">Pervasives</span>.ref) <span class="constructor">Hashtbl</span>.t <span class="keywordsign">-></span><br> + undolist:<span class="keywordsign">'</span>a <span class="constructor">Alpha</span>.undoAlphaElement list <span class="keywordsign">-></span> unit<br> +<span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Cfg.html b/cil/doc/api/type_Cfg.html new file mode 100644 index 0000000..996d773 --- /dev/null +++ b/cil/doc/api/type_Cfg.html @@ -0,0 +1,35 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Cfg</title> +</head> +<body> +<code class="code"><span class="keyword">sig</span><br> + <span class="keyword">val</span> computeFileCFG : <span class="constructor">Cil</span>.file <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> clearFileCFG : <span class="constructor">Cil</span>.file <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> cfgFun : <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> int<br> + <span class="keyword">val</span> clearCFGinfo : <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> printCfgChannel : <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> printCfgFilename : string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> start_id : int <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> nodeList : <span class="constructor">Cil</span>.stmt list <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> numNodes : int <span class="constructor">Pervasives</span>.ref<br> +<span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Cil.cilPrinter.html b/cil/doc/api/type_Cil.cilPrinter.html new file mode 100644 index 0000000..ff117f5 --- /dev/null +++ b/cil/doc/api/type_Cil.cilPrinter.html @@ -0,0 +1,48 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Cil.cilPrinter</title> +</head> +<body> +<code class="code"><span class="keyword">object</span><br> + <span class="keyword">method</span> dBlock : <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> int <span class="keywordsign">-></span> <span class="constructor">Cil</span>.block <span class="keywordsign">-></span> unit<br> + <span class="keyword">method</span> dGlobal : <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> <span class="constructor">Cil</span>.global <span class="keywordsign">-></span> unit<br> + <span class="keyword">method</span> dInit : <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> int <span class="keywordsign">-></span> <span class="constructor">Cil</span>.init <span class="keywordsign">-></span> unit<br> + <span class="keyword">method</span> dStmt : <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> int <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> unit<br> + <span class="keyword">method</span> pAttr : <span class="constructor">Cil</span>.attribute <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc * bool<br> + <span class="keyword">method</span> pAttrParam : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attrparam <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pAttrs : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pBlock : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.block <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pExp : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pFieldDecl : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.fieldinfo <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pGlobal : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.global <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pInit : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.init <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pInstr : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.instr <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pLabel : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.label <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pLineDirective : ?forcefile:bool <span class="keywordsign">-></span> <span class="constructor">Cil</span>.location <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pLval : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.lval <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pOffset : <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> <span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pStmt : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pStmtKind : <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmtkind <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pType : <span class="constructor">Pretty</span>.doc option <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pVDecl : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.varinfo <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pVar : <span class="constructor">Cil</span>.varinfo <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> +<span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Cil.cilVisitor.html b/cil/doc/api/type_Cil.cilVisitor.html new file mode 100644 index 0000000..efe3d13 --- /dev/null +++ b/cil/doc/api/type_Cil.cilVisitor.html @@ -0,0 +1,43 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Cil.cilVisitor</title> +</head> +<body> +<code class="code"><span class="keyword">object</span><br> + <span class="keyword">method</span> queueInstr : <span class="constructor">Cil</span>.instr list <span class="keywordsign">-></span> unit<br> + <span class="keyword">method</span> unqueueInstr : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.instr list<br> + <span class="keyword">method</span> vattr : <span class="constructor">Cil</span>.attribute <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attribute list <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vattrparam : <span class="constructor">Cil</span>.attrparam <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attrparam <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vblock : <span class="constructor">Cil</span>.block <span class="keywordsign">-></span> <span class="constructor">Cil</span>.block <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vexpr : <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vfunc : <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> <span class="constructor">Cil</span>.fundec <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vglob : <span class="constructor">Cil</span>.global <span class="keywordsign">-></span> <span class="constructor">Cil</span>.global list <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vinit : <span class="constructor">Cil</span>.init <span class="keywordsign">-></span> <span class="constructor">Cil</span>.init <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vinitoffs : <span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> <span class="constructor">Cil</span>.offset <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vinst : <span class="constructor">Cil</span>.instr <span class="keywordsign">-></span> <span class="constructor">Cil</span>.instr list <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vlval : <span class="constructor">Cil</span>.lval <span class="keywordsign">-></span> <span class="constructor">Cil</span>.lval <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> voffs : <span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> <span class="constructor">Cil</span>.offset <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vstmt : <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vtype : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vvdec : <span class="constructor">Cil</span>.varinfo <span class="keywordsign">-></span> <span class="constructor">Cil</span>.varinfo <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vvrbl : <span class="constructor">Cil</span>.varinfo <span class="keywordsign">-></span> <span class="constructor">Cil</span>.varinfo <span class="constructor">Cil</span>.visitAction<br> +<span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Cil.defaultCilPrinterClass.html b/cil/doc/api/type_Cil.defaultCilPrinterClass.html new file mode 100644 index 0000000..75a36eb --- /dev/null +++ b/cil/doc/api/type_Cil.defaultCilPrinterClass.html @@ -0,0 +1,25 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Cil.defaultCilPrinterClass</title> +</head> +<body> +<code class="code"><span class="constructor">Cil</span>.cilPrinter</code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Cil.html b/cil/doc/api/type_Cil.html new file mode 100644 index 0000000..da6f9e9 --- /dev/null +++ b/cil/doc/api/type_Cil.html @@ -0,0 +1,622 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Cil</title> +</head> +<body> +<code class="code"><span class="keyword">sig</span><br> + <span class="keyword">val</span> initCIL : unit <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> cilVersion : string<br> + <span class="keyword">val</span> cilVersionMajor : int<br> + <span class="keyword">val</span> cilVersionMinor : int<br> + <span class="keyword">val</span> cilVersionRevision : int<br> + <span class="keyword">type</span> file = {<br> + <span class="keyword">mutable</span> fileName : string;<br> + <span class="keyword">mutable</span> globals : <span class="constructor">Cil</span>.global list;<br> + <span class="keyword">mutable</span> globinit : <span class="constructor">Cil</span>.fundec option;<br> + <span class="keyword">mutable</span> globinitcalled : bool;<br> + }<br> + <span class="keyword">and</span> comment = <span class="constructor">Cil</span>.location * string<br> + <span class="keyword">and</span> global =<br> + <span class="constructor">GType</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typeinfo * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">GCompTag</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.compinfo * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">GCompTagDecl</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.compinfo * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">GEnumTag</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.enuminfo * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">GEnumTagDecl</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.enuminfo * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">GVarDecl</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.varinfo * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">GVar</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.varinfo * <span class="constructor">Cil</span>.initinfo * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">GFun</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.fundec * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">GAsm</span> <span class="keyword">of</span> string * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">GPragma</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.attribute * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">GText</span> <span class="keyword">of</span> string<br> + <span class="keyword">and</span> typ =<br> + <span class="constructor">TVoid</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.attributes<br> + <span class="keywordsign">|</span> <span class="constructor">TInt</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.ikind * <span class="constructor">Cil</span>.attributes<br> + <span class="keywordsign">|</span> <span class="constructor">TFloat</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.fkind * <span class="constructor">Cil</span>.attributes<br> + <span class="keywordsign">|</span> <span class="constructor">TPtr</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typ * <span class="constructor">Cil</span>.attributes<br> + <span class="keywordsign">|</span> <span class="constructor">TArray</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typ * <span class="constructor">Cil</span>.exp option * <span class="constructor">Cil</span>.attributes<br> + <span class="keywordsign">|</span> <span class="constructor">TFun</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typ * (string * <span class="constructor">Cil</span>.typ * <span class="constructor">Cil</span>.attributes) list option *<br> + bool * <span class="constructor">Cil</span>.attributes<br> + <span class="keywordsign">|</span> <span class="constructor">TNamed</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typeinfo * <span class="constructor">Cil</span>.attributes<br> + <span class="keywordsign">|</span> <span class="constructor">TComp</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.compinfo * <span class="constructor">Cil</span>.attributes<br> + <span class="keywordsign">|</span> <span class="constructor">TEnum</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.enuminfo * <span class="constructor">Cil</span>.attributes<br> + <span class="keywordsign">|</span> <span class="constructor">TBuiltin_va_list</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.attributes<br> + <span class="keyword">and</span> ikind =<br> + <span class="constructor">IChar</span><br> + <span class="keywordsign">|</span> <span class="constructor">ISChar</span><br> + <span class="keywordsign">|</span> <span class="constructor">IUChar</span><br> + <span class="keywordsign">|</span> <span class="constructor">IInt</span><br> + <span class="keywordsign">|</span> <span class="constructor">IUInt</span><br> + <span class="keywordsign">|</span> <span class="constructor">IShort</span><br> + <span class="keywordsign">|</span> <span class="constructor">IUShort</span><br> + <span class="keywordsign">|</span> <span class="constructor">ILong</span><br> + <span class="keywordsign">|</span> <span class="constructor">IULong</span><br> + <span class="keywordsign">|</span> <span class="constructor">ILongLong</span><br> + <span class="keywordsign">|</span> <span class="constructor">IULongLong</span><br> + <span class="keyword">and</span> fkind = <span class="constructor">FFloat</span> <span class="keywordsign">|</span> <span class="constructor">FDouble</span> <span class="keywordsign">|</span> <span class="constructor">FLongDouble</span><br> + <span class="keyword">and</span> attribute = <span class="constructor">Attr</span> <span class="keyword">of</span> string * <span class="constructor">Cil</span>.attrparam list<br> + <span class="keyword">and</span> attributes = <span class="constructor">Cil</span>.attribute list<br> + <span class="keyword">and</span> attrparam =<br> + <span class="constructor">AInt</span> <span class="keyword">of</span> int<br> + <span class="keywordsign">|</span> <span class="constructor">AStr</span> <span class="keyword">of</span> string<br> + <span class="keywordsign">|</span> <span class="constructor">ACons</span> <span class="keyword">of</span> string * <span class="constructor">Cil</span>.attrparam list<br> + <span class="keywordsign">|</span> <span class="constructor">ASizeOf</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typ<br> + <span class="keywordsign">|</span> <span class="constructor">ASizeOfE</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.attrparam<br> + <span class="keywordsign">|</span> <span class="constructor">ASizeOfS</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typsig<br> + <span class="keywordsign">|</span> <span class="constructor">AAlignOf</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typ<br> + <span class="keywordsign">|</span> <span class="constructor">AAlignOfE</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.attrparam<br> + <span class="keywordsign">|</span> <span class="constructor">AAlignOfS</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typsig<br> + <span class="keywordsign">|</span> <span class="constructor">AUnOp</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.unop * <span class="constructor">Cil</span>.attrparam<br> + <span class="keywordsign">|</span> <span class="constructor">ABinOp</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.binop * <span class="constructor">Cil</span>.attrparam * <span class="constructor">Cil</span>.attrparam<br> + <span class="keywordsign">|</span> <span class="constructor">ADot</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.attrparam * string<br> + <span class="keyword">and</span> compinfo = {<br> + <span class="keyword">mutable</span> cstruct : bool;<br> + <span class="keyword">mutable</span> cname : string;<br> + <span class="keyword">mutable</span> ckey : int;<br> + <span class="keyword">mutable</span> cfields : <span class="constructor">Cil</span>.fieldinfo list;<br> + <span class="keyword">mutable</span> cattr : <span class="constructor">Cil</span>.attributes;<br> + <span class="keyword">mutable</span> cdefined : bool;<br> + <span class="keyword">mutable</span> creferenced : bool;<br> + }<br> + <span class="keyword">and</span> fieldinfo = {<br> + <span class="keyword">mutable</span> fcomp : <span class="constructor">Cil</span>.compinfo;<br> + <span class="keyword">mutable</span> fname : string;<br> + <span class="keyword">mutable</span> ftype : <span class="constructor">Cil</span>.typ;<br> + <span class="keyword">mutable</span> fbitfield : int option;<br> + <span class="keyword">mutable</span> fattr : <span class="constructor">Cil</span>.attributes;<br> + <span class="keyword">mutable</span> floc : <span class="constructor">Cil</span>.location;<br> + }<br> + <span class="keyword">and</span> enuminfo = {<br> + <span class="keyword">mutable</span> ename : string;<br> + <span class="keyword">mutable</span> eitems : (string * <span class="constructor">Cil</span>.exp * <span class="constructor">Cil</span>.location) list;<br> + <span class="keyword">mutable</span> eattr : <span class="constructor">Cil</span>.attributes;<br> + <span class="keyword">mutable</span> ereferenced : bool;<br> + }<br> + <span class="keyword">and</span> typeinfo = {<br> + <span class="keyword">mutable</span> tname : string;<br> + <span class="keyword">mutable</span> ttype : <span class="constructor">Cil</span>.typ;<br> + <span class="keyword">mutable</span> treferenced : bool;<br> + }<br> + <span class="keyword">and</span> varinfo = {<br> + <span class="keyword">mutable</span> vname : string;<br> + <span class="keyword">mutable</span> vtype : <span class="constructor">Cil</span>.typ;<br> + <span class="keyword">mutable</span> vattr : <span class="constructor">Cil</span>.attributes;<br> + <span class="keyword">mutable</span> vstorage : <span class="constructor">Cil</span>.storage;<br> + <span class="keyword">mutable</span> vglob : bool;<br> + <span class="keyword">mutable</span> vinline : bool;<br> + <span class="keyword">mutable</span> vdecl : <span class="constructor">Cil</span>.location;<br> + <span class="keyword">mutable</span> vid : int;<br> + <span class="keyword">mutable</span> vaddrof : bool;<br> + <span class="keyword">mutable</span> vreferenced : bool;<br> + }<br> + <span class="keyword">and</span> storage = <span class="constructor">NoStorage</span> <span class="keywordsign">|</span> <span class="constructor">Static</span> <span class="keywordsign">|</span> <span class="constructor">Register</span> <span class="keywordsign">|</span> <span class="constructor">Extern</span><br> + <span class="keyword">and</span> exp =<br> + <span class="constructor">Const</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.constant<br> + <span class="keywordsign">|</span> <span class="constructor">Lval</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.lval<br> + <span class="keywordsign">|</span> <span class="constructor">SizeOf</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typ<br> + <span class="keywordsign">|</span> <span class="constructor">SizeOfE</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.exp<br> + <span class="keywordsign">|</span> <span class="constructor">SizeOfStr</span> <span class="keyword">of</span> string<br> + <span class="keywordsign">|</span> <span class="constructor">AlignOf</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typ<br> + <span class="keywordsign">|</span> <span class="constructor">AlignOfE</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.exp<br> + <span class="keywordsign">|</span> <span class="constructor">UnOp</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.unop * <span class="constructor">Cil</span>.exp * <span class="constructor">Cil</span>.typ<br> + <span class="keywordsign">|</span> <span class="constructor">BinOp</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.binop * <span class="constructor">Cil</span>.exp * <span class="constructor">Cil</span>.exp * <span class="constructor">Cil</span>.typ<br> + <span class="keywordsign">|</span> <span class="constructor">CastE</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typ * <span class="constructor">Cil</span>.exp<br> + <span class="keywordsign">|</span> <span class="constructor">AddrOf</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.lval<br> + <span class="keywordsign">|</span> <span class="constructor">StartOf</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.lval<br> + <span class="keyword">and</span> constant =<br> + <span class="constructor">CInt64</span> <span class="keyword">of</span> int64 * <span class="constructor">Cil</span>.ikind * string option<br> + <span class="keywordsign">|</span> <span class="constructor">CStr</span> <span class="keyword">of</span> string<br> + <span class="keywordsign">|</span> <span class="constructor">CWStr</span> <span class="keyword">of</span> int64 list<br> + <span class="keywordsign">|</span> <span class="constructor">CChr</span> <span class="keyword">of</span> char<br> + <span class="keywordsign">|</span> <span class="constructor">CReal</span> <span class="keyword">of</span> float * <span class="constructor">Cil</span>.fkind * string option<br> + <span class="keywordsign">|</span> <span class="constructor">CEnum</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.exp * string * <span class="constructor">Cil</span>.enuminfo<br> + <span class="keyword">and</span> unop = <span class="constructor">Neg</span> <span class="keywordsign">|</span> <span class="constructor">BNot</span> <span class="keywordsign">|</span> <span class="constructor">LNot</span><br> + <span class="keyword">and</span> binop =<br> + <span class="constructor">PlusA</span><br> + <span class="keywordsign">|</span> <span class="constructor">PlusPI</span><br> + <span class="keywordsign">|</span> <span class="constructor">IndexPI</span><br> + <span class="keywordsign">|</span> <span class="constructor">MinusA</span><br> + <span class="keywordsign">|</span> <span class="constructor">MinusPI</span><br> + <span class="keywordsign">|</span> <span class="constructor">MinusPP</span><br> + <span class="keywordsign">|</span> <span class="constructor">Mult</span><br> + <span class="keywordsign">|</span> <span class="constructor">Div</span><br> + <span class="keywordsign">|</span> <span class="constructor">Mod</span><br> + <span class="keywordsign">|</span> <span class="constructor">Shiftlt</span><br> + <span class="keywordsign">|</span> <span class="constructor">Shiftrt</span><br> + <span class="keywordsign">|</span> <span class="constructor">Lt</span><br> + <span class="keywordsign">|</span> <span class="constructor">Gt</span><br> + <span class="keywordsign">|</span> <span class="constructor">Le</span><br> + <span class="keywordsign">|</span> <span class="constructor">Ge</span><br> + <span class="keywordsign">|</span> <span class="constructor">Eq</span><br> + <span class="keywordsign">|</span> <span class="constructor">Ne</span><br> + <span class="keywordsign">|</span> <span class="constructor">BAnd</span><br> + <span class="keywordsign">|</span> <span class="constructor">BXor</span><br> + <span class="keywordsign">|</span> <span class="constructor">BOr</span><br> + <span class="keywordsign">|</span> <span class="constructor">LAnd</span><br> + <span class="keywordsign">|</span> <span class="constructor">LOr</span><br> + <span class="keyword">and</span> lval = <span class="constructor">Cil</span>.lhost * <span class="constructor">Cil</span>.offset<br> + <span class="keyword">and</span> lhost = <span class="constructor">Var</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.varinfo <span class="keywordsign">|</span> <span class="constructor">Mem</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">and</span> offset =<br> + <span class="constructor">NoOffset</span><br> + <span class="keywordsign">|</span> <span class="constructor">Field</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.fieldinfo * <span class="constructor">Cil</span>.offset<br> + <span class="keywordsign">|</span> <span class="constructor">Index</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.exp * <span class="constructor">Cil</span>.offset<br> + <span class="keyword">and</span> init =<br> + <span class="constructor">SingleInit</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.exp<br> + <span class="keywordsign">|</span> <span class="constructor">CompoundInit</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typ * (<span class="constructor">Cil</span>.offset * <span class="constructor">Cil</span>.init) list<br> + <span class="keyword">and</span> initinfo = { <span class="keyword">mutable</span> init : <span class="constructor">Cil</span>.init option; }<br> + <span class="keyword">and</span> fundec = {<br> + <span class="keyword">mutable</span> svar : <span class="constructor">Cil</span>.varinfo;<br> + <span class="keyword">mutable</span> sformals : <span class="constructor">Cil</span>.varinfo list;<br> + <span class="keyword">mutable</span> slocals : <span class="constructor">Cil</span>.varinfo list;<br> + <span class="keyword">mutable</span> smaxid : int;<br> + <span class="keyword">mutable</span> sbody : <span class="constructor">Cil</span>.block;<br> + <span class="keyword">mutable</span> smaxstmtid : int option;<br> + <span class="keyword">mutable</span> sallstmts : <span class="constructor">Cil</span>.stmt list;<br> + }<br> + <span class="keyword">and</span> block = {<br> + <span class="keyword">mutable</span> battrs : <span class="constructor">Cil</span>.attributes;<br> + <span class="keyword">mutable</span> bstmts : <span class="constructor">Cil</span>.stmt list;<br> + }<br> + <span class="keyword">and</span> stmt = {<br> + <span class="keyword">mutable</span> labels : <span class="constructor">Cil</span>.label list;<br> + <span class="keyword">mutable</span> skind : <span class="constructor">Cil</span>.stmtkind;<br> + <span class="keyword">mutable</span> sid : int;<br> + <span class="keyword">mutable</span> succs : <span class="constructor">Cil</span>.stmt list;<br> + <span class="keyword">mutable</span> preds : <span class="constructor">Cil</span>.stmt list;<br> + }<br> + <span class="keyword">and</span> label =<br> + <span class="constructor">Label</span> <span class="keyword">of</span> string * <span class="constructor">Cil</span>.location * bool<br> + <span class="keywordsign">|</span> <span class="constructor">Case</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.exp * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">Default</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.location<br> + <span class="keyword">and</span> stmtkind =<br> + <span class="constructor">Instr</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.instr list<br> + <span class="keywordsign">|</span> <span class="constructor">Return</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.exp option * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">Goto</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.stmt <span class="constructor">Pervasives</span>.ref * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">Break</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">Continue</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">If</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.exp * <span class="constructor">Cil</span>.block * <span class="constructor">Cil</span>.block * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">Switch</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.exp * <span class="constructor">Cil</span>.block * <span class="constructor">Cil</span>.stmt list * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">Loop</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.block * <span class="constructor">Cil</span>.location * <span class="constructor">Cil</span>.stmt option * <span class="constructor">Cil</span>.stmt option<br> + <span class="keywordsign">|</span> <span class="constructor">Block</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.block<br> + <span class="keywordsign">|</span> <span class="constructor">TryFinally</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.block * <span class="constructor">Cil</span>.block * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">TryExcept</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.block * (<span class="constructor">Cil</span>.instr list * <span class="constructor">Cil</span>.exp) * <span class="constructor">Cil</span>.block *<br> + <span class="constructor">Cil</span>.location<br> + <span class="keyword">and</span> instr =<br> + <span class="constructor">Set</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.lval * <span class="constructor">Cil</span>.exp * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">Call</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.lval option * <span class="constructor">Cil</span>.exp * <span class="constructor">Cil</span>.exp list * <span class="constructor">Cil</span>.location<br> + <span class="keywordsign">|</span> <span class="constructor">Asm</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.attributes * string list * (string * <span class="constructor">Cil</span>.lval) list *<br> + (string * <span class="constructor">Cil</span>.exp) list * string list * <span class="constructor">Cil</span>.location<br> + <span class="keyword">and</span> location = { line : int; file : string; byte : int; }<br> + <span class="keyword">and</span> typsig =<br> + <span class="constructor">TSArray</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typsig * int64 option * <span class="constructor">Cil</span>.attribute list<br> + <span class="keywordsign">|</span> <span class="constructor">TSPtr</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typsig * <span class="constructor">Cil</span>.attribute list<br> + <span class="keywordsign">|</span> <span class="constructor">TSComp</span> <span class="keyword">of</span> bool * string * <span class="constructor">Cil</span>.attribute list<br> + <span class="keywordsign">|</span> <span class="constructor">TSFun</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typsig * <span class="constructor">Cil</span>.typsig list * bool * <span class="constructor">Cil</span>.attribute list<br> + <span class="keywordsign">|</span> <span class="constructor">TSEnum</span> <span class="keyword">of</span> string * <span class="constructor">Cil</span>.attribute list<br> + <span class="keywordsign">|</span> <span class="constructor">TSBase</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> lowerConstants : bool ref<br> + <span class="keyword">val</span> insertImplicitCasts : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">type</span> featureDescr = {<br> + fd_enabled : bool <span class="constructor">Pervasives</span>.ref;<br> + fd_name : string;<br> + fd_description : string;<br> + fd_extraopt : (string * <span class="constructor">Arg</span>.spec * string) list;<br> + fd_doit : <span class="constructor">Cil</span>.file <span class="keywordsign">-></span> unit;<br> + fd_post_check : bool;<br> + }<br> + <span class="keyword">val</span> compareLoc : <span class="constructor">Cil</span>.location <span class="keywordsign">-></span> <span class="constructor">Cil</span>.location <span class="keywordsign">-></span> int<br> + <span class="keyword">val</span> emptyFunction : string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.fundec<br> + <span class="keyword">val</span> setFormals : <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> <span class="constructor">Cil</span>.varinfo list <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> setFunctionType : <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> setFunctionTypeMakeFormals : <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> setMaxId : <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> dummyFunDec : <span class="constructor">Cil</span>.fundec<br> + <span class="keyword">val</span> dummyFile : <span class="constructor">Cil</span>.file<br> + <span class="keyword">val</span> saveBinaryFile : <span class="constructor">Cil</span>.file <span class="keywordsign">-></span> string <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> saveBinaryFileChannel : <span class="constructor">Cil</span>.file <span class="keywordsign">-></span> <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> loadBinaryFile : string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.file<br> + <span class="keyword">val</span> getGlobInit : ?main_name:string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.file <span class="keywordsign">-></span> <span class="constructor">Cil</span>.fundec<br> + <span class="keyword">val</span> iterGlobals : <span class="constructor">Cil</span>.file <span class="keywordsign">-></span> (<span class="constructor">Cil</span>.global <span class="keywordsign">-></span> unit) <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> foldGlobals : <span class="constructor">Cil</span>.file <span class="keywordsign">-></span> (<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="constructor">Cil</span>.global <span class="keywordsign">-></span> <span class="keywordsign">'</span>a) <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> mapGlobals : <span class="constructor">Cil</span>.file <span class="keywordsign">-></span> (<span class="constructor">Cil</span>.global <span class="keywordsign">-></span> <span class="constructor">Cil</span>.global) <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> new_sid : unit <span class="keywordsign">-></span> int<br> + <span class="keyword">val</span> prepareCFG : <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> computeCFGInfo : <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> bool <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> copyFunction : <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.fundec<br> + <span class="keyword">val</span> pushGlobal :<br> + <span class="constructor">Cil</span>.global <span class="keywordsign">-></span><br> + types:<span class="constructor">Cil</span>.global list <span class="constructor">Pervasives</span>.ref <span class="keywordsign">-></span><br> + variables:<span class="constructor">Cil</span>.global list <span class="constructor">Pervasives</span>.ref <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> invalidStmt : <span class="constructor">Cil</span>.stmt<br> + <span class="keyword">val</span> gccBuiltins : (string, <span class="constructor">Cil</span>.typ * <span class="constructor">Cil</span>.typ list * bool) <span class="constructor">Hashtbl</span>.t<br> + <span class="keyword">val</span> msvcBuiltins : (string, <span class="constructor">Cil</span>.typ * <span class="constructor">Cil</span>.typ list * bool) <span class="constructor">Hashtbl</span>.t<br> + <span class="keyword">val</span> makeZeroInit : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.init<br> + <span class="keyword">val</span> foldLeftCompound :<br> + doinit:(<span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> <span class="constructor">Cil</span>.init <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>a) <span class="keywordsign">-></span><br> + ct:<span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> initl:(<span class="constructor">Cil</span>.offset * <span class="constructor">Cil</span>.init) list <span class="keywordsign">-></span> acc:<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> foldLeftCompoundAll :<br> + doinit:(<span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> <span class="constructor">Cil</span>.init <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>a) <span class="keywordsign">-></span><br> + ct:<span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> initl:(<span class="constructor">Cil</span>.offset * <span class="constructor">Cil</span>.init) list <span class="keywordsign">-></span> acc:<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> voidType : <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> isVoidType : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> bool<br> + <span class="keyword">val</span> isVoidPtrType : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> bool<br> + <span class="keyword">val</span> intType : <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> uintType : <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> longType : <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> ulongType : <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> charType : <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> charPtrType : <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> wcharKind : <span class="constructor">Cil</span>.ikind <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> wcharType : <span class="constructor">Cil</span>.typ <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> charConstPtrType : <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> voidPtrType : <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> intPtrType : <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> uintPtrType : <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> doubleType : <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> upointType : <span class="constructor">Cil</span>.typ <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> typeOfSizeOf : <span class="constructor">Cil</span>.typ <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> isSigned : <span class="constructor">Cil</span>.ikind <span class="keywordsign">-></span> bool<br> + <span class="keyword">val</span> mkCompInfo :<br> + bool <span class="keywordsign">-></span><br> + string <span class="keywordsign">-></span><br> + (<span class="constructor">Cil</span>.compinfo <span class="keywordsign">-></span><br> + (string * <span class="constructor">Cil</span>.typ * int option * <span class="constructor">Cil</span>.attributes * <span class="constructor">Cil</span>.location) list) <span class="keywordsign">-></span><br> + <span class="constructor">Cil</span>.attributes <span class="keywordsign">-></span> <span class="constructor">Cil</span>.compinfo<br> + <span class="keyword">val</span> copyCompInfo : <span class="constructor">Cil</span>.compinfo <span class="keywordsign">-></span> string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.compinfo<br> + <span class="keyword">val</span> missingFieldName : string<br> + <span class="keyword">val</span> compFullName : <span class="constructor">Cil</span>.compinfo <span class="keywordsign">-></span> string<br> + <span class="keyword">val</span> isCompleteType : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> bool<br> + <span class="keyword">val</span> unrollType : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> unrollTypeDeep : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> separateStorageModifiers :<br> + <span class="constructor">Cil</span>.attribute list <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attribute list * <span class="constructor">Cil</span>.attribute list<br> + <span class="keyword">val</span> isIntegralType : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> bool<br> + <span class="keyword">val</span> isArithmeticType : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> bool<br> + <span class="keyword">val</span> isPointerType : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> bool<br> + <span class="keyword">val</span> isFunctionType : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> bool<br> + <span class="keyword">val</span> argsToList :<br> + (string * <span class="constructor">Cil</span>.typ * <span class="constructor">Cil</span>.attributes) list option <span class="keywordsign">-></span><br> + (string * <span class="constructor">Cil</span>.typ * <span class="constructor">Cil</span>.attributes) list<br> + <span class="keyword">val</span> isArrayType : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> bool<br> + <span class="keyword">exception</span> <span class="constructor">LenOfArray</span><br> + <span class="keyword">val</span> lenOfArray : <span class="constructor">Cil</span>.exp option <span class="keywordsign">-></span> int<br> + <span class="keyword">val</span> getCompField : <span class="constructor">Cil</span>.compinfo <span class="keywordsign">-></span> string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.fieldinfo<br> + <span class="keyword">type</span> existsAction = <span class="constructor">ExistsTrue</span> <span class="keywordsign">|</span> <span class="constructor">ExistsFalse</span> <span class="keywordsign">|</span> <span class="constructor">ExistsMaybe</span><br> + <span class="keyword">val</span> existsType : (<span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.existsAction) <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> bool<br> + <span class="keyword">val</span> splitFunctionType :<br> + <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span><br> + <span class="constructor">Cil</span>.typ * (string * <span class="constructor">Cil</span>.typ * <span class="constructor">Cil</span>.attributes) list option * bool *<br> + <span class="constructor">Cil</span>.attributes<br> + <span class="keyword">val</span> splitFunctionTypeVI :<br> + <span class="constructor">Cil</span>.varinfo <span class="keywordsign">-></span><br> + <span class="constructor">Cil</span>.typ * (string * <span class="constructor">Cil</span>.typ * <span class="constructor">Cil</span>.attributes) list option * bool *<br> + <span class="constructor">Cil</span>.attributes<br> + <span class="keyword">val</span> d_typsig : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typsig <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> typeSig : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typsig<br> + <span class="keyword">val</span> typeSigWithAttrs :<br> + ?ignoreSign:bool <span class="keywordsign">-></span><br> + (<span class="constructor">Cil</span>.attributes <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes) <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typsig<br> + <span class="keyword">val</span> setTypeSigAttrs : <span class="constructor">Cil</span>.attributes <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typsig <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typsig<br> + <span class="keyword">val</span> typeSigAttrs : <span class="constructor">Cil</span>.typsig <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes<br> + <span class="keyword">val</span> makeVarinfo : bool <span class="keywordsign">-></span> string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.varinfo<br> + <span class="keyword">val</span> makeFormalVar :<br> + <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> ?where:string <span class="keywordsign">-></span> string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.varinfo<br> + <span class="keyword">val</span> makeLocalVar :<br> + <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> ?insert:bool <span class="keywordsign">-></span> string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.varinfo<br> + <span class="keyword">val</span> makeTempVar : <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> ?name:string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.varinfo<br> + <span class="keyword">val</span> makeGlobalVar : string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.varinfo<br> + <span class="keyword">val</span> copyVarinfo : <span class="constructor">Cil</span>.varinfo <span class="keywordsign">-></span> string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.varinfo<br> + <span class="keyword">val</span> newVID : unit <span class="keywordsign">-></span> int<br> + <span class="keyword">val</span> addOffsetLval : <span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> <span class="constructor">Cil</span>.lval <span class="keywordsign">-></span> <span class="constructor">Cil</span>.lval<br> + <span class="keyword">val</span> addOffset : <span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> <span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> <span class="constructor">Cil</span>.offset<br> + <span class="keyword">val</span> removeOffsetLval : <span class="constructor">Cil</span>.lval <span class="keywordsign">-></span> <span class="constructor">Cil</span>.lval * <span class="constructor">Cil</span>.offset<br> + <span class="keyword">val</span> removeOffset : <span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> <span class="constructor">Cil</span>.offset * <span class="constructor">Cil</span>.offset<br> + <span class="keyword">val</span> typeOfLval : <span class="constructor">Cil</span>.lval <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> typeOffset : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> zero : <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> one : <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> mone : <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> kinteger64 : <span class="constructor">Cil</span>.ikind <span class="keywordsign">-></span> int64 <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> kinteger : <span class="constructor">Cil</span>.ikind <span class="keywordsign">-></span> int <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> integer : int <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> isInteger : <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> int64 option<br> + <span class="keyword">val</span> isConstant : <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> bool<br> + <span class="keyword">val</span> isZero : <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> bool<br> + <span class="keyword">val</span> charConstToInt : char <span class="keywordsign">-></span> <span class="constructor">Cil</span>.constant<br> + <span class="keyword">val</span> constFold : bool <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> constFoldBinOp :<br> + bool <span class="keywordsign">-></span> <span class="constructor">Cil</span>.binop <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> increm : <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> int <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> var : <span class="constructor">Cil</span>.varinfo <span class="keywordsign">-></span> <span class="constructor">Cil</span>.lval<br> + <span class="keyword">val</span> mkAddrOf : <span class="constructor">Cil</span>.lval <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> mkAddrOrStartOf : <span class="constructor">Cil</span>.lval <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> mkMem : addr:<span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> off:<span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> <span class="constructor">Cil</span>.lval<br> + <span class="keyword">val</span> mkString : string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> mkCastT : e:<span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> oldt:<span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> newt:<span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> mkCast : e:<span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> newt:<span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> stripCasts : <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> typeOf : <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> parseInt : string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> mkStmt : <span class="constructor">Cil</span>.stmtkind <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt<br> + <span class="keyword">val</span> mkBlock : <span class="constructor">Cil</span>.stmt list <span class="keywordsign">-></span> <span class="constructor">Cil</span>.block<br> + <span class="keyword">val</span> mkStmtOneInstr : <span class="constructor">Cil</span>.instr <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt<br> + <span class="keyword">val</span> compactStmts : <span class="constructor">Cil</span>.stmt list <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt list<br> + <span class="keyword">val</span> mkEmptyStmt : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt<br> + <span class="keyword">val</span> dummyInstr : <span class="constructor">Cil</span>.instr<br> + <span class="keyword">val</span> dummyStmt : <span class="constructor">Cil</span>.stmt<br> + <span class="keyword">val</span> mkWhile : guard:<span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> body:<span class="constructor">Cil</span>.stmt list <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt list<br> + <span class="keyword">val</span> mkForIncr :<br> + iter:<span class="constructor">Cil</span>.varinfo <span class="keywordsign">-></span><br> + first:<span class="constructor">Cil</span>.exp <span class="keywordsign">-></span><br> + stopat:<span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> incr:<span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> body:<span class="constructor">Cil</span>.stmt list <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt list<br> + <span class="keyword">val</span> mkFor :<br> + start:<span class="constructor">Cil</span>.stmt list <span class="keywordsign">-></span><br> + guard:<span class="constructor">Cil</span>.exp <span class="keywordsign">-></span><br> + next:<span class="constructor">Cil</span>.stmt list <span class="keywordsign">-></span> body:<span class="constructor">Cil</span>.stmt list <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt list<br> + <span class="keyword">type</span> attributeClass = <span class="constructor">AttrName</span> <span class="keyword">of</span> bool <span class="keywordsign">|</span> <span class="constructor">AttrFunType</span> <span class="keyword">of</span> bool <span class="keywordsign">|</span> <span class="constructor">AttrType</span><br> + <span class="keyword">val</span> attributeHash : (string, <span class="constructor">Cil</span>.attributeClass) <span class="constructor">Hashtbl</span>.t<br> + <span class="keyword">val</span> partitionAttributes :<br> + default:<span class="constructor">Cil</span>.attributeClass <span class="keywordsign">-></span><br> + <span class="constructor">Cil</span>.attributes <span class="keywordsign">-></span><br> + <span class="constructor">Cil</span>.attribute list * <span class="constructor">Cil</span>.attribute list * <span class="constructor">Cil</span>.attribute list<br> + <span class="keyword">val</span> addAttribute : <span class="constructor">Cil</span>.attribute <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes<br> + <span class="keyword">val</span> addAttributes : <span class="constructor">Cil</span>.attribute list <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes<br> + <span class="keyword">val</span> dropAttribute : string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes<br> + <span class="keyword">val</span> dropAttributes : string list <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes<br> + <span class="keyword">val</span> filterAttributes : string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes<br> + <span class="keyword">val</span> hasAttribute : string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes <span class="keywordsign">-></span> bool<br> + <span class="keyword">val</span> typeAttrs : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attribute list<br> + <span class="keyword">val</span> setTypeAttrs : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> typeAddAttributes : <span class="constructor">Cil</span>.attribute list <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> typeRemoveAttributes : string list <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ<br> + <span class="keyword">type</span> <span class="keywordsign">'</span>a visitAction =<br> + <span class="constructor">SkipChildren</span><br> + <span class="keywordsign">|</span> <span class="constructor">DoChildren</span><br> + <span class="keywordsign">|</span> <span class="constructor">ChangeTo</span> <span class="keyword">of</span> <span class="keywordsign">'</span>a<br> + <span class="keywordsign">|</span> <span class="constructor">ChangeDoChildrenPost</span> <span class="keyword">of</span> <span class="keywordsign">'</span>a * (<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>a)<br> + <span class="keyword">class</span> <span class="keyword">type</span> cilVisitor =<br> + <span class="keyword">object</span><br> + <span class="keyword">method</span> queueInstr : <span class="constructor">Cil</span>.instr list <span class="keywordsign">-></span> unit<br> + <span class="keyword">method</span> unqueueInstr : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.instr list<br> + <span class="keyword">method</span> vattr : <span class="constructor">Cil</span>.attribute <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attribute list <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vattrparam : <span class="constructor">Cil</span>.attrparam <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attrparam <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vblock : <span class="constructor">Cil</span>.block <span class="keywordsign">-></span> <span class="constructor">Cil</span>.block <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vexpr : <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vfunc : <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> <span class="constructor">Cil</span>.fundec <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vglob : <span class="constructor">Cil</span>.global <span class="keywordsign">-></span> <span class="constructor">Cil</span>.global list <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vinit : <span class="constructor">Cil</span>.init <span class="keywordsign">-></span> <span class="constructor">Cil</span>.init <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vinitoffs : <span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> <span class="constructor">Cil</span>.offset <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vinst : <span class="constructor">Cil</span>.instr <span class="keywordsign">-></span> <span class="constructor">Cil</span>.instr list <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vlval : <span class="constructor">Cil</span>.lval <span class="keywordsign">-></span> <span class="constructor">Cil</span>.lval <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> voffs : <span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> <span class="constructor">Cil</span>.offset <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vstmt : <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vtype : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vvdec : <span class="constructor">Cil</span>.varinfo <span class="keywordsign">-></span> <span class="constructor">Cil</span>.varinfo <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">method</span> vvrbl : <span class="constructor">Cil</span>.varinfo <span class="keywordsign">-></span> <span class="constructor">Cil</span>.varinfo <span class="constructor">Cil</span>.visitAction<br> + <span class="keyword">end</span><br> + <span class="keyword">class</span> nopCilVisitor : cilVisitor<br> + <span class="keyword">val</span> visitCilFile : <span class="constructor">Cil</span>.cilVisitor <span class="keywordsign">-></span> <span class="constructor">Cil</span>.file <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> visitCilFileSameGlobals : <span class="constructor">Cil</span>.cilVisitor <span class="keywordsign">-></span> <span class="constructor">Cil</span>.file <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> visitCilGlobal : <span class="constructor">Cil</span>.cilVisitor <span class="keywordsign">-></span> <span class="constructor">Cil</span>.global <span class="keywordsign">-></span> <span class="constructor">Cil</span>.global list<br> + <span class="keyword">val</span> visitCilFunction : <span class="constructor">Cil</span>.cilVisitor <span class="keywordsign">-></span> <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> <span class="constructor">Cil</span>.fundec<br> + <span class="keyword">val</span> visitCilExpr : <span class="constructor">Cil</span>.cilVisitor <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> visitCilLval : <span class="constructor">Cil</span>.cilVisitor <span class="keywordsign">-></span> <span class="constructor">Cil</span>.lval <span class="keywordsign">-></span> <span class="constructor">Cil</span>.lval<br> + <span class="keyword">val</span> visitCilOffset : <span class="constructor">Cil</span>.cilVisitor <span class="keywordsign">-></span> <span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> <span class="constructor">Cil</span>.offset<br> + <span class="keyword">val</span> visitCilInitOffset : <span class="constructor">Cil</span>.cilVisitor <span class="keywordsign">-></span> <span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> <span class="constructor">Cil</span>.offset<br> + <span class="keyword">val</span> visitCilInstr : <span class="constructor">Cil</span>.cilVisitor <span class="keywordsign">-></span> <span class="constructor">Cil</span>.instr <span class="keywordsign">-></span> <span class="constructor">Cil</span>.instr list<br> + <span class="keyword">val</span> visitCilStmt : <span class="constructor">Cil</span>.cilVisitor <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt<br> + <span class="keyword">val</span> visitCilBlock : <span class="constructor">Cil</span>.cilVisitor <span class="keywordsign">-></span> <span class="constructor">Cil</span>.block <span class="keywordsign">-></span> <span class="constructor">Cil</span>.block<br> + <span class="keyword">val</span> visitCilType : <span class="constructor">Cil</span>.cilVisitor <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> visitCilVarDecl : <span class="constructor">Cil</span>.cilVisitor <span class="keywordsign">-></span> <span class="constructor">Cil</span>.varinfo <span class="keywordsign">-></span> <span class="constructor">Cil</span>.varinfo<br> + <span class="keyword">val</span> visitCilInit : <span class="constructor">Cil</span>.cilVisitor <span class="keywordsign">-></span> <span class="constructor">Cil</span>.init <span class="keywordsign">-></span> <span class="constructor">Cil</span>.init<br> + <span class="keyword">val</span> visitCilAttributes :<br> + <span class="constructor">Cil</span>.cilVisitor <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attribute list <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attribute list<br> + <span class="keyword">val</span> msvcMode : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> useLogicalOperators : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> constFoldVisitor : bool <span class="keywordsign">-></span> <span class="constructor">Cil</span>.cilVisitor<br> + <span class="keyword">type</span> lineDirectiveStyle =<br> + <span class="constructor">LineComment</span><br> + <span class="keywordsign">|</span> <span class="constructor">LinePreprocessorInput</span><br> + <span class="keywordsign">|</span> <span class="constructor">LinePreprocessorOutput</span><br> + <span class="keyword">val</span> lineDirectiveStyle : <span class="constructor">Cil</span>.lineDirectiveStyle option <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> print_CIL_Input : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> printCilAsIs : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> lineLength : int <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> forgcc : string <span class="keywordsign">-></span> string<br> + <span class="keyword">val</span> currentLoc : <span class="constructor">Cil</span>.location <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> currentGlobal : <span class="constructor">Cil</span>.global <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> d_loc : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.location <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_thisloc : unit <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_ikind : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.ikind <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_fkind : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.fkind <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_storage : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.storage <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_const : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.constant <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> derefStarLevel : int<br> + <span class="keyword">val</span> indexLevel : int<br> + <span class="keyword">val</span> arrowLevel : int<br> + <span class="keyword">val</span> addrOfLevel : int<br> + <span class="keyword">val</span> additiveLevel : int<br> + <span class="keyword">val</span> comparativeLevel : int<br> + <span class="keyword">val</span> bitwiseLevel : int<br> + <span class="keyword">val</span> getParenthLevel : <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> int<br> + <span class="keyword">class</span> <span class="keyword">type</span> cilPrinter =<br> + <span class="keyword">object</span><br> + <span class="keyword">method</span> dBlock : <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> int <span class="keywordsign">-></span> <span class="constructor">Cil</span>.block <span class="keywordsign">-></span> unit<br> + <span class="keyword">method</span> dGlobal : <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> <span class="constructor">Cil</span>.global <span class="keywordsign">-></span> unit<br> + <span class="keyword">method</span> dInit : <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> int <span class="keywordsign">-></span> <span class="constructor">Cil</span>.init <span class="keywordsign">-></span> unit<br> + <span class="keyword">method</span> dStmt : <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> int <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> unit<br> + <span class="keyword">method</span> pAttr : <span class="constructor">Cil</span>.attribute <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc * bool<br> + <span class="keyword">method</span> pAttrParam : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attrparam <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pAttrs : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pBlock : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.block <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pExp : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pFieldDecl : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.fieldinfo <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pGlobal : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.global <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pInit : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.init <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pInstr : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.instr <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pLabel : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.label <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pLineDirective : ?forcefile:bool <span class="keywordsign">-></span> <span class="constructor">Cil</span>.location <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pLval : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.lval <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pOffset : <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> <span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pStmt : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pStmtKind : <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmtkind <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pType : <span class="constructor">Pretty</span>.doc option <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pVDecl : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.varinfo <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">method</span> pVar : <span class="constructor">Cil</span>.varinfo <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">end</span><br> + <span class="keyword">class</span> defaultCilPrinterClass : cilPrinter<br> + <span class="keyword">val</span> defaultCilPrinter : <span class="constructor">Cil</span>.cilPrinter<br> + <span class="keyword">class</span> plainCilPrinterClass : cilPrinter<br> + <span class="keyword">val</span> plainCilPrinter : <span class="constructor">Cil</span>.cilPrinter<br> + <span class="keyword">val</span> printerForMaincil : <span class="constructor">Cil</span>.cilPrinter <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> printType : <span class="constructor">Cil</span>.cilPrinter <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> printExp : <span class="constructor">Cil</span>.cilPrinter <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> printLval : <span class="constructor">Cil</span>.cilPrinter <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.lval <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> printGlobal : <span class="constructor">Cil</span>.cilPrinter <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.global <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> printAttr : <span class="constructor">Cil</span>.cilPrinter <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attribute <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> printAttrs : <span class="constructor">Cil</span>.cilPrinter <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> printInstr : <span class="constructor">Cil</span>.cilPrinter <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.instr <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> printStmt : <span class="constructor">Cil</span>.cilPrinter <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> printBlock : <span class="constructor">Cil</span>.cilPrinter <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.block <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> dumpStmt :<br> + <span class="constructor">Cil</span>.cilPrinter <span class="keywordsign">-></span> <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> int <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> dumpBlock :<br> + <span class="constructor">Cil</span>.cilPrinter <span class="keywordsign">-></span> <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> int <span class="keywordsign">-></span> <span class="constructor">Cil</span>.block <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> printInit : <span class="constructor">Cil</span>.cilPrinter <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.init <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> dumpInit :<br> + <span class="constructor">Cil</span>.cilPrinter <span class="keywordsign">-></span> <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> int <span class="keywordsign">-></span> <span class="constructor">Cil</span>.init <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> d_type : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_exp : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_lval : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.lval <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_offset : <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_init : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.init <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_binop : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.binop <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_unop : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.unop <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_attr : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attribute <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_attrparam : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attrparam <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_attrlist : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_instr : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.instr <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_label : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.label <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_stmt : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_block : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.block <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_global : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.global <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> dn_exp : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> dn_lval : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.lval <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> dn_init : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.init <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> dn_type : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> dn_global : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.global <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> dn_attrlist : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attributes <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> dn_attr : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attribute <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> dn_attrparam : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.attrparam <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> dn_stmt : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> dn_instr : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.instr <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_shortglobal : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.global <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> dumpGlobal :<br> + <span class="constructor">Cil</span>.cilPrinter <span class="keywordsign">-></span> <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> <span class="constructor">Cil</span>.global <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> dumpFile :<br> + <span class="constructor">Cil</span>.cilPrinter <span class="keywordsign">-></span> <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.file <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> bug : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc) <span class="constructor">Pervasives</span>.format <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> unimp : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc) <span class="constructor">Pervasives</span>.format <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> error : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc) <span class="constructor">Pervasives</span>.format <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> errorLoc :<br> + <span class="constructor">Cil</span>.location <span class="keywordsign">-></span> (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc) <span class="constructor">Pervasives</span>.format <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> warn : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc) <span class="constructor">Pervasives</span>.format <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> warnOpt : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc) <span class="constructor">Pervasives</span>.format <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> warnContext : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc) <span class="constructor">Pervasives</span>.format <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> warnContextOpt : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc) <span class="constructor">Pervasives</span>.format <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> warnLoc :<br> + <span class="constructor">Cil</span>.location <span class="keywordsign">-></span> (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc) <span class="constructor">Pervasives</span>.format <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> d_plainexp : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_plaininit : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.init <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_plainlval : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.lval <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_plaintype : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> uniqueVarNames : <span class="constructor">Cil</span>.file <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> peepHole2 :<br> + (<span class="constructor">Cil</span>.instr * <span class="constructor">Cil</span>.instr <span class="keywordsign">-></span> <span class="constructor">Cil</span>.instr list option) <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt list <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> peepHole1 :<br> + (<span class="constructor">Cil</span>.instr <span class="keywordsign">-></span> <span class="constructor">Cil</span>.instr list option) <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt list <span class="keywordsign">-></span> unit<br> + <span class="keyword">exception</span> <span class="constructor">SizeOfError</span> <span class="keyword">of</span> string * <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> bitsSizeOf : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> int<br> + <span class="keyword">val</span> sizeOf : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> alignOf_int : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> int<br> + <span class="keyword">val</span> bitsOffset : <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.offset <span class="keywordsign">-></span> int * int<br> + <span class="keyword">val</span> char_is_unsigned : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> little_endian : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> underscore_name : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> locUnknown : <span class="constructor">Cil</span>.location<br> + <span class="keyword">val</span> get_instrLoc : <span class="constructor">Cil</span>.instr <span class="keywordsign">-></span> <span class="constructor">Cil</span>.location<br> + <span class="keyword">val</span> get_globalLoc : <span class="constructor">Cil</span>.global <span class="keywordsign">-></span> <span class="constructor">Cil</span>.location<br> + <span class="keyword">val</span> get_stmtLoc : <span class="constructor">Cil</span>.stmtkind <span class="keywordsign">-></span> <span class="constructor">Cil</span>.location<br> + <span class="keyword">val</span> dExp : <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> dInstr : <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> <span class="constructor">Cil</span>.location <span class="keywordsign">-></span> <span class="constructor">Cil</span>.instr<br> + <span class="keyword">val</span> dGlobal : <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> <span class="constructor">Cil</span>.location <span class="keywordsign">-></span> <span class="constructor">Cil</span>.global<br> + <span class="keyword">val</span> mapNoCopy : (<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>a) <span class="keywordsign">-></span> <span class="keywordsign">'</span>a list <span class="keywordsign">-></span> <span class="keywordsign">'</span>a list<br> + <span class="keyword">val</span> mapNoCopyList : (<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>a list) <span class="keywordsign">-></span> <span class="keywordsign">'</span>a list <span class="keywordsign">-></span> <span class="keywordsign">'</span>a list<br> + <span class="keyword">val</span> startsWith : string <span class="keywordsign">-></span> string <span class="keywordsign">-></span> bool<br> + <span class="keyword">type</span> formatArg =<br> + <span class="constructor">Fe</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.exp<br> + <span class="keywordsign">|</span> <span class="constructor">Feo</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.exp option<br> + <span class="keywordsign">|</span> <span class="constructor">Fu</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.unop<br> + <span class="keywordsign">|</span> <span class="constructor">Fb</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.binop<br> + <span class="keywordsign">|</span> <span class="constructor">Fk</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.ikind<br> + <span class="keywordsign">|</span> <span class="constructor">FE</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.exp list<br> + <span class="keywordsign">|</span> <span class="constructor">Ff</span> <span class="keyword">of</span> (string * <span class="constructor">Cil</span>.typ * <span class="constructor">Cil</span>.attributes)<br> + <span class="keywordsign">|</span> <span class="constructor">FF</span> <span class="keyword">of</span> (string * <span class="constructor">Cil</span>.typ * <span class="constructor">Cil</span>.attributes) list<br> + <span class="keywordsign">|</span> <span class="constructor">Fva</span> <span class="keyword">of</span> bool<br> + <span class="keywordsign">|</span> <span class="constructor">Fv</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.varinfo<br> + <span class="keywordsign">|</span> <span class="constructor">Fl</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.lval<br> + <span class="keywordsign">|</span> <span class="constructor">Flo</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.lval option<br> + <span class="keywordsign">|</span> <span class="constructor">Fo</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.offset<br> + <span class="keywordsign">|</span> <span class="constructor">Fc</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.compinfo<br> + <span class="keywordsign">|</span> <span class="constructor">Fi</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.instr<br> + <span class="keywordsign">|</span> <span class="constructor">FI</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.instr list<br> + <span class="keywordsign">|</span> <span class="constructor">Ft</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.typ<br> + <span class="keywordsign">|</span> <span class="constructor">Fd</span> <span class="keyword">of</span> int<br> + <span class="keywordsign">|</span> <span class="constructor">Fg</span> <span class="keyword">of</span> string<br> + <span class="keywordsign">|</span> <span class="constructor">Fs</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.stmt<br> + <span class="keywordsign">|</span> <span class="constructor">FS</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.stmt list<br> + <span class="keywordsign">|</span> <span class="constructor">FA</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.attributes<br> + <span class="keywordsign">|</span> <span class="constructor">Fp</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.attrparam<br> + <span class="keywordsign">|</span> <span class="constructor">FP</span> <span class="keyword">of</span> <span class="constructor">Cil</span>.attrparam list<br> + <span class="keywordsign">|</span> <span class="constructor">FX</span> <span class="keyword">of</span> string<br> + <span class="keyword">val</span> d_formatarg : unit <span class="keywordsign">-></span> <span class="constructor">Cil</span>.formatArg <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> lowerConstants : bool <span class="constructor">Pervasives</span>.ref<br> +<span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Cil.nopCilVisitor.html b/cil/doc/api/type_Cil.nopCilVisitor.html new file mode 100644 index 0000000..0ac6c96 --- /dev/null +++ b/cil/doc/api/type_Cil.nopCilVisitor.html @@ -0,0 +1,25 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Cil.nopCilVisitor</title> +</head> +<body> +<code class="code"><span class="constructor">Cil</span>.cilVisitor</code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Cil.plainCilPrinterClass.html b/cil/doc/api/type_Cil.plainCilPrinterClass.html new file mode 100644 index 0000000..ecd6317 --- /dev/null +++ b/cil/doc/api/type_Cil.plainCilPrinterClass.html @@ -0,0 +1,25 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Cil.plainCilPrinterClass</title> +</head> +<body> +<code class="code"><span class="constructor">Cil</span>.cilPrinter</code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Cillower.html b/cil/doc/api/type_Cillower.html new file mode 100644 index 0000000..a8924ed --- /dev/null +++ b/cil/doc/api/type_Cillower.html @@ -0,0 +1,25 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Cillower</title> +</head> +<body> +<code class="code"><span class="keyword">sig</span> <span class="keyword">val</span> lowerEnumVisitor : <span class="constructor">Cil</span>.cilVisitor <span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Clist.html b/cil/doc/api/type_Clist.html new file mode 100644 index 0000000..c7dbd02 --- /dev/null +++ b/cil/doc/api/type_Clist.html @@ -0,0 +1,44 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Clist</title> +</head> +<body> +<code class="code"><span class="keyword">sig</span><br> + <span class="keyword">type</span> <span class="keywordsign">'</span>a clist =<br> + <span class="constructor">CList</span> <span class="keyword">of</span> <span class="keywordsign">'</span>a list<br> + <span class="keywordsign">|</span> <span class="constructor">CConsL</span> <span class="keyword">of</span> <span class="keywordsign">'</span>a * <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist<br> + <span class="keywordsign">|</span> <span class="constructor">CConsR</span> <span class="keyword">of</span> <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist * <span class="keywordsign">'</span>a<br> + <span class="keywordsign">|</span> <span class="constructor">CSeq</span> <span class="keyword">of</span> <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist * <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist<br> + <span class="keyword">val</span> toList : <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist <span class="keywordsign">-></span> <span class="keywordsign">'</span>a list<br> + <span class="keyword">val</span> fromList : <span class="keywordsign">'</span>a list <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist<br> + <span class="keyword">val</span> single : <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist<br> + <span class="keyword">val</span> empty : <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist<br> + <span class="keyword">val</span> append : <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist<br> + <span class="keyword">val</span> checkBeforeAppend : <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist <span class="keywordsign">-></span> bool<br> + <span class="keyword">val</span> length : <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist <span class="keywordsign">-></span> int<br> + <span class="keyword">val</span> map : (<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>b) <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist <span class="keywordsign">-></span> <span class="keywordsign">'</span>b <span class="constructor">Clist</span>.clist<br> + <span class="keyword">val</span> fold_left : (<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>b <span class="keywordsign">-></span> <span class="keywordsign">'</span>a) <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>b <span class="constructor">Clist</span>.clist <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> iter : (<span class="keywordsign">'</span>a <span class="keywordsign">-></span> unit) <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> rev : (<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>a) <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist<br> + <span class="keyword">val</span> docCList :<br> + <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> (<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="constructor">Clist</span>.clist <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> +<span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Dataflow.BackwardsDataFlow.html b/cil/doc/api/type_Dataflow.BackwardsDataFlow.html new file mode 100644 index 0000000..78ffeba --- /dev/null +++ b/cil/doc/api/type_Dataflow.BackwardsDataFlow.html @@ -0,0 +1,26 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Dataflow.BackwardsDataFlow</title> +</head> +<body> +<code class="code"><span class="keyword">functor</span> (<span class="constructor">T</span> : <span class="constructor">BackwardsTransfer</span>) <span class="keywordsign">-></span><br> + <span class="keyword">sig</span> <span class="keyword">val</span> compute : <span class="constructor">Cil</span>.stmt list <span class="keywordsign">-></span> unit <span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Dataflow.BackwardsTransfer.html b/cil/doc/api/type_Dataflow.BackwardsTransfer.html new file mode 100644 index 0000000..763df74 --- /dev/null +++ b/cil/doc/api/type_Dataflow.BackwardsTransfer.html @@ -0,0 +1,44 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Dataflow.BackwardsTransfer</title> +</head> +<body> +<code class="code"><span class="keyword">sig</span><br> + <span class="keyword">val</span> name : string<br> + <span class="keyword">val</span> debug : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">type</span> t<br> + <span class="keyword">val</span> pretty : unit <span class="keywordsign">-></span> <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> stmtStartData : <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="constructor">Inthash</span>.t<br> + <span class="keyword">val</span> combineStmtStartData :<br> + <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span><br> + old:<span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="keywordsign">-></span> <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t option<br> + <span class="keyword">val</span> combineSuccessors :<br> + <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="keywordsign">-></span> <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t<br> + <span class="keyword">val</span> doStmt : <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="constructor">Dataflow</span>.action<br> + <span class="keyword">val</span> doInstr :<br> + <span class="constructor">Cil</span>.instr <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="constructor">Dataflow</span>.action<br> + <span class="keyword">val</span> filterStmt : <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> bool<br> +<span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Dataflow.ForwardsDataFlow.html b/cil/doc/api/type_Dataflow.ForwardsDataFlow.html new file mode 100644 index 0000000..a042cfc --- /dev/null +++ b/cil/doc/api/type_Dataflow.ForwardsDataFlow.html @@ -0,0 +1,25 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Dataflow.ForwardsDataFlow</title> +</head> +<body> +<code class="code"><span class="keyword">functor</span> (<span class="constructor">T</span> : <span class="constructor">ForwardsTransfer</span>) <span class="keywordsign">-></span> <span class="keyword">sig</span> <span class="keyword">val</span> compute : <span class="constructor">Cil</span>.stmt list <span class="keywordsign">-></span> unit <span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Dataflow.ForwardsTransfer.html b/cil/doc/api/type_Dataflow.ForwardsTransfer.html new file mode 100644 index 0000000..1e4d48b --- /dev/null +++ b/cil/doc/api/type_Dataflow.ForwardsTransfer.html @@ -0,0 +1,51 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Dataflow.ForwardsTransfer</title> +</head> +<body> +<code class="code"><span class="keyword">sig</span><br> + <span class="keyword">val</span> name : string<br> + <span class="keyword">val</span> debug : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">type</span> t<br> + <span class="keyword">val</span> copy : <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="keywordsign">-></span> <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t<br> + <span class="keyword">val</span> stmtStartData : <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="constructor">Inthash</span>.t<br> + <span class="keyword">val</span> pretty : unit <span class="keywordsign">-></span> <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> computeFirstPredecessor :<br> + <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="keywordsign">-></span> <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t<br> + <span class="keyword">val</span> combinePredecessors :<br> + <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span><br> + old:<span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="keywordsign">-></span> <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t option<br> + <span class="keyword">val</span> doInstr :<br> + <span class="constructor">Cil</span>.instr <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="constructor">Dataflow</span>.action<br> + <span class="keyword">val</span> doStmt :<br> + <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="constructor">Dataflow</span>.stmtaction<br> + <span class="keyword">val</span> doGuard :<br> + <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="constructor">Dataflow</span>.guardaction<br> + <span class="keyword">val</span> filterStmt : <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> bool<br> +<span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Dataflow.html b/cil/doc/api/type_Dataflow.html new file mode 100644 index 0000000..fa03476 --- /dev/null +++ b/cil/doc/api/type_Dataflow.html @@ -0,0 +1,85 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Dataflow</title> +</head> +<body> +<code class="code"><span class="keyword">sig</span><br> + <span class="keyword">type</span> <span class="keywordsign">'</span>a action = <span class="constructor">Default</span> <span class="keywordsign">|</span> <span class="constructor">Done</span> <span class="keyword">of</span> <span class="keywordsign">'</span>a <span class="keywordsign">|</span> <span class="constructor">Post</span> <span class="keyword">of</span> (<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>a)<br> + <span class="keyword">type</span> <span class="keywordsign">'</span>a stmtaction = <span class="constructor">SDefault</span> <span class="keywordsign">|</span> <span class="constructor">SDone</span> <span class="keywordsign">|</span> <span class="constructor">SUse</span> <span class="keyword">of</span> <span class="keywordsign">'</span>a<br> + <span class="keyword">type</span> <span class="keywordsign">'</span>a guardaction = <span class="constructor">GDefault</span> <span class="keywordsign">|</span> <span class="constructor">GUse</span> <span class="keyword">of</span> <span class="keywordsign">'</span>a <span class="keywordsign">|</span> <span class="constructor">GUnreachable</span><br> + <span class="keyword">module</span> <span class="keyword">type</span> <span class="constructor">ForwardsTransfer</span> =<br> + <span class="keyword">sig</span><br> + <span class="keyword">val</span> name : string<br> + <span class="keyword">val</span> debug : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">type</span> t<br> + <span class="keyword">val</span> copy : <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="keywordsign">-></span> <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t<br> + <span class="keyword">val</span> stmtStartData : <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="constructor">Inthash</span>.t<br> + <span class="keyword">val</span> pretty : unit <span class="keywordsign">-></span> <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> computeFirstPredecessor :<br> + <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="keywordsign">-></span> <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t<br> + <span class="keyword">val</span> combinePredecessors :<br> + <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span><br> + old:<span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="keywordsign">-></span> <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t option<br> + <span class="keyword">val</span> doInstr :<br> + <span class="constructor">Cil</span>.instr <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="constructor">Dataflow</span>.action<br> + <span class="keyword">val</span> doStmt :<br> + <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="constructor">Dataflow</span>.stmtaction<br> + <span class="keyword">val</span> doGuard :<br> + <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">ForwardsTransfer</span>.t <span class="constructor">Dataflow</span>.guardaction<br> + <span class="keyword">val</span> filterStmt : <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> bool<br> + <span class="keyword">end</span><br> + <span class="keyword">module</span> <span class="constructor">ForwardsDataFlow</span> :<br> + <span class="keyword">functor</span> (<span class="constructor">T</span> : <span class="constructor">ForwardsTransfer</span>) <span class="keywordsign">-></span><br> + <span class="keyword">sig</span> <span class="keyword">val</span> compute : <span class="constructor">Cil</span>.stmt list <span class="keywordsign">-></span> unit <span class="keyword">end</span><br> + <span class="keyword">module</span> <span class="keyword">type</span> <span class="constructor">BackwardsTransfer</span> =<br> + <span class="keyword">sig</span><br> + <span class="keyword">val</span> name : string<br> + <span class="keyword">val</span> debug : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">type</span> t<br> + <span class="keyword">val</span> pretty : unit <span class="keywordsign">-></span> <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> stmtStartData : <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="constructor">Inthash</span>.t<br> + <span class="keyword">val</span> combineStmtStartData :<br> + <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span><br> + old:<span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="keywordsign">-></span> <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t option<br> + <span class="keyword">val</span> combineSuccessors :<br> + <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="keywordsign">-></span> <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t<br> + <span class="keyword">val</span> doStmt : <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="constructor">Dataflow</span>.action<br> + <span class="keyword">val</span> doInstr :<br> + <span class="constructor">Cil</span>.instr <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="keywordsign">-></span><br> + <span class="constructor">Dataflow</span>.<span class="constructor">BackwardsTransfer</span>.t <span class="constructor">Dataflow</span>.action<br> + <span class="keyword">val</span> filterStmt : <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> bool<br> + <span class="keyword">end</span><br> + <span class="keyword">module</span> <span class="constructor">BackwardsDataFlow</span> :<br> + <span class="keyword">functor</span> (<span class="constructor">T</span> : <span class="constructor">BackwardsTransfer</span>) <span class="keywordsign">-></span><br> + <span class="keyword">sig</span> <span class="keyword">val</span> compute : <span class="constructor">Cil</span>.stmt list <span class="keywordsign">-></span> unit <span class="keyword">end</span><br> +<span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Dominators.html b/cil/doc/api/type_Dominators.html new file mode 100644 index 0000000..a9fef53 --- /dev/null +++ b/cil/doc/api/type_Dominators.html @@ -0,0 +1,32 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Dominators</title> +</head> +<body> +<code class="code"><span class="keyword">sig</span><br> + <span class="keyword">val</span> computeIDom : <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt option <span class="constructor">Inthash</span>.t<br> + <span class="keyword">val</span> getIdom : <span class="constructor">Cil</span>.stmt option <span class="constructor">Inthash</span>.t <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt option<br> + <span class="keyword">val</span> dominates : <span class="constructor">Cil</span>.stmt option <span class="constructor">Inthash</span>.t <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt <span class="keywordsign">-></span> bool<br> + <span class="keyword">val</span> findNaturalLoops :<br> + <span class="constructor">Cil</span>.fundec <span class="keywordsign">-></span><br> + <span class="constructor">Cil</span>.stmt option <span class="constructor">Inthash</span>.t <span class="keywordsign">-></span> (<span class="constructor">Cil</span>.stmt * <span class="constructor">Cil</span>.stmt list) list<br> +<span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Errormsg.html b/cil/doc/api/type_Errormsg.html new file mode 100644 index 0000000..3ad0a86 --- /dev/null +++ b/cil/doc/api/type_Errormsg.html @@ -0,0 +1,64 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Errormsg</title> +</head> +<body> +<code class="code"><span class="keyword">sig</span><br> + <span class="keyword">val</span> logChannel : <span class="constructor">Pervasives</span>.out_channel <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> debugFlag : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> verboseFlag : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> warnFlag : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">exception</span> <span class="constructor">Error</span><br> + <span class="keyword">val</span> error : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc, unit) format4 <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> bug : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc, unit) format4 <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> unimp : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc, unit) format4 <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> s : <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>b<br> + <span class="keyword">val</span> hadErrors : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> warn : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc, unit) format4 <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> warnOpt : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc, unit) format4 <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> log : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc, unit) format4 <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> logg : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc, unit) format4 <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> null : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc, unit) format4 <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> pushContext : (unit <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> popContext : unit <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> showContext : unit <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> withContext : (unit <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span> (<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>b) <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>b<br> + <span class="keyword">val</span> newline : unit <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> newHline : unit <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> getPosition : unit <span class="keywordsign">-></span> int * string * int<br> + <span class="keyword">val</span> getHPosition : unit <span class="keywordsign">-></span> int * string<br> + <span class="keyword">val</span> setHLine : int <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> setHFile : string <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> setCurrentLine : int <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> setCurrentFile : string <span class="keywordsign">-></span> unit<br> + <span class="keyword">type</span> location = { file : string; line : int; hfile : string; hline : int; }<br> + <span class="keyword">val</span> d_loc : unit <span class="keywordsign">-></span> <span class="constructor">Errormsg</span>.location <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_hloc : unit <span class="keywordsign">-></span> <span class="constructor">Errormsg</span>.location <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> getLocation : unit <span class="keywordsign">-></span> <span class="constructor">Errormsg</span>.location<br> + <span class="keyword">val</span> parse_error : string <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> locUnknown : <span class="constructor">Errormsg</span>.location<br> + <span class="keyword">val</span> readingFromStdin : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> startParsing : ?useBasename:bool <span class="keywordsign">-></span> string <span class="keywordsign">-></span> <span class="constructor">Lexing</span>.lexbuf<br> + <span class="keyword">val</span> startParsingFromString :<br> + ?file:string <span class="keywordsign">-></span> ?line:int <span class="keywordsign">-></span> string <span class="keywordsign">-></span> <span class="constructor">Lexing</span>.lexbuf<br> + <span class="keyword">val</span> finishParsing : unit <span class="keywordsign">-></span> unit<br> +<span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Formatcil.html b/cil/doc/api/type_Formatcil.html new file mode 100644 index 0000000..7c5139b --- /dev/null +++ b/cil/doc/api/type_Formatcil.html @@ -0,0 +1,45 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Formatcil</title> +</head> +<body> +<code class="code"><span class="keyword">sig</span><br> + <span class="keyword">val</span> cExp : string <span class="keywordsign">-></span> (string * <span class="constructor">Cil</span>.formatArg) list <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp<br> + <span class="keyword">val</span> cLval : string <span class="keywordsign">-></span> (string * <span class="constructor">Cil</span>.formatArg) list <span class="keywordsign">-></span> <span class="constructor">Cil</span>.lval<br> + <span class="keyword">val</span> cType : string <span class="keywordsign">-></span> (string * <span class="constructor">Cil</span>.formatArg) list <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ<br> + <span class="keyword">val</span> cInstr :<br> + string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.location <span class="keywordsign">-></span> (string * <span class="constructor">Cil</span>.formatArg) list <span class="keywordsign">-></span> <span class="constructor">Cil</span>.instr<br> + <span class="keyword">val</span> cStmt :<br> + string <span class="keywordsign">-></span><br> + (string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.varinfo) <span class="keywordsign">-></span><br> + <span class="constructor">Cil</span>.location <span class="keywordsign">-></span> (string * <span class="constructor">Cil</span>.formatArg) list <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt<br> + <span class="keyword">val</span> cStmts :<br> + string <span class="keywordsign">-></span><br> + (string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.varinfo) <span class="keywordsign">-></span><br> + <span class="constructor">Cil</span>.location <span class="keywordsign">-></span> (string * <span class="constructor">Cil</span>.formatArg) list <span class="keywordsign">-></span> <span class="constructor">Cil</span>.stmt list<br> + <span class="keyword">val</span> dExp : string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.exp <span class="keywordsign">-></span> <span class="constructor">Cil</span>.formatArg list option<br> + <span class="keyword">val</span> dLval : string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.lval <span class="keywordsign">-></span> <span class="constructor">Cil</span>.formatArg list option<br> + <span class="keyword">val</span> dType : string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.typ <span class="keywordsign">-></span> <span class="constructor">Cil</span>.formatArg list option<br> + <span class="keyword">val</span> dInstr : string <span class="keywordsign">-></span> <span class="constructor">Cil</span>.instr <span class="keywordsign">-></span> <span class="constructor">Cil</span>.formatArg list option<br> + <span class="keyword">val</span> noMemoize : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> test : unit <span class="keywordsign">-></span> unit<br> +<span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Pretty.MakeMapPrinter.html b/cil/doc/api/type_Pretty.MakeMapPrinter.html new file mode 100644 index 0000000..0b9d35e --- /dev/null +++ b/cil/doc/api/type_Pretty.MakeMapPrinter.html @@ -0,0 +1,42 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Pretty.MakeMapPrinter</title> +</head> +<body> +<code class="code"><span class="keyword">functor</span><br> + (<span class="constructor">Map</span> : <span class="keyword">sig</span><br> + <span class="keyword">type</span> key<br> + <span class="keyword">type</span> <span class="keywordsign">'</span>a t<br> + <span class="keyword">val</span> fold :<br> + (<span class="constructor">Pretty</span>.<span class="constructor">MakeMapPrinter</span>.key <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>b <span class="keywordsign">-></span> <span class="keywordsign">'</span>b) <span class="keywordsign">-></span><br> + <span class="keywordsign">'</span>a <span class="constructor">Pretty</span>.<span class="constructor">MakeMapPrinter</span>.t <span class="keywordsign">-></span> <span class="keywordsign">'</span>b <span class="keywordsign">-></span> <span class="keywordsign">'</span>b<br> + <span class="keyword">end</span>) <span class="keywordsign">-></span><br> + <span class="keyword">sig</span><br> + <span class="keyword">val</span> docMap :<br> + ?sep:<span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span><br> + (<span class="constructor">Map</span>.key <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="constructor">Map</span>.t <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_map :<br> + ?dmaplet:(<span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span><br> + string <span class="keywordsign">-></span><br> + (unit <span class="keywordsign">-></span> <span class="constructor">Map</span>.key <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span><br> + (unit <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="constructor">Map</span>.t <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Pretty.MakeSetPrinter.html b/cil/doc/api/type_Pretty.MakeSetPrinter.html new file mode 100644 index 0000000..c5e0466 --- /dev/null +++ b/cil/doc/api/type_Pretty.MakeSetPrinter.html @@ -0,0 +1,40 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Pretty.MakeSetPrinter</title> +</head> +<body> +<code class="code"><span class="keyword">functor</span><br> + (<span class="constructor">Set</span> : <span class="keyword">sig</span><br> + <span class="keyword">type</span> elt<br> + <span class="keyword">type</span> t<br> + <span class="keyword">val</span> fold :<br> + (<span class="constructor">Pretty</span>.<span class="constructor">MakeSetPrinter</span>.elt <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>a) <span class="keywordsign">-></span><br> + <span class="constructor">Pretty</span>.<span class="constructor">MakeSetPrinter</span>.t <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">end</span>) <span class="keywordsign">-></span><br> + <span class="keyword">sig</span><br> + <span class="keyword">val</span> docSet :<br> + ?sep:<span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span><br> + (<span class="constructor">Set</span>.elt <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Set</span>.t <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_set :<br> + string <span class="keywordsign">-></span><br> + (unit <span class="keywordsign">-></span> <span class="constructor">Set</span>.elt <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Set</span>.t <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Pretty.html b/cil/doc/api/type_Pretty.html new file mode 100644 index 0000000..fc70f65 --- /dev/null +++ b/cil/doc/api/type_Pretty.html @@ -0,0 +1,111 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Pretty</title> +</head> +<body> +<code class="code"><span class="keyword">sig</span><br> + <span class="keyword">type</span> doc<br> + <span class="keyword">val</span> nil : <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> ( ++ ) : <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> concat : <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> text : string <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> num : int <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> real : float <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> chr : char <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> line : <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> leftflush : <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> break : <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> align : <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> unalign : <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> mark : <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> unmark : <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> indent : int <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> markup : <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> seq :<br> + sep:<span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span><br> + doit:(<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span> elements:<span class="keywordsign">'</span>a list <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> docList :<br> + ?sep:<span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> (<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="keywordsign">'</span>a list <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_list :<br> + string <span class="keywordsign">-></span> (unit <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="keywordsign">'</span>a list <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> docArray :<br> + ?sep:<span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span><br> + (int <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="keywordsign">'</span>a array <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> docOpt : (<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="keywordsign">'</span>a option <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_int32 : int32 <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> f_int32 : unit <span class="keywordsign">-></span> int32 <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_int64 : int64 <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> f_int64 : unit <span class="keywordsign">-></span> int64 <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">module</span> <span class="constructor">MakeMapPrinter</span> :<br> + <span class="keyword">functor</span><br> + (<span class="constructor">Map</span> : <span class="keyword">sig</span><br> + <span class="keyword">type</span> key<br> + <span class="keyword">type</span> <span class="keywordsign">'</span>a t<br> + <span class="keyword">val</span> fold :<br> + (<span class="constructor">Pretty</span>.<span class="constructor">MakeMapPrinter</span>.key <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>b <span class="keywordsign">-></span> <span class="keywordsign">'</span>b) <span class="keywordsign">-></span><br> + <span class="keywordsign">'</span>a <span class="constructor">Pretty</span>.<span class="constructor">MakeMapPrinter</span>.t <span class="keywordsign">-></span> <span class="keywordsign">'</span>b <span class="keywordsign">-></span> <span class="keywordsign">'</span>b<br> + <span class="keyword">end</span>) <span class="keywordsign">-></span><br> + <span class="keyword">sig</span><br> + <span class="keyword">val</span> docMap :<br> + ?sep:<span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span><br> + (<span class="constructor">Map</span>.key <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="constructor">Map</span>.t <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_map :<br> + ?dmaplet:(<span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span><br> + string <span class="keywordsign">-></span><br> + (unit <span class="keywordsign">-></span> <span class="constructor">Map</span>.key <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span><br> + (unit <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="constructor">Map</span>.t <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">end</span><br> + <span class="keyword">module</span> <span class="constructor">MakeSetPrinter</span> :<br> + <span class="keyword">functor</span><br> + (<span class="constructor">Set</span> : <span class="keyword">sig</span><br> + <span class="keyword">type</span> elt<br> + <span class="keyword">type</span> t<br> + <span class="keyword">val</span> fold :<br> + (<span class="constructor">Pretty</span>.<span class="constructor">MakeSetPrinter</span>.elt <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>a) <span class="keywordsign">-></span><br> + <span class="constructor">Pretty</span>.<span class="constructor">MakeSetPrinter</span>.t <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">end</span>) <span class="keywordsign">-></span><br> + <span class="keyword">sig</span><br> + <span class="keyword">val</span> docSet :<br> + ?sep:<span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span><br> + (<span class="constructor">Set</span>.elt <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Set</span>.t <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> d_set :<br> + string <span class="keywordsign">-></span><br> + (unit <span class="keywordsign">-></span> <span class="constructor">Set</span>.elt <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc) <span class="keywordsign">-></span> unit <span class="keywordsign">-></span> <span class="constructor">Set</span>.t <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">end</span><br> + <span class="keyword">val</span> insert : unit <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc<br> + <span class="keyword">val</span> dprintf : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc, <span class="constructor">Pretty</span>.doc) format4 <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> gprintf :<br> + (<span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> <span class="keywordsign">'</span>a) <span class="keywordsign">-></span> (<span class="keywordsign">'</span>b, unit, <span class="constructor">Pretty</span>.doc, <span class="keywordsign">'</span>a) format4 <span class="keywordsign">-></span> <span class="keywordsign">'</span>b<br> + <span class="keyword">val</span> fprint : <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> width:int <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> sprint : width:int <span class="keywordsign">-></span> <span class="constructor">Pretty</span>.doc <span class="keywordsign">-></span> string<br> + <span class="keyword">val</span> fprintf :<br> + <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc) <span class="constructor">Pervasives</span>.format <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> printf : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc) <span class="constructor">Pervasives</span>.format <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> eprintf : (<span class="keywordsign">'</span>a, unit, <span class="constructor">Pretty</span>.doc) <span class="constructor">Pervasives</span>.format <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> + <span class="keyword">val</span> withPrintDepth : int <span class="keywordsign">-></span> (unit <span class="keywordsign">-></span> unit) <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> printDepth : int <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> printIndent : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> fastMode : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> flushOften : bool <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> countNewLines : int <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> auto_printer : string <span class="keywordsign">-></span> <span class="keywordsign">'</span>a<br> +<span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/api/type_Stats.html b/cil/doc/api/type_Stats.html new file mode 100644 index 0000000..77cd218 --- /dev/null +++ b/cil/doc/api/type_Stats.html @@ -0,0 +1,36 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of class methods" rel=Appendix href="index_methods.html"> +<link title="Index of classes" rel=Appendix href="index_classes.html"> +<link title="Index of class types" rel=Appendix href="index_class_types.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Index of module types" rel=Appendix href="index_module_types.html"> +<link title="Pretty" rel="Chapter" href="Pretty.html"> +<link title="Errormsg" rel="Chapter" href="Errormsg.html"> +<link title="Clist" rel="Chapter" href="Clist.html"> +<link title="Stats" rel="Chapter" href="Stats.html"> +<link title="Cil" rel="Chapter" href="Cil.html"> +<link title="Formatcil" rel="Chapter" href="Formatcil.html"> +<link title="Alpha" rel="Chapter" href="Alpha.html"> +<link title="Cillower" rel="Chapter" href="Cillower.html"> +<link title="Cfg" rel="Chapter" href="Cfg.html"> +<link title="Dataflow" rel="Chapter" href="Dataflow.html"> +<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Stats</title> +</head> +<body> +<code class="code"><span class="keyword">sig</span><br> + <span class="keyword">val</span> reset : bool <span class="keywordsign">-></span> unit<br> + <span class="keyword">exception</span> <span class="constructor">NoPerfCount</span><br> + <span class="keyword">val</span> has_performance_counters : unit <span class="keywordsign">-></span> bool<br> + <span class="keyword">val</span> sample_pentium_perfcount_20 : unit <span class="keywordsign">-></span> int<br> + <span class="keyword">val</span> sample_pentium_perfcount_10 : unit <span class="keywordsign">-></span> int<br> + <span class="keyword">val</span> time : string <span class="keywordsign">-></span> (<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>b) <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>b<br> + <span class="keyword">val</span> repeattime : float <span class="keywordsign">-></span> string <span class="keywordsign">-></span> (<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>b) <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>b<br> + <span class="keyword">val</span> print : <span class="constructor">Pervasives</span>.out_channel <span class="keywordsign">-></span> string <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> lastTime : float <span class="constructor">Pervasives</span>.ref<br> + <span class="keyword">val</span> timethis : (<span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>b) <span class="keywordsign">-></span> <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="keywordsign">'</span>b<br> +<span class="keyword">end</span></code></body></html>
\ No newline at end of file diff --git a/cil/doc/changes.html b/cil/doc/changes.html new file mode 100644 index 0000000..17ffdf7 --- /dev/null +++ b/cil/doc/changes.html @@ -0,0 +1,486 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +Changes +</TITLE> +</HEAD> +<BODY > +<A HREF="cil019.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc49">20</A> Changes</H2><A NAME="sec-changes"></A> +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<B>May 20, 2006</B>: <B>Released version 1.3.5</B> +<LI CLASS="li-itemize"><B>May 19, 2006</B>: <TT>Makefile.cil.in</TT>/<TT>Makefile.cil</TT> have + been renamed <TT>Makefile.in</TT>/<TT>Makefile</TT>. And <TT>maincil.ml</TT> has + been renamed <TT>main.ml</TT>. +<LI CLASS="li-itemize"><B>May 18, 2006</B>: Added a new module <A HREF="api/Cfg.html">Cfg</A> to compute the + control-flow graph. Unlike the older <A HREF="api/Cil.html#VALcomputeCFGInfo">Cil.computeCFGInfo</A>, + the new version does not modify the code. +<LI CLASS="li-itemize"><B>May 18, 2006</B>: Added several new analyses: reaching + definitions, available expressions, liveness analysis, and dead code + elimination. See Section <A HREF="ext.html#sec-Extension">8</A>. +<LI CLASS="li-itemize"><B>May 2, 2006</B>: Added a flag <TT>--noInsertImplicitCasts</TT>. + When this flag is used, CIL code will only include casts inserted by + the programmer. Implicit coercions are not changed to explicit casts. +<LI CLASS="li-itemize"><B>April 16, 2006</B>: Minor improvements to the <TT>--stats</TT> + flag (Section <A HREF="cil007.html#sec-cilly-asm-options">7.2</A>). We now use Pentium performance + counters by default, if your processor supports them. +<LI CLASS="li-itemize"><B>April 10, 2006</B>: Extended <TT>machdep.c</TT> to support + microcontroller compilers where the struct alignment of integer + types does not match the size of the type. Thanks to Nathan + Cooprider for the patch. +<LI CLASS="li-itemize"><B>April 6, 2006</B>: Fix for global initializers of unions when + the union field being initialized is not the first one, and for + missing initializers of unions when the first field is not the + largest field. +<LI CLASS="li-itemize"><B>April 6, 2006</B>: Fix for bitfields in the SFI module. +<LI CLASS="li-itemize"><B>April 6, 2006</B>: Various fixes for gcc attributes. + <TT>packed</TT>, <TT>section</TT>, and <TT>always_inline</TT> attributes are now + parsed correctly. Also fixed printing of attributes on enum types. +<LI CLASS="li-itemize"><B>March 30, 2006</B>: Fix for <TT>rmtemps.ml</TT>, which deletes + unused inline functions. When in <TT>gcc</TT> mode CIL now leaves all + inline functions in place, since <TT>gcc</TT> treats these as externally + visible. +<LI CLASS="li-itemize"><B>March 15, 2006</B>: Fix for <TT>typeof(<I>e</I>)</TT> when <I>e</I> has type + <TT>void</TT>. +<LI CLASS="li-itemize"><B>March 3, 2006</B>: Assume inline assembly instructions can + fall through for the purposes of adding return statements. Thanks to + Nathan Cooprider for the patch. +<LI CLASS="li-itemize"><B>February 27, 2006</B>: Fix for extern inline functions when + the output of CIL is fed back into CIL. +<LI CLASS="li-itemize"><B>January 30, 2006</B>: Fix parsing of <TT>switch</TT> without braces. +<LI CLASS="li-itemize"><B>January 30, 2006</B>: Allow `$' to appear in identifiers. +<LI CLASS="li-itemize"><B>January 13, 2006</B>: Added support for gcc's alias attribute + on functions. See Section <A HREF="cil016.html#sec-ugly-gcc">16.2</A>, item 8. +<LI CLASS="li-itemize"><B>December 9, 2005</B>: Christoph Spiel fixed the Golf and + Olf modules so that Golf can be used with the points-to analysis. + He also added performance fixes and cleaned up the documentation. +<LI CLASS="li-itemize"><B>December 1, 2005</B>: Major rewrite of the ext/callgraph module. +<LI CLASS="li-itemize"><B>December 1, 2005</B>: Preserve enumeration constants in CIL. Default +is the old behavior to replace them with integers. +<LI CLASS="li-itemize"><B>November 30, 2005</B>: Added support for many GCC <TT>__builtin</TT> + functions. +<LI CLASS="li-itemize"><B>November 30, 2005</B>: Added the EXTRAFEATURES configure + option, making it easier to add Features to the build process. +<LI CLASS="li-itemize"><B>November 23, 2005</B>: In MSVC mode do not remove any locals whose name + appears as a substring in an inline assembly. +<LI CLASS="li-itemize"><B>November 23, 2005</B>: Do not add a return to functions that have the + noreturn attribute. +<LI CLASS="li-itemize"><B>November 22, 2005</B>: <B>Released version 1.3.4</B> +<LI CLASS="li-itemize"><B>November 21, 2005</B>: Performance and correctness fixes for + the Points-to Analysis module. Thanks to Christoph Spiel for the + patches. +<LI CLASS="li-itemize"><B>October 5, 2005</B>: CIL now builds on SPARC/Solaris. Thanks + to Nick Petroni and Remco van Engelen for the patches. +<LI CLASS="li-itemize"><B>September 26, 2005</B>: CIL no longer uses the `<TT>-I-</TT>' flag + by default when preprocessing with gcc. +<LI CLASS="li-itemize"><B>August 24, 2005</B>: Added a command-line option + “--forceRLArgEval” that forces function arguments to be evaluated + right-to-left. This is the default behavior in unoptimized gcc and + MSVC, but the order of evaluation is undefined when using + optimizations, unless you apply this CIL transformation. This flag + does not affect the order of evaluation of e.g. binary operators, + which remains undefined. Thanks to Nathan Cooprider for the patch. +<LI CLASS="li-itemize"><B>August 9, 2005</B>: Fixed merging when there are more than 20 + input files. +<LI CLASS="li-itemize"><B>August 3, 2005</B>: When merging, it is now an error to + declare the same global variable twice with different initializers. +<LI CLASS="li-itemize"><B>July 27, 2005</B>: Fixed bug in transparent unions. +<LI CLASS="li-itemize"><B>July 27, 2005</B>: Fixed bug in collectInitializer. Thanks to + Benjamin Monate for the patch. +<LI CLASS="li-itemize"><B>July 26, 2005</B>: Better support for extended inline assembly + in gcc. +<LI CLASS="li-itemize"><B>July 26, 2005</B>: Added many more gcc __builtin* functions + to CIL. Most are treated as Call instructions, but a few are + translated into expressions so that they can be used in global + initializers. For example, “<TT>__builtin_offsetof(t, field)</TT>” is + rewritten as “<TT>&((t*)0)->field</TT>”, the traditional way of calculating + an offset. +<LI CLASS="li-itemize"><B>July 18, 2005</B>: Fixed bug in the constant folding of shifts + when the second argument was negative or too large. +<LI CLASS="li-itemize"><B>July 18, 2005</B>: Fixed bug where casts were not always + inserted in function calls. +<LI CLASS="li-itemize"><B>June 10, 2005</B>: Fixed bug in the code that makes implicit + returns explicit. We weren't handling switch blocks correctly. +<LI CLASS="li-itemize"><B>June 1, 2005</B>: <B>Released version 1.3.3</B> +<LI CLASS="li-itemize"><B>May 31, 2005</B>: Fixed handling of noreturn attribute for function + pointers. +<LI CLASS="li-itemize"><B>May 30, 2005</B>: Fixed bugs in the handling of constructors in gcc. +<LI CLASS="li-itemize"><B>May 30, 2005</B>: Fixed bugs in the generation of global variable IDs. +<LI CLASS="li-itemize"><B>May 27, 2005</B>: Reimplemented the translation of function calls so + that we can intercept some builtins. This is important for the uses of + __builtin_constant_p in constants. +<LI CLASS="li-itemize"><B>May 27, 2005</B>: Export the plainCilPrinter, for debugging. +<LI CLASS="li-itemize"><B>May 27, 2005</B>: Fixed bug with printing of const attribute for + arrays. +<LI CLASS="li-itemize"><B>May 27, 2005</B>: Fixed bug in generation of type signatures. Now they + should not contain expressions anymore, so you can use structural equality. + This used to lead to Out_of_Memory exceptions. +<LI CLASS="li-itemize"><B>May 27, 2005</B>: Fixed bug in type comparisons using + TBuiltin_va_list. +<LI CLASS="li-itemize"><B>May 27, 2005</B>: Improved the constant folding in array lengths and + case expressions. +<LI CLASS="li-itemize"><B>May 27, 2005</B>: Added the <TT>__builtin_frame_address</TT> to the set + of gcc builtins. +<LI CLASS="li-itemize"><B>May 27, 2005</B>: Added the CIL project to SourceForge. +<LI CLASS="li-itemize"><B>April 23, 2005</B>: The cattr field was not visited. +<LI CLASS="li-itemize"><B>March 6, 2005</B>: Debian packaging support +<LI CLASS="li-itemize"><B>February 16, 2005</B>: Merger fixes. +<LI CLASS="li-itemize"><B>February 11, 2005</B>: Fixed a bug in <TT>--dopartial</TT>. Thanks to +Nathan Cooprider for this fix. +<LI CLASS="li-itemize"><B>January 31, 2005</B>: Make sure the input file is closed even if a + parsing error is encountered. +<LI CLASS="li-itemize"><B>January 11, 2005</B>: <B>Released version 1.3.2</B> +<LI CLASS="li-itemize"><B>January 11, 2005</B>: Fixed printing of integer constants whose + integer kind is shorter than an int. +<LI CLASS="li-itemize"><B>January 11, 2005</B>: Added checks for negative size arrays and arrays + too big. +<LI CLASS="li-itemize"><B>January 10, 2005</B>: Added support for GCC attribute “volatile” for + tunctions (as a synonim for noreturn). +<LI CLASS="li-itemize"><B>January 10, 2005</B>: Improved the comparison of array sizes when + comparing array types. +<LI CLASS="li-itemize"><B>January 10, 2005</B>: Fixed handling of shell metacharacters in the + cilly command lione. +<LI CLASS="li-itemize"><B>January 10, 2005</B>: Fixed dropping of cast in initialization of + local variable with the result of a function call. +<LI CLASS="li-itemize"><B>January 10, 2005</B>: Fixed some structural comparisons that were + broken in the Ocaml 3.08. +<LI CLASS="li-itemize"><B>January 10, 2005</B>: Fixed the <TT>unrollType</TT> function to not forget + attributes. +<LI CLASS="li-itemize"><B>January 10, 2005</B>: Better keeping track of locations of function + prototypes and definitions. +<LI CLASS="li-itemize"><B>January 10, 2005</B>: Fixed bug with the expansion of enumeration + constants in attributes. +<LI CLASS="li-itemize"><B>October 18, 2004</B>: Fixed a bug in cabsvisit.ml. CIl would wrap a + BLOCK around a single atom unnecessarily. +<LI CLASS="li-itemize"><B>August 7, 2004</B>: <B>Released version 1.3.1</B> +<LI CLASS="li-itemize"><B>August 4, 2004</B>: Fixed a bug in splitting of structs using + <TT>--dosimplify</TT> +<LI CLASS="li-itemize"><B>July 29, 2004</B>: Minor changes to the type typeSig (type signatures) + to ensure that they do not contain types, so that you can do structural + comparison without danger of nontermination. +<LI CLASS="li-itemize"><B>July 28, 2004</B>: Ocaml version 3.08 is required. Numerous small + changes while porting to Ocaml 3.08. +<LI CLASS="li-itemize"><B>July 7, 2004</B>: <B>Released version 1.2.6</B> +<LI CLASS="li-itemize"><B>July 2, 2004</B>: Character constants such as <TT>'c'</TT> should + have type <TT>int</TT>, not <TT>char</TT>. Added a utility function + <TT>Cil.charConstToInt</TT> that sign-extends chars greater than 128, if needed. +<LI CLASS="li-itemize"><B>July 2, 2004</B>: Fixed a bug that was casting values to int + before applying the logical negation operator !. This caused + problems for floats, and for integer types bigger than <TT>int</TT>. +<LI CLASS="li-itemize"><B>June 13, 2004</B>: Added the field <TT>sallstmts</TT> to a function + description, to hold all statements in the function. +<LI CLASS="li-itemize"><B>June 13, 2004</B>: Added new extensions for data flow analyses, and + for computing dominators. +<LI CLASS="li-itemize"><B>June 10, 2004</B>: Force initialization of CIL at the start of +Cabs2cil. +<LI CLASS="li-itemize"><B>June 9, 2004</B>: Added support for GCC <TT>__attribute_used__</TT> +<LI CLASS="li-itemize"><B>April 7, 2004</B>: <B>Released version 1.2.5</B> +<LI CLASS="li-itemize"><B>April 7, 2004</B>: Allow now to run ./configure CC=cl and set the MSVC +compiler to be the default. The MSVC driver will now select the default name +of the .exe file like the CL compiler. +<LI CLASS="li-itemize"><B>April 7, 2004</B>: Fixed a bug in the driver. The temporary files are +deleted by the Perl script before the CL compiler gets to them? +<LI CLASS="li-itemize"><B>April 7, 2004</B>: Added the - form of arguments to the MSVC driver. +<LI CLASS="li-itemize"><B>April 7, 2004</B>: Added a few more GCC-specific string escapes, (, [, +{, %, E. +<LI CLASS="li-itemize"><B>April 7, 2004</B>: Fixed bug with continuation lines in MSVC. +<LI CLASS="li-itemize"><B>April 6, 2004</B>: Fixed embarassing bug in the parser: the precedence + of casts and unary operators was switched. +<LI CLASS="li-itemize"><B>April 5, 2004</B>: Fixed a bug involving statements mixed between +declarations containing initializers. Now we make sure that the initializers +are run in the proper order with respect to the statements. +<LI CLASS="li-itemize"><B>April 5, 2004</B>: Fixed a bug in the merger. The merger was keeping +separate alpha renaming talbes (namespaces) for variables and types. This +means that it might end up with a type and a variable named the same way, if +they come from different files, which breaks an important CIL invariant. +<LI CLASS="li-itemize"><B>March 11, 2004</B> : Fixed a bug in the Cil.copyFunction function. The +new local variables were not getting fresh IDs. +<LI CLASS="li-itemize"><B>March 5, 2004</B>: Fixed a bug in the handling of static function + prototypes in a block scope. They used to be renamed. Now we just consider + them global. +<LI CLASS="li-itemize"><B>February 20, 2004</B>: <B>Released version 1.2.4</B> +<LI CLASS="li-itemize"><B>February 15, 2004</B>: Changed the parser to allow extra semicolons + after field declarations. +<LI CLASS="li-itemize"><B>February 14, 2004</B>: Changed the Errormsg functions: error, unimp, +bug to not raise an exception. Instead they just set Errormsg.hadErrors. +<LI CLASS="li-itemize"><B>February 13, 2004</B>: Change the parsing of attributes to recognize + enumeration constants. +<LI CLASS="li-itemize"><B>February 10, 2004</B>: In some versions of <TT>gcc</TT> the identifier + _{thread is an identifier and in others it is a keyword. Added code + during configuration to detect which is the case. +<LI CLASS="li-itemize"><B>January 7, 2004</B>: <B>Released version 1.2.3</B> +<LI CLASS="li-itemize"><B>January 7, 2004</B>: Changed the alpha renamer to be less +conservative. It will remember all versions of a name that were seen and will +only create a new name if we have not seen one. +<LI CLASS="li-itemize"><B>December 30, 2003</B> : Extended the <TT>cilly</TT> command to understand + better linker command options <TT>-lfoo</TT>. +<LI CLASS="li-itemize"><B>December 5, 2003</B>: Added markup commands to the pretty-printer +module. Also, changed the “@<” left-flush command into “@''. +<LI CLASS="li-itemize"><B>December 4, 2003</B>: Wide string literals are now handled +directly by Cil (rather than being exploded into arrays). This is +apparently handy for Microsoft Device Driver APIs that use intrinsic +functions that require literal constant wide-string arguments. +<LI CLASS="li-itemize"><B>December 3, 2003</B>: Added support for structured exception handling + extensions for the Microsoft compilers. +<LI CLASS="li-itemize"><B>December 1, 2003</B>: Fixed a Makefile bug in the generation of the +Cil library (e.g., <TT>cil.cma</TT>) that was causing it to be unusable. Thanks +to KEvin Millikin for pointing out this bug. +<LI CLASS="li-itemize"><B>November 26, 2003</B>: Added support for linkage specifications + (extern “C”). +<LI CLASS="li-itemize"><B>November 26, 2003</B>: Added the ocamlutil directory to contain some +utilities shared with other projects. +<LI CLASS="li-itemize"><B>November 25, 2003</B>: <B>Released version 1.2.2</B> +<LI CLASS="li-itemize"><B>November 24, 2003</B>: Fixed a bug that allowed a static local to + conflict with a global with the same name that is declared later in the + file. +<LI CLASS="li-itemize"><B>November 24, 2003</B>: Removed the <TT>--keep</TT> option of the <TT>cilly</TT> + driver and replaced it with <TT>--save-temps</TT>. +<LI CLASS="li-itemize"><B>November 24, 2003</B>: Added printing of what CIL features are being + run. +<LI CLASS="li-itemize"><B>November 24, 2003</B>: Fixed a bug that resulted in attributes being + dropped for integer types. +<LI CLASS="li-itemize"><B>November 11, 2003</B>: Fixed a bug in the visitor for enumeration + definitions. +<LI CLASS="li-itemize"><B>October 24, 2003</B>: Fixed a problem in the configuration script. It + was not recognizing the Ocaml version number for beta versions. +<LI CLASS="li-itemize"><B>October 15, 2003</B>: Fixed a problem in version 1.2.1 that was + preventing compilation on OCaml 3.04. +<LI CLASS="li-itemize"><B>September 17, 2003: Released version 1.2.1.</B> +<LI CLASS="li-itemize"><B>September 7, 2003</B>: Redesigned the interface for choosing + <TT>#line</TT> directive printing styles. Cil.printLn and + Cil.printLnComment have been merged into Cil.lineDirectiveStyle. +<LI CLASS="li-itemize"><B>August 8, 2003</B>: Do not silently pad out functions calls with +arguments to match the prototype. +<LI CLASS="li-itemize"><B>August 1, 2003</B>: A variety of fixes suggested by Steve Chamberlain: +initializers for externs, prohibit float literals in enum, initializers for +unsized arrays were not working always, an overflow problem in Ocaml, changed +the processing of attributes before struct specifiers<BR> +<BR> +<LI CLASS="li-itemize"><B>July 14, 2003</B>: Add basic support for GCC's "__thread" storage +qualifier. If given, it will appear as a "thread" attribute at the top of the +type of the declared object. Treatment is very similar to "__declspec(...)" +in MSVC<BR> +<BR> +<LI CLASS="li-itemize"><B>July 8, 2003</B>: Fixed some of the __alignof computations. Fixed + bug in the designated initializers for arrays (Array.get error). +<LI CLASS="li-itemize"><B>July 8, 2003</B>: Fixed infinite loop bug (Stack Overflow) in the + visitor for __alignof. +<LI CLASS="li-itemize"><B>July 8, 2003</B>: Fixed bug in the conversion to CIL. A function or + array argument of + the GCC __typeof() was being converted to pointer type. Instead, it should + be left alone, just like for sizeof. +<LI CLASS="li-itemize"><B>July 7, 2003</B>: New Escape module provides utility functions + for escaping characters and strings in accordance with C lexical + rules.<BR> +<BR> +<LI CLASS="li-itemize"><B>July 2, 2003</B>: Relax CIL's rules for when two enumeration types are +considered compatible. Previously CIL considered two enums to be compatible if +they were the same enum. Now we follow the C99 standard.<BR> +<BR> +<LI CLASS="li-itemize"><B>June 28, 2003</B>: In the Formatparse module, Eric Haugh found and + fixed a bug in the handling of lvalues of the form “lv->field.more”.<BR> +<BR> +<LI CLASS="li-itemize"><B>June 28, 2003</B>: Extended the handling of gcc command lines +arguments in the Perl scripts. <BR> +<BR> +<LI CLASS="li-itemize"><B>June 23, 2003</B>: In Rmtmps module, simplified the API for + customizing the root set. Clients may supply a predicate that + returns true for each root global. Modifying various + “<TT>referenced</TT>” fields directly is no longer supported.<BR> +<BR> +<LI CLASS="li-itemize"><B>June 17, 2003</B>: Reimplement internal utility routine + <TT>Cil.escape_char</TT>. Faster and better. <BR> +<BR> +<LI CLASS="li-itemize"><B>June 14, 2003</B>: Implemented support for <TT>__attribute__s</TT> +appearing between "struct" and the struct tag name (also for unions and +enums), since gcc supports this as documented in section 4.30 of the gcc +(2.95.3) manual<BR> +<BR> +<LI CLASS="li-itemize"><B>May 30, 2003</B>: Released the regression tests. +<LI CLASS="li-itemize"><B>May 28, 2003</B>: <B>Released version 1.1.2</B> +<LI CLASS="li-itemize"><B>May 26, 2003</B>: Add the <TT>simplify</TT> module that compiles CIL +expressions into simpler expressions, similar to those that appear in a +3-address intermediate language. +<LI CLASS="li-itemize"><B>May 26, 2003</B>: Various fixes and improvements to the pointer +analysis modules. +<LI CLASS="li-itemize"><B>May 26, 2003</B>: Added optional consistency checking for +transformations. +<LI CLASS="li-itemize"><B>May 25, 2003</B>: Added configuration support for big endian machines. +Now <A HREF="api/Cil.html#VALlittle_endian">Cil.little_endian</A> can be used to test whether the machine is +little endian or not. +<LI CLASS="li-itemize"><B>May 22, 2003</B>: Fixed a bug in the handling of inline functions. The +CIL merger used to turn these functions into “static”, which is incorrect. +<LI CLASS="li-itemize"><B>May 22, 2003</B>: Expanded the CIL consistency checker to verify +undesired sharing relationships between data structures. +<LI CLASS="li-itemize"><B>May 22, 2003</B>: Fixed bug in the <TT>oneret</TT> CIL module: it was +mishandling certain labeled return statements. +<LI CLASS="li-itemize"><B>May 5, 2003</B>: <B>Released version 1.0.11</B> +<LI CLASS="li-itemize"><B>May 5, 2003</B>: OS X (powerpc/darwin) support for CIL. Special +thanks to Jeff Foster, Andy Begel and Tim Leek. +<LI CLASS="li-itemize"><B>April 30, 2003</B>: Better description of how to use CIL for your +analysis. +<LI CLASS="li-itemize"><B>April 28, 2003</B>: Fixed a bug with <TT>--dooneRet</TT> and +<TT>--doheapify</TT>. Thanks, Manos Renieris. +<LI CLASS="li-itemize"><B>April 16, 2003</B>: Reworked management of + temporary/intermediate output files in Perl driver scripts. Default + behavior is now to remove all such files. To keep intermediate + files, use one of the following existing flags: + <UL CLASS="itemize"><LI CLASS="li-itemize"> + <TT>--keepmerged</TT> for the single-file merge of all sources + <LI CLASS="li-itemize"><TT>--keep=<<I>dir</I></TT><TT>></TT> for various other CIL and + CCured output files + <LI CLASS="li-itemize"><TT>--save-temps</TT> for various gcc intermediate files; MSVC + has no equivalent option + </UL> + As part of this change, some intermediate files have changed their + names slightly so that new suffixes are always preceded by a + period. For example, CCured output that used to appear in + “<TT>foocured.c</TT>” now appears in “<TT>foo.cured.c</TT>”. +<LI CLASS="li-itemize"><B>April 7, 2003</B>: Changed the representation of the <A HREF="api/Cil.html#VALGVar">Cil.GVar</A> +global constructor. Now it is possible to update the initializer without +reconstructing the global (which in turn it would require reconstructing the +list of globals that make up a program). We did this because it is often +tempting to use <A HREF="api/Cil.html#VALvisitCilFileSameGlobals">Cil.visitCilFileSameGlobals</A> and the <A HREF="api/Cil.html#VALGVar">Cil.GVar</A> +was the only global that could not be updated in place. +<LI CLASS="li-itemize"><B>April 6, 2003</B>: Reimplemented parts of the cilly.pl script to make +it more robust in the presence of complex compiler arguments. +<LI CLASS="li-itemize"><B>March 10, 2003</B>: <B>Released version 1.0.9</B> +<LI CLASS="li-itemize"><B>March 10, 2003</B>: Unified and documented a large number of CIL +Library Modules: oneret, simplemem, makecfg, heapify, stackguard, partial. +Also documented the main client interface for the pointer analysis. +<LI CLASS="li-itemize"><B>February 18, 2003</B>: Fixed a bug in logwrites that was causing it +to produce invalid C code on writes to bitfields. Thanks, David Park. +<LI CLASS="li-itemize"><B>February 15, 2003</B>: <B>Released version 1.0.8</B> +<LI CLASS="li-itemize"><B>February 15, 2003</B>: PDF versions of the manual and API are +available for those who would like to print them out. +<LI CLASS="li-itemize"><B>February 14, 2003</B>: CIL now comes bundled with alias analyses. +<LI CLASS="li-itemize"><B>February 11, 2003</B>: Added support for adding/removing options from + <TT>./configure</TT>. +<LI CLASS="li-itemize"><B>February 3, 2003</B>: <B>Released version 1.0.7</B> +<LI CLASS="li-itemize"><B>February 1, 2003</B>: Some bug fixes in the handling of variable +argument functions in new versions of <TT>gcc</TT> And <TT>glibc</TT>. +<LI CLASS="li-itemize"><B>January 29, 2003</B>: Added the logical AND and OR operators. +Exapanded the translation to CIL to handle more complicated initializers +(including those that contain logical operators). +<LI CLASS="li-itemize"><B>January 28, 2003</B>: <B>Released version 1.0.6</B> +<LI CLASS="li-itemize"><B>January 28, 2003</B>: Added support for the new handling of +variable-argument functions in new versions of <TT>glibc</TT>. +<LI CLASS="li-itemize"><B>January 19, 2003</B>: Added support for declarations in interpreted + constructors. Relaxed the semantics of the patterns for variables. +<LI CLASS="li-itemize"><B>January 17, 2003</B>: Added built-in prototypes for the gcc built-in + functions. Changed the <TT>pGlobal</TT> method in the printers to print the + carriage return as well. +<LI CLASS="li-itemize"><B>January 9, 2003</B>: Reworked lexer and parser's strategy for + tracking source file names and line numbers to more closely match + typical native compiler behavior. The visible CIL interface is + unchanged. +<LI CLASS="li-itemize"><B>January 9, 2003</B>: Changed the interface to the alpha convertor. Now +you can pass a list where it will record undo information that you can use to +revert the changes that it makes to the scope tables. +<LI CLASS="li-itemize"><B>January 6, 2003</B>: <B>Released version 1.0.5</B> +<LI CLASS="li-itemize"><B>January 4, 2003</B>: Changed the interface for the Formatcil module. + Now the placeholders in the pattern have names. Also expanded the + documentation of the Formatcil module. + Now the placeholders in the pattern have names. +<LI CLASS="li-itemize"><B>January 3, 2003</B>: Extended the <TT>rmtmps</TT> module to also remove + unused labels that are generated in the conversion to CIL. This reduces the + number of warnings that you get from <TT>cgcc</TT> afterwards. +<LI CLASS="li-itemize"><B>December 17, 2002</B>: Fixed a few bugs in CIL related to the + representation of string literals. The standard says that a string literal + is an array. In CIL, a string literal has type pointer to character. This is + Ok, except as an argument of sizeof. To support this exception, we have + added to CIL the expression constructor SizeOfStr. This allowed us to fix + bugs with computing <TT>sizeof("foo bar")</TT> and <TT>sizeof((char*)"foo bar")</TT> + (the former is 8 and the latter is 4).<BR> +<BR> +<LI CLASS="li-itemize"><B>December 8, 2002</B>: Fixed a few bugs in the lexer and parser + relating to hex and octal escapes in string literals. Also fixed + the dependencies between the lexer and parser. +<LI CLASS="li-itemize"><B>December 5, 2002</B>: Fixed visitor bugs that were causing + some attributes not to be visited and some queued instructions to be + dropped. +<LI CLASS="li-itemize"><B>December 3, 2002</B>: Added a transformation to catch stack + overflows. Fixed the heapify transformation. +<LI CLASS="li-itemize"><B>October 14, 2002</B>: CIL is now available under the BSD license +(see the License section or the file LICENSE). <B>Released version 1.0.4</B> +<LI CLASS="li-itemize"><B>October 9, 2002</B>: More FreeBSD configuration changes, support +for the GCC-ims <TT>__signed</TT> and <TT>__volatile</TT>. Thanks to Axel +Simon for pointing out these problems. <B>Released version 1.0.3</B> +<LI CLASS="li-itemize"><B>October 8, 2002</B>: FreeBSD configuration and porting fixes. +Thanks to Axel Simon for pointing out these problems. +<LI CLASS="li-itemize"><B>September 10, 2002</B>: Fixed bug in conversion to CIL. Now we drop +all “const” qualifiers from the types of locals, even from the fields of +local structures or elements of arrays. +<LI CLASS="li-itemize"><B>September 7, 2002</B>: Extended visitor interface to distinguish visitng + offsets inside lvalues from offsets inside initializer lists. +<LI CLASS="li-itemize"><B>September 7, 2002</B>: <B>Released version 1.0.1</B> +<LI CLASS="li-itemize"><B>September 6, 2002</B>: Extended the patcher with the <TT>ateof</TT> flag. +<LI CLASS="li-itemize"><B>September 4, 2002</B>: Fixed bug in the elaboration to CIL. In some +cases constant folding of <TT>||</TT> and <TT>&&</TT> was computed wrong. +<LI CLASS="li-itemize"><B>September 3, 2002</B>: Fixed the merger documentation. +<LI CLASS="li-itemize"><B>August 29, 2002</B>: <B>Released version 1.0.0.</B> +<LI CLASS="li-itemize"><B>August 29, 2002</B>: Started numbering versions with a major nubmer, +minor and revisions. Released version 1.0.0. +<LI CLASS="li-itemize"><B>August 25, 2002</B>: Fixed the implementation of the unique +identifiers for global variables and composites. Now those identifiers are +globally unique. +<LI CLASS="li-itemize"><B>August 24, 2002</B>: Added to the machine-dependent configuration the +<TT>sizeofvoid</TT>. It is 1 on gcc and 0 on MSVC. Extended the implementation of +<TT>Cil.bitsSizeOf</TT> to handle this (it was previously returning an error when +trying to compute the size of <TT>void</TT>). +<LI CLASS="li-itemize"><B>August 24, 2002</B>: Changed the representation of structure and +unions to distinguish between undefined structures and those that are defined +to be empty (allowed on gcc). The sizeof operator is undefined for the former +and returns 0 for the latter. +<LI CLASS="li-itemize"><B>August 22, 2002</B>: Apply a patch from Richard H. Y. to support +FreeBSD installations. Thanks, Richard! +<LI CLASS="li-itemize"><B>August 12, 2002</B>: Fixed a bug in the translation of wide-character +strings. Now this translation matches that of the underlying compiler. Changed +the implementation of the compiler dependencies. +<LI CLASS="li-itemize"><B>May 25, 2002</B>: Added interpreted constructors and destructors. +<LI CLASS="li-itemize"><B>May 17, 2002</B>: Changed the representation of functions to move the +“inline” information to the varinfo. This way we can print the “inline” +even in declarations which is what gcc does. +<LI CLASS="li-itemize"><B>May 15, 2002</B>: Changed the visitor for initializers to make two +tail-recursive passes (the second is a <TT>List.rev</TT> and only done if one of +the initializers change). This prevents <TT>Stack_Overflow</TT> for large +initializers. Also improved the processing of initializers when converting to +CIL. +<LI CLASS="li-itemize"><B>May 15, 2002</B>: Changed the front-end to allow the use of <TT>MSVC</TT> +mode even on machines that do not have MSVC. The machine-dependent parameters +for GCC will be used in that case. +<LI CLASS="li-itemize"><B>May 11, 2002</B>: Changed the representation of formals in function +types. Now the function type is purely functional. +<LI CLASS="li-itemize"><B>May 4, 2002</B>: Added the function +<A HREF="api/Cil.html#VALvisitCilFileSameGlobals">Cil.visitCilFileSameGlobals</A> and changed <A HREF="api/Cil.html#VALvisitCilFile">Cil.visitCilFile</A> to be +tail recursive. This prevents stack overflow on huge files. +<LI CLASS="li-itemize"><B>February 28, 2002</B>: Changed the significance of the +<TT>CompoundInit</TT> in <A HREF="api/Cil.html#TYPEinit">Cil.init</A> to allow for missing initializers at the +end of an array initializer. Added the API function +<A HREF="api/Cil.html#VALfoldLeftCompoundAll">Cil.foldLeftCompoundAll</A>. +</UL> +<HR> +<A HREF="cil019.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +</BODY> +</HTML> diff --git a/cil/doc/cil.css b/cil/doc/cil.css new file mode 100644 index 0000000..7466cf4 --- /dev/null +++ b/cil/doc/cil.css @@ -0,0 +1,10 @@ + +.toc{list-style:none;} +.title{margin:auto;text-align:center} +.center{text-align:center;margin-left:auto;margin-right:auto;} +.flushleft{text-align:left;margin-left:0ex;margin-right:auto;} +.flushright{text-align:right;margin-left:auto;margin-right:0ex;} +DIV TABLE{margin-left:inherit;margin-right:inherit;} +PRE{text-align:left;margin-left:0ex;margin-right:auto;} +BLOCKQUOTE{margin-left:4ex;margin-right:4ex;text-align:left;} +.part{margin:auto;text-align:center} diff --git a/cil/doc/cil.html b/cil/doc/cil.html new file mode 100644 index 0000000..4d912d3 --- /dev/null +++ b/cil/doc/cil.html @@ -0,0 +1,3532 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> + +<HEAD> + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> +<STYLE type="text/css"> +.toc{list-style:none;} +.title{margin:auto;text-align:center} +.center{text-align:center;margin-left:auto;margin-right:auto;} +.flushleft{text-align:left;margin-left:0ex;margin-right:auto;} +.flushright{text-align:right;margin-left:auto;margin-right:0ex;} +DIV TABLE{margin-left:inherit;margin-right:inherit;} +PRE{text-align:left;margin-left:0ex;margin-right:auto;} +BLOCKQUOTE{margin-left:4ex;margin-right:4ex;text-align:left;} +.part{margin:auto;text-align:center} +</STYLE> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +</HEAD> + +<BODY > +<!--HEVEA command line is: /usr/bin/hevea -exec xxdate.exe ../../cilpp --> +<!--HTMLHEAD--> +<!--ENDHTML--> +<!--PREFIX <ARG ></ARG>--> +<!--CUT DEF section 1 --> + + + +<TABLE CLASS="title"> +<TR><TD></TD> +</TR></TABLE><BR> +<!--TOC section Introduction--> + +<H2 CLASS="section"><A NAME="htoc1">1</A> Introduction</H2><!--SEC END --> + +New: CIL now has a Source Forge page: + <A HREF="javascript:loadTop('http://sourceforge.net/projects/cil')">http://sourceforge.net/projects/cil</A>. <BR> +<BR> +CIL (<B>C</B> <B>I</B>ntermediate <B>L</B>anguage) is a high-level representation +along with a set of tools that permit easy analysis and source-to-source +transformation of C programs.<BR> +<BR> +CIL is both lower-level than abstract-syntax trees, by clarifying ambiguous +constructs and removing redundant ones, and also higher-level than typical +intermediate languages designed for compilation, by maintaining types and a +close relationship with the source program. The main advantage of CIL is that +it compiles all valid C programs into a few core constructs with a very clean +semantics. Also CIL has a syntax-directed type system that makes it easy to +analyze and manipulate C programs. Furthermore, the CIL front-end is able to +process not only ANSI-C programs but also those using Microsoft C or GNU C +extensions. If you do not use CIL and want instead to use just a C parser and +analyze programs expressed as abstract-syntax trees then your analysis will +have to handle a lot of ugly corners of the language (let alone the fact that +parsing C itself is not a trivial task). See Section <A HREF="#sec-simplec">16</A> for some +examples of such extreme programs that CIL simplifies for you.<BR> +<BR> +In essence, CIL is a highly-structured, “clean” subset of C. CIL features a +reduced number of syntactic and conceptual forms. For example, all looping +constructs are reduced to a single form, all function bodies are given +explicit <TT>return</TT> statements, syntactic sugar like <TT>"->"</TT> is +eliminated and function arguments with array types become pointers. (For an +extensive list of how CIL simplifies C programs, see Section <A HREF="#sec-cabs2cil">4</A>.) +This reduces the number of cases that must be considered when manipulating a C +program. CIL also separates type declarations from code and flattens scopes +within function bodies. This structures the program in a manner more amenable +to rapid analysis and transformation. CIL computes the types of all program +expressions, and makes all type promotions and casts explicit. CIL supports +all GCC and MSVC extensions except for nested functions and complex numbers. +Finally, CIL organizes C's imperative features into expressions, instructions +and statements based on the presence and absence of side-effects and +control-flow. Every statement can be annotated with successor and predecessor +information. Thus CIL provides an integrated program representation that can +be used with routines that require an AST (e.g. type-based analyses and +pretty-printers), as well as with routines that require a CFG (e.g., dataflow +analyses). CIL also supports even lower-level representations (e.g., +three-address code), see Section <A HREF="#sec-Extension">8</A>. <BR> +<BR> +CIL comes accompanied by a number of Perl scripts that perform generally +useful operations on code: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +A <A HREF="#sec-driver">driver</A> which behaves as either the <TT>gcc</TT> or +Microsoft VC compiler and can invoke the preprocessor followed by the CIL +application. The advantage of this script is that you can easily use CIL and +the analyses written for CIL with existing make files. +<LI CLASS="li-itemize">A <A HREF="#sec-merger">whole-program merger</A> that you can use as a +replacement for your compiler and it learns all the files you compile when you +make a project and merges all of the preprocessed source files into a single +one. This makes it easy to do whole-program analysis. +<LI CLASS="li-itemize">A <A HREF="#sec-patcher">patcher</A> makes it easy to create modified +copies of the system include files. The CIL driver can then be told to use +these patched copies instead of the standard ones. +</UL> +CIL has been tested very extensively. It is able to process the SPECINT95 +benchmarks, the Linux kernel, GIMP and other open-source projects. All of +these programs are compiled to the simple CIL and then passed to <TT>gcc</TT> and +they still run! We consider the compilation of Linux a major feat especially +since Linux contains many of the ugly GCC extensions (see Section <A HREF="#sec-ugly-gcc">16.2</A>). +This adds to about 1,000,000 lines of code that we tested it on. It is also +able to process the few Microsoft NT device drivers that we have had access +to. CIL was tested against GCC's c-torture testsuite and (except for the tests +involving complex numbers and inner functions, which CIL does not currently +implement) CIL passes most of the tests. Specifically CIL fails 23 tests out +of the 904 c-torture tests that it should pass. GCC itself fails 19 tests. A +total of 1400 regression test cases are run automatically on each change to +the CIL sources.<BR> +<BR> +CIL is relatively independent on the underlying machine and compiler. When +you build it CIL will configure itself according to the underlying compiler. +However, CIL has only been tested on Intel x86 using the gcc compiler on Linux +and cygwin and using the MS Visual C compiler. (See below for specific +versions of these compilers that we have used CIL for.)<BR> +<BR> +The largest application we have used CIL for is +<A HREF="javascript:loadTop('../ccured/index.html')">CCured</A>, a compiler that compiles C code into +type-safe code by analyzing your pointer usage and inserting runtime checks in +the places that cannot be guaranteed statically to be type safe. <BR> +<BR> +You can also use CIL to “compile” code that uses GCC extensions (e.g. the +Linux kernel) into standard C code.<BR> +<BR> +CIL also comes accompanies by a growing library of extensions (see +Section <A HREF="#sec-Extension">8</A>). You can use these for your projects or as examples of +using CIL. <BR> +<BR> +<TT>PDF</TT> versions of <A HREF="CIL.pdf">this manual</A> and the +<A HREF="CIL-API.pdf">CIL API</A> are available. However, we recommend the +<TT>HTML</TT> versions because the postprocessed code examples are easier to +view. <BR> +<BR> +If you use CIL in your project, we would appreciate letting us know. If you +want to cite CIL in your research writings, please refer to the paper “CIL: +Intermediate Language and Tools for Analysis and Transformation of C +Programs” by George C. Necula, Scott McPeak, S.P. Rahul and Westley Weimer, +in “Proceedings of Conference on Compilier Construction”, 2002.<BR> +<BR> +<!--TOC section Installation--> + +<H2 CLASS="section"><A NAME="htoc2">2</A> Installation</H2><!--SEC END --> + +You will need OCaml release 3.08 or higher to build CIL. CIL has been tested +on Linux and on Windows (where it can behave at either Microsoft Visual C or +gcc).<BR> +<BR> +If you want to use CIL on Windows then you must get a complete installation +of <TT>cygwin</TT> and the source-code OCaml distribution and compile it yourself +using the cygwin tools (as opposed to getting the Win32 native-code version of +OCaml). If you have not done this before then take a look +<A HREF="../ccured/setup.html">here</A>. (Don't need to worry about <TT>cvs</TT> and +<TT>ssh</TT> unless you will need to use the master CVS repository for CIL.) +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> +Download the CIL <A HREF="distrib">distribution</A> (latest version is +<A HREF="distrib/cil-1.3.5.tar.gz"><TT>distrib/cil-1.3.5.tar.gz</TT></A>). See the Section <A HREF="#sec-changes">20</A> for recent changes to the CIL distribution. +<LI CLASS="li-enumerate">Unzip and untar the source distribution. This will create a directory + called <TT>cil</TT> whose structure is explained below.<BR> +<TT>tar xvfz cil-1.3.5.tar.gz</TT> +<LI CLASS="li-enumerate">Enter the <TT>cil</TT> directory and run the <TT>configure</TT> script and then + GNU make to build the distribution. If you are on Windows, at least the + <TT>configure</TT> step must be run from within <TT>bash</TT>.<BR> + <CODE>cd cil</CODE><BR> + <CODE>./configure</CODE><BR> + <CODE>make</CODE><BR> + <CODE>make quicktest</CODE><BR> +<LI CLASS="li-enumerate">You should now find <TT>cilly.asm.exe</TT> in a +subdirectory of <TT>obj</TT>. The name of the subdirectory is either <TT>x86_WIN32</TT> +if you are using <TT>cygwin</TT> on Windows or <TT>x86_LINUX</TT> if you are using +Linux (although you should be using instead the Perl wrapper <TT>bin/cilly</TT>). +Note that we do not have an <TT>install</TT> make target and you should use Cil +from the development directory. +<LI CLASS="li-enumerate">If you decide to use CIL, <B>please</B> +<A HREF="mailto:necula@cs.berkeley.edu">send us a note</A>. This will help recharge +our batteries after more than a year of development. And of course, do send us +your bug reports as well.</OL> +The <TT>configure</TT> script tries to find appropriate defaults for your system. +You can control its actions by passing the following arguments: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>CC=foo</TT> Specifies the path for the <TT>gcc</TT> executable. By default +whichever version is in the PATH is used. If <TT>CC</TT> specifies the Microsoft +<TT>cl</TT> compiler, then that compiler will be set as the default one. Otherwise, +the <TT>gcc</TT> compiler will be the default. +</UL> +CIL requires an underlying C compiler and preprocessor. CIL depends on the +underlying compiler and machine for the sizes and alignment of types.The +installation procedure for CIL queries the underlying compiler for +architecture and compiler dependent configuration parameters, such as the size +of a pointer or the particular alignment rules for structure fields. (This +means, of course, that you should re-run <TT>./configure</TT> when you move CIL to +another machine.)<BR> +<BR> +We have tested CIL on the following compilers: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +On Windows, <TT>cl</TT> compiler version 12.00.8168 (MSVC 6), + 13.00.9466 (MSVC .Net), and 13.10.3077 (MSVC .Net 2003). Run <TT>cl</TT> + with no arguments to get the compiler version. +<LI CLASS="li-itemize">On Windows, using <TT>cygwin</TT> and <TT>gcc</TT> version 2.95.3, 3.0, + 3.2, 3.3, and 3.4. +<LI CLASS="li-itemize">On Linux, using <TT>gcc</TT> version 2.95.3, 3.0, 3.2, 3.3, and 4.0. +</UL> +Others have successfully used CIL with Mac OS X (on both PowerPC and +x86), Solaris, and *BSD. If you make any changes to the build +system in order to run CIL on your platform, please send us a patch.<BR> +<BR> + <!--TOC section Distribution Contents--> + +<H2 CLASS="section"><A NAME="htoc3">3</A> Distribution Contents</H2><!--SEC END --> + +The file <A HREF="distrib/cil-1.3.5.tar.gz"><TT>distrib/cil-1.3.5.tar.gz</TT></A> +contains the complete source CIL distribution, +consisting of the following files:<BR> +<TABLE CELLSPACING=2 CELLPADDING=0> +<TR><TD ALIGN=left NOWRAP>Filename</TD> +<TD ALIGN=left NOWRAP>Description</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>Makefile.in</TT></TD> +<TD ALIGN=left NOWRAP><TT>configure</TT> source for the + Makefile that builds CIL</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>configure</TT></TD> +<TD ALIGN=left NOWRAP>The configure script</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>configure.in</TT></TD> +<TD ALIGN=left NOWRAP>The <TT>autoconf</TT> source for <TT>configure</TT></TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>config.guess</TT>, <TT>config.sub</TT>, <TT>install-sh</TT></TD> +<TD ALIGN=left NOWRAP>stuff required by + <TT>configure</TT></TD> +</TR> +<TR><TD ALIGN=left NOWRAP> </TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>doc/</TT></TD> +<TD ALIGN=left NOWRAP>HTML documentation of the CIL API</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>obj/</TT></TD> +<TD ALIGN=left NOWRAP>Directory that will contain the compiled + CIL modules and executables</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>bin/cilly.in</TT></TD> +<TD ALIGN=left NOWRAP>The <TT>configure</TT> source for a Perl script + that can be invoked with the + same arguments as either <TT>gcc</TT> or + Microsoft Visual C and will convert the + program to CIL, perform some simple + transformations, emit it and compile it as + usual.</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>lib/CompilerStub.pm</TT></TD> +<TD ALIGN=left NOWRAP>A Perl class that can be used to write code + that impersonates a compiler. <TT>cilly</TT> + uses it.</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>lib/Merger.pm</TT></TD> +<TD ALIGN=left NOWRAP>A subclass of <TT>CompilerStub.pm</TT> that can + be used to merge source files into a single + source file.<TT>cilly</TT> + uses it.</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>bin/patcher.in</TT></TD> +<TD ALIGN=left NOWRAP>A Perl script that applies specified patches + to standard include files.</TD> +</TR> +<TR><TD ALIGN=left NOWRAP> </TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/check.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>Checks the well-formedness of a CIL file</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/cil.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>Definition of CIL abstract syntax and + utilities for manipulating it</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/clist.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>Utilities for efficiently managing lists + that need to be concatenated often</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/errormsg.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>Utilities for error reporting</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/ext/heapify.ml</TT></TD> +<TD ALIGN=left NOWRAP>A CIL transformation that moves array local + variables from the stack to the heap</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/ext/logcalls.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>A CIL transformation that logs every + function call</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/ext/sfi.ml</TT></TD> +<TD ALIGN=left NOWRAP>A CIL transformation that can log every + memory read and write</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/frontc/clexer.mll</TT></TD> +<TD ALIGN=left NOWRAP>The lexer</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/frontc/cparser.mly</TT></TD> +<TD ALIGN=left NOWRAP>The parser</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/frontc/cabs.ml</TT></TD> +<TD ALIGN=left NOWRAP>The abstract syntax</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/frontc/cprint.ml</TT></TD> +<TD ALIGN=left NOWRAP>The pretty printer for CABS</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/frontc/cabs2cil.ml</TT></TD> +<TD ALIGN=left NOWRAP>The elaborator to CIL</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/main.ml</TT></TD> +<TD ALIGN=left NOWRAP>The <TT>cilly</TT> application</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/pretty.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>Utilities for pretty printing</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/rmtmps.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>A CIL tranformation that removes unused + types, variables and inlined functions</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/stats.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>Utilities for maintaining timing statistics</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/testcil.ml</TT></TD> +<TD ALIGN=left NOWRAP>A random test of CIL (against the resident + C compiler)</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/trace.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>Utilities useful for printing debugging + information</TD> +</TR> +<TR><TD ALIGN=left NOWRAP> </TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>ocamlutil/</TT></TD> +<TD ALIGN=left NOWRAP>Miscellaneous libraries that are not + specific to CIL.</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>ocamlutil/Makefile.ocaml</TT></TD> +<TD ALIGN=left NOWRAP>A file that is included by <TT>Makefile</TT></TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>ocamlutil/Makefile.ocaml.build</TT></TD> +<TD ALIGN=left NOWRAP>A file that is included by <TT>Makefile</TT></TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>ocamlutil/perfcount.c</TT></TD> +<TD ALIGN=left NOWRAP>C code that links with src/stats.ml + and reads Intel performance + counters.</TD> +</TR> +<TR><TD ALIGN=left NOWRAP> </TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>obj/@ARCHOS@/feature_config.ml</TT></TD> +<TD ALIGN=left NOWRAP>File generated by the Makefile + describing which extra “features” + to compile. See Section <A HREF="#sec-cil">5</A></TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>obj/@ARCHOS@/machdep.ml</TT></TD> +<TD ALIGN=left NOWRAP>File generated by the Makefile containing + information about your architecture, + such as the size of a pointer</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/machdep.c</TT></TD> +<TD ALIGN=left NOWRAP>C program that generates + <TT>machdep.ml</TT> files</TD> +</TR></TABLE><BR> +<!--TOC section Compiling C to CIL--> + +<H2 CLASS="section"><A NAME="htoc4">4</A> Compiling C to CIL</H2><!--SEC END --> +<A NAME="sec-cabs2cil"></A> +In this section we try to describe a few of the many transformations that are +applied to a C program to convert it to CIL. The module that implements this +conversion is about 5000 lines of OCaml code. In contrast a simple program +transformation that instruments all functions to keep a shadow stack of the +true return address (thus preventing stack smashing) is only 70 lines of code. +This example shows that the analysis is so much simpler because it has to +handle only a few simple C constructs and also because it can leverage on CIL +infrastructure such as visitors and pretty-printers.<BR> +<BR> +In no particular order these are a few of the most significant ways in which +C programs are compiled into CIL: +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> +CIL will eliminate all declarations for unused entities. This means that +just because your hello world program includes <TT>stdio.h</TT> it does not mean +that your analysis has to handle all the ugly stuff from <TT>stdio.h</TT>.<BR> +<BR> +<LI CLASS="li-enumerate">Type specifiers are interpreted and normalized: +<PRE CLASS="verbatim"><FONT COLOR=blue> +int long signed x; +signed long extern x; +long static int long y; + +// Some code that uses these declaration, so that CIL does not remove them +int main() { return x + y; } +</FONT></PRE> +See the <A HREF="examples/ex1.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Anonymous structure and union declarations are given a name. +<PRE CLASS="verbatim"><FONT COLOR=blue> + struct { int x; } s; +</FONT></PRE> +See the <A HREF="examples/ex2.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Nested structure tag definitions are pulled apart. This means that all +structure tag definitions can be found by a simple scan of the globals. +<PRE CLASS="verbatim"><FONT COLOR=blue> +struct foo { + struct bar { + union baz { + int x1; + double x2; + } u1; + int y; + } s1; + int z; +} f; +</FONT></PRE> +See the <A HREF="examples/ex3.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">All structure, union, enumeration definitions and the type definitions +from inners scopes are moved to global scope (with appropriate renaming). This +facilitates moving around of the references to these entities. +<PRE CLASS="verbatim"><FONT COLOR=blue> +int main() { + struct foo { + int x; } foo; + { + struct foo { + double d; + }; + return foo.x; + } +} +</FONT></PRE> +See the <A HREF="examples/ex4.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Prototypes are added for those functions that are called before being +defined. Furthermore, if a prototype exists but does not specify the type of +parameters that is fixed. But CIL will not be able to add prototypes for those +functions that are neither declared nor defined (but are used!). +<PRE CLASS="verbatim"><FONT COLOR=blue> + int f(); // Prototype without arguments + int f(double x) { + return g(x); + } + int g(double x) { + return x; + } +</FONT></PRE> +See the <A HREF="examples/ex5.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Array lengths are computed based on the initializers or by constant +folding. +<PRE CLASS="verbatim"><FONT COLOR=blue> + int a1[] = {1,2,3}; + int a2[sizeof(int) >= 4 ? 8 : 16]; +</FONT></PRE> +See the <A HREF="examples/ex6.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Enumeration tags are computed using constant folding: +<PRE CLASS="verbatim"><FONT COLOR=blue> +int main() { + enum { + FIVE = 5, + SIX, SEVEN, + FOUR = FIVE - 1, + EIGHT = sizeof(double) + } x = FIVE; + return x; +} + +</FONT></PRE> +See the <A HREF="examples/ex7.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Initializers are normalized to include specific initialization for the +missing elements: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int a1[5] = {1,2,3}; + struct foo { int x, y; } s1 = { 4 }; +</FONT></PRE> +See the <A HREF="examples/ex8.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Initializer designators are interpreted and eliminated. Subobjects are +properly marked with braces. CIL implements +the whole ISO C99 specification for initializer (neither GCC nor MSVC do) and +a few GCC extensions. +<PRE CLASS="verbatim"><FONT COLOR=blue> + struct foo { + int x, y; + int a[5]; + struct inner { + int z; + } inner; + } s = { 0, .inner.z = 3, .a[1 ... 2] = 5, 4, y : 8 }; +</FONT></PRE> +See the <A HREF="examples/ex9.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">String initializers for arrays of characters are processed +<PRE CLASS="verbatim"><FONT COLOR=blue> +char foo[] = "foo plus bar"; +</FONT></PRE> +See the <A HREF="examples/ex10.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">String constants are concatenated +<PRE CLASS="verbatim"><FONT COLOR=blue> +char *foo = "foo " " plus " " bar "; +</FONT></PRE> +See the <A HREF="examples/ex11.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Initializers for local variables are turned into assignments. This is in +order to separate completely the declarative part of a function body from the +statements. This has the unfortunate effect that we have to drop the <TT>const</TT> +qualifier from local variables ! +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x = 5; + struct foo { int f1, f2; } a [] = {1, 2, 3, 4, 5 }; +</FONT></PRE> +See the <A HREF="examples/ex12.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Local variables in inner scopes are pulled to function scope (with +appropriate renaming). Local scopes thus disappear. This makes it easy to find +and operate on all local variables in a function. +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x = 5; + int main() { + int x = 6; + { + int x = 7; + return x; + } + return x; + } +</FONT></PRE> +See the <A HREF="examples/ex13.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Global declarations in local scopes are moved to global scope: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x = 5; + int main() { + int x = 6; + { + static int x = 7; + return x; + } + return x; + } +</FONT></PRE> +See the <A HREF="examples/ex14.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Return statements are added for functions that are missing them. If the +return type is not a base type then a <TT>return</TT> without a value is added. +The guaranteed presence of return statements makes it easy to implement a +transformation that inserts some code to be executed immediately before +returning from a function. +<PRE CLASS="verbatim"><FONT COLOR=blue> + int foo() { + int x = 5; + } +</FONT></PRE> +See the <A HREF="examples/ex15.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">One of the most significant transformations is that expressions that +contain side-effects are separated into statements. +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x, f(int); + return (x ++ + f(x)); +</FONT></PRE> +See the <A HREF="examples/ex16.txt">CIL output</A> for this +code fragment<BR> +<BR> +Internally, the <TT>x ++</TT> statement is turned into an assignment which the +pretty-printer prints like the original. CIL has only three forms of basic +statements: assignments, function calls and inline assembly.<BR> +<BR> +<LI CLASS="li-enumerate">Shortcut evaluation of boolean expressions and the <TT>?:</TT> operator are +compiled into explicit conditionals: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x; + int y = x ? 2 : 4; + int z = x || y; + // Here we duplicate the return statement + if(x && y) { return 0; } else { return 1; } + // To avoid excessive duplication, CIL uses goto's for + // statement that have more than 5 instructions + if(x && y || z) { x ++; y ++; z ++; x ++; y ++; return z; } +</FONT></PRE> +See the <A HREF="examples/ex17.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">GCC's conditional expression with missing operands are also compiled +into conditionals: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int f();; + return f() ? : 4; +</FONT></PRE> +See the <A HREF="examples/ex18.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">All forms of loops (<TT>while</TT>, <TT>for</TT> and <TT>do</TT>) are compiled +internally as a single <TT>while(1)</TT> looping construct with explicit <TT>break</TT> +statement for termination. For simple <TT>while</TT> loops the pretty printer is +able to print back the original: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x, y; + for(int i = 0; i<5; i++) { + if(i == 5) continue; + if(i == 4) break; + i += 2; + } + while(x < 5) { + if(x == 3) continue; + x ++; + } +</FONT></PRE> +See the <A HREF="examples/ex19.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">GCC's block expressions are compiled away. (That's right there is an +infinite loop in this code.) +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x = 5, y = x; + int z = ({ x++; L: y -= x; y;}); + return ({ goto L; 0; }); +</FONT></PRE> +See the <A HREF="examples/ex20.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">CIL contains support for both MSVC and GCC inline assembly (both in one +internal construct)<BR> +<BR> +<LI CLASS="li-enumerate">CIL compiles away the GCC extension that allows many kinds of constructs +to be used as lvalues: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x, y, z; + return &(x ? y : z) - & (x ++, x); +</FONT></PRE> +See the <A HREF="examples/ex21.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">All types are computed and explicit casts are inserted for all +promotions and conversions that a compiler must insert:<BR> +<BR> +<LI CLASS="li-enumerate">CIL will turn old-style function definition (without prototype) into +new-style definitions. This will make the compiler less forgiving when +checking function calls, and will catch for example cases when a function is +called with too few arguments. This happens in old-style code for the purpose +of implementing variable argument functions.<BR> +<BR> +<LI CLASS="li-enumerate">Since CIL sees the source after preprocessing the code after CIL does +not contain the comments and the preprocessing directives.<BR> +<BR> +<LI CLASS="li-enumerate">CIL will remove from the source file those type declarations, local +variables and inline functions that are not used in the file. This means that +your analysis does not have to see all the ugly stuff that comes from the +header files: +<PRE CLASS="verbatim"><FONT COLOR=blue> +#include <stdio.h> + +typedef int unused_type; + +static char unused_static (void) { return 0; } + +int main() { + int unused_local; + printf("Hello world\n"); // Only printf will be kept from stdio.h +} +</FONT></PRE> +See the <A HREF="examples/ex22.txt">CIL output</A> for this +code fragment</OL> +<!--TOC section How to Use CIL--> + +<H2 CLASS="section"><A NAME="htoc5">5</A> How to Use CIL</H2><!--SEC END --> +<A NAME="sec-cil"></A><!--NAME cilly.html--> +<BR> +<BR> +There are two predominant ways to use CIL to write a program analysis or +transformation. The first is to phrase your analysis as a module that is +called by our existing driver. The second is to use CIL as a stand-alone +library. We highly recommend that you use <TT>cilly</TT>, our driver. <BR> +<BR> +<!--TOC subsection Using <TT>cilly</TT>, the CIL driver--> + +<H3 CLASS="subsection"><A NAME="htoc6">5.1</A> Using <TT>cilly</TT>, the CIL driver</H3><!--SEC END --> + +The most common way to use CIL is to write an Ocaml module containing your +analysis and transformation, which you then link into our boilerplate +driver application called <TT>cilly</TT>. <TT>cilly</TT> is a Perl script that +processes and mimics <TT>GCC</TT> and <TT>MSVC</TT> command-line arguments and then +calls <TT>cilly.byte.exe</TT> or <TT>cilly.asm.exe</TT> (CIL's Ocaml executable). <BR> +<BR> +An example of such module is <TT>logwrites.ml</TT>, a transformation that is +distributed with CIL and whose purpose is to instrument code to print the +addresses of memory locations being written. (We plan to release a +C-language interface to CIL so that you can write your analyses in C +instead of Ocaml.) See Section <A HREF="#sec-Extension">8</A> for a survey of other example +modules. <BR> +<BR> +Assuming that you have written <TT>/home/necula/logwrites.ml</TT>, +here is how you use it: +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">Modify <TT>logwrites.ml</TT> so that it includes a CIL “feature + descriptor” like this: +<PRE CLASS="verbatim"> +let feature : featureDescr = + { fd_name = "logwrites"; + fd_enabled = ref false; + fd_description = "generation of code to log memory writes"; + fd_extraopt = []; + fd_doit = + (function (f: file) -> + let lwVisitor = new logWriteVisitor in + visitCilFileSameGlobals lwVisitor f) + } +</PRE>The <TT>fd_name</TT> field names the feature and its associated + command-line arguments. The <TT>fd_enabled</TT> field is a <TT>bool ref</TT>. + “<TT>fd_doit</TT>” will be invoked if <TT>!fd_enabled</TT> is true after + argument parsing, so initialize the ref cell to true if you want + this feature to be enabled by default.<BR> +<BR> +When the user passes the <TT>--dologwrites</TT> + command-line option to <TT>cilly</TT>, the variable associated with the + <TT>fd_enabled</TT> flag is set and the <TT>fd_doit</TT> function is called + on the <TT>Cil.file</TT> that represents the merger (see Section <A HREF="#sec-merger">13</A>) of + all C files listed as arguments. <BR> +<BR> +<LI CLASS="li-enumerate">Invoke <TT>configure</TT> with the arguments +<PRE CLASS="verbatim"> +./configure EXTRASRCDIRS=/home/necula EXTRAFEATURES=logwrites +</PRE> + This step works if each feature is packaged into its own ML file, and the +name of the entry point in the file is <TT>feature</TT>.<BR> +<BR> +An alternative way to specify the new features is to change the build files +yourself, as explained below. You'll need to use this method if a single +feature is split across multiple files. +<OL CLASS="enumerate" type=a><LI CLASS="li-enumerate"> + Put <TT>logwrites.ml</TT> in the <TT>src</TT> or <TT>src/ext</TT> directory. This + will make sure that <TT>make</TT> can find it. If you want to put it in some + other directory, modify <TT>Makefile.in</TT> and add to <TT>SOURCEDIRS</TT> your + directory. Alternately, you can create a symlink from <TT>src</TT> or + <TT>src/ext</TT> to your file.<BR> +<BR> +<LI CLASS="li-enumerate">Modify the <TT>Makefile.in</TT> and add your module to the + <TT>CILLY_MODULES</TT> or + <TT>CILLY_LIBRARY_MODULES</TT> variables. The order of the modules matters. Add + your modules somewhere after <TT>cil</TT> and before <TT>main</TT>.<BR> +<BR> +<LI CLASS="li-enumerate">If you have any helper files for your module, add those to + the makefile in the same way. e.g.: +<PRE CLASS="verbatim"> +CILLY_MODULES = $(CILLY_LIBRARY_MODULES) \ + myutilities1 myutilities2 logwrites \ + main +</PRE> + Again, order is important: <TT>myutilities2.ml</TT> will be able to refer + to Myutilities1 but not Logwrites. If you have any ocamllex or ocamlyacc + files, add them to both <TT>CILLY_MODULES</TT> and either <TT>MLLS</TT> or + <TT>MLYS</TT>.<BR> +<BR> +<LI CLASS="li-enumerate">Modify <TT>main.ml</TT> so that your new feature descriptor appears in + the global list of CIL features. +<PRE CLASS="verbatim"> +let features : C.featureDescr list = + [ Logcalls.feature; + Oneret.feature; + Heapify.feature1; + Heapify.feature2; + makeCFGFeature; + Partial.feature; + Simplemem.feature; + Logwrites.feature; (* add this line to include the logwrites feature! *) + ] + @ Feature_config.features +</PRE> + Features are processed in the order they appear on this list. Put + your feature last on the list if you plan to run any of CIL's + built-in features (such as makeCFGfeature) before your own.</OL><BR> +Standard code in <TT>cilly</TT> takes care of adding command-line arguments, + printing the description, and calling your function automatically. + Note: do not worry about introducing new bugs into CIL by adding a single + line to the feature list. <BR> +<BR> +<LI CLASS="li-enumerate">Now you can invoke the <TT>cilly</TT> application on a preprocessed file, or + instead use the <TT>cilly</TT> driver which provides a convenient compiler-like + interface to <TT>cilly</TT>. See Section <A HREF="#sec-driver">7</A> for details using <TT>cilly</TT>. + Remember to enable your analysis by passing the right argument (e.g., + <TT>--dologwrites</TT>). </OL> +<!--TOC subsection Using CIL as a library--> + +<H3 CLASS="subsection"><A NAME="htoc7">5.2</A> Using CIL as a library</H3><!--SEC END --> + +CIL can also be built as a library that is called from your stand-alone +application. Add <TT>cil/src</TT>, <TT>cil/src/frontc</TT>, <TT>cil/obj/x86_LINUX</TT> +(or <TT>cil/obj/x86_WIN32</TT>) to your Ocaml project <TT>-I</TT> include paths. +Building CIL will also build the library <TT>cil/obj/*/cil.cma</TT> (or +<TT>cil/obj/*/cil.cmxa</TT>). You can then link your application against that +library. <BR> +<BR> +You can call the <TT>Frontc.parse: string -> unit -> Cil.file</TT> function with +the name of a file containing the output of the C preprocessor. +The <TT>Mergecil.merge: Cil.file list -> string -> Cil.file</TT> function merges +multiple files. You can then invoke your analysis function on the resulting +<TT>Cil.file</TT> data structure. You might want to call +<TT>Rmtmps.removeUnusedTemps</TT> first to clean up the prototypes and variables +that are not used. Then you can call the function <TT>Cil.dumpFile: +cilPrinter -> out_channel -> Cil.file -> unit</TT> to print the file to a +given output channel. A good <TT>cilPrinter</TT> to use is +<TT>defaultCilPrinter</TT>. <BR> +<BR> +Check out <TT>src/main.ml</TT> and <TT>bin/cilly</TT> for other good ideas +about high-level file processing. Again, we highly recommend that you just +our <TT>cilly</TT> driver so that you can avoid spending time re-inventing the +wheel to provide drop-in support for standard <TT>makefile</TT>s. <BR> +<BR> +Here is a concrete example of compiling and linking your project against +CIL. Imagine that your program analysis or transformation is contained in +the single file <TT>main.ml</TT>. +<PRE CLASS="verbatim"> +$ ocamlopt -c -I $(CIL)/obj/x86_LINUX/ main.ml +$ ocamlopt -ccopt -L$(CIL)/obj/x86_LINUX/ -o main unix.cmxa str.cmxa \ + $(CIL)/obj/x86_LINUX/cil.cmxa main.cmx +</PRE> +The first line compiles your analysis, the second line links it against CIL +(as a library) and the Ocaml Unix library. For more information about +compiling and linking Ocaml programs, see the Ocaml home page +at <A HREF="javascript:loadTop('http://caml.inria.fr/ocaml/')">http://caml.inria.fr/ocaml/</A>. <BR> +<BR> +In the next section we give an overview of the API that you can use +to write your analysis and transformation. <BR> +<BR> +<!--TOC section CIL API Documentation--> + +<H2 CLASS="section"><A NAME="htoc8">6</A> CIL API Documentation</H2><!--SEC END --> +<A NAME="sec-api"></A> +The CIL API is documented in the file <TT>src/cil.mli</TT>. We also have an +<A HREF="api/index.html">online documentation</A> extracted from <TT>cil.mli</TT>. We +index below the main types that are used to represent C programs in CIL: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<A HREF="api/index_types.html">An index of all types</A> +<LI CLASS="li-itemize"><A HREF="api/index_values.html">An index of all values</A> +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEfile">Cil.file</A> is the representation of a file. +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEglobal">Cil.global</A> is the representation of a global declaration or +definitions. Values for <A HREF="api/Cil.html#VALemptyFunction">operating on globals</A>. +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEtyp">Cil.typ</A> is the representation of a type. +Values for <A HREF="api/Cil.html#VALvoidType">operating on types</A>. +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEcompinfo">Cil.compinfo</A> is the representation of a structure or a union +type +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEfieldinfo">Cil.fieldinfo</A> is the representation of a field in a structure +or a union +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEenuminfo">Cil.enuminfo</A> is the representation of an enumeration type. +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEvarinfo">Cil.varinfo</A> is the representation of a variable +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEfundec">Cil.fundec</A> is the representation of a function +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPElval">Cil.lval</A> is the representation of an lvalue. +Values for <A HREF="api/Cil.html#VALmakeVarInfo">operating on lvalues</A>. +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEexp">Cil.exp</A> is the representation of an expression without +side-effects. +Values for <A HREF="api/Cil.html#VALzero">operating on expressions</A>. +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEinstr">Cil.instr</A> is the representation of an instruction (with +side-effects but without control-flow) +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEstmt">Cil.stmt</A> is the representation of a control-flow statements. +Values for <A HREF="api/Cil.html#VALmkStmt">operating on statements</A>. +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEattribute">Cil.attribute</A> is the representation of attributes. +Values for <A HREF="api/Cil.html#TYPEattributeClass">operating on attributes</A>. +</UL> +<!--TOC subsection Using the visitor--> + +<H3 CLASS="subsection"><A NAME="htoc9">6.1</A> Using the visitor</H3><!--SEC END --> +<A NAME="sec-visitor"></A> +One of the most useful tools exported by the CIL API is an implementation of +the visitor pattern for CIL programs. The visiting engine scans depth-first +the structure of a CIL program and at each node is queries a user-provided +visitor structure whether it should do one of the following operations: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +Ignore this node and all its descendants +<LI CLASS="li-itemize">Descend into all of the children and when done rebuild the node if any +of the children have changed. +<LI CLASS="li-itemize">Replace the subtree rooted at the node with another tree. +<LI CLASS="li-itemize">Replace the subtree with another tree, then descend into the children +and rebuild the node if necessary and then invoke a user-specified function. +<LI CLASS="li-itemize">In addition to all of the above actions then visitor can specify that +some instructions should be queued to be inserted before the current +instruction or statement being visited. +</UL> +By writing visitors you can customize the program traversal and +transformation. One major limitation of the visiting engine is that it does +not propagate information from one node to another. Each visitor must use its +own private data to achieve this effect if necessary. <BR> +<BR> +Each visitor is an object that is an instance of a class of type <A HREF="api/Cil.cilVisitor.html#.">Cil.cilVisitor..</A> +The most convenient way to obtain such classes is to specialize the +<A HREF="api/Cil.nopCilVisitor.html#c">Cil.nopCilVisitor.c</A>lass (which just traverses the tree doing +nothing). Any given specialization typically overrides only a few of the +methods. Take a look for example at the visitor defined in the module +<TT>logwrites.ml</TT>. Another, more elaborate example of a visitor is the +[copyFunctionVisitor] defined in <TT>cil.ml</TT>.<BR> +<BR> +Once you have defined a visitor you can invoke it with one of the functions: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<A HREF="api/Cil.html#VALvisitCilFile">Cil.visitCilFile</A> or <A HREF="api/Cil.html#VALvisitCilFileSameGlobals">Cil.visitCilFileSameGlobals</A> - visit a file +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALvisitCilGlobal">Cil.visitCilGlobal</A> - visit a global +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALvisitCilFunction">Cil.visitCilFunction</A> - visit a function definition +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALvisitCilExp">Cil.visitCilExp</A> - visit an expression +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALvisitCilLval">Cil.visitCilLval</A> - visit an lvalue +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALvisitCilInstr">Cil.visitCilInstr</A> - visit an instruction +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALvisitCilStmt">Cil.visitCilStmt</A> - visit a statement +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALvisitCilType">Cil.visitCilType</A> - visit a type. Note that this does not visit +the files of a composite type. use visitGlobal to visit the [GCompTag] that +defines the fields. +</UL> +Some transformations may want to use visitors to insert additional +instructions before statements and instructions. To do so, pass a list of +instructions to the <A HREF="api/Cil.html#VALqueueInstr">Cil.queueInstr</A> method of the specialized +object. The instructions will automatically be inserted before that +instruction in the transformed code. The <A HREF="api/Cil.html#VALunqueueInstr">Cil.unqueueInstr</A> method +should not normally be called by the user. <BR> +<BR> +<!--TOC subsection Interpreted Constructors and Deconstructors--> + +<H3 CLASS="subsection"><A NAME="htoc10">6.2</A> Interpreted Constructors and Deconstructors</H3><!--SEC END --> + +Interpreted constructors and deconstructors are a facility for constructing +and deconstructing CIL constructs using a pattern with holes that can be +filled with a variety of kinds of elements. The pattern is a string that uses +the C syntax to represent C language elements. For example, the following +code: +<PRE CLASS="verbatim"><FONT COLOR=blue> +Formatcil.cType "void * const (*)(int x)" +</FONT></PRE> +is an alternative way to construct the internal representation of the type of pointer to function +with an integer argument and a void * const as result: +<PRE CLASS="verbatim"><FONT COLOR=blue> +TPtr(TFun(TVoid [Attr("const", [])], + [ ("x", TInt(IInt, []), []) ], false, []), []) +</FONT></PRE> +The advantage of the interpreted constructors is that you can use familiar C +syntax to construct CIL abstract-syntax trees. <BR> +<BR> +You can construct this way types, lvalues, expressions, instructions and +statements. The pattern string can also contain a number of placeholders that +are replaced during construction with CIL items passed as additional argument +to the construction function. For example, the <TT>%e:id</TT> placeholder means +that the argument labeled “id” (expected to be of form <TT>Fe exp</TT>) will +supply the expression to replace the placeholder. For example, the following +code constructs an increment instruction at location <TT>loc</TT>: +<PRE CLASS="verbatim"><FONT COLOR=blue> +Formatcil.cInstr "%v:x = %v:x + %e:something" + loc + [ ("something", Fe some_exp); + ("x", Fv some_varinfo) ] +</FONT></PRE> +An alternative way to construct the same CIL instruction is: +<PRE CLASS="verbatim"><FONT COLOR=blue> +Set((Var some_varinfo, NoOffset), + BinOp(PlusA, Lval (Var some_varinfo, NoOffset), + some_exp, intType), + loc) +</FONT></PRE> +See <A HREF="api/Cil.html#TYPEformatArg">Cil.formatArg</A> for a definition of the placeholders that are +understood.<BR> +<BR> +A dual feature is the interpreted deconstructors. This can be used to test +whether a CIL construct has a certain form: +<PRE CLASS="verbatim"><FONT COLOR=blue> +Formatcil.dType "void * const (*)(int x)" t +</FONT></PRE> +will test whether the actual argument <TT>t</TT> is indeed a function pointer of +the required type. If it is then the result is <TT>Some []</TT> otherwise it is +<TT>None</TT>. Furthermore, for the purpose of the interpreted deconstructors +placeholders in patterns match anything of the right type. For example, +<PRE CLASS="verbatim"><FONT COLOR=blue> +Formatcil.dType "void * (*)(%F:t)" t +</FONT></PRE> +will match any function pointer type, independent of the type and number of +the formals. If the match succeeds the result is <TT>Some [ FF forms ]</TT> where +<TT>forms</TT> is a list of names and types of the formals. Note that each member +in the resulting list corresponds positionally to a placeholder in the +pattern.<BR> +<BR> +The interpreted constructors and deconstructors do not support the complete C +syntax, but only a substantial fragment chosen to simplify the parsing. The +following is the syntax that is supported: +<PRE CLASS="verbatim"> +Expressions: + E ::= %e:ID | %d:ID | %g:ID | n | L | ( E ) | Unop E | E Binop E + | sizeof E | sizeof ( T ) | alignof E | alignof ( T ) + | & L | ( T ) E + +Unary operators: + Unop ::= + | - | ~ | %u:ID + +Binary operators: + Binop ::= + | - | * | / | << | >> | & | ``|'' | ^ + | == | != | < | > | <= | >= | %b:ID + +Lvalues: + L ::= %l:ID | %v:ID Offset | * E | (* E) Offset | E -> ident Offset + +Offsets: + Offset ::= empty | %o:ID | . ident Offset | [ E ] Offset + +Types: + T ::= Type_spec Attrs Decl + +Type specifiers: + Type_spec ::= void | char | unsigned char | short | unsigned short + | int | unsigned int | long | unsigned long | %k:ID | float + | double | struct %c:ID | union %c:ID + + +Declarators: + Decl ::= * Attrs Decl | Direct_decl + + +Direct declarators: + Direct_decl ::= empty | ident | ( Attrs Decl ) + | Direct_decl [ Exp_opt ] + | ( Attrs Decl )( Parameters ) + +Optional expressions + Exp_opt ::= empty | E | %eo:ID + +Formal parameters + Parameters ::= empty | ... | %va:ID | %f:ID | T | T , Parameters + +List of attributes + Attrs ::= empty | %A:ID | Attrib Attrs + +Attributes + Attrib ::= const | restrict | volatile | __attribute__ ( ( GAttr ) ) + +GCC Attributes + GAttr ::= ident | ident ( AttrArg_List ) + +Lists of GCC Attribute arguments: + AttrArg_List ::= AttrArg | %P:ID | AttrArg , AttrArg_List + +GCC Attribute arguments + AttrArg ::= %p:ID | ident | ident ( AttrArg_List ) + +Instructions + Instr ::= %i:ID ; | L = E ; | L Binop= E | Callres L ( Args ) + +Actual arguments + Args ::= empty | %E:ID | E | E , Args + +Call destination + Callres ::= empty | L = | %lo:ID + +Statements + Stmt ::= %s:ID | if ( E ) then Stmt ; | if ( E ) then Stmt else Stmt ; + | return Exp_opt | break ; | continue ; | { Stmt_list } + | while (E ) Stmt | Instr_list + +Lists of statements + Stmt_list ::= empty | %S:ID | Stmt Stmt_list + | Type_spec Attrs Decl ; Stmt_list + | Type_spec Attrs Decl = E ; Stmt_list + | Type_spec Attrs Decl = L (Args) ; Stmt_list + +List of instructions + Instr_list ::= Instr | %I:ID | Instr Instr_list +</PRE> +Notes regarding the syntax: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +In the grammar description above non-terminals are written with +uppercase initial<BR> +<BR> +<LI CLASS="li-itemize">All of the patterns consist of the <TT>%</TT> character followed by one or +two letters, followed by “:” and an indentifier. For each such +pattern there is a corresponding constructor of the <A HREF="api/Cil.html#TYPEformatArg">Cil.formatArg</A> +type, whose name is the letter 'F' followed by the same one or two letters as +in the pattern. That constructor is used by the user code to pass a +<A HREF="api/Cil.html#TYPEformatArg">Cil.formatArg</A> actual argument to the interpreted constructor and by +the interpreted deconstructor to return what was matched for a pattern.<BR> +<BR> +<LI CLASS="li-itemize">If the pattern name is uppercase, it designates a list of the elements +designated by the corresponding lowercase pattern. E.g. %E designated lists +of expressions (as in the actual arguments of a call).<BR> +<BR> +<LI CLASS="li-itemize">The two-letter patterns whose second letter is “o” designate an +optional element. E.g. %eo designates an optional expression (as in the +length of an array). <BR> +<BR> +<LI CLASS="li-itemize">Unlike in calls to <TT>printf</TT>, the pattern %g is used for strings. <BR> +<BR> +<LI CLASS="li-itemize">The usual precedence and associativity rules as in C apply <BR> +<BR> +<LI CLASS="li-itemize">The pattern string can contain newlines and comments, using both the +<TT>/* ... */</TT> style as well as the <TT>//</TT> one. <BR> +<BR> +<LI CLASS="li-itemize">When matching a “cast” pattern of the form <TT>( T ) E</TT>, the +deconstructor will match even expressions that do not have the actual cast but +in that case the type is matched against the type of the expression. E.g. the +patters <TT>"(int)%e"</TT> will match any expression of type <TT>int</TT> whether it +has an explicit cast or not. <BR> +<BR> +<LI CLASS="li-itemize">The %k pattern is used to construct and deconstruct an integer type of +any kind. <BR> +<BR> +<LI CLASS="li-itemize">Notice that the syntax of types and declaration are the same (in order +to simplify the parser). This means that technically you can write a whole +declaration instead of a type in the cast. In this case the name that you +declare is ignored.<BR> +<BR> +<LI CLASS="li-itemize">In lists of formal parameters and lists of attributes, an empty list in +the pattern matches any formal parameters or attributes. <BR> +<BR> +<LI CLASS="li-itemize">When matching types, uses of named types are unrolled to expose a real +type before matching. <BR> +<BR> +<LI CLASS="li-itemize">The order of the attributes is ignored during matching. The the pattern +for a list of attributes contains %A then the resulting <TT>formatArg</TT> will be +bound to <B>all</B> attributes in the list. For example, the pattern <TT>"const +%A"</TT> matches any list of attributes that contains <TT>const</TT> and binds the +corresponding placeholder to the entire list of attributes, including +<TT>const</TT>. <BR> +<BR> +<LI CLASS="li-itemize">All instruction-patterns must be terminated by semicolon<BR> +<BR> +<LI CLASS="li-itemize">The autoincrement and autodecrement instructions are not supported. Also +not supported are complex expressions, the <TT>&&</TT> and <TT>||</TT> shortcut +operators, and a number of other more complex instructions or statements. In +general, the patterns support only constructs that can be represented directly +in CIL.<BR> +<BR> +<LI CLASS="li-itemize">The pattern argument identifiers are not used during deconstruction. +Instead, the result contains a sequence of values in the same order as the +appearance of pattern arguments in the pattern.<BR> +<BR> +<LI CLASS="li-itemize">You can mix statements with declarations. For each declaration a new + temporary will be constructed (using a function you provive). You can then + refer to that temporary by name in the rest of the pattern.<BR> +<BR> +<LI CLASS="li-itemize">The <TT>%v:</TT> pattern specifier is optional. +</UL> +The following function are defined in the <TT>Formatcil</TT> module for +constructing and deconstructing: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<A HREF="api/Formatcil.html#VALcExp">Formatcil.cExp</A> constructs <A HREF="api/Cil.html#TYPEexp">Cil.exp</A>. +<LI CLASS="li-itemize"><A HREF="api/Formatcil.html#VALcType">Formatcil.cType</A> constructs <A HREF="api/Cil.html#TYPEtyp">Cil.typ</A>. +<LI CLASS="li-itemize"><A HREF="api/Formatcil.html#VALcLval">Formatcil.cLval</A> constructs <A HREF="api/Cil.html#TYPElval">Cil.lval</A>. +<LI CLASS="li-itemize"><A HREF="api/Formatcil.html#VALcInstr">Formatcil.cInstr</A> constructs <A HREF="api/Cil.html#TYPEinstr">Cil.instr</A>. +<LI CLASS="li-itemize"><A HREF="api/Formatcil.html#VALcStmt">Formatcil.cStmt</A> and <A HREF="api/Formatcil.html#VALcStmts">Formatcil.cStmts</A> construct <A HREF="api/Cil.html#TYPEstmt">Cil.stmt</A>. +<LI CLASS="li-itemize"><A HREF="api/Formatcil.html#VALdExp">Formatcil.dExp</A> deconstructs <A HREF="api/Cil.html#TYPEexp">Cil.exp</A>. +<LI CLASS="li-itemize"><A HREF="api/Formatcil.html#VALdType">Formatcil.dType</A> deconstructs <A HREF="api/Cil.html#TYPEtyp">Cil.typ</A>. +<LI CLASS="li-itemize"><A HREF="api/Formatcil.html#VALdLval">Formatcil.dLval</A> deconstructs <A HREF="api/Cil.html#TYPElval">Cil.lval</A>. +<LI CLASS="li-itemize"><A HREF="api/Formatcil.html#VALdInstr">Formatcil.dInstr</A> deconstructs <A HREF="api/Cil.html#TYPElval">Cil.lval</A>. +</UL> +Below is an example using interpreted constructors. This example generates +the CIL representation of code that scans an array backwards and initializes +every even-index element with an expression: +<PRE CLASS="verbatim"><FONT COLOR=blue> +Formatcil.cStmts + loc + "int idx = sizeof(array) / sizeof(array[0]) - 1; + while(idx >= 0) { + // Some statements to be run for all the elements of the array + %S:init + if(! (idx & 1)) + array[idx] = %e:init_even; + /* Do not forget to decrement the index variable */ + idx = idx - 1; + }" + (fun n t -> makeTempVar myfunc ~name:n t) + [ ("array", Fv myarray); + ("init", FS [stmt1; stmt2; stmt3]); + ("init_even", Fe init_expr_for_even_elements) ] +</FONT></PRE> +To write the same CIL statement directly in CIL would take much more effort. +Note that the pattern is parsed only once and the result (a function that +takes the arguments and constructs the statement) is memoized. <BR> +<BR> +<!--TOC subsubsection Performance considerations for interpreted constructors--> + +<H4 CLASS="subsubsection"><A NAME="htoc11">6.2.1</A> Performance considerations for interpreted constructors</H4><!--SEC END --> + +Parsing the patterns is done with a LALR parser and it takes some time. To +improve performance the constructors and deconstructors memoize the parsed +patterns and will only compile a pattern once. Also all construction and +deconstruction functions can be applied partially to the pattern string to +produce a function that can be later used directly to construct or +deconstruct. This function appears to be about two times slower than if the +construction is done using the CIL constructors (without memoization the +process would be one order of magnitude slower.) However, the convenience of +interpreted constructor might make them a viable choice in many situations +when performance is not paramount (e.g. prototyping).<BR> +<BR> +<!--TOC subsection Printing and Debugging support--> + +<H3 CLASS="subsection"><A NAME="htoc12">6.3</A> Printing and Debugging support</H3><!--SEC END --> + +The Modules <A HREF="api/Pretty.html">Pretty</A> and <A HREF="api/Errormsg.html">Errormsg</A> contain respectively +utilities for pretty printing and reporting errors and provide a convenient +<TT>printf</TT>-like interface. <BR> +<BR> +Additionally, CIL defines for each major type a pretty-printing function that +you can use in conjunction with the <A HREF="api/Pretty.html">Pretty</A> interface. The +following are some of the pretty-printing functions: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<A HREF="api/Cil.html#VALd_exp">Cil.d_exp</A> - print an expression +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_type">Cil.d_type</A> - print a type +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_lval">Cil.d_lval</A> - print an lvalue +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_global">Cil.d_global</A> - print a global +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_stmt">Cil.d_stmt</A> - print a statment +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_instr">Cil.d_instr</A> - print an instruction +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_init">Cil.d_init</A> - print an initializer +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_attr">Cil.d_attr</A> - print an attribute +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_attrlist">Cil.d_attrlist</A> - print a set of attributes +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_loc">Cil.d_loc</A> - print a location +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_ikind">Cil.d_ikind</A> - print an integer kind +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_fkind">Cil.d_fkind</A> - print a floating point kind +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_const">Cil.d_const</A> - print a constant +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_storage">Cil.d_storage</A> - print a storage specifier +</UL> +You can even customize the pretty-printer by creating instances of +<A HREF="api/Cil.cilPrinter.html#.">Cil.cilPrinter..</A> Typically such an instance extends +<A HREF="api/Cil.html#VALdefaultCilPrinter">Cil.defaultCilPrinter</A>. Once you have a customized pretty-printer you +can use the following printing functions: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<A HREF="api/Cil.html#VALprintExp">Cil.printExp</A> - print an expression +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALprintType">Cil.printType</A> - print a type +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALprintLval">Cil.printLval</A> - print an lvalue +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALprintGlobal">Cil.printGlobal</A> - print a global +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALprintStmt">Cil.printStmt</A> - print a statment +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALprintInstr">Cil.printInstr</A> - print an instruction +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALprintInit">Cil.printInit</A> - print an initializer +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALprintAttr">Cil.printAttr</A> - print an attribute +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALprintAttrs">Cil.printAttrs</A> - print a set of attributes +</UL> +CIL has certain internal consistency invariants. For example, all references +to a global variable must point to the same <TT>varinfo</TT> structure. This +ensures that one can rename the variable by changing the name in the +<TT>varinfo</TT>. These constraints are mentioned in the API documentation. There +is also a consistency checker in file <TT>src/check.ml</TT>. If you suspect that +your transformation is breaking these constraints then you can pass the +<TT>--check</TT> option to cilly and this will ensure that the consistency checker +is run after each transformation. <BR> +<BR> +<!--TOC subsection Attributes--> + +<H3 CLASS="subsection"><A NAME="htoc13">6.4</A> Attributes</H3><!--SEC END --> +<A NAME="sec-attrib"></A> +In CIL you can attach attributes to types and to names (variables, functions +and fields). Attributes are represented using the type <A HREF="api/Cil.html#TYPEattribute">Cil.attribute</A>. +An attribute consists of a name and a number of arguments (represented using +the type <A HREF="api/Cil.html#TYPEattrparam">Cil.attrparam</A>). Almost any expression can be used as an +attribute argument. Attributes are stored in lists sorted by the name of the +attribute. To maintain list ordering, use the functions +<A HREF="api/Cil.html#VALtypeAttrs">Cil.typeAttrs</A> to retrieve the attributes of a type and the functions +<A HREF="api/Cil.html#VALaddAttribute">Cil.addAttribute</A> and <A HREF="api/Cil.html#VALaddAttributes">Cil.addAttributes</A> to add attributes. +Alternatively you can use <A HREF="api/Cil.html#VALtypeAddAttributes">Cil.typeAddAttributes</A> to add an attribute to +a type (and return the new type).<BR> +<BR> +GCC already has extensive support for attributes, and CIL extends this +support to user-defined attributes. A GCC attribute has the syntax: +<PRE CLASS="verbatim"> + gccattribute ::= __attribute__((attribute)) (Note the double parentheses) +</PRE> + Since GCC and MSVC both support various flavors of each attribute (with or +without leading or trailing _) we first strip ALL leading and trailing _ +from the attribute name (but not the identified in [ACons] parameters in +<A HREF="api/Cil.html#TYPEattrparam">Cil.attrparam</A>). When we print attributes, for GCC we add two leading +and two trailing _; for MSVC we add just two leading _.<BR> +<BR> +There is support in CIL so that you can control the printing of attributes +(see <A HREF="api/Cil.html#VALsetCustomPrintAttribute">Cil.setCustomPrintAttribute</A> and +<A HREF="api/Cil.html#VALsetCustomPrintAttributeScope">Cil.setCustomPrintAttributeScope</A>). This custom-printing support is now +used to print the "const" qualifier as "<TT>const</TT>" and not as +"<TT>__attribute__((const))</TT>".<BR> +<BR> +The attributes are specified in declarations. This is unfortunate since the C +syntax for declarations is already quite complicated and after writing the +parser and elaborator for declarations I am convinced that few C programmers +understand it completely. Anyway, this seems to be the easiest way to support +attributes. <BR> +<BR> +Name attributes must be specified at the very end of the declaration, just +before the <TT>=</TT> for the initializer or before the <TT>,</TT> the separates a +declaration in a group of declarations or just before the <TT>;</TT> that +terminates the declaration. A name attribute for a function being defined can +be specified just before the brace that starts the function body.<BR> +<BR> +For example (in the following examples <TT>A1</TT>,...,<TT>An</TT> are type attributes +and <TT>N</TT> is a name attribute (each of these uses the <TT>__attribute__</TT> syntax): +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x N; + int x N, * y N = 0, z[] N; + extern void exit() N; + int fact(int x) N { ... } +</FONT></PRE> +Type attributes can be specified along with the type using the following + rules: +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> + The type attributes for a base type (int, float, named type, reference + to struct or union or enum) must be specified immediately following the + type (actually it is Ok to mix attributes with the specification of the + type, in between unsigned and int for example).<BR> +<BR> +For example: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int A1 x N; /* A1 applies to the type int. An example is an attribute + "even" restricting the type int to even values. */ + struct foo A1 A2 x; // Both A1 and A2 apply to the struct foo type +</FONT></PRE><BR> +<BR> +<LI CLASS="li-enumerate">The type attributes for a pointer type must be specified immediately + after the * symbol. +<PRE CLASS="verbatim"><FONT COLOR=blue> + /* A pointer (A1) to an int (A2) */ + int A2 * A1 x; + /* A pointer (A1) to a pointer (A2) to a float (A3) */ + float A3 * A2 * A1 x; +</FONT></PRE> +Note: The attributes for base types and for pointer types are a strict + extension of the ANSI C type qualifiers (const, volatile and restrict). In + fact CIL treats these qualifiers as attributes. <BR> +<BR> +<LI CLASS="li-enumerate">The attributes for a function type or for an array type can be + specified using parenthesized declarators.<BR> +<BR> +For example: +<PRE CLASS="verbatim"><FONT COLOR=blue> + /* A function (A1) from int (A2) to float (A3) */ + float A3 (A1 f)(int A2); + + /* A pointer (A1) to a function (A2) that returns an int (A3) */ + int A3 (A2 * A1 pfun)(void); + + /* An array (A1) of int (A2) */ + int A2 (A1 x0)[] + + /* Array (A1) of pointers (A2) to functions (A3) that take an int (A4) and + * return a pointer (A5) to int (A6) */ + int A6 * A5 (A3 * A2 (A1 x1)[5])(int A4); + + + /* A function (A4) that takes a float (A5) and returns a pointer (A6) to an + * int (A7) */ + extern int A7 * A6 (A4 x2)(float A5 x); + + /* A function (A1) that takes a int (A2) and that returns a pointer (A3) to + * a function (A4) that takes a float (A5) and returns a pointer (A6) to an + * int (A7) */ + int A7 * A6 (A4 * A3 (A1 x3)(int A2 x))(float A5) { + return & x2; + } +</FONT></PRE></OL> +Note: ANSI C does not allow the specification of type qualifiers for function +and array types, although it allows for the parenthesized declarator. With +just a bit of thought (looking at the first few examples above) I hope that +the placement of attributes for function and array types will seem intuitive.<BR> +<BR> +This extension is not without problems however. If you want to refer just to +a type (in a cast for example) then you leave the name out. But this leads to +strange conflicts due to the parentheses that we introduce to scope the +attributes. Take for example the type of x0 from above. It should be written +as: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int A2 (A1 )[] +</FONT></PRE> +But this will lead most C parsers into deep confusion because the parentheses +around A1 will be confused for parentheses of a function designator. To push +this problem around (I don't know a solution) whenever we are about to print a +parenthesized declarator with no name but with attributes, we comment out the +attributes so you can see them (for whatever is worth) without confusing the +compiler. For example, here is how we would print the above type: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int A2 /*(A1 )*/[] +</FONT></PRE> +<!--TOC paragraph Handling of predefined GCC attributes--> + +<H5 CLASS="paragraph">Handling of predefined GCC attributes</H5><!--SEC END --> + +GCC already supports attributes in a lot of places in declarations. The only +place where we support attributes and GCC does not is right before the { that +starts a function body. <BR> +<BR> +GCC classifies its attributes in attributes for functions, for variables and +for types, although the latter category is only usable in definition of struct +or union types and is not nearly as powerful as the CIL type attributes. We +have made an effort to reclassify GCC attributes as name and type attributes +(they only apply for function types). Here is what we came up with: +<UL CLASS="itemize"><LI CLASS="li-itemize"> + GCC name attributes:<BR> +<BR> +section, constructor, destructor, unused, weak, no_instrument_function, + noreturn, alias, no_check_memory_usage, dllinport, dllexport, exception, + model<BR> +<BR> +Note: the "noreturn" attribute would be more appropriately qualified as a + function type attribute. But we classify it as a name attribute to make + it easier to support a similarly named MSVC attribute. <BR> +<BR> +<LI CLASS="li-itemize">GCC function type attributes:<BR> +<BR> +fconst (printed as "const"), format, regparm, stdcall, + cdecl, longcall<BR> +<BR> +I was not able to completely decipher the position in which these attributes + must go. So, the CIL elaborator knows these names and applies the following + rules: + <UL CLASS="itemize"><LI CLASS="li-itemize"> + All of the name attributes that appear in the specifier part (i.e. at + the beginning) of a declaration are associated with all declared names. <BR> +<BR> +<LI CLASS="li-itemize">All of the name attributes that appear at the end of a declarator are + associated with the particular name being declared.<BR> +<BR> +<LI CLASS="li-itemize">More complicated is the handling of the function type attributes, since + there can be more than one function in a single declaration (a function + returning a pointer to a function). Lacking any real understanding of how + GCC handles this, I attach the function type attribute to the "nearest" + function. This means that if a pointer to a function is "nearby" the + attribute will be correctly associated with the function. In truth I pray + that nobody uses declarations as that of x3 above. + </UL> +</UL> +<!--TOC paragraph Handling of predefined MSVC attributes--> + +<H5 CLASS="paragraph">Handling of predefined MSVC attributes</H5><!--SEC END --> + +MSVC has two kinds of attributes, declaration modifiers to be printed before + the storage specifier using the notation "<TT>__declspec(...)</TT>" and a few + function type attributes, printed almost as our CIL function type + attributes. <BR> +<BR> +The following are the name attributes that are printed using + <TT>__declspec</TT> right before the storage designator of the declaration: + thread, naked, dllimport, dllexport, noreturn<BR> +<BR> +The following are the function type attributes supported by MSVC: + fastcall, cdecl, stdcall<BR> +<BR> +It is not worth going into the obscure details of where MSVC accepts these + type attributes. The parser thinks it knows these details and it pulls + these attributes from wherever they might be placed. The important thing + is that MSVC will accept if we print them according to the rules of the CIL + attributes ! <BR> +<BR> +<!--TOC section The CIL Driver--> + +<H2 CLASS="section"><A NAME="htoc14">7</A> The CIL Driver</H2><!--SEC END --> +<A NAME="sec-driver"></A> +We have packaged CIL as an application <TT>cilly</TT> that contains certain +example modules, such as <TT>logwrites.ml</TT> (a module +that instruments code to print the addresses of memory locations being +written). Normally, you write another module like that, add command-line +options and an invocation of your module in <TT>src/main.ml</TT>. Once you compile +CIL you will obtain the file <TT>obj/cilly.asm.exe</TT>. <BR> +<BR> +We wrote a driver for this executable that makes it easy to invoke your +analysis on existing C code with very little manual intervention. This driver +is <TT>bin/cilly</TT> and is quite powerful. Note that the <TT>cilly</TT> script +is configured during installation with the path where CIL resides. This means +that you can move it to any place you want. <BR> +<BR> +A simple use of the driver is: +<PRE CLASS="verbatim"> +bin/cilly --save-temps -D HAPPY_MOOD -I myincludes hello.c -o hello +</PRE> +<FONT COLOR=blue>--save-temps</FONT> tells CIL to save the resulting output files in the +current directory. Otherwise, they'll be put in <TT>/tmp</TT> and deleted +automatically. Not that this is the only CIL-specific flag in the +list – the other flags use <TT>gcc</TT>'s syntax.<BR> +<BR> +This performs the following actions: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +preprocessing using the -D and -I arguments with the resulting + file left in <TT>hello.i</TT>, +<LI CLASS="li-itemize">the invocation of the <TT>cilly.asm</TT> application which parses <TT>hello.i</TT> + converts it to CIL and the pretty-prints it to <TT>hello.cil.c</TT> +<LI CLASS="li-itemize">another round of preprocessing with the result placed in <TT>hello.cil.i</TT> +<LI CLASS="li-itemize">the true compilation with the result in <TT>hello.cil.o</TT> +<LI CLASS="li-itemize">a linking phase with the result in <TT>hello</TT> +</UL> +Note that <TT>cilly</TT> behaves like the <TT>gcc</TT> compiler. This makes it +easy to use it with existing <TT>Makefiles</TT>: +<PRE CLASS="verbatim"> +make CC="bin/cilly" LD="bin/cilly" +</PRE> + <TT>cilly</TT> can also behave as the Microsoft Visual C compiler, if the first + argument is <TT>--mode=MSVC</TT>: +<PRE CLASS="verbatim"> +bin/cilly --mode=MSVC /D HAPPY_MOOD /I myincludes hello.c /Fe hello.exe +</PRE> + (This in turn will pass a <TT>--MSVC</TT> flag to the underlying <TT>cilly.asm</TT> + process which will make it understand the Microsoft Visual C extensions)<BR> +<BR> +<TT>cilly</TT> can also behave as the archiver <TT>ar</TT>, if it is passed an +argument <TT>--mode=AR</TT>. Note that only the <TT>cr</TT> mode is supported (create a +new archive and replace all files in there). Therefore the previous version of +the archive is lost. <BR> +<BR> +Furthermore, <TT>cilly</TT> allows you to pass some arguments on to the +underlying <TT>cilly.asm</TT> process. As a general rule all arguments that start +with <TT>--</TT> and that <TT>cilly</TT> itself does not process, are passed on. For +example, +<PRE CLASS="verbatim"> +bin/cilly --dologwrites -D HAPPY_MOOD -I myincludes hello.c -o hello.exe +</PRE> + will produce a file <TT>hello.cil.c</TT> that prints all the memory addresses +written by the application. <BR> +<BR> +The most powerful feature of <TT>cilly</TT> is that it can collect all the +sources in your project, merge them into one file and then apply CIL. This +makes it a breeze to do whole-program analysis and transformation. All you +have to do is to pass the <TT>--merge</TT> flag to <TT>cilly</TT>: +<PRE CLASS="verbatim"> +make CC="bin/cilly --save-temps --dologwrites --merge" +</PRE> + You can even leave some files untouched: +<PRE CLASS="verbatim"> +make CC="bin/cilly --save-temps --dologwrites --merge --leavealone=foo --leavealone=bar" +</PRE> + This will merge all the files except those with the basename <TT>foo</TT> and +<TT>bar</TT>. Those files will be compiled as usual and then linked in at the very +end. <BR> +<BR> +The sequence of actions performed by <TT>cilly</TT> depends on whether merging +is turned on or not: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +If merging is off + <OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> + For every file <TT>file.c</TT> to compile + <OL CLASS="enumerate" type=a><LI CLASS="li-enumerate"> + Preprocess the file with the given arguments to + produce <TT>file.i</TT> + <LI CLASS="li-enumerate">Invoke <TT>cilly.asm</TT> to produce a <TT>file.cil.c</TT> + <LI CLASS="li-enumerate">Preprocess to <TT>file.cil.i</TT> + <LI CLASS="li-enumerate">Invoke the underlying compiler to produce <TT>file.cil.o</TT> + </OL> + <LI CLASS="li-enumerate">Link the resulting objects + </OL> +<LI CLASS="li-itemize">If merging is on + <OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> + For every file <TT>file.c</TT> to compile + <OL CLASS="enumerate" type=a><LI CLASS="li-enumerate"> + Preprocess the file with the given arguments to + produce <TT>file.i</TT> + <LI CLASS="li-enumerate">Save the preprocessed source as <TT>file.o</TT> + </OL> + <LI CLASS="li-enumerate">When linking executable <TT>hello.exe</TT>, look at every object + file that must be linked and see if it actually + contains preprocessed source. Pass all those files to a + special merging application (described in + Section <A HREF="#sec-merger">13</A>) to produce <TT>hello.exe_comb.c</TT> + <LI CLASS="li-enumerate">Invoke <TT>cilly.asm</TT> to produce a <TT>hello.exe_comb.cil.c</TT> + <LI CLASS="li-enumerate">Preprocess to <TT>hello.exe_comb.cil.i</TT> + <LI CLASS="li-enumerate">Invoke the underlying compiler to produce <TT>hello.exe_comb.cil.o</TT> + <LI CLASS="li-enumerate">Invoke the actual linker to produce <TT>hello.exe</TT> + </OL> +</UL> +Note that files that you specify with <TT>--leavealone</TT> are not merged and +never presented to CIL. They are compiled as usual and then are linked in at +the end. <BR> +<BR> +And a final feature of <TT>cilly</TT> is that it can substitute copies of the +system's include files: +<PRE CLASS="verbatim"> +make CC="bin/cilly --includedir=myinclude" +</PRE> + This will force the preprocessor to use the file <TT>myinclude/xxx/stdio.h</TT> +(if it exists) whenever it encounters <TT>#include <stdio.h></TT>. The <TT>xxx</TT> is +a string that identifies the compiler version you are using. This modified +include files should be produced with the patcher script (see +Section <A HREF="#sec-patcher">14</A>).<BR> +<BR> +<!--TOC subsection <TT>cilly</TT> Options--> + +<H3 CLASS="subsection"><A NAME="htoc15">7.1</A> <TT>cilly</TT> Options</H3><!--SEC END --> + +Among the options for the <TT>cilly</TT> you can put anything that can normally +go in the command line of the compiler that <TT>cilly</TT> is impersonating. +<TT>cilly</TT> will do its best to pass those options along to the appropriate +subprocess. In addition, the following options are supported (a complete and +up-to-date list can always be obtained by running <TT>cilly --help</TT>): +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>--mode=mode</TT> This must be the first argument if present. It makes +<TT>cilly</TT> behave as a given compiled. The following modes are recognized: + <UL CLASS="itemize"><LI CLASS="li-itemize"> + GNUCC - the GNU C Compiler. This is the default. + <LI CLASS="li-itemize">MSVC - the Microsoft Visual C compiler. Of course, you should + pass only MSVC valid options in this case. + <LI CLASS="li-itemize">AR - the archiver <TT>ar</TT>. Only the mode <TT>cr</TT> is supported and + the original version of the archive is lost. + </UL> +<LI CLASS="li-itemize"><TT>--help</TT> Prints a list of the options supported. +<LI CLASS="li-itemize"><TT>--verbose</TT> Prints lots of messages about what is going on. +<LI CLASS="li-itemize"><TT>--stages</TT> Less than <TT>--verbose</TT> but lets you see what <TT>cilly</TT> + is doing. +<LI CLASS="li-itemize"><TT>--merge</TT> This tells <TT>cilly</TT> to first attempt to collect into one +source file all of the sources that make your application, and then to apply +<TT>cilly.asm</TT> on the resulting source. The sequence of actions in this case is +described above and the merger itself is described in Section <A HREF="#sec-merger">13</A>.<BR> +<BR> +<LI CLASS="li-itemize"><TT>--leavealone=xxx</TT>. Do not merge and do not present to CIL the files +whose basename is "xxx". These files are compiled as usual and linked in at +the end. +<LI CLASS="li-itemize"><TT>--includedir=xxx</TT>. Override the include files with those in the given +directory. The given directory is the same name that was given an an argument +to the patcher (see Section <A HREF="#sec-patcher">14</A>). In particular this means that +that directory contains subdirectories named based on the current compiler +version. The patcher creates those directories. +<LI CLASS="li-itemize"><TT>--usecabs</TT>. Do not CIL, but instead just parse the source and print +its AST out. This should looked like the preprocessed file. This is useful +when you suspect that the conversion to CIL phase changes the meaning of the +program. +<LI CLASS="li-itemize"><TT>--save-temps=xxx</TT>. Temporary files are preserved in the xxx + directory. For example, the output of CIL will be put in a file + named <TT>*.cil.c</TT>. +<LI CLASS="li-itemize"><TT>--save-temps</TT>. Temporay files are preserved in the current directory. +</UL> +<!--TOC subsection <TT>cilly.asm</TT> Options--> + +<H3 CLASS="subsection"><A NAME="htoc16">7.2</A> <TT>cilly.asm</TT> Options</H3><!--SEC END --> + + <A NAME="sec-cilly-asm-options"></A> +All of the options that start with <TT>--</TT> and are not understood by +<TT>cilly</TT> are passed on to <TT>cilly.asm</TT>. <TT>cilly</TT> also passes along to +<TT>cilly.asm</TT> flags such as <TT>--MSVC</TT> that both need to know +about. The following options are supported:<BR> +<BR> + <B>General Options:</B> +<UL CLASS="itemize"><LI CLASS="li-itemize"> + <TT>--version</TT> output version information and exit + <LI CLASS="li-itemize"><TT>--verbose</TT> Print lots of random stuff. This is passed on from cilly + <LI CLASS="li-itemize"><TT>--warnall</TT> Show all warnings. + <LI CLASS="li-itemize"><TT>--debug=xxx</TT> turns on debugging flag xxx + <LI CLASS="li-itemize"><TT>--nodebug=xxx</TT> turns off debugging flag xxx + <LI CLASS="li-itemize"><TT>--flush</TT> Flush the output streams often (aids debugging). + <LI CLASS="li-itemize"><TT>--check</TT> Run a consistency check over the CIL after every operation. + <LI CLASS="li-itemize"><TT>--nocheck</TT> turns off consistency checking of CIL. + <LI CLASS="li-itemize"><TT>--noPrintLn</TT> Don't output #line directives in the output. + <LI CLASS="li-itemize"><TT>--commPrintLn</TT> Print #line directives in the output, but + put them in comments. + <LI CLASS="li-itemize"><TT>--log=xxx</TT> Set the name of the log file. By default stderr is used + <LI CLASS="li-itemize"><TT>--MSVC</TT> Enable MSVC compatibility. Default is GNU. + <LI CLASS="li-itemize"><TT>--ignore-merge-conflicts</TT> ignore merging conflicts. + <LI CLASS="li-itemize"><TT>--extrafiles=filename</TT>: the name of a file that contains + a list of additional files to process, separated by whitespace. + <LI CLASS="li-itemize"><TT>--stats</TT> Print statistics about the running time of the + parser, conversion to CIL, etc. Also prints memory-usage + statistics. You can time parts of your own code as well. Calling + (<TT>Stats.time “label” func arg</TT>) will evaluate <TT>(func arg)</TT> + and remember how long this takes. If you call <TT>Stats.time</TT> + repeatedly with the same label, CIL will report the aggregate + time.<BR> +<BR> +If available, CIL uses the x86 performance counters for these + stats. This is very precise, but results in “wall-clock time.” + To report only user-mode time, find the call to <TT>Stats.reset</TT> in + <TT>main.ml</TT>, and change it to <TT>Stats.reset false</TT>.<BR> +<BR> +<B>Lowering Options</B> + <LI CLASS="li-itemize"><TT>--noLowerConstants</TT> do not lower constant expressions. + <LI CLASS="li-itemize"><TT>--noInsertImplicitCasts</TT> do not insert implicit casts. + <LI CLASS="li-itemize"><TT>--forceRLArgEval</TT> Forces right to left evaluation of function arguments. + <LI CLASS="li-itemize"><TT>--disallowDuplication</TT> Prevent small chunks of code from being duplicated. + <LI CLASS="li-itemize"><TT>--keepunused</TT> Do not remove the unused variables and types. + <LI CLASS="li-itemize"><TT>--rmUnusedInlines</TT> Delete any unused inline functions. This is the default in MSVC mode.<BR> +<BR> +<B>Output Options:</B> + <LI CLASS="li-itemize"><TT>--printCilAsIs</TT> Do not try to simplify the CIL when + printing. Without this flag, CIL will attempt to produce prettier + output by e.g. changing <TT>while(1)</TT> into more meaningful loops. + <LI CLASS="li-itemize"><TT>--noWrap</TT> do not wrap long lines when printing + <LI CLASS="li-itemize"><TT>--out=xxx</TT> the name of the output CIL file. <TT>cilly</TT> + sets this for you. + <LI CLASS="li-itemize"><TT>--mergedout=xxx</TT> specify the name of the merged file + <LI CLASS="li-itemize"><TT>--cabsonly=xxx</TT> CABS output file name +<BR> +<BR> + <B>Selected features.</B> See Section <A HREF="#sec-Extension">8</A> for more information. +<LI CLASS="li-itemize"><TT>--dologcalls</TT>. Insert code in the processed source to print the name of +functions as are called. Implemented in <TT>src/ext/logcalls.ml</TT>. +<LI CLASS="li-itemize"><TT>--dologwrites</TT>. Insert code in the processed source to print the +address of all memory writes. Implemented in <TT>src/ext/logwrites.ml</TT>. +<LI CLASS="li-itemize"><TT>--dooneRet</TT>. Make each function have at most one 'return'. +Implemented in <TT>src/ext/oneret.ml</TT>. +<LI CLASS="li-itemize"><TT>--dostackGuard</TT>. Instrument function calls and returns to +maintain a separate stack for return addresses. Implemeted in +<TT>src/ext/heapify.ml</TT>. +<LI CLASS="li-itemize"><TT>--domakeCFG</TT>. Make the program look more like a CFG. Implemented +in <TT>src/cil.ml</TT>. +<LI CLASS="li-itemize"><TT>--dopartial</TT>. Do interprocedural partial evaluation and +constant folding. Implemented in <TT>src/ext/partial.ml</TT>. +<LI CLASS="li-itemize"><TT>--dosimpleMem</TT>. Simplify all memory expressions. Implemented in +<TT>src/ext/simplemem.ml</TT>. <BR> +<BR> +For an up-to-date list of available options, run <TT>cilly.asm --help</TT>. </UL> +<!--TOC section Library of CIL Modules--> + +<H2 CLASS="section"><A NAME="htoc17">8</A> Library of CIL Modules</H2><!--SEC END --> + <A NAME="sec-Extension"></A><!--NAME ext.html--> +<BR> +<BR> +We are developing a suite of modules that use CIL for program analyses and +transformations that we have found useful. You can use these modules directly +on your code, or generally as inspiration for writing similar modules. A +particularly big and complex application written on top of CIL is CCured +(<A HREF="../ccured/index.html"><TT>../ccured/index.html</TT></A>).<BR> +<BR> +<!--TOC subsection Control-Flow Graphs--> + +<H3 CLASS="subsection"><A NAME="htoc18">8.1</A> Control-Flow Graphs</H3><!--SEC END --> + <A NAME="sec-cfg"></A> +The <A HREF="api/Cil.html#TYPEstmt">Cil.stmt</A> datatype includes fields for intraprocedural +control-flow information: the predecessor and successor statements of +the current statement. This information is not computed by default. +If you want to use the control-flow graph, or any of the extensions in +this section that require it, you have to explicitly ask CIL to +compute the CFG.<BR> +<BR> +<!--TOC subsubsection The CFG module (new in CIL 1.3.5)--> + +<H4 CLASS="subsubsection"><A NAME="htoc19">8.1.1</A> The CFG module (new in CIL 1.3.5)</H4><!--SEC END --> + +The best way to compute the CFG is with the CFG module. Just invoke +<A HREF="api/Cfg.html#VALcomputeFileCFG">Cfg.computeFileCFG</A> on your file. The <A HREF="api/Cfg.html">Cfg</A> API +describes the rest of actions you can take with this module, including +computing the CFG for one function at a time, or printing the CFG in +<TT>dot</TT> form.<BR> +<BR> +<!--TOC subsubsection Simplified control flow--> + +<H4 CLASS="subsubsection"><A NAME="htoc20">8.1.2</A> Simplified control flow</H4><!--SEC END --> + +CIL can reduce high-level C control-flow constructs like <TT>switch</TT> and +<TT>continue</TT> to lower-level <TT>goto</TT>s. This completely eliminates some +possible classes of statements from the program and may make the result +easier to analyze (e.g., it simplifies data-flow analysis).<BR> +<BR> +You can invoke this transformation on the command line with +<TT>--domakeCFG</TT> or programatically with <A HREF="api/Cil.html#VALprepareCFG">Cil.prepareCFG</A>. +After calling Cil.prepareCFG, you can use <A HREF="api/Cil.html#VALcomputeCFGInfo">Cil.computeCFGInfo</A> +to compute the CFG information and find the successor and predecessor +of each statement.<BR> +<BR> +For a concrete example, you can see how <TT>cilly --domakeCFG</TT> +transforms the following code (note the fall-through in case 1): +<PRE CLASS="verbatim"><FONT COLOR=blue> + int foo (int predicate) { + int x = 0; + switch (predicate) { + case 0: return 111; + case 1: x = x + 1; + case 2: return (x+3); + case 3: break; + default: return 222; + } + return 333; + } +</FONT></PRE> +See the <A HREF="examples/ex23.txt">CIL output</A> for this +code fragment<BR> +<BR> +<!--TOC subsection Data flow analysis framework--> + +<H3 CLASS="subsection"><A NAME="htoc21">8.2</A> Data flow analysis framework</H3><!--SEC END --> + +The <A HREF="api/Dataflow.html">Dataflow</A> module (click for the ocamldoc) contains a +parameterized framework for forward and backward data flow +analyses. You provide the transfer functions and this module does the +analysis. You must compute control-flow information (Section <A HREF="#sec-cfg">8.1</A>) +before invoking the Dataflow module.<BR> +<BR> +<!--TOC subsection Dominators--> + +<H3 CLASS="subsection"><A NAME="htoc22">8.3</A> Dominators</H3><!--SEC END --> + +The module <A HREF="api/Dominators.html">Dominators</A> contains the computation of immediate + dominators. It uses the <A HREF="api/Dataflow.html">Dataflow</A> module. <BR> +<BR> +<!--TOC subsection Points-to Analysis--> + +<H3 CLASS="subsection"><A NAME="htoc23">8.4</A> Points-to Analysis</H3><!--SEC END --> + +The module <TT>ptranal.ml</TT> contains two interprocedural points-to +analyses for CIL: <TT>Olf</TT> and <TT>Golf</TT>. <TT>Olf</TT> is the default. +(Switching from <TT>olf.ml</TT> to <TT>golf.ml</TT> requires a change in +<TT>Ptranal</TT> and a recompiling <TT>cilly</TT>.)<BR> +<BR> +The analyses have the following characteristics: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +Not based on C types (inferred pointer relationships are sound + despite most kinds of C casts) +<LI CLASS="li-itemize">One level of subtyping +<LI CLASS="li-itemize">One level of context sensitivity (Golf only) +<LI CLASS="li-itemize">Monomorphic type structures +<LI CLASS="li-itemize">Field insensitive (fields of structs are conflated) +<LI CLASS="li-itemize">Demand-driven (points-to queries are solved on demand) +<LI CLASS="li-itemize">Handle function pointers +</UL> +The analysis itself is factored into two components: <TT>Ptranal</TT>, +which walks over the CIL file and generates constraints, and <TT>Olf</TT> +or <TT>Golf</TT>, which solve the constraints. The analysis is invoked +with the function <TT>Ptranal.analyze_file: Cil.file -> + unit</TT>. This function builds the points-to graph for the CIL file +and stores it internally. There is currently no facility for clearing +internal state, so <TT>Ptranal.analyze_file</TT> should only be called +once.<BR> +<BR> +The constructed points-to graph supports several kinds of queries, +including alias queries (may two expressions be aliased?) and +points-to queries (to what set of locations may an expression point?).<BR> +<BR> +The main interface with the alias analysis is as follows: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>Ptranal.may_alias: Cil.exp -> Cil.exp -> bool</TT>. If + <TT>true</TT>, the two expressions may have the same value. +<LI CLASS="li-itemize"><TT>Ptranal.resolve_lval: Cil.lval -> (Cil.varinfo + list)</TT>. Returns the list of variables to which the given + left-hand value may point. +<LI CLASS="li-itemize"><TT>Ptranal.resolve_exp: Cil.exp -> (Cil.varinfo list)</TT>. + Returns the list of variables to which the given expression may + point. +<LI CLASS="li-itemize"><TT>Ptranal.resolve_funptr: Cil.exp -> (Cil.fundec + list)</TT>. Returns the list of functions to which the given + expression may point. +</UL> +The precision of the analysis can be customized by changing the values +of several flags: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>Ptranal.no_sub: bool ref</TT>. + If <TT>true</TT>, subtyping is disabled. Associated commandline option: + <B>--ptr_unify</B>. +<LI CLASS="li-itemize"><TT>Ptranal.analyze_mono: bool ref</TT>. + (Golf only) If <TT>true</TT>, context sensitivity is disabled and the + analysis is effectively monomorphic. Commandline option: + <B>--ptr_mono</B>. +<LI CLASS="li-itemize"><TT>Ptranal.smart_aliases: bool ref</TT>. + (Golf only) If <TT>true</TT>, “smart” disambiguation of aliases is + enabled. Otherwise, aliases are computed by intersecting points-to + sets. This is an experimental feature. +<LI CLASS="li-itemize"><TT>Ptranal.model_strings: bool ref</TT>. + Make the alias analysis model string constants by treating them as + pointers to chars. Commandline option: <B>--ptr_model_strings</B> +<LI CLASS="li-itemize"><TT>Ptranal.conservative_undefineds: bool ref</TT>. + Make the most pessimistic assumptions about globals if an undefined + function is present. Such a function can write to every global + variable. Commandline option: <B>--ptr_conservative</B> +</UL> +In practice, the best precision/efficiency tradeoff is achieved by +setting <TT>Ptranal.no_sub</TT> to <TT>false</TT>, <TT>Ptranal.analyze_mono</TT> to +<TT>true</TT>, and <TT>Ptranal.smart_aliases</TT> to <TT>false</TT>. These are the +default values of the flags.<BR> +<BR> +There are also a few flags that can be used to inspect or serialize +the results of the analysis. +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>Ptranal.debug_may_aliases</TT>. + Print the may-alias relationship of each pair of expressions in the + program. Commandline option: <B>--ptr_may_aliases</B>. +<LI CLASS="li-itemize"><TT>Ptranal.print_constraints: bool ref</TT>. + If <TT>true</TT>, the analysis will print each constraint as it is + generated. +<LI CLASS="li-itemize"><TT>Ptranal.print_types: bool ref</TT>. + If <TT>true</TT>, the analysis will print the inferred type of each + variable in the program.<BR> +<BR> +If <TT>Ptranal.analyze_mono</TT> and <TT>Ptranal.no_sub</TT> are both + <TT>true</TT>, this output is sufficient to reconstruct the points-to + graph. One nice feature is that there is a pretty printer for + recursive types, so the print routine does not loop. +<LI CLASS="li-itemize"><TT>Ptranal.compute_results: bool ref</TT>. + If <TT>true</TT>, the analysis will print out the points-to set of each + variable in the program. This will essentially serialize the + points-to graph. +</UL> +<!--TOC subsection StackGuard--> + +<H3 CLASS="subsection"><A NAME="htoc24">8.5</A> StackGuard</H3><!--SEC END --> + +The module <TT>heapify.ml</TT> contains a transformation similar to the one +described in “StackGuard: Automatic Adaptive Detection and Prevention of +Buffer-Overflow Attacks”, <EM>Proceedings of the 7th USENIX Security +Conference</EM>. In essence it modifies the program to maintain a separate +stack for return addresses. Even if a buffer overrun attack occurs the +actual correct return address will be taken from the special stack. <BR> +<BR> +Although it does work, this CIL module is provided mainly as an example of +how to perform a simple source-to-source program analysis and +transformation. As an optimization only functions that contain a dangerous +local array make use of the special return address stack. <BR> +<BR> +For a concrete example, you can see how <TT>cilly --dostackGuard</TT> +transforms the following dangerous code: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int dangerous() { + char array[10]; + scanf("%s",array); // possible buffer overrun! + } + + int main () { + return dangerous(); + } +</FONT></PRE> +See the <A HREF="examples/ex24.txt">CIL output</A> for this +code fragment<BR> +<BR> +<!--TOC subsection Heapify--> + +<H3 CLASS="subsection"><A NAME="htoc25">8.6</A> Heapify</H3><!--SEC END --> + +The module <TT>heapify.ml</TT> also contains a transformation that moves all +dangerous local arrays to the heap. This also prevents a number of buffer +overruns. <BR> +<BR> +For a concrete example, you can see how <TT>cilly --doheapify</TT> +transforms the following dangerous code: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int dangerous() { + char array[10]; + scanf("%s",array); // possible buffer overrun! + } + + int main () { + return dangerous(); + } +</FONT></PRE> +See the <A HREF="examples/ex25.txt">CIL output</A> for this +code fragment<BR> +<BR> +<!--TOC subsection One Return--> + +<H3 CLASS="subsection"><A NAME="htoc26">8.7</A> One Return</H3><!--SEC END --> + +The module <TT>oneret.ml</TT> contains a transformation the ensures that all +function bodies have at most one return statement. This simplifies a number +of analyses by providing a canonical exit-point. <BR> +<BR> +For a concrete example, you can see how <TT>cilly --dooneRet</TT> +transforms the following code: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int foo (int predicate) { + if (predicate <= 0) { + return 1; + } else { + if (predicate > 5) + return 2; + return 3; + } + } +</FONT></PRE> +See the <A HREF="examples/ex26.txt">CIL output</A> for this +code fragment<BR> +<BR> +<!--TOC subsection Partial Evaluation and Constant Folding--> + +<H3 CLASS="subsection"><A NAME="htoc27">8.8</A> Partial Evaluation and Constant Folding</H3><!--SEC END --> + +The <TT>partial.ml</TT> module provides a simple interprocedural partial +evaluation and constant folding data-flow analysis and transformation. This +transformation requires the <TT>--domakeCFG</TT> option. <BR> +<BR> +For a concrete example, you can see how <TT>cilly --domakeCFG --dopartial</TT> +transforms the following code (note the eliminated <TT>if</TT> branch and the +partial optimization of <TT>foo</TT>): +<PRE CLASS="verbatim"><FONT COLOR=blue> + int foo(int x, int y) { + int unknown; + if (unknown) + return y+2; + return x+3; + } + + int main () { + int a,b,c; + a = foo(5,7) + foo(6,7); + b = 4; + c = b * b; + if (b > c) + return b-c; + else + return b+c; + } +</FONT></PRE> +See the <A HREF="examples/ex27.txt">CIL output</A> for this +code fragment<BR> +<BR> +<!--TOC subsection Reaching Definitions--> + +<H3 CLASS="subsection"><A NAME="htoc28">8.9</A> Reaching Definitions</H3><!--SEC END --> + +The <TT>reachingdefs.ml</TT> module uses the dataflow framework and CFG +information to calculate the definitions that reach each +statement. After computing the CFG (Section <A HREF="#sec-cfg">8.1</A>) and calling +<TT>computeRDs</TT> on a +function declaration, <TT>ReachingDef.stmtStartData</TT> will contain a +mapping from statement IDs to data about which definitions reach each +statement. In particular, it is a mapping from statement IDs to a +triple the first two members of which are used internally. The third +member is a mapping from variable IDs to Sets of integer options. If +the set contains <TT>Some(i)</TT>, then the definition of that variable +with ID <TT>i</TT> reaches that statement. If the set contains <TT>None</TT>, +then there is a path to that statement on which there is no definition +of that variable. Also, if the variable ID is unmapped at a +statement, then no definition of that variable reaches that statement.<BR> +<BR> +To summarize, reachingdefs.ml has the following interface: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>computeRDs</TT> – Computes reaching definitions. Requires that +CFG information has already been computed for each statement. +<LI CLASS="li-itemize"><TT>ReachingDef.stmtStartData</TT> – contains reaching +definition data after <TT>computeRDs</TT> is called. +<LI CLASS="li-itemize"><TT>ReachingDef.defIdStmtHash</TT> – Contains a mapping +from definition IDs to the ID of the statement in which +the definition occurs. +<LI CLASS="li-itemize"><TT>getRDs</TT> – Takes a statement ID and returns +reaching definition data for that statement. +<LI CLASS="li-itemize"><TT>instrRDs</TT> – Takes a list of instructions and the +definitions that reach the first instruction, and for +each instruction calculates the definitions that reach +either into or out of that instruction. +<LI CLASS="li-itemize"><TT>rdVisitorClass</TT> – A subclass of nopCilVisitor that +can be extended such that the current reaching definition +data is available when expressions are visited through +the <TT>get_cur_iosh</TT> method of the class. +</UL> +<!--TOC subsection Available Expressions--> + +<H3 CLASS="subsection"><A NAME="htoc29">8.10</A> Available Expressions</H3><!--SEC END --> + +The <TT>availexps.ml</TT> module uses the dataflow framework and CFG +information to calculate something similar to a traditional available +expressions analysis. After <TT>computeAEs</TT> is called following a CFG +calculation (Section <A HREF="#sec-cfg">8.1</A>), <TT>AvailableExps.stmtStartData</TT> will +contain a mapping +from statement IDs to data about what expressions are available at +that statement. The data for each statement is a mapping for each +variable ID to the whole expression available at that point(in the +traditional sense) which the variable was last defined to be. So, +this differs from a traditional available expressions analysis in that +only whole expressions from a variable definition are considered rather +than all expressions.<BR> +<BR> +The interface is as follows: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>computeAEs</TT> – Computes available expressions. Requires +that CFG information has already been comptued for each statement. +<LI CLASS="li-itemize"><TT>AvailableExps.stmtStartData</TT> – Contains available +expressions data for each statement after <TT>computeAEs</TT> has been +called. +<LI CLASS="li-itemize"><TT>getAEs</TT> – Takes a statement ID and returns +available expression data for that statement. +<LI CLASS="li-itemize"><TT>instrAEs</TT> – Takes a list of instructions and +the availalbe expressions at the first instruction, and +for each instruction calculates the expressions available +on entering or exiting each instruction. +<LI CLASS="li-itemize"><TT>aeVisitorClass</TT> – A subclass of nopCilVisitor that +can be extended such that the current available expressions +data is available when expressions are visited through the +<TT>get_cur_eh</TT> method of the class. +</UL> +<!--TOC subsection Liveness Analysis--> + +<H3 CLASS="subsection"><A NAME="htoc30">8.11</A> Liveness Analysis</H3><!--SEC END --> + +The <TT>liveness.ml</TT> module uses the dataflow framework and +CFG information to calculate which variables are live at +each program point. After <TT>computeLiveness</TT> is called +following a CFG calculation (Section <A HREF="#sec-cfg">8.1</A>), <TT>LiveFlow.stmtStartData</TT> will +contain a mapping for each statement ID to a set of <TT>varinfo</TT>s +for varialbes live at that program point.<BR> +<BR> +The interface is as follows: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>computeLiveness</TT> – Computes live variables. Requires +that CFG information has already been computed for each statement. +<LI CLASS="li-itemize"><TT>LiveFlow.stmtStartData</TT> – Contains live variable data +for each statement after <TT>computeLiveness</TT> has been called. +</UL> +Also included in this module is a command line interface that +will cause liveness data to be printed to standard out for +a particular function or label. +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>–doliveness</TT> – Instructs cilly to comptue liveness +information and to print on standard out the variables live +at the points specified by <TT>–live_func</TT> and <TT>live_label</TT>. +If both are ommitted, then nothing is printed. +<LI CLASS="li-itemize"><TT>–live_func</TT> – The name of the function whose +liveness data is of interest. If <TT>–live_label</TT> is ommitted, +then data for each statement is printed. +<LI CLASS="li-itemize"><TT>–live_label</TT> – The name of the label at which +the liveness data will be printed. +</UL> +<!--TOC subsection Dead Code Elimination--> + +<H3 CLASS="subsection"><A NAME="htoc31">8.12</A> Dead Code Elimination</H3><!--SEC END --> + +The module <TT>deadcodeelim.ml</TT> uses the reaching definitions +analysis to eliminate assignment instructions whose results +are not used. The interface is as follows: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>elim_dead_code</TT> – Performs dead code elimination +on a function. Requires that CFG information has already +been computed (Section <A HREF="#sec-cfg">8.1</A>). +<LI CLASS="li-itemize"><TT>dce</TT> – Performs dead code elimination on an +entire file. Requires that CFG information has already +been computed. +</UL> +<!--TOC subsection Simple Memory Operations--> + +<H3 CLASS="subsection"><A NAME="htoc32">8.13</A> Simple Memory Operations</H3><!--SEC END --> + +The <TT>simplemem.ml</TT> module allows CIL lvalues that contain memory +accesses to be even futher simplified via the introduction of +well-typed temporaries. After this transformation all lvalues involve +at most one memory reference.<BR> +<BR> +For a concrete example, you can see how <TT>cilly --dosimpleMem</TT> +transforms the following code: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int main () { + int ***three; + int **two; + ***three = **two; + } +</FONT></PRE> +See the <A HREF="examples/ex28.txt">CIL output</A> for this +code fragment<BR> +<BR> +<!--TOC subsection Simple Three-Address Code--> + +<H3 CLASS="subsection"><A NAME="htoc33">8.14</A> Simple Three-Address Code</H3><!--SEC END --> + +The <TT>simplify.ml</TT> module further reduces the complexity of program +expressions and gives you a form of three-address code. After this +transformation all expressions will adhere to the following grammar: +<PRE CLASS="verbatim"> + basic::= + Const _ + Addrof(Var v, NoOffset) + StartOf(Var v, NoOffset) + Lval(Var v, off), where v is a variable whose address is not taken + and off contains only "basic" + + exp::= + basic + Lval(Mem basic, NoOffset) + BinOp(bop, basic, basic) + UnOp(uop, basic) + CastE(t, basic) + + lval ::= + Mem basic, NoOffset + Var v, off, where v is a variable whose address is not taken and off + contains only "basic" +</PRE>In addition, all <TT>sizeof</TT> and <TT>alignof</TT> forms are turned into +constants. Accesses to arrays and variables whose address is taken are +turned into "Mem" accesses. All field and index computations are turned +into address arithmetic.<BR> +<BR> +For a concrete example, you can see how <TT>cilly --dosimplify</TT> +transforms the following code: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int main() { + struct mystruct { + int a; + int b; + } m; + int local; + int arr[3]; + int *ptr; + + ptr = &local; + m.a = local + sizeof(m) + arr[2]; + return m.a; + } +</FONT></PRE> +See the <A HREF="examples/ex29.txt">CIL output</A> for this +code fragment<BR> +<BR> +<!--TOC subsection Converting C to C++--> + +<H3 CLASS="subsection"><A NAME="htoc34">8.15</A> Converting C to C++</H3><!--SEC END --> + +The module canonicalize.ml performs several transformations to correct +differences between C and C++, so that the output is (hopefully) valid +C++ code. This may be incomplete — certain fixes which are necessary +for some programs are not yet implemented.<BR> +<BR> +Using the <TT>--doCanonicalize</TT> option with CIL will perform the +following changes to your program: +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> +Any variables that use C++ keywords as identifiers are renamed. +<LI CLASS="li-enumerate">C allows global variables to have multiple declarations and + multiple (equivalent) definitions. This transformation removes + all but one declaration and all but one definition. +<LI CLASS="li-enumerate"><TT>__inline</TT> is #defined to <TT>inline</TT>, and <TT>__restrict</TT> + is #defined to nothing. +<LI CLASS="li-enumerate">C allows function pointers with no specified arguments to be used on + any argument list. To make C++ accept this code, we insert a cast + from the function pointer to a type that matches the arguments. Of + course, this does nothing to guarantee that the pointer actually has + that type. +<LI CLASS="li-enumerate">Makes casts from int to enum types explicit. (CIL changes enum + constants to int constants, but doesn't use a cast.) +</OL> +<!--TOC section Controlling CIL--> + +<H2 CLASS="section"><A NAME="htoc35">9</A> Controlling CIL</H2><!--SEC END --> + +In the process of converting a C file to CIL we drop the unused prototypes +and even inline function definitions. This results in much smaller files. If +you do not want this behavior then you must pass the <TT>--keepunused</TT> argument +to the CIL application. <BR> +<BR> +Alternatively you can put the following pragma in the code (instructing CIL +to specifically keep the declarations and definitions of the function +<TT>func1</TT> and variable <TT>var2</TT>, the definition of type <TT>foo</TT> and of +structure <TT>bar</TT>): +<PRE CLASS="verbatim"><FONT COLOR=blue> +#pragma cilnoremove("func1", "var2", "type foo", "struct bar") +</FONT></PRE> +<!--TOC section GCC Extensions--> + +<H2 CLASS="section"><A NAME="htoc36">10</A> GCC Extensions</H2><!--SEC END --> + +The CIL parser handles most of the <TT>gcc</TT> +<A HREF="javascript:loadTop('http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_5.html#SEC67')">extensions</A> +and compiles them to CIL. The following extensions are not handled (note that +we are able to compile a large number of programs, including the Linux kernel, +without encountering these): +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> +Nested function definitions. +<LI CLASS="li-enumerate">Constructing function calls. +<LI CLASS="li-enumerate">Naming an expression's type. +<LI CLASS="li-enumerate">Complex numbers +<LI CLASS="li-enumerate">Hex floats +<LI CLASS="li-enumerate">Subscripts on non-lvalue arrays. +<LI CLASS="li-enumerate">Forward function parameter declarations +</OL> +The following extensions are handled, typically by compiling them away: +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> +Attributes for functions, variables and types. In fact, we have a clear +specification (see Section <A HREF="#sec-attrib">6.4</A>) of how attributes are interpreted. The +specification extends that of <TT>gcc</TT>. +<LI CLASS="li-enumerate">Old-style function definitions and prototypes. These are translated to +new-style. +<LI CLASS="li-enumerate">Locally-declared labels. As part of the translation to CIL, we generate +new labels as needed. +<LI CLASS="li-enumerate">Labels as values and computed goto. This allows a program to take the +address of a label and to manipulate it as any value and also to perform a +computed goto. We compile this by assigning each label whose address is taken +a small integer that acts as its address. Every computed <TT>goto</TT> in the body +of the function is replaced with a <TT>switch</TT> statement. If you want to invoke +the label from another function, you are on your own (the <TT>gcc</TT> +documentation says the same.) +<LI CLASS="li-enumerate">Generalized lvalues. You can write code like <TT>(a, b) += 5</TT> and it gets +translated to CIL. +<LI CLASS="li-enumerate">Conditionals with omitted operands. Things like <TT>x ? : y</TT> are +translated to CIL. +<LI CLASS="li-enumerate">Double word integers. The type <TT>long long</TT> and the <TT>LL</TT> suffix on +constants is understood. This is currently interpreted as 64-bit integers. +<LI CLASS="li-enumerate">Local arrays of variable length. These are converted to uses of +<TT>alloca</TT>, the array variable is replaced with a pointer to the allocated +array and the instances of <TT>sizeof(a)</TT> are adjusted to return the size of +the array and not the size of the pointer. +<LI CLASS="li-enumerate">Non-constant local initializers. Like all local initializers these are +compiled into assignments. +<LI CLASS="li-enumerate">Compound literals. These are also turned into assignments. +<LI CLASS="li-enumerate">Designated initializers. The CIL parser actually supports the full ISO +syntax for initializers, which is more than both <TT>gcc</TT> and <TT>MSVC</TT>. I +(George) think that this is the most complicated part of the C language and +whoever designed it should be banned from ever designing languages again. +<LI CLASS="li-enumerate">Case ranges. These are compiled into separate cases. There is no code +duplication, just a larger number of <TT>case</TT> statements. +<LI CLASS="li-enumerate">Transparent unions. This is a strange feature that allows you to define +a function whose formal argument has a (tranparent) union type, but the +argument is called as if it were the first element of the union. This is +compiled away by saying that the type of the formal argument is that of the +first field, and the first thing in the function body we copy the formal into +a union. <BR> +<BR> +<LI CLASS="li-enumerate">Inline assembly-language. The full syntax is supported and it is carried +as such in CIL.<BR> +<BR> +<LI CLASS="li-enumerate">Function names as strings. The identifiers <TT>__FUNCTION__</TT> and +<TT>__PRETTY_FUNCTION__</TT> are replaced with string literals. <BR> +<BR> +<LI CLASS="li-enumerate">Keywords <TT>typeof</TT>, <TT>alignof</TT>, <TT>inline</TT> are supported. +</OL> +<!--TOC section CIL Limitations--> + +<H2 CLASS="section"><A NAME="htoc37">11</A> CIL Limitations</H2><!--SEC END --> + +There are several implementation details of CIL that might make it unusable + or less than ideal for certain tasks: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +CIL operates after preprocessing. If you need to see comments, for +example, you cannot use CIL. But you can use attributes and pragmas instead. +And there is some support to help you patch the include files before they are +seen by the preprocessor. For example, this is how we turn some +<TT>#define</TT>s that we don't like into function calls. <BR> +<BR> +<LI CLASS="li-itemize">CIL does transform the code in a non-trivial way. This is done in order +to make most analyses easier. But if you want to see the code <TT>e1, e2++</TT> +exactly as it appears in the code, then you should not use CIL. <BR> +<BR> +<LI CLASS="li-itemize">CIL removes all local scopes and moves all variables to function +scope. It also separates a declaration with an initializer into a declaration +plus an assignment. The unfortunate effect of this transformation is that +local variables cannot have the <TT>const</TT> qualifier.</UL> +<!--TOC section Known Bugs and Limitations--> + +<H2 CLASS="section"><A NAME="htoc38">12</A> Known Bugs and Limitations</H2><!--SEC END --> + +<UL CLASS="itemize"><LI CLASS="li-itemize">In the new versions of <TT>glibc</TT> there is a function + <TT>__builtin_va_arg</TT> that takes a type as its second argument. CIL + handles that through a slight trick. As it parses the function it changes a + call like: +<PRE CLASS="verbatim"> + mytype x = __builtin_va_arg(marker, mytype) +</PRE>into +<PRE CLASS="verbatim"> + mytype x; + __builtin_va_arg(marker, sizeof(mytype), &x); +</PRE> + The latter form is used internally in CIL. However, the CIL pretty printer + will try to emit the original code. <BR> +<BR> +Similarly, <TT>__builtin_types_compatible_p(t1, t2)</TT>, which takes + types as arguments, is represented internally as + <TT>__builtin_types_compatible_p(sizeof t1, sizeof t2)</TT>, but the + sizeofs are removed when printing.<BR> +<BR> +<LI CLASS="li-itemize">The implementation of <TT>bitsSizeOf</TT> does not take into account the +packing pragmas. However it was tested to be accurate on cygwin/gcc-2.95.3, +Linux/gcc-2.95.3 and on Windows/MSVC.<BR> +<BR> +<LI CLASS="li-itemize">We do not support tri-graph sequences (ISO 5.2.1.1).<BR> +<BR> +<LI CLASS="li-itemize">GCC has a strange feature called “extern inline”. Such a function can +be defined twice: first with the “extern inline” specifier and the second +time without it. If optimizations are turned off then the “extern inline” +definition is considered a prototype (its body is ignored). If optimizations +are turned on then the extern inline function is inlined at all of its +occurrences from the point of its definition all the way to the point where the +(optional) second definition appears. No body is generated for an extern +inline function. A body is generated for the real definition and that one is +used in the rest of the file. <BR> +<BR> +CIL will rename your extern inline function (and its uses) with the suffix + <TT>__extinline</TT>. This means that if you have two such definition, that do + different things and the optimizations are not on, then the CIL version might + compute a different answer !<BR> +<BR> +Also, if you have multiple extern inline declarations then CIL will ignore +but the first one. This is not so bad because GCC itself would not like it. <BR> +<BR> +<LI CLASS="li-itemize">There are still a number of bugs in handling some obscure features of +GCC. For example, when you use variable-length arrays, CIL turns them into +calls to <TT>alloca</TT>. This means that they are deallocated when the function +returns and not when the local scope ends. <BR> +<BR> +Variable-length arrays are not supported as fields of a struct or union.<BR> +<BR> +<LI CLASS="li-itemize">CIL cannot parse arbitrary <TT>#pragma</TT> directives. Their + syntax must follow gcc's attribute syntax to be understood. If you + need a pragma that does not follow gcc syntax, add that pragma's name + to <TT>no_parse_pragma</TT> in <TT>src/frontc/clexer.mll</TT> to indicate that + CIL should treat that pragma as a monolithic string rather than try + to parse its arguments.<BR> +<BR> +CIL cannot parse a line containing an empty <TT>#pragma</TT>.<BR> +<BR> +<LI CLASS="li-itemize">CIL only parses <TT>#pragma</TT> directives at the "top level", this is, + outside of any enum, structure, union, or function definitions.<BR> +<BR> +If your compiler uses pragmas in places other than the top-level, + you may have to preprocess the sources in a special way (sed, perl, + etc.) to remove pragmas from these locations.<BR> +<BR> +<LI CLASS="li-itemize">CIL cannot parse the following code (fixing this problem would require +extensive hacking of the LALR grammar): +<PRE CLASS="verbatim"><FONT COLOR=blue> +int bar(int ()); // This prototype cannot be parsed +int bar(int x()); // If you add a name to the function, it works +int bar(int (*)()); // This also works (and it is more appropriate) +</FONT></PRE><BR> +<BR> +<LI CLASS="li-itemize">CIL also cannot parse certain K&R old-style prototypes with missing +return type: +<PRE CLASS="verbatim"><FONT COLOR=blue> +g(); // This cannot be parsed +int g(); // This is Ok +</FONT></PRE><BR> +<BR> +<LI CLASS="li-itemize">CIL does not understand some obscure combinations of type specifiers +(“signed” and “unsigned” applied to typedefs that themselves contain a +sign specification; you could argue that this should not be allowed anyway): +<PRE CLASS="verbatim"><FONT COLOR=blue> +typedef signed char __s8; +__s8 unsigned uchartest; // This is unsigned char for gcc +</FONT></PRE><BR> +<BR> +<LI CLASS="li-itemize">The statement <TT>x = 3 + x ++</TT> will perform the increment of <TT>x</TT> + before the assignment, while <TT>gcc</TT> delays the increment after the + assignment. It turned out that this behavior is much easier to implement + than gcc's one, and either way is correct (since the behavior is unspecified + in this case). Similarly, if you write <TT>x = x ++;</TT> then CIL will perform + the increment before the assignment, whereas GCC and MSVC will perform it + after the assignment. +</UL> +<!--TOC section Using the merger--> + +<H2 CLASS="section"><A NAME="htoc39">13</A> Using the merger</H2><!--SEC END --> +<A NAME="sec-merger"></A><!--NAME merger.html--> +<BR> +<BR> +There are many program analyses that are more effective when +done on the whole program.<BR> +<BR> +The merger is a tool that combines all of the C source files in a project +into a single C file. There are two tasks that a merger must perform: +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> +Detect what are all the sources that make a project and with what +compiler arguments they are compiled.<BR> +<BR> +<LI CLASS="li-enumerate">Merge all of the source files into a single file. +</OL> +For the first task the merger impersonates a compiler and a linker (both a +GCC and a Microsoft Visual C mode are supported) and it expects to be invoked +(from a build script or a Makefile) on all sources of the project. When +invoked to compile a source the merger just preprocesses the source and saves +the result using the name of the requested object file. By preprocessing at +this time the merger is able to take into account variations in the command +line arguments that affect preprocessing of different source files.<BR> +<BR> +When the merger is invoked to link a number of object files it collects the +preprocessed sources that were stored with the names of the object files, and +invokes the merger proper. Note that arguments that affect the compilation or +linking must be the same for all source files.<BR> +<BR> +For the second task, the merger essentially concatenates the preprocessed +sources with care to rename conflicting file-local declarations (we call this +process alpha-conversion of a file). The merger also attempts to remove +duplicate global declarations and definitions. Specifically the following +actions are taken: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +File-scope names (<TT>static</TT> globals, names of types defined with +<TT>typedef</TT>, and structure/union/enumeration tags) are given new names if they +conflict with declarations from previously processed sources. The new name is +formed by appending the suffix <TT>___n</TT>, where <TT>n</TT> is a unique integer +identifier. Then the new names are applied to their occurrences in the file. <BR> +<BR> +<LI CLASS="li-itemize">Non-static declarations and definitions of globals are never renamed. +But we try to remove duplicate ones. Equality of globals is detected by +comparing the printed form of the global (ignoring the line number directives) +after the body has been alpha-converted. This process is intended to remove +those declarations (e.g. function prototypes) that originate from the same +include file. Similarly, we try to eliminate duplicate definitions of +<TT>inline</TT> functions, since these occasionally appear in include files.<BR> +<BR> +<LI CLASS="li-itemize">The types of all global declarations with the same name from all files +are compared for type isomorphism. During this process, the merger detects all +those isomorphisms between structures and type definitions that are <B>required</B> for the merged program to be legal. Such structure tags and +typenames are coalesced and given the same name. <BR> +<BR> +<LI CLASS="li-itemize">Besides the structure tags and type names that are required to be +isomorphic, the merger also tries to coalesce definitions of structures and +types with the same name from different file. However, in this case the merger +will not give an error if such definitions are not isomorphic; it will just +use different names for them. <BR> +<BR> +<LI CLASS="li-itemize">In rare situations, it can happen that a file-local global in +encountered first and it is not renamed, only to discover later when +processing another file that there is an external symbol with the same name. +In this case, a second pass is made over the merged file to rename the +file-local symbol. +</UL> +Here is an example of using the merger:<BR> +<BR> +The contents of <TT>file1.c</TT> is: +<PRE CLASS="verbatim"><FONT COLOR=blue> +struct foo; // Forward declaration +extern struct foo *global; +</FONT></PRE> +The contents of <TT>file2.c</TT> is: +<PRE CLASS="verbatim"><FONT COLOR=blue> +struct bar { + int x; + struct bar *next; +}; +extern struct bar *global; +struct foo { + int y; +}; +extern struct foo another; +void main() { +} +</FONT></PRE> +There are several ways in which one might create an executable from these +files: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<PRE CLASS="verbatim"> +gcc file1.c file2.c -o a.out +</PRE><BR> +<BR> +<LI CLASS="li-itemize"><PRE CLASS="verbatim"> +gcc -c file1.c -o file1.o +gcc -c file2.c -o file2.o +ld file1.o file2.o -o a.out +</PRE><BR> +<BR> +<LI CLASS="li-itemize"><PRE CLASS="verbatim"> +gcc -c file1.c -o file1.o +gcc -c file2.c -o file2.o +ar r libfile2.a file2.o +gcc file1.o libfile2.a -o a.out +</PRE><BR> +<BR> +<LI CLASS="li-itemize"><PRE CLASS="verbatim"> +gcc -c file1.c -o file1.o +gcc -c file2.c -o file2.o +ar r libfile2.a file2.o +gcc file1.o -lfile2 -o a.out +</PRE></UL> +In each of the cases above you must replace all occurrences of <TT>gcc</TT> and +<TT>ld</TT> with <TT>cilly --merge</TT>, and all occurrences of <TT>ar</TT> with <TT>cilly +--merge --mode=AR</TT>. It is very important that the <TT>--merge</TT> flag be used +throughout the build process. If you want to see the merged source file you +must also pass the <TT>--keepmerged</TT> flag to the linking phase. <BR> +<BR> +The result of merging file1.c and file2.c is: +<PRE CLASS="verbatim"><FONT COLOR=blue> +// from file1.c +struct foo; // Forward declaration +extern struct foo *global; + +// from file2.c +struct foo { + int x; + struct foo *next; +}; +struct foo___1 { + int y; +}; +extern struct foo___1 another; +</FONT></PRE> +<!--TOC section Using the patcher--> + +<H2 CLASS="section"><A NAME="htoc40">14</A> Using the patcher</H2><!--SEC END --> +<A NAME="sec-patcher"></A><!--NAME patcher.html--> +<BR> +<BR> +Occasionally we have needed to modify slightly the standard include files. +So, we developed a simple mechanism that allows us to create modified copies +of the include files and use them instead of the standard ones. For this +purpose we specify a patch file and we run a program caller Patcher which +makes modified copies of include files and applies the patch.<BR> +<BR> +The patcher is invoked as follows: +<PRE CLASS="verbatim"> +bin/patcher [options] + +Options: + --help Prints this help message + --verbose Prints a lot of information about what is being done + --mode=xxx What tool to emulate: + GNUCC - GNU CC + MSVC - MS VC cl compiler + + --dest=xxx The destination directory. Will make one if it does not exist + --patch=xxx Patch file (can be specified multiple times) + --ppargs=xxx An argument to be passed to the preprocessor (can be specified + multiple times) + + --ufile=xxx A user-include file to be patched (treated as \#include "xxx") + --sfile=xxx A system-include file to be patched (treated as \#include <xxx>) + + --clean Remove all files in the destination directory + --dumpversion Print the version name used for the current compiler + + All of the other arguments are passed to the preprocessor. You should pass + enough arguments (e.g., include directories) so that the patcher can find the + right include files to be patched. +</PRE> + Based on the given <TT>mode</TT> and the current version of the compiler (which +the patcher can print when given the <TT>dumpversion</TT> argument) the patcher +will create a subdirectory of the <TT>dest</TT> directory (say <TT>/usr/home/necula/cil/include</TT>), such as: +<PRE CLASS="verbatim"> +/usr/home/necula/cil/include/gcc_2.95.3-5 +</PRE> + In that file the patcher will copy the modified versions of the include files +specified with the <TT>ufile</TT> and <TT>sfile</TT> options. Each of these options can +be specified multiple times. <BR> +<BR> +The patch file (specified with the <TT>patch</TT> option) has a format inspired by +the Unix <TT>patch</TT> tool. The file has the following grammar: +<PRE CLASS="verbatim"> +<<< flags +patterns +=== +replacement +>>> +</PRE> + The flags are a comma separated, case-sensitive, sequence of keywords or +keyword = value. The following flags are supported: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>file=foo.h</TT> - will only apply the patch on files whose name is + <TT>foo.h</TT>. +<LI CLASS="li-itemize"><TT>optional</TT> - this means that it is Ok if the current patch does not +match any of the processed files. +<LI CLASS="li-itemize"><TT>group=foo</TT> - will add this patch to the named group. If this is not +specified then a unique group is created to contain just the current patch. +When all files specified in the command line have been patched, an error +message is generated for all groups for whom no member patch was used. We use +this mechanism to receive notice when the patch triggers are out-dated with +respect to the new include files. +<LI CLASS="li-itemize"><TT>system=sysname</TT> - will only consider this pattern on a given +operating system. The “sysname” is reported by the “$Ô” variable in +Perl, except that Windows is always considered to have sysname +“cygwin.” For Linux use “linux” (capitalization matters). +<LI CLASS="li-itemize"><TT>ateof</TT> - In this case the patterns are ignored and the replacement +text is placed at the end of the patched file. Use the <TT>file</TT> flag if you +want to restrict the files in which this replacement is performed. +<LI CLASS="li-itemize"><TT>atsof</TT> - The patterns are ignored and the replacement text is placed +at the start of the patched file. Uf the <TT>file</TT> flag to restrict the +application of this patch to a certain file. +<LI CLASS="li-itemize"><TT>disabled</TT> - Use this flag if you want to disable the pattern. +</UL> +The patterns can consist of several groups of lines separated by the <TT>|||</TT> +marker. Each of these group of lines is a multi-line pattern that if found in +the file will be replaced with the text given at the end of the block. <BR> +<BR> +The matching is space-insensitive.<BR> +<BR> +All of the markers <TT><<<</TT>, <TT>|||</TT>, <TT>===</TT> and <TT>>>></TT> must appear at the +beginning of a line but they can be followed by arbitrary text (which is +ignored).<BR> +<BR> +The replacement text can contain the special keyword <TT>@__pattern__@</TT>, +which is substituted with the pattern that matched. <BR> +<BR> +<!--TOC section Debugging support--> + +<H2 CLASS="section"><A NAME="htoc41">15</A> Debugging support</H2><!--SEC END --> +<A NAME="sec-debugger"></A> +Most of the time we debug our code using the Errormsg module along with the +pretty printer. But if you want to use the Ocaml debugger here is an easy way +to do it. Say that you want to debug the invocation of cilly that arises out +of the following command: +<PRE CLASS="verbatim"> +cilly -c hello.c +</PRE> + You must follow the installation <A HREF="../ccured/setup.html">instructions</A> +to install the Elist support files for ocaml and to extend your .emacs +appropriately. Then from within Emacs you do +<PRE CLASS="verbatim"> +ALT-X my-camldebug +</PRE> + This will ask you for the command to use for running the Ocaml debugger +(initially the default will be “ocamldebug” or the last command you +introduced). You use the following command: +<PRE CLASS="verbatim"> +cilly --ocamldebug -c hello.c +</PRE> + This will run <TT>cilly</TT> as usual and invoke the Ocaml debugger when the cilly +engine starts. The advantage of this way of invoking the debugger is that the +directory search paths are set automatically and the right set or arguments is +passed to the debugger. <BR> +<BR> +<!--TOC section Who Says C is Simple?--> + +<H2 CLASS="section"><A NAME="htoc42">16</A> Who Says C is Simple?</H2><!--SEC END --> +<A NAME="sec-simplec"></A> +When I (George) started to write CIL I thought it was going to take two weeks. +Exactly a year has passed since then and I am still fixing bugs in it. This +gross underestimate was due to the fact that I thought parsing and making +sense of C is simple. You probably think the same. What I did not expect was +how many dark corners this language has, especially if you want to parse +real-world programs such as those written for GCC or if you are more ambitious +and you want to parse the Linux or Windows NT sources (both of these were +written without any respect for the standard and with the expectation that +compilers will be changed to accommodate the program). <BR> +<BR> +The following examples were actually encountered either in real programs or +are taken from the ISO C99 standard or from the GCC's testcases. My first +reaction when I saw these was: <EM>Is this C?</EM>. The second one was : <EM>What the hell does it mean?</EM>. <BR> +<BR> +If you are contemplating doing program analysis for C on abstract-syntax +trees then your analysis ought to be able to handle these things. Or, you can +use CIL and let CIL translate them into clean C code. <BR> +<BR> +<!--TOC subsection Standard C--> + +<H3 CLASS="subsection"><A NAME="htoc43">16.1</A> Standard C</H3><!--SEC END --> + +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">Why does the following code return 0 for most values of <TT>x</TT>? (This +should be easy.) +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x; + return x == (1 && x); +</FONT></PRE> +See the <A HREF="examples/ex30.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Why does the following code return 0 and not -1? (Answer: because +<TT>sizeof</TT> is unsigned, thus the result of the subtraction is unsigned, thus +the shift is logical.) +<PRE CLASS="verbatim"><FONT COLOR=blue> + return ((1 - sizeof(int)) >> 32); +</FONT></PRE> +See the <A HREF="examples/ex31.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Scoping rules can be tricky. This function returns 5. +<PRE CLASS="verbatim"><FONT COLOR=blue> +int x = 5; +int f() { + int x = 3; + { + extern int x; + return x; + } +} +</FONT></PRE> +See the <A HREF="examples/ex32.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Functions and function pointers are implicitly converted to each other. +<PRE CLASS="verbatim"><FONT COLOR=blue> +int (*pf)(void); +int f(void) { + + pf = &f; // This looks ok + pf = ***f; // Dereference a function? + pf(); // Invoke a function pointer? + (****pf)(); // Looks strange but Ok + (***************f)(); // Also Ok +} +</FONT></PRE> +See the <A HREF="examples/ex33.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Initializer with designators are one of the hardest parts about ISO C. +Neither MSVC or GCC implement them fully. GCC comes close though. What is the +final value of <TT>i.nested.y</TT> and <TT>i.nested.z</TT>? (Answer: 2 and respectively +6). +<PRE CLASS="verbatim"><FONT COLOR=blue> +struct { + int x; + struct { + int y, z; + } nested; +} i = { .nested.y = 5, 6, .x = 1, 2 }; +</FONT></PRE> +See the <A HREF="examples/ex34.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">This is from c-torture. This function returns 1. +<PRE CLASS="verbatim"><FONT COLOR=blue> +typedef struct +{ + char *key; + char *value; +} T1; + +typedef struct +{ + long type; + char *value; +} T3; + +T1 a[] = +{ + { + "", + ((char *)&((T3) {1, (char *) 1})) + } +}; +int main() { + T3 *pt3 = (T3*)a[0].value; + return pt3->value; +} +</FONT></PRE> +See the <A HREF="examples/ex35.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Another one with constructed literals. This one is legal according to +the GCC documentation but somehow GCC chokes on (it works in CIL though). This +code returns 2. +<PRE CLASS="verbatim"><FONT COLOR=blue> + return ((int []){1,2,3,4})[1]; +</FONT></PRE> +See the <A HREF="examples/ex36.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">In the example below there is one copy of “bar” and two copies of + “pbar” (static prototypes at block scope have file scope, while for all + other types they have block scope). +<PRE CLASS="verbatim"><FONT COLOR=blue> + int foo() { + static bar(); + static (*pbar)() = bar; + + } + + static bar() { + return 1; + } + + static (*pbar)() = 0; +</FONT></PRE> +See the <A HREF="examples/ex37.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Two years after heavy use of CIL, by us and others, I discovered a bug + in the parser. The return value of the following function depends on what + precedence you give to casts and unary minus: +<PRE CLASS="verbatim"><FONT COLOR=blue> + unsigned long foo() { + return (unsigned long) - 1 / 8; + } +</FONT></PRE> +See the <A HREF="examples/ex38.txt">CIL output</A> for this +code fragment<BR> +<BR> +The correct interpretation is <TT>((unsigned long) - 1) / 8</TT>, which is a + relatively large number, as opposed to <TT>(unsigned long) (- 1 / 8)</TT>, which + is 0. </OL> +<!--TOC subsection GCC ugliness--> + +<H3 CLASS="subsection"><A NAME="htoc44">16.2</A> GCC ugliness</H3><!--SEC END --> +<A NAME="sec-ugly-gcc"></A> +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">GCC has generalized lvalues. You can take the address of a lot of +strange things: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x, y, z; + return &(x ? y : z) - & (x++, x); +</FONT></PRE> +See the <A HREF="examples/ex39.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">GCC lets you omit the second component of a conditional expression. +<PRE CLASS="verbatim"><FONT COLOR=blue> + extern int f(); + return f() ? : -1; // Returns the result of f unless it is 0 +</FONT></PRE> +See the <A HREF="examples/ex40.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Computed jumps can be tricky. CIL compiles them away in a fairly clean +way but you are on your own if you try to jump into another function this way. +<PRE CLASS="verbatim"><FONT COLOR=blue> +static void *jtab[2]; // A jump table +static int doit(int x){ + + static int jtab_init = 0; + if(!jtab_init) { // Initialize the jump table + jtab[0] = &&lbl1; + jtab[1] = &&lbl2; + jtab_init = 1; + } + goto *jtab[x]; // Jump through the table +lbl1: + return 0; +lbl2: + return 1; +} + +int main(void){ + if (doit(0) != 0) exit(1); + if (doit(1) != 1) exit(1); + exit(0); +} +</FONT></PRE> +See the <A HREF="examples/ex41.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">A cute little example that we made up. What is the returned value? +(Answer: 1); +<PRE CLASS="verbatim"><FONT COLOR=blue> + return ({goto L; 0;}) && ({L: 5;}); +</FONT></PRE> +See the <A HREF="examples/ex42.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate"><TT>extern inline</TT> is a strange feature of GNU C. Can you guess what the +following code computes? +<PRE CLASS="verbatim"><FONT COLOR=blue> +extern inline foo(void) { return 1; } +int firstuse(void) { return foo(); } + +// A second, incompatible definition of foo +int foo(void) { return 2; } + +int main() { + return foo() + firstuse(); +} +</FONT></PRE> +See the <A HREF="examples/ex43.txt">CIL output</A> for this +code fragment<BR> +<BR> +The answer depends on whether the optimizations are turned on. If they are +then the answer is 3 (the first definition is inlined at all occurrences until +the second definition). If the optimizations are off, then the first +definition is ignore (treated like a prototype) and the answer is 4. <BR> +<BR> +CIL will misbehave on this example, if the optimizations are turned off (it + always returns 3).<BR> +<BR> +<LI CLASS="li-enumerate">GCC allows you to cast an object of a type T into a union as long as the +union has a field of that type: +<PRE CLASS="verbatim"><FONT COLOR=blue> +union u { + int i; + struct s { + int i1, i2; + } s; +}; + +union u x = (union u)6; + +int main() { + struct s y = {1, 2}; + union u z = (union u)y; +} +</FONT></PRE> +See the <A HREF="examples/ex44.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">GCC allows you to use the <TT>__mode__</TT> attribute to specify the size +of the integer instead of the standard <TT>char</TT>, <TT>short</TT> and so on: +<PRE CLASS="verbatim"><FONT COLOR=blue> +int __attribute__ ((__mode__ ( __QI__ ))) i8; +int __attribute__ ((__mode__ ( __HI__ ))) i16; +int __attribute__ ((__mode__ ( __SI__ ))) i32; +int __attribute__ ((__mode__ ( __DI__ ))) i64; +</FONT></PRE> +See the <A HREF="examples/ex45.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">The “alias” attribute on a function declaration tells the + linker to treat this declaration as another name for the specified + function. CIL will replace the declaration with a trampoline + function pointing to the specified target. +<PRE CLASS="verbatim"><FONT COLOR=blue> + static int bar(int x, char y) { + return x + y; + } + + //foo is considered another name for bar. + int foo(int x, char y) __attribute__((alias("bar"))); +</FONT></PRE> +See the <A HREF="examples/ex46.txt">CIL output</A> for this +code fragment</OL> +<!--TOC subsection Microsoft VC ugliness--> + +<H3 CLASS="subsection"><A NAME="htoc45">16.3</A> Microsoft VC ugliness</H3><!--SEC END --> + +This compiler has few extensions, so there is not much to say here. +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> +Why does the following code return 0 and not -1? (Answer: because of a +bug in Microsoft Visual C. It thinks that the shift is unsigned just because +the second operator is unsigned. CIL reproduces this bug when in MSVC mode.) +<PRE CLASS="verbatim"><FONT COLOR=blue> + return -3 >> (8 * sizeof(int)); +</FONT></PRE><BR> +<BR> +<LI CLASS="li-enumerate">Unnamed fields in a structure seem really strange at first. It seems +that Microsoft Visual C introduced this extension, then GCC picked it up (but +in the process implemented it wrongly: in GCC the field <TT>y</TT> overlaps with +<TT>x</TT>!). +<PRE CLASS="verbatim"><FONT COLOR=blue> +struct { + int x; + struct { + int y, z; + struct { + int u, v; + }; + }; +} a; +return a.x + a.y + a.z + a.u + a.v; +</FONT></PRE> +See the <A HREF="examples/ex47.txt">CIL output</A> for this +code fragment</OL> +<!--TOC section Authors--> + +<H2 CLASS="section"><A NAME="htoc46">17</A> Authors</H2><!--SEC END --> + +The CIL parser was developed starting from Hugues Casse's <TT>frontc</TT> +front-end for C although all the files from the <TT>frontc</TT> distribution have +been changed very extensively. The intermediate language and the elaboration +stage are all written from scratch. The main author is +<A HREF="mailto:necula@cs.berkeley.edu">George Necula</A>, with significant +contributions from <A HREF="mailto:smcpeak@cs.berkeley.edu">Scott McPeak</A>, +<A HREF="mailto:weimer@cs.berkeley.edu">Westley Weimer</A>, +<A HREF="mailto:liblit@cs.wisc.edu">Ben Liblit</A>, +<A HREF="javascript:loadTop('http://www.cs.berkeley.edu/~matth/')">Matt Harren</A>, +Raymond To and Aman Bhargava.<BR> +<BR> +This work is based upon work supported in part by the National Science +Foundation under Grants No. 9875171, 0085949 and 0081588, and gifts from +Microsoft Research. Any opinions, findings, and conclusions or recommendations +expressed in this material are those of the author(s) and do not necessarily +reflect the views of the National Science Foundation or the other sponsors.<BR> +<BR> +<!--TOC section License--> + +<H2 CLASS="section"><A NAME="htoc47">18</A> License</H2><!--SEC END --> + +Copyright (c) 2001-2005, +<UL CLASS="itemize"><LI CLASS="li-itemize"> +George C. Necula <necula@cs.berkeley.edu> +<LI CLASS="li-itemize">Scott McPeak <smcpeak@cs.berkeley.edu> +<LI CLASS="li-itemize">Wes Weimer <weimer@cs.berkeley.edu> +<LI CLASS="li-itemize">Ben Liblit <liblit@cs.wisc.edu> +</UL> +All rights reserved.<BR> +<BR> +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met:<BR> +<BR> +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.<BR> +<BR> +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.<BR> +<BR> +3. The names of the contributors may not be used to endorse or promote +products derived from this software without specific prior written +permission.<BR> +<BR> +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.<BR> +<BR> +<!--TOC section Bug reports--> + +<H2 CLASS="section"><A NAME="htoc48">19</A> Bug reports</H2><!--SEC END --> + +We are certain that there are still some remaining bugs in CIL. If you find +one please file a bug report in our Source Forge space +<A HREF="javascript:loadTop('http://sourceforge.net/projects/cil')">http://sourceforge.net/projects/cil</A>. <BR> +<BR> +You can find there the latest announcements, a source distribution, +bug report submission instructions and a mailing list: cil-users[at +sign]lists.sourceforge.net. Please use this list to ask questions about CIL, +as it will ensure your message is viewed by a broad audience. <BR> +<BR> +<!--TOC section Changes--> + +<H2 CLASS="section"><A NAME="htoc49">20</A> Changes</H2><!--SEC END --> +<A NAME="sec-changes"></A><!--NAME changes.html--> + +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<B>May 20, 2006</B>: <B>Released version 1.3.5</B> +<LI CLASS="li-itemize"><B>May 19, 2006</B>: <TT>Makefile.cil.in</TT>/<TT>Makefile.cil</TT> have + been renamed <TT>Makefile.in</TT>/<TT>Makefile</TT>. And <TT>maincil.ml</TT> has + been renamed <TT>main.ml</TT>. +<LI CLASS="li-itemize"><B>May 18, 2006</B>: Added a new module <A HREF="api/Cfg.html">Cfg</A> to compute the + control-flow graph. Unlike the older <A HREF="api/Cil.html#VALcomputeCFGInfo">Cil.computeCFGInfo</A>, + the new version does not modify the code. +<LI CLASS="li-itemize"><B>May 18, 2006</B>: Added several new analyses: reaching + definitions, available expressions, liveness analysis, and dead code + elimination. See Section <A HREF="#sec-Extension">8</A>. +<LI CLASS="li-itemize"><B>May 2, 2006</B>: Added a flag <TT>--noInsertImplicitCasts</TT>. + When this flag is used, CIL code will only include casts inserted by + the programmer. Implicit coercions are not changed to explicit casts. +<LI CLASS="li-itemize"><B>April 16, 2006</B>: Minor improvements to the <TT>--stats</TT> + flag (Section <A HREF="#sec-cilly-asm-options">7.2</A>). We now use Pentium performance + counters by default, if your processor supports them. +<LI CLASS="li-itemize"><B>April 10, 2006</B>: Extended <TT>machdep.c</TT> to support + microcontroller compilers where the struct alignment of integer + types does not match the size of the type. Thanks to Nathan + Cooprider for the patch. +<LI CLASS="li-itemize"><B>April 6, 2006</B>: Fix for global initializers of unions when + the union field being initialized is not the first one, and for + missing initializers of unions when the first field is not the + largest field. +<LI CLASS="li-itemize"><B>April 6, 2006</B>: Fix for bitfields in the SFI module. +<LI CLASS="li-itemize"><B>April 6, 2006</B>: Various fixes for gcc attributes. + <TT>packed</TT>, <TT>section</TT>, and <TT>always_inline</TT> attributes are now + parsed correctly. Also fixed printing of attributes on enum types. +<LI CLASS="li-itemize"><B>March 30, 2006</B>: Fix for <TT>rmtemps.ml</TT>, which deletes + unused inline functions. When in <TT>gcc</TT> mode CIL now leaves all + inline functions in place, since <TT>gcc</TT> treats these as externally + visible. +<LI CLASS="li-itemize"><B>March 15, 2006</B>: Fix for <TT>typeof(<I>e</I>)</TT> when <I>e</I> has type + <TT>void</TT>. +<LI CLASS="li-itemize"><B>March 3, 2006</B>: Assume inline assembly instructions can + fall through for the purposes of adding return statements. Thanks to + Nathan Cooprider for the patch. +<LI CLASS="li-itemize"><B>February 27, 2006</B>: Fix for extern inline functions when + the output of CIL is fed back into CIL. +<LI CLASS="li-itemize"><B>January 30, 2006</B>: Fix parsing of <TT>switch</TT> without braces. +<LI CLASS="li-itemize"><B>January 30, 2006</B>: Allow `$' to appear in identifiers. +<LI CLASS="li-itemize"><B>January 13, 2006</B>: Added support for gcc's alias attribute + on functions. See Section <A HREF="#sec-ugly-gcc">16.2</A>, item 8. +<LI CLASS="li-itemize"><B>December 9, 2005</B>: Christoph Spiel fixed the Golf and + Olf modules so that Golf can be used with the points-to analysis. + He also added performance fixes and cleaned up the documentation. +<LI CLASS="li-itemize"><B>December 1, 2005</B>: Major rewrite of the ext/callgraph module. +<LI CLASS="li-itemize"><B>December 1, 2005</B>: Preserve enumeration constants in CIL. Default +is the old behavior to replace them with integers. +<LI CLASS="li-itemize"><B>November 30, 2005</B>: Added support for many GCC <TT>__builtin</TT> + functions. +<LI CLASS="li-itemize"><B>November 30, 2005</B>: Added the EXTRAFEATURES configure + option, making it easier to add Features to the build process. +<LI CLASS="li-itemize"><B>November 23, 2005</B>: In MSVC mode do not remove any locals whose name + appears as a substring in an inline assembly. +<LI CLASS="li-itemize"><B>November 23, 2005</B>: Do not add a return to functions that have the + noreturn attribute. +<LI CLASS="li-itemize"><B>November 22, 2005</B>: <B>Released version 1.3.4</B> +<LI CLASS="li-itemize"><B>November 21, 2005</B>: Performance and correctness fixes for + the Points-to Analysis module. Thanks to Christoph Spiel for the + patches. +<LI CLASS="li-itemize"><B>October 5, 2005</B>: CIL now builds on SPARC/Solaris. Thanks + to Nick Petroni and Remco van Engelen for the patches. +<LI CLASS="li-itemize"><B>September 26, 2005</B>: CIL no longer uses the `<TT>-I-</TT>' flag + by default when preprocessing with gcc. +<LI CLASS="li-itemize"><B>August 24, 2005</B>: Added a command-line option + “--forceRLArgEval” that forces function arguments to be evaluated + right-to-left. This is the default behavior in unoptimized gcc and + MSVC, but the order of evaluation is undefined when using + optimizations, unless you apply this CIL transformation. This flag + does not affect the order of evaluation of e.g. binary operators, + which remains undefined. Thanks to Nathan Cooprider for the patch. +<LI CLASS="li-itemize"><B>August 9, 2005</B>: Fixed merging when there are more than 20 + input files. +<LI CLASS="li-itemize"><B>August 3, 2005</B>: When merging, it is now an error to + declare the same global variable twice with different initializers. +<LI CLASS="li-itemize"><B>July 27, 2005</B>: Fixed bug in transparent unions. +<LI CLASS="li-itemize"><B>July 27, 2005</B>: Fixed bug in collectInitializer. Thanks to + Benjamin Monate for the patch. +<LI CLASS="li-itemize"><B>July 26, 2005</B>: Better support for extended inline assembly + in gcc. +<LI CLASS="li-itemize"><B>July 26, 2005</B>: Added many more gcc __builtin* functions + to CIL. Most are treated as Call instructions, but a few are + translated into expressions so that they can be used in global + initializers. For example, “<TT>__builtin_offsetof(t, field)</TT>” is + rewritten as “<TT>&((t*)0)->field</TT>”, the traditional way of calculating + an offset. +<LI CLASS="li-itemize"><B>July 18, 2005</B>: Fixed bug in the constant folding of shifts + when the second argument was negative or too large. +<LI CLASS="li-itemize"><B>July 18, 2005</B>: Fixed bug where casts were not always + inserted in function calls. +<LI CLASS="li-itemize"><B>June 10, 2005</B>: Fixed bug in the code that makes implicit + returns explicit. We weren't handling switch blocks correctly. +<LI CLASS="li-itemize"><B>June 1, 2005</B>: <B>Released version 1.3.3</B> +<LI CLASS="li-itemize"><B>May 31, 2005</B>: Fixed handling of noreturn attribute for function + pointers. +<LI CLASS="li-itemize"><B>May 30, 2005</B>: Fixed bugs in the handling of constructors in gcc. +<LI CLASS="li-itemize"><B>May 30, 2005</B>: Fixed bugs in the generation of global variable IDs. +<LI CLASS="li-itemize"><B>May 27, 2005</B>: Reimplemented the translation of function calls so + that we can intercept some builtins. This is important for the uses of + __builtin_constant_p in constants. +<LI CLASS="li-itemize"><B>May 27, 2005</B>: Export the plainCilPrinter, for debugging. +<LI CLASS="li-itemize"><B>May 27, 2005</B>: Fixed bug with printing of const attribute for + arrays. +<LI CLASS="li-itemize"><B>May 27, 2005</B>: Fixed bug in generation of type signatures. Now they + should not contain expressions anymore, so you can use structural equality. + This used to lead to Out_of_Memory exceptions. +<LI CLASS="li-itemize"><B>May 27, 2005</B>: Fixed bug in type comparisons using + TBuiltin_va_list. +<LI CLASS="li-itemize"><B>May 27, 2005</B>: Improved the constant folding in array lengths and + case expressions. +<LI CLASS="li-itemize"><B>May 27, 2005</B>: Added the <TT>__builtin_frame_address</TT> to the set + of gcc builtins. +<LI CLASS="li-itemize"><B>May 27, 2005</B>: Added the CIL project to SourceForge. +<LI CLASS="li-itemize"><B>April 23, 2005</B>: The cattr field was not visited. +<LI CLASS="li-itemize"><B>March 6, 2005</B>: Debian packaging support +<LI CLASS="li-itemize"><B>February 16, 2005</B>: Merger fixes. +<LI CLASS="li-itemize"><B>February 11, 2005</B>: Fixed a bug in <TT>--dopartial</TT>. Thanks to +Nathan Cooprider for this fix. +<LI CLASS="li-itemize"><B>January 31, 2005</B>: Make sure the input file is closed even if a + parsing error is encountered. +<LI CLASS="li-itemize"><B>January 11, 2005</B>: <B>Released version 1.3.2</B> +<LI CLASS="li-itemize"><B>January 11, 2005</B>: Fixed printing of integer constants whose + integer kind is shorter than an int. +<LI CLASS="li-itemize"><B>January 11, 2005</B>: Added checks for negative size arrays and arrays + too big. +<LI CLASS="li-itemize"><B>January 10, 2005</B>: Added support for GCC attribute “volatile” for + tunctions (as a synonim for noreturn). +<LI CLASS="li-itemize"><B>January 10, 2005</B>: Improved the comparison of array sizes when + comparing array types. +<LI CLASS="li-itemize"><B>January 10, 2005</B>: Fixed handling of shell metacharacters in the + cilly command lione. +<LI CLASS="li-itemize"><B>January 10, 2005</B>: Fixed dropping of cast in initialization of + local variable with the result of a function call. +<LI CLASS="li-itemize"><B>January 10, 2005</B>: Fixed some structural comparisons that were + broken in the Ocaml 3.08. +<LI CLASS="li-itemize"><B>January 10, 2005</B>: Fixed the <TT>unrollType</TT> function to not forget + attributes. +<LI CLASS="li-itemize"><B>January 10, 2005</B>: Better keeping track of locations of function + prototypes and definitions. +<LI CLASS="li-itemize"><B>January 10, 2005</B>: Fixed bug with the expansion of enumeration + constants in attributes. +<LI CLASS="li-itemize"><B>October 18, 2004</B>: Fixed a bug in cabsvisit.ml. CIl would wrap a + BLOCK around a single atom unnecessarily. +<LI CLASS="li-itemize"><B>August 7, 2004</B>: <B>Released version 1.3.1</B> +<LI CLASS="li-itemize"><B>August 4, 2004</B>: Fixed a bug in splitting of structs using + <TT>--dosimplify</TT> +<LI CLASS="li-itemize"><B>July 29, 2004</B>: Minor changes to the type typeSig (type signatures) + to ensure that they do not contain types, so that you can do structural + comparison without danger of nontermination. +<LI CLASS="li-itemize"><B>July 28, 2004</B>: Ocaml version 3.08 is required. Numerous small + changes while porting to Ocaml 3.08. +<LI CLASS="li-itemize"><B>July 7, 2004</B>: <B>Released version 1.2.6</B> +<LI CLASS="li-itemize"><B>July 2, 2004</B>: Character constants such as <TT>'c'</TT> should + have type <TT>int</TT>, not <TT>char</TT>. Added a utility function + <TT>Cil.charConstToInt</TT> that sign-extends chars greater than 128, if needed. +<LI CLASS="li-itemize"><B>July 2, 2004</B>: Fixed a bug that was casting values to int + before applying the logical negation operator !. This caused + problems for floats, and for integer types bigger than <TT>int</TT>. +<LI CLASS="li-itemize"><B>June 13, 2004</B>: Added the field <TT>sallstmts</TT> to a function + description, to hold all statements in the function. +<LI CLASS="li-itemize"><B>June 13, 2004</B>: Added new extensions for data flow analyses, and + for computing dominators. +<LI CLASS="li-itemize"><B>June 10, 2004</B>: Force initialization of CIL at the start of +Cabs2cil. +<LI CLASS="li-itemize"><B>June 9, 2004</B>: Added support for GCC <TT>__attribute_used__</TT> +<LI CLASS="li-itemize"><B>April 7, 2004</B>: <B>Released version 1.2.5</B> +<LI CLASS="li-itemize"><B>April 7, 2004</B>: Allow now to run ./configure CC=cl and set the MSVC +compiler to be the default. The MSVC driver will now select the default name +of the .exe file like the CL compiler. +<LI CLASS="li-itemize"><B>April 7, 2004</B>: Fixed a bug in the driver. The temporary files are +deleted by the Perl script before the CL compiler gets to them? +<LI CLASS="li-itemize"><B>April 7, 2004</B>: Added the - form of arguments to the MSVC driver. +<LI CLASS="li-itemize"><B>April 7, 2004</B>: Added a few more GCC-specific string escapes, (, [, +{, %, E. +<LI CLASS="li-itemize"><B>April 7, 2004</B>: Fixed bug with continuation lines in MSVC. +<LI CLASS="li-itemize"><B>April 6, 2004</B>: Fixed embarassing bug in the parser: the precedence + of casts and unary operators was switched. +<LI CLASS="li-itemize"><B>April 5, 2004</B>: Fixed a bug involving statements mixed between +declarations containing initializers. Now we make sure that the initializers +are run in the proper order with respect to the statements. +<LI CLASS="li-itemize"><B>April 5, 2004</B>: Fixed a bug in the merger. The merger was keeping +separate alpha renaming talbes (namespaces) for variables and types. This +means that it might end up with a type and a variable named the same way, if +they come from different files, which breaks an important CIL invariant. +<LI CLASS="li-itemize"><B>March 11, 2004</B> : Fixed a bug in the Cil.copyFunction function. The +new local variables were not getting fresh IDs. +<LI CLASS="li-itemize"><B>March 5, 2004</B>: Fixed a bug in the handling of static function + prototypes in a block scope. They used to be renamed. Now we just consider + them global. +<LI CLASS="li-itemize"><B>February 20, 2004</B>: <B>Released version 1.2.4</B> +<LI CLASS="li-itemize"><B>February 15, 2004</B>: Changed the parser to allow extra semicolons + after field declarations. +<LI CLASS="li-itemize"><B>February 14, 2004</B>: Changed the Errormsg functions: error, unimp, +bug to not raise an exception. Instead they just set Errormsg.hadErrors. +<LI CLASS="li-itemize"><B>February 13, 2004</B>: Change the parsing of attributes to recognize + enumeration constants. +<LI CLASS="li-itemize"><B>February 10, 2004</B>: In some versions of <TT>gcc</TT> the identifier + _{thread is an identifier and in others it is a keyword. Added code + during configuration to detect which is the case. +<LI CLASS="li-itemize"><B>January 7, 2004</B>: <B>Released version 1.2.3</B> +<LI CLASS="li-itemize"><B>January 7, 2004</B>: Changed the alpha renamer to be less +conservative. It will remember all versions of a name that were seen and will +only create a new name if we have not seen one. +<LI CLASS="li-itemize"><B>December 30, 2003</B> : Extended the <TT>cilly</TT> command to understand + better linker command options <TT>-lfoo</TT>. +<LI CLASS="li-itemize"><B>December 5, 2003</B>: Added markup commands to the pretty-printer +module. Also, changed the “@<” left-flush command into “@''. +<LI CLASS="li-itemize"><B>December 4, 2003</B>: Wide string literals are now handled +directly by Cil (rather than being exploded into arrays). This is +apparently handy for Microsoft Device Driver APIs that use intrinsic +functions that require literal constant wide-string arguments. +<LI CLASS="li-itemize"><B>December 3, 2003</B>: Added support for structured exception handling + extensions for the Microsoft compilers. +<LI CLASS="li-itemize"><B>December 1, 2003</B>: Fixed a Makefile bug in the generation of the +Cil library (e.g., <TT>cil.cma</TT>) that was causing it to be unusable. Thanks +to KEvin Millikin for pointing out this bug. +<LI CLASS="li-itemize"><B>November 26, 2003</B>: Added support for linkage specifications + (extern “C”). +<LI CLASS="li-itemize"><B>November 26, 2003</B>: Added the ocamlutil directory to contain some +utilities shared with other projects. +<LI CLASS="li-itemize"><B>November 25, 2003</B>: <B>Released version 1.2.2</B> +<LI CLASS="li-itemize"><B>November 24, 2003</B>: Fixed a bug that allowed a static local to + conflict with a global with the same name that is declared later in the + file. +<LI CLASS="li-itemize"><B>November 24, 2003</B>: Removed the <TT>--keep</TT> option of the <TT>cilly</TT> + driver and replaced it with <TT>--save-temps</TT>. +<LI CLASS="li-itemize"><B>November 24, 2003</B>: Added printing of what CIL features are being + run. +<LI CLASS="li-itemize"><B>November 24, 2003</B>: Fixed a bug that resulted in attributes being + dropped for integer types. +<LI CLASS="li-itemize"><B>November 11, 2003</B>: Fixed a bug in the visitor for enumeration + definitions. +<LI CLASS="li-itemize"><B>October 24, 2003</B>: Fixed a problem in the configuration script. It + was not recognizing the Ocaml version number for beta versions. +<LI CLASS="li-itemize"><B>October 15, 2003</B>: Fixed a problem in version 1.2.1 that was + preventing compilation on OCaml 3.04. +<LI CLASS="li-itemize"><B>September 17, 2003: Released version 1.2.1.</B> +<LI CLASS="li-itemize"><B>September 7, 2003</B>: Redesigned the interface for choosing + <TT>#line</TT> directive printing styles. Cil.printLn and + Cil.printLnComment have been merged into Cil.lineDirectiveStyle. +<LI CLASS="li-itemize"><B>August 8, 2003</B>: Do not silently pad out functions calls with +arguments to match the prototype. +<LI CLASS="li-itemize"><B>August 1, 2003</B>: A variety of fixes suggested by Steve Chamberlain: +initializers for externs, prohibit float literals in enum, initializers for +unsized arrays were not working always, an overflow problem in Ocaml, changed +the processing of attributes before struct specifiers<BR> +<BR> +<LI CLASS="li-itemize"><B>July 14, 2003</B>: Add basic support for GCC's "__thread" storage +qualifier. If given, it will appear as a "thread" attribute at the top of the +type of the declared object. Treatment is very similar to "__declspec(...)" +in MSVC<BR> +<BR> +<LI CLASS="li-itemize"><B>July 8, 2003</B>: Fixed some of the __alignof computations. Fixed + bug in the designated initializers for arrays (Array.get error). +<LI CLASS="li-itemize"><B>July 8, 2003</B>: Fixed infinite loop bug (Stack Overflow) in the + visitor for __alignof. +<LI CLASS="li-itemize"><B>July 8, 2003</B>: Fixed bug in the conversion to CIL. A function or + array argument of + the GCC __typeof() was being converted to pointer type. Instead, it should + be left alone, just like for sizeof. +<LI CLASS="li-itemize"><B>July 7, 2003</B>: New Escape module provides utility functions + for escaping characters and strings in accordance with C lexical + rules.<BR> +<BR> +<LI CLASS="li-itemize"><B>July 2, 2003</B>: Relax CIL's rules for when two enumeration types are +considered compatible. Previously CIL considered two enums to be compatible if +they were the same enum. Now we follow the C99 standard.<BR> +<BR> +<LI CLASS="li-itemize"><B>June 28, 2003</B>: In the Formatparse module, Eric Haugh found and + fixed a bug in the handling of lvalues of the form “lv->field.more”.<BR> +<BR> +<LI CLASS="li-itemize"><B>June 28, 2003</B>: Extended the handling of gcc command lines +arguments in the Perl scripts. <BR> +<BR> +<LI CLASS="li-itemize"><B>June 23, 2003</B>: In Rmtmps module, simplified the API for + customizing the root set. Clients may supply a predicate that + returns true for each root global. Modifying various + “<TT>referenced</TT>” fields directly is no longer supported.<BR> +<BR> +<LI CLASS="li-itemize"><B>June 17, 2003</B>: Reimplement internal utility routine + <TT>Cil.escape_char</TT>. Faster and better. <BR> +<BR> +<LI CLASS="li-itemize"><B>June 14, 2003</B>: Implemented support for <TT>__attribute__s</TT> +appearing between "struct" and the struct tag name (also for unions and +enums), since gcc supports this as documented in section 4.30 of the gcc +(2.95.3) manual<BR> +<BR> +<LI CLASS="li-itemize"><B>May 30, 2003</B>: Released the regression tests. +<LI CLASS="li-itemize"><B>May 28, 2003</B>: <B>Released version 1.1.2</B> +<LI CLASS="li-itemize"><B>May 26, 2003</B>: Add the <TT>simplify</TT> module that compiles CIL +expressions into simpler expressions, similar to those that appear in a +3-address intermediate language. +<LI CLASS="li-itemize"><B>May 26, 2003</B>: Various fixes and improvements to the pointer +analysis modules. +<LI CLASS="li-itemize"><B>May 26, 2003</B>: Added optional consistency checking for +transformations. +<LI CLASS="li-itemize"><B>May 25, 2003</B>: Added configuration support for big endian machines. +Now <A HREF="api/Cil.html#VALlittle_endian">Cil.little_endian</A> can be used to test whether the machine is +little endian or not. +<LI CLASS="li-itemize"><B>May 22, 2003</B>: Fixed a bug in the handling of inline functions. The +CIL merger used to turn these functions into “static”, which is incorrect. +<LI CLASS="li-itemize"><B>May 22, 2003</B>: Expanded the CIL consistency checker to verify +undesired sharing relationships between data structures. +<LI CLASS="li-itemize"><B>May 22, 2003</B>: Fixed bug in the <TT>oneret</TT> CIL module: it was +mishandling certain labeled return statements. +<LI CLASS="li-itemize"><B>May 5, 2003</B>: <B>Released version 1.0.11</B> +<LI CLASS="li-itemize"><B>May 5, 2003</B>: OS X (powerpc/darwin) support for CIL. Special +thanks to Jeff Foster, Andy Begel and Tim Leek. +<LI CLASS="li-itemize"><B>April 30, 2003</B>: Better description of how to use CIL for your +analysis. +<LI CLASS="li-itemize"><B>April 28, 2003</B>: Fixed a bug with <TT>--dooneRet</TT> and +<TT>--doheapify</TT>. Thanks, Manos Renieris. +<LI CLASS="li-itemize"><B>April 16, 2003</B>: Reworked management of + temporary/intermediate output files in Perl driver scripts. Default + behavior is now to remove all such files. To keep intermediate + files, use one of the following existing flags: + <UL CLASS="itemize"><LI CLASS="li-itemize"> + <TT>--keepmerged</TT> for the single-file merge of all sources + <LI CLASS="li-itemize"><TT>--keep=<<I>dir</I></TT><TT>></TT> for various other CIL and + CCured output files + <LI CLASS="li-itemize"><TT>--save-temps</TT> for various gcc intermediate files; MSVC + has no equivalent option + </UL> + As part of this change, some intermediate files have changed their + names slightly so that new suffixes are always preceded by a + period. For example, CCured output that used to appear in + “<TT>foocured.c</TT>” now appears in “<TT>foo.cured.c</TT>”. +<LI CLASS="li-itemize"><B>April 7, 2003</B>: Changed the representation of the <A HREF="api/Cil.html#VALGVar">Cil.GVar</A> +global constructor. Now it is possible to update the initializer without +reconstructing the global (which in turn it would require reconstructing the +list of globals that make up a program). We did this because it is often +tempting to use <A HREF="api/Cil.html#VALvisitCilFileSameGlobals">Cil.visitCilFileSameGlobals</A> and the <A HREF="api/Cil.html#VALGVar">Cil.GVar</A> +was the only global that could not be updated in place. +<LI CLASS="li-itemize"><B>April 6, 2003</B>: Reimplemented parts of the cilly.pl script to make +it more robust in the presence of complex compiler arguments. +<LI CLASS="li-itemize"><B>March 10, 2003</B>: <B>Released version 1.0.9</B> +<LI CLASS="li-itemize"><B>March 10, 2003</B>: Unified and documented a large number of CIL +Library Modules: oneret, simplemem, makecfg, heapify, stackguard, partial. +Also documented the main client interface for the pointer analysis. +<LI CLASS="li-itemize"><B>February 18, 2003</B>: Fixed a bug in logwrites that was causing it +to produce invalid C code on writes to bitfields. Thanks, David Park. +<LI CLASS="li-itemize"><B>February 15, 2003</B>: <B>Released version 1.0.8</B> +<LI CLASS="li-itemize"><B>February 15, 2003</B>: PDF versions of the manual and API are +available for those who would like to print them out. +<LI CLASS="li-itemize"><B>February 14, 2003</B>: CIL now comes bundled with alias analyses. +<LI CLASS="li-itemize"><B>February 11, 2003</B>: Added support for adding/removing options from + <TT>./configure</TT>. +<LI CLASS="li-itemize"><B>February 3, 2003</B>: <B>Released version 1.0.7</B> +<LI CLASS="li-itemize"><B>February 1, 2003</B>: Some bug fixes in the handling of variable +argument functions in new versions of <TT>gcc</TT> And <TT>glibc</TT>. +<LI CLASS="li-itemize"><B>January 29, 2003</B>: Added the logical AND and OR operators. +Exapanded the translation to CIL to handle more complicated initializers +(including those that contain logical operators). +<LI CLASS="li-itemize"><B>January 28, 2003</B>: <B>Released version 1.0.6</B> +<LI CLASS="li-itemize"><B>January 28, 2003</B>: Added support for the new handling of +variable-argument functions in new versions of <TT>glibc</TT>. +<LI CLASS="li-itemize"><B>January 19, 2003</B>: Added support for declarations in interpreted + constructors. Relaxed the semantics of the patterns for variables. +<LI CLASS="li-itemize"><B>January 17, 2003</B>: Added built-in prototypes for the gcc built-in + functions. Changed the <TT>pGlobal</TT> method in the printers to print the + carriage return as well. +<LI CLASS="li-itemize"><B>January 9, 2003</B>: Reworked lexer and parser's strategy for + tracking source file names and line numbers to more closely match + typical native compiler behavior. The visible CIL interface is + unchanged. +<LI CLASS="li-itemize"><B>January 9, 2003</B>: Changed the interface to the alpha convertor. Now +you can pass a list where it will record undo information that you can use to +revert the changes that it makes to the scope tables. +<LI CLASS="li-itemize"><B>January 6, 2003</B>: <B>Released version 1.0.5</B> +<LI CLASS="li-itemize"><B>January 4, 2003</B>: Changed the interface for the Formatcil module. + Now the placeholders in the pattern have names. Also expanded the + documentation of the Formatcil module. + Now the placeholders in the pattern have names. +<LI CLASS="li-itemize"><B>January 3, 2003</B>: Extended the <TT>rmtmps</TT> module to also remove + unused labels that are generated in the conversion to CIL. This reduces the + number of warnings that you get from <TT>cgcc</TT> afterwards. +<LI CLASS="li-itemize"><B>December 17, 2002</B>: Fixed a few bugs in CIL related to the + representation of string literals. The standard says that a string literal + is an array. In CIL, a string literal has type pointer to character. This is + Ok, except as an argument of sizeof. To support this exception, we have + added to CIL the expression constructor SizeOfStr. This allowed us to fix + bugs with computing <TT>sizeof("foo bar")</TT> and <TT>sizeof((char*)"foo bar")</TT> + (the former is 8 and the latter is 4).<BR> +<BR> +<LI CLASS="li-itemize"><B>December 8, 2002</B>: Fixed a few bugs in the lexer and parser + relating to hex and octal escapes in string literals. Also fixed + the dependencies between the lexer and parser. +<LI CLASS="li-itemize"><B>December 5, 2002</B>: Fixed visitor bugs that were causing + some attributes not to be visited and some queued instructions to be + dropped. +<LI CLASS="li-itemize"><B>December 3, 2002</B>: Added a transformation to catch stack + overflows. Fixed the heapify transformation. +<LI CLASS="li-itemize"><B>October 14, 2002</B>: CIL is now available under the BSD license +(see the License section or the file LICENSE). <B>Released version 1.0.4</B> +<LI CLASS="li-itemize"><B>October 9, 2002</B>: More FreeBSD configuration changes, support +for the GCC-ims <TT>__signed</TT> and <TT>__volatile</TT>. Thanks to Axel +Simon for pointing out these problems. <B>Released version 1.0.3</B> +<LI CLASS="li-itemize"><B>October 8, 2002</B>: FreeBSD configuration and porting fixes. +Thanks to Axel Simon for pointing out these problems. +<LI CLASS="li-itemize"><B>September 10, 2002</B>: Fixed bug in conversion to CIL. Now we drop +all “const” qualifiers from the types of locals, even from the fields of +local structures or elements of arrays. +<LI CLASS="li-itemize"><B>September 7, 2002</B>: Extended visitor interface to distinguish visitng + offsets inside lvalues from offsets inside initializer lists. +<LI CLASS="li-itemize"><B>September 7, 2002</B>: <B>Released version 1.0.1</B> +<LI CLASS="li-itemize"><B>September 6, 2002</B>: Extended the patcher with the <TT>ateof</TT> flag. +<LI CLASS="li-itemize"><B>September 4, 2002</B>: Fixed bug in the elaboration to CIL. In some +cases constant folding of <TT>||</TT> and <TT>&&</TT> was computed wrong. +<LI CLASS="li-itemize"><B>September 3, 2002</B>: Fixed the merger documentation. +<LI CLASS="li-itemize"><B>August 29, 2002</B>: <B>Released version 1.0.0.</B> +<LI CLASS="li-itemize"><B>August 29, 2002</B>: Started numbering versions with a major nubmer, +minor and revisions. Released version 1.0.0. +<LI CLASS="li-itemize"><B>August 25, 2002</B>: Fixed the implementation of the unique +identifiers for global variables and composites. Now those identifiers are +globally unique. +<LI CLASS="li-itemize"><B>August 24, 2002</B>: Added to the machine-dependent configuration the +<TT>sizeofvoid</TT>. It is 1 on gcc and 0 on MSVC. Extended the implementation of +<TT>Cil.bitsSizeOf</TT> to handle this (it was previously returning an error when +trying to compute the size of <TT>void</TT>). +<LI CLASS="li-itemize"><B>August 24, 2002</B>: Changed the representation of structure and +unions to distinguish between undefined structures and those that are defined +to be empty (allowed on gcc). The sizeof operator is undefined for the former +and returns 0 for the latter. +<LI CLASS="li-itemize"><B>August 22, 2002</B>: Apply a patch from Richard H. Y. to support +FreeBSD installations. Thanks, Richard! +<LI CLASS="li-itemize"><B>August 12, 2002</B>: Fixed a bug in the translation of wide-character +strings. Now this translation matches that of the underlying compiler. Changed +the implementation of the compiler dependencies. +<LI CLASS="li-itemize"><B>May 25, 2002</B>: Added interpreted constructors and destructors. +<LI CLASS="li-itemize"><B>May 17, 2002</B>: Changed the representation of functions to move the +“inline” information to the varinfo. This way we can print the “inline” +even in declarations which is what gcc does. +<LI CLASS="li-itemize"><B>May 15, 2002</B>: Changed the visitor for initializers to make two +tail-recursive passes (the second is a <TT>List.rev</TT> and only done if one of +the initializers change). This prevents <TT>Stack_Overflow</TT> for large +initializers. Also improved the processing of initializers when converting to +CIL. +<LI CLASS="li-itemize"><B>May 15, 2002</B>: Changed the front-end to allow the use of <TT>MSVC</TT> +mode even on machines that do not have MSVC. The machine-dependent parameters +for GCC will be used in that case. +<LI CLASS="li-itemize"><B>May 11, 2002</B>: Changed the representation of formals in function +types. Now the function type is purely functional. +<LI CLASS="li-itemize"><B>May 4, 2002</B>: Added the function +<A HREF="api/Cil.html#VALvisitCilFileSameGlobals">Cil.visitCilFileSameGlobals</A> and changed <A HREF="api/Cil.html#VALvisitCilFile">Cil.visitCilFile</A> to be +tail recursive. This prevents stack overflow on huge files. +<LI CLASS="li-itemize"><B>February 28, 2002</B>: Changed the significance of the +<TT>CompoundInit</TT> in <A HREF="api/Cil.html#TYPEinit">Cil.init</A> to allow for missing initializers at the +end of an array initializer. Added the API function +<A HREF="api/Cil.html#VALfoldLeftCompoundAll">Cil.foldLeftCompoundAll</A>. +</UL> +<!--HTMLFOOT--> +<!--ENDHTML--> +<!--FOOTER--> +<HR SIZE=2><BLOCKQUOTE CLASS="quote"><EM>This document was translated from L<sup>A</sup>T<sub>E</sub>X by +</EM><A HREF="http://pauillac.inria.fr/~maranget/hevea/index.html"><EM>H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A</EM></A><EM>.</EM></BLOCKQUOTE></BODY> +</HTML> diff --git a/cil/doc/cil.version.tex b/cil/doc/cil.version.tex new file mode 100644 index 0000000..c584859 --- /dev/null +++ b/cil/doc/cil.version.tex @@ -0,0 +1,2 @@ +\def\cilversion{1.3.5} +\def\ccuredversion{@CCURED_VERSION@} diff --git a/cil/doc/cil001.html b/cil/doc/cil001.html new file mode 100644 index 0000000..5edc5da --- /dev/null +++ b/cil/doc/cil001.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +Introduction +</TITLE> +</HEAD> +<BODY > +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil002.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc1">1</A> Introduction</H2> +New: CIL now has a Source Forge page: + <A HREF="javascript:loadTop('http://sourceforge.net/projects/cil')">http://sourceforge.net/projects/cil</A>. <BR> +<BR> +CIL (<B>C</B> <B>I</B>ntermediate <B>L</B>anguage) is a high-level representation +along with a set of tools that permit easy analysis and source-to-source +transformation of C programs.<BR> +<BR> +CIL is both lower-level than abstract-syntax trees, by clarifying ambiguous +constructs and removing redundant ones, and also higher-level than typical +intermediate languages designed for compilation, by maintaining types and a +close relationship with the source program. The main advantage of CIL is that +it compiles all valid C programs into a few core constructs with a very clean +semantics. Also CIL has a syntax-directed type system that makes it easy to +analyze and manipulate C programs. Furthermore, the CIL front-end is able to +process not only ANSI-C programs but also those using Microsoft C or GNU C +extensions. If you do not use CIL and want instead to use just a C parser and +analyze programs expressed as abstract-syntax trees then your analysis will +have to handle a lot of ugly corners of the language (let alone the fact that +parsing C itself is not a trivial task). See Section <A HREF="cil016.html#sec-simplec">16</A> for some +examples of such extreme programs that CIL simplifies for you.<BR> +<BR> +In essence, CIL is a highly-structured, “clean” subset of C. CIL features a +reduced number of syntactic and conceptual forms. For example, all looping +constructs are reduced to a single form, all function bodies are given +explicit <TT>return</TT> statements, syntactic sugar like <TT>"->"</TT> is +eliminated and function arguments with array types become pointers. (For an +extensive list of how CIL simplifies C programs, see Section <A HREF="cil004.html#sec-cabs2cil">4</A>.) +This reduces the number of cases that must be considered when manipulating a C +program. CIL also separates type declarations from code and flattens scopes +within function bodies. This structures the program in a manner more amenable +to rapid analysis and transformation. CIL computes the types of all program +expressions, and makes all type promotions and casts explicit. CIL supports +all GCC and MSVC extensions except for nested functions and complex numbers. +Finally, CIL organizes C's imperative features into expressions, instructions +and statements based on the presence and absence of side-effects and +control-flow. Every statement can be annotated with successor and predecessor +information. Thus CIL provides an integrated program representation that can +be used with routines that require an AST (e.g. type-based analyses and +pretty-printers), as well as with routines that require a CFG (e.g., dataflow +analyses). CIL also supports even lower-level representations (e.g., +three-address code), see Section <A HREF="ext.html#sec-Extension">8</A>. <BR> +<BR> +CIL comes accompanied by a number of Perl scripts that perform generally +useful operations on code: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +A <A HREF="cil007.html#sec-driver">driver</A> which behaves as either the <TT>gcc</TT> or +Microsoft VC compiler and can invoke the preprocessor followed by the CIL +application. The advantage of this script is that you can easily use CIL and +the analyses written for CIL with existing make files. +<LI CLASS="li-itemize">A <A HREF="merger.html#sec-merger">whole-program merger</A> that you can use as a +replacement for your compiler and it learns all the files you compile when you +make a project and merges all of the preprocessed source files into a single +one. This makes it easy to do whole-program analysis. +<LI CLASS="li-itemize">A <A HREF="patcher.html#sec-patcher">patcher</A> makes it easy to create modified +copies of the system include files. The CIL driver can then be told to use +these patched copies instead of the standard ones. +</UL> +CIL has been tested very extensively. It is able to process the SPECINT95 +benchmarks, the Linux kernel, GIMP and other open-source projects. All of +these programs are compiled to the simple CIL and then passed to <TT>gcc</TT> and +they still run! We consider the compilation of Linux a major feat especially +since Linux contains many of the ugly GCC extensions (see Section <A HREF="cil016.html#sec-ugly-gcc">16.2</A>). +This adds to about 1,000,000 lines of code that we tested it on. It is also +able to process the few Microsoft NT device drivers that we have had access +to. CIL was tested against GCC's c-torture testsuite and (except for the tests +involving complex numbers and inner functions, which CIL does not currently +implement) CIL passes most of the tests. Specifically CIL fails 23 tests out +of the 904 c-torture tests that it should pass. GCC itself fails 19 tests. A +total of 1400 regression test cases are run automatically on each change to +the CIL sources.<BR> +<BR> +CIL is relatively independent on the underlying machine and compiler. When +you build it CIL will configure itself according to the underlying compiler. +However, CIL has only been tested on Intel x86 using the gcc compiler on Linux +and cygwin and using the MS Visual C compiler. (See below for specific +versions of these compilers that we have used CIL for.)<BR> +<BR> +The largest application we have used CIL for is +<A HREF="javascript:loadTop('../ccured/index.html')">CCured</A>, a compiler that compiles C code into +type-safe code by analyzing your pointer usage and inserting runtime checks in +the places that cannot be guaranteed statically to be type safe. <BR> +<BR> +You can also use CIL to “compile” code that uses GCC extensions (e.g. the +Linux kernel) into standard C code.<BR> +<BR> +CIL also comes accompanies by a growing library of extensions (see +Section <A HREF="ext.html#sec-Extension">8</A>). You can use these for your projects or as examples of +using CIL. <BR> +<BR> +<TT>PDF</TT> versions of <A HREF="CIL.pdf">this manual</A> and the +<A HREF="CIL-API.pdf">CIL API</A> are available. However, we recommend the +<TT>HTML</TT> versions because the postprocessed code examples are easier to +view. <BR> +<BR> +If you use CIL in your project, we would appreciate letting us know. If you +want to cite CIL in your research writings, please refer to the paper “CIL: +Intermediate Language and Tools for Analysis and Transformation of C +Programs” by George C. Necula, Scott McPeak, S.P. Rahul and Westley Weimer, +in “Proceedings of Conference on Compilier Construction”, 2002.<BR> +<BR> +<HR> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil002.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/cil002.html b/cil/doc/cil002.html new file mode 100644 index 0000000..e575ce3 --- /dev/null +++ b/cil/doc/cil002.html @@ -0,0 +1,98 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +Installation +</TITLE> +</HEAD> +<BODY > +<A HREF="cil001.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil003.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc2">2</A> Installation</H2> +You will need OCaml release 3.08 or higher to build CIL. CIL has been tested +on Linux and on Windows (where it can behave at either Microsoft Visual C or +gcc).<BR> +<BR> +If you want to use CIL on Windows then you must get a complete installation +of <TT>cygwin</TT> and the source-code OCaml distribution and compile it yourself +using the cygwin tools (as opposed to getting the Win32 native-code version of +OCaml). If you have not done this before then take a look +<A HREF="../ccured/setup.html">here</A>. (Don't need to worry about <TT>cvs</TT> and +<TT>ssh</TT> unless you will need to use the master CVS repository for CIL.) +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> +Download the CIL <A HREF="distrib">distribution</A> (latest version is +<A HREF="distrib/cil-1.3.5.tar.gz"><TT>distrib/cil-1.3.5.tar.gz</TT></A>). See the Section <A HREF="changes.html#sec-changes">20</A> for recent changes to the CIL distribution. +<LI CLASS="li-enumerate">Unzip and untar the source distribution. This will create a directory + called <TT>cil</TT> whose structure is explained below.<BR> +<TT>tar xvfz cil-1.3.5.tar.gz</TT> +<LI CLASS="li-enumerate">Enter the <TT>cil</TT> directory and run the <TT>configure</TT> script and then + GNU make to build the distribution. If you are on Windows, at least the + <TT>configure</TT> step must be run from within <TT>bash</TT>.<BR> + <CODE>cd cil</CODE><BR> + <CODE>./configure</CODE><BR> + <CODE>make</CODE><BR> + <CODE>make quicktest</CODE><BR> +<LI CLASS="li-enumerate">You should now find <TT>cilly.asm.exe</TT> in a +subdirectory of <TT>obj</TT>. The name of the subdirectory is either <TT>x86_WIN32</TT> +if you are using <TT>cygwin</TT> on Windows or <TT>x86_LINUX</TT> if you are using +Linux (although you should be using instead the Perl wrapper <TT>bin/cilly</TT>). +Note that we do not have an <TT>install</TT> make target and you should use Cil +from the development directory. +<LI CLASS="li-enumerate">If you decide to use CIL, <B>please</B> +<A HREF="mailto:necula@cs.berkeley.edu">send us a note</A>. This will help recharge +our batteries after more than a year of development. And of course, do send us +your bug reports as well.</OL> +The <TT>configure</TT> script tries to find appropriate defaults for your system. +You can control its actions by passing the following arguments: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>CC=foo</TT> Specifies the path for the <TT>gcc</TT> executable. By default +whichever version is in the PATH is used. If <TT>CC</TT> specifies the Microsoft +<TT>cl</TT> compiler, then that compiler will be set as the default one. Otherwise, +the <TT>gcc</TT> compiler will be the default. +</UL> +CIL requires an underlying C compiler and preprocessor. CIL depends on the +underlying compiler and machine for the sizes and alignment of types.The +installation procedure for CIL queries the underlying compiler for +architecture and compiler dependent configuration parameters, such as the size +of a pointer or the particular alignment rules for structure fields. (This +means, of course, that you should re-run <TT>./configure</TT> when you move CIL to +another machine.)<BR> +<BR> +We have tested CIL on the following compilers: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +On Windows, <TT>cl</TT> compiler version 12.00.8168 (MSVC 6), + 13.00.9466 (MSVC .Net), and 13.10.3077 (MSVC .Net 2003). Run <TT>cl</TT> + with no arguments to get the compiler version. +<LI CLASS="li-itemize">On Windows, using <TT>cygwin</TT> and <TT>gcc</TT> version 2.95.3, 3.0, + 3.2, 3.3, and 3.4. +<LI CLASS="li-itemize">On Linux, using <TT>gcc</TT> version 2.95.3, 3.0, 3.2, 3.3, and 4.0. +</UL> +Others have successfully used CIL with Mac OS X (on both PowerPC and +x86), Solaris, and *BSD. If you make any changes to the build +system in order to run CIL on your platform, please send us a patch.<BR> +<BR> + <HR> +<A HREF="cil001.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil003.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/cil003.html b/cil/doc/cil003.html new file mode 100644 index 0000000..4b885f3 --- /dev/null +++ b/cil/doc/cil003.html @@ -0,0 +1,187 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +Distribution Contents +</TITLE> +</HEAD> +<BODY > +<A HREF="cil002.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil004.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc3">3</A> Distribution Contents</H2> +The file <A HREF="distrib/cil-1.3.5.tar.gz"><TT>distrib/cil-1.3.5.tar.gz</TT></A> +contains the complete source CIL distribution, +consisting of the following files:<BR> +<TABLE CELLSPACING=2 CELLPADDING=0> +<TR><TD ALIGN=left NOWRAP>Filename</TD> +<TD ALIGN=left NOWRAP>Description</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>Makefile.in</TT></TD> +<TD ALIGN=left NOWRAP><TT>configure</TT> source for the + Makefile that builds CIL</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>configure</TT></TD> +<TD ALIGN=left NOWRAP>The configure script</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>configure.in</TT></TD> +<TD ALIGN=left NOWRAP>The <TT>autoconf</TT> source for <TT>configure</TT></TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>config.guess</TT>, <TT>config.sub</TT>, <TT>install-sh</TT></TD> +<TD ALIGN=left NOWRAP>stuff required by + <TT>configure</TT></TD> +</TR> +<TR><TD ALIGN=left NOWRAP> </TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>doc/</TT></TD> +<TD ALIGN=left NOWRAP>HTML documentation of the CIL API</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>obj/</TT></TD> +<TD ALIGN=left NOWRAP>Directory that will contain the compiled + CIL modules and executables</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>bin/cilly.in</TT></TD> +<TD ALIGN=left NOWRAP>The <TT>configure</TT> source for a Perl script + that can be invoked with the + same arguments as either <TT>gcc</TT> or + Microsoft Visual C and will convert the + program to CIL, perform some simple + transformations, emit it and compile it as + usual.</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>lib/CompilerStub.pm</TT></TD> +<TD ALIGN=left NOWRAP>A Perl class that can be used to write code + that impersonates a compiler. <TT>cilly</TT> + uses it.</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>lib/Merger.pm</TT></TD> +<TD ALIGN=left NOWRAP>A subclass of <TT>CompilerStub.pm</TT> that can + be used to merge source files into a single + source file.<TT>cilly</TT> + uses it.</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>bin/patcher.in</TT></TD> +<TD ALIGN=left NOWRAP>A Perl script that applies specified patches + to standard include files.</TD> +</TR> +<TR><TD ALIGN=left NOWRAP> </TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/check.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>Checks the well-formedness of a CIL file</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/cil.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>Definition of CIL abstract syntax and + utilities for manipulating it</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/clist.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>Utilities for efficiently managing lists + that need to be concatenated often</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/errormsg.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>Utilities for error reporting</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/ext/heapify.ml</TT></TD> +<TD ALIGN=left NOWRAP>A CIL transformation that moves array local + variables from the stack to the heap</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/ext/logcalls.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>A CIL transformation that logs every + function call</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/ext/sfi.ml</TT></TD> +<TD ALIGN=left NOWRAP>A CIL transformation that can log every + memory read and write</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/frontc/clexer.mll</TT></TD> +<TD ALIGN=left NOWRAP>The lexer</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/frontc/cparser.mly</TT></TD> +<TD ALIGN=left NOWRAP>The parser</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/frontc/cabs.ml</TT></TD> +<TD ALIGN=left NOWRAP>The abstract syntax</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/frontc/cprint.ml</TT></TD> +<TD ALIGN=left NOWRAP>The pretty printer for CABS</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/frontc/cabs2cil.ml</TT></TD> +<TD ALIGN=left NOWRAP>The elaborator to CIL</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/main.ml</TT></TD> +<TD ALIGN=left NOWRAP>The <TT>cilly</TT> application</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/pretty.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>Utilities for pretty printing</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/rmtmps.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>A CIL tranformation that removes unused + types, variables and inlined functions</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/stats.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>Utilities for maintaining timing statistics</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/testcil.ml</TT></TD> +<TD ALIGN=left NOWRAP>A random test of CIL (against the resident + C compiler)</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/trace.ml,mli</TT></TD> +<TD ALIGN=left NOWRAP>Utilities useful for printing debugging + information</TD> +</TR> +<TR><TD ALIGN=left NOWRAP> </TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>ocamlutil/</TT></TD> +<TD ALIGN=left NOWRAP>Miscellaneous libraries that are not + specific to CIL.</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>ocamlutil/Makefile.ocaml</TT></TD> +<TD ALIGN=left NOWRAP>A file that is included by <TT>Makefile</TT></TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>ocamlutil/Makefile.ocaml.build</TT></TD> +<TD ALIGN=left NOWRAP>A file that is included by <TT>Makefile</TT></TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>ocamlutil/perfcount.c</TT></TD> +<TD ALIGN=left NOWRAP>C code that links with src/stats.ml + and reads Intel performance + counters.</TD> +</TR> +<TR><TD ALIGN=left NOWRAP> </TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>obj/@ARCHOS@/feature_config.ml</TT></TD> +<TD ALIGN=left NOWRAP>File generated by the Makefile + describing which extra “features” + to compile. See Section <A HREF="cilly.html#sec-cil">5</A></TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>obj/@ARCHOS@/machdep.ml</TT></TD> +<TD ALIGN=left NOWRAP>File generated by the Makefile containing + information about your architecture, + such as the size of a pointer</TD> +</TR> +<TR><TD ALIGN=left NOWRAP><TT>src/machdep.c</TT></TD> +<TD ALIGN=left NOWRAP>C program that generates + <TT>machdep.ml</TT> files</TD> +</TR></TABLE><BR> +<HR> +<A HREF="cil002.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil004.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/cil004.html b/cil/doc/cil004.html new file mode 100644 index 0000000..16fde39 --- /dev/null +++ b/cil/doc/cil004.html @@ -0,0 +1,350 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +Compiling C to CIL +</TITLE> +</HEAD> +<BODY > +<A HREF="cil003.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cilly.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc4">4</A> Compiling C to CIL</H2><A NAME="sec-cabs2cil"></A> +In this section we try to describe a few of the many transformations that are +applied to a C program to convert it to CIL. The module that implements this +conversion is about 5000 lines of OCaml code. In contrast a simple program +transformation that instruments all functions to keep a shadow stack of the +true return address (thus preventing stack smashing) is only 70 lines of code. +This example shows that the analysis is so much simpler because it has to +handle only a few simple C constructs and also because it can leverage on CIL +infrastructure such as visitors and pretty-printers.<BR> +<BR> +In no particular order these are a few of the most significant ways in which +C programs are compiled into CIL: +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> +CIL will eliminate all declarations for unused entities. This means that +just because your hello world program includes <TT>stdio.h</TT> it does not mean +that your analysis has to handle all the ugly stuff from <TT>stdio.h</TT>.<BR> +<BR> +<LI CLASS="li-enumerate">Type specifiers are interpreted and normalized: +<PRE CLASS="verbatim"><FONT COLOR=blue> +int long signed x; +signed long extern x; +long static int long y; + +// Some code that uses these declaration, so that CIL does not remove them +int main() { return x + y; } +</FONT></PRE> +See the <A HREF="examples/ex1.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Anonymous structure and union declarations are given a name. +<PRE CLASS="verbatim"><FONT COLOR=blue> + struct { int x; } s; +</FONT></PRE> +See the <A HREF="examples/ex2.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Nested structure tag definitions are pulled apart. This means that all +structure tag definitions can be found by a simple scan of the globals. +<PRE CLASS="verbatim"><FONT COLOR=blue> +struct foo { + struct bar { + union baz { + int x1; + double x2; + } u1; + int y; + } s1; + int z; +} f; +</FONT></PRE> +See the <A HREF="examples/ex3.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">All structure, union, enumeration definitions and the type definitions +from inners scopes are moved to global scope (with appropriate renaming). This +facilitates moving around of the references to these entities. +<PRE CLASS="verbatim"><FONT COLOR=blue> +int main() { + struct foo { + int x; } foo; + { + struct foo { + double d; + }; + return foo.x; + } +} +</FONT></PRE> +See the <A HREF="examples/ex4.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Prototypes are added for those functions that are called before being +defined. Furthermore, if a prototype exists but does not specify the type of +parameters that is fixed. But CIL will not be able to add prototypes for those +functions that are neither declared nor defined (but are used!). +<PRE CLASS="verbatim"><FONT COLOR=blue> + int f(); // Prototype without arguments + int f(double x) { + return g(x); + } + int g(double x) { + return x; + } +</FONT></PRE> +See the <A HREF="examples/ex5.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Array lengths are computed based on the initializers or by constant +folding. +<PRE CLASS="verbatim"><FONT COLOR=blue> + int a1[] = {1,2,3}; + int a2[sizeof(int) >= 4 ? 8 : 16]; +</FONT></PRE> +See the <A HREF="examples/ex6.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Enumeration tags are computed using constant folding: +<PRE CLASS="verbatim"><FONT COLOR=blue> +int main() { + enum { + FIVE = 5, + SIX, SEVEN, + FOUR = FIVE - 1, + EIGHT = sizeof(double) + } x = FIVE; + return x; +} + +</FONT></PRE> +See the <A HREF="examples/ex7.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Initializers are normalized to include specific initialization for the +missing elements: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int a1[5] = {1,2,3}; + struct foo { int x, y; } s1 = { 4 }; +</FONT></PRE> +See the <A HREF="examples/ex8.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Initializer designators are interpreted and eliminated. Subobjects are +properly marked with braces. CIL implements +the whole ISO C99 specification for initializer (neither GCC nor MSVC do) and +a few GCC extensions. +<PRE CLASS="verbatim"><FONT COLOR=blue> + struct foo { + int x, y; + int a[5]; + struct inner { + int z; + } inner; + } s = { 0, .inner.z = 3, .a[1 ... 2] = 5, 4, y : 8 }; +</FONT></PRE> +See the <A HREF="examples/ex9.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">String initializers for arrays of characters are processed +<PRE CLASS="verbatim"><FONT COLOR=blue> +char foo[] = "foo plus bar"; +</FONT></PRE> +See the <A HREF="examples/ex10.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">String constants are concatenated +<PRE CLASS="verbatim"><FONT COLOR=blue> +char *foo = "foo " " plus " " bar "; +</FONT></PRE> +See the <A HREF="examples/ex11.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Initializers for local variables are turned into assignments. This is in +order to separate completely the declarative part of a function body from the +statements. This has the unfortunate effect that we have to drop the <TT>const</TT> +qualifier from local variables ! +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x = 5; + struct foo { int f1, f2; } a [] = {1, 2, 3, 4, 5 }; +</FONT></PRE> +See the <A HREF="examples/ex12.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Local variables in inner scopes are pulled to function scope (with +appropriate renaming). Local scopes thus disappear. This makes it easy to find +and operate on all local variables in a function. +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x = 5; + int main() { + int x = 6; + { + int x = 7; + return x; + } + return x; + } +</FONT></PRE> +See the <A HREF="examples/ex13.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Global declarations in local scopes are moved to global scope: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x = 5; + int main() { + int x = 6; + { + static int x = 7; + return x; + } + return x; + } +</FONT></PRE> +See the <A HREF="examples/ex14.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Return statements are added for functions that are missing them. If the +return type is not a base type then a <TT>return</TT> without a value is added. +The guaranteed presence of return statements makes it easy to implement a +transformation that inserts some code to be executed immediately before +returning from a function. +<PRE CLASS="verbatim"><FONT COLOR=blue> + int foo() { + int x = 5; + } +</FONT></PRE> +See the <A HREF="examples/ex15.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">One of the most significant transformations is that expressions that +contain side-effects are separated into statements. +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x, f(int); + return (x ++ + f(x)); +</FONT></PRE> +See the <A HREF="examples/ex16.txt">CIL output</A> for this +code fragment<BR> +<BR> +Internally, the <TT>x ++</TT> statement is turned into an assignment which the +pretty-printer prints like the original. CIL has only three forms of basic +statements: assignments, function calls and inline assembly.<BR> +<BR> +<LI CLASS="li-enumerate">Shortcut evaluation of boolean expressions and the <TT>?:</TT> operator are +compiled into explicit conditionals: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x; + int y = x ? 2 : 4; + int z = x || y; + // Here we duplicate the return statement + if(x && y) { return 0; } else { return 1; } + // To avoid excessive duplication, CIL uses goto's for + // statement that have more than 5 instructions + if(x && y || z) { x ++; y ++; z ++; x ++; y ++; return z; } +</FONT></PRE> +See the <A HREF="examples/ex17.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">GCC's conditional expression with missing operands are also compiled +into conditionals: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int f();; + return f() ? : 4; +</FONT></PRE> +See the <A HREF="examples/ex18.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">All forms of loops (<TT>while</TT>, <TT>for</TT> and <TT>do</TT>) are compiled +internally as a single <TT>while(1)</TT> looping construct with explicit <TT>break</TT> +statement for termination. For simple <TT>while</TT> loops the pretty printer is +able to print back the original: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x, y; + for(int i = 0; i<5; i++) { + if(i == 5) continue; + if(i == 4) break; + i += 2; + } + while(x < 5) { + if(x == 3) continue; + x ++; + } +</FONT></PRE> +See the <A HREF="examples/ex19.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">GCC's block expressions are compiled away. (That's right there is an +infinite loop in this code.) +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x = 5, y = x; + int z = ({ x++; L: y -= x; y;}); + return ({ goto L; 0; }); +</FONT></PRE> +See the <A HREF="examples/ex20.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">CIL contains support for both MSVC and GCC inline assembly (both in one +internal construct)<BR> +<BR> +<LI CLASS="li-enumerate">CIL compiles away the GCC extension that allows many kinds of constructs +to be used as lvalues: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x, y, z; + return &(x ? y : z) - & (x ++, x); +</FONT></PRE> +See the <A HREF="examples/ex21.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">All types are computed and explicit casts are inserted for all +promotions and conversions that a compiler must insert:<BR> +<BR> +<LI CLASS="li-enumerate">CIL will turn old-style function definition (without prototype) into +new-style definitions. This will make the compiler less forgiving when +checking function calls, and will catch for example cases when a function is +called with too few arguments. This happens in old-style code for the purpose +of implementing variable argument functions.<BR> +<BR> +<LI CLASS="li-enumerate">Since CIL sees the source after preprocessing the code after CIL does +not contain the comments and the preprocessing directives.<BR> +<BR> +<LI CLASS="li-enumerate">CIL will remove from the source file those type declarations, local +variables and inline functions that are not used in the file. This means that +your analysis does not have to see all the ugly stuff that comes from the +header files: +<PRE CLASS="verbatim"><FONT COLOR=blue> +#include <stdio.h> + +typedef int unused_type; + +static char unused_static (void) { return 0; } + +int main() { + int unused_local; + printf("Hello world\n"); // Only printf will be kept from stdio.h +} +</FONT></PRE> +See the <A HREF="examples/ex22.txt">CIL output</A> for this +code fragment</OL> +<HR> +<A HREF="cil003.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cilly.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/cil006.html b/cil/doc/cil006.html new file mode 100644 index 0000000..8fc3194 --- /dev/null +++ b/cil/doc/cil006.html @@ -0,0 +1,627 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +CIL API Documentation +</TITLE> +</HEAD> +<BODY > +<A HREF="cilly.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil007.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc8">6</A> CIL API Documentation</H2><A NAME="sec-api"></A> +The CIL API is documented in the file <TT>src/cil.mli</TT>. We also have an +<A HREF="api/index.html">online documentation</A> extracted from <TT>cil.mli</TT>. We +index below the main types that are used to represent C programs in CIL: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<A HREF="api/index_types.html">An index of all types</A> +<LI CLASS="li-itemize"><A HREF="api/index_values.html">An index of all values</A> +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEfile">Cil.file</A> is the representation of a file. +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEglobal">Cil.global</A> is the representation of a global declaration or +definitions. Values for <A HREF="api/Cil.html#VALemptyFunction">operating on globals</A>. +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEtyp">Cil.typ</A> is the representation of a type. +Values for <A HREF="api/Cil.html#VALvoidType">operating on types</A>. +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEcompinfo">Cil.compinfo</A> is the representation of a structure or a union +type +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEfieldinfo">Cil.fieldinfo</A> is the representation of a field in a structure +or a union +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEenuminfo">Cil.enuminfo</A> is the representation of an enumeration type. +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEvarinfo">Cil.varinfo</A> is the representation of a variable +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEfundec">Cil.fundec</A> is the representation of a function +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPElval">Cil.lval</A> is the representation of an lvalue. +Values for <A HREF="api/Cil.html#VALmakeVarInfo">operating on lvalues</A>. +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEexp">Cil.exp</A> is the representation of an expression without +side-effects. +Values for <A HREF="api/Cil.html#VALzero">operating on expressions</A>. +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEinstr">Cil.instr</A> is the representation of an instruction (with +side-effects but without control-flow) +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEstmt">Cil.stmt</A> is the representation of a control-flow statements. +Values for <A HREF="api/Cil.html#VALmkStmt">operating on statements</A>. +<LI CLASS="li-itemize"><A HREF="api/Cil.html#TYPEattribute">Cil.attribute</A> is the representation of attributes. +Values for <A HREF="api/Cil.html#TYPEattributeClass">operating on attributes</A>. +</UL> +<A NAME="toc3"></A> +<H3 CLASS="subsection"><A NAME="htoc9">6.1</A> Using the visitor</H3><A NAME="sec-visitor"></A> +One of the most useful tools exported by the CIL API is an implementation of +the visitor pattern for CIL programs. The visiting engine scans depth-first +the structure of a CIL program and at each node is queries a user-provided +visitor structure whether it should do one of the following operations: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +Ignore this node and all its descendants +<LI CLASS="li-itemize">Descend into all of the children and when done rebuild the node if any +of the children have changed. +<LI CLASS="li-itemize">Replace the subtree rooted at the node with another tree. +<LI CLASS="li-itemize">Replace the subtree with another tree, then descend into the children +and rebuild the node if necessary and then invoke a user-specified function. +<LI CLASS="li-itemize">In addition to all of the above actions then visitor can specify that +some instructions should be queued to be inserted before the current +instruction or statement being visited. +</UL> +By writing visitors you can customize the program traversal and +transformation. One major limitation of the visiting engine is that it does +not propagate information from one node to another. Each visitor must use its +own private data to achieve this effect if necessary. <BR> +<BR> +Each visitor is an object that is an instance of a class of type <A HREF="api/Cil.cilVisitor.html#.">Cil.cilVisitor..</A> +The most convenient way to obtain such classes is to specialize the +<A HREF="api/Cil.nopCilVisitor.html#c">Cil.nopCilVisitor.c</A>lass (which just traverses the tree doing +nothing). Any given specialization typically overrides only a few of the +methods. Take a look for example at the visitor defined in the module +<TT>logwrites.ml</TT>. Another, more elaborate example of a visitor is the +[copyFunctionVisitor] defined in <TT>cil.ml</TT>.<BR> +<BR> +Once you have defined a visitor you can invoke it with one of the functions: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<A HREF="api/Cil.html#VALvisitCilFile">Cil.visitCilFile</A> or <A HREF="api/Cil.html#VALvisitCilFileSameGlobals">Cil.visitCilFileSameGlobals</A> - visit a file +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALvisitCilGlobal">Cil.visitCilGlobal</A> - visit a global +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALvisitCilFunction">Cil.visitCilFunction</A> - visit a function definition +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALvisitCilExp">Cil.visitCilExp</A> - visit an expression +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALvisitCilLval">Cil.visitCilLval</A> - visit an lvalue +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALvisitCilInstr">Cil.visitCilInstr</A> - visit an instruction +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALvisitCilStmt">Cil.visitCilStmt</A> - visit a statement +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALvisitCilType">Cil.visitCilType</A> - visit a type. Note that this does not visit +the files of a composite type. use visitGlobal to visit the [GCompTag] that +defines the fields. +</UL> +Some transformations may want to use visitors to insert additional +instructions before statements and instructions. To do so, pass a list of +instructions to the <A HREF="api/Cil.html#VALqueueInstr">Cil.queueInstr</A> method of the specialized +object. The instructions will automatically be inserted before that +instruction in the transformed code. The <A HREF="api/Cil.html#VALunqueueInstr">Cil.unqueueInstr</A> method +should not normally be called by the user. <BR> +<BR> +<A NAME="toc4"></A> +<H3 CLASS="subsection"><A NAME="htoc10">6.2</A> Interpreted Constructors and Deconstructors</H3> +Interpreted constructors and deconstructors are a facility for constructing +and deconstructing CIL constructs using a pattern with holes that can be +filled with a variety of kinds of elements. The pattern is a string that uses +the C syntax to represent C language elements. For example, the following +code: +<PRE CLASS="verbatim"><FONT COLOR=blue> +Formatcil.cType "void * const (*)(int x)" +</FONT></PRE> +is an alternative way to construct the internal representation of the type of pointer to function +with an integer argument and a void * const as result: +<PRE CLASS="verbatim"><FONT COLOR=blue> +TPtr(TFun(TVoid [Attr("const", [])], + [ ("x", TInt(IInt, []), []) ], false, []), []) +</FONT></PRE> +The advantage of the interpreted constructors is that you can use familiar C +syntax to construct CIL abstract-syntax trees. <BR> +<BR> +You can construct this way types, lvalues, expressions, instructions and +statements. The pattern string can also contain a number of placeholders that +are replaced during construction with CIL items passed as additional argument +to the construction function. For example, the <TT>%e:id</TT> placeholder means +that the argument labeled “id” (expected to be of form <TT>Fe exp</TT>) will +supply the expression to replace the placeholder. For example, the following +code constructs an increment instruction at location <TT>loc</TT>: +<PRE CLASS="verbatim"><FONT COLOR=blue> +Formatcil.cInstr "%v:x = %v:x + %e:something" + loc + [ ("something", Fe some_exp); + ("x", Fv some_varinfo) ] +</FONT></PRE> +An alternative way to construct the same CIL instruction is: +<PRE CLASS="verbatim"><FONT COLOR=blue> +Set((Var some_varinfo, NoOffset), + BinOp(PlusA, Lval (Var some_varinfo, NoOffset), + some_exp, intType), + loc) +</FONT></PRE> +See <A HREF="api/Cil.html#TYPEformatArg">Cil.formatArg</A> for a definition of the placeholders that are +understood.<BR> +<BR> +A dual feature is the interpreted deconstructors. This can be used to test +whether a CIL construct has a certain form: +<PRE CLASS="verbatim"><FONT COLOR=blue> +Formatcil.dType "void * const (*)(int x)" t +</FONT></PRE> +will test whether the actual argument <TT>t</TT> is indeed a function pointer of +the required type. If it is then the result is <TT>Some []</TT> otherwise it is +<TT>None</TT>. Furthermore, for the purpose of the interpreted deconstructors +placeholders in patterns match anything of the right type. For example, +<PRE CLASS="verbatim"><FONT COLOR=blue> +Formatcil.dType "void * (*)(%F:t)" t +</FONT></PRE> +will match any function pointer type, independent of the type and number of +the formals. If the match succeeds the result is <TT>Some [ FF forms ]</TT> where +<TT>forms</TT> is a list of names and types of the formals. Note that each member +in the resulting list corresponds positionally to a placeholder in the +pattern.<BR> +<BR> +The interpreted constructors and deconstructors do not support the complete C +syntax, but only a substantial fragment chosen to simplify the parsing. The +following is the syntax that is supported: +<PRE CLASS="verbatim"> +Expressions: + E ::= %e:ID | %d:ID | %g:ID | n | L | ( E ) | Unop E | E Binop E + | sizeof E | sizeof ( T ) | alignof E | alignof ( T ) + | & L | ( T ) E + +Unary operators: + Unop ::= + | - | ~ | %u:ID + +Binary operators: + Binop ::= + | - | * | / | << | >> | & | ``|'' | ^ + | == | != | < | > | <= | >= | %b:ID + +Lvalues: + L ::= %l:ID | %v:ID Offset | * E | (* E) Offset | E -> ident Offset + +Offsets: + Offset ::= empty | %o:ID | . ident Offset | [ E ] Offset + +Types: + T ::= Type_spec Attrs Decl + +Type specifiers: + Type_spec ::= void | char | unsigned char | short | unsigned short + | int | unsigned int | long | unsigned long | %k:ID | float + | double | struct %c:ID | union %c:ID + + +Declarators: + Decl ::= * Attrs Decl | Direct_decl + + +Direct declarators: + Direct_decl ::= empty | ident | ( Attrs Decl ) + | Direct_decl [ Exp_opt ] + | ( Attrs Decl )( Parameters ) + +Optional expressions + Exp_opt ::= empty | E | %eo:ID + +Formal parameters + Parameters ::= empty | ... | %va:ID | %f:ID | T | T , Parameters + +List of attributes + Attrs ::= empty | %A:ID | Attrib Attrs + +Attributes + Attrib ::= const | restrict | volatile | __attribute__ ( ( GAttr ) ) + +GCC Attributes + GAttr ::= ident | ident ( AttrArg_List ) + +Lists of GCC Attribute arguments: + AttrArg_List ::= AttrArg | %P:ID | AttrArg , AttrArg_List + +GCC Attribute arguments + AttrArg ::= %p:ID | ident | ident ( AttrArg_List ) + +Instructions + Instr ::= %i:ID ; | L = E ; | L Binop= E | Callres L ( Args ) + +Actual arguments + Args ::= empty | %E:ID | E | E , Args + +Call destination + Callres ::= empty | L = | %lo:ID + +Statements + Stmt ::= %s:ID | if ( E ) then Stmt ; | if ( E ) then Stmt else Stmt ; + | return Exp_opt | break ; | continue ; | { Stmt_list } + | while (E ) Stmt | Instr_list + +Lists of statements + Stmt_list ::= empty | %S:ID | Stmt Stmt_list + | Type_spec Attrs Decl ; Stmt_list + | Type_spec Attrs Decl = E ; Stmt_list + | Type_spec Attrs Decl = L (Args) ; Stmt_list + +List of instructions + Instr_list ::= Instr | %I:ID | Instr Instr_list +</PRE> +Notes regarding the syntax: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +In the grammar description above non-terminals are written with +uppercase initial<BR> +<BR> +<LI CLASS="li-itemize">All of the patterns consist of the <TT>%</TT> character followed by one or +two letters, followed by “:” and an indentifier. For each such +pattern there is a corresponding constructor of the <A HREF="api/Cil.html#TYPEformatArg">Cil.formatArg</A> +type, whose name is the letter 'F' followed by the same one or two letters as +in the pattern. That constructor is used by the user code to pass a +<A HREF="api/Cil.html#TYPEformatArg">Cil.formatArg</A> actual argument to the interpreted constructor and by +the interpreted deconstructor to return what was matched for a pattern.<BR> +<BR> +<LI CLASS="li-itemize">If the pattern name is uppercase, it designates a list of the elements +designated by the corresponding lowercase pattern. E.g. %E designated lists +of expressions (as in the actual arguments of a call).<BR> +<BR> +<LI CLASS="li-itemize">The two-letter patterns whose second letter is “o” designate an +optional element. E.g. %eo designates an optional expression (as in the +length of an array). <BR> +<BR> +<LI CLASS="li-itemize">Unlike in calls to <TT>printf</TT>, the pattern %g is used for strings. <BR> +<BR> +<LI CLASS="li-itemize">The usual precedence and associativity rules as in C apply <BR> +<BR> +<LI CLASS="li-itemize">The pattern string can contain newlines and comments, using both the +<TT>/* ... */</TT> style as well as the <TT>//</TT> one. <BR> +<BR> +<LI CLASS="li-itemize">When matching a “cast” pattern of the form <TT>( T ) E</TT>, the +deconstructor will match even expressions that do not have the actual cast but +in that case the type is matched against the type of the expression. E.g. the +patters <TT>"(int)%e"</TT> will match any expression of type <TT>int</TT> whether it +has an explicit cast or not. <BR> +<BR> +<LI CLASS="li-itemize">The %k pattern is used to construct and deconstruct an integer type of +any kind. <BR> +<BR> +<LI CLASS="li-itemize">Notice that the syntax of types and declaration are the same (in order +to simplify the parser). This means that technically you can write a whole +declaration instead of a type in the cast. In this case the name that you +declare is ignored.<BR> +<BR> +<LI CLASS="li-itemize">In lists of formal parameters and lists of attributes, an empty list in +the pattern matches any formal parameters or attributes. <BR> +<BR> +<LI CLASS="li-itemize">When matching types, uses of named types are unrolled to expose a real +type before matching. <BR> +<BR> +<LI CLASS="li-itemize">The order of the attributes is ignored during matching. The the pattern +for a list of attributes contains %A then the resulting <TT>formatArg</TT> will be +bound to <B>all</B> attributes in the list. For example, the pattern <TT>"const +%A"</TT> matches any list of attributes that contains <TT>const</TT> and binds the +corresponding placeholder to the entire list of attributes, including +<TT>const</TT>. <BR> +<BR> +<LI CLASS="li-itemize">All instruction-patterns must be terminated by semicolon<BR> +<BR> +<LI CLASS="li-itemize">The autoincrement and autodecrement instructions are not supported. Also +not supported are complex expressions, the <TT>&&</TT> and <TT>||</TT> shortcut +operators, and a number of other more complex instructions or statements. In +general, the patterns support only constructs that can be represented directly +in CIL.<BR> +<BR> +<LI CLASS="li-itemize">The pattern argument identifiers are not used during deconstruction. +Instead, the result contains a sequence of values in the same order as the +appearance of pattern arguments in the pattern.<BR> +<BR> +<LI CLASS="li-itemize">You can mix statements with declarations. For each declaration a new + temporary will be constructed (using a function you provive). You can then + refer to that temporary by name in the rest of the pattern.<BR> +<BR> +<LI CLASS="li-itemize">The <TT>%v:</TT> pattern specifier is optional. +</UL> +The following function are defined in the <TT>Formatcil</TT> module for +constructing and deconstructing: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<A HREF="api/Formatcil.html#VALcExp">Formatcil.cExp</A> constructs <A HREF="api/Cil.html#TYPEexp">Cil.exp</A>. +<LI CLASS="li-itemize"><A HREF="api/Formatcil.html#VALcType">Formatcil.cType</A> constructs <A HREF="api/Cil.html#TYPEtyp">Cil.typ</A>. +<LI CLASS="li-itemize"><A HREF="api/Formatcil.html#VALcLval">Formatcil.cLval</A> constructs <A HREF="api/Cil.html#TYPElval">Cil.lval</A>. +<LI CLASS="li-itemize"><A HREF="api/Formatcil.html#VALcInstr">Formatcil.cInstr</A> constructs <A HREF="api/Cil.html#TYPEinstr">Cil.instr</A>. +<LI CLASS="li-itemize"><A HREF="api/Formatcil.html#VALcStmt">Formatcil.cStmt</A> and <A HREF="api/Formatcil.html#VALcStmts">Formatcil.cStmts</A> construct <A HREF="api/Cil.html#TYPEstmt">Cil.stmt</A>. +<LI CLASS="li-itemize"><A HREF="api/Formatcil.html#VALdExp">Formatcil.dExp</A> deconstructs <A HREF="api/Cil.html#TYPEexp">Cil.exp</A>. +<LI CLASS="li-itemize"><A HREF="api/Formatcil.html#VALdType">Formatcil.dType</A> deconstructs <A HREF="api/Cil.html#TYPEtyp">Cil.typ</A>. +<LI CLASS="li-itemize"><A HREF="api/Formatcil.html#VALdLval">Formatcil.dLval</A> deconstructs <A HREF="api/Cil.html#TYPElval">Cil.lval</A>. +<LI CLASS="li-itemize"><A HREF="api/Formatcil.html#VALdInstr">Formatcil.dInstr</A> deconstructs <A HREF="api/Cil.html#TYPElval">Cil.lval</A>. +</UL> +Below is an example using interpreted constructors. This example generates +the CIL representation of code that scans an array backwards and initializes +every even-index element with an expression: +<PRE CLASS="verbatim"><FONT COLOR=blue> +Formatcil.cStmts + loc + "int idx = sizeof(array) / sizeof(array[0]) - 1; + while(idx >= 0) { + // Some statements to be run for all the elements of the array + %S:init + if(! (idx & 1)) + array[idx] = %e:init_even; + /* Do not forget to decrement the index variable */ + idx = idx - 1; + }" + (fun n t -> makeTempVar myfunc ~name:n t) + [ ("array", Fv myarray); + ("init", FS [stmt1; stmt2; stmt3]); + ("init_even", Fe init_expr_for_even_elements) ] +</FONT></PRE> +To write the same CIL statement directly in CIL would take much more effort. +Note that the pattern is parsed only once and the result (a function that +takes the arguments and constructs the statement) is memoized. <BR> +<BR> + +<H4 CLASS="subsubsection"><A NAME="htoc11">6.2.1</A> Performance considerations for interpreted constructors</H4> +Parsing the patterns is done with a LALR parser and it takes some time. To +improve performance the constructors and deconstructors memoize the parsed +patterns and will only compile a pattern once. Also all construction and +deconstruction functions can be applied partially to the pattern string to +produce a function that can be later used directly to construct or +deconstruct. This function appears to be about two times slower than if the +construction is done using the CIL constructors (without memoization the +process would be one order of magnitude slower.) However, the convenience of +interpreted constructor might make them a viable choice in many situations +when performance is not paramount (e.g. prototyping).<BR> +<BR> +<A NAME="toc5"></A> +<H3 CLASS="subsection"><A NAME="htoc12">6.3</A> Printing and Debugging support</H3> +The Modules <A HREF="api/Pretty.html">Pretty</A> and <A HREF="api/Errormsg.html">Errormsg</A> contain respectively +utilities for pretty printing and reporting errors and provide a convenient +<TT>printf</TT>-like interface. <BR> +<BR> +Additionally, CIL defines for each major type a pretty-printing function that +you can use in conjunction with the <A HREF="api/Pretty.html">Pretty</A> interface. The +following are some of the pretty-printing functions: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<A HREF="api/Cil.html#VALd_exp">Cil.d_exp</A> - print an expression +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_type">Cil.d_type</A> - print a type +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_lval">Cil.d_lval</A> - print an lvalue +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_global">Cil.d_global</A> - print a global +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_stmt">Cil.d_stmt</A> - print a statment +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_instr">Cil.d_instr</A> - print an instruction +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_init">Cil.d_init</A> - print an initializer +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_attr">Cil.d_attr</A> - print an attribute +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_attrlist">Cil.d_attrlist</A> - print a set of attributes +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_loc">Cil.d_loc</A> - print a location +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_ikind">Cil.d_ikind</A> - print an integer kind +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_fkind">Cil.d_fkind</A> - print a floating point kind +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_const">Cil.d_const</A> - print a constant +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALd_storage">Cil.d_storage</A> - print a storage specifier +</UL> +You can even customize the pretty-printer by creating instances of +<A HREF="api/Cil.cilPrinter.html#.">Cil.cilPrinter..</A> Typically such an instance extends +<A HREF="api/Cil.html#VALdefaultCilPrinter">Cil.defaultCilPrinter</A>. Once you have a customized pretty-printer you +can use the following printing functions: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<A HREF="api/Cil.html#VALprintExp">Cil.printExp</A> - print an expression +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALprintType">Cil.printType</A> - print a type +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALprintLval">Cil.printLval</A> - print an lvalue +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALprintGlobal">Cil.printGlobal</A> - print a global +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALprintStmt">Cil.printStmt</A> - print a statment +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALprintInstr">Cil.printInstr</A> - print an instruction +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALprintInit">Cil.printInit</A> - print an initializer +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALprintAttr">Cil.printAttr</A> - print an attribute +<LI CLASS="li-itemize"><A HREF="api/Cil.html#VALprintAttrs">Cil.printAttrs</A> - print a set of attributes +</UL> +CIL has certain internal consistency invariants. For example, all references +to a global variable must point to the same <TT>varinfo</TT> structure. This +ensures that one can rename the variable by changing the name in the +<TT>varinfo</TT>. These constraints are mentioned in the API documentation. There +is also a consistency checker in file <TT>src/check.ml</TT>. If you suspect that +your transformation is breaking these constraints then you can pass the +<TT>--check</TT> option to cilly and this will ensure that the consistency checker +is run after each transformation. <BR> +<BR> +<A NAME="toc6"></A> +<H3 CLASS="subsection"><A NAME="htoc13">6.4</A> Attributes</H3><A NAME="sec-attrib"></A> +In CIL you can attach attributes to types and to names (variables, functions +and fields). Attributes are represented using the type <A HREF="api/Cil.html#TYPEattribute">Cil.attribute</A>. +An attribute consists of a name and a number of arguments (represented using +the type <A HREF="api/Cil.html#TYPEattrparam">Cil.attrparam</A>). Almost any expression can be used as an +attribute argument. Attributes are stored in lists sorted by the name of the +attribute. To maintain list ordering, use the functions +<A HREF="api/Cil.html#VALtypeAttrs">Cil.typeAttrs</A> to retrieve the attributes of a type and the functions +<A HREF="api/Cil.html#VALaddAttribute">Cil.addAttribute</A> and <A HREF="api/Cil.html#VALaddAttributes">Cil.addAttributes</A> to add attributes. +Alternatively you can use <A HREF="api/Cil.html#VALtypeAddAttributes">Cil.typeAddAttributes</A> to add an attribute to +a type (and return the new type).<BR> +<BR> +GCC already has extensive support for attributes, and CIL extends this +support to user-defined attributes. A GCC attribute has the syntax: +<PRE CLASS="verbatim"> + gccattribute ::= __attribute__((attribute)) (Note the double parentheses) +</PRE> + Since GCC and MSVC both support various flavors of each attribute (with or +without leading or trailing _) we first strip ALL leading and trailing _ +from the attribute name (but not the identified in [ACons] parameters in +<A HREF="api/Cil.html#TYPEattrparam">Cil.attrparam</A>). When we print attributes, for GCC we add two leading +and two trailing _; for MSVC we add just two leading _.<BR> +<BR> +There is support in CIL so that you can control the printing of attributes +(see <A HREF="api/Cil.html#VALsetCustomPrintAttribute">Cil.setCustomPrintAttribute</A> and +<A HREF="api/Cil.html#VALsetCustomPrintAttributeScope">Cil.setCustomPrintAttributeScope</A>). This custom-printing support is now +used to print the "const" qualifier as "<TT>const</TT>" and not as +"<TT>__attribute__((const))</TT>".<BR> +<BR> +The attributes are specified in declarations. This is unfortunate since the C +syntax for declarations is already quite complicated and after writing the +parser and elaborator for declarations I am convinced that few C programmers +understand it completely. Anyway, this seems to be the easiest way to support +attributes. <BR> +<BR> +Name attributes must be specified at the very end of the declaration, just +before the <TT>=</TT> for the initializer or before the <TT>,</TT> the separates a +declaration in a group of declarations or just before the <TT>;</TT> that +terminates the declaration. A name attribute for a function being defined can +be specified just before the brace that starts the function body.<BR> +<BR> +For example (in the following examples <TT>A1</TT>,...,<TT>An</TT> are type attributes +and <TT>N</TT> is a name attribute (each of these uses the <TT>__attribute__</TT> syntax): +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x N; + int x N, * y N = 0, z[] N; + extern void exit() N; + int fact(int x) N { ... } +</FONT></PRE> +Type attributes can be specified along with the type using the following + rules: +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> + The type attributes for a base type (int, float, named type, reference + to struct or union or enum) must be specified immediately following the + type (actually it is Ok to mix attributes with the specification of the + type, in between unsigned and int for example).<BR> +<BR> +For example: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int A1 x N; /* A1 applies to the type int. An example is an attribute + "even" restricting the type int to even values. */ + struct foo A1 A2 x; // Both A1 and A2 apply to the struct foo type +</FONT></PRE><BR> +<BR> +<LI CLASS="li-enumerate">The type attributes for a pointer type must be specified immediately + after the * symbol. +<PRE CLASS="verbatim"><FONT COLOR=blue> + /* A pointer (A1) to an int (A2) */ + int A2 * A1 x; + /* A pointer (A1) to a pointer (A2) to a float (A3) */ + float A3 * A2 * A1 x; +</FONT></PRE> +Note: The attributes for base types and for pointer types are a strict + extension of the ANSI C type qualifiers (const, volatile and restrict). In + fact CIL treats these qualifiers as attributes. <BR> +<BR> +<LI CLASS="li-enumerate">The attributes for a function type or for an array type can be + specified using parenthesized declarators.<BR> +<BR> +For example: +<PRE CLASS="verbatim"><FONT COLOR=blue> + /* A function (A1) from int (A2) to float (A3) */ + float A3 (A1 f)(int A2); + + /* A pointer (A1) to a function (A2) that returns an int (A3) */ + int A3 (A2 * A1 pfun)(void); + + /* An array (A1) of int (A2) */ + int A2 (A1 x0)[] + + /* Array (A1) of pointers (A2) to functions (A3) that take an int (A4) and + * return a pointer (A5) to int (A6) */ + int A6 * A5 (A3 * A2 (A1 x1)[5])(int A4); + + + /* A function (A4) that takes a float (A5) and returns a pointer (A6) to an + * int (A7) */ + extern int A7 * A6 (A4 x2)(float A5 x); + + /* A function (A1) that takes a int (A2) and that returns a pointer (A3) to + * a function (A4) that takes a float (A5) and returns a pointer (A6) to an + * int (A7) */ + int A7 * A6 (A4 * A3 (A1 x3)(int A2 x))(float A5) { + return & x2; + } +</FONT></PRE></OL> +Note: ANSI C does not allow the specification of type qualifiers for function +and array types, although it allows for the parenthesized declarator. With +just a bit of thought (looking at the first few examples above) I hope that +the placement of attributes for function and array types will seem intuitive.<BR> +<BR> +This extension is not without problems however. If you want to refer just to +a type (in a cast for example) then you leave the name out. But this leads to +strange conflicts due to the parentheses that we introduce to scope the +attributes. Take for example the type of x0 from above. It should be written +as: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int A2 (A1 )[] +</FONT></PRE> +But this will lead most C parsers into deep confusion because the parentheses +around A1 will be confused for parentheses of a function designator. To push +this problem around (I don't know a solution) whenever we are about to print a +parenthesized declarator with no name but with attributes, we comment out the +attributes so you can see them (for whatever is worth) without confusing the +compiler. For example, here is how we would print the above type: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int A2 /*(A1 )*/[] +</FONT></PRE> + +<H5 CLASS="paragraph">Handling of predefined GCC attributes</H5> +GCC already supports attributes in a lot of places in declarations. The only +place where we support attributes and GCC does not is right before the { that +starts a function body. <BR> +<BR> +GCC classifies its attributes in attributes for functions, for variables and +for types, although the latter category is only usable in definition of struct +or union types and is not nearly as powerful as the CIL type attributes. We +have made an effort to reclassify GCC attributes as name and type attributes +(they only apply for function types). Here is what we came up with: +<UL CLASS="itemize"><LI CLASS="li-itemize"> + GCC name attributes:<BR> +<BR> +section, constructor, destructor, unused, weak, no_instrument_function, + noreturn, alias, no_check_memory_usage, dllinport, dllexport, exception, + model<BR> +<BR> +Note: the "noreturn" attribute would be more appropriately qualified as a + function type attribute. But we classify it as a name attribute to make + it easier to support a similarly named MSVC attribute. <BR> +<BR> +<LI CLASS="li-itemize">GCC function type attributes:<BR> +<BR> +fconst (printed as "const"), format, regparm, stdcall, + cdecl, longcall<BR> +<BR> +I was not able to completely decipher the position in which these attributes + must go. So, the CIL elaborator knows these names and applies the following + rules: + <UL CLASS="itemize"><LI CLASS="li-itemize"> + All of the name attributes that appear in the specifier part (i.e. at + the beginning) of a declaration are associated with all declared names. <BR> +<BR> +<LI CLASS="li-itemize">All of the name attributes that appear at the end of a declarator are + associated with the particular name being declared.<BR> +<BR> +<LI CLASS="li-itemize">More complicated is the handling of the function type attributes, since + there can be more than one function in a single declaration (a function + returning a pointer to a function). Lacking any real understanding of how + GCC handles this, I attach the function type attribute to the "nearest" + function. This means that if a pointer to a function is "nearby" the + attribute will be correctly associated with the function. In truth I pray + that nobody uses declarations as that of x3 above. + </UL> +</UL> + +<H5 CLASS="paragraph">Handling of predefined MSVC attributes</H5> +MSVC has two kinds of attributes, declaration modifiers to be printed before + the storage specifier using the notation "<TT>__declspec(...)</TT>" and a few + function type attributes, printed almost as our CIL function type + attributes. <BR> +<BR> +The following are the name attributes that are printed using + <TT>__declspec</TT> right before the storage designator of the declaration: + thread, naked, dllimport, dllexport, noreturn<BR> +<BR> +The following are the function type attributes supported by MSVC: + fastcall, cdecl, stdcall<BR> +<BR> +It is not worth going into the obscure details of where MSVC accepts these + type attributes. The parser thinks it knows these details and it pulls + these attributes from wherever they might be placed. The important thing + is that MSVC will accept if we print them according to the rules of the CIL + attributes ! <BR> +<BR> +<HR> +<A HREF="cilly.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil007.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/cil007.html b/cil/doc/cil007.html new file mode 100644 index 0000000..7d6c023 --- /dev/null +++ b/cil/doc/cil007.html @@ -0,0 +1,279 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +The CIL Driver +</TITLE> +</HEAD> +<BODY > +<A HREF="cil006.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="ext.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc14">7</A> The CIL Driver</H2><A NAME="sec-driver"></A> +We have packaged CIL as an application <TT>cilly</TT> that contains certain +example modules, such as <TT>logwrites.ml</TT> (a module +that instruments code to print the addresses of memory locations being +written). Normally, you write another module like that, add command-line +options and an invocation of your module in <TT>src/main.ml</TT>. Once you compile +CIL you will obtain the file <TT>obj/cilly.asm.exe</TT>. <BR> +<BR> +We wrote a driver for this executable that makes it easy to invoke your +analysis on existing C code with very little manual intervention. This driver +is <TT>bin/cilly</TT> and is quite powerful. Note that the <TT>cilly</TT> script +is configured during installation with the path where CIL resides. This means +that you can move it to any place you want. <BR> +<BR> +A simple use of the driver is: +<PRE CLASS="verbatim"> +bin/cilly --save-temps -D HAPPY_MOOD -I myincludes hello.c -o hello +</PRE> +<FONT COLOR=blue>--save-temps</FONT> tells CIL to save the resulting output files in the +current directory. Otherwise, they'll be put in <TT>/tmp</TT> and deleted +automatically. Not that this is the only CIL-specific flag in the +list – the other flags use <TT>gcc</TT>'s syntax.<BR> +<BR> +This performs the following actions: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +preprocessing using the -D and -I arguments with the resulting + file left in <TT>hello.i</TT>, +<LI CLASS="li-itemize">the invocation of the <TT>cilly.asm</TT> application which parses <TT>hello.i</TT> + converts it to CIL and the pretty-prints it to <TT>hello.cil.c</TT> +<LI CLASS="li-itemize">another round of preprocessing with the result placed in <TT>hello.cil.i</TT> +<LI CLASS="li-itemize">the true compilation with the result in <TT>hello.cil.o</TT> +<LI CLASS="li-itemize">a linking phase with the result in <TT>hello</TT> +</UL> +Note that <TT>cilly</TT> behaves like the <TT>gcc</TT> compiler. This makes it +easy to use it with existing <TT>Makefiles</TT>: +<PRE CLASS="verbatim"> +make CC="bin/cilly" LD="bin/cilly" +</PRE> + <TT>cilly</TT> can also behave as the Microsoft Visual C compiler, if the first + argument is <TT>--mode=MSVC</TT>: +<PRE CLASS="verbatim"> +bin/cilly --mode=MSVC /D HAPPY_MOOD /I myincludes hello.c /Fe hello.exe +</PRE> + (This in turn will pass a <TT>--MSVC</TT> flag to the underlying <TT>cilly.asm</TT> + process which will make it understand the Microsoft Visual C extensions)<BR> +<BR> +<TT>cilly</TT> can also behave as the archiver <TT>ar</TT>, if it is passed an +argument <TT>--mode=AR</TT>. Note that only the <TT>cr</TT> mode is supported (create a +new archive and replace all files in there). Therefore the previous version of +the archive is lost. <BR> +<BR> +Furthermore, <TT>cilly</TT> allows you to pass some arguments on to the +underlying <TT>cilly.asm</TT> process. As a general rule all arguments that start +with <TT>--</TT> and that <TT>cilly</TT> itself does not process, are passed on. For +example, +<PRE CLASS="verbatim"> +bin/cilly --dologwrites -D HAPPY_MOOD -I myincludes hello.c -o hello.exe +</PRE> + will produce a file <TT>hello.cil.c</TT> that prints all the memory addresses +written by the application. <BR> +<BR> +The most powerful feature of <TT>cilly</TT> is that it can collect all the +sources in your project, merge them into one file and then apply CIL. This +makes it a breeze to do whole-program analysis and transformation. All you +have to do is to pass the <TT>--merge</TT> flag to <TT>cilly</TT>: +<PRE CLASS="verbatim"> +make CC="bin/cilly --save-temps --dologwrites --merge" +</PRE> + You can even leave some files untouched: +<PRE CLASS="verbatim"> +make CC="bin/cilly --save-temps --dologwrites --merge --leavealone=foo --leavealone=bar" +</PRE> + This will merge all the files except those with the basename <TT>foo</TT> and +<TT>bar</TT>. Those files will be compiled as usual and then linked in at the very +end. <BR> +<BR> +The sequence of actions performed by <TT>cilly</TT> depends on whether merging +is turned on or not: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +If merging is off + <OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> + For every file <TT>file.c</TT> to compile + <OL CLASS="enumerate" type=a><LI CLASS="li-enumerate"> + Preprocess the file with the given arguments to + produce <TT>file.i</TT> + <LI CLASS="li-enumerate">Invoke <TT>cilly.asm</TT> to produce a <TT>file.cil.c</TT> + <LI CLASS="li-enumerate">Preprocess to <TT>file.cil.i</TT> + <LI CLASS="li-enumerate">Invoke the underlying compiler to produce <TT>file.cil.o</TT> + </OL> + <LI CLASS="li-enumerate">Link the resulting objects + </OL> +<LI CLASS="li-itemize">If merging is on + <OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> + For every file <TT>file.c</TT> to compile + <OL CLASS="enumerate" type=a><LI CLASS="li-enumerate"> + Preprocess the file with the given arguments to + produce <TT>file.i</TT> + <LI CLASS="li-enumerate">Save the preprocessed source as <TT>file.o</TT> + </OL> + <LI CLASS="li-enumerate">When linking executable <TT>hello.exe</TT>, look at every object + file that must be linked and see if it actually + contains preprocessed source. Pass all those files to a + special merging application (described in + Section <A HREF="merger.html#sec-merger">13</A>) to produce <TT>hello.exe_comb.c</TT> + <LI CLASS="li-enumerate">Invoke <TT>cilly.asm</TT> to produce a <TT>hello.exe_comb.cil.c</TT> + <LI CLASS="li-enumerate">Preprocess to <TT>hello.exe_comb.cil.i</TT> + <LI CLASS="li-enumerate">Invoke the underlying compiler to produce <TT>hello.exe_comb.cil.o</TT> + <LI CLASS="li-enumerate">Invoke the actual linker to produce <TT>hello.exe</TT> + </OL> +</UL> +Note that files that you specify with <TT>--leavealone</TT> are not merged and +never presented to CIL. They are compiled as usual and then are linked in at +the end. <BR> +<BR> +And a final feature of <TT>cilly</TT> is that it can substitute copies of the +system's include files: +<PRE CLASS="verbatim"> +make CC="bin/cilly --includedir=myinclude" +</PRE> + This will force the preprocessor to use the file <TT>myinclude/xxx/stdio.h</TT> +(if it exists) whenever it encounters <TT>#include <stdio.h></TT>. The <TT>xxx</TT> is +a string that identifies the compiler version you are using. This modified +include files should be produced with the patcher script (see +Section <A HREF="patcher.html#sec-patcher">14</A>).<BR> +<BR> +<A NAME="toc7"></A> +<H3 CLASS="subsection"><A NAME="htoc15">7.1</A> <TT>cilly</TT> Options</H3> +Among the options for the <TT>cilly</TT> you can put anything that can normally +go in the command line of the compiler that <TT>cilly</TT> is impersonating. +<TT>cilly</TT> will do its best to pass those options along to the appropriate +subprocess. In addition, the following options are supported (a complete and +up-to-date list can always be obtained by running <TT>cilly --help</TT>): +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>--mode=mode</TT> This must be the first argument if present. It makes +<TT>cilly</TT> behave as a given compiled. The following modes are recognized: + <UL CLASS="itemize"><LI CLASS="li-itemize"> + GNUCC - the GNU C Compiler. This is the default. + <LI CLASS="li-itemize">MSVC - the Microsoft Visual C compiler. Of course, you should + pass only MSVC valid options in this case. + <LI CLASS="li-itemize">AR - the archiver <TT>ar</TT>. Only the mode <TT>cr</TT> is supported and + the original version of the archive is lost. + </UL> +<LI CLASS="li-itemize"><TT>--help</TT> Prints a list of the options supported. +<LI CLASS="li-itemize"><TT>--verbose</TT> Prints lots of messages about what is going on. +<LI CLASS="li-itemize"><TT>--stages</TT> Less than <TT>--verbose</TT> but lets you see what <TT>cilly</TT> + is doing. +<LI CLASS="li-itemize"><TT>--merge</TT> This tells <TT>cilly</TT> to first attempt to collect into one +source file all of the sources that make your application, and then to apply +<TT>cilly.asm</TT> on the resulting source. The sequence of actions in this case is +described above and the merger itself is described in Section <A HREF="merger.html#sec-merger">13</A>.<BR> +<BR> +<LI CLASS="li-itemize"><TT>--leavealone=xxx</TT>. Do not merge and do not present to CIL the files +whose basename is "xxx". These files are compiled as usual and linked in at +the end. +<LI CLASS="li-itemize"><TT>--includedir=xxx</TT>. Override the include files with those in the given +directory. The given directory is the same name that was given an an argument +to the patcher (see Section <A HREF="patcher.html#sec-patcher">14</A>). In particular this means that +that directory contains subdirectories named based on the current compiler +version. The patcher creates those directories. +<LI CLASS="li-itemize"><TT>--usecabs</TT>. Do not CIL, but instead just parse the source and print +its AST out. This should looked like the preprocessed file. This is useful +when you suspect that the conversion to CIL phase changes the meaning of the +program. +<LI CLASS="li-itemize"><TT>--save-temps=xxx</TT>. Temporary files are preserved in the xxx + directory. For example, the output of CIL will be put in a file + named <TT>*.cil.c</TT>. +<LI CLASS="li-itemize"><TT>--save-temps</TT>. Temporay files are preserved in the current directory. +</UL> +<A NAME="toc8"></A> +<H3 CLASS="subsection"><A NAME="htoc16">7.2</A> <TT>cilly.asm</TT> Options</H3> + <A NAME="sec-cilly-asm-options"></A> +All of the options that start with <TT>--</TT> and are not understood by +<TT>cilly</TT> are passed on to <TT>cilly.asm</TT>. <TT>cilly</TT> also passes along to +<TT>cilly.asm</TT> flags such as <TT>--MSVC</TT> that both need to know +about. The following options are supported:<BR> +<BR> + <B>General Options:</B> +<UL CLASS="itemize"><LI CLASS="li-itemize"> + <TT>--version</TT> output version information and exit + <LI CLASS="li-itemize"><TT>--verbose</TT> Print lots of random stuff. This is passed on from cilly + <LI CLASS="li-itemize"><TT>--warnall</TT> Show all warnings. + <LI CLASS="li-itemize"><TT>--debug=xxx</TT> turns on debugging flag xxx + <LI CLASS="li-itemize"><TT>--nodebug=xxx</TT> turns off debugging flag xxx + <LI CLASS="li-itemize"><TT>--flush</TT> Flush the output streams often (aids debugging). + <LI CLASS="li-itemize"><TT>--check</TT> Run a consistency check over the CIL after every operation. + <LI CLASS="li-itemize"><TT>--nocheck</TT> turns off consistency checking of CIL. + <LI CLASS="li-itemize"><TT>--noPrintLn</TT> Don't output #line directives in the output. + <LI CLASS="li-itemize"><TT>--commPrintLn</TT> Print #line directives in the output, but + put them in comments. + <LI CLASS="li-itemize"><TT>--log=xxx</TT> Set the name of the log file. By default stderr is used + <LI CLASS="li-itemize"><TT>--MSVC</TT> Enable MSVC compatibility. Default is GNU. + <LI CLASS="li-itemize"><TT>--ignore-merge-conflicts</TT> ignore merging conflicts. + <LI CLASS="li-itemize"><TT>--extrafiles=filename</TT>: the name of a file that contains + a list of additional files to process, separated by whitespace. + <LI CLASS="li-itemize"><TT>--stats</TT> Print statistics about the running time of the + parser, conversion to CIL, etc. Also prints memory-usage + statistics. You can time parts of your own code as well. Calling + (<TT>Stats.time “label” func arg</TT>) will evaluate <TT>(func arg)</TT> + and remember how long this takes. If you call <TT>Stats.time</TT> + repeatedly with the same label, CIL will report the aggregate + time.<BR> +<BR> +If available, CIL uses the x86 performance counters for these + stats. This is very precise, but results in “wall-clock time.” + To report only user-mode time, find the call to <TT>Stats.reset</TT> in + <TT>main.ml</TT>, and change it to <TT>Stats.reset false</TT>.<BR> +<BR> +<B>Lowering Options</B> + <LI CLASS="li-itemize"><TT>--noLowerConstants</TT> do not lower constant expressions. + <LI CLASS="li-itemize"><TT>--noInsertImplicitCasts</TT> do not insert implicit casts. + <LI CLASS="li-itemize"><TT>--forceRLArgEval</TT> Forces right to left evaluation of function arguments. + <LI CLASS="li-itemize"><TT>--disallowDuplication</TT> Prevent small chunks of code from being duplicated. + <LI CLASS="li-itemize"><TT>--keepunused</TT> Do not remove the unused variables and types. + <LI CLASS="li-itemize"><TT>--rmUnusedInlines</TT> Delete any unused inline functions. This is the default in MSVC mode.<BR> +<BR> +<B>Output Options:</B> + <LI CLASS="li-itemize"><TT>--printCilAsIs</TT> Do not try to simplify the CIL when + printing. Without this flag, CIL will attempt to produce prettier + output by e.g. changing <TT>while(1)</TT> into more meaningful loops. + <LI CLASS="li-itemize"><TT>--noWrap</TT> do not wrap long lines when printing + <LI CLASS="li-itemize"><TT>--out=xxx</TT> the name of the output CIL file. <TT>cilly</TT> + sets this for you. + <LI CLASS="li-itemize"><TT>--mergedout=xxx</TT> specify the name of the merged file + <LI CLASS="li-itemize"><TT>--cabsonly=xxx</TT> CABS output file name +<BR> +<BR> + <B>Selected features.</B> See Section <A HREF="ext.html#sec-Extension">8</A> for more information. +<LI CLASS="li-itemize"><TT>--dologcalls</TT>. Insert code in the processed source to print the name of +functions as are called. Implemented in <TT>src/ext/logcalls.ml</TT>. +<LI CLASS="li-itemize"><TT>--dologwrites</TT>. Insert code in the processed source to print the +address of all memory writes. Implemented in <TT>src/ext/logwrites.ml</TT>. +<LI CLASS="li-itemize"><TT>--dooneRet</TT>. Make each function have at most one 'return'. +Implemented in <TT>src/ext/oneret.ml</TT>. +<LI CLASS="li-itemize"><TT>--dostackGuard</TT>. Instrument function calls and returns to +maintain a separate stack for return addresses. Implemeted in +<TT>src/ext/heapify.ml</TT>. +<LI CLASS="li-itemize"><TT>--domakeCFG</TT>. Make the program look more like a CFG. Implemented +in <TT>src/cil.ml</TT>. +<LI CLASS="li-itemize"><TT>--dopartial</TT>. Do interprocedural partial evaluation and +constant folding. Implemented in <TT>src/ext/partial.ml</TT>. +<LI CLASS="li-itemize"><TT>--dosimpleMem</TT>. Simplify all memory expressions. Implemented in +<TT>src/ext/simplemem.ml</TT>. <BR> +<BR> +For an up-to-date list of available options, run <TT>cilly.asm --help</TT>. </UL> +<HR> +<A HREF="cil006.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="ext.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/cil009.html b/cil/doc/cil009.html new file mode 100644 index 0000000..f408d00 --- /dev/null +++ b/cil/doc/cil009.html @@ -0,0 +1,48 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +Controlling CIL +</TITLE> +</HEAD> +<BODY > +<A HREF="ext.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil010.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc35">9</A> Controlling CIL</H2> +In the process of converting a C file to CIL we drop the unused prototypes +and even inline function definitions. This results in much smaller files. If +you do not want this behavior then you must pass the <TT>--keepunused</TT> argument +to the CIL application. <BR> +<BR> +Alternatively you can put the following pragma in the code (instructing CIL +to specifically keep the declarations and definitions of the function +<TT>func1</TT> and variable <TT>var2</TT>, the definition of type <TT>foo</TT> and of +structure <TT>bar</TT>): +<PRE CLASS="verbatim"><FONT COLOR=blue> +#pragma cilnoremove("func1", "var2", "type foo", "struct bar") +</FONT></PRE> +<HR> +<A HREF="ext.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil010.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/cil010.html b/cil/doc/cil010.html new file mode 100644 index 0000000..e7b1e4b --- /dev/null +++ b/cil/doc/cil010.html @@ -0,0 +1,100 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +GCC Extensions +</TITLE> +</HEAD> +<BODY > +<A HREF="cil009.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil011.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc36">10</A> GCC Extensions</H2> +The CIL parser handles most of the <TT>gcc</TT> +<A HREF="javascript:loadTop('http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_5.html#SEC67')">extensions</A> +and compiles them to CIL. The following extensions are not handled (note that +we are able to compile a large number of programs, including the Linux kernel, +without encountering these): +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> +Nested function definitions. +<LI CLASS="li-enumerate">Constructing function calls. +<LI CLASS="li-enumerate">Naming an expression's type. +<LI CLASS="li-enumerate">Complex numbers +<LI CLASS="li-enumerate">Hex floats +<LI CLASS="li-enumerate">Subscripts on non-lvalue arrays. +<LI CLASS="li-enumerate">Forward function parameter declarations +</OL> +The following extensions are handled, typically by compiling them away: +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> +Attributes for functions, variables and types. In fact, we have a clear +specification (see Section <A HREF="cil006.html#sec-attrib">6.4</A>) of how attributes are interpreted. The +specification extends that of <TT>gcc</TT>. +<LI CLASS="li-enumerate">Old-style function definitions and prototypes. These are translated to +new-style. +<LI CLASS="li-enumerate">Locally-declared labels. As part of the translation to CIL, we generate +new labels as needed. +<LI CLASS="li-enumerate">Labels as values and computed goto. This allows a program to take the +address of a label and to manipulate it as any value and also to perform a +computed goto. We compile this by assigning each label whose address is taken +a small integer that acts as its address. Every computed <TT>goto</TT> in the body +of the function is replaced with a <TT>switch</TT> statement. If you want to invoke +the label from another function, you are on your own (the <TT>gcc</TT> +documentation says the same.) +<LI CLASS="li-enumerate">Generalized lvalues. You can write code like <TT>(a, b) += 5</TT> and it gets +translated to CIL. +<LI CLASS="li-enumerate">Conditionals with omitted operands. Things like <TT>x ? : y</TT> are +translated to CIL. +<LI CLASS="li-enumerate">Double word integers. The type <TT>long long</TT> and the <TT>LL</TT> suffix on +constants is understood. This is currently interpreted as 64-bit integers. +<LI CLASS="li-enumerate">Local arrays of variable length. These are converted to uses of +<TT>alloca</TT>, the array variable is replaced with a pointer to the allocated +array and the instances of <TT>sizeof(a)</TT> are adjusted to return the size of +the array and not the size of the pointer. +<LI CLASS="li-enumerate">Non-constant local initializers. Like all local initializers these are +compiled into assignments. +<LI CLASS="li-enumerate">Compound literals. These are also turned into assignments. +<LI CLASS="li-enumerate">Designated initializers. The CIL parser actually supports the full ISO +syntax for initializers, which is more than both <TT>gcc</TT> and <TT>MSVC</TT>. I +(George) think that this is the most complicated part of the C language and +whoever designed it should be banned from ever designing languages again. +<LI CLASS="li-enumerate">Case ranges. These are compiled into separate cases. There is no code +duplication, just a larger number of <TT>case</TT> statements. +<LI CLASS="li-enumerate">Transparent unions. This is a strange feature that allows you to define +a function whose formal argument has a (tranparent) union type, but the +argument is called as if it were the first element of the union. This is +compiled away by saying that the type of the formal argument is that of the +first field, and the first thing in the function body we copy the formal into +a union. <BR> +<BR> +<LI CLASS="li-enumerate">Inline assembly-language. The full syntax is supported and it is carried +as such in CIL.<BR> +<BR> +<LI CLASS="li-enumerate">Function names as strings. The identifiers <TT>__FUNCTION__</TT> and +<TT>__PRETTY_FUNCTION__</TT> are replaced with string literals. <BR> +<BR> +<LI CLASS="li-enumerate">Keywords <TT>typeof</TT>, <TT>alignof</TT>, <TT>inline</TT> are supported. +</OL> +<HR> +<A HREF="cil009.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil011.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/cil011.html b/cil/doc/cil011.html new file mode 100644 index 0000000..975c8dd --- /dev/null +++ b/cil/doc/cil011.html @@ -0,0 +1,53 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +CIL Limitations +</TITLE> +</HEAD> +<BODY > +<A HREF="cil010.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil012.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc37">11</A> CIL Limitations</H2> +There are several implementation details of CIL that might make it unusable + or less than ideal for certain tasks: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +CIL operates after preprocessing. If you need to see comments, for +example, you cannot use CIL. But you can use attributes and pragmas instead. +And there is some support to help you patch the include files before they are +seen by the preprocessor. For example, this is how we turn some +<TT>#define</TT>s that we don't like into function calls. <BR> +<BR> +<LI CLASS="li-itemize">CIL does transform the code in a non-trivial way. This is done in order +to make most analyses easier. But if you want to see the code <TT>e1, e2++</TT> +exactly as it appears in the code, then you should not use CIL. <BR> +<BR> +<LI CLASS="li-itemize">CIL removes all local scopes and moves all variables to function +scope. It also separates a declaration with an initializer into a declaration +plus an assignment. The unfortunate effect of this transformation is that +local variables cannot have the <TT>const</TT> qualifier.</UL> +<HR> +<A HREF="cil010.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil012.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/cil012.html b/cil/doc/cil012.html new file mode 100644 index 0000000..5d18fd5 --- /dev/null +++ b/cil/doc/cil012.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +Known Bugs and Limitations +</TITLE> +</HEAD> +<BODY > +<A HREF="cil011.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="merger.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc38">12</A> Known Bugs and Limitations</H2> +<UL CLASS="itemize"><LI CLASS="li-itemize">In the new versions of <TT>glibc</TT> there is a function + <TT>__builtin_va_arg</TT> that takes a type as its second argument. CIL + handles that through a slight trick. As it parses the function it changes a + call like: +<PRE CLASS="verbatim"> + mytype x = __builtin_va_arg(marker, mytype) +</PRE>into +<PRE CLASS="verbatim"> + mytype x; + __builtin_va_arg(marker, sizeof(mytype), &x); +</PRE> + The latter form is used internally in CIL. However, the CIL pretty printer + will try to emit the original code. <BR> +<BR> +Similarly, <TT>__builtin_types_compatible_p(t1, t2)</TT>, which takes + types as arguments, is represented internally as + <TT>__builtin_types_compatible_p(sizeof t1, sizeof t2)</TT>, but the + sizeofs are removed when printing.<BR> +<BR> +<LI CLASS="li-itemize">The implementation of <TT>bitsSizeOf</TT> does not take into account the +packing pragmas. However it was tested to be accurate on cygwin/gcc-2.95.3, +Linux/gcc-2.95.3 and on Windows/MSVC.<BR> +<BR> +<LI CLASS="li-itemize">We do not support tri-graph sequences (ISO 5.2.1.1).<BR> +<BR> +<LI CLASS="li-itemize">GCC has a strange feature called “extern inline”. Such a function can +be defined twice: first with the “extern inline” specifier and the second +time without it. If optimizations are turned off then the “extern inline” +definition is considered a prototype (its body is ignored). If optimizations +are turned on then the extern inline function is inlined at all of its +occurrences from the point of its definition all the way to the point where the +(optional) second definition appears. No body is generated for an extern +inline function. A body is generated for the real definition and that one is +used in the rest of the file. <BR> +<BR> +CIL will rename your extern inline function (and its uses) with the suffix + <TT>__extinline</TT>. This means that if you have two such definition, that do + different things and the optimizations are not on, then the CIL version might + compute a different answer !<BR> +<BR> +Also, if you have multiple extern inline declarations then CIL will ignore +but the first one. This is not so bad because GCC itself would not like it. <BR> +<BR> +<LI CLASS="li-itemize">There are still a number of bugs in handling some obscure features of +GCC. For example, when you use variable-length arrays, CIL turns them into +calls to <TT>alloca</TT>. This means that they are deallocated when the function +returns and not when the local scope ends. <BR> +<BR> +Variable-length arrays are not supported as fields of a struct or union.<BR> +<BR> +<LI CLASS="li-itemize">CIL cannot parse arbitrary <TT>#pragma</TT> directives. Their + syntax must follow gcc's attribute syntax to be understood. If you + need a pragma that does not follow gcc syntax, add that pragma's name + to <TT>no_parse_pragma</TT> in <TT>src/frontc/clexer.mll</TT> to indicate that + CIL should treat that pragma as a monolithic string rather than try + to parse its arguments.<BR> +<BR> +CIL cannot parse a line containing an empty <TT>#pragma</TT>.<BR> +<BR> +<LI CLASS="li-itemize">CIL only parses <TT>#pragma</TT> directives at the "top level", this is, + outside of any enum, structure, union, or function definitions.<BR> +<BR> +If your compiler uses pragmas in places other than the top-level, + you may have to preprocess the sources in a special way (sed, perl, + etc.) to remove pragmas from these locations.<BR> +<BR> +<LI CLASS="li-itemize">CIL cannot parse the following code (fixing this problem would require +extensive hacking of the LALR grammar): +<PRE CLASS="verbatim"><FONT COLOR=blue> +int bar(int ()); // This prototype cannot be parsed +int bar(int x()); // If you add a name to the function, it works +int bar(int (*)()); // This also works (and it is more appropriate) +</FONT></PRE><BR> +<BR> +<LI CLASS="li-itemize">CIL also cannot parse certain K&R old-style prototypes with missing +return type: +<PRE CLASS="verbatim"><FONT COLOR=blue> +g(); // This cannot be parsed +int g(); // This is Ok +</FONT></PRE><BR> +<BR> +<LI CLASS="li-itemize">CIL does not understand some obscure combinations of type specifiers +(“signed” and “unsigned” applied to typedefs that themselves contain a +sign specification; you could argue that this should not be allowed anyway): +<PRE CLASS="verbatim"><FONT COLOR=blue> +typedef signed char __s8; +__s8 unsigned uchartest; // This is unsigned char for gcc +</FONT></PRE><BR> +<BR> +<LI CLASS="li-itemize">The statement <TT>x = 3 + x ++</TT> will perform the increment of <TT>x</TT> + before the assignment, while <TT>gcc</TT> delays the increment after the + assignment. It turned out that this behavior is much easier to implement + than gcc's one, and either way is correct (since the behavior is unspecified + in this case). Similarly, if you write <TT>x = x ++;</TT> then CIL will perform + the increment before the assignment, whereas GCC and MSVC will perform it + after the assignment. +</UL> +<HR> +<A HREF="cil011.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="merger.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/cil015.html b/cil/doc/cil015.html new file mode 100644 index 0000000..a3dff7d --- /dev/null +++ b/cil/doc/cil015.html @@ -0,0 +1,60 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +Debugging support +</TITLE> +</HEAD> +<BODY > +<A HREF="patcher.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil016.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc41">15</A> Debugging support</H2><A NAME="sec-debugger"></A> +Most of the time we debug our code using the Errormsg module along with the +pretty printer. But if you want to use the Ocaml debugger here is an easy way +to do it. Say that you want to debug the invocation of cilly that arises out +of the following command: +<PRE CLASS="verbatim"> +cilly -c hello.c +</PRE> + You must follow the installation <A HREF="../ccured/setup.html">instructions</A> +to install the Elist support files for ocaml and to extend your .emacs +appropriately. Then from within Emacs you do +<PRE CLASS="verbatim"> +ALT-X my-camldebug +</PRE> + This will ask you for the command to use for running the Ocaml debugger +(initially the default will be “ocamldebug” or the last command you +introduced). You use the following command: +<PRE CLASS="verbatim"> +cilly --ocamldebug -c hello.c +</PRE> + This will run <TT>cilly</TT> as usual and invoke the Ocaml debugger when the cilly +engine starts. The advantage of this way of invoking the debugger is that the +directory search paths are set automatically and the right set or arguments is +passed to the debugger. <BR> +<BR> +<HR> +<A HREF="patcher.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil016.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/cil016.html b/cil/doc/cil016.html new file mode 100644 index 0000000..3191a9d --- /dev/null +++ b/cil/doc/cil016.html @@ -0,0 +1,342 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +Who Says C is Simple? +</TITLE> +</HEAD> +<BODY > +<A HREF="cil015.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil017.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc42">16</A> Who Says C is Simple?</H2><A NAME="sec-simplec"></A> +When I (George) started to write CIL I thought it was going to take two weeks. +Exactly a year has passed since then and I am still fixing bugs in it. This +gross underestimate was due to the fact that I thought parsing and making +sense of C is simple. You probably think the same. What I did not expect was +how many dark corners this language has, especially if you want to parse +real-world programs such as those written for GCC or if you are more ambitious +and you want to parse the Linux or Windows NT sources (both of these were +written without any respect for the standard and with the expectation that +compilers will be changed to accommodate the program). <BR> +<BR> +The following examples were actually encountered either in real programs or +are taken from the ISO C99 standard or from the GCC's testcases. My first +reaction when I saw these was: <EM>Is this C?</EM>. The second one was : <EM>What the hell does it mean?</EM>. <BR> +<BR> +If you are contemplating doing program analysis for C on abstract-syntax +trees then your analysis ought to be able to handle these things. Or, you can +use CIL and let CIL translate them into clean C code. <BR> +<BR> +<A NAME="toc24"></A> +<H3 CLASS="subsection"><A NAME="htoc43">16.1</A> Standard C</H3> +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">Why does the following code return 0 for most values of <TT>x</TT>? (This +should be easy.) +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x; + return x == (1 && x); +</FONT></PRE> +See the <A HREF="examples/ex30.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Why does the following code return 0 and not -1? (Answer: because +<TT>sizeof</TT> is unsigned, thus the result of the subtraction is unsigned, thus +the shift is logical.) +<PRE CLASS="verbatim"><FONT COLOR=blue> + return ((1 - sizeof(int)) >> 32); +</FONT></PRE> +See the <A HREF="examples/ex31.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Scoping rules can be tricky. This function returns 5. +<PRE CLASS="verbatim"><FONT COLOR=blue> +int x = 5; +int f() { + int x = 3; + { + extern int x; + return x; + } +} +</FONT></PRE> +See the <A HREF="examples/ex32.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Functions and function pointers are implicitly converted to each other. +<PRE CLASS="verbatim"><FONT COLOR=blue> +int (*pf)(void); +int f(void) { + + pf = &f; // This looks ok + pf = ***f; // Dereference a function? + pf(); // Invoke a function pointer? + (****pf)(); // Looks strange but Ok + (***************f)(); // Also Ok +} +</FONT></PRE> +See the <A HREF="examples/ex33.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Initializer with designators are one of the hardest parts about ISO C. +Neither MSVC or GCC implement them fully. GCC comes close though. What is the +final value of <TT>i.nested.y</TT> and <TT>i.nested.z</TT>? (Answer: 2 and respectively +6). +<PRE CLASS="verbatim"><FONT COLOR=blue> +struct { + int x; + struct { + int y, z; + } nested; +} i = { .nested.y = 5, 6, .x = 1, 2 }; +</FONT></PRE> +See the <A HREF="examples/ex34.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">This is from c-torture. This function returns 1. +<PRE CLASS="verbatim"><FONT COLOR=blue> +typedef struct +{ + char *key; + char *value; +} T1; + +typedef struct +{ + long type; + char *value; +} T3; + +T1 a[] = +{ + { + "", + ((char *)&((T3) {1, (char *) 1})) + } +}; +int main() { + T3 *pt3 = (T3*)a[0].value; + return pt3->value; +} +</FONT></PRE> +See the <A HREF="examples/ex35.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Another one with constructed literals. This one is legal according to +the GCC documentation but somehow GCC chokes on (it works in CIL though). This +code returns 2. +<PRE CLASS="verbatim"><FONT COLOR=blue> + return ((int []){1,2,3,4})[1]; +</FONT></PRE> +See the <A HREF="examples/ex36.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">In the example below there is one copy of “bar” and two copies of + “pbar” (static prototypes at block scope have file scope, while for all + other types they have block scope). +<PRE CLASS="verbatim"><FONT COLOR=blue> + int foo() { + static bar(); + static (*pbar)() = bar; + + } + + static bar() { + return 1; + } + + static (*pbar)() = 0; +</FONT></PRE> +See the <A HREF="examples/ex37.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Two years after heavy use of CIL, by us and others, I discovered a bug + in the parser. The return value of the following function depends on what + precedence you give to casts and unary minus: +<PRE CLASS="verbatim"><FONT COLOR=blue> + unsigned long foo() { + return (unsigned long) - 1 / 8; + } +</FONT></PRE> +See the <A HREF="examples/ex38.txt">CIL output</A> for this +code fragment<BR> +<BR> +The correct interpretation is <TT>((unsigned long) - 1) / 8</TT>, which is a + relatively large number, as opposed to <TT>(unsigned long) (- 1 / 8)</TT>, which + is 0. </OL> +<A NAME="toc25"></A> +<H3 CLASS="subsection"><A NAME="htoc44">16.2</A> GCC ugliness</H3><A NAME="sec-ugly-gcc"></A> +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">GCC has generalized lvalues. You can take the address of a lot of +strange things: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int x, y, z; + return &(x ? y : z) - & (x++, x); +</FONT></PRE> +See the <A HREF="examples/ex39.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">GCC lets you omit the second component of a conditional expression. +<PRE CLASS="verbatim"><FONT COLOR=blue> + extern int f(); + return f() ? : -1; // Returns the result of f unless it is 0 +</FONT></PRE> +See the <A HREF="examples/ex40.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">Computed jumps can be tricky. CIL compiles them away in a fairly clean +way but you are on your own if you try to jump into another function this way. +<PRE CLASS="verbatim"><FONT COLOR=blue> +static void *jtab[2]; // A jump table +static int doit(int x){ + + static int jtab_init = 0; + if(!jtab_init) { // Initialize the jump table + jtab[0] = &&lbl1; + jtab[1] = &&lbl2; + jtab_init = 1; + } + goto *jtab[x]; // Jump through the table +lbl1: + return 0; +lbl2: + return 1; +} + +int main(void){ + if (doit(0) != 0) exit(1); + if (doit(1) != 1) exit(1); + exit(0); +} +</FONT></PRE> +See the <A HREF="examples/ex41.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">A cute little example that we made up. What is the returned value? +(Answer: 1); +<PRE CLASS="verbatim"><FONT COLOR=blue> + return ({goto L; 0;}) && ({L: 5;}); +</FONT></PRE> +See the <A HREF="examples/ex42.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate"><TT>extern inline</TT> is a strange feature of GNU C. Can you guess what the +following code computes? +<PRE CLASS="verbatim"><FONT COLOR=blue> +extern inline foo(void) { return 1; } +int firstuse(void) { return foo(); } + +// A second, incompatible definition of foo +int foo(void) { return 2; } + +int main() { + return foo() + firstuse(); +} +</FONT></PRE> +See the <A HREF="examples/ex43.txt">CIL output</A> for this +code fragment<BR> +<BR> +The answer depends on whether the optimizations are turned on. If they are +then the answer is 3 (the first definition is inlined at all occurrences until +the second definition). If the optimizations are off, then the first +definition is ignore (treated like a prototype) and the answer is 4. <BR> +<BR> +CIL will misbehave on this example, if the optimizations are turned off (it + always returns 3).<BR> +<BR> +<LI CLASS="li-enumerate">GCC allows you to cast an object of a type T into a union as long as the +union has a field of that type: +<PRE CLASS="verbatim"><FONT COLOR=blue> +union u { + int i; + struct s { + int i1, i2; + } s; +}; + +union u x = (union u)6; + +int main() { + struct s y = {1, 2}; + union u z = (union u)y; +} +</FONT></PRE> +See the <A HREF="examples/ex44.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">GCC allows you to use the <TT>__mode__</TT> attribute to specify the size +of the integer instead of the standard <TT>char</TT>, <TT>short</TT> and so on: +<PRE CLASS="verbatim"><FONT COLOR=blue> +int __attribute__ ((__mode__ ( __QI__ ))) i8; +int __attribute__ ((__mode__ ( __HI__ ))) i16; +int __attribute__ ((__mode__ ( __SI__ ))) i32; +int __attribute__ ((__mode__ ( __DI__ ))) i64; +</FONT></PRE> +See the <A HREF="examples/ex45.txt">CIL output</A> for this +code fragment<BR> +<BR> +<LI CLASS="li-enumerate">The “alias” attribute on a function declaration tells the + linker to treat this declaration as another name for the specified + function. CIL will replace the declaration with a trampoline + function pointing to the specified target. +<PRE CLASS="verbatim"><FONT COLOR=blue> + static int bar(int x, char y) { + return x + y; + } + + //foo is considered another name for bar. + int foo(int x, char y) __attribute__((alias("bar"))); +</FONT></PRE> +See the <A HREF="examples/ex46.txt">CIL output</A> for this +code fragment</OL> +<A NAME="toc26"></A> +<H3 CLASS="subsection"><A NAME="htoc45">16.3</A> Microsoft VC ugliness</H3> +This compiler has few extensions, so there is not much to say here. +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> +Why does the following code return 0 and not -1? (Answer: because of a +bug in Microsoft Visual C. It thinks that the shift is unsigned just because +the second operator is unsigned. CIL reproduces this bug when in MSVC mode.) +<PRE CLASS="verbatim"><FONT COLOR=blue> + return -3 >> (8 * sizeof(int)); +</FONT></PRE><BR> +<BR> +<LI CLASS="li-enumerate">Unnamed fields in a structure seem really strange at first. It seems +that Microsoft Visual C introduced this extension, then GCC picked it up (but +in the process implemented it wrongly: in GCC the field <TT>y</TT> overlaps with +<TT>x</TT>!). +<PRE CLASS="verbatim"><FONT COLOR=blue> +struct { + int x; + struct { + int y, z; + struct { + int u, v; + }; + }; +} a; +return a.x + a.y + a.z + a.u + a.v; +</FONT></PRE> +See the <A HREF="examples/ex47.txt">CIL output</A> for this +code fragment</OL> +<HR> +<A HREF="cil015.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil017.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/cil017.html b/cil/doc/cil017.html new file mode 100644 index 0000000..a9e04eb --- /dev/null +++ b/cil/doc/cil017.html @@ -0,0 +1,53 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +Authors +</TITLE> +</HEAD> +<BODY > +<A HREF="cil016.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil018.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc46">17</A> Authors</H2> +The CIL parser was developed starting from Hugues Casse's <TT>frontc</TT> +front-end for C although all the files from the <TT>frontc</TT> distribution have +been changed very extensively. The intermediate language and the elaboration +stage are all written from scratch. The main author is +<A HREF="mailto:necula@cs.berkeley.edu">George Necula</A>, with significant +contributions from <A HREF="mailto:smcpeak@cs.berkeley.edu">Scott McPeak</A>, +<A HREF="mailto:weimer@cs.berkeley.edu">Westley Weimer</A>, +<A HREF="mailto:liblit@cs.wisc.edu">Ben Liblit</A>, +<A HREF="javascript:loadTop('http://www.cs.berkeley.edu/~matth/')">Matt Harren</A>, +Raymond To and Aman Bhargava.<BR> +<BR> +This work is based upon work supported in part by the National Science +Foundation under Grants No. 9875171, 0085949 and 0081588, and gifts from +Microsoft Research. Any opinions, findings, and conclusions or recommendations +expressed in this material are those of the author(s) and do not necessarily +reflect the views of the National Science Foundation or the other sponsors.<BR> +<BR> +<HR> +<A HREF="cil016.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil018.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/cil018.html b/cil/doc/cil018.html new file mode 100644 index 0000000..dc039ea --- /dev/null +++ b/cil/doc/cil018.html @@ -0,0 +1,71 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +License +</TITLE> +</HEAD> +<BODY > +<A HREF="cil017.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil019.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc47">18</A> License</H2> +Copyright (c) 2001-2005, +<UL CLASS="itemize"><LI CLASS="li-itemize"> +George C. Necula <necula@cs.berkeley.edu> +<LI CLASS="li-itemize">Scott McPeak <smcpeak@cs.berkeley.edu> +<LI CLASS="li-itemize">Wes Weimer <weimer@cs.berkeley.edu> +<LI CLASS="li-itemize">Ben Liblit <liblit@cs.wisc.edu> +</UL> +All rights reserved.<BR> +<BR> +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met:<BR> +<BR> +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer.<BR> +<BR> +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.<BR> +<BR> +3. The names of the contributors may not be used to endorse or promote +products derived from this software without specific prior written +permission.<BR> +<BR> +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.<BR> +<BR> +<HR> +<A HREF="cil017.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil019.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/cil019.html b/cil/doc/cil019.html new file mode 100644 index 0000000..84e3f8b --- /dev/null +++ b/cil/doc/cil019.html @@ -0,0 +1,45 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +Bug reports +</TITLE> +</HEAD> +<BODY > +<A HREF="cil018.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="changes.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc48">19</A> Bug reports</H2> +We are certain that there are still some remaining bugs in CIL. If you find +one please file a bug report in our Source Forge space +<A HREF="javascript:loadTop('http://sourceforge.net/projects/cil')">http://sourceforge.net/projects/cil</A>. <BR> +<BR> +You can find there the latest announcements, a source distribution, +bug report submission instructions and a mailing list: cil-users[at +sign]lists.sourceforge.net. Please use this list to ask questions about CIL, +as it will ensure your message is viewed by a broad audience. <BR> +<BR> +<HR> +<A HREF="cil018.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="changes.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/cilly.html b/cil/doc/cilly.html new file mode 100644 index 0000000..1a28758 --- /dev/null +++ b/cil/doc/cilly.html @@ -0,0 +1,187 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +How to Use CIL +</TITLE> +</HEAD> +<BODY > +<A HREF="cil004.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil006.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc5">5</A> How to Use CIL</H2><A NAME="sec-cil"></A><BR> +<BR> +There are two predominant ways to use CIL to write a program analysis or +transformation. The first is to phrase your analysis as a module that is +called by our existing driver. The second is to use CIL as a stand-alone +library. We highly recommend that you use <TT>cilly</TT>, our driver. <BR> +<BR> +<A NAME="toc1"></A> +<H3 CLASS="subsection"><A NAME="htoc6">5.1</A> Using <TT>cilly</TT>, the CIL driver</H3> +The most common way to use CIL is to write an Ocaml module containing your +analysis and transformation, which you then link into our boilerplate +driver application called <TT>cilly</TT>. <TT>cilly</TT> is a Perl script that +processes and mimics <TT>GCC</TT> and <TT>MSVC</TT> command-line arguments and then +calls <TT>cilly.byte.exe</TT> or <TT>cilly.asm.exe</TT> (CIL's Ocaml executable). <BR> +<BR> +An example of such module is <TT>logwrites.ml</TT>, a transformation that is +distributed with CIL and whose purpose is to instrument code to print the +addresses of memory locations being written. (We plan to release a +C-language interface to CIL so that you can write your analyses in C +instead of Ocaml.) See Section <A HREF="ext.html#sec-Extension">8</A> for a survey of other example +modules. <BR> +<BR> +Assuming that you have written <TT>/home/necula/logwrites.ml</TT>, +here is how you use it: +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">Modify <TT>logwrites.ml</TT> so that it includes a CIL “feature + descriptor” like this: +<PRE CLASS="verbatim"> +let feature : featureDescr = + { fd_name = "logwrites"; + fd_enabled = ref false; + fd_description = "generation of code to log memory writes"; + fd_extraopt = []; + fd_doit = + (function (f: file) -> + let lwVisitor = new logWriteVisitor in + visitCilFileSameGlobals lwVisitor f) + } +</PRE>The <TT>fd_name</TT> field names the feature and its associated + command-line arguments. The <TT>fd_enabled</TT> field is a <TT>bool ref</TT>. + “<TT>fd_doit</TT>” will be invoked if <TT>!fd_enabled</TT> is true after + argument parsing, so initialize the ref cell to true if you want + this feature to be enabled by default.<BR> +<BR> +When the user passes the <TT>--dologwrites</TT> + command-line option to <TT>cilly</TT>, the variable associated with the + <TT>fd_enabled</TT> flag is set and the <TT>fd_doit</TT> function is called + on the <TT>Cil.file</TT> that represents the merger (see Section <A HREF="merger.html#sec-merger">13</A>) of + all C files listed as arguments. <BR> +<BR> +<LI CLASS="li-enumerate">Invoke <TT>configure</TT> with the arguments +<PRE CLASS="verbatim"> +./configure EXTRASRCDIRS=/home/necula EXTRAFEATURES=logwrites +</PRE> + This step works if each feature is packaged into its own ML file, and the +name of the entry point in the file is <TT>feature</TT>.<BR> +<BR> +An alternative way to specify the new features is to change the build files +yourself, as explained below. You'll need to use this method if a single +feature is split across multiple files. +<OL CLASS="enumerate" type=a><LI CLASS="li-enumerate"> + Put <TT>logwrites.ml</TT> in the <TT>src</TT> or <TT>src/ext</TT> directory. This + will make sure that <TT>make</TT> can find it. If you want to put it in some + other directory, modify <TT>Makefile.in</TT> and add to <TT>SOURCEDIRS</TT> your + directory. Alternately, you can create a symlink from <TT>src</TT> or + <TT>src/ext</TT> to your file.<BR> +<BR> +<LI CLASS="li-enumerate">Modify the <TT>Makefile.in</TT> and add your module to the + <TT>CILLY_MODULES</TT> or + <TT>CILLY_LIBRARY_MODULES</TT> variables. The order of the modules matters. Add + your modules somewhere after <TT>cil</TT> and before <TT>main</TT>.<BR> +<BR> +<LI CLASS="li-enumerate">If you have any helper files for your module, add those to + the makefile in the same way. e.g.: +<PRE CLASS="verbatim"> +CILLY_MODULES = $(CILLY_LIBRARY_MODULES) \ + myutilities1 myutilities2 logwrites \ + main +</PRE> + Again, order is important: <TT>myutilities2.ml</TT> will be able to refer + to Myutilities1 but not Logwrites. If you have any ocamllex or ocamlyacc + files, add them to both <TT>CILLY_MODULES</TT> and either <TT>MLLS</TT> or + <TT>MLYS</TT>.<BR> +<BR> +<LI CLASS="li-enumerate">Modify <TT>main.ml</TT> so that your new feature descriptor appears in + the global list of CIL features. +<PRE CLASS="verbatim"> +let features : C.featureDescr list = + [ Logcalls.feature; + Oneret.feature; + Heapify.feature1; + Heapify.feature2; + makeCFGFeature; + Partial.feature; + Simplemem.feature; + Logwrites.feature; (* add this line to include the logwrites feature! *) + ] + @ Feature_config.features +</PRE> + Features are processed in the order they appear on this list. Put + your feature last on the list if you plan to run any of CIL's + built-in features (such as makeCFGfeature) before your own.</OL><BR> +Standard code in <TT>cilly</TT> takes care of adding command-line arguments, + printing the description, and calling your function automatically. + Note: do not worry about introducing new bugs into CIL by adding a single + line to the feature list. <BR> +<BR> +<LI CLASS="li-enumerate">Now you can invoke the <TT>cilly</TT> application on a preprocessed file, or + instead use the <TT>cilly</TT> driver which provides a convenient compiler-like + interface to <TT>cilly</TT>. See Section <A HREF="cil007.html#sec-driver">7</A> for details using <TT>cilly</TT>. + Remember to enable your analysis by passing the right argument (e.g., + <TT>--dologwrites</TT>). </OL> +<A NAME="toc2"></A> +<H3 CLASS="subsection"><A NAME="htoc7">5.2</A> Using CIL as a library</H3> +CIL can also be built as a library that is called from your stand-alone +application. Add <TT>cil/src</TT>, <TT>cil/src/frontc</TT>, <TT>cil/obj/x86_LINUX</TT> +(or <TT>cil/obj/x86_WIN32</TT>) to your Ocaml project <TT>-I</TT> include paths. +Building CIL will also build the library <TT>cil/obj/*/cil.cma</TT> (or +<TT>cil/obj/*/cil.cmxa</TT>). You can then link your application against that +library. <BR> +<BR> +You can call the <TT>Frontc.parse: string -> unit -> Cil.file</TT> function with +the name of a file containing the output of the C preprocessor. +The <TT>Mergecil.merge: Cil.file list -> string -> Cil.file</TT> function merges +multiple files. You can then invoke your analysis function on the resulting +<TT>Cil.file</TT> data structure. You might want to call +<TT>Rmtmps.removeUnusedTemps</TT> first to clean up the prototypes and variables +that are not used. Then you can call the function <TT>Cil.dumpFile: +cilPrinter -> out_channel -> Cil.file -> unit</TT> to print the file to a +given output channel. A good <TT>cilPrinter</TT> to use is +<TT>defaultCilPrinter</TT>. <BR> +<BR> +Check out <TT>src/main.ml</TT> and <TT>bin/cilly</TT> for other good ideas +about high-level file processing. Again, we highly recommend that you just +our <TT>cilly</TT> driver so that you can avoid spending time re-inventing the +wheel to provide drop-in support for standard <TT>makefile</TT>s. <BR> +<BR> +Here is a concrete example of compiling and linking your project against +CIL. Imagine that your program analysis or transformation is contained in +the single file <TT>main.ml</TT>. +<PRE CLASS="verbatim"> +$ ocamlopt -c -I $(CIL)/obj/x86_LINUX/ main.ml +$ ocamlopt -ccopt -L$(CIL)/obj/x86_LINUX/ -o main unix.cmxa str.cmxa \ + $(CIL)/obj/x86_LINUX/cil.cmxa main.cmx +</PRE> +The first line compiles your analysis, the second line links it against CIL +(as a library) and the Ocaml Unix library. For more information about +compiling and linking Ocaml programs, see the Ocaml home page +at <A HREF="javascript:loadTop('http://caml.inria.fr/ocaml/')">http://caml.inria.fr/ocaml/</A>. <BR> +<BR> +In the next section we give an overview of the API that you can use +to write your analysis and transformation. <BR> +<BR> +<HR> +<A HREF="cil004.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil006.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/cilpp.haux b/cil/doc/cilpp.haux new file mode 100644 index 0000000..1b9fa16 --- /dev/null +++ b/cil/doc/cilpp.haux @@ -0,0 +1,64 @@ +\@addtocsec{htoc}{1}{0}{\@print{1}\quad{}Introduction} +\@addtocsec{htoc}{2}{0}{\@print{2}\quad{}Installation} +\@addtocsec{htoc}{3}{0}{\@print{3}\quad{}Distribution Contents} +\@addtocsec{htoc}{4}{0}{\@print{4}\quad{}Compiling C to CIL} +\newlabel{sec-cabs2cil}{{4}{X}} +\@addtocsec{htoc}{5}{0}{\@print{5}\quad{}How to Use CIL} +\newlabel{sec-cil}{{5}{X}} +\@addtocsec{htoc}{6}{1}{\@print{5.1}\quad{}Using \t{cilly}, the CIL driver} +\@addtocsec{htoc}{7}{1}{\@print{5.2}\quad{}Using CIL as a library} +\@addtocsec{htoc}{8}{0}{\@print{6}\quad{}CIL API Documentation} +\newlabel{sec-api}{{6}{X}} +\@addtocsec{htoc}{9}{1}{\@print{6.1}\quad{}Using the visitor} +\newlabel{sec-visitor}{{6.1}{X}} +\@addtocsec{htoc}{10}{1}{\@print{6.2}\quad{}Interpreted Constructors and Deconstructors} +\@addtocsec{htoc}{11}{2}{\@print{6.2.1}\quad{}Performance considerations for interpreted constructors} +\@addtocsec{htoc}{12}{1}{\@print{6.3}\quad{}Printing and Debugging support} +\@addtocsec{htoc}{13}{1}{\@print{6.4}\quad{}Attributes} +\newlabel{sec-attrib}{{6.4}{X}} +\@addtocsec{htoc}{14}{0}{\@print{7}\quad{}The CIL Driver} +\newlabel{sec-driver}{{7}{X}} +\@addtocsec{htoc}{15}{1}{\@print{7.1}\quad{}\t{cilly} Options} +\@addtocsec{htoc}{16}{1}{\@print{7.2}\quad{}\t{cilly.asm} Options} +\newlabel{sec-cilly-asm-options}{{7.2}{X}} +\@addtocsec{htoc}{17}{0}{\@print{8}\quad{}Library of CIL Modules} +\newlabel{sec-Extension}{{8}{X}} +\@addtocsec{htoc}{18}{1}{\@print{8.1}\quad{}Control-Flow Graphs} +\newlabel{sec-cfg}{{8.1}{X}} +\@addtocsec{htoc}{19}{2}{\@print{8.1.1}\quad{}The CFG module (new in CIL 1.3.5)} +\@addtocsec{htoc}{20}{2}{\@print{8.1.2}\quad{}Simplified control flow} +\@addtocsec{htoc}{21}{1}{\@print{8.2}\quad{}Data flow analysis framework} +\@addtocsec{htoc}{22}{1}{\@print{8.3}\quad{}Dominators} +\@addtocsec{htoc}{23}{1}{\@print{8.4}\quad{}Points-to Analysis} +\@addtocsec{htoc}{24}{1}{\@print{8.5}\quad{}StackGuard} +\@addtocsec{htoc}{25}{1}{\@print{8.6}\quad{}Heapify} +\@addtocsec{htoc}{26}{1}{\@print{8.7}\quad{}One Return} +\@addtocsec{htoc}{27}{1}{\@print{8.8}\quad{}Partial Evaluation and Constant Folding} +\@addtocsec{htoc}{28}{1}{\@print{8.9}\quad{}Reaching Definitions} +\@addtocsec{htoc}{29}{1}{\@print{8.10}\quad{}Available Expressions} +\@addtocsec{htoc}{30}{1}{\@print{8.11}\quad{}Liveness Analysis} +\@addtocsec{htoc}{31}{1}{\@print{8.12}\quad{}Dead Code Elimination} +\@addtocsec{htoc}{32}{1}{\@print{8.13}\quad{}Simple Memory Operations} +\@addtocsec{htoc}{33}{1}{\@print{8.14}\quad{}Simple Three-Address Code} +\@addtocsec{htoc}{34}{1}{\@print{8.15}\quad{}Converting C to C++} +\@addtocsec{htoc}{35}{0}{\@print{9}\quad{}Controlling CIL} +\@addtocsec{htoc}{36}{0}{\@print{10}\quad{}GCC Extensions} +\@addtocsec{htoc}{37}{0}{\@print{11}\quad{}CIL Limitations} +\@addtocsec{htoc}{38}{0}{\@print{12}\quad{}Known Bugs and Limitations} +\@addtocsec{htoc}{39}{0}{\@print{13}\quad{}Using the merger} +\newlabel{sec-merger}{{13}{X}} +\@addtocsec{htoc}{40}{0}{\@print{14}\quad{}Using the patcher} +\newlabel{sec-patcher}{{14}{X}} +\@addtocsec{htoc}{41}{0}{\@print{15}\quad{}Debugging support} +\newlabel{sec-debugger}{{15}{X}} +\@addtocsec{htoc}{42}{0}{\@print{16}\quad{}Who Says C is Simple?} +\newlabel{sec-simplec}{{16}{X}} +\@addtocsec{htoc}{43}{1}{\@print{16.1}\quad{}Standard C} +\@addtocsec{htoc}{44}{1}{\@print{16.2}\quad{}GCC ugliness} +\newlabel{sec-ugly-gcc}{{16.2}{X}} +\@addtocsec{htoc}{45}{1}{\@print{16.3}\quad{}Microsoft VC ugliness} +\@addtocsec{htoc}{46}{0}{\@print{17}\quad{}Authors} +\@addtocsec{htoc}{47}{0}{\@print{18}\quad{}License} +\@addtocsec{htoc}{48}{0}{\@print{19}\quad{}Bug reports} +\@addtocsec{htoc}{49}{0}{\@print{20}\quad{}Changes} +\newlabel{sec-changes}{{20}{X}} diff --git a/cil/doc/cilpp.htoc b/cil/doc/cilpp.htoc new file mode 100644 index 0000000..d5bc0e5 --- /dev/null +++ b/cil/doc/cilpp.htoc @@ -0,0 +1,65 @@ +\begin{tocenv} +\tocitem \@locref{htoc1}{\begin{@norefs}\@print{1}\quad{}Introduction\end{@norefs}} +\tocitem \@locref{htoc2}{\begin{@norefs}\@print{2}\quad{}Installation\end{@norefs}} +\tocitem \@locref{htoc3}{\begin{@norefs}\@print{3}\quad{}Distribution Contents\end{@norefs}} +\tocitem \@locref{htoc4}{\begin{@norefs}\@print{4}\quad{}Compiling C to CIL\end{@norefs}} +\tocitem \@locref{htoc5}{\begin{@norefs}\@print{5}\quad{}How to Use CIL\end{@norefs}} +\begin{tocenv} +\tocitem \@locref{htoc6}{\begin{@norefs}\@print{5.1}\quad{}Using \t{cilly}, the CIL driver\end{@norefs}} +\tocitem \@locref{htoc7}{\begin{@norefs}\@print{5.2}\quad{}Using CIL as a library\end{@norefs}} +\end{tocenv} +\tocitem \@locref{htoc8}{\begin{@norefs}\@print{6}\quad{}CIL API Documentation\end{@norefs}} +\begin{tocenv} +\tocitem \@locref{htoc9}{\begin{@norefs}\@print{6.1}\quad{}Using the visitor\end{@norefs}} +\tocitem \@locref{htoc10}{\begin{@norefs}\@print{6.2}\quad{}Interpreted Constructors and Deconstructors\end{@norefs}} +\begin{tocenv} +\tocitem \@locref{htoc11}{\begin{@norefs}\@print{6.2.1}\quad{}Performance considerations for interpreted constructors\end{@norefs}} +\end{tocenv} +\tocitem \@locref{htoc12}{\begin{@norefs}\@print{6.3}\quad{}Printing and Debugging support\end{@norefs}} +\tocitem \@locref{htoc13}{\begin{@norefs}\@print{6.4}\quad{}Attributes\end{@norefs}} +\end{tocenv} +\tocitem \@locref{htoc14}{\begin{@norefs}\@print{7}\quad{}The CIL Driver\end{@norefs}} +\begin{tocenv} +\tocitem \@locref{htoc15}{\begin{@norefs}\@print{7.1}\quad{}\t{cilly} Options\end{@norefs}} +\tocitem \@locref{htoc16}{\begin{@norefs}\@print{7.2}\quad{}\t{cilly.asm} Options\end{@norefs}} +\end{tocenv} +\tocitem \@locref{htoc17}{\begin{@norefs}\@print{8}\quad{}Library of CIL Modules\end{@norefs}} +\begin{tocenv} +\tocitem \@locref{htoc18}{\begin{@norefs}\@print{8.1}\quad{}Control-Flow Graphs\end{@norefs}} +\begin{tocenv} +\tocitem \@locref{htoc19}{\begin{@norefs}\@print{8.1.1}\quad{}The CFG module (new in CIL 1.3.5)\end{@norefs}} +\tocitem \@locref{htoc20}{\begin{@norefs}\@print{8.1.2}\quad{}Simplified control flow\end{@norefs}} +\end{tocenv} +\tocitem \@locref{htoc21}{\begin{@norefs}\@print{8.2}\quad{}Data flow analysis framework\end{@norefs}} +\tocitem \@locref{htoc22}{\begin{@norefs}\@print{8.3}\quad{}Dominators\end{@norefs}} +\tocitem \@locref{htoc23}{\begin{@norefs}\@print{8.4}\quad{}Points-to Analysis\end{@norefs}} +\tocitem \@locref{htoc24}{\begin{@norefs}\@print{8.5}\quad{}StackGuard\end{@norefs}} +\tocitem \@locref{htoc25}{\begin{@norefs}\@print{8.6}\quad{}Heapify\end{@norefs}} +\tocitem \@locref{htoc26}{\begin{@norefs}\@print{8.7}\quad{}One Return\end{@norefs}} +\tocitem \@locref{htoc27}{\begin{@norefs}\@print{8.8}\quad{}Partial Evaluation and Constant Folding\end{@norefs}} +\tocitem \@locref{htoc28}{\begin{@norefs}\@print{8.9}\quad{}Reaching Definitions\end{@norefs}} +\tocitem \@locref{htoc29}{\begin{@norefs}\@print{8.10}\quad{}Available Expressions\end{@norefs}} +\tocitem \@locref{htoc30}{\begin{@norefs}\@print{8.11}\quad{}Liveness Analysis\end{@norefs}} +\tocitem \@locref{htoc31}{\begin{@norefs}\@print{8.12}\quad{}Dead Code Elimination\end{@norefs}} +\tocitem \@locref{htoc32}{\begin{@norefs}\@print{8.13}\quad{}Simple Memory Operations\end{@norefs}} +\tocitem \@locref{htoc33}{\begin{@norefs}\@print{8.14}\quad{}Simple Three-Address Code\end{@norefs}} +\tocitem \@locref{htoc34}{\begin{@norefs}\@print{8.15}\quad{}Converting C to C++\end{@norefs}} +\end{tocenv} +\tocitem \@locref{htoc35}{\begin{@norefs}\@print{9}\quad{}Controlling CIL\end{@norefs}} +\tocitem \@locref{htoc36}{\begin{@norefs}\@print{10}\quad{}GCC Extensions\end{@norefs}} +\tocitem \@locref{htoc37}{\begin{@norefs}\@print{11}\quad{}CIL Limitations\end{@norefs}} +\tocitem \@locref{htoc38}{\begin{@norefs}\@print{12}\quad{}Known Bugs and Limitations\end{@norefs}} +\tocitem \@locref{htoc39}{\begin{@norefs}\@print{13}\quad{}Using the merger\end{@norefs}} +\tocitem \@locref{htoc40}{\begin{@norefs}\@print{14}\quad{}Using the patcher\end{@norefs}} +\tocitem \@locref{htoc41}{\begin{@norefs}\@print{15}\quad{}Debugging support\end{@norefs}} +\tocitem \@locref{htoc42}{\begin{@norefs}\@print{16}\quad{}Who Says C is Simple?\end{@norefs}} +\begin{tocenv} +\tocitem \@locref{htoc43}{\begin{@norefs}\@print{16.1}\quad{}Standard C\end{@norefs}} +\tocitem \@locref{htoc44}{\begin{@norefs}\@print{16.2}\quad{}GCC ugliness\end{@norefs}} +\tocitem \@locref{htoc45}{\begin{@norefs}\@print{16.3}\quad{}Microsoft VC ugliness\end{@norefs}} +\end{tocenv} +\tocitem \@locref{htoc46}{\begin{@norefs}\@print{17}\quad{}Authors\end{@norefs}} +\tocitem \@locref{htoc47}{\begin{@norefs}\@print{18}\quad{}License\end{@norefs}} +\tocitem \@locref{htoc48}{\begin{@norefs}\@print{19}\quad{}Bug reports\end{@norefs}} +\tocitem \@locref{htoc49}{\begin{@norefs}\@print{20}\quad{}Changes\end{@norefs}} +\end{tocenv} diff --git a/cil/doc/ciltoc.html b/cil/doc/ciltoc.html new file mode 100644 index 0000000..7fe4c80 --- /dev/null +++ b/cil/doc/ciltoc.html @@ -0,0 +1,92 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> + +<HEAD> + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +</HEAD> + +<BODY > +<!--HEVEA command line is: /usr/bin/hevea -exec xxdate.exe ../../cilpp --> +<!--HACHA command line is: /usr/bin/hacha -o ciltoc.html cil.html --> + + + +<TABLE CLASS="title"> +<TR><TD></TD> +</TR></TABLE><BR> +<UL> +<LI><A HREF="cil001.html">Introduction</A> +<LI><A HREF="cil002.html">Installation</A> +<LI><A HREF="cil003.html">Distribution Contents</A> +<LI><A HREF="cil004.html">Compiling C to CIL</A> +<LI><A HREF="cilly.html">How to Use CIL</A> +<UL> +<LI><A HREF="cilly.html#toc1">Using <TT>cilly</TT>, the CIL driver</A> +<LI><A HREF="cilly.html#toc2">Using CIL as a library</A> +</UL> +<LI><A HREF="cil006.html">CIL API Documentation</A> +<UL> +<LI><A HREF="cil006.html#toc3">Using the visitor</A> +<LI><A HREF="cil006.html#toc4">Interpreted Constructors and Deconstructors</A> +<LI><A HREF="cil006.html#toc5">Printing and Debugging support</A> +<LI><A HREF="cil006.html#toc6">Attributes</A> +</UL> +<LI><A HREF="cil007.html">The CIL Driver</A> +<UL> +<LI><A HREF="cil007.html#toc7"><TT>cilly</TT> Options</A> +<LI><A HREF="cil007.html#toc8"><TT>cilly.asm</TT> Options</A> +</UL> +<LI><A HREF="ext.html">Library of CIL Modules</A> +<UL> +<LI><A HREF="ext.html#toc9">Control-Flow Graphs</A> +<LI><A HREF="ext.html#toc10">Data flow analysis framework</A> +<LI><A HREF="ext.html#toc11">Dominators</A> +<LI><A HREF="ext.html#toc12">Points-to Analysis</A> +<LI><A HREF="ext.html#toc13">StackGuard</A> +<LI><A HREF="ext.html#toc14">Heapify</A> +<LI><A HREF="ext.html#toc15">One Return</A> +<LI><A HREF="ext.html#toc16">Partial Evaluation and Constant Folding</A> +<LI><A HREF="ext.html#toc17">Reaching Definitions</A> +<LI><A HREF="ext.html#toc18">Available Expressions</A> +<LI><A HREF="ext.html#toc19">Liveness Analysis</A> +<LI><A HREF="ext.html#toc20">Dead Code Elimination</A> +<LI><A HREF="ext.html#toc21">Simple Memory Operations</A> +<LI><A HREF="ext.html#toc22">Simple Three-Address Code</A> +<LI><A HREF="ext.html#toc23">Converting C to C++</A> +</UL> +<LI><A HREF="cil009.html">Controlling CIL</A> +<LI><A HREF="cil010.html">GCC Extensions</A> +<LI><A HREF="cil011.html">CIL Limitations</A> +<LI><A HREF="cil012.html">Known Bugs and Limitations</A> +<LI><A HREF="merger.html">Using the merger</A> +<LI><A HREF="patcher.html">Using the patcher</A> +<LI><A HREF="cil015.html">Debugging support</A> +<LI><A HREF="cil016.html">Who Says C is Simple?</A> +<UL> +<LI><A HREF="cil016.html#toc24">Standard C</A> +<LI><A HREF="cil016.html#toc25">GCC ugliness</A> +<LI><A HREF="cil016.html#toc26">Microsoft VC ugliness</A> +</UL> +<LI><A HREF="cil017.html">Authors</A> +<LI><A HREF="cil018.html">License</A> +<LI><A HREF="cil019.html">Bug reports</A> +<LI><A HREF="changes.html">Changes</A> +</UL> +<!--FOOTER--> +<HR SIZE=2><BLOCKQUOTE CLASS="quote"><EM>This document was translated from L<sup>A</sup>T<sub>E</sub>X by +</EM><A HREF="http://pauillac.inria.fr/~maranget/hevea/index.html"><EM>H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A</EM></A><EM>.</EM></BLOCKQUOTE></BODY> +</HTML> diff --git a/cil/doc/contents_motif.gif b/cil/doc/contents_motif.gif Binary files differnew file mode 100644 index 0000000..5d3d016 --- /dev/null +++ b/cil/doc/contents_motif.gif diff --git a/cil/doc/examples/ex1.txt b/cil/doc/examples/ex1.txt new file mode 100644 index 0000000..2fe6c21 --- /dev/null +++ b/cil/doc/examples/ex1.txt @@ -0,0 +1,16 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex1.c" +long x ; +#line 3 "cilcode.tmp/ex1.c" +static long long y ; +#line 6 "cilcode.tmp/ex1.c" +int main(void) +{ + + { +#line 6 + return ((int )((long long )x + y)); +} +} diff --git a/cil/doc/examples/ex10.txt b/cil/doc/examples/ex10.txt new file mode 100644 index 0000000..7213b4c --- /dev/null +++ b/cil/doc/examples/ex10.txt @@ -0,0 +1,10 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex10.c" +char foo[13] = +#line 1 + { (char )'f', (char )'o', (char )'o', (char )' ', + (char )'p', (char )'l', (char )'u', (char )'s', + (char )' ', (char )'b', (char )'a', (char )'r', + (char )'\000'}; diff --git a/cil/doc/examples/ex11.txt b/cil/doc/examples/ex11.txt new file mode 100644 index 0000000..683df51 --- /dev/null +++ b/cil/doc/examples/ex11.txt @@ -0,0 +1,5 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex11.c" +char *foo = (char *)"foo plus bar "; diff --git a/cil/doc/examples/ex12.txt b/cil/doc/examples/ex12.txt new file mode 100644 index 0000000..d04d83d --- /dev/null +++ b/cil/doc/examples/ex12.txt @@ -0,0 +1,32 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 2 "cilcode.tmp/ex12.c" +struct foo { + int f1 ; + int f2 ; +}; +#line 1 "cilcode.tmp/ex12.c" +int main(void) +{ int x ; + struct foo a[3] ; + + { +#line 1 + x = 5; +#line 2 + a[0].f1 = 1; +#line 2 + a[0].f2 = 2; +#line 2 + a[1].f1 = 3; +#line 2 + a[1].f2 = 4; +#line 2 + a[2].f1 = 5; +#line 2 + a[2].f2 = 0; +#line 3 + return (0); +} +} diff --git a/cil/doc/examples/ex13.txt b/cil/doc/examples/ex13.txt new file mode 100644 index 0000000..6486ad6 --- /dev/null +++ b/cil/doc/examples/ex13.txt @@ -0,0 +1,21 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex13.c" +int x = 5; +#line 2 "cilcode.tmp/ex13.c" +int main(void) +{ int x___0 ; + int x___1 ; + + { +#line 3 + x___0 = 6; +#line 5 + x___1 = 7; +#line 6 + return (x___1); +#line 8 + return (x___0); +} +} diff --git a/cil/doc/examples/ex14.txt b/cil/doc/examples/ex14.txt new file mode 100644 index 0000000..72fc719 --- /dev/null +++ b/cil/doc/examples/ex14.txt @@ -0,0 +1,22 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex14.c" +int x = 5; +#line 5 +int main(void) ; +#line 5 "cilcode.tmp/ex14.c" +static int x___1 = 7; +#line 2 "cilcode.tmp/ex14.c" +int main(void) +{ int x___0 ; + + { +#line 3 + x___0 = 6; +#line 6 + return (x___1); +#line 8 + return (x___0); +} +} diff --git a/cil/doc/examples/ex15.txt b/cil/doc/examples/ex15.txt new file mode 100644 index 0000000..4f64ae9 --- /dev/null +++ b/cil/doc/examples/ex15.txt @@ -0,0 +1,14 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex15.c" +int foo(void) +{ int x ; + + { +#line 2 + x = 5; +#line 3 + return (0); +} +} diff --git a/cil/doc/examples/ex16.txt b/cil/doc/examples/ex16.txt new file mode 100644 index 0000000..82290c2 --- /dev/null +++ b/cil/doc/examples/ex16.txt @@ -0,0 +1,22 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex16.c" +extern int f(int ) ; +#line 1 "cilcode.tmp/ex16.c" +int main(void) +{ int x ; + int tmp ; + int tmp___0 ; + + { +#line 2 + tmp = x; +#line 2 + x ++; +#line 2 + tmp___0 = f(x); +#line 2 + return (tmp + tmp___0); +} +} diff --git a/cil/doc/examples/ex17.txt b/cil/doc/examples/ex17.txt new file mode 100644 index 0000000..20bbaa7 --- /dev/null +++ b/cil/doc/examples/ex17.txt @@ -0,0 +1,81 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex17.c" +int main(void) +{ int x ; + int y ; + int tmp ; + int z ; + int tmp___0 ; + + { +#line 2 + if (x) { +#line 2 + tmp = 2; + } else { +#line 2 + tmp = 4; + } +#line 2 + y = tmp; +#line 3 + if (x) { +#line 3 + tmp___0 = 1; + } else { +#line 3 + if (y) { +#line 3 + tmp___0 = 1; + } else { +#line 3 + tmp___0 = 0; + } + } +#line 3 + z = tmp___0; +#line 5 + if (x) { +#line 5 + if (y) { +#line 5 + return (0); + } else { +#line 5 + return (1); + } + } else { +#line 5 + return (1); + } +#line 8 + if (x) { +#line 8 + if (y) { + goto _L; + } else { + goto _L___0; + } + } else { + _L___0: /* CIL Label */ +#line 8 + if (z) { + _L: /* CIL Label */ +#line 8 + x ++; +#line 8 + y ++; +#line 8 + z ++; +#line 8 + x ++; +#line 8 + y ++; +#line 8 + return (z); + } + } +} +} diff --git a/cil/doc/examples/ex18.txt b/cil/doc/examples/ex18.txt new file mode 100644 index 0000000..bcdb7ef --- /dev/null +++ b/cil/doc/examples/ex18.txt @@ -0,0 +1,20 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex18.c" +extern int f() ; +#line 1 "cilcode.tmp/ex18.c" +int main(void) +{ int tmp___0 ; + + { +#line 2 + tmp___0 = f(); + if (! tmp___0) { +#line 2 + tmp___0 = 4; + } +#line 2 + return (tmp___0); +} +} diff --git a/cil/doc/examples/ex19.txt b/cil/doc/examples/ex19.txt new file mode 100644 index 0000000..3b82868 --- /dev/null +++ b/cil/doc/examples/ex19.txt @@ -0,0 +1,42 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex19.c" +int main(void) +{ int x ; + int i ; + + { +#line 2 + i = 0; +#line 2 + while (i < 5) { +#line 3 + if (i == 5) { + goto __Cont; + } +#line 4 + if (i == 4) { +#line 4 + break; + } +#line 5 + i += 2; + __Cont: /* CIL Label */ +#line 2 + i ++; + } +#line 7 + while (x < 5) { +#line 8 + if (x == 3) { +#line 8 + continue; + } +#line 9 + x ++; + } +#line 11 + return (0); +} +} diff --git a/cil/doc/examples/ex2.txt b/cil/doc/examples/ex2.txt new file mode 100644 index 0000000..2031382 --- /dev/null +++ b/cil/doc/examples/ex2.txt @@ -0,0 +1,9 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex2.c" +struct __anonstruct_s_1 { + int x ; +}; +#line 1 "cilcode.tmp/ex2.c" +struct __anonstruct_s_1 s ; diff --git a/cil/doc/examples/ex20.txt b/cil/doc/examples/ex20.txt new file mode 100644 index 0000000..7a51db3 --- /dev/null +++ b/cil/doc/examples/ex20.txt @@ -0,0 +1,26 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex20.c" +int main(void) +{ int x ; + int y ; + int z ; + + { +#line 1 + x = 5; +#line 1 + y = x; +#line 2 + x ++; + L: +#line 2 + y -= x; +#line 2 + z = y; + goto L; +#line 3 + return (0); +} +} diff --git a/cil/doc/examples/ex21.txt b/cil/doc/examples/ex21.txt new file mode 100644 index 0000000..3f331e4 --- /dev/null +++ b/cil/doc/examples/ex21.txt @@ -0,0 +1,25 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex21.c" +int main(void) +{ int x ; + int y ; + int z ; + int *tmp ; + + { +#line 2 + if (x) { +#line 2 + tmp = & y; + } else { +#line 2 + tmp = & z; + } +#line 2 + x ++; +#line 2 + return (tmp - & x); +} +} diff --git a/cil/doc/examples/ex22.txt b/cil/doc/examples/ex22.txt new file mode 100644 index 0000000..2224e7c --- /dev/null +++ b/cil/doc/examples/ex22.txt @@ -0,0 +1,16 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 327 "/usr/include/stdio.h" +extern int printf(char const * __restrict __format , ...) ; +#line 7 "cilcode.tmp/ex22.c" +int main(void) +{ + + { +#line 9 + printf((char const * __restrict )"Hello world\n"); +#line 10 + return (0); +} +} diff --git a/cil/doc/examples/ex23.txt b/cil/doc/examples/ex23.txt new file mode 100644 index 0000000..d48a135 --- /dev/null +++ b/cil/doc/examples/ex23.txt @@ -0,0 +1,56 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex23.c" +int foo(int predicate ) +{ int x ; + + { +#line 2 + x = 0; +#line 4 + if (predicate == 0) { + goto switch_0_0; + } else { +#line 5 + if (predicate == 1) { + goto switch_0_1; + } else { +#line 6 + if (predicate == 2) { + goto switch_0_2; + } else { +#line 7 + if (predicate == 3) { + goto switch_0_3; + } else { + { + goto switch_0_default; +#line 3 + if (0) { + switch_0_0: /* CIL Label */ +#line 4 + return (111); + switch_0_1: /* CIL Label */ +#line 5 + x ++; + switch_0_2: /* CIL Label */ +#line 6 + return (x + 3); + switch_0_3: /* CIL Label */ + goto switch_0_break; + switch_0_default: /* CIL Label */ ; +#line 8 + return (222); + } else { + switch_0_break: /* CIL Label */ ; + } + } + } + } + } + } +#line 10 + return (333); +} +} diff --git a/cil/doc/examples/ex24.txt b/cil/doc/examples/ex24.txt new file mode 100644 index 0000000..587ce67 --- /dev/null +++ b/cil/doc/examples/ex24.txt @@ -0,0 +1,59 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +extern void * stackguard_get_ra(); +extern void stackguard_set_ra(void *new_ra); +/* You must provide an implementation for functions that get and set the + * return address. Such code is unfortunately architecture specific. + */ +struct stackguard_stack { + void * data; + struct stackguard_stack * next; +} * stackguard_stack; + +void stackguard_push(void *ra) { + void * old = stackguard_stack; + stackguard_stack = (struct stackguard_stack *) + malloc(sizeof(stackguard_stack)); + stackguard_stack->data = ra; + stackguard_stack->next = old; +} + +void * stackguard_pop() { + void * ret = stackguard_stack->data; + void * next = stackguard_stack->next; + free(stackguard_stack); + stackguard_stack->next = next; + return ret; +} +#line 3 "cilcode.tmp/ex24.c" +extern int ( /* missing proto */ scanf)() ; +#line 1 "cilcode.tmp/ex24.c" +int dangerous(void) +{ char array[10] ; + void *return_address ; + + { + return_address = (void *)stackguard_get_ra(); + stackguard_push(return_address); +#line 3 + scanf("%s", array); + { + return_address = (void *)stackguard_pop(); + stackguard_set_ra(return_address); +#line 4 + return (0); + } +} +} +#line 6 "cilcode.tmp/ex24.c" +int main(void) +{ int tmp ; + + { +#line 7 + tmp = dangerous(); +#line 7 + return (tmp); +} +} diff --git a/cil/doc/examples/ex25.txt b/cil/doc/examples/ex25.txt new file mode 100644 index 0000000..88f6902 --- /dev/null +++ b/cil/doc/examples/ex25.txt @@ -0,0 +1,40 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 3 "cilcode.tmp/ex25.c" +extern int ( /* missing proto */ scanf)() ; +#line 1 "cilcode.tmp/ex25.c" +struct dangerous_heapify { + char array[10] ; +}; +#line 1 "cilcode.tmp/ex25.c" +int dangerous(void) +{ struct dangerous_heapify *dangerous_heapify ; + int __cil_tmp3 ; + + { +#line 1 + dangerous_heapify = (struct dangerous_heapify *)malloc(sizeof(struct dangerous_heapify )); +#line 3 + scanf("%s", dangerous_heapify->array); + { +#line 4 + __cil_tmp3 = 0; +#line 4 + free(dangerous_heapify); +#line 4 + return (__cil_tmp3); + } +} +} +#line 6 "cilcode.tmp/ex25.c" +int main(void) +{ int tmp ; + + { +#line 7 + tmp = dangerous(); +#line 7 + return (tmp); +} +} diff --git a/cil/doc/examples/ex26.txt b/cil/doc/examples/ex26.txt new file mode 100644 index 0000000..8f5b171 --- /dev/null +++ b/cil/doc/examples/ex26.txt @@ -0,0 +1,29 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex26.c" +int foo(int predicate ) +{ int __retres ; + + { +#line 2 + if (predicate <= 0) { +#line 3 + __retres = 1; + goto return_label; + } else { +#line 5 + if (predicate > 5) { +#line 6 + __retres = 2; + goto return_label; + } +#line 7 + __retres = 3; + goto return_label; + } + return_label: /* CIL Label */ +#line 1 + return (__retres); +} +} diff --git a/cil/doc/examples/ex27.txt b/cil/doc/examples/ex27.txt new file mode 100644 index 0000000..6059113 --- /dev/null +++ b/cil/doc/examples/ex27.txt @@ -0,0 +1,51 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex27.c" +int foo(int x , int y ) +{ int unknown ; + + { +#line 3 + if (unknown) { +#line 4 + return (9); + } +#line 5 + return (x + 3); +} +} +#line 8 "cilcode.tmp/ex27.c" +int main(void) +{ int a ; + int b ; + int c ; + int tmp ; + int tmp___0 ; + + { + { +#line 10 + tmp = foo(5, 7); +#line 10 + tmp___0 = foo(6, 7); +#line 10 + a = tmp + tmp___0; +#line 11 + b = 4; +#line 12 + c = 16; + } + { + { +#line 16 + return (20); + } +#line 13 + if (0) { +#line 14 + return (b - c); + } + } +} +} diff --git a/cil/doc/examples/ex28.txt b/cil/doc/examples/ex28.txt new file mode 100644 index 0000000..098b144 --- /dev/null +++ b/cil/doc/examples/ex28.txt @@ -0,0 +1,24 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex28.c" +int main(void) +{ int ***three ; + int **two ; + int **mem_3 ; + int *mem_4 ; + int *mem_5 ; + + { +#line 4 + mem_3 = (*three); +#line 4 + mem_4 = (*mem_3); +#line 4 + mem_5 = (*two); +#line 4 + (*mem_4) = (*mem_5); +#line 5 + return (0); +} +} diff --git a/cil/doc/examples/ex29.txt b/cil/doc/examples/ex29.txt new file mode 100644 index 0000000..7df8f68 --- /dev/null +++ b/cil/doc/examples/ex29.txt @@ -0,0 +1,53 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 2 "cilcode.tmp/ex29.c" +struct mystruct { + int a ; + int b ; +}; +#line 1 "cilcode.tmp/ex29.c" +int main(void) +{ struct mystruct m ; + int local ; + int arr[3] ; + int *ptr ; + unsigned int __cil_tmp5 ; + unsigned int __cil_tmp6 ; + int __cil_tmp7 ; + unsigned int __cil_tmp8 ; + int *__cil_tmp9 ; + int __cil_tmp10 ; + unsigned int __cil_tmp11 ; + unsigned int __cil_tmp12 ; + unsigned int __cil_tmp13 ; + int m_b14 ; + int m_a15 ; + + { +#line 10 + ptr = & local; +#line 11 + __cil_tmp5 = 2 * 4U; +#line 11 + __cil_tmp6 = (unsigned int )(arr) + __cil_tmp5; +#line 11 + __cil_tmp7 = (*((int *)__cil_tmp6)); +#line 11 + __cil_tmp8 = (unsigned int )__cil_tmp7; +#line 11 + __cil_tmp9 = & local; +#line 11 + __cil_tmp10 = (*__cil_tmp9); +#line 11 + __cil_tmp11 = (unsigned int )__cil_tmp10; +#line 11 + __cil_tmp12 = __cil_tmp11 + 8U; +#line 11 + __cil_tmp13 = __cil_tmp12 + __cil_tmp8; +#line 11 + m_a15 = (int )__cil_tmp13; +#line 12 + return (m_a15); +} +} diff --git a/cil/doc/examples/ex3.txt b/cil/doc/examples/ex3.txt new file mode 100644 index 0000000..2ca8ac9 --- /dev/null +++ b/cil/doc/examples/ex3.txt @@ -0,0 +1,20 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex3.c" +union baz { + int x1 ; + double x2 ; +}; +#line 1 "cilcode.tmp/ex3.c" +struct bar { + union baz u1 ; + int y ; +}; +#line 1 "cilcode.tmp/ex3.c" +struct foo { + struct bar s1 ; + int z ; +}; +#line 1 "cilcode.tmp/ex3.c" +struct foo f ; diff --git a/cil/doc/examples/ex30.txt b/cil/doc/examples/ex30.txt new file mode 100644 index 0000000..729cfb0 --- /dev/null +++ b/cil/doc/examples/ex30.txt @@ -0,0 +1,12 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex30.c" +int main(void) +{ int x ; + + { +#line 2 + return (x == (x != 0)); +} +} diff --git a/cil/doc/examples/ex31.txt b/cil/doc/examples/ex31.txt new file mode 100644 index 0000000..ab7d471 --- /dev/null +++ b/cil/doc/examples/ex31.txt @@ -0,0 +1,12 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex31.c" +int main(void) +{ + + { +#line 1 + return ((int )((1U - sizeof(int )) >> 32)); +} +} diff --git a/cil/doc/examples/ex32.txt b/cil/doc/examples/ex32.txt new file mode 100644 index 0000000..f2b6b5b --- /dev/null +++ b/cil/doc/examples/ex32.txt @@ -0,0 +1,16 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex32.c" +int x = 5; +#line 2 "cilcode.tmp/ex32.c" +int f(void) +{ int x___0 ; + + { +#line 3 + x___0 = 3; +#line 6 + return (x); +} +} diff --git a/cil/doc/examples/ex33.txt b/cil/doc/examples/ex33.txt new file mode 100644 index 0000000..f73178f --- /dev/null +++ b/cil/doc/examples/ex33.txt @@ -0,0 +1,24 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex33.c" +int (*pf)(void) ; +#line 2 "cilcode.tmp/ex33.c" +int f(void) +{ + + { +#line 4 + pf = & f; +#line 5 + pf = & f; +#line 6 + ((*pf))(); +#line 7 + ((*pf))(); +#line 8 + f(); +#line 9 + return (0); +} +} diff --git a/cil/doc/examples/ex34.txt b/cil/doc/examples/ex34.txt new file mode 100644 index 0000000..494ca91 --- /dev/null +++ b/cil/doc/examples/ex34.txt @@ -0,0 +1,15 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex34.c" +struct __anonstruct_nested_2 { + int y ; + int z ; +}; +#line 1 "cilcode.tmp/ex34.c" +struct __anonstruct_i_1 { + int x ; + struct __anonstruct_nested_2 nested ; +}; +#line 1 "cilcode.tmp/ex34.c" +struct __anonstruct_i_1 i = {1, {2, 6}}; diff --git a/cil/doc/examples/ex35.txt b/cil/doc/examples/ex35.txt new file mode 100644 index 0000000..1af7447 --- /dev/null +++ b/cil/doc/examples/ex35.txt @@ -0,0 +1,32 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex35.c" +struct __anonstruct_T1_1 { + char *key ; + char *value ; +}; +#line 1 "cilcode.tmp/ex35.c" +typedef struct __anonstruct_T1_1 T1; +#line 7 "cilcode.tmp/ex35.c" +struct __anonstruct_T3_2 { + long type ; + char *value ; +}; +#line 7 "cilcode.tmp/ex35.c" +typedef struct __anonstruct_T3_2 T3; +#line 13 "cilcode.tmp/ex35.c" +struct __anonstruct_T3_2 __constr_expr_0 = {1L, (char *)1}; +#line 13 "cilcode.tmp/ex35.c" +T1 a[1] = { {(char *)"", (char *)(& __constr_expr_0)}}; +#line 20 "cilcode.tmp/ex35.c" +int main(void) +{ T3 *pt3 ; + + { +#line 21 + pt3 = (T3 *)a[0].value; +#line 22 + return ((int )pt3->value); +} +} diff --git a/cil/doc/examples/ex36.txt b/cil/doc/examples/ex36.txt new file mode 100644 index 0000000..adbcdaa --- /dev/null +++ b/cil/doc/examples/ex36.txt @@ -0,0 +1,20 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex36.c" +int main(void) +{ int __constr_expr_0[4] ; + + { +#line 1 + __constr_expr_0[0] = 1; +#line 1 + __constr_expr_0[1] = 2; +#line 1 + __constr_expr_0[2] = 3; +#line 1 + __constr_expr_0[3] = 4; +#line 1 + return (__constr_expr_0[1]); +} +} diff --git a/cil/doc/examples/ex37.txt b/cil/doc/examples/ex37.txt new file mode 100644 index 0000000..00d6ca4 --- /dev/null +++ b/cil/doc/examples/ex37.txt @@ -0,0 +1,14 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 3 "cilcode.tmp/ex37.c" +int foo(void) ; +#line 1 "cilcode.tmp/ex37.c" +int foo(void) +{ + + { +#line 5 + return (0); +} +} diff --git a/cil/doc/examples/ex38.txt b/cil/doc/examples/ex38.txt new file mode 100644 index 0000000..706e13d --- /dev/null +++ b/cil/doc/examples/ex38.txt @@ -0,0 +1,12 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex38.c" +unsigned long foo(void) +{ + + { +#line 2 + return (536870911UL); +} +} diff --git a/cil/doc/examples/ex39.txt b/cil/doc/examples/ex39.txt new file mode 100644 index 0000000..2c8c25f --- /dev/null +++ b/cil/doc/examples/ex39.txt @@ -0,0 +1,25 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex39.c" +int main(void) +{ int x ; + int y ; + int z ; + int *tmp ; + + { +#line 2 + if (x) { +#line 2 + tmp = & y; + } else { +#line 2 + tmp = & z; + } +#line 2 + x ++; +#line 2 + return (tmp - & x); +} +} diff --git a/cil/doc/examples/ex4.txt b/cil/doc/examples/ex4.txt new file mode 100644 index 0000000..00a22d3 --- /dev/null +++ b/cil/doc/examples/ex4.txt @@ -0,0 +1,16 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 2 "cilcode.tmp/ex4.c" +struct foo { + int x ; +}; +#line 1 "cilcode.tmp/ex4.c" +int main(void) +{ struct foo foo ; + + { +#line 8 + return (foo.x); +} +} diff --git a/cil/doc/examples/ex40.txt b/cil/doc/examples/ex40.txt new file mode 100644 index 0000000..c41496b --- /dev/null +++ b/cil/doc/examples/ex40.txt @@ -0,0 +1,20 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex40.c" +extern int f() ; +#line 1 "cilcode.tmp/ex40.c" +int main(void) +{ int tmp___0 ; + + { +#line 2 + tmp___0 = f(); + if (! tmp___0) { +#line 2 + tmp___0 = -1; + } +#line 2 + return (tmp___0); +} +} diff --git a/cil/doc/examples/ex41.txt b/cil/doc/examples/ex41.txt new file mode 100644 index 0000000..f1196f3 --- /dev/null +++ b/cil/doc/examples/ex41.txt @@ -0,0 +1,69 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex41.c" +static void *jtab[2] ; +#line 4 +static int doit(int x ) ; +#line 4 "cilcode.tmp/ex41.c" +static int jtab_init = 0; +#line 2 "cilcode.tmp/ex41.c" +static int doit(int x ) +{ unsigned int __compgoto ; + + { +#line 5 + if (! jtab_init) { +#line 6 + jtab[0] = (void *)0; +#line 7 + jtab[1] = (void *)1; +#line 8 + jtab_init = 1; + } +#line 10 + __compgoto = (unsigned int )jtab[x]; +#line 10 + switch (__compgoto) { + case 1: + goto lbl2; + case 0: + goto lbl1; + default: +#line 10 + (*((int *)0)) = 0; + } + lbl1: +#line 12 + return (0); + lbl2: +#line 14 + return (1); +} +} +#line 18 +extern int ( /* missing proto */ exit)() ; +#line 17 "cilcode.tmp/ex41.c" +int main(void) +{ int tmp ; + int tmp___0 ; + + { +#line 18 + tmp = doit(0); +#line 18 + if (tmp != 0) { +#line 18 + exit(1); + } +#line 19 + tmp___0 = doit(1); +#line 19 + if (tmp___0 != 1) { +#line 19 + exit(1); + } +#line 20 + exit(0); +} +} diff --git a/cil/doc/examples/ex42.txt b/cil/doc/examples/ex42.txt new file mode 100644 index 0000000..b0f40b8 --- /dev/null +++ b/cil/doc/examples/ex42.txt @@ -0,0 +1,22 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex42.c" +int main(void) +{ int tmp ; + + { + goto L; +#line 1 + if (0) { + L: +#line 1 + tmp = 1; + } else { +#line 1 + tmp = 0; + } +#line 1 + return (tmp); +} +} diff --git a/cil/doc/examples/ex43.txt b/cil/doc/examples/ex43.txt new file mode 100644 index 0000000..4104f79 --- /dev/null +++ b/cil/doc/examples/ex43.txt @@ -0,0 +1,46 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex43.c" +__inline static int foo__extinline(void) +{ + + { +#line 1 + return (1); +} +} +#line 2 "cilcode.tmp/ex43.c" +int firstuse(void) +{ int tmp ; + + { +#line 2 + tmp = foo__extinline(); +#line 2 + return (tmp); +} +} +#line 5 "cilcode.tmp/ex43.c" +int foo(void) +{ + + { +#line 5 + return (2); +} +} +#line 7 "cilcode.tmp/ex43.c" +int main(void) +{ int tmp ; + int tmp___0 ; + + { +#line 8 + tmp = foo(); +#line 8 + tmp___0 = firstuse(); +#line 8 + return (tmp + tmp___0); +} +} diff --git a/cil/doc/examples/ex44.txt b/cil/doc/examples/ex44.txt new file mode 100644 index 0000000..06f83ba --- /dev/null +++ b/cil/doc/examples/ex44.txt @@ -0,0 +1,31 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex44.c" +struct s { + int i1 ; + int i2 ; +}; +#line 1 "cilcode.tmp/ex44.c" +union u { + int i ; + struct s s ; +}; +#line 8 "cilcode.tmp/ex44.c" +union u x = {6}; +#line 10 "cilcode.tmp/ex44.c" +int main(void) +{ struct s y ; + union u z ; + + { +#line 11 + y.i1 = 1; +#line 11 + y.i2 = 2; +#line 12 + z.s = y; +#line 13 + return (0); +} +} diff --git a/cil/doc/examples/ex45.txt b/cil/doc/examples/ex45.txt new file mode 100644 index 0000000..aaafca3 --- /dev/null +++ b/cil/doc/examples/ex45.txt @@ -0,0 +1,11 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex45.c" +char i8 ; +#line 2 "cilcode.tmp/ex45.c" +short i16 ; +#line 3 "cilcode.tmp/ex45.c" +int i32 ; +#line 4 "cilcode.tmp/ex45.c" +long long i64 ; diff --git a/cil/doc/examples/ex46.txt b/cil/doc/examples/ex46.txt new file mode 100644 index 0000000..1f87ec2 --- /dev/null +++ b/cil/doc/examples/ex46.txt @@ -0,0 +1,23 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex46.c" +static int bar(int x , char y ) +{ + + { +#line 2 + return (x + (int )y); +} +} +#line 6 "cilcode.tmp/ex46.c" +int foo(int x , char y ) +{ int tmp ; + + { +#line 6 + tmp = bar(x, y); +#line 6 + return (tmp); +} +} diff --git a/cil/doc/examples/ex47.txt b/cil/doc/examples/ex47.txt new file mode 100644 index 0000000..cc5c306 --- /dev/null +++ b/cil/doc/examples/ex47.txt @@ -0,0 +1,28 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex47.c" +struct __anonstruct____missing_field_name_3 { + int u ; + int v ; +}; +#line 1 "cilcode.tmp/ex47.c" +struct __anonstruct____missing_field_name_2 { + int y ; + int z ; + struct __anonstruct____missing_field_name_3 __annonCompField1 ; +}; +#line 1 "cilcode.tmp/ex47.c" +struct __anonstruct_a_1 { + int x ; + struct __anonstruct____missing_field_name_2 __annonCompField2 ; +}; +#line 1 "cilcode.tmp/ex47.c" +int main(void) +{ struct __anonstruct_a_1 a ; + + { +#line 10 + return ((((a.x + a.__annonCompField2.y) + a.__annonCompField2.z) + a.__annonCompField2.__annonCompField1.u) + a.__annonCompField2.__annonCompField1.v); +} +} diff --git a/cil/doc/examples/ex5.txt b/cil/doc/examples/ex5.txt new file mode 100644 index 0000000..d750bb5 --- /dev/null +++ b/cil/doc/examples/ex5.txt @@ -0,0 +1,27 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex5.c" +int f(double x ) ; +#line 3 +int g(double x ) ; +#line 2 "cilcode.tmp/ex5.c" +int f(double x ) +{ int tmp ; + + { +#line 3 + tmp = g(x); +#line 3 + return (tmp); +} +} +#line 5 "cilcode.tmp/ex5.c" +int g(double x ) +{ + + { +#line 6 + return ((int )x); +} +} diff --git a/cil/doc/examples/ex6.txt b/cil/doc/examples/ex6.txt new file mode 100644 index 0000000..c33eb9e --- /dev/null +++ b/cil/doc/examples/ex6.txt @@ -0,0 +1,7 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex6.c" +int a1[3] = { 1, 2, 3}; +#line 2 "cilcode.tmp/ex6.c" +int a2[8] ; diff --git a/cil/doc/examples/ex7.txt b/cil/doc/examples/ex7.txt new file mode 100644 index 0000000..55434c7 --- /dev/null +++ b/cil/doc/examples/ex7.txt @@ -0,0 +1,22 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 2 "cilcode.tmp/ex7.c" +enum __anonenum_x_1 { + FIVE = 5, + SIX = 6, + SEVEN = 7, + FOUR = 4, + EIGHT = 8 +} ; +#line 1 "cilcode.tmp/ex7.c" +int main(void) +{ enum __anonenum_x_1 x ; + + { +#line 2 + x = 5; +#line 8 + return ((int )x); +} +} diff --git a/cil/doc/examples/ex8.txt b/cil/doc/examples/ex8.txt new file mode 100644 index 0000000..323a41e --- /dev/null +++ b/cil/doc/examples/ex8.txt @@ -0,0 +1,13 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 2 "cilcode.tmp/ex8.c" +struct foo { + int x ; + int y ; +}; +#line 1 "cilcode.tmp/ex8.c" +int a1[5] = { 1, 2, 3, 0, + 0}; +#line 2 "cilcode.tmp/ex8.c" +struct foo s1 = {4, 0}; diff --git a/cil/doc/examples/ex9.txt b/cil/doc/examples/ex9.txt new file mode 100644 index 0000000..22e976c --- /dev/null +++ b/cil/doc/examples/ex9.txt @@ -0,0 +1,16 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +#line 1 "cilcode.tmp/ex9.c" +struct inner { + int z ; +}; +#line 1 "cilcode.tmp/ex9.c" +struct foo { + int x ; + int y ; + int a[5] ; + struct inner inner ; +}; +#line 1 "cilcode.tmp/ex9.c" +struct foo s = {0, 8, {0, 5, 5, 4, 0}, {3}}; diff --git a/cil/doc/ext.html b/cil/doc/ext.html new file mode 100644 index 0000000..532e225 --- /dev/null +++ b/cil/doc/ext.html @@ -0,0 +1,506 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +Library of CIL Modules +</TITLE> +</HEAD> +<BODY > +<A HREF="cil007.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil009.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc17">8</A> Library of CIL Modules</H2> <A NAME="sec-Extension"></A><BR> +<BR> +We are developing a suite of modules that use CIL for program analyses and +transformations that we have found useful. You can use these modules directly +on your code, or generally as inspiration for writing similar modules. A +particularly big and complex application written on top of CIL is CCured +(<A HREF="../ccured/index.html"><TT>../ccured/index.html</TT></A>).<BR> +<BR> +<A NAME="toc9"></A> +<H3 CLASS="subsection"><A NAME="htoc18">8.1</A> Control-Flow Graphs</H3> <A NAME="sec-cfg"></A> +The <A HREF="api/Cil.html#TYPEstmt">Cil.stmt</A> datatype includes fields for intraprocedural +control-flow information: the predecessor and successor statements of +the current statement. This information is not computed by default. +If you want to use the control-flow graph, or any of the extensions in +this section that require it, you have to explicitly ask CIL to +compute the CFG.<BR> +<BR> + +<H4 CLASS="subsubsection"><A NAME="htoc19">8.1.1</A> The CFG module (new in CIL 1.3.5)</H4> +The best way to compute the CFG is with the CFG module. Just invoke +<A HREF="api/Cfg.html#VALcomputeFileCFG">Cfg.computeFileCFG</A> on your file. The <A HREF="api/Cfg.html">Cfg</A> API +describes the rest of actions you can take with this module, including +computing the CFG for one function at a time, or printing the CFG in +<TT>dot</TT> form.<BR> +<BR> + +<H4 CLASS="subsubsection"><A NAME="htoc20">8.1.2</A> Simplified control flow</H4> +CIL can reduce high-level C control-flow constructs like <TT>switch</TT> and +<TT>continue</TT> to lower-level <TT>goto</TT>s. This completely eliminates some +possible classes of statements from the program and may make the result +easier to analyze (e.g., it simplifies data-flow analysis).<BR> +<BR> +You can invoke this transformation on the command line with +<TT>--domakeCFG</TT> or programatically with <A HREF="api/Cil.html#VALprepareCFG">Cil.prepareCFG</A>. +After calling Cil.prepareCFG, you can use <A HREF="api/Cil.html#VALcomputeCFGInfo">Cil.computeCFGInfo</A> +to compute the CFG information and find the successor and predecessor +of each statement.<BR> +<BR> +For a concrete example, you can see how <TT>cilly --domakeCFG</TT> +transforms the following code (note the fall-through in case 1): +<PRE CLASS="verbatim"><FONT COLOR=blue> + int foo (int predicate) { + int x = 0; + switch (predicate) { + case 0: return 111; + case 1: x = x + 1; + case 2: return (x+3); + case 3: break; + default: return 222; + } + return 333; + } +</FONT></PRE> +See the <A HREF="examples/ex23.txt">CIL output</A> for this +code fragment<BR> +<BR> +<A NAME="toc10"></A> +<H3 CLASS="subsection"><A NAME="htoc21">8.2</A> Data flow analysis framework</H3> +The <A HREF="api/Dataflow.html">Dataflow</A> module (click for the ocamldoc) contains a +parameterized framework for forward and backward data flow +analyses. You provide the transfer functions and this module does the +analysis. You must compute control-flow information (Section <A HREF="#sec-cfg">8.1</A>) +before invoking the Dataflow module.<BR> +<BR> +<A NAME="toc11"></A> +<H3 CLASS="subsection"><A NAME="htoc22">8.3</A> Dominators</H3> +The module <A HREF="api/Dominators.html">Dominators</A> contains the computation of immediate + dominators. It uses the <A HREF="api/Dataflow.html">Dataflow</A> module. <BR> +<BR> +<A NAME="toc12"></A> +<H3 CLASS="subsection"><A NAME="htoc23">8.4</A> Points-to Analysis</H3> +The module <TT>ptranal.ml</TT> contains two interprocedural points-to +analyses for CIL: <TT>Olf</TT> and <TT>Golf</TT>. <TT>Olf</TT> is the default. +(Switching from <TT>olf.ml</TT> to <TT>golf.ml</TT> requires a change in +<TT>Ptranal</TT> and a recompiling <TT>cilly</TT>.)<BR> +<BR> +The analyses have the following characteristics: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +Not based on C types (inferred pointer relationships are sound + despite most kinds of C casts) +<LI CLASS="li-itemize">One level of subtyping +<LI CLASS="li-itemize">One level of context sensitivity (Golf only) +<LI CLASS="li-itemize">Monomorphic type structures +<LI CLASS="li-itemize">Field insensitive (fields of structs are conflated) +<LI CLASS="li-itemize">Demand-driven (points-to queries are solved on demand) +<LI CLASS="li-itemize">Handle function pointers +</UL> +The analysis itself is factored into two components: <TT>Ptranal</TT>, +which walks over the CIL file and generates constraints, and <TT>Olf</TT> +or <TT>Golf</TT>, which solve the constraints. The analysis is invoked +with the function <TT>Ptranal.analyze_file: Cil.file -> + unit</TT>. This function builds the points-to graph for the CIL file +and stores it internally. There is currently no facility for clearing +internal state, so <TT>Ptranal.analyze_file</TT> should only be called +once.<BR> +<BR> +The constructed points-to graph supports several kinds of queries, +including alias queries (may two expressions be aliased?) and +points-to queries (to what set of locations may an expression point?).<BR> +<BR> +The main interface with the alias analysis is as follows: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>Ptranal.may_alias: Cil.exp -> Cil.exp -> bool</TT>. If + <TT>true</TT>, the two expressions may have the same value. +<LI CLASS="li-itemize"><TT>Ptranal.resolve_lval: Cil.lval -> (Cil.varinfo + list)</TT>. Returns the list of variables to which the given + left-hand value may point. +<LI CLASS="li-itemize"><TT>Ptranal.resolve_exp: Cil.exp -> (Cil.varinfo list)</TT>. + Returns the list of variables to which the given expression may + point. +<LI CLASS="li-itemize"><TT>Ptranal.resolve_funptr: Cil.exp -> (Cil.fundec + list)</TT>. Returns the list of functions to which the given + expression may point. +</UL> +The precision of the analysis can be customized by changing the values +of several flags: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>Ptranal.no_sub: bool ref</TT>. + If <TT>true</TT>, subtyping is disabled. Associated commandline option: + <B>--ptr_unify</B>. +<LI CLASS="li-itemize"><TT>Ptranal.analyze_mono: bool ref</TT>. + (Golf only) If <TT>true</TT>, context sensitivity is disabled and the + analysis is effectively monomorphic. Commandline option: + <B>--ptr_mono</B>. +<LI CLASS="li-itemize"><TT>Ptranal.smart_aliases: bool ref</TT>. + (Golf only) If <TT>true</TT>, “smart” disambiguation of aliases is + enabled. Otherwise, aliases are computed by intersecting points-to + sets. This is an experimental feature. +<LI CLASS="li-itemize"><TT>Ptranal.model_strings: bool ref</TT>. + Make the alias analysis model string constants by treating them as + pointers to chars. Commandline option: <B>--ptr_model_strings</B> +<LI CLASS="li-itemize"><TT>Ptranal.conservative_undefineds: bool ref</TT>. + Make the most pessimistic assumptions about globals if an undefined + function is present. Such a function can write to every global + variable. Commandline option: <B>--ptr_conservative</B> +</UL> +In practice, the best precision/efficiency tradeoff is achieved by +setting <TT>Ptranal.no_sub</TT> to <TT>false</TT>, <TT>Ptranal.analyze_mono</TT> to +<TT>true</TT>, and <TT>Ptranal.smart_aliases</TT> to <TT>false</TT>. These are the +default values of the flags.<BR> +<BR> +There are also a few flags that can be used to inspect or serialize +the results of the analysis. +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>Ptranal.debug_may_aliases</TT>. + Print the may-alias relationship of each pair of expressions in the + program. Commandline option: <B>--ptr_may_aliases</B>. +<LI CLASS="li-itemize"><TT>Ptranal.print_constraints: bool ref</TT>. + If <TT>true</TT>, the analysis will print each constraint as it is + generated. +<LI CLASS="li-itemize"><TT>Ptranal.print_types: bool ref</TT>. + If <TT>true</TT>, the analysis will print the inferred type of each + variable in the program.<BR> +<BR> +If <TT>Ptranal.analyze_mono</TT> and <TT>Ptranal.no_sub</TT> are both + <TT>true</TT>, this output is sufficient to reconstruct the points-to + graph. One nice feature is that there is a pretty printer for + recursive types, so the print routine does not loop. +<LI CLASS="li-itemize"><TT>Ptranal.compute_results: bool ref</TT>. + If <TT>true</TT>, the analysis will print out the points-to set of each + variable in the program. This will essentially serialize the + points-to graph. +</UL> +<A NAME="toc13"></A> +<H3 CLASS="subsection"><A NAME="htoc24">8.5</A> StackGuard</H3> +The module <TT>heapify.ml</TT> contains a transformation similar to the one +described in “StackGuard: Automatic Adaptive Detection and Prevention of +Buffer-Overflow Attacks”, <EM>Proceedings of the 7th USENIX Security +Conference</EM>. In essence it modifies the program to maintain a separate +stack for return addresses. Even if a buffer overrun attack occurs the +actual correct return address will be taken from the special stack. <BR> +<BR> +Although it does work, this CIL module is provided mainly as an example of +how to perform a simple source-to-source program analysis and +transformation. As an optimization only functions that contain a dangerous +local array make use of the special return address stack. <BR> +<BR> +For a concrete example, you can see how <TT>cilly --dostackGuard</TT> +transforms the following dangerous code: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int dangerous() { + char array[10]; + scanf("%s",array); // possible buffer overrun! + } + + int main () { + return dangerous(); + } +</FONT></PRE> +See the <A HREF="examples/ex24.txt">CIL output</A> for this +code fragment<BR> +<BR> +<A NAME="toc14"></A> +<H3 CLASS="subsection"><A NAME="htoc25">8.6</A> Heapify</H3> +The module <TT>heapify.ml</TT> also contains a transformation that moves all +dangerous local arrays to the heap. This also prevents a number of buffer +overruns. <BR> +<BR> +For a concrete example, you can see how <TT>cilly --doheapify</TT> +transforms the following dangerous code: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int dangerous() { + char array[10]; + scanf("%s",array); // possible buffer overrun! + } + + int main () { + return dangerous(); + } +</FONT></PRE> +See the <A HREF="examples/ex25.txt">CIL output</A> for this +code fragment<BR> +<BR> +<A NAME="toc15"></A> +<H3 CLASS="subsection"><A NAME="htoc26">8.7</A> One Return</H3> +The module <TT>oneret.ml</TT> contains a transformation the ensures that all +function bodies have at most one return statement. This simplifies a number +of analyses by providing a canonical exit-point. <BR> +<BR> +For a concrete example, you can see how <TT>cilly --dooneRet</TT> +transforms the following code: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int foo (int predicate) { + if (predicate <= 0) { + return 1; + } else { + if (predicate > 5) + return 2; + return 3; + } + } +</FONT></PRE> +See the <A HREF="examples/ex26.txt">CIL output</A> for this +code fragment<BR> +<BR> +<A NAME="toc16"></A> +<H3 CLASS="subsection"><A NAME="htoc27">8.8</A> Partial Evaluation and Constant Folding</H3> +The <TT>partial.ml</TT> module provides a simple interprocedural partial +evaluation and constant folding data-flow analysis and transformation. This +transformation requires the <TT>--domakeCFG</TT> option. <BR> +<BR> +For a concrete example, you can see how <TT>cilly --domakeCFG --dopartial</TT> +transforms the following code (note the eliminated <TT>if</TT> branch and the +partial optimization of <TT>foo</TT>): +<PRE CLASS="verbatim"><FONT COLOR=blue> + int foo(int x, int y) { + int unknown; + if (unknown) + return y+2; + return x+3; + } + + int main () { + int a,b,c; + a = foo(5,7) + foo(6,7); + b = 4; + c = b * b; + if (b > c) + return b-c; + else + return b+c; + } +</FONT></PRE> +See the <A HREF="examples/ex27.txt">CIL output</A> for this +code fragment<BR> +<BR> +<A NAME="toc17"></A> +<H3 CLASS="subsection"><A NAME="htoc28">8.9</A> Reaching Definitions</H3> +The <TT>reachingdefs.ml</TT> module uses the dataflow framework and CFG +information to calculate the definitions that reach each +statement. After computing the CFG (Section <A HREF="#sec-cfg">8.1</A>) and calling +<TT>computeRDs</TT> on a +function declaration, <TT>ReachingDef.stmtStartData</TT> will contain a +mapping from statement IDs to data about which definitions reach each +statement. In particular, it is a mapping from statement IDs to a +triple the first two members of which are used internally. The third +member is a mapping from variable IDs to Sets of integer options. If +the set contains <TT>Some(i)</TT>, then the definition of that variable +with ID <TT>i</TT> reaches that statement. If the set contains <TT>None</TT>, +then there is a path to that statement on which there is no definition +of that variable. Also, if the variable ID is unmapped at a +statement, then no definition of that variable reaches that statement.<BR> +<BR> +To summarize, reachingdefs.ml has the following interface: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>computeRDs</TT> – Computes reaching definitions. Requires that +CFG information has already been computed for each statement. +<LI CLASS="li-itemize"><TT>ReachingDef.stmtStartData</TT> – contains reaching +definition data after <TT>computeRDs</TT> is called. +<LI CLASS="li-itemize"><TT>ReachingDef.defIdStmtHash</TT> – Contains a mapping +from definition IDs to the ID of the statement in which +the definition occurs. +<LI CLASS="li-itemize"><TT>getRDs</TT> – Takes a statement ID and returns +reaching definition data for that statement. +<LI CLASS="li-itemize"><TT>instrRDs</TT> – Takes a list of instructions and the +definitions that reach the first instruction, and for +each instruction calculates the definitions that reach +either into or out of that instruction. +<LI CLASS="li-itemize"><TT>rdVisitorClass</TT> – A subclass of nopCilVisitor that +can be extended such that the current reaching definition +data is available when expressions are visited through +the <TT>get_cur_iosh</TT> method of the class. +</UL> +<A NAME="toc18"></A> +<H3 CLASS="subsection"><A NAME="htoc29">8.10</A> Available Expressions</H3> +The <TT>availexps.ml</TT> module uses the dataflow framework and CFG +information to calculate something similar to a traditional available +expressions analysis. After <TT>computeAEs</TT> is called following a CFG +calculation (Section <A HREF="#sec-cfg">8.1</A>), <TT>AvailableExps.stmtStartData</TT> will +contain a mapping +from statement IDs to data about what expressions are available at +that statement. The data for each statement is a mapping for each +variable ID to the whole expression available at that point(in the +traditional sense) which the variable was last defined to be. So, +this differs from a traditional available expressions analysis in that +only whole expressions from a variable definition are considered rather +than all expressions.<BR> +<BR> +The interface is as follows: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>computeAEs</TT> – Computes available expressions. Requires +that CFG information has already been comptued for each statement. +<LI CLASS="li-itemize"><TT>AvailableExps.stmtStartData</TT> – Contains available +expressions data for each statement after <TT>computeAEs</TT> has been +called. +<LI CLASS="li-itemize"><TT>getAEs</TT> – Takes a statement ID and returns +available expression data for that statement. +<LI CLASS="li-itemize"><TT>instrAEs</TT> – Takes a list of instructions and +the availalbe expressions at the first instruction, and +for each instruction calculates the expressions available +on entering or exiting each instruction. +<LI CLASS="li-itemize"><TT>aeVisitorClass</TT> – A subclass of nopCilVisitor that +can be extended such that the current available expressions +data is available when expressions are visited through the +<TT>get_cur_eh</TT> method of the class. +</UL> +<A NAME="toc19"></A> +<H3 CLASS="subsection"><A NAME="htoc30">8.11</A> Liveness Analysis</H3> +The <TT>liveness.ml</TT> module uses the dataflow framework and +CFG information to calculate which variables are live at +each program point. After <TT>computeLiveness</TT> is called +following a CFG calculation (Section <A HREF="#sec-cfg">8.1</A>), <TT>LiveFlow.stmtStartData</TT> will +contain a mapping for each statement ID to a set of <TT>varinfo</TT>s +for varialbes live at that program point.<BR> +<BR> +The interface is as follows: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>computeLiveness</TT> – Computes live variables. Requires +that CFG information has already been computed for each statement. +<LI CLASS="li-itemize"><TT>LiveFlow.stmtStartData</TT> – Contains live variable data +for each statement after <TT>computeLiveness</TT> has been called. +</UL> +Also included in this module is a command line interface that +will cause liveness data to be printed to standard out for +a particular function or label. +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>–doliveness</TT> – Instructs cilly to comptue liveness +information and to print on standard out the variables live +at the points specified by <TT>–live_func</TT> and <TT>live_label</TT>. +If both are ommitted, then nothing is printed. +<LI CLASS="li-itemize"><TT>–live_func</TT> – The name of the function whose +liveness data is of interest. If <TT>–live_label</TT> is ommitted, +then data for each statement is printed. +<LI CLASS="li-itemize"><TT>–live_label</TT> – The name of the label at which +the liveness data will be printed. +</UL> +<A NAME="toc20"></A> +<H3 CLASS="subsection"><A NAME="htoc31">8.12</A> Dead Code Elimination</H3> +The module <TT>deadcodeelim.ml</TT> uses the reaching definitions +analysis to eliminate assignment instructions whose results +are not used. The interface is as follows: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>elim_dead_code</TT> – Performs dead code elimination +on a function. Requires that CFG information has already +been computed (Section <A HREF="#sec-cfg">8.1</A>). +<LI CLASS="li-itemize"><TT>dce</TT> – Performs dead code elimination on an +entire file. Requires that CFG information has already +been computed. +</UL> +<A NAME="toc21"></A> +<H3 CLASS="subsection"><A NAME="htoc32">8.13</A> Simple Memory Operations</H3> +The <TT>simplemem.ml</TT> module allows CIL lvalues that contain memory +accesses to be even futher simplified via the introduction of +well-typed temporaries. After this transformation all lvalues involve +at most one memory reference.<BR> +<BR> +For a concrete example, you can see how <TT>cilly --dosimpleMem</TT> +transforms the following code: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int main () { + int ***three; + int **two; + ***three = **two; + } +</FONT></PRE> +See the <A HREF="examples/ex28.txt">CIL output</A> for this +code fragment<BR> +<BR> +<A NAME="toc22"></A> +<H3 CLASS="subsection"><A NAME="htoc33">8.14</A> Simple Three-Address Code</H3> +The <TT>simplify.ml</TT> module further reduces the complexity of program +expressions and gives you a form of three-address code. After this +transformation all expressions will adhere to the following grammar: +<PRE CLASS="verbatim"> + basic::= + Const _ + Addrof(Var v, NoOffset) + StartOf(Var v, NoOffset) + Lval(Var v, off), where v is a variable whose address is not taken + and off contains only "basic" + + exp::= + basic + Lval(Mem basic, NoOffset) + BinOp(bop, basic, basic) + UnOp(uop, basic) + CastE(t, basic) + + lval ::= + Mem basic, NoOffset + Var v, off, where v is a variable whose address is not taken and off + contains only "basic" +</PRE>In addition, all <TT>sizeof</TT> and <TT>alignof</TT> forms are turned into +constants. Accesses to arrays and variables whose address is taken are +turned into "Mem" accesses. All field and index computations are turned +into address arithmetic.<BR> +<BR> +For a concrete example, you can see how <TT>cilly --dosimplify</TT> +transforms the following code: +<PRE CLASS="verbatim"><FONT COLOR=blue> + int main() { + struct mystruct { + int a; + int b; + } m; + int local; + int arr[3]; + int *ptr; + + ptr = &local; + m.a = local + sizeof(m) + arr[2]; + return m.a; + } +</FONT></PRE> +See the <A HREF="examples/ex29.txt">CIL output</A> for this +code fragment<BR> +<BR> +<A NAME="toc23"></A> +<H3 CLASS="subsection"><A NAME="htoc34">8.15</A> Converting C to C++</H3> +The module canonicalize.ml performs several transformations to correct +differences between C and C++, so that the output is (hopefully) valid +C++ code. This may be incomplete — certain fixes which are necessary +for some programs are not yet implemented.<BR> +<BR> +Using the <TT>--doCanonicalize</TT> option with CIL will perform the +following changes to your program: +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> +Any variables that use C++ keywords as identifiers are renamed. +<LI CLASS="li-enumerate">C allows global variables to have multiple declarations and + multiple (equivalent) definitions. This transformation removes + all but one declaration and all but one definition. +<LI CLASS="li-enumerate"><TT>__inline</TT> is #defined to <TT>inline</TT>, and <TT>__restrict</TT> + is #defined to nothing. +<LI CLASS="li-enumerate">C allows function pointers with no specified arguments to be used on + any argument list. To make C++ accept this code, we insert a cast + from the function pointer to a type that matches the arguments. Of + course, this does nothing to guarantee that the pointer actually has + that type. +<LI CLASS="li-enumerate">Makes casts from int to enum types explicit. (CIL changes enum + constants to int constants, but doesn't use a cast.) +</OL> +<HR> +<A HREF="cil007.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil009.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/header.html b/cil/doc/header.html new file mode 100644 index 0000000..cfedee9 --- /dev/null +++ b/cil/doc/header.html @@ -0,0 +1,18 @@ +<html> + +<head> +<meta http-equiv="Content-Language" content="en-us"> +<meta name="GENERATOR" content="Microsoft FrontPage 5.0"> +<meta name="ProgId" content="FrontPage.Editor.Document"> +<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> +<title>CIL Documentation (v. 1.3.5)</title> +<base target="contents"> +</head> + +<body> + +<h1 align="center">CIL - Infrastructure for C Program Analysis and Transformation (v. 1.3.5)</h1> + +</body> + +</html> diff --git a/cil/doc/index.html b/cil/doc/index.html new file mode 100644 index 0000000..77ec160 --- /dev/null +++ b/cil/doc/index.html @@ -0,0 +1,26 @@ +<html> + +<head> +<meta name="GENERATOR" content="Microsoft FrontPage 5.0"> +<meta name="ProgId" content="FrontPage.Editor.Document"> +<base target="main"> +<title>CIL Documentation (v. 1.3.5)</title> +</head> + +<frameset rows="64,*"> + <frame name="banner" scrolling="auto" noresize target="contents" + src="header.html"> + <frameset cols="267,*"> + <frame name="contents" target="main" src="ciltoc.html" scrolling="auto"> + <frame name="main" src="cil001.html" scrolling="auto"> + </frameset> + <noframes> + <body> + + <p>This page uses frames, but your browser doesn't support them.</p> + + </body> + </noframes> +</frameset> + +</html>
\ No newline at end of file diff --git a/cil/doc/merger.html b/cil/doc/merger.html new file mode 100644 index 0000000..636dd2a --- /dev/null +++ b/cil/doc/merger.html @@ -0,0 +1,167 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +Using the merger +</TITLE> +</HEAD> +<BODY > +<A HREF="cil012.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="patcher.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc39">13</A> Using the merger</H2><A NAME="sec-merger"></A><BR> +<BR> +There are many program analyses that are more effective when +done on the whole program.<BR> +<BR> +The merger is a tool that combines all of the C source files in a project +into a single C file. There are two tasks that a merger must perform: +<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate"> +Detect what are all the sources that make a project and with what +compiler arguments they are compiled.<BR> +<BR> +<LI CLASS="li-enumerate">Merge all of the source files into a single file. +</OL> +For the first task the merger impersonates a compiler and a linker (both a +GCC and a Microsoft Visual C mode are supported) and it expects to be invoked +(from a build script or a Makefile) on all sources of the project. When +invoked to compile a source the merger just preprocesses the source and saves +the result using the name of the requested object file. By preprocessing at +this time the merger is able to take into account variations in the command +line arguments that affect preprocessing of different source files.<BR> +<BR> +When the merger is invoked to link a number of object files it collects the +preprocessed sources that were stored with the names of the object files, and +invokes the merger proper. Note that arguments that affect the compilation or +linking must be the same for all source files.<BR> +<BR> +For the second task, the merger essentially concatenates the preprocessed +sources with care to rename conflicting file-local declarations (we call this +process alpha-conversion of a file). The merger also attempts to remove +duplicate global declarations and definitions. Specifically the following +actions are taken: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +File-scope names (<TT>static</TT> globals, names of types defined with +<TT>typedef</TT>, and structure/union/enumeration tags) are given new names if they +conflict with declarations from previously processed sources. The new name is +formed by appending the suffix <TT>___n</TT>, where <TT>n</TT> is a unique integer +identifier. Then the new names are applied to their occurrences in the file. <BR> +<BR> +<LI CLASS="li-itemize">Non-static declarations and definitions of globals are never renamed. +But we try to remove duplicate ones. Equality of globals is detected by +comparing the printed form of the global (ignoring the line number directives) +after the body has been alpha-converted. This process is intended to remove +those declarations (e.g. function prototypes) that originate from the same +include file. Similarly, we try to eliminate duplicate definitions of +<TT>inline</TT> functions, since these occasionally appear in include files.<BR> +<BR> +<LI CLASS="li-itemize">The types of all global declarations with the same name from all files +are compared for type isomorphism. During this process, the merger detects all +those isomorphisms between structures and type definitions that are <B>required</B> for the merged program to be legal. Such structure tags and +typenames are coalesced and given the same name. <BR> +<BR> +<LI CLASS="li-itemize">Besides the structure tags and type names that are required to be +isomorphic, the merger also tries to coalesce definitions of structures and +types with the same name from different file. However, in this case the merger +will not give an error if such definitions are not isomorphic; it will just +use different names for them. <BR> +<BR> +<LI CLASS="li-itemize">In rare situations, it can happen that a file-local global in +encountered first and it is not renamed, only to discover later when +processing another file that there is an external symbol with the same name. +In this case, a second pass is made over the merged file to rename the +file-local symbol. +</UL> +Here is an example of using the merger:<BR> +<BR> +The contents of <TT>file1.c</TT> is: +<PRE CLASS="verbatim"><FONT COLOR=blue> +struct foo; // Forward declaration +extern struct foo *global; +</FONT></PRE> +The contents of <TT>file2.c</TT> is: +<PRE CLASS="verbatim"><FONT COLOR=blue> +struct bar { + int x; + struct bar *next; +}; +extern struct bar *global; +struct foo { + int y; +}; +extern struct foo another; +void main() { +} +</FONT></PRE> +There are several ways in which one might create an executable from these +files: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<PRE CLASS="verbatim"> +gcc file1.c file2.c -o a.out +</PRE><BR> +<BR> +<LI CLASS="li-itemize"><PRE CLASS="verbatim"> +gcc -c file1.c -o file1.o +gcc -c file2.c -o file2.o +ld file1.o file2.o -o a.out +</PRE><BR> +<BR> +<LI CLASS="li-itemize"><PRE CLASS="verbatim"> +gcc -c file1.c -o file1.o +gcc -c file2.c -o file2.o +ar r libfile2.a file2.o +gcc file1.o libfile2.a -o a.out +</PRE><BR> +<BR> +<LI CLASS="li-itemize"><PRE CLASS="verbatim"> +gcc -c file1.c -o file1.o +gcc -c file2.c -o file2.o +ar r libfile2.a file2.o +gcc file1.o -lfile2 -o a.out +</PRE></UL> +In each of the cases above you must replace all occurrences of <TT>gcc</TT> and +<TT>ld</TT> with <TT>cilly --merge</TT>, and all occurrences of <TT>ar</TT> with <TT>cilly +--merge --mode=AR</TT>. It is very important that the <TT>--merge</TT> flag be used +throughout the build process. If you want to see the merged source file you +must also pass the <TT>--keepmerged</TT> flag to the linking phase. <BR> +<BR> +The result of merging file1.c and file2.c is: +<PRE CLASS="verbatim"><FONT COLOR=blue> +// from file1.c +struct foo; // Forward declaration +extern struct foo *global; + +// from file2.c +struct foo { + int x; + struct foo *next; +}; +struct foo___1 { + int y; +}; +extern struct foo___1 another; +</FONT></PRE> +<HR> +<A HREF="cil012.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="patcher.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/next_motif.gif b/cil/doc/next_motif.gif Binary files differnew file mode 100644 index 0000000..3f84bac --- /dev/null +++ b/cil/doc/next_motif.gif diff --git a/cil/doc/patcher.html b/cil/doc/patcher.html new file mode 100644 index 0000000..2c727e2 --- /dev/null +++ b/cil/doc/patcher.html @@ -0,0 +1,126 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + + + +<META http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"> +<META name="GENERATOR" content="hevea 1.08"> + +<base target="main"> +<script language="JavaScript"> +<!-- Begin +function loadTop(url) { + parent.location.href= url; +} +// --> +</script> +<LINK rel="stylesheet" type="text/css" href="cil.css"> +<TITLE> +Using the patcher +</TITLE> +</HEAD> +<BODY > +<A HREF="merger.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil015.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +<HR> + +<H2 CLASS="section"><A NAME="htoc40">14</A> Using the patcher</H2><A NAME="sec-patcher"></A><BR> +<BR> +Occasionally we have needed to modify slightly the standard include files. +So, we developed a simple mechanism that allows us to create modified copies +of the include files and use them instead of the standard ones. For this +purpose we specify a patch file and we run a program caller Patcher which +makes modified copies of include files and applies the patch.<BR> +<BR> +The patcher is invoked as follows: +<PRE CLASS="verbatim"> +bin/patcher [options] + +Options: + --help Prints this help message + --verbose Prints a lot of information about what is being done + --mode=xxx What tool to emulate: + GNUCC - GNU CC + MSVC - MS VC cl compiler + + --dest=xxx The destination directory. Will make one if it does not exist + --patch=xxx Patch file (can be specified multiple times) + --ppargs=xxx An argument to be passed to the preprocessor (can be specified + multiple times) + + --ufile=xxx A user-include file to be patched (treated as \#include "xxx") + --sfile=xxx A system-include file to be patched (treated as \#include <xxx>) + + --clean Remove all files in the destination directory + --dumpversion Print the version name used for the current compiler + + All of the other arguments are passed to the preprocessor. You should pass + enough arguments (e.g., include directories) so that the patcher can find the + right include files to be patched. +</PRE> + Based on the given <TT>mode</TT> and the current version of the compiler (which +the patcher can print when given the <TT>dumpversion</TT> argument) the patcher +will create a subdirectory of the <TT>dest</TT> directory (say <TT>/usr/home/necula/cil/include</TT>), such as: +<PRE CLASS="verbatim"> +/usr/home/necula/cil/include/gcc_2.95.3-5 +</PRE> + In that file the patcher will copy the modified versions of the include files +specified with the <TT>ufile</TT> and <TT>sfile</TT> options. Each of these options can +be specified multiple times. <BR> +<BR> +The patch file (specified with the <TT>patch</TT> option) has a format inspired by +the Unix <TT>patch</TT> tool. The file has the following grammar: +<PRE CLASS="verbatim"> +<<< flags +patterns +=== +replacement +>>> +</PRE> + The flags are a comma separated, case-sensitive, sequence of keywords or +keyword = value. The following flags are supported: +<UL CLASS="itemize"><LI CLASS="li-itemize"> +<TT>file=foo.h</TT> - will only apply the patch on files whose name is + <TT>foo.h</TT>. +<LI CLASS="li-itemize"><TT>optional</TT> - this means that it is Ok if the current patch does not +match any of the processed files. +<LI CLASS="li-itemize"><TT>group=foo</TT> - will add this patch to the named group. If this is not +specified then a unique group is created to contain just the current patch. +When all files specified in the command line have been patched, an error +message is generated for all groups for whom no member patch was used. We use +this mechanism to receive notice when the patch triggers are out-dated with +respect to the new include files. +<LI CLASS="li-itemize"><TT>system=sysname</TT> - will only consider this pattern on a given +operating system. The “sysname” is reported by the “$Ô” variable in +Perl, except that Windows is always considered to have sysname +“cygwin.” For Linux use “linux” (capitalization matters). +<LI CLASS="li-itemize"><TT>ateof</TT> - In this case the patterns are ignored and the replacement +text is placed at the end of the patched file. Use the <TT>file</TT> flag if you +want to restrict the files in which this replacement is performed. +<LI CLASS="li-itemize"><TT>atsof</TT> - The patterns are ignored and the replacement text is placed +at the start of the patched file. Uf the <TT>file</TT> flag to restrict the +application of this patch to a certain file. +<LI CLASS="li-itemize"><TT>disabled</TT> - Use this flag if you want to disable the pattern. +</UL> +The patterns can consist of several groups of lines separated by the <TT>|||</TT> +marker. Each of these group of lines is a multi-line pattern that if found in +the file will be replaced with the text given at the end of the block. <BR> +<BR> +The matching is space-insensitive.<BR> +<BR> +All of the markers <TT><<<</TT>, <TT>|||</TT>, <TT>===</TT> and <TT>>>></TT> must appear at the +beginning of a line but they can be followed by arbitrary text (which is +ignored).<BR> +<BR> +The replacement text can contain the special keyword <TT>@__pattern__@</TT>, +which is substituted with the pattern that matched. <BR> +<BR> +<HR> +<A HREF="merger.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> +<A HREF="ciltoc.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A> +<A HREF="cil015.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> +</BODY> +</HTML> diff --git a/cil/doc/previous_motif.gif b/cil/doc/previous_motif.gif Binary files differnew file mode 100644 index 0000000..8c8a3e6 --- /dev/null +++ b/cil/doc/previous_motif.gif |