blob: e191bfec2e0ae69f188bad680b504eebd10e1f8e [file] [log] [blame]
Kevinbc8e50f2007-10-05 21:18:52 +00001<!-- Consulted: http://www.w3.org/TR/CSS1 & http://www.w3.org/TR/CSS21/ & http://www.w3.org/TR/html401/ -->
Kevinaef89fc2007-10-06 01:28:23 +00002<!-- Material used from: HTML 4.01 specs: http://www.w3.org/TR/html401/ -->
3<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4<html>
Kevinbc8e50f2007-10-05 21:18:52 +00005<head>
Kevinaef89fc2007-10-06 01:28:23 +00006 <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
Kevinbc8e50f2007-10-05 21:18:52 +00007 <title>Clang - Get Involved</title>
8 <link type="text/css" rel="stylesheet" href="menu.css" />
9 <link type="text/css" rel="stylesheet" href="content.css" />
10</head>
11<body>
12<!--#include virtual="menu.html.incl"-->
13<div id="content">
14<h1>Getting Involved</h1>
15There are many tasks that are open to new developers who want to get involved with the Clang project. Below, you will find details on how to get started with Clang, plus a few tasks that we need help with.<br>
16<br>
17Please note that the information provided here is not completely thorough. This is intentional. If you plan to work on Clang, we would like you to get involved with the other developers. This will allow us to work together better and will give you a better feel for how things are done.
Chris Lattnera08ee282007-10-06 05:42:47 +000018You can talk with other developers at the following mailing list: <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">cfe-dev mailing list</a>.
19The clang mailing list is a very friendly place. You can see the archives for records of past discussion. Note that a significant amount of design discussion takes place on the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">cfe-commits mailing list</a>.
Kevinbc8e50f2007-10-05 21:18:52 +000020
21<h2>Getting Started</h2>
22<h3>A word of warning</h3>
Chris Lattnera08ee282007-10-06 05:42:47 +000023While 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:
Kevinbc8e50f2007-10-05 21:18:52 +000024<ol>
25 <li>The semantic analyzer does not produce all of the warnings and errors it should.
Chris Lattnera08ee282007-10-06 05:42:47 +000026 <li>The LLVM code generator is still very early on. It does not support many important things, like any support for structs and unions. That said, it does handle scalar operations and vectors. clang is not ready to be used as a general purpose C code generator yet.
Kevinbc8e50f2007-10-05 21:18:52 +000027 <li>We don't consider the API to be stable yet, and reserve the right to change fundamental things :)
28</ol>
29Our plan is to continue chipping away at these issues until C works really well, but we'd love help from other interested contributors.
Chris Lattnera08ee282007-10-06 05:42:47 +000030
Kevinbc8e50f2007-10-05 21:18:52 +000031<h3>Follow what's going on</h3>
Chris Lattnera08ee282007-10-06 05:42:47 +000032
33Clang is a subproject of the <a href="http://llvm.org">LLVM Project</a>, but has
34its own mailing lists because the communities have people with different
35interests. If you are interested in clang only, these two lists should be all
36you need. If you are interested in the LLVM optimizer and code generator,
37please consider signing up for <a
38href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">llvmdev</a> and <a
39href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">llvm-commits</a>
40as well.<br>
Kevinbc8e50f2007-10-05 21:18:52 +000041<ul>
42<li><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">cfe-commits</a> - This list is for patch submission/discussion.
43<li><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">cfe-dev</a> - This list is for everything else clang related.
44</ul>
Kevin13043a42007-10-05 21:44:03 +000045<h3>Building clang / working with the code<a name="build">&nbsp;</a></h3>
Kevinbc8e50f2007-10-05 21:18:52 +000046If you would like to check out and build the project, the current scheme is:<br>
47<ol>
48 <li>Check out llvm
49 <ul>
50 <li>cd llvm/tools
51 <li>svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
52 </ul>
Chris Lattnera08ee282007-10-06 05:42:47 +000053 <li>Non-mac users: Paths to system header files are currently hard coded
54 into the tool; as a result, if clang can't find your system headers,
55 please follow these instructions:
Kevinbc8e50f2007-10-05 21:18:52 +000056 <ul>
57 <li>'touch empty.c; gcc -v empty.c -fsyntax-only' to get the path.
58 <li>change clang/Driver/clang.cpp:606 to include that path
59 </ul>
60 <li>Build llvm
61 <ul>
62 <li>cd clang
63 <li>make
64 </ul>
65</ol>
Chris Lattnera08ee282007-10-06 05:42:47 +000066<p>Note that the C front-end uses LLVM, but does not depend on llvm-gcc :)</p>
67
Kevinbc8e50f2007-10-05 21:18:52 +000068<p>We will eventually integrate this better as a sub-project, but for now it builds a single tool named 'clang'.<br>
69Once llvm is built in this way, you can compile C code.
70<h3>Examples of using clang</h3>
71The clang driver takes a lot of GCC compatible options, which you can see with 'clang --help'. Here are a few examples:
72<!-- Thanks to http://shiflett.org/blog/2006/oct/formatting-and-highlighting-php-code-listings
73 Site suggested using pre in CSS, but doesn't work in IE, so went for the <pre> tag.
74-->
75<pre class="code">
76$ cat ~/t.c
77
78typedef float V __attribute__((vector_size(16)));
79V foo(V a, V b) { return a+b*a; }
80
Kevinbc8e50f2007-10-05 21:18:52 +000081Preprocessing:
82$ clang ~/t.c -E
83# 1 "/Users/sabre/t.c" 1
84
85typedef float V __attribute__((vector_size(16)));
86
87V foo(V a, V b) { return a+b*a; }
88
89
90Type checking:
91$ clang -fsyntax-only ~/t.c
92
93
94GCC options:
95$ clang -fsyntax-only ~/t.c -pedantic
96/Users/sabre/t.c:2:17: warning: extension used
97typedef float V __attribute__((vector_size(16)));
Chris Lattnera08ee282007-10-06 05:42:47 +000098 ^
Kevinbc8e50f2007-10-05 21:18:52 +0000991 diagnostic generated.
100
101
102
103Pretty printing from the AST:
Chris Lattnerae3758d2007-10-11 00:38:03 +0000104$ clang ~/t.c -ast-print
Kevinbc8e50f2007-10-05 21:18:52 +0000105typedef float V __attribute__(( vector_size(16) ));
106
107V foo(V a, V b) {
108 return a + b * a;
109}
110
111
112LLVM code generation:
113$ clang ~/t.c -emit-llvm | llvm-as | opt -std-compile-opts | llvm-dis
114define <4 x float> @foo(<4 x float> %a, <4 x float> %b) {
115entry:
116 %mul = mul <4 x float> %b, %a ; <<4 x float>>
117[#uses=1]
118 %add = add <4 x float> %mul, %a ; <<4 x float>>
119[#uses=1]
120 ret <4 x float> %add
121}
122$ clang ~/t.c -emit-llvm | llvm-as | opt -std-compile-opts | llc -
123march=ppc32 -mcpu=g5
124..
125_foo:
126 vmaddfp v2, v3, v2, v2
127 blr
128$ clang ~/t.c -emit-llvm | llvm-as | opt -std-compile-opts | llc -
129march=x86 -mcpu=yonah
130..
131_foo:
132 mulps %xmm0, %xmm1
133 addps %xmm0, %xmm1
134 movaps %xmm1, %xmm0
135 ret
136</pre>
137<h2>Available tasks</h2>
138Here are a few tasks that are currently available for newcomers to work on:
139
Chris Lattnera08ee282007-10-06 05:42:47 +0000140<ul>
141<li>None yet, ask on cfe-dev</li>
142</ul>
Kevinbc8e50f2007-10-05 21:18:52 +0000143</div>
144</body>
Chris Lattnerae3758d2007-10-11 00:38:03 +0000145</html>