Beispiel #1
0
        /// <summary>
        /// Lower array to view casts to direct references to the underyling view.
        /// </summary>
        private static void Lower(
            RewriterContext context,
            TypeLowering <ArrayType> typeLowering,
            ArrayToViewCast value)
        {
            var builder  = context.Builder;
            var location = value.Location;

            // Get the view from the array implementation structure
            Value array = value.Value;
            var   view  = GetViewFromArray(builder, location, array);

            // Cast this view into the generic address space to match all invariants
            view = builder.CreateAddressSpaceCast(
                location,
                view,
                MemoryAddressSpace.Generic);

            // Replace the current cast with the actual view pointing to the elements
            context.ReplaceAndRemove(value, view);
        }
 /// <summary cref="IValueVisitor.Visit(ArrayToViewCast)"/>
 public void Visit(ArrayToViewCast value) =>
 throw new InvalidCodeGenerationException();