Example #1
0
            public bool Flag;       // toggled to mark reachability

            public Line([CanBeNull] ILabel label, TCode code, [CanBeNull] ILabel target, PeepholeLineType type)
            {
                Label       = label;
                Code        = code;
                TargetLabel = target;
                Type        = type;
            }
Example #2
0
 public CombinableLine(ILabel label, TCode code, ILabel target, PeepholeLineType type)
     : this()
 {
     Label  = label;
     Code   = code;
     Target = target;
     Type   = type;
 }
Example #3
0
            public void CopyFrom([NotNull] Line other)
            {
                Label       = other.Label;
                Code        = other.Code;
                TargetLabel = other.TargetLabel;
                Type        = other.Type;

                TargetLine = other.TargetLine;
                Flag       = other.Flag;
            }
Example #4
0
        static PeepholeLineType InvertBranch(PeepholeLineType type)
        {
            switch (type)
            {
            case PeepholeLineType.BranchPositive:
                return(PeepholeLineType.BranchNegative);

            case PeepholeLineType.BranchNegative:
                return(PeepholeLineType.BranchPositive);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Example #5
0
 /// <summary>
 /// Adds an instruction to the buffer.
 /// </summary>
 /// <param name="code">The instruction.</param>
 /// <param name="target">The target label of this instruction, or null.</param>
 /// <param name="type">The type of instruction.</param>
 public void AddLine(TCode code, [CanBeNull] ILabel target, PeepholeLineType type)
 {
     lines.AddLast(new Line(pendingLabel, code, target, type));
     pendingLabel = null;
 }
Example #6
0
 static bool IsInvertibleBranch(PeepholeLineType type)
 {
     return(type == PeepholeLineType.BranchNegative ||
            type == PeepholeLineType.BranchPositive);
 }