From patchwork Fri Jun 4 21:27:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 454178 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp769533jae; Fri, 4 Jun 2021 14:28:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzca6dH+3VjPJOFF9o6X+n3tkXE8jASN9H9djn4xz/RkbNKpn4CuXiWAD+t1jWV4SGL7Tpj X-Received: by 2002:a5d:9842:: with SMTP id p2mr5403759ios.132.1622842095342; Fri, 04 Jun 2021 14:28:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622842095; cv=none; d=google.com; s=arc-20160816; b=JfSgva9AGacbuu+TEPfXxT7iFPKj1AmuQ7K/x5F3b0D4u+QJ7FKvkHR855Gs+75bD1 iECrem1dgYMrQOWq36ml+/Aj6O0u5PULHNNUBrImGc5uX/ftFVoM0YahHC/dtQllX7nW /zvyC3JYzDqB2ihLCPvr2bm3OlCyU5oKKEHgQg55D/sJkp6U5HnmnryFjuLmFdCvZUrS bmMsVD20Tk1z/CeruXyg38SwwpTcWMOGavFZpdyO7tBD5RWBeOHFPeot1A8QLf2lFqiu OQF2QMfrQvo0/5D2k3cuc+fj83nDp3lV9tdBkaW1xwkPlt7Y/mswP3+3Cu2bkiC4vkO6 Kqbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature; bh=OBnD80OWvAt3AEc/b5nWfCgyZ/ubHwErEKV/hyUvRD4=; b=bV44QczOjgtqaxjTqliwnC3dB0NvJAXmlSQTalKZRBVsoBXmpR9B+dhoh2hRizJ9Hx fuiZ+fQLksUUVzZo/FUmAT68+BGMcxj08Hm5Nr+V9lkGWbFZysPAwcPo4emwCvgGCzFf /9Bhu90r8gVrgq/O/OM+XYnPcX65WuQROdQgqcwyFMFOQPuCoGIdaKFCMajTO3UZoTyM XckFeV1rvVhvTnRhIIxtnUc0ex3OGV9CuuTRXArXBHN3gSV+7wQYaHfHdPkMVKuNp1hU bSCQZv7Yv/Ir8MpaeHpzAmIfeIXKWyPevH8vMc6jzEF7XozGtt5BqdIr8Umx69kz6HeW iGDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="a2gCOhX/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j13si8257375ils.109.2021.06.04.14.28.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jun 2021 14:28:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="a2gCOhX/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpHMU-0007EA-RZ for patch@linaro.org; Fri, 04 Jun 2021 17:28:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpHM7-0007Dv-B2 for qemu-devel@nongnu.org; Fri, 04 Jun 2021 17:27:51 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:42988) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lpHM5-0004YE-QF for qemu-devel@nongnu.org; Fri, 04 Jun 2021 17:27:51 -0400 Received: by mail-pg1-x52c.google.com with SMTP id i34so2449842pgl.9 for ; Fri, 04 Jun 2021 14:27:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OBnD80OWvAt3AEc/b5nWfCgyZ/ubHwErEKV/hyUvRD4=; b=a2gCOhX/xSxvtajDu1wLrvkdHCHL1q2KOZhqBICwEVtnRVMfqLe2lxUoWaRHOShtk1 CaP0oxJe6HPxEM+PvvptouqHUjBJuo+QK7VDTrhDIJV3b+iyzxne49EEDVDM0YKG4mCU OxvJV0LFGkUPcfEyR3/LrWdmIOseIU0a/9MY/19uonOIyGyrrd79jLIVerw0OcZUA83F duFDHTBeRIbgjzFZSCAVfVsftaAMJ1eiefAYx/RrEt0SQz7l2ivo7GE+MA++I9/I/osP g3gFiPAZXFWKjMVhpo1GBBqf2umJrbzbJ7aQMZ9IJDdiiJjwAwyZEPWWetiFRMHfhtW2 alug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OBnD80OWvAt3AEc/b5nWfCgyZ/ubHwErEKV/hyUvRD4=; b=QmKrcbWzwUlUl1NySUWm+Hbu2QEyssbnvFKDEUCEvItOqvOpDW4pBnP0A9U6mECRPD dT2d/oH4XaoapMSzg3YhiHU/IL6FrbycHQrw2bitrh98/sZw+htziGFaT5QjGPLRJpet OToDI/ZBy7ngfHta6eU8VFJLUX8hrsTLjzLUgrTSTHg8utp1GNR1Q0bAdqE8I0adFVtR 6swxS/Ve3I8K9XtAozLPrSk9YYBdrxa66LAWae9zb24lqLyWx+rYgALDaHv4rfxgsUgA HS4xR5T32+y9xJ0dwlUeSJYlwpMVO3N6rtLSNFhrx6CP/4lh27XO6cnGQsambpotKMQ5 sNwQ== X-Gm-Message-State: AOAM530/4tHW1ZhKCf6Cl9CA0k/skI2Wr1KenVx6YxFCCRzdusyNY7yR Y5GonR50E+rHHcY6wDZ8FRZxC0MdA/xHGw== X-Received: by 2002:a65:64c4:: with SMTP id t4mr6954096pgv.222.1622842068397; Fri, 04 Jun 2021 14:27:48 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id gn4sm5447197pjb.16.2021.06.04.14.27.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 14:27:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH] tcg: Introduce tcg_remove_ops_after Date: Fri, 4 Jun 2021 14:27:47 -0700 Message-Id: <20210604212747.959028-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Introduce a function to remove everything emitted since a given point. Cc: Peter Maydell Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 1 + tcg/tcg.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) -- 2.25.1 diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 74cb345308..6895246fab 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -1081,6 +1081,7 @@ TCGOp *tcg_emit_op(TCGOpcode opc); void tcg_op_remove(TCGContext *s, TCGOp *op); TCGOp *tcg_op_insert_before(TCGContext *s, TCGOp *op, TCGOpcode opc); TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *op, TCGOpcode opc); +void tcg_remove_ops_after(TCGOp *op); void tcg_optimize(TCGContext *s); diff --git a/tcg/tcg.c b/tcg/tcg.c index 0dc271aac9..262dbba1fd 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2649,6 +2649,19 @@ void tcg_op_remove(TCGContext *s, TCGOp *op) #endif } +void tcg_remove_ops_after(TCGOp *op) +{ + TCGContext *s = tcg_ctx; + + while (true) { + TCGOp *last = tcg_last_op(); + if (last == op) { + return; + } + tcg_op_remove(s, last); + } +} + static TCGOp *tcg_op_alloc(TCGOpcode opc) { TCGContext *s = tcg_ctx;