Here is the updated version of BCCK for HW3. It is final unless you find problems in it. Because of the requirements of the homework, some of the BCCK framework needed to be changed. What this means from user's perspective is that some existing work that you have done might break. In most cases the changes you need to do to make it work again are both minor and obvious. If you are experiencing a problem with it and you are not sure how to fix it, contact Kamen. To illustrate the functionality of this fixed version, there are three examples, all in the BCC project. These are DependenceAnalysis, TestTile and TestUnimodularTransform. These are passes p3, p4 and p5 respectively in BCC.cs. You can comment out two of them and leave only one to experiment how they behave. The line to comment is pX.execute(ref e), where X is 3, 4 or 5. It is easiest if you experiment with the following input: ------------------------------ const int SIZE = 500; int main(int argc, char* argv[]) { int i, j, k; for(i=0; i<=SIZE-1; ++i) for(j=0; j<=SIZE-1; ++j) for(k=0; k<=SIZE-1; ++k) C[i][j] += A[i][k] * B[k][j]; return 1; } ------------------------------ The result from DependenceAnalysis.cs is: Parsing (C:\user\BC\BCC\bin\Debug\test4.c)... done! Ambiguity resolutions: 4 (1 Syntactic + 3 Semantic) PASS: NodeInitializer... Done! PASS: ArrayFixup... Done! PASS: SymbolTableBuilder... Done! PASS: DependenceAnalysis... Function: main WAW between C[i][j] and C[i][j]: (0, 0, +) RAR between A[i][k] and A[i][k]: (0, +, 0) RAR between B[k][j] and B[k][j]: (+, 0, 0) Done! PASS: Simplifier... Done! PASS: NodeDeinitializer... Done! Time: 00:00:01.8626784 The result from TestTile.cs is: const int SIZE = 500; int main(int argc, char * argv[]) { int i; int j; int k; { int _i; int _j; int _k; for (_i = 0; _i <= SIZE - 1; _i += 10) for (_j = 0; _j <= SIZE - 1; _j += 10) for (_k = 0; _k <= SIZE - 1; _k += 10) for (i = _i; i <= min(_i + 10, SIZE - 1); i += 1) for (j = _j; j <= min(_j + 10, SIZE - 1); j += 1) for (k = _k; k <= min(_k + 10, SIZE - 1); k += 1) C[i][j] += A[i][k] * B[k][j]; } return 1; } and finally the result from TestUnimodularTransform.cs is: const int SIZE = 500; int main(int argc, char * argv[]) { int i; int j; int k; { int _i; int _j; int _k; for (_i = 0; _i <= -1 + SIZE; _i += 1) for (_j = 0; _j <= -1 + SIZE; _j += 1) for (_k = 2 * _i; _k <= -1 + 2 * _i + SIZE; _k += 1) { i = -2 * _i + _k; j = _j; k = _i; C[i][j] += A[i][k] * B[k][j]; } } return 1; } As you might have already guessed, these three examples do the following: 1. DependenceAnalysis.cs is a paragon solution to HW2. It also has reuse vectors. You can use this for HW3. 2. TestTile.cs finds a loopnest inside a function and tiles it with square tiles of size 10. 3. TestUnimodularTransform.cs finds a 3-deep loopnest inside a function and transforms it with the unimodular matrix [[1 0 0][0 1 0][2 0 1]]. As you can say from the source of 2 and 3, they are just examples, not general purpose routines. Running them successfully on anything but the input described above is not guaranteed to work. They should serve you as an example of what you might need to do as part of HW3. There are a bunch of interesting changes to BCCK with a lot of new functionality: 1. Omega is handled much better a. You can walk the DNF b. You can use && and || in formulas, so no excessive parethesizing is needed anymore... c. You can reuse the variables you define... (a favourite trouble in HW2). d. A lot of useful relations are implemented for you e. Translation of native AST expressions to/from Omega expressions is implemented 2. Passes work a bit differently. a. Inside VisitXXX the first parameter is of type AbstractNode and is passed by reference. This lets you change the node you are visiting to something completely different. b. A simplifier pass has been implemented to optimize expressions like 0*x 1*x x+0 and so on. These are generated a lot in unimodular transforms... 3. Integer Linear Programming Stuff is implemented a. A very powerful Matrix class b. Null spaces, Kernels, ColumnEchelonForm, ... c. ... There is a good chance that I have missed something. In any case if something is not clear, send me e-mail. I will give a short lecture at some point in the week after the break where I will give more examples and you can ask all your questions. You can also run DependenceAnalysis.cs on the example input for HW2: void test1 (int N) { int i, j, k; for(i=0; i