Esempio n. 1
0
 /// <summary>
 /// Returns a <see cref="System.String" /> that represents this instance.
 /// </summary>
 /// <returns>
 /// A <see cref="System.String" /> that represents this instance.
 /// </returns>
 public override string ToString()
 {
     if (IsPhysicalRegister)
     {
         return(PhysicalRegister.ToString());
     }
     else
     {
         return(string.Format("V_{0}", VirtualRegisterOperand.Index));
     }
 }
Esempio n. 2
0
        public OpcodeEncoder AppendSIB(int scale, PhysicalRegister index, PhysicalRegister @base)
        {
            Debug.Assert(scale == 1 || scale == 2 || scale == 4 || scale == 8);

            int svalue = 0;

            if (scale == 1)
            {
                svalue = 0;
            }
            else if (scale == 2)
            {
                svalue = 1;
            }
            else if (scale == 4)
            {
                svalue = 2;
            }
            else if (scale == 8)
            {
                svalue = 3;
            }

            // scale
            AppendBits(svalue, 2);

            // index
            if (index == null)
            {
                Append3Bits(0b100);
            }
            else
            {
                AppendRegister(index);
            }

            // base
            if (@base == null)
            {
                Append3Bits(0b101);
            }
            else
            {
                AppendRegister(@base);
            }

            return(this);
        }
Esempio n. 3
0
        private int FindIndex(PhysicalRegister register, bool source)
        {
            for (int i = 0; i < Moves.Count; i++)
            {
                var move = Moves[i];

                var operand = source ? move.Source : move.Destination;

                if (!operand.IsCPURegister)
                {
                    continue;
                }

                if (operand.Register == register)
                {
                    return(i);
                }
            }

            return(-1);
        }
Esempio n. 4
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            switch (NodeType)
            {
            case NodeType.Instruction: sb.Append(Instruction.Name); break;

            case NodeType.FixedIntegerConstant: sb.Append(ConstantInteger.ToString()); break;

            case NodeType.FixedDoubleConstant: sb.Append(ConstantDouble.ToString()); break;

            case NodeType.PhyiscalRegister: sb.Append(PhysicalRegister.ToString()); break;

            case NodeType.VirtualRegister:
            case NodeType.OperandVariable: sb.Append(Alias); break;

            case NodeType.ConstantVariable: sb.Append("(Const "); sb.Append(Alias); sb.Append(")"); break;

            case NodeType.TypeVariable: sb.Append('<'); sb.Append(Alias); sb.Append('>'); break;

            case NodeType.Expression: sb.Append("["); sb.Append(ExpressionNode.ToString()); sb.Append("]"); break;

            case NodeType.Any: sb.Append("_"); break;

            default: break;
            }

            if (ParentNodes.Count != 0)
            {
                foreach (var node in ParentNodes)
                {
                    sb.Append(" ");
                    sb.Append(node.ToString());
                }
            }

            return(sb.ToString());
        }
Esempio n. 5
0
 public OpcodeEncoder AppendRM(PhysicalRegister register)
 {
     return(Append3Bits(register.RegisterCode));
 }
Esempio n. 6
0
 public VirtualRegister(PhysicalRegister physicalRegister, bool reserved)
 {
     PhysicalRegister = physicalRegister;
     IsReserved       = reserved;
     IsSpilled        = false;
 }
 public LiveIntervalTrack(PhysicalRegister register, bool reserved)
 {
     Register   = register;
     IsReserved = reserved;
 }
Esempio n. 8
0
 public Node(PhysicalRegister physicalRegister)
 {
     NodeType         = NodeType.PhyiscalRegister;
     PhysicalRegister = physicalRegister;
 }