| 1 | /* |
| 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
| 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | * |
| 6 | * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. |
| 7 | */ |
| 8 | |
| 9 | #include "monetdb_config.h" |
| 10 | #include "opt_reduce.h" |
| 11 | #include "mal_interpreter.h" |
| 12 | |
| 13 | str |
| 14 | OPTreduceImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p) |
| 15 | { |
| 16 | int actions = 0; |
| 17 | char buf[256]; |
| 18 | lng usec = GDKusec(); |
| 19 | (void)cntxt; |
| 20 | (void)stk; |
| 21 | (void) p; |
| 22 | |
| 23 | actions = mb->vtop; |
| 24 | trimMalVariables(mb,0); |
| 25 | actions = actions - mb->vtop; |
| 26 | |
| 27 | /* Defense line against incorrect plans */ |
| 28 | /* plan is not changed */ |
| 29 | /* plan is not changed */ |
| 30 | //if( actions > 0){ |
| 31 | //chkTypes(cntxt->usermodule, mb, FALSE); |
| 32 | //chkFlow(mb); |
| 33 | //chkDeclarations(mb); |
| 34 | //} |
| 35 | /* keep all actions taken as a post block comment */ |
| 36 | usec = GDKusec()- usec; |
| 37 | snprintf(buf,256,"%-20s actions=%2d time=" LLFMT " usec" ,"reduce" ,actions, usec); |
| 38 | newComment(mb,buf); |
| 39 | if( actions >= 0) |
| 40 | addtoMalBlkHistory(mb); |
| 41 | |
| 42 | if( OPTdebug & OPTreduce){ |
| 43 | fprintf(stderr, "#REDUCE optimizer entry\n" ); |
| 44 | fprintFunction(stderr, mb, 0, LIST_MAL_ALL); |
| 45 | } |
| 46 | return MAL_SUCCEED; |
| 47 | } |
| 48 | |