Skip to content
Snippets Groups Projects
Commit 8580ac96 authored by David Grellscheid's avatar David Grellscheid
Browse files

Clarify rbp rsp will come later

parent f90e4c32
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,7 @@ In this group session, you will explore how **C** code is translated into assemb ...@@ -9,7 +9,7 @@ In this group session, you will explore how **C** code is translated into assemb
## Get started with the Compiler ## Get started with the Compiler
1. Open the compiler here: https://godbolt.org/. 1. Open the compiler here: https://godbolt.org/.
2. Change the language from **C++** to **C**. There's a field for this at the top of the code input section on the left. 2. Change the language from **C++** to **C**. There's a field for this at the top of the code input section on the left.
3. Find the compiler output options (the cog that says **Output...**). Untick **Intel asm syntax** as this is what we will be interpreting for the rest of the session. 3. Find the compiler output options (the cog that says **Output...**). Untick **Intel asm syntax** as this is what we will be interpreting for the rest of the session. The output now matches the lecture examples.
4. You can add multiple compilers to easily make comparisons by simply clicking on **+ Add new...** on the same bar where you found **Output...** and selecting **Compiler**. <br> 4. You can add multiple compilers to easily make comparisons by simply clicking on **+ Add new...** on the same bar where you found **Output...** and selecting **Compiler**. <br>
You will come across a lot of new abbreviations for instructions and pointers/registers. You do not really need to understand what each of them, is but being able to distinguish between intructions and pointer/registers would be of help. You will come across a lot of new abbreviations for instructions and pointers/registers. You do not really need to understand what each of them, is but being able to distinguish between intructions and pointer/registers would be of help.
...@@ -24,7 +24,7 @@ int add(int a, int b){ ...@@ -24,7 +24,7 @@ int add(int a, int b){
} }
``` ```
2. Let this function compile using **x86-64**, **clang** and **gcc** (latest versions) for different optimization levels (compiler options or flags) **-O0**, **-O1**, **-O2**, and analyze the assembly output. Observe how the assembly code changes with optimization. 2. Let this function compile using **x86-64**, **clang** and **gcc** (latest versions) for different optimization levels (compiler options or flags) **-O0**, **-O1**, **-O2**, and analyze the assembly output. Observe how the assembly code changes with optimization. We'll get back to %rbp and %rsp later, don't worry too much about those, for now see them as "locations". 4(%rsp) is 4 bytes away from 8(%rsp) etc.
3. Switch to **arm gcc** and repeat the compilation and comparision for different levels of optimization. Observe how the assembly code for **x86-64** differs to that of **ARM**. 3. Switch to **arm gcc** and repeat the compilation and comparision for different levels of optimization. Observe how the assembly code for **x86-64** differs to that of **ARM**.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment