From patchwork Fri Oct 14 23:02:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "juzhe.zhong@rivai.ai" X-Patchwork-Id: 2889 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp411763wrs; Fri, 14 Oct 2022 16:03:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4zD/LKaC+eujk10gM0ja/3GgUyC1+bl4j86rEtH6rZs96eT3moPesE/GskEdUIN8c0bkhX X-Received: by 2002:a50:ff09:0:b0:456:fd61:83b3 with SMTP id a9-20020a50ff09000000b00456fd6183b3mr113808edu.166.1665788602943; Fri, 14 Oct 2022 16:03:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665788602; cv=none; d=google.com; s=arc-20160816; b=RycGProgp+ZsgYsWCU+49PzD8MxNmORsuuCfzlu2IrZayM34bk+hTXiMxcjK4Xayck W/HaNSmhHSyWkOl5dBHVAiI+DHLuNlLJSCaB0bQSZ7h31K8hbwgVsxD3NCZWHSB9Vxgm P5p2sch9f6Ot3LuaDgHFDRcT3bXuLc7OvPcMEleRrIsV5l0535+22uRKYdXTRYZmpJUc aCBGf5Zjg6hTU0vU0cPBuv+gRUjkenJu9rpARSMXLD9BmIPZ9O+hAMuOjoGhYODgVF5D rWqpuYCv5P1l+tj5HyPU0aEDm6DQADNRhxPvWQHKwomS82KF6Hxh6qWGOPaemR0TvREJ Di0A== 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:feedback-id :content-transfer-encoding:mime-version:message-id:date:subject:to :from:dmarc-filter:delivered-to; bh=8mXxC3UGEcGOS5wAITkgF0MUkRioBVE9C47sDd6+4Lc=; b=DJ/Bn5HtRdIIEn/R+ECjDBU5zb5mVgf7US8KR1bTrDpSc6Yc0IreIG7fWBqtzPzQ1I WywTfFCxCIaP11LjHDXDS03eWpBYgVQuPGWL0DzRrGoHKC9AK0TlDR4BgRxlUhEv/FR7 72lFLvlCkkCgD1TGIMwuhGK/aQ7cAf1PNswi6WURT4juuYqdej6nbSecEelzodddaxRn njMVtXENBUADkQJZVDTWiLzTABbfDr/qp9p3yzq57qr213r0yMleBvB/i27jmP51RT6R eDtxkykdfsDR2mePLYl3ECladLi6IsUd4W+LVLHm7ZWlGhR39RN2i0cAxnTevCxs38+S MmqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d38-20020a056402402600b0045cd5902d51si3310686eda.507.2022.10.14.16.03.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 16:03:22 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.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; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7C6AC3854141 for ; Fri, 14 Oct 2022 23:03:17 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbgau2.qq.com (smtpbgau2.qq.com [54.206.34.216]) by sourceware.org (Postfix) with ESMTPS id 315343858C52 for ; Fri, 14 Oct 2022 23:02:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 315343858C52 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai X-QQ-mid: bizesmtp86t1665788562tqrozdy4 Received: from rios-cad5.localdomain ( [42.247.22.66]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 15 Oct 2022 07:02:40 +0800 (CST) X-QQ-SSF: 01400000002000D0K000B00A0000000 X-QQ-FEAT: RFp2QSjOiS7qFog9k/ciEaO1T+fQoSWL2Z/mxO8cDDkWEdTQQhASfSczfiJjU S8oH7ZlaDOLFdnrUlf1EzyPnFXqC7Mh66+US4+xRJvwoeMcsMMj8BS50P50nsSIKCqrywR4 5pa+cSxiL3R3JoWNeljjMUEA+e7dQA//TYvxfwjgO3dEIvAcuHUWOBnvDGYaZWpjGx9R7F+ +rweeVGIMuUUFpIoXT+CFsy9V2GWiLwCfPAcQXAtGgV7YNu0MR3o34uF/QRnwlgi5TBOLto HKFfRi7JZMrlp7U45uPjdD2yd3TvWLWdlzWIPn3kJh6kQAisu6IDMIY3vMkndOM5b5RtImR 5jh0Do4L40bvTBVkRh7ijPCrgSLzBehWTch8u3YlusqOGBj5as= X-QQ-GoodBg: 2 From: juzhe.zhong@rivai.ai To: gcc-patches@gcc.gnu.org Subject: [PATCH] RISC-V: Reorganize mangle_builtin_type.[NFC] Date: Sat, 15 Oct 2022 07:02:36 +0800 Message-Id: <20221014230236.134044-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvr:qybglogicsvr7 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kito.cheng@gmail.com, Ju-Zhe Zhong Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746705950197443441?= X-GMAIL-MSGID: =?utf-8?q?1746705950197443441?= From: Ju-Zhe Zhong Hi, this patch fixed my mistake in the previous commit patch. Since "mangle_builtin_type" is a global function will be called in riscv.cc. It's reasonable move it down and put them together stay with other global functions. gcc/ChangeLog: * config/riscv/riscv-vector-builtins.cc (mangle_builtin_type): Move down the function. --- gcc/config/riscv/riscv-vector-builtins.cc | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/gcc/config/riscv/riscv-vector-builtins.cc b/gcc/config/riscv/riscv-vector-builtins.cc index 99c482582d3..55d45651618 100644 --- a/gcc/config/riscv/riscv-vector-builtins.cc +++ b/gcc/config/riscv/riscv-vector-builtins.cc @@ -155,19 +155,6 @@ lookup_vector_type_attribute (const_tree type) return lookup_attribute ("RVV type", TYPE_ATTRIBUTES (type)); } -/* If TYPE is a built-in type defined by the RVV ABI, return the mangled name, - otherwise return NULL. */ -const char * -mangle_builtin_type (const_tree type) -{ - if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL) - type = TREE_TYPE (TYPE_NAME (type)); - if (tree attr = lookup_vector_type_attribute (type)) - if (tree id = TREE_VALUE (chain_index (0, TREE_VALUE (attr)))) - return IDENTIFIER_POINTER (id); - return NULL; -} - /* Return a representation of "const T *". */ static tree build_const_pointer (tree t) @@ -250,6 +237,19 @@ register_vector_type (vector_type_index type) builtin_types[type].vector_ptr = build_pointer_type (vectype); } +/* If TYPE is a built-in type defined by the RVV ABI, return the mangled name, + otherwise return NULL. */ +const char * +mangle_builtin_type (const_tree type) +{ + if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL) + type = TREE_TYPE (TYPE_NAME (type)); + if (tree attr = lookup_vector_type_attribute (type)) + if (tree id = TREE_VALUE (chain_index (0, TREE_VALUE (attr)))) + return IDENTIFIER_POINTER (id); + return NULL; +} + /* Initialize all compiler built-ins related to RVV that should be defined at start-up. */ void