Skip to content

Commit 2916489

Browse files
committed
[Docs] Fix relative links in tutorial.
Update relative links in Kaleidoscope tutorial.
1 parent 584704c commit 2916489

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl03.rst

+9-9
Original file line numberDiff line numberDiff line change
@@ -198,22 +198,22 @@ automatically provide each one with an increasing, unique numeric
198198
suffix. Local value names for instructions are purely optional, but it
199199
makes it much easier to read the IR dumps.
200200

201-
`LLVM instructions <../LangRef.html#instruction-reference>`_ are constrained by strict
201+
`LLVM instructions <../../LangRef.html#instruction-reference>`_ are constrained by strict
202202
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
204204
result type of the add must match the operand types. Because all values
205205
in Kaleidoscope are doubles, this makes for very simple code for add,
206206
sub and mul.
207207

208208
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
210210
one bit integer). The problem with this is that Kaleidoscope wants the
211211
value to be a 0.0 or 1.0 value. In order to get these semantics, we
212212
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
214214
input integer into a floating point value by treating the input as an
215215
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
217217
would return 0.0 and -1.0, depending on the input value.
218218

219219
.. code-block:: c++
@@ -246,14 +246,14 @@ can use the LLVM symbol table to resolve function names for us.
246246

247247
Once we have the function to call, we recursively codegen each argument
248248
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
250250
calling conventions by default, allowing these calls to also call into
251251
standard library functions like "sin" and "cos", with no additional
252252
effort.
253253

254254
This wraps up our handling of the four basic expressions that we have so
255255
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
257257
several other interesting instructions that are really easy to plug into
258258
our basic framework.
259259

@@ -297,7 +297,7 @@ are, so you don't "new" a type, you "get" it.
297297
The final line above actually creates the IR Function corresponding to
298298
the Prototype. This indicates the type, linkage and name to use, as
299299
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
301301
defined outside the current module and/or that it is callable by
302302
functions outside the module. The Name passed in is the name the user
303303
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,
385385
we call the ``codegen()`` method for the root expression of the function. If no
386386
error happens, this emits code to compute the expression into the entry block
387387
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.
389389
Once the function is built, we call ``verifyFunction``, which is
390390
provided by LLVM. This function does a variety of consistency checks on
391391
the generated code, to determine if our compiler is doing everything

llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ but if run at link time, this can be a substantial portion of the whole
117117
program). It also supports and includes "per-function" passes which just
118118
operate on a single function at a time, without looking at other
119119
functions. For more information on passes and how they are run, see the
120-
`How to Write a Pass <../WritingAnLLVMPass.html>`_ document and the
121-
`List of LLVM Passes <../Passes.html>`_.
120+
`How to Write a Pass <../../WritingAnLLVMPass.html>`_ document and the
121+
`List of LLVM Passes <../../Passes.html>`_.
122122

123123
For Kaleidoscope, we are currently generating functions on the fly, one
124124
at a time, as the user types them in. We aren't shooting for the
@@ -130,7 +130,7 @@ exactly the code we have now, except that we would defer running the
130130
optimizer until the entire file has been parsed.
131131

132132
In order to get per-function optimizations going, we need to set up a
133-
`FunctionPassManager <../WritingAnLLVMPass.html#what-passmanager-doesr>`_ to hold
133+
`FunctionPassManager <../../WritingAnLLVMPass.html#what-passmanager-doesr>`_ to hold
134134
and organize the LLVM optimizations that we want to run. Once we have
135135
that, we can add a set of optimizations to run. We'll need a new
136136
FunctionPassManager for each module that we want to optimize, so we'll
@@ -207,7 +207,7 @@ point add instruction from every execution of this function.
207207

208208
LLVM provides a wide variety of optimizations that can be used in
209209
certain circumstances. Some `documentation about the various
210-
passes <../Passes.html>`_ is available, but it isn't very complete.
210+
passes <../../Passes.html>`_ is available, but it isn't very complete.
211211
Another good source of ideas can come from looking at the passes that
212212
``Clang`` runs to get started. The "``opt``" tool allows you to
213213
experiment with passes from the command line, so you can see if they do

llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl05.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ Kaleidoscope looks like this:
217217
To visualize the control flow graph, you can use a nifty feature of the
218218
LLVM '`opt <http://llvm.org/cmds/opt.html>`_' tool. If you put this LLVM
219219
IR into "t.ll" and run "``llvm-as < t.ll | opt -analyze -view-cfg``", `a
220-
window will pop up <../ProgrammersManual.html#viewing-graphs-while-debugging-code>`_ and you'll
220+
window will pop up <../../ProgrammersManual.html#viewing-graphs-while-debugging-code>`_ and you'll
221221
see this graph:
222222

223223
.. figure:: LangImpl05-cfg.png

llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ direct accesses to G and H: they are not renamed or versioned. This
105105
differs from some other compiler systems, which do try to version memory
106106
objects. In LLVM, instead of encoding dataflow analysis of memory into
107107
the LLVM IR, it is handled with `Analysis
108-
Passes <../WritingAnLLVMPass.html>`_ which are computed on demand.
108+
Passes <../../WritingAnLLVMPass.html>`_ which are computed on demand.
109109

110110
With this in mind, the high-level idea is that we want to make a stack
111111
variable (which lives in memory, because it is on the stack) for each
@@ -120,7 +120,7 @@ that @G defines *space* for an i32 in the global data area, but its
120120
*name* actually refers to the address for that space. Stack variables
121121
work the same way, except that instead of being declared with global
122122
variable definitions, they are declared with the `LLVM alloca
123-
instruction <../LangRef.html#alloca-instruction>`_:
123+
instruction <../../LangRef.html#alloca-instruction>`_:
124124

125125
.. code-block:: llvm
126126
@@ -223,7 +223,7 @@ variables in certain circumstances:
223223
funny pointer arithmetic is involved, the alloca will not be
224224
promoted.
225225
#. mem2reg only works on allocas of `first
226-
class <../LangRef.html#first-class-types>`_ values (such as pointers,
226+
class <../../LangRef.html#first-class-types>`_ values (such as pointers,
227227
scalars and vectors), and only if the array size of the allocation is
228228
1 (or missing in the .ll file). mem2reg is not capable of promoting
229229
structs or arrays to registers. Note that the "sroa" pass is
@@ -249,7 +249,7 @@ is:
249249
variables that only have one assignment point, good heuristics to
250250
avoid insertion of unneeded phi nodes, etc.
251251
- Needed for debug info generation: `Debug information in
252-
LLVM <../SourceLevelDebugging.html>`_ relies on having the address of
252+
LLVM <../../SourceLevelDebugging.html>`_ relies on having the address of
253253
the variable exposed so that debug info can be attached to it. This
254254
technique dovetails very naturally with this style of debug info.
255255

llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl10.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ For example, try adding:
5151
extending the type system in all sorts of interesting ways. Simple
5252
arrays are very easy and are quite useful for many different
5353
applications. Adding them is mostly an exercise in learning how the
54-
LLVM `getelementptr <../LangRef.html#getelementptr-instruction>`_ instruction
54+
LLVM `getelementptr <../../LangRef.html#getelementptr-instruction>`_ instruction
5555
works: it is so nifty/unconventional, it `has its own
56-
FAQ <../GetElementPtr.html>`_!
56+
FAQ <../../GetElementPtr.html>`_!
5757
- **standard runtime** - Our current language allows the user to access
5858
arbitrary external functions, and we use it for things like "printd"
5959
and "putchard". As you extend the language to add higher-level
@@ -66,10 +66,10 @@ For example, try adding:
6666
memory, either with calls to the standard libc malloc/free interface
6767
or with a garbage collector. If you would like to use garbage
6868
collection, note that LLVM fully supports `Accurate Garbage
69-
Collection <../GarbageCollection.html>`_ including algorithms that
69+
Collection <../../GarbageCollection.html>`_ including algorithms that
7070
move objects and need to scan/update the stack.
7171
- **exception handling support** - LLVM supports generation of `zero
72-
cost exceptions <../ExceptionHandling.html>`_ which interoperate with
72+
cost exceptions <../../ExceptionHandling.html>`_ which interoperate with
7373
code compiled in other languages. You could also generate code by
7474
implicitly making every function return an error value and checking
7575
it. You could also make explicit use of setjmp/longjmp. There are

0 commit comments

Comments
 (0)