-
Notifications
You must be signed in to change notification settings - Fork 0
/
LLVM.html
90 lines (90 loc) · 5.47 KB
/
LLVM.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="style.css"/>
<link rel="stylesheet" type="text/css" href="pygments.css"/>
<link rel="icon" type="image/png" href="logo-simple.png"/>
</head>
<body>
<div class="layout-header">
<a href="index.html"><img src="logo.png" alt="Firm Logo" /></a>
</div>
<div class="layout-content-wrapper">
<div class="layout-content">
<div class="layout-sidebar">
<ul>
<li><a href="index.html">About</a></li>
<li><a href="Features">Features</a></li>
<li><a href="Download">Download</a></li>
<li><a href="Documentation">Documentation</a></li>
<li><a href="Projects">Projects</a></li>
<li><a href="Development">Development</a></li>
<li><a href="Contact">Contact</a></li>
</ul>
<ul class="external">
<li><a href="http://pp.info.uni-karlsruhe.de/projects/firm_publications.php">Publications</a></li>
</ul>
</div>
<div class="layout-document">
<div class="sect1">
<h2 id="_lib_span_class_algo_span_class_algo_firm_span_span_vs_llvm">lib<span class="algo"><span class="algo">Firm</span></span> vs LLVM</h2>
<div class="sectionbody">
<div class="paragraph"><p>Let me start with the similarities:
Both libraries provide an intermediate representation for compilers which is low level (closer to hardware than to high level source language), and both provide optimizing transformations for their representations and backends for different architectures.
So both have a very similar mission:
Optimized compilation/generation of machine code.</p></div>
<div class="paragraph"><p>Now for the differences and keep in mind that we are biased</p></div>
<div class="ulist"><ul>
<li>
<p>
lib<span class="algo"><span class="algo">Firm</span></span> uses a graph based program representation, based on the SSA form.
This generally makes it easier to create and execute optimisations that replace patterns, since you generally don’t have to care about the schedule inside basic blocks.
</p>
</li>
<li>
<p>
lib<span class="algo"><span class="algo">Firm</span></span> is written in C while LLVM uses C<code>.
In practice this means, shorter compile and link times and easier to understand APIs.
Using C</code> provides us with more flexible abstract datatypes (lists, hashmaps) and more modern language features such as namespaces and operator overloading, but in my experience that isn’t worth the overhead in compilation times, more complicated error messages and code bloat which slows me down as a programmer.
Also generating language bindings is alot easier with C interfaces - we were able to create a java binding called jFirm within 2 months.
</p>
</li>
<li>
<p>
LLVM probably is a little stronger for architecture neutral optimisations and a bit faster (though lib<span class="algo"><span class="algo">Firm</span></span> isn’t slow either).
</p>
</li>
<li>
<p>
lib<span class="algo"><span class="algo">Firm</span></span> has very modern/good register allocation infrastructure.
In combination with our IA32 backend we often produce better code than LLVM and sometimes even gcc.
(This is based on our measurements with Spec CPU2000 and our own set of micro benchmarks, results vary heavily depending on the benchmark of course, so in the end you should do your own benchmarks and not focus on a single task).
</p>
</li>
<li>
<p>
lib<span class="algo"><span class="algo">Firm</span></span> has very good IA32 and SPARC backends.
libFirms ARM and AMD64 backends are still in very early phases and often fail or don’t produce good code yet.
</p>
</li>
</ul></div>
<div class="paragraph"><p>Also, both projects have a primary frontend which compiles C code,
cparser and clang.
We have to admit that clang can do even more,
like C++ and Objective-C.</p></div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<div class="layout-footer">
<span><a href="https://lists.ira.uni-karlsruhe.de/mailman/listinfo/firm">Mailing list</a>: <a href="mailto:firm@ipd.info.uni-karlsruhe.de">firm@ipd.info.uni-karlsruhe.de</a></span>
| <span>IRC: #firm on <a href="http://webchat.freenode.net/?channels=firm">Freenode</a></span>
| <span><a href="http://pp.info.uni-karlsruhe.de/~firm/bugs">Bugtracker</a></span>
</div>
</body>
</html>