public void StoreElement() { var value = _evaluator.Pop(); var index = _evaluator.Pop(); var array = (LocalVariable)_evaluator.Pop(); var setArrayElement = new SetArrayElement { Instance = array, Index = index, Right = value }; AddOperation(setArrayElement); }
public void SetArrayElementValue() { var right = _evaluator.Pop(); var index = _evaluator.Pop(); var instance = (LocalVariable)_evaluator.Pop(); var setArrayElement = new SetArrayElement { Instance = instance, Index = index, Right = right }; AddOperation(setArrayElement); }
/// <summary> /// Lowers set element values. /// </summary> private static void Lower( RewriterContext context, TypeLowering <ArrayType> _, SetArrayElement value) { var linearAddress = GetLinearAddress( context, value.ObjectValue, value.Index, out var ptr); var builder = context.Builder; var address = builder.CreateLoadElementAddress( value.Location, ptr, linearAddress); var newStore = builder.CreateStore( value.Location, address, value.Value); context.ReplaceAndRemove(value, newStore); }
/// <summary cref="IValueVisitor.Visit(SetArrayElement)"/> public void Visit(SetArrayElement value) => throw new InvalidCodeGenerationException();