------------------------------- a1ve Expression and Assignments ------------------------------- Compile the following program (file a1ve.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 : a1ve.c Compilation : gcc -c -fdump-tree-gimple a1ve.c View result : vi -O a1ve.c a1ve.c.*.gimple Clear dumps : rm -f a1ve.c.* a1ve.o Program ------- int N; void main() { int a, b; int c = 2; int x; a = b; x = 5; c = a + b; x = N * 2; c = a * 2 + b * 3; N = c + x; } Questions --------- 1 How do the declarations look in the GIMPLE? Specifically, what happens to: (a) the multi-variable declaration [int a, b], (b) the initialization declaration [int c = 2], and (c) the global declaration [int N]? 2 How do assignment statements get translated into GIMPLE? Is there any difference between constant assignments, variable assignments, simple expressions, and assignments to globals? 3 How are complex expressions such as [c = a * 2 + b * 3] broken down? 4 Why do you think simple expressions [c = a + b] can appear in GIMPLE but not a complex expression [c = a * 2 + b * 3]? Optional Problem ---------------- Try to understand the underlying GIMPLE representation by looking at the RAW dumps: Compilation : gcc -c -fdump-tree-gimple-raw a1ve.c View result : vi -O a1ve.c a1ve.c.*.gimple