]> granicus.if.org Git - clang/commitdiff
De-^Mify file.
authorEric Christopher <echristo@apple.com>
Fri, 8 Feb 2008 06:45:49 +0000 (06:45 +0000)
committerEric Christopher <echristo@apple.com>
Fri, 8 Feb 2008 06:45:49 +0000 (06:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46879 91177308-0d34-0410-b5e6-96231b3b80d8

www/get_started.html

index cd2c84a60068415f532f701bba788f9972ad95a4..47909aba63f0f10d3dcfef273ee8f2c146e8ba97 100644 (file)
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"\r
-          "http://www.w3.org/TR/html4/strict.dtd">\r
-<html>\r
-<head>\r
-  <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />\r
-  <title>Clang - Getting Started</title>\r
-  <link type="text/css" rel="stylesheet" href="menu.css" />\r
-  <link type="text/css" rel="stylesheet" href="content.css" />\r
-</head>\r
-<body>\r
-\r
-<!--#include virtual="menu.html.incl"-->\r
-\r
-<div id="content">\r
-\r
-<h1>Getting Started: Building and Running Clang</h1>\r
-\r
-\r
-<p>This page gives you the shortest path to checking out clang and demos a few\r
-options.  This should get you up and running with the minimum of muss and fuss.\r
-If you like what you see, please consider <a href="get_involved.html">getting\r
-involved</a> with the clang community.</p>\r
-\r
-\r
-<h2>A word of warning</h2>\r
-\r
-<p>While this work aims to provide a fully functional C/C++/ObjC front-end, it\r
-is <em>still very early work</em> and is under heavy development. In particular,\r
-there is no real C++ support yet (this is obviously a big project), and C/ObjC\r
-support is still missing some features. Some of the more notable missing pieces\r
-of C support are:</p>\r
-\r
-<ol>\r
-  <li>The semantic analyzer does not produce all of the warnings and errors it\r
-      should.</li>\r
-  <li>The LLVM code generator is still missing important features.  clang is not\r
-      ready to be used as a general purpose C code generator yet, but if you\r
-      hit problems and report them to cfe-dev, we'll fix them :).</li>\r
-  <li>We don't consider the API to be stable yet, and reserve the right to\r
-      change fundamental things.</li>\r
-</ol>\r
-\r
-<p>Our plan is to continue chipping away at these issues until C works really\r
-well, but we'd love help from other interested contributors.  We expect C to be\r
-in good shape by mid to late 2008.</p>\r
-\r
-<h3><a name="build">Building clang / working with the code</a></h3>\r
-\r
-<p>If you would like to check out and build the project, the current scheme\r
-is:</p>\r
-\r
-<ol>\r
-  <li><a href="http://www.llvm.org/docs/GettingStarted.html#checkout">Checkout\r
-   and build LLVM</a> from SVN head:</li>\r
-  \r
-  <ul>\r
-    <li><tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>\r
-    <li><tt>cd llvm</tt></li>\r
-    <li><tt>./configure; make</tt></li>\r
-  </ul>\r
-  <li>Checkout clang:</li>\r
-  <ul>\r
-     <li>From within the <tt>llvm</tt> directory (where you\r
-     built llvm):</li>\r
-     <li><tt>cd llvm/tools</tt>\r
-     <li><tt>svn co http://llvm.org/svn/llvm-project/cfe/trunk clang</tt></li>\r
-     \r
-  </ul>\r
-  <li>Non-mac users: Paths to system header files are currently hard coded\r
-      into clang; as a result, if clang can't find your system headers,\r
-      please follow these instructions:</li>\r
-      \r
-  <ul>\r
-    <li>'<tt>touch empty.c; gcc -v empty.c -fsyntax-only</tt>' to get the \r
-    path.</li>\r
-    <li>Look for the comment "FIXME: temporary hack:\r
-    hard-coded paths" in <tt>clang/Driver/clang.cpp</tt> and\r
-    change the lines below to include that path.</li>\r
-  </ul>\r
-  \r
-  <li>Build clang:</li>\r
-  <ul>\r
-    <li><tt>cd clang</tt> (assuming that you are in <tt>llvm/tools</tt>)</li>\r
-    <li><tt>make</tt> (this will give you a debug build)</li>\r
-  </ul>\r
-  \r
-  <li>Try it out (assuming you add llvm/Debug/bin to your path):</li>\r
-  <ul>\r
-    <li><tt>clang --help</tt></li>\r
-    <li><tt>clang file.c -fsyntax-only</tt> (check for correctness)</li>\r
-    <li><tt>clang file.c -ast-dump</tt> (internal debug dump of ast)</li>\r
-    <li><tt>clang file.c -ast-view</tt> (<a \r
-    href="http://llvm.org/docs/ProgrammersManual.html#ViewGraph">set up graphviz\r
-     and rebuild llvm first</a>)</li>\r
-    <li><tt>clang file.c -emit-llvm</tt> (print out unoptimized llvm code)</li>\r
-    <li><tt>clang file.c -emit-llvm | llvm-as | opt -std-compile-opts | \r
-         llvm-dis</tt> (print out optimized llvm code)</li>\r
-    <li><tt>clang file.c -emit-llvm | llvm-as | opt -std-compile-opts | llc\r
-         &gt; file.s</tt> (output native machine code)</li>\r
-  </ul>\r
-</ol>\r
-\r
-<p>Note that the C front-end uses LLVM, but does not depend on\r
-  llvm-gcc.  If you encounter problems with building clang, make\r
-  sure you have the latest SVN version of LLVM.  LLVM contains\r
-  support libraries for clang that will be updated as well as\r
-  development on clang progresses.</p>\r
-  \r
-<h3>Examples of using clang</h3>\r
-\r
-<p>The clang driver takes a lot of GCC compatible options, which you can see\r
-with 'clang --help'. Here are a few examples:</p>\r
-<!-- Thanks to\r
- http://shiflett.org/blog/2006/oct/formatting-and-highlighting-php-code-listings\r
-Site suggested using pre in CSS, but doesn't work in IE, so went for the <pre>\r
-tag. -->\r
-\r
-<pre class="code">\r
-$ <b>cat ~/t.c</b>\r
-typedef float V __attribute__((vector_size(16)));\r
-V foo(V a, V b) { return a+b*a; }\r
-</pre>\r
-\r
-\r
-<h4>Preprocessing:</h4>\r
-\r
-<pre class="code">\r
-$ <b>clang ~/t.c -E</b>\r
-# 1 "/Users/sabre/t.c" 1\r
-\r
-typedef float V __attribute__((vector_size(16)));\r
-\r
-V foo(V a, V b) { return a+b*a; }\r
-</pre>\r
-\r
-\r
-<h4>Type checking:</h4>\r
-\r
-<pre class="code">\r
-$ <b>clang -fsyntax-only ~/t.c</b>\r
-</pre>\r
-\r
-\r
-<h4>GCC options:</h4>\r
-\r
-<pre class="code">\r
-$ <b>clang -fsyntax-only ~/t.c -pedantic</b>\r
-/Users/sabre/t.c:2:17: warning: extension used\r
-typedef float V __attribute__((vector_size(16)));\r
-                ^\r
-1 diagnostic generated.\r
-</pre>\r
-\r
-\r
-<h4>Pretty printing from the AST:</h4>\r
-\r
-<pre class="code">\r
-$ <b>clang ~/t.c -ast-print</b>\r
-typedef float V __attribute__(( vector_size(16) ));\r
-V foo(V a, V b) {\r
-   return a + b * a;\r
-}\r
-</pre>\r
-\r
-\r
-<h4>Code generation with LLVM:</h4>\r
-\r
-<pre class="code">\r
-$ <b>clang ~/t.c -emit-llvm | llvm-as | opt -std-compile-opts | llvm-dis</b>\r
-define &lt;4 x float&gt; @foo(&lt;4 x float&gt; %a, &lt;4 x float&gt; %b) {\r
-entry:\r
-         %mul = mul &lt;4 x float&gt; %b, %a\r
-         %add = add &lt;4 x float&gt; %mul, %a\r
-         ret &lt;4 x float&gt; %add\r
-}\r
-$ <b>clang ~/t.c -emit-llvm | llvm-as | opt -std-compile-opts | llc -march=ppc32 -mcpu=g5</b>\r
-..\r
-_foo:\r
-         vmaddfp v2, v3, v2, v2\r
-         blr\r
-$ <b>clang ~/t.c -emit-llvm | llvm-as | opt -std-compile-opts | llc -march=x86 -mcpu=yonah</b>\r
-..\r
-_foo:\r
-         mulps %xmm0, %xmm1\r
-         addps %xmm0, %xmm1\r
-         movaps %xmm1, %xmm0\r
-         ret\r
-</pre>\r
-\r
-<h3>GCC "Emulation" Driver</h3>\r
-\r
-While the <tt>clang</tt> executable is a compiler driver that can perform code\r
-generation, program analysis, and other actions, it is not designed to be a\r
-drop-in replacement for GCC's <tt>cc</tt>. There is interest in developing such\r
-a driver for clang, but in the interim the clang source tree includes a Python\r
-script <tt>ccc</tt> in the <tt>utils</tt> subdirectory that provides some of\r
-this functionality (the script is intended to be used where GCC's <tt>cc</tt>\r
-could be used). It is currently a work in progress, and eventually will likely\r
-be replaced by a more complete driver.\r
-\r
-<p>Example use:</p>\r
-\r
-<pre class="code">\r
-$ <b>ccc t.c</b>\r
-clang -emit-llvm-bc -o t.o -U__GNUC__ t.c\r
-llvm-ld -native -o a.out t.o\r
-$ <b>ls</b>\r
-a.out a.out.bc t.c t.o\r
-</pre>\r
-  \r
-\r
-\r
-\r
-</div>\r
-</body>\r
-</html>\r
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+          "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+  <title>Clang - Getting Started</title>
+  <link type="text/css" rel="stylesheet" href="menu.css" />
+  <link type="text/css" rel="stylesheet" href="content.css" />
+</head>
+<body>
+
+<!--#include virtual="menu.html.incl"-->
+
+<div id="content">
+
+<h1>Getting Started: Building and Running Clang</h1>
+
+
+<p>This page gives you the shortest path to checking out clang and demos a few
+options.  This should get you up and running with the minimum of muss and fuss.
+If you like what you see, please consider <a href="get_involved.html">getting
+involved</a> with the clang community.</p>
+
+
+<h2>A word of warning</h2>
+
+<p>While this work aims to provide a fully functional C/C++/ObjC front-end, it
+is <em>still very early work</em> and is under heavy development. In particular,
+there is no real C++ support yet (this is obviously a big project), and C/ObjC
+support is still missing some features. Some of the more notable missing pieces
+of C support are:</p>
+
+<ol>
+  <li>The semantic analyzer does not produce all of the warnings and errors it
+      should.</li>
+  <li>The LLVM code generator is still missing important features.  clang is not
+      ready to be used as a general purpose C code generator yet, but if you
+      hit problems and report them to cfe-dev, we'll fix them :).</li>
+  <li>We don't consider the API to be stable yet, and reserve the right to
+      change fundamental things.</li>
+</ol>
+
+<p>Our plan is to continue chipping away at these issues until C works really
+well, but we'd love help from other interested contributors.  We expect C to be
+in good shape by mid to late 2008.</p>
+
+<h3><a name="build">Building clang / working with the code</a></h3>
+
+<p>If you would like to check out and build the project, the current scheme
+is:</p>
+
+<ol>
+  <li><a href="http://www.llvm.org/docs/GettingStarted.html#checkout">Checkout
+   and build LLVM</a> from SVN head:</li>
+
+  <ul>
+    <li><tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
+    <li><tt>cd llvm</tt></li>
+    <li><tt>./configure; make</tt></li>
+  </ul>
+  <li>Checkout clang:</li>
+  <ul>
+     <li>From within the <tt>llvm</tt> directory (where you
+     built llvm):</li>
+     <li><tt>cd llvm/tools</tt>
+     <li><tt>svn co http://llvm.org/svn/llvm-project/cfe/trunk clang</tt></li>
+
+  </ul>
+  <li>Non-mac users: Paths to system header files are currently hard coded
+      into clang; as a result, if clang can't find your system headers,
+      please follow these instructions:</li>
+
+  <ul>
+    <li>'<tt>touch empty.c; gcc -v empty.c -fsyntax-only</tt>' to get the
+    path.</li>
+    <li>Look for the comment "FIXME: temporary hack:
+    hard-coded paths" in <tt>clang/Driver/clang.cpp</tt> and
+    change the lines below to include that path.</li>
+  </ul>
+
+  <li>Build clang:</li>
+  <ul>
+    <li><tt>cd clang</tt> (assuming that you are in <tt>llvm/tools</tt>)</li>
+    <li><tt>make</tt> (this will give you a debug build)</li>
+  </ul>
+
+  <li>Try it out (assuming you add llvm/Debug/bin to your path):</li>
+  <ul>
+    <li><tt>clang --help</tt></li>
+    <li><tt>clang file.c -fsyntax-only</tt> (check for correctness)</li>
+    <li><tt>clang file.c -ast-dump</tt> (internal debug dump of ast)</li>
+    <li><tt>clang file.c -ast-view</tt> (<a
+    href="http://llvm.org/docs/ProgrammersManual.html#ViewGraph">set up graphviz
+     and rebuild llvm first</a>)</li>
+    <li><tt>clang file.c -emit-llvm</tt> (print out unoptimized llvm code)</li>
+    <li><tt>clang file.c -emit-llvm | llvm-as | opt -std-compile-opts |
+         llvm-dis</tt> (print out optimized llvm code)</li>
+    <li><tt>clang file.c -emit-llvm | llvm-as | opt -std-compile-opts | llc
+         &gt; file.s</tt> (output native machine code)</li>
+  </ul>
+</ol>
+
+<p>Note that the C front-end uses LLVM, but does not depend on
+  llvm-gcc.  If you encounter problems with building clang, make
+  sure you have the latest SVN version of LLVM.  LLVM contains
+  support libraries for clang that will be updated as well as
+  development on clang progresses.</p>
+
+<h3>Examples of using clang</h3>
+
+<p>The clang driver takes a lot of GCC compatible options, which you can see
+with 'clang --help'. Here are a few examples:</p>
+<!-- Thanks to
+ http://shiflett.org/blog/2006/oct/formatting-and-highlighting-php-code-listings
+Site suggested using pre in CSS, but doesn't work in IE, so went for the <pre>
+tag. -->
+
+<pre class="code">
+$ <b>cat ~/t.c</b>
+typedef float V __attribute__((vector_size(16)));
+V foo(V a, V b) { return a+b*a; }
+</pre>
+
+
+<h4>Preprocessing:</h4>
+
+<pre class="code">
+$ <b>clang ~/t.c -E</b>
+# 1 "/Users/sabre/t.c" 1
+
+typedef float V __attribute__((vector_size(16)));
+
+V foo(V a, V b) { return a+b*a; }
+</pre>
+
+
+<h4>Type checking:</h4>
+
+<pre class="code">
+$ <b>clang -fsyntax-only ~/t.c</b>
+</pre>
+
+
+<h4>GCC options:</h4>
+
+<pre class="code">
+$ <b>clang -fsyntax-only ~/t.c -pedantic</b>
+/Users/sabre/t.c:2:17: warning: extension used
+typedef float V __attribute__((vector_size(16)));
+                ^
+1 diagnostic generated.
+</pre>
+
+
+<h4>Pretty printing from the AST:</h4>
+
+<pre class="code">
+$ <b>clang ~/t.c -ast-print</b>
+typedef float V __attribute__(( vector_size(16) ));
+V foo(V a, V b) {
+   return a + b * a;
+}
+</pre>
+
+
+<h4>Code generation with LLVM:</h4>
+
+<pre class="code">
+$ <b>clang ~/t.c -emit-llvm | llvm-as | opt -std-compile-opts | llvm-dis</b>
+define &lt;4 x float&gt; @foo(&lt;4 x float&gt; %a, &lt;4 x float&gt; %b) {
+entry:
+         %mul = mul &lt;4 x float&gt; %b, %a
+         %add = add &lt;4 x float&gt; %mul, %a
+         ret &lt;4 x float&gt; %add
+}
+$ <b>clang ~/t.c -emit-llvm | llvm-as | opt -std-compile-opts | llc -march=ppc32 -mcpu=g5</b>
+..
+_foo:
+         vmaddfp v2, v3, v2, v2
+         blr
+$ <b>clang ~/t.c -emit-llvm | llvm-as | opt -std-compile-opts | llc -march=x86 -mcpu=yonah</b>
+..
+_foo:
+         mulps %xmm0, %xmm1
+         addps %xmm0, %xmm1
+         movaps %xmm1, %xmm0
+         ret
+</pre>
+
+<h3>GCC "Emulation" Driver</h3>
+
+While the <tt>clang</tt> executable is a compiler driver that can perform code
+generation, program analysis, and other actions, it is not designed to be a
+drop-in replacement for GCC's <tt>cc</tt>. There is interest in developing such
+a driver for clang, but in the interim the clang source tree includes a Python
+script <tt>ccc</tt> in the <tt>utils</tt> subdirectory that provides some of
+this functionality (the script is intended to be used where GCC's <tt>cc</tt>
+could be used). It is currently a work in progress, and eventually will likely
+be replaced by a more complete driver.
+
+<p>Example use:</p>
+
+<pre class="code">
+$ <b>ccc t.c</b>
+clang -emit-llvm-bc -o t.o -U__GNUC__ t.c
+llvm-ld -native -o a.out t.o
+$ <b>ls</b>
+a.out a.out.bc t.c t.o
+</pre>
+
+
+
+
+</div>
+</body>
+</html>