perf expr: Merge find_ids and regular parsing
Add a new option to parsing that the set of IDs being used should be computed, this means every action needs to handle the compute_ids and regular case. This means actions yield a new ids type is a set of ids or the value being computed. Use the compute_ids case to replace find IDs parsing. Signed-off-by: Ian Rogers <irogers@google.com> Tested-by: John Garry <john.garry@huawei.com> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jin Yao <yao.jin@linux.intel.com> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Clarke <pc@us.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sandeep Dasgupta <sdasgup@google.com> Cc: Stephane Eranian <eranian@google.com> Link: https://lore.kernel.org/r/20210923074616.674826-11-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
762a05c561
commit
3f965a7df0
@@ -314,10 +314,9 @@ void expr__ctx_free(struct expr_parse_ctx *ctx)
|
||||
|
||||
static int
|
||||
__expr__parse(double *val, struct expr_parse_ctx *ctx, const char *expr,
|
||||
int start, int runtime)
|
||||
bool compute_ids, int runtime)
|
||||
{
|
||||
struct expr_scanner_ctx scanner_ctx = {
|
||||
.start_token = start,
|
||||
.runtime = runtime,
|
||||
};
|
||||
YY_BUFFER_STATE buffer;
|
||||
@@ -337,7 +336,7 @@ __expr__parse(double *val, struct expr_parse_ctx *ctx, const char *expr,
|
||||
expr_set_debug(1, scanner);
|
||||
#endif
|
||||
|
||||
ret = expr_parse(val, ctx, scanner);
|
||||
ret = expr_parse(val, ctx, compute_ids, scanner);
|
||||
|
||||
expr__flush_buffer(buffer, scanner);
|
||||
expr__delete_buffer(buffer, scanner);
|
||||
@@ -348,13 +347,13 @@ __expr__parse(double *val, struct expr_parse_ctx *ctx, const char *expr,
|
||||
int expr__parse(double *final_val, struct expr_parse_ctx *ctx,
|
||||
const char *expr, int runtime)
|
||||
{
|
||||
return __expr__parse(final_val, ctx, expr, EXPR_PARSE, runtime) ? -1 : 0;
|
||||
return __expr__parse(final_val, ctx, expr, /*compute_ids=*/false, runtime) ? -1 : 0;
|
||||
}
|
||||
|
||||
int expr__find_ids(const char *expr, const char *one,
|
||||
struct expr_parse_ctx *ctx, int runtime)
|
||||
{
|
||||
int ret = __expr__parse(NULL, ctx, expr, EXPR_OTHER, runtime);
|
||||
int ret = __expr__parse(NULL, ctx, expr, /*compute_ids=*/true, runtime);
|
||||
|
||||
if (one)
|
||||
expr__del_id(ctx, one);
|
||||
|
||||
Reference in New Issue
Block a user