diff mbox

[RFC,2/7] tcg: store ENV global in TCGContext

Message ID 0ad225dd3634c8432916bcbf6ada30fb38478a2c.1413286807.git.batuzovk@ispras.ru
State New
Headers show

Commit Message

Kirill Batuzov Oct. 16, 2014, 8:56 a.m. UTC
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 <batuzovk@ispras.ru>
---
 tcg/tcg.h |    1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

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;