1ade1368c924aab0fe22a69835bf0e71858e1cdc
[satune.git] / src / AST / function.h
1 #ifndef FUNCTION_H
2 #define FUNCTION_H
3 #include "classlist.h"
4 #include "mymemory.h"
5 #include "ops.h"
6 #include "structs.h"
7
8 class Function {
9 public:
10         Function(FunctionType _type) : type(_type) {}
11         FunctionType type;
12         virtual ~Function() {}
13         virtual Function *clone(CSolver *solver, CloneMap *map) {ASSERT(0); return NULL;}
14         MEMALLOC;
15 };
16
17 class FunctionOperator : public Function {
18 public:
19         ArithOp op;
20         Array<Set *> domains;
21         Set *range;
22         OverFlowBehavior overflowbehavior;
23         FunctionOperator(ArithOp op, Set **domain, uint numDomain, Set *range, OverFlowBehavior overflowbehavior);
24         uint64_t applyFunctionOperator(uint numVals, uint64_t *values);
25         bool isInRangeFunction(uint64_t val);
26         Function *clone(CSolver *solver, CloneMap *map);
27         MEMALLOC;
28 };
29
30 class FunctionTable : public Function {
31 public:
32         Table *table;
33         UndefinedBehavior undefBehavior;
34         FunctionTable (Table *table, UndefinedBehavior behavior);
35         Function *clone(CSolver *solver, CloneMap *map);
36         MEMALLOC;
37 };
38
39 #endif