|
|
@@ -4,31 +4,31 @@
|
|
|
|
|
|
|
|
|
Both QBE and LLVM are compiler backends using an SSA
|
|
|
-representation. This document will explain why the
|
|
|
-advanced stage in which LLVM is does not make QBE a
|
|
|
-redundant project. Obviously, everything following is
|
|
|
-probably biased, because written by me.
|
|
|
+representation. This document will explain why LLVM
|
|
|
+does not make QBE a redundant project. Obviously,
|
|
|
+everything following is probably biased, because
|
|
|
+written by me.
|
|
|
|
|
|
- Scope
|
|
|
-------
|
|
|
|
|
|
-QBE is a much smaller scale projects with different
|
|
|
-goals than LLVM.
|
|
|
+QBE is a much smaller scale project with different goals
|
|
|
+than LLVM.
|
|
|
|
|
|
* QBE is for amateur language designers.
|
|
|
|
|
|
It does not address all the problems faced when
|
|
|
conceiving an industry-grade language. If you are
|
|
|
toying with some language ideas, using LLVM will
|
|
|
- feel like throwing your backpack in a truck, but
|
|
|
- using QBE will feel more like biking.
|
|
|
+ be like hauling your backpack in a truck, but using
|
|
|
+ QBE will feel more like biking.
|
|
|
|
|
|
* QBE is about the first 70%, not the last 30%.
|
|
|
|
|
|
It attempts to pinpoint, in the extremely vast
|
|
|
compilation literature, the optimizations that get
|
|
|
- you 70% of the performance in 10% of the code needed
|
|
|
- to scrape the last bits of performance.
|
|
|
+ you 70% of the performance in 10% of the code of
|
|
|
+ full blown compilers.
|
|
|
|
|
|
For example, copy propagation on SSA form is
|
|
|
implemented in 160 lines of code in QBE!
|
|
|
@@ -68,8 +68,8 @@ are a few things provided in QBE to consider.
|
|
|
|
|
|
* LLVM IR is more cluttered with memory operations.
|
|
|
|
|
|
- Implementing SSA construction is hard, and to save
|
|
|
- its frontends from having to do it, LLVM provides
|
|
|
+ Implementing SSA construction is hard. To save its
|
|
|
+ users from having to implement it, LLVM provides
|
|
|
stack slots. This means that one increment of
|
|
|
a variable `v` will be composed of three LLVM
|
|
|
instructions: one load, one add, and one store.
|
|
|
@@ -87,13 +87,13 @@ are a few things provided in QBE to consider.
|
|
|
|
|
|
For the sake of advanced optimizations and
|
|
|
correctness, LLVM has complex IL types. However,
|
|
|
- only a few types are really first class in the IL
|
|
|
- and many operations of source languages require
|
|
|
- casts to be compiled.
|
|
|
+ only a few types are really first class and many
|
|
|
+ operations of source languages require casts to be
|
|
|
+ compiled.
|
|
|
|
|
|
Because QBE makes a much lighter use of types, the
|
|
|
IL is more readable and shorter. It can of course be
|
|
|
argued back that correctness of QBE is jeoparadized,
|
|
|
- but remember that, in practice, the large amounts
|
|
|
+ but remember that, in practice, the large amount
|
|
|
of casts necessary in LLVM IL is compromizing the
|
|
|
overall effectiveness of the type system.
|