Last change
on this file since 252 was 2, checked in by Rick van der Zwet, 15 years ago |
Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)
|
File size:
1.2 KB
|
Rev | Line | |
---|
[2] | 1 | /*
|
---|
| 2 | * ICGenerator.cc - Implementation of the ICGenerator class
|
---|
| 3 | *
|
---|
| 4 | * Part of the assignment of the Compiler Construction course
|
---|
| 5 | * LIACS, Leiden University
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #include <sstream>
|
---|
| 9 | #include "ICGenerator.h"
|
---|
| 10 |
|
---|
| 11 | // Constructor
|
---|
| 12 | ICGenerator::ICGenerator() {
|
---|
| 13 | tempvarIndex = 0;
|
---|
| 14 | labelIndex = 0;
|
---|
| 15 | symtab = NULL;
|
---|
| 16 | tree = NULL;
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 |
|
---|
| 20 | // Destructor
|
---|
| 21 | ICGenerator::~ICGenerator() {
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 | // Preprocesses the syntax tree; this method is called before
|
---|
| 26 | // GenerateIntermediateCode() if optimizations are enabled
|
---|
| 27 | void ICGenerator::Preprocess (SyntaxTree * tree, SymbolTable * symtab) {
|
---|
| 28 | this->symtab = symtab;
|
---|
| 29 | this->tree = tree;
|
---|
| 30 |
|
---|
| 31 | // For assignment 5, this function might be a suitable point where you can
|
---|
| 32 | // apply some optimizations to the syntax tree. For example, you can insert
|
---|
| 33 | // the optimization code you wrote for assignment 3.
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 |
|
---|
| 37 |
|
---|
| 38 | // Postprocesses the intermediate code; this method is called after
|
---|
| 39 | // GenerateIntermediateCode() if optimizations are enabled
|
---|
| 40 | void ICGenerator::Postprocess (IntermediateCode * code, SymbolTable * symtab) {
|
---|
| 41 | this->symtab = symtab;
|
---|
| 42 |
|
---|
| 43 | // For assignment 5, this function might be a suitable point where you can
|
---|
| 44 | // apply some optimizations to the syntax tree. For example, you can insert
|
---|
| 45 | // the optimization code you wrote for assignment 3.
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.