private void EmitLdfld(AILEmitter Context, int Index) { long IntInputs = Context.LocalAlloc.GetIntInputs(Context.GetILBlock(Index)); long VecInputs = Context.LocalAlloc.GetVecInputs(Context.GetILBlock(Index)); LoadLocals(Context, IntInputs, ARegisterType.Int); LoadLocals(Context, VecInputs, ARegisterType.Vector); }
private void EmitStfld(AILEmitter Context, int Index) { long IntOutputs = Context.LocalAlloc.GetIntOutputs(Context.GetILBlock(Index)); long VecOutputs = Context.LocalAlloc.GetVecOutputs(Context.GetILBlock(Index)); StoreLocals(Context, IntOutputs, ARegisterType.Int); StoreLocals(Context, VecOutputs, ARegisterType.Vector); }
public void Emit(AILEmitter Context) { switch (IoType) { case AIoType.Arg: Context.Generator.EmitLdarg(Index); break; case AIoType.Fields: { long IntInputs = Context.LocalAlloc.GetIntInputs(Context.GetILBlock(Index)); long VecInputs = Context.LocalAlloc.GetVecInputs(Context.GetILBlock(Index)); LoadLocals(Context, IntInputs, ARegisterType.Int); LoadLocals(Context, VecInputs, ARegisterType.Vector); break; } case AIoType.Flag: EmitLdloc(Context, Index, ARegisterType.Flag); break; case AIoType.Int: EmitLdloc(Context, Index, ARegisterType.Int); break; case AIoType.Vector: EmitLdloc(Context, Index, ARegisterType.Vector); break; } }
public bool AdvanceOpCode() { while (++OpcIndex >= (CurrBlock?.OpCodes.Count ?? 0)) { if (BlkIndex + 1 >= Graph.Length) { return(false); } BlkIndex++; OpcIndex = -1; ILBlock = Emitter.GetILBlock(BlkIndex); } return(true); }
public bool AdvanceOpCode() { if (OpcIndex + 1 == CurrBlock.OpCodes.Count && BlkIndex + 1 == Graph.Length) { return(false); } while (++OpcIndex >= (CurrBlock?.OpCodes.Count ?? 0)) { BlkIndex++; OpcIndex = -1; OptOpLastFlagSet = null; OptOpLastCompare = null; ILBlock = Emitter.GetILBlock(BlkIndex); } return(true); }
public AILEmitterCtx(ATranslator Translator, ABlock[] Graph, ABlock Root) { this.Translator = Translator; this.Graph = Graph; this.Root = Root; string SubName = $"Sub{Root.Position:X16}"; Labels = new Dictionary <long, AILLabel>(); Emitter = new AILEmitter(Graph, Root, SubName); ILBlock = Emitter.GetILBlock(0); OpcIndex = -1; if (!AdvanceOpCode()) { throw new ArgumentException(nameof(Graph)); } }
public AILEmitterCtx( ATranslator Translator, ABlock[] Graph, ABlock Root, string SubName) { if (Translator == null) { throw new ArgumentNullException(nameof(Translator)); } if (Graph == null) { throw new ArgumentNullException(nameof(Graph)); } if (Root == null) { throw new ArgumentNullException(nameof(Root)); } this.Translator = Translator; this.Graph = Graph; this.Root = Root; Callees = new HashSet <long>(); Labels = new Dictionary <long, AILLabel>(); Emitter = new AILEmitter(Graph, Root, SubName); ILBlock = Emitter.GetILBlock(0); OpcIndex = -1; if (Graph.Length == 0 || !AdvanceOpCode()) { throw new ArgumentException(nameof(Graph)); } }
public AILEmitterCtx( ATranslatorCache Cache, ABlock[] Graph, ABlock Root, string SubName) { this.Cache = Cache ?? throw new ArgumentNullException(nameof(Cache)); this.Graph = Graph ?? throw new ArgumentNullException(nameof(Graph)); this.Root = Root ?? throw new ArgumentNullException(nameof(Root)); Labels = new Dictionary <long, AILLabel>(); Emitter = new AILEmitter(Graph, Root, SubName); ILBlock = Emitter.GetILBlock(0); OpcIndex = -1; if (Graph.Length == 0 || !AdvanceOpCode()) { throw new ArgumentException(nameof(Graph)); } }