예제 #1
0
        public void Add(IILEmit ilEmitter)
        {
            if (ilEmitter is ILBarrier)
            {
                //Those barriers are used to separate the groups of CIL
                //opcodes emitted by each ARM instruction.
                //We can only consider the new outputs for doing input elimination
                //after all the CIL opcodes used by the instruction being emitted.
                IntAwOutputs = IntOutputs;
                VecAwOutputs = VecOutputs;
            }
            else if (ilEmitter is IlOpCodeLoad ld && ILEmitter.IsRegIndex(ld.Index))
            {
                switch (ld.IoType)
                {
                case IoType.Flag:   IntInputs |= ((1L << ld.Index) << 32) & ~IntAwOutputs; break;

                case IoType.Int:    IntInputs |= (1L << ld.Index) & ~IntAwOutputs; break;

                case IoType.Vector: VecInputs |= (1L << ld.Index) & ~VecAwOutputs; break;
                }
            }
예제 #2
0
        public ILEmitterCtx(
            TranslatorCache cache,
            Block[]         graph,
            Block root,
            string subName)
        {
            _cache = cache ?? throw new ArgumentNullException(nameof(cache));
            _graph = graph ?? throw new ArgumentNullException(nameof(graph));
            _root  = root ?? throw new ArgumentNullException(nameof(root));

            _labels = new Dictionary <long, ILLabel>();

            _emitter = new ILEmitter(graph, root, subName);

            _ilBlock = _emitter.GetIlBlock(0);

            _opcIndex = -1;

            if (graph.Length == 0 || !AdvanceOpCode())
            {
                throw new ArgumentException(nameof(graph));
            }
        }
예제 #3
0
        public void Emit(ILEmitter context)
        {
            switch (IoType)
            {
            case IoType.Arg: context.Generator.EmitLdarg(Index); break;

            case IoType.Fields:
            {
                long intInputs = context.LocalAlloc.GetIntInputs(context.GetIlBlock(Index));
                long vecInputs = context.LocalAlloc.GetVecInputs(context.GetIlBlock(Index));

                LoadLocals(context, intInputs, RegisterType.Int);
                LoadLocals(context, vecInputs, RegisterType.Vector);

                break;
            }

            case IoType.Flag:   EmitLdloc(context, Index, RegisterType.Flag);   break;

            case IoType.Int:    EmitLdloc(context, Index, RegisterType.Int);    break;

            case IoType.Vector: EmitLdloc(context, Index, RegisterType.Vector); break;
            }
        }
예제 #4
0
 public void Emit(ILEmitter context)
 {
     context.Generator.Emit(_ilOp);
 }
예제 #5
0
 public void Emit(ILEmitter context)
 {
     context.Generator.Emit(OpCodes.Call, _mthdInfo);
 }
예제 #6
0
 public void Emit(ILEmitter context)
 {
     context.Generator.Emit(_ilOp, _label.GetLabel(context));
 }
예제 #7
0
 public void Emit(ILEmitter context)
 {
     context.Generator.MarkLabel(GetLabel(context));
 }