xref: /llvm-project/polly/www/get_started.html (revision 5aafc6d58f3405662902cee006be11e599801b88)
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2          "http://www.w3.org/TR/html4/strict.dtd">
3<html>
4<head>
5  <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
6  <title>Polly - Getting Started</title>
7  <link type="text/css" rel="stylesheet" href="menu.css" />
8  <link type="text/css" rel="stylesheet" href="content.css" />
9</head>
10<body>
11
12<div id="box">
13<!--#include virtual="menu.html.incl"-->
14
15<div id="content">
16
17<h1>Building and Installing Polly</h1>
18You can build Polly with <a href="https://cmake.org/">cmake</a> and your preferred generator (e.g. Ninja, make, Visual Studio, etc.).
19
20<h3 id="source">Get the code</h3>
21
22<pre>
23git clone https://github.com/llvm/llvm-project.git
24</pre>
25
26You can also get a shallow clone by running:
27
28<pre>
29git clone --depth 1 https://github.com/llvm/llvm-project.git
30</pre>
31
32<h3 id="build">Build Polly</h3>
33
34<pre>
35mkdir build && cd build
36cmake '-DLLVM_ENABLE_PROJECTS=clang;polly' ../llvm
37cmake --build .
38</pre>
39
40You can also pass arguments to cmake to specify a particular generator (e.g. <code>-G Ninja</code>) or the build type (<code>-DCMAKE_BUILD_TYPE=Release</code>).
41
42If you just want to play around with Polly, it is recommended to do a Release+Assert build by passing
43<code>-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON</code>.
44
45<h3>Test Polly</h3>
46
47To test Polly, you can run
48
49<pre>cmake --build . --target check-polly</pre>
50
51<h3>Using Polly</h3>
52
53Suppose that you want to compile a program hello.c using Polly.
54
55To compile it with Polly (in the build folder), you can run:
56
57<pre>
58bin/clang -O3 -mllvm -polly hello.c
59</pre>
60
61<h3> Troubleshooting</h3>
62
63<p>
64  If you run out of memory when building with Ninja, try lowering the concurrency of Ninja (e.g. <code> ninja -j 2 </code>).
65  More tips and tricks to building and using LLVM can be found <a href="https://llvm.org/docs/GettingStarted.html#common-problems">here</a>.
66</p>
67
68<p>
69For more information on getting started with Polly and LLVM in general, see LLVM's <a href = "https://llvm.org/docs/GettingStarted.html">getting started docs</a>.
70</p>
71
72</div>
73</div>
74
75</body>
76</html>
77