Download Theory of Language Translation - Lecture Slides | CMSC 430 and more Study notes Computer Science in PDF only on Docsity! ! " # $ % & ' $ ' # $ % Lecture 1 2CMSC 430 ( )*)) ' • + → , ' - ' ' .) & /0 ' ' ' ' 1 ' )0 ! ' ' ) 1 2 -*.# -*.) ' % ' 1 ' ) • 3 4 % → ' 2 ' & ' ' 1 ' )5 ' ' ! 2 )5 ' ' 4 % 1 & ' ' & % ' ' & *) Lecture 1 3CMSC 430 6 7 • → 8 ' 9: → 0 8: • 5 4 → : → 5 : → * : → 7 : → 3 ' ! : ; / ' % 4 ) Lecture 1 4CMSC 430 6 7 • <1' → ' → 0 • 5 ' • 5 4 * 0' % # % ' % + = > Lecture 1 5CMSC 430 • • 5 • 1 % ? • #' <% ' • , ' # • 7 • 3 ' ! • + & ? • # ? • , Lecture 1 6CMSC 430 # ' ' 1 * • < ? ' → " ! 8 Lecture 1 7CMSC 430 * 2 • ,& 1 % → ,& ' ' ' ' @ 3 5A • B * → ; ' & % → 6 * ' ' • ' ' → 5 4 ' 4 ' )C & % • $ % → ' ? % 2 → 5 2 4 0 ' Lecture 1 8CMSC 430 ' • ' D → ? ' 1 ' 1 ' → ? ' ' % ' ' & • D → ? ' 1 ' 1 ' • ' ' • E % ' - E %F . → & → 3 E ' ' + ' ' ! - . Lecture 1 9CMSC 430 ' D • ' ' ' & ' → ' & ' ' ' ' • ' ' → • % ' → ' ' ' G • % ' ** → ' • ' 1 ' " → ? 1' ' H " Lecture 1 10CMSC 430 , ' % % ' ' ' ? 7 ' C 2 ? ' 7 ' + ' ' ' + 0? " 5+ ? ' 01 ' ' ? " ' ! ? 5 " ' ' , Lecture 1 11CMSC 430 , ' ' ' / → ' ' → ' % ' ' ' → ' ' * & ' ' → ' & ' ' ' 1' → ' ' ' 1 ' ' ' → 2 ' ' 1 Lecture 1 12CMSC 430 * $ ! """ # $ # " % &'$ 9 Lecture 1 25CMSC 430 6*< , • 5 ' • * % ' • $ % & ' ' → ' ' ' ' ' & ' OPQ → ' 5+ 5 F ? R → 3 # , ' ' 4 Lecture 1 26CMSC 430 6*< # ? • C % % & • ' • " 3 ? + " 3 #< • 3 ' ;5 ' - * . ' 1' ;5 ' ' 4 Lecture 1 27CMSC 430 6*< , • ? % & * • $ % • ' % - . 3 ' ;5 ' C 2 & % 4 Lecture 1 28CMSC 430 ' ,' % ' - 3 ' ! . • ? ! ,# & - ' .,# • 5 ' ' ' → ' % & ' G • % @' A → % ' % 4 99 9S ' & * 9 Lecture 1 29CMSC 430 3 ' ! - <. ' • + % " ' % • % ' 2 1 • ! ' ' 1 • + % ' " ' % • # ' % • < ' ' ' 7 7 7 7 """ 5 8 Lecture 1 30CMSC 430 <1' 3 ' ! <1 0 4 94 9.::, 94 9;.;::)<9 5:) = 5 > S Lecture 1 31CMSC 430 <1' 3 ' ! <1 0 4 94 9.::, 94 9;.;::)<9 5:) = 5 > = 7,. 4 9.:,4 9.:) 0 = = 7 Lecture 1 32CMSC 430 <1' 3 ' ! <1 0 4 94 9.::, 94 9;.;::)<9 5:) = 5 > = 7,. 4 9.:,4 9.:) 0 = = 7 94 9;.: = 7,. 94 9.:: 4 9.:,4 9.:) 0 = = 7 Lecture 1 33CMSC 430 # ' # - . ' / • 6 * ' ' • F ! • 5 ! • ? • ? 7) ? @ 4 ? @ 4 A Lecture 1 34CMSC 430 # #' ' • ' ' ' % → ? , % -* ' . → + → • #' * • < - 1 . • , ' → , • ' → 5 → ' ' ! Lecture 1 35CMSC 430 OQ/,6 =5)Q ' • % * • ' # ' # ' 1 8 % 6 & ' % ,# ' Dead code elimination Global cse Code motion Constant folding Strength reduction Value numbering Dead store elimination Code straightening Trap elimination Algebraic reassociation * Lecture 1 36CMSC 430 OQ/,6 =5)Q ' • % * • ' # ' # ' 1 8 % 6 & ' % ,# ' Multi-level IR has become common wisdom * P Lecture 1 37CMSC 430 OQS/C 5= 5? #, ' • % ' ! * • 0 1 ' ! -O . • ' ! ' Lecture 1 38CMSC 430 8/ 7 ,5 S ' - & 3 S ' , . 3 ' ! ' ,? S • * • 0% % ,# • 7 & % ' B )) 7 @ 0 7 A & 7 A Classic analysis Inlining (user & library code) Cloning (constants & locality) Dead function elimination Dead variable elimination Lecture 1 39CMSC 430 8/ 7 ,5 S ' - & 3 S ' , . 3 ' ! ' ,? S • * • 0% % ,# • 7 & % ' B )) 7 @ 0 7 A & 7 A @0 7 5 Dependence analysis Parallelization Loop transformations (fission, fusion, interchange, peeling, tiling, unroll & jam) Array privitization Lecture 1 40CMSC 430 8/ 7 ,5 S ' - & 3 S ' , . 3 ' ! ' ,? S • * • 0% % ,# • 7 & % ' B )) 7 @ 0 7 A & 7 A A & 7 5 SSA-based analysis & opt’n Constant propagation, PRE, OSR+LFTR, DVNT, DCE (also used by other phases) Lecture 1 41CMSC 430 8/ 7 ,5 S ' - & 3 S ' , . 3 ' ! ' ,? S • * • 0% % ,# • 7 & % ' B )) 7 @ 0 7 A & 7 A A If conversion & predication Code motion Scheduling (inc. sw pipelining) Allocation Peephole optimization Lecture 1 42CMSC 430 <% 8E , ' & & • 0 * & • 0 & -. ' ! ? % 1 % <' % ' ' ' &1