summaryrefslogtreecommitdiff
path: root/src/arch/operands/register.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/operands/register.c')
-rw-r--r--src/arch/operands/register.c92
1 files changed, 23 insertions, 69 deletions
diff --git a/src/arch/operands/register.c b/src/arch/operands/register.c
index e457158..9c0a337 100644
--- a/src/arch/operands/register.c
+++ b/src/arch/operands/register.c
@@ -24,6 +24,9 @@
#include "register.h"
+#include <assert.h>
+
+
#include "register-int.h"
#include "../storage.h"
@@ -45,7 +48,7 @@ static void g_register_operand_dispose(GRegisterOperand *);
static void g_register_operand_finalize(GRegisterOperand *);
/* Compare un opérande avec un autre. */
-static int g_register_operand_compare(const GRegisterOperand *, const GRegisterOperand *);
+static int g_register_operand_compare(const GRegisterOperand *, const GRegisterOperand *, bool);
/* Traduit un opérande en version humainement lisible. */
static void g_register_operand_print(const GRegisterOperand *, GBufferLine *);
@@ -56,7 +59,7 @@ static void g_register_operand_print(const GRegisterOperand *, GBufferLine *);
/* Fournit l'empreinte d'un candidat à une centralisation. */
-static guint g_register_operand_hash(const GRegisterOperand *);
+static guint g_register_operand_hash(const GRegisterOperand *, bool);
@@ -132,8 +135,6 @@ static void g_register_operand_init(GRegisterOperand *operand)
{
operand->reg = NULL;
- INIT_REG_OP_EXTRA(operand);
-
}
@@ -179,8 +180,9 @@ static void g_register_operand_finalize(GRegisterOperand *operand)
/******************************************************************************
* *
-* Paramètres : a = premier opérande à consulter. *
-* b = second opérande à consulter. *
+* Paramètres : a = premier opérande à consulter. *
+* b = second opérande à consulter. *
+* lock = précise le besoin en verrouillage. *
* *
* Description : Compare un opérande avec un autre. *
* *
@@ -190,12 +192,19 @@ static void g_register_operand_finalize(GRegisterOperand *operand)
* *
******************************************************************************/
-static int g_register_operand_compare(const GRegisterOperand *a, const GRegisterOperand *b)
+static int g_register_operand_compare(const GRegisterOperand *a, const GRegisterOperand *b, bool lock)
{
int result; /* Bilan à retourner */
+ GArchOperandClass *class; /* Classe parente normalisée */
result = g_arch_register_compare(a->reg, b->reg);
+ if (result == 0)
+ {
+ class = G_ARCH_OPERAND_CLASS(g_register_operand_parent_class);
+ result = class->compare(G_ARCH_OPERAND(a), G_ARCH_OPERAND(b), false);
+ }
+
return result;
}
@@ -246,63 +255,6 @@ GArchRegister *g_register_operand_get_register(const GRegisterOperand *operand)
}
-/******************************************************************************
-* *
-* Paramètres : operand = opérande représentant un registre à mettre à jour. *
-* *
-* Description : Marque l'opérande comme étant écrit plutôt que consulté. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_register_operand_mark_as_written(GRegisterOperand *operand)
-{
- regop_obj_extra *extra; /* Données insérées à modifier */
-
- extra = GET_REG_OP_EXTRA(operand);
-
- g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
-
- extra->is_written = true;
-
- g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande représentant un registre à consulter. *
-* *
-* Description : Indique le type d'accès réalisé sur l'opérande. *
-* *
-* Retour : Type d'accès : true en cas d'écriture, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool g_register_operand_is_written(const GRegisterOperand *operand)
-{
- bool result; /* Statut à retourner */
- regop_obj_extra *extra; /* Données insérées à modifier */
-
- extra = GET_REG_OP_EXTRA(operand);
-
- g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
-
- result = extra->is_written;
-
- g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
-
- return result;
-
-}
-
-
/* ---------------------------------------------------------------------------------- */
/* CONTROLE DU VOLUME DES INSTANCES */
@@ -312,6 +264,7 @@ bool g_register_operand_is_written(const GRegisterOperand *operand)
/******************************************************************************
* *
* Paramètres : operand = objet dont l'instance se veut unique. *
+* lock = précise le besoin en verrouillage. *
* *
* Description : Fournit l'empreinte d'un candidat à une centralisation. *
* *
@@ -321,20 +274,21 @@ bool g_register_operand_is_written(const GRegisterOperand *operand)
* *
******************************************************************************/
-static guint g_register_operand_hash(const GRegisterOperand *operand)
+static guint g_register_operand_hash(const GRegisterOperand *operand, bool lock)
{
guint result; /* Valeur à retourner */
+ GArchOperandClass *class; /* Classe parente normalisée */
GArchRegister *reg; /* Registre visé par l'opérande*/
+ class = G_ARCH_OPERAND_CLASS(g_register_operand_parent_class);
+ result = class->hash(G_ARCH_OPERAND(operand), false);
+
reg = g_register_operand_get_register(operand);
- result = g_arch_register_hash(reg);
+ result ^= g_arch_register_hash(reg);
g_object_unref(G_OBJECT(reg));
- if (g_register_operand_is_written(operand))
- result ^= 1;
-
return result;
}