Execution Flow, Branches, Function Calls

1  Introduction

2  Relative Branches

PC <- old PC + literal value in instruction

2.1  IF ... THEN ... ELSE

2.2  WHILE Loop

2.3  DO ... WHILE Loop

2.4  FOR Loops

2.5  SWITCH Statements

2.6  GOTO Considered Harmful

3  Performing Function Calls

3.1  Requirements to Perform Functions

3.2  Issues in Performing Functions

3.3  The Solution: A Stack

3.4  Implementing the Stack

        subu $sp, $sp, 4     # Decrement $sp by 4
        sw $t1, ($sp)        # and copy $t1 onto the stack
        lw $t1, ($sp)
        addu $sp, $sp, 4

3.5  The Stack Frame

3.6  Returning Values from a Function Call

3.7  Function Calls on MIPS

3.8  Function Calls on the PDP-11

3.9  Function Calls on the IA-32 Family

3.10  Function Calls on the VAX Architecture




File translated from TEX by TTH, version 3.85.
On 8 Dec 2010, 08:43.