blob: 783be97defdc4dedc56361748e38faffc114100c [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.
18You 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>. (On the other hand, if you feel uncomfortable getting involved in a public mailing list right away, and you just want to ask a few questions to begin with, then you can contact Chris personally, until you feel comfortable moving to the mailing list.)
19
20<h2>Getting Started</h2>
21<h3>A word of warning</h3>
22While this work aims to provide a fully functional C/C++/ObjC front- end, it is *still very early work*. 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:
23<ol>
24 <li>The semantic analyzer does not produce all of the warnings and errors it should.
25 <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.
26 <li>We don't consider the API to be stable yet, and reserve the right to change fundamental things :)
27</ol>
28Our plan is to continue chipping away at these issues until C works really well, but we'd love help from other interested contributors.
29<h3>Follow what's going on</h3>
30To avoid spamming the main LLVM mailing list, two lists were setup just for Clang. Please take all Clang related discussion to these two lists. (Note: If all you care about is the Clang front-end, and not the overall LLVM Compiler project, then the two CFE lists are all that you need.)<br>
31<ul>
32<li><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">cfe-commits</a> - This list is for patch submission/discussion.
33<li><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">cfe-dev</a> - This list is for everything else clang related.
34</ul>
Kevin13043a42007-10-05 21:44:03 +000035<h3>Building clang / working with the code<a name="build">&nbsp;</a></h3>
Kevinbc8e50f2007-10-05 21:18:52 +000036If you would like to check out and build the project, the current scheme is:<br>
37<ol>
38 <li>Check out llvm
39 <ul>
40 <li>cd llvm/tools
41 <li>svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
42 </ul>
43 <li>Non-mac users: Paths to system header files are currently hard coded into the tool; as a result, non-Mac users will need to change the path in one of the files.
44 <ul>
45 <li>'touch empty.c; gcc -v empty.c -fsyntax-only' to get the path.
46 <li>change clang/Driver/clang.cpp:606 to include that path
47 </ul>
48 <li>Build llvm
49 <ul>
50 <li>cd clang
51 <li>make
52 </ul>
53</ol>
54<p>Note that the C front-end uses libsupport and libsystem. You don't need llvm-gcc :)
55<p>We will eventually integrate this better as a sub-project, but for now it builds a single tool named 'clang'.<br>
56Once llvm is built in this way, you can compile C code.
57<h3>Examples of using clang</h3>
58The clang driver takes a lot of GCC compatible options, which you can see with 'clang --help'. Here are a few examples:
59<!-- Thanks to http://shiflett.org/blog/2006/oct/formatting-and-highlighting-php-code-listings
60 Site suggested using pre in CSS, but doesn't work in IE, so went for the <pre> tag.
61-->
62<pre class="code">
63$ cat ~/t.c
64
65typedef float V __attribute__((vector_size(16)));
66V foo(V a, V b) { return a+b*a; }
67
68
69Preprocessing:
70$ clang ~/t.c -E
71# 1 "/Users/sabre/t.c" 1
72
73typedef float V __attribute__((vector_size(16)));
74
75V foo(V a, V b) { return a+b*a; }
76
77
78Type checking:
79$ clang -fsyntax-only ~/t.c
80
81
82GCC options:
83$ clang -fsyntax-only ~/t.c -pedantic
84/Users/sabre/t.c:2:17: warning: extension used
85typedef float V __attribute__((vector_size(16)));
86 ^
871 diagnostic generated.
88
89
90
91Pretty printing from the AST:
92$ clang ~/t.c -parse-ast-print
93typedef float V __attribute__(( vector_size(16) ));
94
95V foo(V a, V b) {
96 return a + b * a;
97}
98
99
100LLVM code generation:
101$ clang ~/t.c -emit-llvm | llvm-as | opt -std-compile-opts | llvm-dis
102define <4 x float> @foo(<4 x float> %a, <4 x float> %b) {
103entry:
104 %mul = mul <4 x float> %b, %a ; <<4 x float>>
105[#uses=1]
106 %add = add <4 x float> %mul, %a ; <<4 x float>>
107[#uses=1]
108 ret <4 x float> %add
109}
110$ clang ~/t.c -emit-llvm | llvm-as | opt -std-compile-opts | llc -
111march=ppc32 -mcpu=g5
112..
113_foo:
114 vmaddfp v2, v3, v2, v2
115 blr
116$ clang ~/t.c -emit-llvm | llvm-as | opt -std-compile-opts | llc -
117march=x86 -mcpu=yonah
118..
119_foo:
120 mulps %xmm0, %xmm1
121 addps %xmm0, %xmm1
122 movaps %xmm1, %xmm0
123 ret
124</pre>
125<h2>Available tasks</h2>
126Here are a few tasks that are currently available for newcomers to work on:
127
128<h2>Final words</h2>
129In any case, we welcome questions, comments, and especially patches :).
130<br><br>
131Thanks!
132<br><br>
133-Chris
134</div>
135</body>
136</html>