Commit | Line | Data |
---|---|---|
953192ba MD |
1 | #ifndef _FILTER_IR_H |
2 | #define _FILTER_IR_H | |
3 | ||
4 | /* | |
5 | * filter-ir.h | |
6 | * | |
7 | * LTTng filter ir | |
8 | * | |
9 | * Copyright 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
10 | * | |
11 | * This library is free software; you can redistribute it and/or modify it | |
12 | * under the terms of the GNU Lesser General Public License, version 2.1 only, | |
13 | * as published by the Free Software Foundation. | |
14 | * | |
15 | * This library is distributed in the hope that it will be useful, | |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | * Lesser General Public License for more details. | |
19 | * | |
20 | * You should have received a copy of the GNU Lesser General Public License | |
21 | * along with this library; if not, write to the Free Software Foundation, | |
22 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
23 | */ | |
24 | ||
25 | #include "filter-ast.h" | |
26 | ||
27 | enum ir_op_signedness { | |
28 | IR_SIGN_UNKNOWN = 0, | |
29 | IR_SIGNED, | |
30 | IR_UNSIGNED, | |
31 | IR_SIGN_DYN, /* signedness determined dynamically */ | |
32 | }; | |
33 | ||
34 | enum ir_data_type { | |
35 | IR_DATA_UNKNOWN = 0, | |
36 | IR_DATA_STRING, | |
37 | IR_DATA_NUMERIC, /* numeric and boolean */ | |
e90d8561 | 38 | IR_DATA_FLOAT, |
953192ba | 39 | IR_DATA_FIELD_REF, |
586dc72f | 40 | IR_DATA_GET_CONTEXT_REF, |
953192ba MD |
41 | }; |
42 | ||
43 | enum ir_op_type { | |
44 | IR_OP_UNKNOWN = 0, | |
45 | IR_OP_ROOT, | |
46 | IR_OP_LOAD, | |
47 | IR_OP_UNARY, | |
48 | IR_OP_BINARY, | |
49 | IR_OP_LOGICAL, | |
50 | }; | |
51 | ||
52 | /* left or right child */ | |
53 | enum ir_side { | |
54 | IR_SIDE_UNKNOWN = 0, | |
55 | IR_LEFT, | |
56 | IR_RIGHT, | |
57 | }; | |
58 | ||
59 | struct ir_op_root { | |
60 | struct ir_op *child; | |
61 | }; | |
62 | ||
63 | struct ir_op_load { | |
64 | union { | |
65 | char *string; | |
66 | int64_t num; | |
e90d8561 | 67 | double flt; |
953192ba MD |
68 | char *ref; |
69 | } u; | |
70 | }; | |
71 | ||
72 | struct ir_op_unary { | |
73 | enum unary_op_type type; | |
74 | struct ir_op *child; | |
75 | }; | |
76 | ||
77 | struct ir_op_binary { | |
78 | enum op_type type; | |
79 | struct ir_op *left; | |
80 | struct ir_op *right; | |
81 | }; | |
82 | ||
83 | struct ir_op_logical { | |
84 | enum op_type type; | |
85 | struct ir_op *left; | |
86 | struct ir_op *right; | |
87 | }; | |
88 | ||
89 | struct ir_op { | |
90 | /* common to all ops */ | |
91 | enum ir_op_type op; | |
92 | enum ir_data_type data_type; | |
93 | enum ir_op_signedness signedness; | |
94 | enum ir_side side; | |
95 | ||
96 | union { | |
97 | struct ir_op_root root; | |
98 | struct ir_op_load load; | |
99 | struct ir_op_unary unary; | |
100 | struct ir_op_binary binary; | |
101 | struct ir_op_logical logical; | |
102 | } u; | |
103 | }; | |
104 | ||
105 | #endif /* _FILTER_IR_H */ |