@@ -198,22 +198,22 @@ automatically provide each one with an increasing, unique numeric
198
198
suffix. Local value names for instructions are purely optional, but it
199
199
makes it much easier to read the IR dumps.
200
200
201
- `LLVM instructions <../LangRef.html#instruction-reference >`_ are constrained by strict
201
+ `LLVM instructions <../../ LangRef.html#instruction-reference >`_ are constrained by strict
202
202
rules: for example, the Left and Right operators of an `add
203
- instruction <../LangRef.html#add-instruction> `_ must have the same type, and the
203
+ instruction <../../ LangRef.html#add-instruction> `_ must have the same type, and the
204
204
result type of the add must match the operand types. Because all values
205
205
in Kaleidoscope are doubles, this makes for very simple code for add,
206
206
sub and mul.
207
207
208
208
On the other hand, LLVM specifies that the `fcmp
209
- instruction <../LangRef.html#fcmp-instruction> `_ always returns an 'i1' value (a
209
+ instruction <../../ LangRef.html#fcmp-instruction> `_ always returns an 'i1' value (a
210
210
one bit integer). The problem with this is that Kaleidoscope wants the
211
211
value to be a 0.0 or 1.0 value. In order to get these semantics, we
212
212
combine the fcmp instruction with a `uitofp
213
- instruction <../LangRef.html#uitofp-to-instruction> `_. This instruction converts its
213
+ instruction <../../ LangRef.html#uitofp-to-instruction> `_. This instruction converts its
214
214
input integer into a floating point value by treating the input as an
215
215
unsigned value. In contrast, if we used the `sitofp
216
- instruction <../LangRef.html#sitofp-to-instruction> `_, the Kaleidoscope '<' operator
216
+ instruction <../../ LangRef.html#sitofp-to-instruction> `_, the Kaleidoscope '<' operator
217
217
would return 0.0 and -1.0, depending on the input value.
218
218
219
219
.. code-block :: c++
@@ -246,14 +246,14 @@ can use the LLVM symbol table to resolve function names for us.
246
246
247
247
Once we have the function to call, we recursively codegen each argument
248
248
that is to be passed in, and create an LLVM `call
249
- instruction <../LangRef.html#call-instruction> `_. Note that LLVM uses the native C
249
+ instruction <../../ LangRef.html#call-instruction> `_. Note that LLVM uses the native C
250
250
calling conventions by default, allowing these calls to also call into
251
251
standard library functions like "sin" and "cos", with no additional
252
252
effort.
253
253
254
254
This wraps up our handling of the four basic expressions that we have so
255
255
far in Kaleidoscope. Feel free to go in and add some more. For example,
256
- by browsing the `LLVM language reference <../LangRef.html >`_ you'll find
256
+ by browsing the `LLVM language reference <../../ LangRef.html >`_ you'll find
257
257
several other interesting instructions that are really easy to plug into
258
258
our basic framework.
259
259
@@ -297,7 +297,7 @@ are, so you don't "new" a type, you "get" it.
297
297
The final line above actually creates the IR Function corresponding to
298
298
the Prototype. This indicates the type, linkage and name to use, as
299
299
well as which module to insert into. "`external
300
- linkage <../LangRef.html#linkage> `_" means that the function may be
300
+ linkage <../../ LangRef.html#linkage> `_" means that the function may be
301
301
defined outside the current module and/or that it is callable by
302
302
functions outside the module. The Name passed in is the name the user
303
303
specified: since "``TheModule ``" is specified, this name is registered
@@ -385,7 +385,7 @@ Once the insertion point has been set up and the NamedValues map populated,
385
385
we call the ``codegen() `` method for the root expression of the function. If no
386
386
error happens, this emits code to compute the expression into the entry block
387
387
and returns the value that was computed. Assuming no error, we then create an
388
- LLVM `ret instruction <../LangRef.html#ret-instruction >`_, which completes the function.
388
+ LLVM `ret instruction <../../ LangRef.html#ret-instruction >`_, which completes the function.
389
389
Once the function is built, we call ``verifyFunction ``, which is
390
390
provided by LLVM. This function does a variety of consistency checks on
391
391
the generated code, to determine if our compiler is doing everything
0 commit comments