Start writing actual compillation code in compiler series

This commit is contained in:
2019-11-05 00:42:33 -08:00
parent 81ee50d0d4
commit c79b5a4120
6 changed files with 260 additions and 7 deletions

View File

@@ -55,6 +55,7 @@ a `Module` object, which represents some collection of code and declarations
{{< codeblock "C++" "compiler/08/llvm_context.hpp" >}}
{{< todo >}} Consistently name context / state.{{< /todo >}}
{{< todo >}} Explain creation functions. {{< /todo >}}
We include the LLVM context, builder, and module as members
of the context struct. Since the builder and the module need
@@ -97,6 +98,8 @@ which you can extrapolate the rest:
{{< codelines "C++" "compiler/08/llvm_context.cpp" 7 11 >}}
{{< todo >}} Also show struct body setters. {{< /todo >}}
Similarly, here are a few lines from `create_functions()`, which
give a very good idea of the rest of that method:
@@ -180,5 +183,7 @@ methods.
With these things in mind, here's the signature for `gen_llvm`:
```C++
virtual void gen_llvm(const llvm_context&, llvm::Function*) const;
virtual void gen_llvm(llvm_context&, llvm::Function*) const;
```
{{< todo >}} Fix pointer type inconsistencies. {{< /todo >}}