Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
| 2 | "http://www.w3.org/TR/html4/strict.dtd">
|
Kevin | aef89fc | 2007-10-06 01:28:23 +0000 | [diff] [blame] | 3 | <html>
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 4 | <head>
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 5 | <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
| 6 | <title>Clang - Get Involved</title>
|
| 7 | <link type="text/css" rel="stylesheet" href="menu.css" />
|
| 8 | <link type="text/css" rel="stylesheet" href="content.css" />
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 9 | </head>
|
| 10 | <body>
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 11 |
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 12 | <!--#include virtual="menu.html.incl"-->
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 13 |
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 14 | <div id="content">
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 15 |
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 16 | <h1>Getting Involved</h1>
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 17 |
|
| 18 | <p>There are many tasks that are open to new developers who want to get involved
|
| 19 | with the Clang project. Below, you will find details on how to get started with
|
| 20 | Clang, plus a few tasks that we need help with.</p>
|
| 21 |
|
| 22 | <p>Please note that the information provided here is not completely thorough.
|
| 23 | This is intentional. If you plan to work on Clang, we would like you to get
|
| 24 | involved with the other developers. This will allow us to work together better
|
| 25 | and will give you a better feel for how things are done.</p>
|
| 26 |
|
| 27 | <p>You can talk with other developers at the following mailing list: <a
|
| 28 | href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">cfe-dev mailing
|
| 29 | list</a>. The clang mailing list is a very friendly place. You can see the
|
| 30 | archives for records of past discussion. Note that a significant amount of
|
| 31 | design discussion takes place on the <a
|
| 32 | href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">cfe-commits mailing
|
| 33 | list</a>. </p>
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 34 |
|
| 35 | <h2>Getting Started</h2>
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 36 |
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 37 | <h3>A word of warning</h3>
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 38 |
|
| 39 | <p>While this work aims to provide a fully functional C/C++/ObjC front-end, it
|
| 40 | is <em>still very early work</em> and is under heavy development. In particular,
|
| 41 | there is no real C++ support yet (this is obviously a big project), and C/ObjC
|
| 42 | support is still missing some features. Some of the more notable missing pieces
|
| 43 | of C support are:</p>
|
| 44 |
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 45 | <ol>
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 46 | <li>The semantic analyzer does not produce all of the warnings and errors it
|
| 47 | should.</li>
|
| 48 | <li>The LLVM code generator is still very early on. It does not support many
|
| 49 | important things, like any support for structs and unions. That said, it
|
| 50 | does handle scalar operations and vectors. clang is not ready to be used
|
| 51 | as a general purpose C code generator yet.</li>
|
| 52 | <li>We don't consider the API to be stable yet, and reserve the right to
|
| 53 | change fundamental things. :)</li>
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 54 | </ol>
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 55 |
|
| 56 | <p>Our plan is to continue chipping away at these issues until C works really
|
| 57 | well, but we'd love help from other interested contributors.</p>
|
Chris Lattner | a08ee28 | 2007-10-06 05:42:47 +0000 | [diff] [blame] | 58 |
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 59 | <h3>Follow what's going on</h3>
|
Chris Lattner | a08ee28 | 2007-10-06 05:42:47 +0000 | [diff] [blame] | 60 |
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 61 | <p>Clang is a subproject of the <a href="http://llvm.org">LLVM Project</a>, but
|
| 62 | has its own mailing lists because the communities have people with different
|
Chris Lattner | a08ee28 | 2007-10-06 05:42:47 +0000 | [diff] [blame] | 63 | interests. If you are interested in clang only, these two lists should be all
|
| 64 | you need. If you are interested in the LLVM optimizer and code generator,
|
| 65 | please consider signing up for <a
|
| 66 | href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">llvmdev</a> and <a
|
| 67 | href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">llvm-commits</a>
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 68 | as well.</p>
|
| 69 |
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 70 | <ul>
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 71 | <li><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">cfe-commits
|
| 72 | </a> - This list is for patch submission/discussion.</li>
|
| 73 |
|
| 74 | <li><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">cfe-dev</a> -
|
| 75 | This list is for everything else clang related.</li>
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 76 | </ul>
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 77 |
|
| 78 | <h3><a name="build">Building clang / working with the code</a></h3>
|
| 79 |
|
| 80 | <p>If you would like to check out and build the project, the current scheme
|
| 81 | is:</p>
|
Ted Kremenek | 2722622 | 2007-10-31 15:31:24 +0000 | [diff] [blame] | 82 |
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 83 | <ol>
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 84 | <li><a href="http://www.llvm.org/docs/GettingStarted.html#checkout">Checkout
|
| 85 | and build LLVM</a> from SVN head:</li>
|
| 86 |
|
| 87 | <ul>
|
| 88 | <li><tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
|
| 89 | <li><tt>cd llvm</tt></li>
|
| 90 | <li><tt>./configure; make</tt></li>
|
| 91 | </ul>
|
| 92 | <li>Checkout clang:</li>
|
| 93 | <ul>
|
| 94 | <li>From within the <tt>llvm</tt> directory (where you
|
| 95 | built llvm):</li>
|
| 96 | <li><tt>cd llvm/tools</tt>
|
| 97 | <li><tt>svn co
|
| 98 | http://llvm.org/svn/llvm-project/cfe/trunk clang</tt></li>
|
| 99 |
|
| 100 | </ul>
|
| 101 | <li>Non-mac users: Paths to system header files are currently hard coded
|
| 102 | into clang; as a result, if clang can't find your system headers,
|
| 103 | please follow these instructions:</li>
|
| 104 |
|
| 105 | <ul>
|
| 106 | <li>'<tt>touch empty.c; gcc -v empty.c -fsyntax-only</tt>' to get the
|
| 107 | path.</li>
|
| 108 | <li>Look for the comment "FIXME: temporary hack:
|
| 109 | hard-coded paths" in <tt>clang/Driver/clang.cpp</tt> and
|
| 110 | change the lines below to include that path.</li>
|
| 111 | </ul>
|
| 112 |
|
| 113 | <li>Build clang:</li>
|
| 114 | <ul>
|
| 115 | <li><tt>cd clang</tt> (assuming that you are in <tt>llvm/tools</tt>)</li>
|
| 116 | <li><tt>make</tt></li>
|
| 117 | </ul>
|
| 118 |
|
| 119 | <li>Try it out (assuming you add llvm/Debug/bin to your path):</li>
|
| 120 | <ul>
|
| 121 | <li><tt>clang --help</tt></li>
|
| 122 | <li><tt>clang file.c -fsyntax-only</tt> (check for correctness)</li>
|
| 123 | <li><tt>clang file.c -ast-dump</tt> (internal debug dump of ast)</li>
|
| 124 | <li><tt>clang file.c -ast-view</tt> (<a
|
| 125 | href="http://llvm.org/docs/ProgrammersManual.html#ViewGraph">set up graphviz
|
| 126 | and rebuild llvm first</a>)</li>
|
| 127 | <li><tt>clang file.c -emit-llvm</tt> (print out unoptimized llvm code)</li>
|
| 128 | <li><tt>clang file.c -emit-llvm | llvm-as | opt -std-compile-opts |
|
| 129 | llvm-dis</tt> (print out optimized llvm code)</li>
|
| 130 | <li><tt>clang file.c -emit-llvm | llvm-as | opt -std-compile-opts | llc
|
| 131 | > file.s</tt> (output native machine code)</li>
|
| 132 | </ul>
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 133 | </ol>
|
Ted Kremenek | 2722622 | 2007-10-31 15:31:24 +0000 | [diff] [blame] | 134 |
|
| 135 | <p>Note that the C front-end uses LLVM, but does not depend on
|
| 136 | llvm-gcc. If you encounter problems with building clang, make
|
| 137 | sure you have the latest SVN version of LLVM. LLVM contains
|
| 138 | support libraries for clang that will be updated as well as
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 139 | development on clang progresses.</p>
|
| 140 |
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 141 | <h3>Examples of using clang</h3>
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 142 |
|
| 143 | <p>The clang driver takes a lot of GCC compatible options, which you can see
|
| 144 | with 'clang --help'. Here are a few examples:</p>
|
| 145 | <!-- Thanks to
|
| 146 | http://shiflett.org/blog/2006/oct/formatting-and-highlighting-php-code-listings
|
| 147 | Site suggested using pre in CSS, but doesn't work in IE, so went for the <pre>
|
| 148 | tag. -->
|
| 149 |
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 150 | <pre class="code">
|
| 151 | $ cat ~/t.c
|
| 152 |
|
| 153 | typedef float V __attribute__((vector_size(16)));
|
| 154 | V foo(V a, V b) { return a+b*a; }
|
| 155 |
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 156 | Preprocessing:
|
| 157 | $ clang ~/t.c -E
|
| 158 | # 1 "/Users/sabre/t.c" 1
|
| 159 |
|
| 160 | typedef float V __attribute__((vector_size(16)));
|
| 161 |
|
| 162 | V foo(V a, V b) { return a+b*a; }
|
| 163 |
|
| 164 |
|
| 165 | Type checking:
|
| 166 | $ clang -fsyntax-only ~/t.c
|
| 167 |
|
| 168 |
|
| 169 | GCC options:
|
| 170 | $ clang -fsyntax-only ~/t.c -pedantic
|
| 171 | /Users/sabre/t.c:2:17: warning: extension used
|
| 172 | typedef float V __attribute__((vector_size(16)));
|
Chris Lattner | a08ee28 | 2007-10-06 05:42:47 +0000 | [diff] [blame] | 173 | ^
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 174 | 1 diagnostic generated.
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 | Pretty printing from the AST:
|
Chris Lattner | ae3758d | 2007-10-11 00:38:03 +0000 | [diff] [blame] | 179 | $ clang ~/t.c -ast-print
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 180 | typedef float V __attribute__(( vector_size(16) ));
|
| 181 |
|
| 182 | V foo(V a, V b) {
|
| 183 | return a + b * a;
|
| 184 | }
|
| 185 |
|
| 186 |
|
| 187 | LLVM code generation:
|
| 188 | $ clang ~/t.c -emit-llvm | llvm-as | opt -std-compile-opts | llvm-dis
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 189 | define <4 x float> @foo(<4 x float> %a, <4 x float> %b) {
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 190 | entry:
|
Chris Lattner | de9a4f5 | 2007-12-13 05:42:27 +0000 | [diff] [blame^] | 191 | %mul = mul <4 x float> %b, %a
|
| 192 | %add = add <4 x float> %mul, %a
|
| 193 | ret <4 x float> %add
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 194 | }
|
| 195 | $ clang ~/t.c -emit-llvm | llvm-as | opt -std-compile-opts | llc -
|
| 196 | march=ppc32 -mcpu=g5
|
| 197 | ..
|
| 198 | _foo:
|
| 199 | vmaddfp v2, v3, v2, v2
|
| 200 | blr
|
| 201 | $ clang ~/t.c -emit-llvm | llvm-as | opt -std-compile-opts | llc -
|
| 202 | march=x86 -mcpu=yonah
|
| 203 | ..
|
| 204 | _foo:
|
| 205 | mulps %xmm0, %xmm1
|
| 206 | addps %xmm0, %xmm1
|
| 207 | movaps %xmm1, %xmm0
|
| 208 | ret
|
| 209 | </pre>
|
| 210 | <h2>Available tasks</h2>
|
| 211 | Here are a few tasks that are currently available for newcomers to work on:
|
| 212 |
|
Chris Lattner | a08ee28 | 2007-10-06 05:42:47 +0000 | [diff] [blame] | 213 | <ul>
|
| 214 | <li>None yet, ask on cfe-dev</li>
|
| 215 | </ul>
|
Kevin | bc8e50f | 2007-10-05 21:18:52 +0000 | [diff] [blame] | 216 | </div>
|
| 217 | </body>
|
Chris Lattner | ae3758d | 2007-10-11 00:38:03 +0000 | [diff] [blame] | 218 | </html>
|