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); }
// 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); }
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); } }