Documentation and examples improvements


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51739 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/llvmc2/doc/LLVMC-Reference.rst b/tools/llvmc2/doc/LLVMC-Reference.rst
index 8c7dd59..18ebf0d 100644
--- a/tools/llvmc2/doc/LLVMC-Reference.rst
+++ b/tools/llvmc2/doc/LLVMC-Reference.rst
@@ -125,15 +125,31 @@
 ``gsview`` installed for this to work properly.
 
 
-The 'case' construct
---------------------
+The 'case' expression
+---------------------
 
-The 'case' construct can be used to calculate weights for optional
+The 'case' construct can be used to calculate weights of the optional
 edges and to choose between several alternative command line strings
 in the ``cmd_line`` tool property. It is designed after the
-similarly-named construct in functional languages and takes the
-form ``(case (test_1), statement_1, (test_2), statement_2,
-... (test_N), statement_N)``.
+similarly-named construct in functional languages and takes the form
+``(case (test_1), statement_1, (test_2), statement_2, ... (test_N),
+statement_N)``. The statements are evaluated only if the corresponding
+tests evaluate to true.
+
+Examples::
+
+    // Increases edge weight by 5 if "-A" is provided on the
+    // command-line, and by 5 more if "-B" is also provided.
+    (case
+        (switch_on "A"), (inc_weight 5),
+        (switch_on "B"), (inc_weight 5))
+
+    // Evaluates to "cmdline1" if option "-A" is provided on the
+    // command line, otherwise to "cmdline2"
+    (case
+        (switch_on "A"), ("cmdline1"),
+        (default), ("cmdline2"))
+
 
 * Possible tests are:
 
@@ -153,7 +169,8 @@
     belongs to the current input language set. Example:
     ```(input_languages_contain "c++")``.
 
-  - ``default`` - Always evaluates to true. Should be used
+  - ``default`` - Always evaluates to true. Should always be the last
+    test in the ``case`` expression.
 
   - ``and`` - A standard logical combinator that returns true iff all
     of its arguments return true. Used like this: ``(and (test1),
diff --git a/tools/llvmc2/doc/LLVMC-Tutorial.rst b/tools/llvmc2/doc/LLVMC-Tutorial.rst
index 63b6de3..eed6a5e 100644
--- a/tools/llvmc2/doc/LLVMC-Tutorial.rst
+++ b/tools/llvmc2/doc/LLVMC-Tutorial.rst
@@ -64,8 +64,8 @@
 in this graph are tools, and edges signify that there is a
 transformation path between two tools (for example, assembly source
 produced by the compiler can be transformed into executable code by an
-assembler). A special node named ``root`` is used to mark graph entry
-points.
+assembler). A special node named ``root`` is used to mark the graph
+entry points.
 
 Tool descriptions are basically lists of properties: most properties
 in the example above should be self-explanatory; the ``sink`` property
diff --git a/tools/llvmc2/doc/Makefile b/tools/llvmc2/doc/Makefile
new file mode 100644
index 0000000..71441a9
--- /dev/null
+++ b/tools/llvmc2/doc/Makefile
@@ -0,0 +1,13 @@
+
+RST2HTML=rst2html
+
+all : LLVMC-Reference.html LLVMC-Tutorial.html
+
+LLVMC-Tutorial.html : LLVMC-Tutorial.rst
+	$(RST2HTML) $< $@
+
+LLVMC-Reference.html : LLVMC-Reference.rst
+	$(RST2HTML) $< $@
+
+clean :
+	rm *.html