Beispiel #1
0
        public IEnumerable <IXILMapping> TryMap(ITransactionSite taSite, XILInstr instr, TypeDescriptor[] operandTypes, TypeDescriptor[] resultTypes)
        {
            var fu  = taSite.Host;
            BCU bcu = fu as BCU;

            if (bcu != _host)
            {
                yield break;
            }

            switch (instr.Name)
            {
            case InstructionCodes.Goto:
            case InstructionCodes.BranchIfTrue:
            case InstructionCodes.BranchIfFalse:
            {
                var target = (BranchLabel)instr.Operand;
                switch (instr.Name)
                {
                case InstructionCodes.Goto:
                    yield return(new GotoMapping(bcu, target));

                    yield break;

                case InstructionCodes.BranchIfTrue:
                    yield return(new BranchIfMapping(bcu, target));

                    yield break;

                case InstructionCodes.BranchIfFalse:
                    yield return(new BranchIfNotMapping(bcu, target));

                    yield break;

                default:
                    throw new NotImplementedException();
                }
            }

            default:
                yield break;
            }
        }
Beispiel #2
0
 public BCUMapping(BCU bcu, BranchLabel target)
 {
     _bcu    = bcu;
     _target = target;
 }
Beispiel #3
0
 public BCUTransactionSite(BCU host) :
     base(host)
 {
     _host = host;
 }
Beispiel #4
0
 /// <summary>
 /// Constructs an instance
 /// </summary>
 /// <param name="host">the branch control unit</param>
 /// <param name="latency">desired latency</param>
 public BCUMapper(BCU host, int latency = 1)
 {
     _host    = host;
     _latency = latency;
 }
Beispiel #5
0
 public BranchIfNotMapping(BCU bcu, BranchLabel target) :
     base(bcu, target)
 {
 }
Beispiel #6
0
 public GotoMapping(BCU bcu, BranchLabel target) :
     base(bcu, target)
 {
 }