Lines Matching refs:code
16 an AST, how to build LLVM IR, and how to optimize the resultant code as
24 Since LLVM requires that the input code be in SSA form, this is a very
25 nice property and it is often unclear to newcomers how to generate code
39 .. code-block:: c
56 .. code-block:: llvm
123 .. code-block:: llvm
134 This code shows an example of how you can declare and manipulate a stack
141 .. code-block:: llvm
183 .. code-block:: bash
306 The symbol table in Kaleidoscope is managed at code generation time by
312 code, but does not (by itself) change the behavior of the compiler. All
313 of these changes are isolated in the Kaleidoscope code generator.
323 we do this, the C++ compiler will tell us what parts of the code we need
326 .. code-block:: c++
334 .. code-block:: c++
346 This funny looking code creates an IRBuilder object that is pointing at
353 code generating a reference to them actually needs to produce a load
356 .. code-block:: c++
370 with ``ForExprAST::codegen()`` (see the `full code listing <#id1>`_ for
371 the unabridged code):
373 .. code-block:: c++
380 // Emit the start code first, without 'variable' in scope.
401 This code is virtually identical to the code `before we allowed mutable
402 variables <LangImpl05.html#code-generation-for-the-for-loop>`_. The big difference is that we
407 them. The code for this is also pretty simple:
409 .. code-block:: c++
439 .. code-block:: c++
449 It is interesting to see what the code looks like before and after the
450 mem2reg optimization runs. For example, this is the before/after code
453 .. code-block:: llvm
484 still see the extremely simple-minded code generation strategy we are
492 Here is the code after the mem2reg pass runs:
494 .. code-block:: llvm
525 .. code-block:: llvm
561 .. code-block:: c++
575 .. code-block:: c++
592 .. code-block:: c++
615 and arguments. For example, we can now run code like this:
643 Kaleidoscope: we extend the lexer, the parser, the AST and the code
645 extend the lexer. As before, this is pretty trivial, the code looks like
648 .. code-block:: c++
673 .. code-block:: c++
696 .. code-block:: c++
726 .. code-block:: c++
739 The first part of this code parses the list of identifier/expr pairs
742 .. code-block:: c++
770 .. code-block:: c++
785 Now that we can parse and represent the code, we need to support
786 emission of LLVM IR for it. This code starts out with:
788 .. code-block:: c++
804 .. code-block:: c++
831 There are more comments here than code. The basic idea is that we emit
836 .. code-block:: c++
845 .. code-block:: c++
867 Here is the complete code listing for our running example, enhanced with
870 .. code-block:: bash
877 Here is the code: