These videos about conditionals and jump instructions will especially prepare you for the second lab assignment, where you’ll have to infer the behavior of a program given only its machine code.
- Overview of x86-64 condition codes and how they’re set.
- Interpreting condition codes as number comparisons.
- Instructions for using and setting condition codes.
- Working backward from machine code with setcc instructions to a C source.
- Control 5: cmovccx 1:42The cmovcxx instruction. Although this instruction is used infrequently (for technical and historical reasons), it helps set up the idea of jumps.
- Introduction to “jump” instructions to implement if branches.
- An note on implementation variants for if branches, which foreshadows implementation variants for loops.
- Another concrete example of machine code that is generated for an if branch.
- Compiling do–while loops to jumps.
- Compiling while loops to jumps.
- Compiling for loops to jumps and why that’s essentially the same as compiling while loops.
- Given C code and machine code, figuring out how registers are used in the machine code to implement variables of the C code.
- The switch form in C and its implementation through conditions and jump tables—
especially jump tables.
- Still more on jump tables, where the details are slightly different when generated by a compiler relative to the hand-rolled table of the previous video.