Implement filter expression to bytecode compiler in liblttng-ctl
[lttng-tools.git] / src / lib / lttng-ctl / filter-ir.h
CommitLineData
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
27enum ir_op_signedness {
28 IR_SIGN_UNKNOWN = 0,
29 IR_SIGNED,
30 IR_UNSIGNED,
31 IR_SIGN_DYN, /* signedness determined dynamically */
32};
33
34enum ir_data_type {
35 IR_DATA_UNKNOWN = 0,
36 IR_DATA_STRING,
37 IR_DATA_NUMERIC, /* numeric and boolean */
38 IR_DATA_FIELD_REF,
39};
40
41enum ir_op_type {
42 IR_OP_UNKNOWN = 0,
43 IR_OP_ROOT,
44 IR_OP_LOAD,
45 IR_OP_UNARY,
46 IR_OP_BINARY,
47 IR_OP_LOGICAL,
48};
49
50/* left or right child */
51enum ir_side {
52 IR_SIDE_UNKNOWN = 0,
53 IR_LEFT,
54 IR_RIGHT,
55};
56
57struct ir_op_root {
58 struct ir_op *child;
59};
60
61struct ir_op_load {
62 union {
63 char *string;
64 int64_t num;
65 char *ref;
66 } u;
67};
68
69struct ir_op_unary {
70 enum unary_op_type type;
71 struct ir_op *child;
72};
73
74struct ir_op_binary {
75 enum op_type type;
76 struct ir_op *left;
77 struct ir_op *right;
78};
79
80struct ir_op_logical {
81 enum op_type type;
82 struct ir_op *left;
83 struct ir_op *right;
84};
85
86struct ir_op {
87 /* common to all ops */
88 enum ir_op_type op;
89 enum ir_data_type data_type;
90 enum ir_op_signedness signedness;
91 enum ir_side side;
92
93 union {
94 struct ir_op_root root;
95 struct ir_op_load load;
96 struct ir_op_unary unary;
97 struct ir_op_binary binary;
98 struct ir_op_logical logical;
99 } u;
100};
101
102#endif /* _FILTER_IR_H */
This page took 0.025704 seconds and 4 git commands to generate.