Message ID | c143088cbaf7a19a992e008689420d95a90f3fab.1668487922.git.research_trasio@irq.a4lg.com |
---|---|
State | Accepted |
Headers |
Return-Path: <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a40e:b0:83:7221:86ba with SMTP id ck14csp3425295dyb; Mon, 14 Nov 2022 21:02:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf6hTOp81x+r5SrHUzD3wxGX3jH2omBBQqm70gmGgWEEPj1tv3YNinbMeuJ1BUOu56Do5XFg X-Received: by 2002:a17:907:cc8a:b0:7ae:f6e8:2502 with SMTP id up10-20020a170907cc8a00b007aef6e82502mr6338692ejc.157.1668488567237; Mon, 14 Nov 2022 21:02:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668488567; cv=none; d=google.com; s=arc-20160816; b=cOsRoDjqaJUHSMg1tU0Y2+irOwwoahKCTCr4Y3jtehw8kmhtp7edOHGwJTndmjYggR nlXx3pEQHRJc0XXtNMlNRXqwSmBfebAGfAEQAvCFXN0XwEcSUh6KjwubCbtE78JTGWxX wRy5MAyJHzbzPDgL3mXIrGHs0/Yl7w9eEerKJa3mWDGW77DVdTCauCZBELlJlqQBrLjH Xogjdw17aq4vBTVnbyXk+ta4029pBTHHPDwCYUW0RVMGR1RtvY02Ot4VpJhGhvooBsZb a4SUisGd/Mt9+CLx4Vxy05Q7OkerPVZ8X4mV8SXNciH66memu1orzWwl4jRdRUcjz6dd IX7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=zN0uw+NLIQY6eBUq5ljReYrRgNKJJO6+pILxbE4sqC4=; b=jv91903vdACl2c7+yaC3or5UKMRRihz9Gw2WWANaf9t0RVhy2aOXQOM94o9+cypdaL eilXBPaerQfvg/0+HHeW7n/FmHDFpqZy5GHjiBwR45q0p3X/14oQNkHevlgq9PhVgHFd r0xgW+tJ78kJGdNbdkemB0oPpvVdLpRoIQ5XM2+/BeqWwkaOzOot1Rc5j/yFD0AkcUW6 jozVRqhmQBWqKyjJGqV1ZiX9E64rFvDR9XVDFgIcYtdIaXXEX9YRo2Exo8DUY8M/DHqj DndIDdnuvoJurXkdiABFVgEMZepV8+3FHQMpxvYmSFWE7jp8UMxLrDHSmIl+CG30HVnK w+tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=wnSiSzuH; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id wt13-20020a170906ee8d00b0078d1e08f1e5si11097083ejb.919.2022.11.14.21.02.46 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Nov 2022 21:02:47 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=wnSiSzuH; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 69EA43947C25 for <ouuuleilei@gmail.com>; Tue, 15 Nov 2022 05:00:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 69EA43947C25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668488403; bh=zN0uw+NLIQY6eBUq5ljReYrRgNKJJO6+pILxbE4sqC4=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=wnSiSzuHqENp9y3qyr1BNlj9XNb5sRZxz1/f4InnPQRKHISOoLLOQinsHaOzricwu vv0AjP01YwcSe+y4YgzweLOvUA+LE5oaQdKo0mvdlgPaRJoBL11Q6lD3vcM2xU6HKH 1hdsqpxDQB8MOhX8TC5DD2MJUtOHOtkalf7txPNw= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id 79F0D382D39A for <binutils@sourceware.org>; Tue, 15 Nov 2022 04:58:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 79F0D382D39A Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id D0F21300089; Tue, 15 Nov 2022 04:58:25 +0000 (UTC) To: Tsukasa OI <research_trasio@irq.a4lg.com>, Nelson Chu <nelson@rivosinc.com>, Kito Cheng <kito.cheng@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com> Cc: binutils@sourceware.org Subject: [PATCH 05/11] RISC-V: One time CSR hash table initialization Date: Tue, 15 Nov 2022 04:52:48 +0000 Message-Id: <c143088cbaf7a19a992e008689420d95a90f3fab.1668487922.git.research_trasio@irq.a4lg.com> In-Reply-To: <cover.1668487922.git.research_trasio@irq.a4lg.com> References: <cover.1668487922.git.research_trasio@irq.a4lg.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> From: Tsukasa OI via Binutils <binutils@sourceware.org> Reply-To: Tsukasa OI <research_trasio@irq.a4lg.com> Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749537067859008886?= X-GMAIL-MSGID: =?utf-8?q?1749537067859008886?= |
Series |
RISC-V: Requirements for disassembler optimizations batch 1
|
|
Checks
Context | Check | Description |
---|---|---|
snail/binutils-gdb-check | success | Github commit url |
Commit Message
Tsukasa OI
Nov. 15, 2022, 4:52 a.m. UTC
The current disassembler intends to initialize the CSR hash table when CSR name parsing is required at the first time. This is managed by a function- scope static variable init_csr but... there's a problem. It's never set to true. Because of this issue, current disassembler actually initializes the CSR hash table every time when CSR name parsing is required. This commit sets init_csr to true once the CSR hash table is initialized. It is expected to have about 30% performance improvements alone when thousands of only CSR instructions are disassembled (CSR instructions are rare in general so real world performance improvement is not that high). This commit alone will not affect real world performance that much but after the efficient opcode hash is implemented, it will be much effective (sometimes >x10 effect than this commit alone) so that even some regular programs can benefit from it. opcodes/ChangeLog: * riscv-dis.c (print_insn_args): Make sure that CSR hash table initialization occurs only once. --- opcodes/riscv-dis.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c index 3135db30ccd..ec38bed747a 100644 --- a/opcodes/riscv-dis.c +++ b/opcodes/riscv-dis.c @@ -564,6 +564,7 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info DECLARE_CSR (name, num, class, define_version, abort_version) #include "opcode/riscv-opc.h" #undef DECLARE_CSR + init_csr = true; } if (riscv_csr_hash[csr] != NULL)