---------------------------------------------- a2if Conditional Jumps and Control Flow Graphs ---------------------------------------------- Compile the following program (file a2if.c) and observe the GIMPLE dumps. Source file : a2if.c Compilation : gcc -c -fdump-tree-gimple a2if.c View result : vi -O a2if.c a2if.c.*.gimple Clear dumps : rm -f a2if.c.* a2if.o Program ------- #define true 1 #define false 0 #define bool unsigned bool LeapYear(unsigned int Year) { bool Leap; if(Year % 4 == 0) { if(Year % 100 == 0) { if(Year % 400 == 0) { Leap = true; } else { Leap = false; } } else { Leap = true; } } else { Leap = false; } return Leap; } Questions --------- 1 How have if-blocks been translated into GIMPLE statements? Comment about the usage of conditional and unconditional gotos. 2 Repeat the above compilation, but now asking for another dump that of the pass "cfg". View this pass and say whether this representation makes it easier to read and understand GIMPLEs. Draw the control-flow graph of the program a2if.c on a piece of paper by looking at the CFG dump. Compilation : gcc -c -fdump-tree-cfg a2if.c View result : vi -O a2if.c a2if.c.*.cfg ***Note*** From here onwards we will only look at passes from "cfg" onwards, each of which uses a CFG-based representation using basic blocks.