public void VisitAccess(AccessNode node) { // Don't insert unreachable code if (!_builder.InsertBlock.IsValid) { return; } node.Lhs.AcceptExpressionVisitor(this); if (!_visitedValue.IsValid) { throw new InvalidOperationException("access did not produce a usable base pointer"); } Value lhs = _visitedValue; StructType structType = (StructType)_genContext.SemanticModule.ExpressionResultTypes[node.Lhs]; StructLayout layout = _genContext.StructLayoutManager.GetLayout(structType); if (!layout.MemberOffsets.TryGetValue(node.Rhs, out int index)) { throw new InvalidOperationException(); } _visitedValue = _builder.BuildExtractValue(lhs, (uint)index); }
public void VisitAccess(AccessNode node) { IAddressableNode addressableNode = (IAddressableNode)node.Lhs; addressableNode.AcceptAddressableVisitor(this); StructType structType = (StructType)_genContext.SemanticModule.ExpressionResultTypes[node.Lhs]; StructLayout layout = _genContext.StructLayoutManager.GetLayout(structType); if (!layout.MemberOffsets.TryGetValue(node.Rhs, out int index)) { throw new InvalidOperationException(); } AssignmentWritePointer = _builder.BuildStructGEP(AssignmentWritePointer, (uint)index); }