Received: by 2002:a17:90a:1609:0:0:0:0 with SMTP id n9csp541871pja; Thu, 19 Mar 2020 07:14:40 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu95s0aHYaWs7DApYT6k+KfW2sMoEhd/Z+yXCRQsC9pwJW7PaTgjLJLzQZjAOVmkVwcLAvK X-Received: by 2002:a9d:344:: with SMTP id 62mr2610383otv.102.1584627280774; Thu, 19 Mar 2020 07:14:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584627280; cv=none; d=google.com; s=arc-20160816; b=HqDNYwiOtFg119dCrrDOEVQbC09Y/aiKVsyYdGH1F0PdQ08LY65GoQO/ZCbuxYepJm ae/DG9WDQbTVPG6hEN9uvidowB1Xeuzk/pAtutPTLzD1DJChKWbXnlTxACIXfFFu1hZh YiE25FUuqE9joAGXSqP2Y6UCND+WuUl3VVoZ/JZ5e9oieoXVWqc3Zd+rwVEjQNhozhTO SnTCR8DvOmmtcofTWB2uTk4wAoXwLC8QSP7bgcfdbaGvKER2fN4RKFD4q7m7BcFerBZr 3ho0chRTOoq6sWkbopIBqKXe3WT4PaoSWymR13b0w5bcsyqoSfe3dk7i/ZlHqD0remph JifQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=I8S8McjaQxAALWIvQRRARjJWVOmyDo3wYo9tsnPjYPQ=; b=mVpWb/7ihU3R0tqxwdk4Rni7ESlb27hEp9JdT5jHYeq5nddQSI7wOSK3SPktrBY+hY fWkaEL5tuKtLzYGfRpf3S0gFBILRYSzFizf7vaN8eCTud1KEffz6amK+//PIrx/KGPTJ d6yTVqSNSCzq4dLAYxFSY7kGbGWn6hM3qoT48sm04WztKymOD9wfPE//5llNfofUbXJ7 zuS7zqQhSAgPKY7a2te7ti1sYwTQYWTjKgn6gvo4YMIfNFbNnZ3p4C03bqVgFluKwfW9 bep7NJv5cDB7yM/X/ch7QCbn0/VEOse49WmBmKJi0AXdDhgM4McVL3tQqCRsfbJ6/wTy Ypeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11si1128338oig.212.2020.03.19.07.14.09; Thu, 19 Mar 2020 07:14:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728005AbgCSOLP (ORCPT + 99 others); Thu, 19 Mar 2020 10:11:15 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:32848 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727949AbgCSOLL (ORCPT ); Thu, 19 Mar 2020 10:11:11 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jEvsw-0002Fw-Th; Thu, 19 Mar 2020 15:10:59 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 32D0D1C22AC; Thu, 19 Mar 2020 15:10:52 +0100 (CET) Date: Thu, 19 Mar 2020 14:10:51 -0000 From: "tip-bot2 for Jiri Olsa" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf expr: Add expr.c object Cc: Jiri Olsa , Andi Kleen , Alexander Shishkin , John Garry , Kajol Jain , Michael Petlan , Namhyung Kim , Peter Zijlstra , Ravi Bangoria , Arnaldo Carvalho de Melo , x86 , LKML In-Reply-To: <20200228093616.67125-2-jolsa@kernel.org> References: <20200228093616.67125-2-jolsa@kernel.org> MIME-Version: 1.0 Message-ID: <158462705181.28353.9884213405921971659.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: 576a65b6974ddc830a89b6feb6823bd6b5914bde Gitweb: https://git.kernel.org/tip/576a65b6974ddc830a89b6feb6823bd6b5914bde Author: Jiri Olsa AuthorDate: Fri, 28 Feb 2020 10:36:12 +01:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Mon, 09 Mar 2020 21:43:24 -03:00 perf expr: Add expr.c object Add generic expr code into new expr.c object. The expr.c object will be mainly used in following change that will get rid of the manual flex code, Signed-off-by: Jiri Olsa Reviewed-by: Andi Kleen Cc: Alexander Shishkin Cc: John Garry Cc: Kajol Jain Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Ravi Bangoria Link: http://lore.kernel.org/lkml/20200228093616.67125-2-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/Build | 1 + tools/perf/util/expr.c | 19 +++++++++++++++++++ tools/perf/util/expr.y | 16 ---------------- 3 files changed, 20 insertions(+), 16 deletions(-) create mode 100644 tools/perf/util/expr.c diff --git a/tools/perf/util/Build b/tools/perf/util/Build index 07da6c7..6fdf073 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -122,6 +122,7 @@ perf-y += vsprintf.o perf-y += units.o perf-y += time-utils.o perf-y += expr-bison.o +perf-y += expr.o perf-y += branch.o perf-y += mem2node.o diff --git a/tools/perf/util/expr.c b/tools/perf/util/expr.c new file mode 100644 index 0000000..816b23b --- /dev/null +++ b/tools/perf/util/expr.c @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include "expr.h" + +/* Caller must make sure id is allocated */ +void expr__add_id(struct parse_ctx *ctx, const char *name, double val) +{ + int idx; + + assert(ctx->num_ids < MAX_PARSE_ID); + idx = ctx->num_ids++; + ctx->ids[idx].name = name; + ctx->ids[idx].val = val; +} + +void expr__ctx_init(struct parse_ctx *ctx) +{ + ctx->num_ids = 0; +} diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y index 7d22624..7cea8b7 100644 --- a/tools/perf/util/expr.y +++ b/tools/perf/util/expr.y @@ -6,7 +6,6 @@ #define IN_EXPR_Y 1 #include "expr.h" #include "smt.h" -#include #include #define MAXIDLEN 256 @@ -169,21 +168,6 @@ static int expr__lex(YYSTYPE *res, const char **pp) return tok; } -/* Caller must make sure id is allocated */ -void expr__add_id(struct parse_ctx *ctx, const char *name, double val) -{ - int idx; - assert(ctx->num_ids < MAX_PARSE_ID); - idx = ctx->num_ids++; - ctx->ids[idx].name = name; - ctx->ids[idx].val = val; -} - -void expr__ctx_init(struct parse_ctx *ctx) -{ - ctx->num_ids = 0; -} - static bool already_seen(const char *val, const char *one, const char **other, int num_other) {