Академический Документы
Профессиональный Документы
Культура Документы
All rights reserved: Fadzlin Binti Ahmadon, FSKM UiTM Jasin. For usage of CSC569 Principles of Compiler class.
ASSEMBLY LANGUAGE FOR CONTROL STRUCTURES
1. if-else
CMP
COND B L1
UNCOND B L2
L1 STMT
L2 STMT
2. while
L1 CMP
COND B L2
L2 STMT
UNCOND B L1 loop
L3 exit
3. for
MOV initialisation
LOD
Boolean
STO
L1 CMP
COND B L2
L2 STMT
UNCOND B L1 loop
L3 exit
All rights reserved: Fadzlin Binti Ahmadon, FSKM UiTM Jasin. For usage of CSC569 Principles of Compiler class.
Examples of operations:
5. if ( a > b) a = a+1
1. c = a + b;
CMP a, b
LOD R1, a BH L1
ADD R1, b B L2
STO R1, c L1: LOD R1, a
ADD R1, 1
2. a = 14; STO R1, a
b = 12; L2:
println(a-b);
All rights reserved: Fadzlin Binti Ahmadon, FSKM UiTM Jasin. For usage of CSC569 Principles of Compiler class.