d54c56156f
In certain cases, we can avoid the overhead of writing to hex_new_value and write directly to hex_gpr. We add need_commit field to DisasContext indicating if the end-of-packet commit is needed. If it is not needed, get_result_gpr() and get_result_gpr_pair() can return hex_gpr. We pass the ctx->need_commit to helpers when needed. Finally, we can early-exit from gen_reg_writes during packet commit. There are a few instructions whose semantics write to the result before reading all the inputs. Therefore, the idef-parser generated code is incompatible with short-circuit. We tell idef-parser to skip them. For debugging purposes, we add a cpu property to turn off short-circuit. When the short-circuit property is false, we skip the analysis and force the end-of-packet commit. Here's a simple example of the TCG generated for 0x004000b4: 0x7800c020 { R0 = #0x1 } BEFORE: ---- 004000b4 movi_i32 new_r0,$0x1 mov_i32 r0,new_r0 AFTER: ---- 004000b4 movi_i32 r0,$0x1 This patch reintroduces a use of check_for_attrib, so we remove the G_GNUC_UNUSED added earlier in this series. Signed-off-by: Taylor Simpson <tsimpson@quicinc.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Brian Cain <bcain@quicinc.com> Message-Id: <20230427230012.3800327-12-tsimpson@quicinc.com>
64 lines
3.0 KiB
C
64 lines
3.0 KiB
C
/*
|
|
* Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef HEXAGON_GENPTR_H
|
|
#define HEXAGON_GENPTR_H
|
|
|
|
#include "insn.h"
|
|
#include "tcg/tcg.h"
|
|
#include "translate.h"
|
|
|
|
extern const SemanticInsn opcode_genptr[];
|
|
|
|
void gen_store32(TCGv vaddr, TCGv src, int width, uint32_t slot);
|
|
void gen_store1(TCGv_env cpu_env, TCGv vaddr, TCGv src, uint32_t slot);
|
|
void gen_store2(TCGv_env cpu_env, TCGv vaddr, TCGv src, uint32_t slot);
|
|
void gen_store4(TCGv_env cpu_env, TCGv vaddr, TCGv src, uint32_t slot);
|
|
void gen_store8(TCGv_env cpu_env, TCGv vaddr, TCGv_i64 src, uint32_t slot);
|
|
void gen_store1i(TCGv_env cpu_env, TCGv vaddr, int32_t src, uint32_t slot);
|
|
void gen_store2i(TCGv_env cpu_env, TCGv vaddr, int32_t src, uint32_t slot);
|
|
void gen_store4i(TCGv_env cpu_env, TCGv vaddr, int32_t src, uint32_t slot);
|
|
void gen_store8i(TCGv_env cpu_env, TCGv vaddr, int64_t src, uint32_t slot);
|
|
TCGv gen_read_reg(TCGv result, int num);
|
|
TCGv gen_read_preg(TCGv pred, uint8_t num);
|
|
void gen_log_reg_write(DisasContext *ctx, int rnum, TCGv val);
|
|
void gen_log_pred_write(DisasContext *ctx, int pnum, TCGv val);
|
|
void gen_set_usr_field(DisasContext *ctx, int field, TCGv val);
|
|
void gen_set_usr_fieldi(DisasContext *ctx, int field, int x);
|
|
void gen_set_usr_field_if(DisasContext *ctx, int field, TCGv val);
|
|
void gen_sat_i32(TCGv dest, TCGv source, int width);
|
|
void gen_sat_i32_ovfl(TCGv ovfl, TCGv dest, TCGv source, int width);
|
|
void gen_satu_i32(TCGv dest, TCGv source, int width);
|
|
void gen_satu_i32_ovfl(TCGv ovfl, TCGv dest, TCGv source, int width);
|
|
void gen_sat_i64(TCGv_i64 dest, TCGv_i64 source, int width);
|
|
void gen_sat_i64_ovfl(TCGv ovfl, TCGv_i64 dest, TCGv_i64 source, int width);
|
|
void gen_satu_i64(TCGv_i64 dest, TCGv_i64 source, int width);
|
|
void gen_satu_i64_ovfl(TCGv ovfl, TCGv_i64 dest, TCGv_i64 source, int width);
|
|
void gen_add_sat_i64(DisasContext *ctx, TCGv_i64 ret, TCGv_i64 a, TCGv_i64 b);
|
|
TCGv gen_8bitsof(TCGv result, TCGv value);
|
|
void gen_set_byte_i64(int N, TCGv_i64 result, TCGv src);
|
|
TCGv gen_get_byte(TCGv result, int N, TCGv src, bool sign);
|
|
TCGv gen_get_byte_i64(TCGv result, int N, TCGv_i64 src, bool sign);
|
|
TCGv gen_get_half(TCGv result, int N, TCGv src, bool sign);
|
|
void gen_set_half(int N, TCGv result, TCGv src);
|
|
void gen_set_half_i64(int N, TCGv_i64 result, TCGv src);
|
|
void probe_noshuf_load(TCGv va, int s, int mi);
|
|
|
|
extern const target_ulong reg_immut_masks[TOTAL_PER_THREAD_REGS];
|
|
|
|
#endif
|