Update README for llvm-rs-cc..

BUG=3348577

Change-Id: I6da544666e2009488f475fb340f9a8e6a0e1e559
diff --git a/README.html b/README.html
index 7c34008..4ace7c6 100644
--- a/README.html
+++ b/README.html
@@ -4,7 +4,7 @@
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
-<title>llvm-rs-cc: Compiler for ScriptC language</title>
+<title>llvm-rs-cc: Compiler for Renderscript language</title>
 <style type="text/css">
 
 /*
@@ -304,13 +304,13 @@
 </style>
 </head>
 <body>
-<div class="document" id="llvm-rs-cc-compiler-for-scriptc-language">
-<h1 class="title">llvm-rs-cc: Compiler for ScriptC language</h1>
+<div class="document" id="llvm-rs-cc-compiler-for-renderscript-language">
+<h1 class="title">llvm-rs-cc: Compiler for Renderscript language</h1>
 
 <div class="section" id="introduction">
 <h1>Introduction</h1>
-<p>llvm-rs-cc compiles a program in the ScriptC language to generate the
-following files.</p>
+<p>llvm-rs-cc compiles a program in the Renderscript language to generate the
+following files:</p>
 <ul class="simple">
 <li>Bitcode file. Note that the bitcode here denotes the LLVM (Low-Level
 Virtual Machine) bitcode representation, which will be consumed on
@@ -320,13 +320,13 @@
 <li>Reflected APIs for Java. As a result, Android's Java developers can
 invoke those APIs from their code.</li>
 </ul>
-<p>Note that although ScriptC is C99-like, we enhance it with several
+<p>Note that although Renderscript is C99-like, we enhance it with several
 distinct, effective features for Android programming. We will use
-example usage below to illustrate these features.</p>
-<p>llvm-rs-cc is being run on a host and is highly-optimizing. As a
-result, libbcc on the device can be lightweight and focus on
-machine-dependent code generation given some bitcode.</p>
-<p>llvm-rs-cc is a driver on top of libslang. The archictecture of
+some examples to illustrate these features.</p>
+<p>llvm-rs-cc is run on the host and performs many aggressive optimizations.
+As a result, libbcc on the device can be lightweight and focus on
+machine-dependent code generation for some input bitcode.</p>
+<p>llvm-rs-cc is a driver on top of libslang. The architecture of
 libslang and libbcc is depicted in the following figure:</p>
 <pre class="literal-block">
 libslang   libbcc
@@ -345,13 +345,13 @@
 <p>The option <em>-p</em> denotes the directory for outputting the reflected Java files.</p>
 </li>
 <li><p class="first"><em>-d $(PRIVATE_RS_OUTPUT_DIR)</em></p>
-<p>This option <em>-d</em> sets the directory for writing dependences.</p>
+<p>This option <em>-d</em> sets the directory for writing dependence information.</p>
 </li>
 <li><p class="first"><em>-MD</em></p>
-<p>Note that <em>-MD</em> will tell llvm-rs-cc to output dependences.</p>
+<p>Note that <em>-MD</em> will tell llvm-rs-cc to output dependence information.</p>
 </li>
-<li><p class="first"><em>-a</em></p>
-<p>Specifies additional dependence target.</p>
+<li><p class="first"><em>-a $(EXTRA_TARGETS)</em></p>
+<p>Specifies additional target dependencies.</p>
 </li>
 </ul>
 </div>
@@ -361,8 +361,8 @@
 <pre class="literal-block">
 $ cd &lt;Android_Root_Directory&gt;
 </pre>
-<p>Using frameworks/base/libs/rs/java/Fountain as a simple app in both
-Java and ScriptC, we can find the following command line in the build
+<p>Using frameworks/base/tests/RenderScriptTests/Fountain as a simple app in both
+Java and Renderscript, we can find the following command line in the build
 log:</p>
 <pre class="literal-block">
 $ out/host/linux-x86/bin/llvm-rs-cc \
@@ -385,7 +385,7 @@
 </div>
 <div class="section" id="example-program-fountain-rs">
 <h1>Example Program: fountain.rs</h1>
-<p>fountain.rs is in ScriptC language, which is based on the standard
+<p>fountain.rs is in the Renderscript language, which is based on the standard
 C99. However, llvm-rs-cc goes beyond &quot;clang -std=c99&quot; and provides the
 following important features:</p>
 </div>
@@ -395,14 +395,14 @@
 <li><p class="first"><em>#pragma rs java_package_name([PACKAGE_NAME])</em></p>
 <p>The ScriptC_[SCRIPT_NAME].java has to be packaged so that Java
 developers can invoke those APIs.</p>
-<p>To do that, a ScriptC programmer should specify the package name, so
+<p>To do that, a Renderscript programmer should specify the package name, so
 that llvm-rs-cc knows the package expression and hence the directory
 for outputting ScriptC_[SCRIPT_NAME].java.</p>
 <p>In fountain.rs, we have:</p>
 <pre class="literal-block">
 #pragma rs java_package_name(com.android.fountain)
 </pre>
-<p>In ScriptC.fountain.java, we have:</p>
+<p>In ScriptC_fountain.java, we have:</p>
 <pre class="literal-block">
 package com.android.fountain
 </pre>
@@ -417,14 +417,14 @@
 </div>
 <div class="section" id="basic-reflection-export-variables-and-functions">
 <h1>2. Basic Reflection: Export Variables and Functions</h1>
-<p>llvm-rs-cc automatically export the &quot;externalizable and defined&quot; functions and
+<p>llvm-rs-cc automatically exports the &quot;externalizable and defined&quot; functions and
 variables to Android's Java side. That is, scripts are accessible from
 Java.</p>
 <p>For instance, for:</p>
 <pre class="literal-block">
 int foo = 0;
 </pre>
-<p>In ScriptC_fountain.java, llvm-rs-cc will reflect it to:</p>
+<p>In ScriptC_fountain.java, llvm-rs-cc will reflect the following methods:</p>
 <pre class="literal-block">
 void set_foo(int v)...
 
@@ -434,7 +434,7 @@
 to the functions and global variables within a script. In summary,
 global variables and functions within a script that are not declared
 static will generate get, set, or invoke methods.  This provides a way
-to set the data within a script and call to its functions.</p>
+to set the data within a script and call its functions.</p>
 <p>Take the addParticles function in fountain.rs as an example:</p>
 <pre class="literal-block">
 void addParticles(int rate, float x, float y, int index, bool newColor) {
@@ -462,20 +462,20 @@
 Point_t *point;
 </pre>
 <p>llvm-rs-cc generates one ScriptField*.java file for each user-defined
-struct. I.e., in this case llvm-rs-cc will reflect to two files,
+struct. In this case, llvm-rs-cc will reflect two files,
 ScriptC_fountain.java and ScriptField_Point.java.</p>
-<p>Note that when the type of exportable variable is struct, ScriptC
-developers should avoid anonymous structs. This is because llvm-rs-cc
-uses the struct name to name the file, instead of the typedef name.</p>
+<p>Note that when the type of an exportable variable is a structure, Renderscript
+developers should avoid using anonymous structs. This is because llvm-rs-cc
+uses the struct name to identify the file, instead of the typedef name.</p>
 <p>For the generated Java files, using ScriptC_fountain.java as an
-example we have:</p>
+example we also have:</p>
 <pre class="literal-block">
 void bind_point(ScriptField_Point v)
 </pre>
 <p>This binds your object with the allocated memory.</p>
 <p>You can bind the struct(e.g., Point), using the setter and getter
-method in ScriptField_Point.java.</p>
-<p>After binding, you could get the object from this method:</p>
+methods in ScriptField_Point.java.</p>
+<p>After binding, you can access the object with this method:</p>
 <pre class="literal-block">
 ScriptField_Point get_point()
 </pre>
@@ -515,60 +515,90 @@
 ...
 </pre>
 </div>
-<div class="section" id="summarize-the-java-reflection-above">
-<h1>4. Summarize the Java Reflection above</h1>
-<p>Let us summarize the high-level design of reflection next.</p>
+<div class="section" id="summary-of-the-java-reflection-above">
+<h1>4. Summary of the Java Reflection above</h1>
+<p>This section summarizes the high-level design of Renderscript's reflection.</p>
 <ul>
-<li><p class="first">In terms of script's global functions, they can be called from Java.
+<li><p class="first">In terms of a script's global functions, they can be called from Java.
 These calls operate asynchronously and no assumptions should be made
-upon with a function called will actually complete operation.  If it
-is necessary to wait for a function to complete the java application
-may call the runtime finish method which will wait for all the script
-threads to complete.  Two special functions also exist:</p>
-<ul class="simple">
-<li>The function <strong>init</strong> present will be called once after the script
+on whether a function called will have actually completed operation.  If it
+is necessary to wait for a function to complete, the Java application
+may call the runtime finish() method, which will wait for all the script
+threads to complete pending operations.  A few special functions can also
+exist:</p>
+<ul>
+<li><p class="first">The function <strong>init</strong> (if present) will be called once after the script
 is loaded.  This is useful to initialize data or anything else the
-script may need before it can be used.  The init may not depend on
-globals initialized from Java as it will be called before these
-can be initialized.</li>
-<li>The function <strong>root</strong> is a special function for graphics.  Which a
-script must redraw its contents this function will be called.  No
+script may need before it can be used.  The init function may not depend
+on globals initialized from Java as it will be called before these
+can be initialized. The function signature for init must be:</p>
+<pre class="literal-block">
+void init(void);
+</pre>
+</li>
+<li><p class="first">The function <strong>root</strong> is a special function for graphics.  This function
+will be called when a script must redraw its contents.  No
 assumptions should be made as to when this function will be
-called.  It will only be called if the script is bound as root.
-Also calls to this will be synchronized with data updates and
+called.  It will only be called if the script is bound as a graphics root.
+Calls to this function will be synchronized with data updates and
 other invocations from Java.  Thus the script will not change due
-to external influence during a run of <strong>root</strong>.  The return value
-indicates to the runtime if the function should be called again to
+to external influence in the middle of running <strong>root</strong>.  The return value
+indicates to the runtime when the function should be called again to
 redraw in the future.  A return value of 0 indicates that no
-redraw is necessary until something changes.  Any positive integer
-indicates a time in ms that the runtime should wait before calling
-root again to render another frame.</li>
+redraw is necessary until something changes on the Java side.  Any
+positive integer indicates a time in milliseconds that the runtime should
+wait before calling root again to render another frame.  The function
+signature for a graphics root functions is as follows:</p>
+<pre class="literal-block">
+int root(void);
+</pre>
+</li>
+<li><p class="first">It is also possible to create a purely compute-based <strong>root</strong> function.
+Such a function has the following signature:</p>
+<pre class="literal-block">
+void root(const T1 *in, T2 *out, const T3 *usrData, uint32_t x, uint32_t y);
+</pre>
+<p>T1, T2, and T3 represent any supported Renderscript type.  Any parameters
+above can be omitted, although at least one of in/out must be present.
+If both in and out are present, root must only be invoked with types of
+the same exact dimensionality (i.e. matching X and Y values for dimension).
+This root function is accessible through the Renderscript language
+construct <strong>forEach</strong>.  We also reflect a Java version to access this
+function as <strong>forEach_root</strong> (for API levels of 14+).  An example of this
+can be seen in the Android SDK sample for HelloCompute.</p>
+</li>
+<li><p class="first">The function <strong>.rs.dtor</strong> is a function that is sometimes generated by
+llvm-rs-cc.  This function cleans up any global variable that contains
+(or is) a reference counted Renderscript object type (such as an
+rs_allocation, rs_font, or rs_script).  This function will be invoked
+implicitly by the Renderscript runtime during script teardown.</p>
+</li>
 </ul>
 </li>
-<li><p class="first">In terms of script's global data, global variables can be written
-from Java.  The Java class will cache the value or object set and
+<li><p class="first">In terms of a script's global data, global variables can be written
+from Java.  The Java instance will cache the value or object set and
 provide return methods to retrieve this value.  If a script updates
 the value, this update will not propagate back to the Java class.
-Initializers if present will also initialize the cached Java value.
+Initializers, if present, will also initialize the cached Java value.
 This provides a convenient way to declare constants within a script and
-make them accessible from the java runtime.  If the script declares a
+make them accessible to the Java runtime.  If the script declares a
 variable const, only the get methods will be generated.</p>
 <p>Globals within a script are considered local to the script.  They
 cannot be accessed by other scripts and are in effect always 'static'
-in the traditional C sense.  Static here is used to control if a
-accessor is generated.  Static continues to mean <em>not
+in the traditional C sense.  Static here is used to control if
+accessors are generated.  Static continues to mean <em>not
 externally visible</em> and thus prevents the generation of
-accessors.  Globals are persistent across invocations to a script and
+accessors.  Globals are persistent across invocations of a script and
 thus may be used to hold data from run to run.</p>
 <p>Globals of two types may be reflected into the Java class.  The first
-type is basic non-pointer types.  Types defined in rs_types.rsh may be
-used.  For the non-pointer class get and set methods are generated in
+type is basic non-pointer types.  Types defined in rs_types.rsh may also be
+used.  For the non-pointer class, get and set methods are generated for
 Java.  Globals of single pointer types behave differently.  These may
 use more complex types.  Simple structures composed of the types in
 rs_types.rsh may also be used.  These globals generate bind points in
-java.  If the type is a structure they also generate a <strong>Field</strong> class
-used to pack and unpack the contents of the structure.  Binding an
-allocation to one of these bind points in Java effectively sets the
+Java.  If the type is a structure they also generate an appropriate
+<strong>Field</strong> class that is used to pack and unpack the contents of the
+structure.  Binding an allocation in Java effectively sets the
 pointer in the script.  Bind points marked const indicate to the
 runtime that the script will not modify the contents of an allocation.
 This may allow the runtime to make more effective use of threads.</p>
@@ -587,6 +617,7 @@
 <ul class="simple">
 <li><em>float sin(float);</em></li>
 <li><em>float2 sin(float2);</em></li>
+<li><em>float3 sin(float3);</em></li>
 <li><em>float4 sin(float4);</em></li>
 </ul>
 </div>