What single rule decides whether a rearrangement is allowed?
- Whether observable behaviour stays the same
- Whether it makes the file shorter
- Whether the programmer approves each time
Which jobs belong to the back end?
- Parsing text into a tree
- Writing user documentation
- Picking instructions and assigning registers
An optimiser may reorder two independent sums.
Circle one: True False
Why is folding 2 plus 3 into 5 always allowed?
- Constants have no observable behaviour of their own
- Folding makes the source file prettier
- Constants never appear in real programs
Only two registers are free for a times b plus c. What must the back end do?
- Skip the multiplication entirely
- Spill one value to memory and reload it
- Ask the programmer for more registers
Why must the optimiser keep a read that looks unused when a device sits behind it?
- Reads make the program run faster
- Devices enjoy extra attention
- Deleting it changes what the device experiences
Two statements touch different variables, but the second writes to a log file. May they swap?
- Yes, different variables always swap safely
- Yes, logs are invisible to observers
- No, the log write is observable and fixes the order
The optimiser swaps a device write with the computation of its value to save time. Allowed?
- Yes, computations always move freely
- No, reordering across a visible write is forbidden
- Yes, writes are never observable