X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Ffilter-visitor-generate-ir.c;h=d23372f4b0eb672abf15f0c08bffb73c7e3212ab;hb=32dd26fbc3c69fe677a7917535e10ace066e674c;hp=9d44b234924da53f2d6a97b0333419ca0d4b0b78;hpb=953192ba6eb2118c22bcfcb4bcd813f141b407e7;p=lttng-tools.git diff --git a/src/lib/lttng-ctl/filter-visitor-generate-ir.c b/src/lib/lttng-ctl/filter-visitor-generate-ir.c index 9d44b2349..d23372f4b 100644 --- a/src/lib/lttng-ctl/filter-visitor-generate-ir.c +++ b/src/lib/lttng-ctl/filter-visitor-generate-ir.c @@ -26,8 +26,8 @@ #include #include #include -#include "filter-parser.h" #include "filter-ast.h" +#include "filter-parser.h" #include "filter-ir.h" static @@ -100,6 +100,22 @@ struct ir_op *make_op_load_numeric(int64_t v, enum ir_side side) return op; } +static +struct ir_op *make_op_load_float(double v, enum ir_side side) +{ + struct ir_op *op; + + op = calloc(sizeof(struct ir_op), 1); + if (!op) + return NULL; + op->op = IR_OP_LOAD; + op->data_type = IR_DATA_FLOAT; + op->signedness = IR_SIGN_UNKNOWN; + op->side = side; + op->u.load.u.flt = v; + return op; +} + static struct ir_op *make_op_load_field_ref(char *string, enum ir_side side) { @@ -314,8 +330,8 @@ struct ir_op *make_op_binary_compare(enum op_type bin_op_type, } if ((left->data_type == IR_DATA_STRING - && right->data_type == IR_DATA_NUMERIC) - || (left->data_type == IR_DATA_NUMERIC && + && (right->data_type == IR_DATA_NUMERIC || right->data_type == IR_DATA_FLOAT)) + || ((left->data_type == IR_DATA_NUMERIC || left->data_type == IR_DATA_FLOAT) && right->data_type == IR_DATA_STRING)) { fprintf(stderr, "[error] binary operation '%s' operand type mismatch\n", op_str); goto error; @@ -492,6 +508,9 @@ struct ir_op *make_expression(struct filter_parser_ctx *ctx, case AST_EXP_CONSTANT: return make_op_load_numeric(node->u.expression.u.constant, side); + case AST_EXP_FLOAT_CONSTANT: + return make_op_load_float(node->u.expression.u.float_constant, + side); case AST_EXP_IDENTIFIER: if (node->u.expression.pre_op != AST_LINK_UNKNOWN) { fprintf(stderr, "[error] %s: dotted and dereferenced identifiers not supported\n", __func__); @@ -633,6 +652,8 @@ static struct ir_op *make_unary_op(struct filter_parser_ctx *ctx, struct filter_node *node, enum ir_side side) { + const char *op_str = "?"; + switch (node->u.unary_op.type) { case AST_UNARY_UNKNOWN: default: @@ -684,7 +705,17 @@ struct ir_op *make_unary_op(struct filter_parser_ctx *ctx, } return op; } + case AST_UNARY_BIN_NOT: + { + op_str = "~"; + goto error_not_supported; + } } + +error_not_supported: + fprintf(stderr, "[error] %s: unary operation '%s' not supported\n", + __func__, op_str); + return NULL; } static