public void LoadReferenceInArrayTyped(ClosureEntities closureEntities) { var index = _evaluator.Pop(); var instance = (LocalVariable)_evaluator.Pop(); var result = SetNewVReg(); var arrayVariable = GetArrayElement.Create(result, instance, index, closureEntities); AddOperation(arrayVariable); }
public void LoadReferenceInArray() { var secondVar = _evaluator.Pop(); var firstVar = (LocalVariable)_evaluator.Pop(); var result = SetNewVReg(); var arrayVariable = new GetArrayElement { AssignedTo = result, Instance = firstVar, Index = secondVar, }; result.FixedType = new TypeDescription(arrayVariable.GetElementType()); AddOperation(arrayVariable); }
/// <summary> /// Lowers get element values. /// </summary> private static void Lower( RewriterContext context, TypeLowering <ArrayType> _, GetArrayElement 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 newLoad = builder.CreateLoad( value.Location, address); context.ReplaceAndRemove(value, newLoad); }
/// <summary cref="IValueVisitor.Visit(GetArrayElement)"/> public void Visit(GetArrayElement value) => throw new InvalidCodeGenerationException();