From 085c4bd6ebfa812bdd5ab64adf8cf61b8cd1f4b0 Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 12 Dec 2016 23:49:42 +0100 Subject: [PATCH] Nothing uses phi congruence any more (replaced by register allocator anode coalescing), so remove the pass that calculated it. --- mach/proto/mcg/pass_phigroups.c | 103 -------------------------------- mach/proto/mcg/reg.h | 15 ++--- 2 files changed, 4 insertions(+), 114 deletions(-) delete mode 100644 mach/proto/mcg/pass_phigroups.c diff --git a/mach/proto/mcg/pass_phigroups.c b/mach/proto/mcg/pass_phigroups.c deleted file mode 100644 index 68d8c7d34..000000000 --- a/mach/proto/mcg/pass_phigroups.c +++ /dev/null @@ -1,103 +0,0 @@ -#include "mcg.h" - -static PMAPOF(struct vreg, struct vreg) phimap; - -static void make_phimap(void) -{ - int i, j; - - phimap.count = 0; - for (i=0; iphis.count; j++) - { - struct vreg* vreg = bb->phis.item[j].left; - struct phi* phi = bb->phis.item[j].right; - struct vreg* prevvreg = phi->ir->result; - - pmap_add(&phimap, vreg, prevvreg); - } - } -} - -static void recursively_associate_group(struct phicongruence* c, struct vreg* vreg) -{ - int i; - - vreg->congruence = c; - array_appendu(&c->vregs, vreg); - tracef('V', "V: %%%d is a member of congruence group %d\n", - vreg->id, c->id); - - if (vreg->defined) - { - struct constraint* constraint = pmap_findleft(&vreg->defined->constraints, vreg); - if (c->type == 0) - c->type = vreg->type; - - assert(c->type == vreg->type); - - array_appendu(&c->definitions, vreg->defined); - } - - for (;;) - { - struct vreg* child = pmap_findleft(&phimap, vreg); - if (!child) - break; - - pmap_remove(&phimap, vreg, child); - recursively_associate_group(c, child); - } - - for (;;) - { - struct vreg* child = pmap_findright(&phimap, vreg); - if (!child) - break; - - pmap_remove(&phimap, child, vreg); - recursively_associate_group(c, child); - } -} - -static void update_vreg_types(struct phicongruence* c) -{ - int i; - - for (i=0; ivregs.count; i++) - { - struct vreg* vreg = c->vregs.item[i]; - - if (vreg->type == 0) - vreg->type = c->type; - assert(vreg->type == c->type); - assert(vreg->type != 0); - } -} - -static void associate_groups(void) -{ - static int number = 0; - - while (phimap.count > 0) - { - struct phicongruence* c = heap_alloc(&proc_heap, 1, sizeof(*c)); - c->id = number++; - recursively_associate_group(c, phimap.item[0].left); - update_vreg_types(c); - } -} - -void pass_find_phi_congruence_groups(void) -{ - make_phimap(); - associate_groups(); -} - -/* vim: set sw=4 ts=4 expandtab : */ - - - diff --git a/mach/proto/mcg/reg.h b/mach/proto/mcg/reg.h index d1c4cbcb5..c0cd47fa1 100644 --- a/mach/proto/mcg/reg.h +++ b/mach/proto/mcg/reg.h @@ -3,14 +3,6 @@ #define WITH_ATTR(a) (1<<(a)) -struct phicongruence -{ - int id; - ARRAYOF(struct vreg) vregs; - ARRAYOF(struct hop) definitions; - uint32_t type; -}; - struct hreg { const char* id; @@ -25,10 +17,11 @@ struct vreg { int id; uint32_t type; - struct phicongruence* congruence; - struct hop* defined; struct anode* anode; - ARRAYOF(struct hop) used; + bool is_spillable; + struct hop* defined; + ARRAYOF(struct hop) usedhops; + ARRAYOF(struct basicblock) usedphis; }; typedef PMAPOF(struct hreg, struct vreg) register_assignment_t; -- 2.34.1