ITEC 460 - Chapter 8 Notes
basic architecture
- What can a computer do?
- arith ops
- relops
- store/retrieve from memory
- straight line ex
- branch
- access i/o devices
- What storage does it have
- asm language vs machine language
intro
- AAT is roughly independent of architecture
Stack, Call Frame, Memory
- Must look at memory for locals and params (and registers)
- Stack grows from small to large addresses
- SP points to next open location
-
AR = stack frame = call frame
-
FP points to start of current call frame
-
call frame: look at foo bar example to see how to access
- locals and params
- step through how this works from one call to the next
- call frame: locals, saved regs, params for called
-
results come back in a register, not onstack
-
Use offset from fp to get to call frame
-
params accessed by both: put in caller
and use neg offset from (new) to access in called
-
Caller pushes params, makes call, then can pop params
-
Notice that fp is constant during execution of a proc
-
- but sp moves and fp may change but will be restored
-
Call stmt moves fp
Abstract Assembly
- Statement trees: asm instructions - don't represent values
- Expression trees: asm instr operands - represent values
- Five kinds of expression trees:
- constant (ie integers)
- register - string that specifies a register
- operator - two expr trees and an operator
- call expression - string for function name and list of
expressions for operands (stack access is part of codegen)
- Memory address - absolute rare; offset from fp common
- Eight kinds of statement trees
- Move
- label
- Jump
- Conditional Jump
- sequential
- call statement
- empty
- return
Topic
Topic
Topic
Topic
Topic
Last modified on