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; } }
public BCUMapping(BCU bcu, BranchLabel target) { _bcu = bcu; _target = target; }
public BCUTransactionSite(BCU host) : base(host) { _host = host; }
/// <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; }
public BranchIfNotMapping(BCU bcu, BranchLabel target) : base(bcu, target) { }
public GotoMapping(BCU bcu, BranchLabel target) : base(bcu, target) { }