Ejemplo n.º 1
0
 public bool WasUsed(Instruction instr, Identifier id)
 {
     this.id      = id;
     this.wasUsed = false;
     instr.Accept(this);
     return(wasUsed);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Given a procedure in SSA form, converts it back to "normal" form.
        /// </summary>
        /// <param name="renameVariables"></param>
        public void ConvertBack(bool renameVariables)
        {
            UnSSA unssa = new UnSSA(this);

            foreach (Block block in Procedure.ControlGraph.Blocks)
            {
                for (int st = 0; st < block.Statements.Count; ++st)
                {
                    Instruction instr = block.Statements[st].Instruction;
                    if (instr is PhiAssignment || instr is DefInstruction)
                    {
                        block.Statements.RemoveAt(st);
                        --st;
                    }
                    else if (renameVariables)
                    {
                        instr.Accept(unssa);
                    }
                }
            }

            // Remove any instructions in the return block, used only
            // for computation of reaching definitions.

            Procedure.ExitBlock.Statements.Clear();
        }
Ejemplo n.º 3
0
        public void EnableInstructionOnly_AllElementStateCorrect()
        {
            var revealInstruction = new Revealer();

            _instruction.Accept(revealInstruction);

            Assert.False(_mario.Active);
            Assert.False(_luigi.Active);
            Assert.True(_instruction.Active);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// For each statement in the procedure, traverse any defined operands. Upon
 /// encountering, add alias statements for all the known aliases.
 /// We do this in reverse order, calculating at the same time the deadness
 /// of all registers. We may not need to generate an alias if the
 /// register is dead.
 /// </summary>
 /// <param name="proc"></param>
 public void Transform()
 {
     foreach (var block in proc.ControlGraph.Blocks)
     {
         StartBlock(block);
         for (iStm = block.Statements.Count - 1; iStm >= 0; --iStm)
         {
             Instruction instr = block.Statements[iStm].Instruction;
             instr.Accept(this);
         }
     }
 }
Ejemplo n.º 5
0
 private static int GetNumberPushedByInstruction(Instruction current)
 {
     return(current.Accept(new NumberPushedVisitor()));
 }
Ejemplo n.º 6
0
 public bool Match(Instruction instr)
 {
     matcher.Clear();
     return(instr.Accept(this));
 }
Ejemplo n.º 7
0
 public Instruction ReplaceIdentifiers(Instruction instr)
 {
     return(instr.Accept(this));
 }
Ejemplo n.º 8
0
 public string Visit(Instruction instruction)
 {
     return(instruction.Accept(this));
 }
Ejemplo n.º 9
0
 public bool IsCritical(Instruction instr)
 {
     isCritical = false;
     instr.Accept(this);
     return(isCritical);
 }
Ejemplo n.º 10
0
 public SideEffectFlags FindSideEffect(Instruction instr)
 {
     flags = SideEffectFlags.None;
     instr.Accept(this);
     return(flags);
 }
 public void Visit(Instruction instruction)
 {
     instruction.Accept(this);
 }
Ejemplo n.º 12
0
		public SideEffectFlags FindSideEffect(Instruction instr)
		{
			flags = SideEffectFlags.None;
			instr.Accept(this);
			return flags;
		}
Ejemplo n.º 13
0
		public bool IsCritical(Instruction instr)
		{
			isCritical = false;
			instr.Accept(this);
			return isCritical;
		}
Ejemplo n.º 14
0
 public ISet <VariableDescriptor> Visit(Instruction instruction)
 {
     return(instruction.Accept(this));
 }
Ejemplo n.º 15
0
 public void Visit(Instruction node)
 {
     node.Accept(this);
 }