When a TCG backend does not support some vector operation we need to emulate this operation. Unlike arguments of the scalar operations vector values are hard to operate on directly or to be passed as function arguments (because a target may lack corresponding type support). To avoid this we will use pointers to host memory locations holding values of temporaries. This memory locations for globals must be their canonical locations in CPUArchState because moving them around is expensive and hard to implement.
Fortunately globals always have memory locations statically assigned to them. They are addressed relative to AREG0. To express direct access to this memory in TCG opcodes we need to know global variable ENV (which corresponds to this AREG0). Add a field to TCGContext. Frontends can save ENV there during translate_init. It will be used in handling vector operations only so targets that do not use vector support do not need to set it. Signed-off-by: Kirill Batuzov <batuz...@ispras.ru> --- tcg/tcg.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tcg/tcg.h b/tcg/tcg.h index 01dbede..83fb0d3 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -496,6 +496,7 @@ struct TCGContext { tcg_insn_unit *code_ptr; TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */ TCGTempSet free_temps[TCG_TYPE_COUNT * 2]; + TCGv_ptr cpu_env; /* used to access memory locations for vector globals */ GHashTable *helpers; -- 1.7.10.4