Primary:
[Skip To Body]
[Front Door]
[Current]
[Glance]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Sets:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Project]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Miscellaneous:
[2001S]
[98F]
[SamR]
[Glimmer Labs]
Back to General Improvement Techniques. On to Code Improvement, Concluded.
Held Wednesday, December 4, 2002
Summary
Today we continue our study of optimization with an extended example.
Notes
Overview
LOOP: add t1, $1, t1 mul t1, $4, t2 ...
LOOP: add t2, $4, t2 ...
for i := 1 to n do for j := 1 to n do B[j,i] := A[i,j]
MOV $1, i NEXT_OUTER: JEQ i, n -> END_OUTER MOV $1 -> j NEXT_INNER: JEQ j, n -> END_INNER ISUB i, $1 -> t1 IMUL t1, $4 -> t2 IMUL t2, n -> t3 ISUB j, $1 -> t4 IMUL t4, $4 -> t5 IADD t3, t5 -> t6 MOV offset(A,t6) -> t7 ISUB j, $1 -> t8 IMUL t8, $4 -> t9 IMUL t9, n -> t10 ISUB i, $1 -> t11 IMUL t11, $4 -> t12 IADD t10, t12 -> t13 IMOV t7 -> offset(B,t13) IADD j, $1 -> j JUMP NEXT_INNER END_INNER: IADD i, $1 -> i JUMP NEXT_OUTER END_OUTER: ...
Back to General Improvement Techniques. On to Code Improvement, Concluded.
Primary:
[Skip To Body]
[Front Door]
[Current]
[Glance]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Sets:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Project]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Miscellaneous:
[2001S]
[98F]
[SamR]
[Glimmer Labs]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Fri Dec 6 10:53:08 2002.
The source to the document was last modified on Wed Sep 25 10:45:03 2002.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS362/2002F/Outlines/outline.38.html
.
You may wish to
validate this document's HTML
;
;
Check with Bobby