diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2023-03-03 13:47:27 -0800 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2023-03-05 13:44:07 -0800 |
commit | f85b1fc4a0a572b0b92f5199deac1fb57e6f2aa3 (patch) | |
tree | 5dcbb497577b31738aaf50bc5429632f257c5bb5 /include | |
parent | 533206f0520e2d46362e4e6d920c8b9fa7ec1bb4 (diff) | |
download | qemu-f85b1fc4a0a572b0b92f5199deac1fb57e6f2aa3.zip qemu-f85b1fc4a0a572b0b92f5199deac1fb57e6f2aa3.tar.gz qemu-f85b1fc4a0a572b0b92f5199deac1fb57e6f2aa3.tar.bz2 |
tcg: Link branches to the labels
This allows us to easily find all branches that use a label.
Since 'refs' is only tested vs zero, remove it and test for
an empty list instead. Drop the use of bitfields, which had
been used to pack refs into a single 32-bit word.
Reviewed-by: Taylor Simpson <tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/tcg/tcg-op.h | 7 | ||||
-rw-r--r-- | include/tcg/tcg.h | 19 |
2 files changed, 14 insertions, 12 deletions
diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index 353d430..7085614 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -259,12 +259,7 @@ static inline void gen_set_label(TCGLabel *l) tcg_gen_op1(INDEX_op_set_label, label_arg(l)); } -static inline void tcg_gen_br(TCGLabel *l) -{ - l->refs++; - tcg_gen_op1(INDEX_op_br, label_arg(l)); -} - +void tcg_gen_br(TCGLabel *l); void tcg_gen_mb(TCGBar); /* Helper calls. */ diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 7e2b954..0dc8801 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -238,16 +238,23 @@ struct TCGRelocation { int type; }; +typedef struct TCGOp TCGOp; +typedef struct TCGLabelUse TCGLabelUse; +struct TCGLabelUse { + QSIMPLEQ_ENTRY(TCGLabelUse) next; + TCGOp *op; +}; + typedef struct TCGLabel TCGLabel; struct TCGLabel { - unsigned present : 1; - unsigned has_value : 1; - unsigned id : 14; - unsigned refs : 16; + bool present; + bool has_value; + uint16_t id; union { uintptr_t value; const tcg_insn_unit *value_ptr; } u; + QSIMPLEQ_HEAD(, TCGLabelUse) branches; QSIMPLEQ_HEAD(, TCGRelocation) relocs; QSIMPLEQ_ENTRY(TCGLabel) next; }; @@ -487,7 +494,7 @@ typedef struct TCGTempSet { #define SYNC_ARG (1 << 0) typedef uint32_t TCGLifeData; -typedef struct TCGOp { +struct TCGOp { TCGOpcode opc : 8; unsigned nargs : 8; @@ -506,7 +513,7 @@ typedef struct TCGOp { /* Arguments for the opcode. */ TCGArg args[]; -} TCGOp; +}; #define TCGOP_CALLI(X) (X)->param1 #define TCGOP_CALLO(X) (X)->param2 |