コード例 #1
0
 public bool WasUsed(Instruction instr, Identifier id)
 {
     this.id      = id;
     this.wasUsed = false;
     instr.Accept(this);
     return(wasUsed);
 }
コード例 #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();
        }
コード例 #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);
        }
コード例 #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);
         }
     }
 }
コード例 #5
0
 private static int GetNumberPushedByInstruction(Instruction current)
 {
     return(current.Accept(new NumberPushedVisitor()));
 }
コード例 #6
0
 public bool Match(Instruction instr)
 {
     matcher.Clear();
     return(instr.Accept(this));
 }
コード例 #7
0
 public Instruction ReplaceIdentifiers(Instruction instr)
 {
     return(instr.Accept(this));
 }
コード例 #8
0
 public string Visit(Instruction instruction)
 {
     return(instruction.Accept(this));
 }
コード例 #9
0
 public bool IsCritical(Instruction instr)
 {
     isCritical = false;
     instr.Accept(this);
     return(isCritical);
 }
コード例 #10
0
 public SideEffectFlags FindSideEffect(Instruction instr)
 {
     flags = SideEffectFlags.None;
     instr.Accept(this);
     return(flags);
 }
コード例 #11
0
 public void Visit(Instruction instruction)
 {
     instruction.Accept(this);
 }
コード例 #12
0
ファイル: SideEffectFinder.cs プロジェクト: killbug2004/reko
		public SideEffectFlags FindSideEffect(Instruction instr)
		{
			flags = SideEffectFlags.None;
			instr.Accept(this);
			return flags;
		}
コード例 #13
0
ファイル: CriticalInstruction.cs プロジェクト: relaxar/reko
		public bool IsCritical(Instruction instr)
		{
			isCritical = false;
			instr.Accept(this);
			return isCritical;
		}
コード例 #14
0
 public ISet <VariableDescriptor> Visit(Instruction instruction)
 {
     return(instruction.Accept(this));
 }
コード例 #15
0
 public void Visit(Instruction node)
 {
     node.Accept(this);
 }