diff options
Diffstat (limited to 'src/arch/arm/v7/operands/reglist.c')
-rw-r--r-- | src/arch/arm/v7/operands/reglist.c | 210 |
1 files changed, 2 insertions, 208 deletions
diff --git a/src/arch/arm/v7/operands/reglist.c b/src/arch/arm/v7/operands/reglist.c index 968a423..9f641b8 100644 --- a/src/arch/arm/v7/operands/reglist.c +++ b/src/arch/arm/v7/operands/reglist.c @@ -30,14 +30,10 @@ #include "../../../operand-int.h" #include "../../../register.h" -#include "../../../sharing/manager.h" #include "../../../../common/sort.h" -/* --------------------- MANIPULATION D'OPERANDES INDIVIDUELLES --------------------- */ - - /* Définition d'un opérande listant une série de registres ARM (instance) */ struct _GArmV7RegListOperand { @@ -69,15 +65,6 @@ static void g_armv7_reglist_operand_dispose(GArmV7RegListOperand *); /* Procède à la libération totale de la mémoire. */ static void g_armv7_reglist_operand_finalize(GArmV7RegListOperand *); -/* Initialise un nouvel objet partagé avec des informations. */ -static bool g_armv7_reglist_operand_apply_template(GArmV7RegListOperand *, const GArmV7RegListOperand *); - -/* Réalise une copie minimale d'un contenu partagé. */ -static void g_armv7_reglist_operand_define_template(const GArmV7RegListOperand *, GArmV7RegListOperand *); - -/* Libère la mémoire utilisée par un patron d'instance. */ -static void g_armv7_reglist_operand_free_template(const GArmV7RegListOperand *, GArmV7RegListOperand *); - /* Compare un opérande avec un autre. */ static int g_armv7_reglist_operand_compare(const GArmV7RegListOperand *, const GArmV7RegListOperand *); @@ -86,23 +73,6 @@ static void g_armv7_reglist_operand_print(const GArmV7RegListOperand *, GBufferL -/* -------------------------- PARTAGES DE CONTENUS UNIQUES -------------------------- */ - - -/* Gestionnaire des partages d'instances */ -static GShareManager *_armv7_reglist_operand_manager = NULL; - - -/* Fournit le gestionnaire de partages attribué à un type. */ -static GShareManager *get_armv7_reglist_operand_share_manager(void); - - - -/* ---------------------------------------------------------------------------------- */ -/* MANIPULATION D'OPERANDES INDIVIDUELLES */ -/* ---------------------------------------------------------------------------------- */ - - /* Indique le type défini par la GLib pour une liste de registres ARM. */ G_DEFINE_TYPE(GArmV7RegListOperand, g_armv7_reglist_operand, G_TYPE_ARCH_OPERAND); @@ -130,12 +100,6 @@ static void g_armv7_reglist_operand_class_init(GArmV7RegListOperandClass *klass) object->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_reglist_operand_dispose; object->finalize = (GObjectFinalizeFunc)g_armv7_reglist_operand_finalize; - operand->get_manager = (get_operand_manager_fc)get_armv7_reglist_operand_share_manager; - - operand->apply_template = (apply_operand_template_fc)g_armv7_reglist_operand_apply_template; - operand->define_template = (define_operand_template_fc)g_armv7_reglist_operand_define_template; - operand->free_template = (free_operand_template_fc)g_armv7_reglist_operand_free_template;; - operand->compare = (operand_compare_fc)g_armv7_reglist_operand_compare; operand->print = (operand_print_fc)g_armv7_reglist_operand_print; @@ -208,91 +172,6 @@ static void g_armv7_reglist_operand_finalize(GArmV7RegListOperand *operand) /****************************************************************************** * * -* Paramètres : operand = objet partagé à initialiser. * -* template = information à utiliser pour la mise en place. * -* * -* Description : Initialise un nouvel objet partagé avec des informations. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static bool g_armv7_reglist_operand_apply_template(GArmV7RegListOperand *operand, const GArmV7RegListOperand *template) -{ - size_t i; /* Boucle de parcours */ - - g_armv7_reglist_operand_define_template(template, operand); - - for (i = 0; i < operand->count; i++) - g_object_ref(G_OBJECT(operand->registers[i])); - - return true; - -} - - -/****************************************************************************** -* * -* Paramètres : operand = objet partagé à consulter. * -* template = informations à retrouver intégralement. * -* * -* Description : Réalise une copie minimale d'un contenu partagé. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_armv7_reglist_operand_define_template(const GArmV7RegListOperand *operand, GArmV7RegListOperand *template) -{ - size_t i; /* Boucle de parcours */ - - if (operand != NULL) - template->count = operand->count; - else - template->count = 0; - - if (template->count == 0) - template->registers = NULL; - - else - { - template->registers = (GArmV7Register **)malloc(template->count * sizeof(GArmV7Register *)); - - for (i = 0; i < template->count; i++) - template->registers[i] = operand->registers[i]; - - } - -} - - -/****************************************************************************** -* * -* Paramètres : operand = objet partagé à consulter. * -* template = informations dont le contenu est à libérer. * -* * -* Description : Libère la mémoire utilisée par un patron d'instance. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_armv7_reglist_operand_free_template(const GArmV7RegListOperand *operand, GArmV7RegListOperand *template) -{ - if (template->registers != NULL) - free(template->registers); - -} - - -/****************************************************************************** -* * * Paramètres : a = premier opérande à consulter. * * b = second opérande à consulter. * * * @@ -388,9 +267,9 @@ static void g_armv7_reglist_operand_print(const GArmV7RegListOperand *operand, G GArchOperand *g_armv7_reglist_operand_new(void) { - GSharedInstance *result; /* Structure à retourner */ + GArchOperand *result; /* Structure à retourner */ - result = g_share_manager_build(_armv7_reglist_operand_manager, NULL); + result = g_object_new(G_TYPE_ARMV7_REGLIST_OPERAND, NULL); return G_ARCH_OPERAND(result); @@ -495,88 +374,3 @@ GArmV7Register *g_armv7_reglist_operand_get_register(const GArmV7RegListOperand return operand->registers[index]; } - - - -/* ---------------------------------------------------------------------------------- */ -/* PARTAGES DE CONTENUS UNIQUES */ -/* ---------------------------------------------------------------------------------- */ - - -/****************************************************************************** -* * -* Paramètres : - * -* * -* Description : Fournit le gestionnaire de partages attribué à un type. * -* * -* Retour : Gestionnaire de partages en place. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static GShareManager *get_armv7_reglist_operand_share_manager(void) -{ - return _armv7_reglist_operand_manager; - -} - - -/****************************************************************************** -* * -* Paramètres : - * -* * -* Description : Met en place les mécanismes de partage de listes de reg. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool init_armv7_reglist_operand_sharing(void) -{ - _armv7_reglist_operand_manager = g_share_manager_new(G_TYPE_ARMV7_REGLIST_OPERAND); - - return true; - -} - - -/****************************************************************************** -* * -* Paramètres : - * -* * -* Description : Imprime des statistiques quant aux partages dans l'archi. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ -#ifdef DEBUG_DUMP_STATS -void dump_armv7_reglist_operand_share_stats(void) -{ - g_share_manager_dump_stats(_armv7_reglist_operand_manager); - -} -#endif - - -/****************************************************************************** -* * -* Paramètres : - * -* * -* Description : Supprime les mécanismes de partage des listes de registres. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void exit_armv7_reglist_operand_sharing(void) -{ - g_object_unref(G_OBJECT(_armv7_reglist_operand_manager)); - -} |