protected override void DoBuild( EmitSyntax emit, Pipe <EmitSyntax> ldvalue, SwitchGeneratorAction action) { this.action = action; #if false var decisionTree = new BinaryDecisionTreeBuilder(intMap.DefaultValue, platformInfo); var node = decisionTree.Build(intMap.Enumerate().ToArray()); #else this.builder = new DecisionTreeBuilder(platformInfo); var node = builder.Build( intMap, possibleBounds, frequency); #endif this.emit = emit; this.ldvalue = ldvalue; this.labels = new List <Ref <Labels> >(); strategy.PlanCode(node); strategy.GenerateCode(); // Debug.Write(node); }
protected override void DoBuild(EmitSyntax emit, Pipe<EmitSyntax> ldvalue, SwitchGeneratorAction action) { var labels = new Ref<Labels>[map.Length]; for (int i = 0; i != labels.Length; ++i) { labels[i] = emit.Labels.Generate().GetRef(); } emit .Do(ldvalue) .Switch(labels) ; action(emit, defaultValue); for (int i = 0; i != labels.Length; ++i) { emit.Label(labels[i].Def); action(emit, map[i]); } }
protected override void DoBuild(EmitSyntax emit, Pipe <EmitSyntax> ldvalue, SwitchGeneratorAction action) { var labels = new Ref <Labels> [map.Length]; for (int i = 0; i != labels.Length; ++i) { labels[i] = emit.Labels.Generate().GetRef(); } emit .Do(ldvalue) .Switch(labels) ; action(emit, defaultValue); for (int i = 0; i != labels.Length; ++i) { emit.Label(labels[i].Def); action(emit, map[i]); } }
protected override void DoBuild( EmitSyntax emit, Pipe<EmitSyntax> ldvalue, SwitchGeneratorAction action) { this.action = action; #if false var decisionTree = new BinaryDecisionTreeBuilder(intMap.DefaultValue, platformInfo); var node = decisionTree.Build(intMap.Enumerate().ToArray()); #else this.builder = new DecisionTreeBuilder(platformInfo); var node = builder.Build( intMap, possibleBounds, frequency); #endif this.emit = emit; this.ldvalue = ldvalue; this.labels = new List<Ref<Labels>>(); strategy.PlanCode(node); strategy.GenerateCode(); // Debug.Write(node); }
protected abstract void DoBuild(EmitSyntax emit, Pipe <EmitSyntax> ldvalue, SwitchGeneratorAction action);
public void Build(EmitSyntax emit, Pipe <EmitSyntax> ldvalue, SwitchGeneratorAction action) { this.END = emit.Labels.Generate(); DoBuild(emit, ldvalue, action); }
public void Build(EmitSyntax emit, Ref <Args>[] args, SwitchGeneratorAction action) { Build(emit, il => il.Ldarg(args[0]), action); }
protected abstract void DoBuild(EmitSyntax emit, Pipe<EmitSyntax> ldvalue, SwitchGeneratorAction action);
public void Build(EmitSyntax emit, Pipe<EmitSyntax> ldvalue, SwitchGeneratorAction action) { this.END = emit.Labels.Generate(); DoBuild(emit, ldvalue, action); }
public void Build(EmitSyntax emit, Ref<Args>[] args, SwitchGeneratorAction action) { Build(emit, il => il.Ldarg(args[0]), action); }