Esempio n. 1
0
        /// <summary>
        /// Lowers phi values.
        /// </summary>
        private static void Lower(
            SSARewriterContext <FieldRef> context,
            LoweringData data,
            PhiValue phi)
        {
            foreach (var(fieldType, fieldAccess) in phi.Type as StructureType)
            {
                // Build a new phi which might become dead in the future
                var phiBuilder = context.Builder.CreatePhi(
                    phi.Location,
                    fieldType);

                // Register the lowered phi
                data.AddPhi(new LoweredPhi(
                                phi,
                                fieldAccess,
                                phiBuilder));

                // Bind the new phi value
                context.SetValue(
                    context.Block,
                    new FieldRef(phi, fieldAccess),
                    phiBuilder.PhiValue);
            }
            context.Remove(phi);
        }