diff options
| author | kristina <notstina@gmail.com> | 2019-11-16 20:58:08 +0000 |
|---|---|---|
| committer | kristina <notstina@gmail.com> | 2019-11-16 21:09:16 +0000 |
| commit | 2916489c54a303971bc546f287b71532d49ddd33 (patch) | |
| tree | 643e8429cb520b3c2976458f4aabdbb80d9b11eb /llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl03.rst | |
| parent | 584704c725a266aed4ed11f389bab055192e3a24 (diff) | |
| download | bcm5719-llvm-2916489c54a303971bc546f287b71532d49ddd33.tar.gz bcm5719-llvm-2916489c54a303971bc546f287b71532d49ddd33.zip | |
[Docs] Fix relative links in tutorial.
Update relative links in Kaleidoscope tutorial.
Diffstat (limited to 'llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl03.rst')
| -rw-r--r-- | llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl03.rst | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl03.rst b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl03.rst index 7b4e24d35e4..5364b172ad9 100644 --- a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl03.rst +++ b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl03.rst @@ -198,22 +198,22 @@ automatically provide each one with an increasing, unique numeric suffix. Local value names for instructions are purely optional, but it makes it much easier to read the IR dumps. -`LLVM instructions <../LangRef.html#instruction-reference>`_ are constrained by strict +`LLVM instructions <../../LangRef.html#instruction-reference>`_ are constrained by strict rules: for example, the Left and Right operators of an `add -instruction <../LangRef.html#add-instruction>`_ must have the same type, and the +instruction <../../LangRef.html#add-instruction>`_ must have the same type, and the result type of the add must match the operand types. Because all values in Kaleidoscope are doubles, this makes for very simple code for add, sub and mul. On the other hand, LLVM specifies that the `fcmp -instruction <../LangRef.html#fcmp-instruction>`_ always returns an 'i1' value (a +instruction <../../LangRef.html#fcmp-instruction>`_ always returns an 'i1' value (a one bit integer). The problem with this is that Kaleidoscope wants the value to be a 0.0 or 1.0 value. In order to get these semantics, we combine the fcmp instruction with a `uitofp -instruction <../LangRef.html#uitofp-to-instruction>`_. This instruction converts its +instruction <../../LangRef.html#uitofp-to-instruction>`_. This instruction converts its input integer into a floating point value by treating the input as an unsigned value. In contrast, if we used the `sitofp -instruction <../LangRef.html#sitofp-to-instruction>`_, the Kaleidoscope '<' operator +instruction <../../LangRef.html#sitofp-to-instruction>`_, the Kaleidoscope '<' operator would return 0.0 and -1.0, depending on the input value. .. code-block:: c++ @@ -246,14 +246,14 @@ can use the LLVM symbol table to resolve function names for us. Once we have the function to call, we recursively codegen each argument that is to be passed in, and create an LLVM `call -instruction <../LangRef.html#call-instruction>`_. Note that LLVM uses the native C +instruction <../../LangRef.html#call-instruction>`_. Note that LLVM uses the native C calling conventions by default, allowing these calls to also call into standard library functions like "sin" and "cos", with no additional effort. This wraps up our handling of the four basic expressions that we have so far in Kaleidoscope. Feel free to go in and add some more. For example, -by browsing the `LLVM language reference <../LangRef.html>`_ you'll find +by browsing the `LLVM language reference <../../LangRef.html>`_ you'll find several other interesting instructions that are really easy to plug into our basic framework. @@ -297,7 +297,7 @@ are, so you don't "new" a type, you "get" it. The final line above actually creates the IR Function corresponding to the Prototype. This indicates the type, linkage and name to use, as well as which module to insert into. "`external -linkage <../LangRef.html#linkage>`_" means that the function may be +linkage <../../LangRef.html#linkage>`_" means that the function may be defined outside the current module and/or that it is callable by functions outside the module. The Name passed in is the name the user 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, we call the ``codegen()`` method for the root expression of the function. If no error happens, this emits code to compute the expression into the entry block and returns the value that was computed. Assuming no error, we then create an -LLVM `ret instruction <../LangRef.html#ret-instruction>`_, which completes the function. +LLVM `ret instruction <../../LangRef.html#ret-instruction>`_, which completes the function. Once the function is built, we call ``verifyFunction``, which is provided by LLVM. This function does a variety of consistency checks on the generated code, to determine if our compiler is doing everything |

