---------------------------------------------- A-1 Declarations, Expressions, and Assignments ---------------------------------------------- Compile the following program (file A-1.c) and observe the GIMPLE dumps and answer the questions below. If you manage to finish all questions quickly try to attempt the optional problem. Source file : A-1.c Compilation : gcc-4.7.2 -c -fdump-tree-gimple A-1.c View result : vi -O A-1.c A-1.c.*.gimple Clear dumps : rm -f A-1.c.* A-1.o Program ------- int Z; void main() { int a, b, c; int p = 6; int q; double r; a = 10; b = 20; c = a * b + 25; p = 6; q = Z; r = 34.5; Z = r; Z = Z + 1; } Questions --------- 1 How do the declarations look in the GIMPLE? Specifically, what happens to multiple variables declared and initialized on the same line? What happens to global declaration [int Z]? 2 How are complex expressions such as [c = a * b + 25] broken down? Can you determine a rule as to when temporary variables will be introduced? 3 How are floats/doubles represented in GIMPLE? What happens when a float/double is assigned to an integer in [Z = r]? 4 How are reads/writes to the global variable Z performed? Why is there a temporary introduced for the statement [Z = Z + 1] but not for the statements [q = Z] or [Z = p]? Optional Problem ---------------- Try to understand the underlying GIMPLE representation by looking at the RAW dumps: Compilation : gcc-4.7.2 -c -fdump-tree-gimple-raw A-1.c View result : vi -O A-1.c A-1.c.*.gimple