4848import vadl .types .DataType ;
4949import vadl .types .MicroArchitectureType ;
5050import vadl .types .SIntType ;
51+ import vadl .types .StatusType ;
5152import vadl .types .Type ;
5253import vadl .types .UIntType ;
5354import vadl .utils .BigIntUtils ;
108109import vadl .viam .graph .dependency .SignExtendNode ;
109110import vadl .viam .graph .dependency .SliceNode ;
110111import vadl .viam .graph .dependency .StageEffectNode ;
112+ import vadl .viam .graph .dependency .StructGetFieldNode ;
111113import vadl .viam .graph .dependency .TensorNode ;
112114import vadl .viam .graph .dependency .TruncateNode ;
113- import vadl .viam .graph .dependency .TupleGetFieldNode ;
114115import vadl .viam .graph .dependency .WriteArtificialResNode ;
115116import vadl .viam .graph .dependency .WriteMemNode ;
116117import vadl .viam .graph .dependency .WriteRegTensorNode ;
@@ -781,7 +782,6 @@ private SubgraphContext fetch(Statement stmt) {
781782 }
782783
783784
784-
785785 /// This utility function can be used to fill in missing indexes of a tensor.
786786 ///
787787 /// It basically returns a permutation of all possible indices for the dimensions provided.
@@ -1067,19 +1067,18 @@ private ExpressionNode visitIdentifyable(Expr expr) {
10671067 // Let statement and expression
10681068 if (computedTarget instanceof LetStatement letStatement ) {
10691069 var expression = fetch (letStatement .valueExpr );
1070- var index = letStatement .getIndexOf (innerName );
10711070 if (letStatement .identifiers .size () > 1 ) {
1072- expression = new TupleGetFieldNode ( index , expression ,
1071+ expression = new StructGetFieldNode ( letStatement . mapName ( innerName ) , expression ,
10731072 getViamType (letStatement .getTypeOf (innerName )));
10741073 }
10751074 return new LetNode (new LetNode .Name (innerName , letStatement .location ()), expression );
10761075 }
10771076 if (computedTarget instanceof LetExpr letExpr ) {
10781077 var expression = fetch (letExpr .valueExpr );
1079- var index = letExpr .getIndexOf (innerName );
10801078 if (letExpr .identifiers .size () > 1 ) {
10811079 expression =
1082- new TupleGetFieldNode (index , expression , getViamType (letExpr .getTypeOf (innerName )));
1080+ new StructGetFieldNode (letExpr .mapName (innerName ), expression ,
1081+ getViamType (letExpr .getTypeOf (innerName )));
10831082 }
10841083 return new LetNode (new LetNode .Name (innerName , letExpr .location ()), expression );
10851084 }
@@ -1173,7 +1172,7 @@ public ExpressionNode visit(GroupedExpr expr) {
11731172
11741173 var type = expr .type ().equals (Type .string ()) ? expr .type () :
11751174 Type .bits (expr .expressions .get (0 ).type ().asDataType ()
1176- .bitWidth () + expr .expressions .get (1 ).type ().asDataType ().bitWidth ());
1175+ .bitWidth () + expr .expressions .get (1 ).type ().asDataType ().bitWidth ());
11771176
11781177 var call = new BuiltInCall (concatBuiltin ,
11791178 new NodeList <>(expr .expressions .get (0 ).accept (this ),
@@ -1183,7 +1182,7 @@ public ExpressionNode visit(GroupedExpr expr) {
11831182 for (int i = 2 ; i < expr .expressions .size (); i ++) {
11841183 type = expr .type ().equals (Type .string ()) ? expr .type () :
11851184 Type .bits (type .asDataType ().bitWidth ()
1186- + expr .expressions .get (i ).type ().asDataType ().bitWidth ());
1185+ + expr .expressions .get (i ).type ().asDataType ().bitWidth ());
11871186 call = new BuiltInCall (concatBuiltin ,
11881187 new NodeList <>(call ,
11891188 expr .expressions .get (i ).accept (this )),
@@ -1284,9 +1283,8 @@ private ExpressionNode visitSubCall(CallIndexExpr expr, ExpressionNode exprBefor
12841283 (DataType ) getViamType (requireNonNull (subCall .formatFieldType )));
12851284 resultExpr =
12861285 visitSliceIndexCall (slice , subCall .formatFieldType , subCall .argsIndices );
1287- } else if (subCall .computedStatusIndex != null ) {
1288- var indexing =
1289- new TupleGetFieldNode (subCall .computedStatusIndex , resultExpr , Type .bool ());
1286+ } else if (exprBeforeSubcall .type () instanceof StatusType ) {
1287+ var indexing = new StructGetFieldNode (subCall .identifier ().name , resultExpr , Type .bool ());
12901288 resultExpr = visitSliceIndexCall (indexing , Type .bool (), subCall .argsIndices );
12911289 } else if (exprBeforeSubcall .type () == MicroArchitectureType .instruction ()) {
12921290 // There is weired way to call functions on instructions
@@ -1413,7 +1411,7 @@ public ExpressionNode visitStageCall(CallIndexExpr expr, StageDefinition stageDe
14131411 .filter (o -> o .identifier ().name .equals (subcall .identifier ().name ))
14141412 .findFirst ()
14151413 .get ()
1416- ).get ();
1414+ ).get ();
14171415 return new ReadStageOutputNode (output );
14181416 }
14191417
@@ -1811,10 +1809,10 @@ public SubgraphContext visit(AssignmentStatement statement) {
18111809 /**
18121810 * Method that prepares the value so that it can be used for a dynamic write of a resource.
18131811 *
1814- * @param value value that is being written (right side of assignment)
1815- * @param entireRead resource value before value is written
1816- * @param index the dynamic expression of the index.
1817- * @return that incorporates the written value into the resource.
1812+ * @param value value that is being written (right side of assignment)
1813+ * @param entireRead resource value before value is written
1814+ * @param index the dynamic expression of the index.
1815+ * @return that incorporates the written value into the resource.
18181816 */
18191817 private ExpressionNode dynamicIndexWriteValue (ExpressionNode value , ReadResourceNode entireRead ,
18201818 @ Nullable ExpressionNode index ) {
0 commit comments