예제 #1
0
 public void IgAddEdge()
 {
     var ig = new InterferenceGraph();
     var id1 = new Identifier("id1", PrimitiveType.Word32, null);
     var id2 = new Identifier("id2", PrimitiveType.Word32, null);
     ig.Add(id1, id2);
     Assert.IsTrue(ig.Interfere(id1, id2), "id1 inteferes with id2", null);
     Assert.IsTrue(ig.Interfere(id2, id1), "id2 inteferes with id1", null);
 }
예제 #2
0
        // Returns true if v is also live in before executing s.

        public bool LiveOutAtStatement(Statement s, SsaIdentifier v)
        {
            // v is live-out at s.

            List <Identifier> ids = this.IdentifiersDefinedAtStatement(s);

            foreach (Identifier id in ids)
            {
                if (id != v.Identifier)
                {
                    interference.Add(id, v.Identifier);
                }
            }
            return(v.DefStatement != s);
        }
예제 #3
0
        public void LiveOutAtStatement(Block block, int iStm, SsaIdentifier sid)
        {
            Dictionary <SsaIdentifier, SsaIdentifier> W = iStm >= 0
                                ? VariablesDefinedByStatement(block.Statements[iStm])
                                : new Dictionary <SsaIdentifier, SsaIdentifier>();

            foreach (SsaIdentifier w in W.Values)
            {
                if (w != sid)
                {
                    interference.Add(w.Identifier, sid.Identifier);
                }
            }
            if (!W.ContainsKey(sid))
            {
                LiveInAtStatement(block, iStm, sid);
            }
        }