private static LocalVariable GetVRegMapped(List <LocalVariable> virtRegs, KeyValuePair <int, int> id)
        {
            var localVariable = virtRegs.First(item => id.Key == item.Id);
            var vRegMapped    = new LocalVariable
            {
                Kind      = VariableKind.Vreg,
                Id        = id.Value,
                FixedType = localVariable.FixedType
            };

            vRegMapped.AutoName();
            return(vRegMapped);
        }
Esempio n. 2
0
        public LocalVariable SetNewVReg()
        {
            _vRegId++;
            var newLocal = new LocalVariable
            {
                Kind = VariableKind.Vreg,
                Id   = _vRegId
            };

            newLocal.AutoName();
            Push(newLocal);
            return(newLocal);
        }
        public static LocalVariable CreateCacheVariable(this CilMethodInterpreter interpreter,
                                                        TypeDescription computedType)
        {
            var midRepresentation = interpreter.MidRepresentation;
            var max           = midRepresentation.Vars.VirtRegs.Max(vreg => vreg.Id) + 1;
            var cacheVariable = new LocalVariable
            {
                FixedType = computedType,
                Id        = max,
                Kind      = VariableKind.Vreg
            };

            cacheVariable.AutoName();
            midRepresentation.Vars.VirtRegs.Add(cacheVariable);
            return(cacheVariable);
        }