]> git.mdlowis.com Git - proto/obnc.git/commitdiff
nested array accesses appear to be working now. next up is records
authorMichael D. Lowis <mike@mdlowis.com>
Thu, 22 Sep 2022 01:07:02 +0000 (21:07 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Thu, 22 Sep 2022 01:07:02 +0000 (21:07 -0400)
cerise/backend/ssa/codegen.c
cerise/src/ssa.c
cerise/tests/Module.m

index 150da9ec6c6d67f4687a8892d79e05d4b86662ce..72aa317df543fb28d8e0cc522d12ba6deced0c13 100644 (file)
@@ -74,7 +74,6 @@ void emit_type(Type* type)
             printf("[%d x ", type->size);
             emit_type(type->base);
             printf("]");
-
             break;
 
         case FORM_RECORD:
index b9cbec464d55852e694b79d4c093d9bb0662a08b..e9521dee607f6dc933792db825e335f29bfe1f36 100644 (file)
@@ -211,7 +211,10 @@ SsaNode* ssa_fieldref(Parser* p, SsaNode* record, char* fname)
 
 SsaNode* ssa_index(Parser* p, SsaNode* array, SsaNode* index)
 {
-//    array = load(p, array);
+    if (array->mode == MODE_MEMORY && array->code == '[')
+    {
+        array = load(p, array);
+    }
     index = load(p, index);
     SsaNode* node = ssa_node('[', MODE_MEMORY);
     node->type = array->type->base;
index 322000ba122a4fd21300f9ddc039936f0bc18e86..b837bd4d829abb9ec4f09eba1e75032ad569a44c 100644 (file)
@@ -6,6 +6,10 @@ var
   vReal : Real
   vIntArray : array 42 of Int
   vIntArray2 : array 5 of array 5 of Int
+#  vRec : record
+#    a : Int
+#    b : array 5 of Int
+#  end
 
 procedure TestReturnVoid()
 begin