Exemplo n.º 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);
 }
Exemplo n.º 2
0
        public SsaLivenessAnalysis(SsaState ssa)
        {
            this.ssaIds       = ssa.Identifiers;
            this.visited      = new HashSet <Block>();
            this.records      = new Dictionary <Block, Record>();
            this.defined      = new Dictionary <Statement, List <Identifier> >();
            this.interference = new InterferenceGraph();

            BuildRecords(ssa.Procedure.ControlGraph.Blocks);
            BuildDefinedMap(ssaIds);
            BuildInterferenceGraph(ssaIds);
        }
Exemplo n.º 3
0
 public void BuildInterferenceGraph(SsaIdentifierCollection ssaIds)
 {
     interference = new InterferenceGraph();
     foreach (SsaIdentifier v in ssaIds)
     {
         visited = new HashSet <Block>();
         foreach (Statement s in v.Uses)
         {
             PhiFunction phi = GetPhiFunction(s);
             if (phi != null)
             {
                 var p = phi.Arguments.First(e => e.Value == v.Identifier).Block;
                 LiveOutAtBlock(p, v);
             }
             else
             {
                 int i = s.Block.Statements.IndexOf(s);
                 LiveInAtStatement(s.Block, i, v);
             }
         }
     }
 }
Exemplo n.º 4
0
		public void BuildInterferenceGraph(SsaIdentifierCollection ssaIds)
		{
			interference = new InterferenceGraph();
			foreach (SsaIdentifier v in ssaIds)
			{
				visited = new HashSet<Block>();
				foreach (Statement s in v.Uses)
				{
					PhiFunction phi = GetPhiFunction(s);
					if (phi != null)
					{
						int i = Array.IndexOf(phi.Arguments, v.Identifier);
						Block p = s.Block.Pred[i];
						LiveOutAtBlock(p, v);
					}
					else
					{
						int i = s.Block.Statements.IndexOf(s);
						LiveInAtStatement(s.Block, i, v);
					}
				}
			}
		}
Exemplo n.º 5
0
		public SsaLivenessAnalysis2(Procedure proc, SsaIdentifierCollection ssa)
		{
			this.ssa = ssa;
            visitedBlocks = new Dictionary<Block, Block>();
			interference = new InterferenceGraph();
		}
Exemplo n.º 6
0
 public SsaLivenessAnalysis2(SsaState ssa)
 {
     this.ssa      = ssa.Identifiers;
     visitedBlocks = new Dictionary <Block, Block>();
     interference  = new InterferenceGraph();
 }
Exemplo n.º 7
0
 public SsaLivenessAnalysis2(Procedure proc, SsaIdentifierCollection ssa)
 {
     this.ssa      = ssa;
     visitedBlocks = new Dictionary <Block, Block>();
     interference  = new InterferenceGraph();
 }
Exemplo n.º 8
0
 public void IgCreate()
 {
     InterferenceGraph ig = new InterferenceGraph();
 }