diff options
Diffstat (limited to 'src/arch/register.c')
-rw-r--r-- | src/arch/register.c | 60 |
1 files changed, 20 insertions, 40 deletions
diff --git a/src/arch/register.c b/src/arch/register.c index ef593b4..87a07b5 100644 --- a/src/arch/register.c +++ b/src/arch/register.c @@ -58,8 +58,8 @@ static void g_arch_register_inc_references(GArchRegister *); /* Décrémente le compteur de partage. */ static void g_arch_register_dec_references(GArchRegister *); -/* Indique l'objet partagé correspond à une description donnée. */ -static gboolean g_arch_register_compare_info(const GArchRegister *, const void *); +/* Compare de façon accélérée un registre avec un autre. */ +static int g_arch_register_quickly_compare(const GArchRegister **, const GArchRegister **); @@ -79,7 +79,7 @@ static void g_register_operand_dispose(GRegisterOperand *); static void g_register_operand_finalize(GRegisterOperand *); /* Compare un opérande avec un autre. */ -static bool g_register_operand_compare(const GRegisterOperand *, const GRegisterOperand *); +static int g_register_operand_compare(const GRegisterOperand **, const GRegisterOperand **); /* Traduit un opérande en version humainement lisible. */ static void g_register_operand_print(const GRegisterOperand *, GBufferLine *, AsmSyntax); @@ -158,8 +158,7 @@ static void g_arch_register_interface_init(GSharedInstanceInterface *iface) iface->inc_ref = (inc_shared_ref_fc)g_arch_register_inc_references; iface->dec_ref = (dec_shared_ref_fc)g_arch_register_dec_references; - iface->cmp_info = (compare_shared_info_fc)g_arch_register_compare_info; - iface->is_equal = (is_shared_equal_fc)g_arch_register_equal; + iface->qck_cmp = (qck_compare_shared_fc)g_arch_register_quickly_compare; } @@ -285,22 +284,22 @@ static void g_arch_register_dec_references(GArchRegister *reg) /****************************************************************************** * * -* Paramètres : reg = objet partagé à consulter. * -* info = compilation de d'information à analyser. * +* Paramètres : a = premier registre à consulter. * +* b = second registre à consulter. * * * -* Description : Indique l'objet partagé correspond à une description donnée. * +* Description : Compare de façon accélérée un registre avec un autre. * * * -* Retour : true si les détails centraux sont partagés, false sinon. * +* Retour : Bilan de la comparaison. * * * * Remarques : - * * * ******************************************************************************/ -static gboolean g_arch_register_compare_info(const GArchRegister *reg, const void *info) +static int g_arch_register_quickly_compare(const GArchRegister **a, const GArchRegister **b) { - bool result; /* Bilan à retourner */ + int result; /* Bilan à faire remonter */ - result = G_ARCH_REGISTER_GET_CLASS(reg)->cmp_info(G_SHARED_INSTANCE(reg), info); + result = G_ARCH_REGISTER_GET_CLASS(*a)->compare(a, b); return result; @@ -339,33 +338,9 @@ guint g_arch_register_hash(const GArchRegister *reg) * * ******************************************************************************/ -int g_arch_register_compare(const GArchRegister *a, const GArchRegister *b) -{ - return G_ARCH_REGISTER_GET_CLASS(a)->compare(a, b); - -} - - -/****************************************************************************** -* * -* Paramètres : a = premier opérande à consulter. * -* b = second opérande à consulter. * -* * -* Description : Détermine si un registre est égal à un autre. * -* * -* Retour : Bilan de la comparaison. * -* * -* Remarques : - * -* * -******************************************************************************/ - -gboolean g_arch_register_equal(const GArchRegister *a, const GArchRegister *b) +int g_arch_register_compare(const GArchRegister * const *a, const GArchRegister * const *b) { - int ret; /* Comparaison détaillée */ - - ret = g_arch_register_compare(a, b); - - return (ret == 0 ? TRUE : FALSE); + return G_ARCH_REGISTER_GET_CLASS(*a)->compare(a, b); } @@ -598,9 +573,14 @@ GArchRegister *g_register_operand_get_register(const GRegisterOperand *operand) * * ******************************************************************************/ -static bool g_register_operand_compare(const GRegisterOperand *a, const GRegisterOperand *b) +static int g_register_operand_compare(const GRegisterOperand **a, const GRegisterOperand **b) { - return (g_arch_register_compare(a->reg, b->reg) == 0); + int result; /* Bilan à retourner */ + + result = g_arch_register_compare((const GArchRegister * const *)&(*a)->reg, + (const GArchRegister * const *)&(*b)->reg); + + return result; } |