This preview shows page 1. Sign up to view the full content.
Unformatted text preview: register %edx is set to 0 beforehand. 3.6 Control
Up to this point, we have considered ways to access and operate on data. Another important part of program execution is to control the sequence of operations that are performed. The default for statements in C as well as for assembly code is to have control ﬂow sequentially, with statements or instructions executed in the order they appear in the program. Some constructs in C, such as conditionals, loops, and switches, allow the control to ﬂow in nonsequential order, with the exact sequence depending on the values of program data. Assembly code provides lower-level mechanisms for implementing nonsequential control ﬂow. The basic operation is to jump to a different part of the program, possibly contingent on the result of some test. The compiler must generate instruction sequences that build upon these low-level mechanisms to implement the control constructs of C. In our presentation, we ﬁrst cover the machine-level mechanisms and then show how the dif...
View Full Document
- Spring '10
- The American