#include "blocks.h" #include "optimise.h" #define ADDRLP4 (ADDRL + P + sizeop(4)); #define MAX_VREGS 100 static void doNode(Node node); static void cleanBlock(Block b); static char* mergetemps() { // Identify forests // Create list of temps. // Work though each forest // For each forest: // If symbol is temporary & not marked, replace with temp from list // If non spare in list: add temp to list. // At end of forest. Set index to 0. flow_applyToBlocks(cleanBlock); return NULL; } static void cleanBlock(Block block) { if (visitedThisBlock(block)) return; markBlockAsVisited(block); Node p, last; last = block_lastNode(block)->x.next; // fprint(stderr, "Cleaning up block %d\n", block_id(b)); for (p = block_firstNode(block); p != last; p = p->x.next) { doNode(p); } } static void doForest(Node forest) { // Loop through forest; doTree(tree); reset(); } optimiser merge = { "merge", "Remaining local variables, ie. compiler generated variables are merged.", 0, &mergetemps };