Small edit
[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 "astops.h"
7 #include "structs.h"
8
9 class Function {
10 public:
11         Function(FunctionType _type) : type(_type) {}
12         FunctionType type;
13         virtual ~Function() {}
14         virtual Function *clone(CSolver *solver, CloneMap *map) {ASSERT(0); return NULL;}
15         CMEMALLOC;
16 };
17
18 class FunctionOperator : public Function {
19 public:
20         ArithOp op;
21         Array<Set *> domains;
22         Set *range;
23         OverFlowBehavior overflowbehavior;
24         FunctionOperator(ArithOp op, Set **domain, uint numDomain, Set *range, OverFlowBehavior overflowbehavior);
25         uint64_t applyFunctionOperator(uint numVals, uint64_t *values);
26         bool isInRangeFunction(uint64_t val);
27         Function *clone(CSolver *solver, CloneMap *map);
28         CMEMALLOC;
29 };
30
31 class FunctionTable : public Function {
32 public:
33         Table *table;
34         UndefinedBehavior undefBehavior;
35         FunctionTable (Table *table, UndefinedBehavior behavior);
36         Function *clone(CSolver *solver, CloneMap *map);
37         CMEMALLOC;
38 };
39
40 #endif