From patchwork Thu Apr 13 16:55:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 9679733 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CFFE760381 for ; Thu, 13 Apr 2017 16:56:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C28472869B for ; Thu, 13 Apr 2017 16:56:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B7A46286A7; Thu, 13 Apr 2017 16:56:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6ED7C2869B for ; Thu, 13 Apr 2017 16:56:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752689AbdDMQ4D (ORCPT ); Thu, 13 Apr 2017 12:56:03 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:34932 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753951AbdDMQ4B (ORCPT ); Thu, 13 Apr 2017 12:56:01 -0400 Received: by mail-wr0-f194.google.com with SMTP id l44so9375489wrc.2 for ; Thu, 13 Apr 2017 09:56:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4kL1zBquVTZFdaupViGhGJxHqOaYhBLLYASMuIU/cQU=; b=HCv/tZeNu4eHLPI+TXSNTROU8QjPhNLf0/nJOaN0NLhM+rXCUG409WHQW/NXItOLmA E7ClU6FvE9zmmTXvb5lsV2LeGRphiUV/by0o1tjRhZErctMoI/yPrz7gzXwDOwScrzj4 7gCt6rkR2SGIKA+iYYMZA4Ix4RgCDFd2fupyubxWmkmqnyrabVO9irPmdgKl5PFrJV/o L0DChDv/vPwQXlSs+VWjFek8pisgZBcYkjS4y2T8bCZ6MkId4TzXbI8zzIyIf1Og+BAC +2FTd/qvrcESBqUO/KpPCSSl8INukjIAQcSdOYAKelsIJPF8QzOvQv3WkSPUq0DnG7zz YoxA== 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:in-reply-to :references; bh=4kL1zBquVTZFdaupViGhGJxHqOaYhBLLYASMuIU/cQU=; b=OaBdHLimam+p2uMiEhL+oZb3Z1sn4lqqOsYxVxJFPHH6KRY3vIJ2+9RzV3LdCVBEkv eIaXPoCF3e2Z1/aQ4f4KC5pxCp4GBun/bO/D78UlmkU/FcQ3MbX6znw3LCyR+CoErQcq 3Q4kiVSUJ+qWnxAcHPzJg/S1jkrj+a056D+RPQkFnUtnGvxRu1vhBKSHZxpvi+r4BT+C iGGJ4g9dcIql+IFbFy+V6ESnBgVcwNz/ECM3TKlea+Oj2D3fKewW9+9KfTOD55Bmmncn YXqcXXlfE5e6MBLXcADw/OCC4RL+h7p6toofybAUW6ipSezMznptPnJmkAjjb5dEPx5N /cDg== X-Gm-Message-State: AN3rC/6O2r8yBBYY2Ktm2aUO/yYQ5jQ20nS8KjJ/MlMfVBVsh0mCSi6m STGYQ/YtX00hruMvMcI= X-Received: by 10.223.160.87 with SMTP id l23mr4138584wrl.24.1492102559318; Thu, 13 Apr 2017 09:55:59 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:8b2:dc00:a909:829c:fd:bc60]) by smtp.gmail.com with ESMTPSA id q129sm13297803wmg.1.2017.04.13.09.55.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Apr 2017 09:55:58 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Christopher Li , Luc Van Oostenryck Subject: [PATCH 2/8] add helper add_load_dominators() Date: Thu, 13 Apr 2017 18:55:45 +0200 Message-Id: <20170413165551.2785-3-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170413165551.2785-1-luc.vanoostenryck@gmail.com> References: <20170413165551.2785-1-luc.vanoostenryck@gmail.com> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Luc Van Oostenryck --- flow.c | 12 ++++++++++++ flow.h | 1 + 2 files changed, 13 insertions(+) diff --git a/flow.c b/flow.c index 50507a5e7..25a5bffbe 100644 --- a/flow.c +++ b/flow.c @@ -417,6 +417,18 @@ void add_dominator(struct pseudo_list **phi_list, struct instruction *insn, use_pseudo(insn, phi, add_pseudo(phi_list, phi)); } +struct pseudo_list *add_load_dominators(struct instruction *insn, struct instruction_list *doms, + struct ident *ident) +{ + struct pseudo_list *phi_list = NULL; + struct instruction *dom; + + FOR_EACH_PTR(doms, dom) { + add_dominator(&phi_list, insn, dom, ident); + } END_FOR_EACH_PTR(dom); + return phi_list; +} + /* * We should probably sort the phi list just to make it easier to compare * later for equality. diff --git a/flow.h b/flow.h index 800585547..a6d0881c2 100644 --- a/flow.h +++ b/flow.h @@ -39,6 +39,7 @@ void check_access(struct instruction *insn); void convert_load_instruction(struct instruction *, pseudo_t); void rewrite_load_instruction(struct instruction *, struct pseudo_list *); void add_dominator(struct pseudo_list **, struct instruction *, struct instruction *, struct ident*); +struct pseudo_list *add_load_dominators(struct instruction *, struct instruction_list *, struct ident*); int dominates(pseudo_t pseudo, struct instruction *insn, struct instruction *dom, int local); extern void clear_liveness(struct entrypoint *ep);