summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/operands/immediate.c6
-rw-r--r--src/arch/operands/register.c50
2 files changed, 51 insertions, 5 deletions
diff --git a/src/arch/operands/immediate.c b/src/arch/operands/immediate.c
index 6e6925c..ec81cfe 100644
--- a/src/arch/operands/immediate.c
+++ b/src/arch/operands/immediate.c
@@ -156,7 +156,7 @@ static void g_imm_operand_print(const GImmOperand *, GBufferLine *);
static char *g_imm_operand_build_tooltip(const GImmOperand *, const GLoadedBinary *);
/* Fournit l'empreinte d'un candidat à une centralisation. */
-static guint g_arch_operand_hash(const GImmOperand *);
+static guint g_imm_operand_hash(const GImmOperand *);
/* Charge un opérande depuis une mémoire tampon. */
static bool g_imm_operand_unserialize(GImmOperand *, GAsmStorage *, GBinFormat *, packed_buffer_t *);
@@ -262,7 +262,7 @@ static void g_imm_operand_class_init(GImmOperandClass *klass)
operand->print = (operand_print_fc)g_imm_operand_print;
operand->build_tooltip = (operand_build_tooltip_fc)g_imm_operand_build_tooltip;
- operand->hash = (operand_hash_fc)g_arch_operand_hash;
+ operand->hash = (operand_hash_fc)g_imm_operand_hash;
operand->unserialize = (unserialize_operand_fc)g_imm_operand_unserialize;
operand->serialize = (serialize_operand_fc)g_imm_operand_serialize;
@@ -1588,7 +1588,7 @@ void g_imm_operand_as_uleb128(const GImmOperand *operand, uleb128_t *val)
* *
******************************************************************************/
-static guint g_arch_operand_hash(const GImmOperand *operand)
+static guint g_imm_operand_hash(const GImmOperand *operand)
{
guint result; /* Valeur à retourner */
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 */
/* ---------------------------------------------------------------------------------- */