




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The exam takes 89 minutes. For each exercise, you can see how many points can be achieved, for a total of 50 points. Write in comprehensible ...
Typology: Exercises
1 / 8
This page cannot be seen from the preview
Don't miss anything!





Fakultät IV Institut für Technische Informatik und Mikroelektronik FG Architektur eingebetteter Systeme
Exercise 1 2 3 4 5
∑
max. points 18 4 24 6 6 58 reached points corrector
Important Instructions:
Write a Regular Expression for the following languages:
(a) Write a grammar matching simple arithmetic expressions
(b) Is this language regular? Justify your answer. (A formal proof is not necessary.)
An expression a op b is said to be very busy at program point P if along every control flow path from P there is an expression a op b before a redefinition of a or b.
Show how very busy expressions may be calculated using iterative dataflow analysis by filling out the following table. The Dominators analysis is provided as a reference for the expected format. If you use gen and kill sets, don’t forget to precisely define what they contain for this analysis.
Dominators Very Busy Expression
Domain Sets of blocks
Direction Forward
Meet Intersection
Transfer Func. fB ( x ) = x ∪ { B }
Equations OUT[ B ] = fB (IN[ B ])
IN[ B ] = ⋂ P ∈ pred ( B ) OUT[ P^ ]
Initialization OUT[ P ] = all blocks
Boundary OUT[ Entry ] = ∅
Given the code:
1 b = a + 2 ; 2 c = b ∗ b ; 3 b = c + 1 ; 4 r e t u r n b ∗ a ;
(a) Write the set of live variables before each instruction (i.e., IN ( i )).
(b) Draw the register interference graph.
(c) Assume to have only two physical registers, find an optimal registry allocation.
The original code shown on the left has been transformed into the code on the right by inlining the muldiv function into the test function. Starting from the inlined variant, name and apply at least three additional optimizations. Show the new code after each applied optimization.
/// Original code static unsigned muldiv( unsigned arg1, unsigned arg2, unsigned op) { if (op == 0) { return arg1 * arg2; } else { return arg1 / arg2; } } unsigned test(unsigned arg) { return muldiv(arg, 16, 1); }
/// After inlining unsigned test(unsigned arg) { unsigned arg = arg1, arg2 = 16, op = 1; if (op == 0) { retval = arg1 * arg2; } else { retval = arg1 / arg2; } return retval; }