vdats now record the odat that creates them
[henge/webcc.git] / src / apc / ir.c
index bf62227..de021cc 100644 (file)
@@ -98,7 +98,7 @@ push_cdat
   curr_cdatp->idx = num_cdats;
 
   /* Set the cdat as a subclass of the previous cdat */
-
+  (*cdat_stackp)->class_list[(*cdat_stackp)->num_classes] = curr_cdatp;
   /* Push the cdat onto the cdat_stack */
   *++cdat_stackp = curr_cdatp;
 
@@ -197,11 +197,12 @@ insert_set_svlink
   curr_cdatp = curr_cdat();
   curr_linkp = alloc_link();
 
-  /* Insert vlink into link_stack so that it gets processed at
+  /* Insert svlink into link_stack so that it gets processed at
      output time */
   curr_linkp->type = 3;
   curr_linkp->cdat_idx = curr_cdatp->idx;
   curr_linkp->set_idx = curr_cdatp->num_sets;
+  curr_linkp->ele_idx = -1;
   curr_linkp->link_t.svlink.ref_id = ref_id;
 
 }
@@ -219,13 +220,16 @@ insert_set
   struct set* curr_setp;
   struct ref* prev_refp;
   struct ref* curr_refp;
+  struct vdat* curr_vdatp;
 
   curr_odatp = curr_set_odatp; //allocated at insert_set_label, preserved in global space
   curr_cdatp = curr_cdat();
   curr_setp = curr_set();
   prev_refp = prev_ref();
   curr_refp = alloc_ref();
+  curr_vdatp = curr_vdat();
 
+  curr_vdatp->creator = curr_set_odatp;
 
   curr_setp->cdat_idx = curr_cdatp->idx; //does a set need its class idx?
   memmove(curr_setp->name, curr_odatp->name, 32);
@@ -280,6 +284,8 @@ insert_ele_label
   curr_elep->ref_id = ref_id;
 }
 
+/* We don't make an odat here, at output time we will resolve
+   the ref_id to the corresponding odat. */
 void
 insert_ele_olink
 ( uint64_t ref_id
@@ -295,8 +301,8 @@ insert_ele_olink
   curr_linkp = alloc_link();
 
   curr_elep->cdat_idx = curr_cdatp->idx;
-  curr_elep->ref_id = ref_id; /* Will be resolved to offset
-                                                   when link is processed */
+  curr_elep->ref_id = ref_id;
+
   curr_linkp->type = 1;
   curr_linkp->link_t.olink.ref_id = ref_id;
   curr_linkp->cdat_idx = curr_cdatp->idx;
@@ -359,18 +365,22 @@ insert_ele()
   uint64_t ref_id;
   struct cdat* curr_cdatp;
   struct odat* curr_odatp;
+  struct vdat* curr_vdatp;
   struct set* curr_setp;
   struct ele* curr_elep;
   struct ref* curr_refp;
   struct ref* prev_refp;
 
+
   curr_cdatp = curr_cdat();
   curr_odatp = curr_odat(); //malloced @ insert_ele_label
+  curr_vdatp = curr_vdat();
   curr_setp = curr_set();
   curr_elep = curr_ele();
   curr_refp = alloc_ref();
   prev_refp = prev_ref();
 
+  curr_vdatp->creator = curr_odatp;
   /* Populate ele in cdat */
   curr_elep->cdat_idx = curr_cdatp->idx;
   curr_setp->num_ele++;