File tree Expand file tree Collapse file tree 6 files changed +9
-9
lines changed
appendix-a-how-to-implement-a-string-type-in-llvm
object-oriented-constructs Expand file tree Collapse file tree 6 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ that the function's state is preserved across the repeated calls of the
66function; this includes the function's local offset at the point it
77yielded a value.
88
9- The most straigthforward way to implement a generator is by wrapping all
9+ The most straightforward way to implement a generator is by wrapping all
1010of its state variables (arguments, local variables, and return values)
1111up into an ad-hoc structure and then pass the address of that structure
1212to the generator.
@@ -24,7 +24,7 @@ The important thing is to think of iterators as a sort of micro-thread
2424that is resumed whenever the iterator is called again. In other words,
2525we need to save the address of how far the iterator got on each pass
2626through so that it can resume as if a microscopic thread switch had
27- occured . So we save the address of the instruction after the return
27+ occurred . So we save the address of the instruction after the return
2828instruction so that we can resume running as if we never had returned in
2929the first place.
3030
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ There are two ways to implement a string type in LLVM:
1010I'd personally much prefer to use the second method, but for the sake of
1111the example, I'll go ahead and illustrate a simple but useful string
1212type in LLVM IR. It assumes a 32-bit architecture, so please replace all
13- occurences of ``i32 `` with ``i64 `` if you are targetting a 64-bit
13+ occurrences of ``i32 `` with ``i64 `` if you are targeting a 64-bit
1414architecture.
1515
1616We'll be making a dynamic, mutable string type that can be appended to
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ Functions with a Variable Number of Parameters
7272
7373To call a so-called vararg function, you first need to define or declare
7474it using the elipsis (...) and then you need to make use of a special
75- syntax for function calls that allows you to explictly list the types of
75+ syntax for function calls that allows you to explicitly list the types of
7676the parameters of the function that is being called. This "hack" exists
7777to allow overriding a call to a function such as a function with
7878variable parameters. Please notice that you only need to specify the
@@ -184,9 +184,9 @@ This simple example is in turn compiled to
184184 ret void
185185 }
186186
187- We can see that the funtion now actually returns ``void `` and another
187+ We can see that the function now actually returns ``void `` and another
188188parameter was added. The first parameter is a pointer to the result,
189- which is allocated by the caller. The pointer has the attirbute
189+ which is allocated by the caller. The pointer has the attribute
190190``noalias `` because there is no way that one of the parameters might
191191point to the same location. The ``sret `` attribute indicates that this
192192is the return value.
Original file line number Diff line number Diff line change 11Global Variables
22----------------
33
4- Global varibles are trivial to implement in LLVM IR:
4+ Global variables are trivial to implement in LLVM IR:
55
66.. code-block :: cpp
77
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ This is equivalent to the following LLVM IR:
8989 }
9090
9191 And the compiler then supplies the needed type casts and pointer
92- arithmentic whenever ``baseB `` is being referenced as an instance
92+ arithmetic whenever ``baseB `` is being referenced as an instance
9393
9494of ``BaseB ``. Please notice that all it takes is a ``bitcast `` from one
9595class to another as well as an adjustment of the last argument to
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ Virtual Inheritance
22-------------------
33
44Virtual inheritance is actually quite simple as it dictates that
5- identical base classes are to be merged into a single occurence . For
5+ identical base classes are to be merged into a single occurrence . For
66instance, given this:
77
88.. code-block :: cpp
You can’t perform that action at this time.
0 commit comments