Compilers (CS362 2001S)

Class 38: Additional Improvement Techniques

Back to General Improvement Techniques. On to Student Presentations (1).

Held Wednesday, May 2, 2001


Today we continue our study of optimization with an extended example.


Improvement, Continued

Loop Optimizations

A Longer Example

  • Given those assumptions, and knowledge that the representation of A begins at some position (which we'll also call A), where if A[x,y]?
  • The code will look something like the following
      mov $1, i
      je i, n END_OUTER
      mov $1, j
      je   j,   n,   END_INNER
      sub  i,   $1,  t1
      mul  t1,  $4,  t2
      mul  t2,  n,   t3
      sub  j,   $1,  t4
      mul  t4,  $4,  t5
      add  t3,  t5,  t6
      mov  offset(A,t6), t7
      sub  j,   $1,  t8
      mul  t8,  $4,  t9
      mul  t9,  n,   t10
      sub  i,   $1,  t11
      mul  t11, $4,  t12
      add  t10, t12, t13
      mov  t7, offset(B,t13)
      add  j, $1, j
      jump NEXT_INNER
      add  i, $1, i
      jump NEXT_OUTER
  • We'll start by breaking the code into basic blocks.
  • We'll continue by identifying and eliminating common subexpressions.
  • We'll continue by propagating copies.
  • We'll conclude by identifying induction variables and reducing the strength of some operations.



    Monday, 22 January 2001

    • Created as a blank outline.

    Wednesday, 2 May 2001

    • Filled in the details.


    Back to General Improvement Techniques. On to Student Presentations (1).

    Disclaimer: I usually create these pages on the fly. This means that they are rarely proofread and may contain bad grammar and incorrect details. It also means that I may update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

    This page was generated by Siteweaver on Wed May 2 10:50:43 2001.
    This page may be found at
    You may validate this page's HTML.
    The source was last modified Wed May 2 10:46:43 2001.