示例#1
0
        private void HandleStoreVar(XILSInstr i)
        {
            int      readPoint;
            Variable local = i.StaticOperand as Variable;

            if (DflowAnalyzer.IsReadAfterWrite(i.Index, out readPoint))
            {
                var preds = RemapPreds(i.Preds);

                // keep expression on the stack, but bury it at the very bottom.
                for (int j = 1; j < _resultStack.Count; j++)
                {
                    var resultTypes = TypeStack.Reverse().Skip(1).Concat(TypeStack.Skip(_resultStack.Count - 1)).ToArray();
                    Emit(DefaultInstructionSet.Instance.Dig(_resultStack.Count - 1).CreateStk(
                             preds,
                             TypeStack.Reverse().ToArray(),
                             resultTypes));
                    preds = new InstructionDependency[0];
                }
                _read2write[readPoint] = _resultStack[0];
            }
            else if (local == null)
            {
                ProcessDefault(i);
            }
            else if (DflowAnalyzer.EliminableLocals.Contains(local.LocalIndex))
            {
                Emit(DefaultInstructionSet.Instance.Pop().CreateStk(1, local.Type));
            }
            else
            {
                ProcessDefault(i);
            }
        }