diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2021-08-10 21:55:57 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2021-08-10 21:55:57 (GMT) |
commit | 35f435585638fdf74377c3a9c7e7c2413995d4a7 (patch) | |
tree | 38835ce0b13a54c7e8484aaa10ad8536f3760c5c /src/arch/operands/register.c | |
parent | c0cc928bfab0af2cdbf16e9a04d41983f4732b93 (diff) |
Prepare all Dalvik operands for a singleton status.
Diffstat (limited to 'src/arch/operands/register.c')
-rw-r--r-- | src/arch/operands/register.c | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/src/arch/operands/register.c b/src/arch/operands/register.c index 9a6de17..e457158 100644 --- a/src/arch/operands/register.c +++ b/src/arch/operands/register.c @@ -52,6 +52,14 @@ static void g_register_operand_print(const GRegisterOperand *, GBufferLine *); +/* ------------------------ CONTROLE DU VOLUME DES INSTANCES ------------------------ */ + + +/* Fournit l'empreinte d'un candidat à une centralisation. */ +static guint g_register_operand_hash(const GRegisterOperand *); + + + /* --------------------- TRANSPOSITIONS VIA CACHE DES OPERANDES --------------------- */ @@ -100,6 +108,8 @@ static void g_register_operand_class_init(GRegisterOperandClass *klass) operand->compare = (operand_compare_fc)g_register_operand_compare; operand->print = (operand_print_fc)g_register_operand_print; + operand->hash = (operand_hash_fc)g_register_operand_hash; + operand->unserialize = (unserialize_operand_fc)g_register_operand_unserialize; operand->serialize = (serialize_operand_fc)g_register_operand_serialize; @@ -229,8 +239,7 @@ GArchRegister *g_register_operand_get_register(const GRegisterOperand *operand) result = operand->reg; - if (result != NULL) - g_object_ref(G_OBJECT(result)); + g_object_ref(G_OBJECT(result)); return result; @@ -296,6 +305,43 @@ bool g_register_operand_is_written(const GRegisterOperand *operand) /* ---------------------------------------------------------------------------------- */ +/* CONTROLE DU VOLUME DES INSTANCES */ +/* ---------------------------------------------------------------------------------- */ + + +/****************************************************************************** +* * +* Paramètres : operand = objet dont l'instance se veut unique. * +* * +* Description : Fournit l'empreinte d'un candidat à une centralisation. * +* * +* Retour : Empreinte de l'élément représenté. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static guint g_register_operand_hash(const GRegisterOperand *operand) +{ + guint result; /* Valeur à retourner */ + GArchRegister *reg; /* Registre visé par l'opérande*/ + + reg = g_register_operand_get_register(operand); + + result = g_arch_register_hash(reg); + + g_object_unref(G_OBJECT(reg)); + + if (g_register_operand_is_written(operand)) + result ^= 1; + + return result; + +} + + + +/* ---------------------------------------------------------------------------------- */ /* TRANSPOSITIONS VIA CACHE DES OPERANDES */ /* ---------------------------------------------------------------------------------- */ |