\n"); exit(1); } n = atoi(argv[1]); for (i=1, s=1 ; i <= n ; i++) s *= i; printf("fact %d = %d\n", (i-1), s); exit(0); A BASIC BLOCK is a sequence of consecutive language statements with the following properties: Program flow doesn't jump into or from that block except maybe to the first statement or from the last statement. A simple example of such a jump is executing any GOTO statement, but IF and DO statements are really constructed out of similar implied jumps. The sequence is maximal in the sense that adding one more statement at the beginning of the block, or one more statement at the end, will make the previous requirement false. When you examine the way program control flows, the basic blocks are the natural building blocks, so making their boundaries stand out will make the code easier to follow."> \n"); exit(1); } n = atoi(argv[1]); for (i=1, s=1 ; i <= n ; i++) s *= i; printf("fact %d = %d\n", (i-1), s); exit(0); A BASIC BLOCK is a sequence of consecutive language statements with the following properties: Program flow doesn't jump into or from that block except maybe to the first statement or from the last statement. A simple example of such a jump is executing any GOTO statement, but IF and DO statements are really constructed out of similar implied jumps. The sequence is maximal in the sense that adding one more statement at the beginning of the block, or one more statement at the end, will make the previous requirement false. When you examine the way program control flows, the basic blocks are the natural building blocks, so making their boundaries stand out will make the code easier to follow.">
Download presentation
Presentation is loading. Please wait.
Published byΧρυσάνθη Καλλιγάς Modified over 5 years ago
1
What is a Basic Block ? A BASIC BLOCK is a sequence of consecutive language statements with the following properties: Program flow doesn't jump into or from that block except maybe to the first statement or from the last statement. A simple example of such a jump is executing any GOTO statement, but IF and DO statements are really constructed out of similar implied jumps. The sequence is maximal in the sense that adding one more statement at the beginning of the block, or one more statement at the end, will make the previous requirement false. When you examine the way program control flows, the basic blocks are the natural building blocks, so making their boundaries stand out will make the code easier to follow
2
Mapping C code to Blocks Using IR Viewer
Fact2 benchmark source int main (int argc, char *argv[]) { int i,s,n; if (argc < 2) { printf("Usage: fact2 <n>\n"); exit(1); } n = atoi(argv[1]); for (i=1, s=1 ; i <= n ; i++) s *= i; printf("fact %d = %d\n", (i-1), s); exit(0); A BASIC BLOCK is a sequence of consecutive language statements with the following properties: Program flow doesn't jump into or from that block except maybe to the first statement or from the last statement. A simple example of such a jump is executing any GOTO statement, but IF and DO statements are really constructed out of similar implied jumps. The sequence is maximal in the sense that adding one more statement at the beginning of the block, or one more statement at the end, will make the previous requirement false. When you examine the way program control flows, the basic blocks are the natural building blocks, so making their boundaries stand out will make the code easier to follow.
3
Indentifying Loops int main (int argc, char *argv[]) { int i,s,n; if (argc < 2) { printf("Usage: fact2 <n>\n"); exit(1); } n = atoi(argv[1]); for (i=1, s=1 ; i <= n ; i++) s *= i; printf("fact %d = %d\n", (i-1), s); exit(0);
4
Reading REBEL Code Format of a Rebel Operation Format of Operand in Rebel Operation
5
Example Rebel Block (eight Benchmark)
bb 2 ( weight(1) entry_ops(65) exit_ops(66) entry_edges(ctrl ^13) exit_edges(ctrl ^21) flags(sched) attr(lc ^102) subregions( op 65 (C_MERGE [] [] s_time(0) s_opcode(C_MERGE.0) in_edges(op-64(1)) flags(sched)) op 7 (MOVE [br<6:i gpr 4>] [i<0>] p<t> s_time(0) s_opcode(MOVE.0) op 8 (MOVE [br<5:i gpr 12>] [i<0>] p<t> s_time(0) s_opcode(MOVE.1) op 9 (MOVE [br<4:i gpr 11>] [i<0>] p<t> s_time(0) s_opcode(MOVE.2) op 10 (MOVE [br<3:i gpr 5>] [i<0>] p<t> s_time(0) s_opcode(MOVE.3) op 11 (MOVE [br<2:i gpr 10>] [i<0>] p<t> s_time(1) s_opcode(MOVE.0) op 12 (MOVE [br<1:i gpr 2>] [i<0>] p<t> s_time(1) s_opcode(MOVE.1) op 66 (DUMMY_BR [] [] s_time(2) s_opcode(DUMMY_BR.0) out(op-67(1)) ) Frequency of visits to region Entry only at Op 65 and exit at Op 66 Sub-region containing Operations In the eight benchmark, this block corresponds to the a=b=c=d=e=x=y=0; statement. Each Operation MOVEs to the variable’s register the value ‘0’ Thus one of the above variables is in virtual register 1/physical register 2 and is initialized to ‘0’ The Format of the various instructions is given in the HPL-PD Industry Standard Architecture
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.