Skip to content

Commit 630b4fb

Browse files
authored
Documentation fixes (#277)
* Fixes #270 - [BUG] - Kaleidoscope docs for chapter 3 contain incorrect note * Fixes #271 - [BUG] - Kaleidoscope chapter 3.5 contains a blank warning note * Fixes #272 - [BUG] - Kaleidoscope Ch 4 contains invalid nested parens.
1 parent 211d1fb commit 630b4fb

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

src/Samples/Kaleidoscope/Chapter3.5/Kaleidoscope-ch3.5.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,20 @@ These Options are initialized in a private static member for the passes.
3838

3939
### Special attributes for parsed functions
4040
>[!WARNING]
41-
When performing optimizations with the new pass builder system the
42-
TargetLibraryInfo (Internal LLVM concept) is used to determine what the "built-in"
43-
functions are. Unfortunately, they leave little room for manipulating or customizing
44-
this set (In C++ there is some "wiggle room", in LLVM-C there is NO support for
45-
this type at all!). Unfortunately, that means that if any function happens to have
46-
the same name as the TargetLibraryInfo for a given Triple then it will be optimized
47-
AS a built-in function (even if not declared as one) unless explicitly declared as
48-
"not" at the call site with an attribute. This is an unfortunate state
49-
of affairs with the LLVM support for C++ and highly problematic for `C` based
50-
bindings/projections like this library. Fortunately, there is a scapegoat for this.
51-
The function can include a `nobuiltin` attribute at the call site to prevent the
52-
optimizer from assuming the call is to one of the well known built-in functions.
53-
This isn't used for Kaleidoscope. But does leave room for problems with names that
54-
match some arbitrary set of "built-in" symbols.
41+
>When performing optimizations with the new pass builder system the
42+
>TargetLibraryInfo (Internal LLVM concept) is used to determine what the "built-in"
43+
>functions are. Unfortunately, they leave little room for manipulating or customizing
44+
>this set (In C++ there is some "wiggle room", in LLVM-C there is NO support for
45+
>this type at all!). Unfortunately, that means that if any function happens to have
46+
>the same name as the TargetLibraryInfo for a given Triple then it will be optimized
47+
>AS a built-in function (even if not declared as one) unless explicitly declared as
48+
>"not" at the call site with an attribute. This is an unfortunate state
49+
>of affairs with the LLVM support for C++ and highly problematic for `C` based
50+
>bindings/projections like this library. Fortunately, there is a scapegoat for this.
51+
>The function can include a `nobuiltin` attribute at the call site to prevent the
52+
>optimizer from assuming the call is to one of the well known built-in functions.
53+
>This isn't used for Kaleidoscope. But does leave room for problems with names that
54+
>match some arbitrary set of "built-in" symbols.
5555
5656
[!code-csharp[Main](CodeGenerator.cs#GetOrDeclareFunction)]
5757

src/Samples/Kaleidoscope/Chapter3/Kaleidoscope-ch3.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,10 @@ Generation of the LLVM IR for a constant is quite simple.
175175

176176
> [!NOTE]
177177
> The constant value is uniqued in LLVM so that multiple calls given the same input
178-
> value will produce the same LLVM Value. Ubiquity.NET.Llvm honors this and is
179-
> implemented in a way to ensure that reference equality reflects the identity of
180-
> the uniqued values correctly.
178+
> value will produce the same LLVM Value. Ubiquity.NET.Llvm honors this via value
179+
> equality tests. It does ***NOT*** guarantee reference equality. (It used to in
180+
> older versions but no longer does as that led to subtle problems with ownership
181+
> and multi-threaded JIT)
181182
182183
### Variable reference expression
183184
References to variables in Kaleidoscope, like most other languages, use a name. In

src/Samples/Kaleidoscope/Chapter4/Kaleidoscope-ch4.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ returned.
102102

103103
For named function definitions, the module is lazy added to the JIT as it isn't
104104
known if/when the function is called. The JIT engine will compile modules lazy
105-
added into native code on first use. (Though if the function is never used, then
105+
added into native code on first use. Though, if the function is never used, then
106106
creating the IR module was wasted. ([Chapter 7.1](xref:Kaleidoscope-ch7.1) has a
107107
solution for even that extra overhead - truly lazy JIT). Since Kaleidoscope is
108108
generally a dynamic language it is possible and reasonable for the user to

0 commit comments

Comments
 (0)