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#ifndef _OPT_SUPPORT_H
10#define _OPT_SUPPORT_H
11
12#include "mal.h"
13#include "mal_function.h"
14#include "mal_scenario.h"
15#include "mal_builder.h"
16
17/*
18 * The optimizers should all be equiped with debugging code
19 * to easily trace their performance.
20 */
21mal_export str MALoptimizer(Client c);
22mal_export str optimizeMALBlock(Client cntxt, MalBlkPtr mb);
23mal_export void showOptimizerStep(str fnme,int i, int flg);
24mal_export void showOptimizerHistory(void);
25
26mal_export int optimizerIsApplied(MalBlkPtr mb, str name);
27mal_export int isUnsafeInstruction(InstrPtr q);
28mal_export int isUnsafeFunction(InstrPtr q);
29mal_export int isSealedFunction(InstrPtr q);
30mal_export int safetyBarrier(InstrPtr p, InstrPtr q);
31mal_export int hasSameSignature(MalBlkPtr mb, InstrPtr p, InstrPtr q);
32mal_export int hasSameArguments(MalBlkPtr mb, InstrPtr p, InstrPtr q);
33mal_export int hasCommonResults(InstrPtr p, InstrPtr q);
34mal_export int isUpdateInstruction(InstrPtr p);
35mal_export int hasSideEffects(MalBlkPtr mb, InstrPtr p, int strict);
36mal_export int mayhaveSideEffects(Client cntxt, MalBlkPtr mb, InstrPtr p, int strict);
37mal_export int isSideEffectFree(MalBlkPtr mb);
38mal_export int isBlocking(InstrPtr p);
39mal_export int isFragmentGroup(InstrPtr q);
40mal_export int isFragmentGroup2(InstrPtr q);
41mal_export int isDelta(InstrPtr q);
42mal_export int isMatJoinOp(InstrPtr q);
43mal_export int isMatLeftJoinOp(InstrPtr q);
44mal_export int isMapOp(InstrPtr q);
45mal_export int isLikeOp(InstrPtr q);
46mal_export int isTopn(InstrPtr q);
47mal_export int isSlice(InstrPtr q);
48mal_export int isSample(InstrPtr q);
49mal_export int isOrderby(InstrPtr q);
50mal_export int isSelect(InstrPtr q);
51mal_export int isSubJoin(InstrPtr q);
52mal_export int isMultiplex(InstrPtr q);
53mal_export int isOptimizerEnabled(MalBlkPtr mb, str opt);
54
55#endif /* _OPT_SUPPORT_H */
56
57