From patchwork Thu Apr 27 23:00:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Simpson X-Patchwork-Id: 13225817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 268BEC77B7C for ; Thu, 27 Apr 2023 23:03:04 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1psAbW-0001r8-OH; Thu, 27 Apr 2023 19:00:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psAbM-0001nQ-O1 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 19:00:37 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psAbE-0001LO-85 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 19:00:36 -0400 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33RLSX0u024999; Thu, 27 Apr 2023 23:00:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=XeGFV8V7hwjZX4sbPp5ePdNXo4ZbYQM0vG/ot2omjE8=; b=Wrs4yB61MgT40w1bcdpi81r8HItfbhR9mhr70dzOamTqawJnpwVCuxwd5Qyo1R9tGSB5 YRs26LYHE5MJ9lqXLjLo4UZBZ8uD3Pdk6PT9N25w3ZW7kM4AGIhDWm+k1Zyhti0ijEgi obCdYRcsmgyG1wMHMK2t1fclV0pEQPLdYIOWP5M4EImxMjRgb1L0sEdP4tLW3FBvjLXN oCRoeuv4YewWc1mmwEuYlcb5WMSwe1vikaTD8DrX+w+O+ptZpESS6A1nBy1gaw5uV8od qm7gLkTxSgAwz+kWVLupe7wpNdSnr0HwYziFmO3koUbwfz247P+NhwAk4yFS6P0YqN2Y NQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q7wq88gpt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Apr 2023 23:00:16 +0000 Received: from pps.filterd (NALASPPMTA02.qualcomm.com [127.0.0.1]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 33RN0FJV014941; Thu, 27 Apr 2023 23:00:15 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA02.qualcomm.com (PPS) with ESMTPS id 3q7wcbsb9f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Apr 2023 23:00:15 +0000 Received: from NALASPPMTA02.qualcomm.com (NALASPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 33RN0FRd014922; Thu, 27 Apr 2023 23:00:15 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA02.qualcomm.com (PPS) with ESMTPS id 33RN0Ei6014897 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Apr 2023 23:00:15 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id DE48F6CB; Thu, 27 Apr 2023 16:00:13 -0700 (PDT) From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, ale@rev.ng, anjo@rev.ng, bcain@quicinc.com, quic_mathbern@quicinc.com Subject: [PATCH v2 17/21] Hexagon (target/hexagon) Move new_value to DisasContext Date: Thu, 27 Apr 2023 16:00:08 -0700 Message-Id: <20230427230012.3800327-18-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230427230012.3800327-1-tsimpson@quicinc.com> References: <20230427230012.3800327-1-tsimpson@quicinc.com> MIME-Version: 1.0 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: vZKg6mxams1_jTUbzpi1mDMWxkMsKLcz X-Proofpoint-ORIG-GUID: vZKg6mxams1_jTUbzpi1mDMWxkMsKLcz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-27_09,2023-04-27_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=829 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 priorityscore=1501 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304270202 Received-SPF: pass client-ip=205.220.180.131; envelope-from=tsimpson@qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The new_value array in the CPUHexagonState is only used for bookkeeping within the translation of a packet. With recent changes that eliminate the need to free TCGv variables, these make more sense to be transient and kept in DisasContext. Suggested-by: Richard Henderson Signed-off-by: Taylor Simpson Reviewed-by: Richard Henderson --- target/hexagon/cpu.h | 1 - target/hexagon/translate.h | 2 +- target/hexagon/genptr.c | 6 +++++- target/hexagon/translate.c | 14 +++----------- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index 3687f2caa2..22aba20be2 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -85,7 +85,6 @@ typedef struct CPUArchState { target_ulong stack_start; uint8_t slot_cancelled; - target_ulong new_value[TOTAL_PER_THREAD_REGS]; target_ulong new_value_usr; /* diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h index 4c17433a6f..6dde487566 100644 --- a/target/hexagon/translate.h +++ b/target/hexagon/translate.h @@ -69,6 +69,7 @@ typedef struct DisasContext { bool need_pkt_has_store_s1; bool short_circuit; bool has_hvx_helper; + TCGv new_value[TOTAL_PER_THREAD_REGS]; } DisasContext; static inline void ctx_log_pred_write(DisasContext *ctx, int pnum) @@ -190,7 +191,6 @@ extern TCGv hex_pred[NUM_PREGS]; extern TCGv hex_this_PC; extern TCGv hex_slot_cancelled; extern TCGv hex_branch_taken; -extern TCGv hex_new_value[TOTAL_PER_THREAD_REGS]; extern TCGv hex_new_value_usr; extern TCGv hex_reg_written[TOTAL_PER_THREAD_REGS]; extern TCGv hex_new_pred_value[NUM_PREGS]; diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index ede1474ea5..c7a8e2ce55 100644 --- a/target/hexagon/genptr.c +++ b/target/hexagon/genptr.c @@ -74,7 +74,11 @@ TCGv get_result_gpr(DisasContext *ctx, int rnum) if (rnum == HEX_REG_USR) { return hex_new_value_usr; } else { - return hex_new_value[rnum]; + if (ctx->new_value[rnum] == NULL) { + ctx->new_value[rnum] = tcg_temp_new(); + tcg_gen_movi_tl(ctx->new_value[rnum], 0); + } + return ctx->new_value[rnum]; } } else { return hex_gpr[rnum]; diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index d46a724c1b..5f35bb20e7 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -44,7 +44,6 @@ TCGv hex_pred[NUM_PREGS]; TCGv hex_this_PC; TCGv hex_slot_cancelled; TCGv hex_branch_taken; -TCGv hex_new_value[TOTAL_PER_THREAD_REGS]; TCGv hex_new_value_usr; TCGv hex_reg_written[TOTAL_PER_THREAD_REGS]; TCGv hex_new_pred_value[NUM_PREGS]; @@ -513,6 +512,9 @@ static void gen_start_packet(DisasContext *ctx) } ctx->s1_store_processed = false; ctx->pre_commit = true; + for (i = 0; i < TOTAL_PER_THREAD_REGS; i++) { + ctx->new_value[i] = NULL; + } analyze_packet(ctx); @@ -1156,7 +1158,6 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, } #define NAME_LEN 64 -static char new_value_names[TOTAL_PER_THREAD_REGS][NAME_LEN]; static char reg_written_names[TOTAL_PER_THREAD_REGS][NAME_LEN]; static char new_pred_value_names[NUM_PREGS][NAME_LEN]; static char store_addr_names[STORES_MAX][NAME_LEN]; @@ -1178,15 +1179,6 @@ void hexagon_translate_init(void) offsetof(CPUHexagonState, gpr[i]), hexagon_regnames[i]); - if (i == HEX_REG_USR) { - hex_new_value[i] = NULL; - } else { - snprintf(new_value_names[i], NAME_LEN, "new_%s", hexagon_regnames[i]); - hex_new_value[i] = tcg_global_mem_new(cpu_env, - offsetof(CPUHexagonState, new_value[i]), - new_value_names[i]); - } - if (HEX_DEBUG) { snprintf(reg_written_names[i], NAME_LEN, "reg_written_%s", hexagon_regnames[i]);