+ link = XNEW (struct code_ptr);
+ link->insn_code = insn_code_number;
+
+ /* See if we find something that already had this extraction method. */
+
+ op_count = VEC_length (locstr, acc.oplocs);
+ dup_count = VEC_length (locstr, acc.duplocs);
+ gcc_assert (dup_count == VEC_length (int, acc.dupnums));
+
+ for (p = extractions; p; p = p->next)
+ {
+ if (p->op_count != op_count || p->dup_count != dup_count)
+ continue;
+
+ for (j = 0; j < op_count; j++)
+ {
+ char *a = p->oplocs[j];
+ char *b = VEC_index (locstr, acc.oplocs, j);
+ if (a != b && (!a || !b || strcmp (a, b)))
+ break;
+ }
+
+ if (j != op_count)
+ continue;
+
+ for (j = 0; j < dup_count; j++)
+ if (p->dupnums[j] != VEC_index (int, acc.dupnums, j)
+ || strcmp (p->duplocs[j], VEC_index (locstr, acc.duplocs, j)))
+ break;
+
+ if (j != dup_count)
+ continue;
+
+ /* This extraction is the same as ours. Just link us in. */
+ link->next = p->insns;
+ p->insns = link;
+ goto done;
+ }
+
+ /* Otherwise, make a new extraction method. We stash the arrays
+ after the extraction structure in memory. */
+
+ p = XNEWVAR (struct extraction, sizeof (struct extraction)
+ + op_count*sizeof (char *)
+ + dup_count*sizeof (char *)
+ + dup_count*sizeof (int));
+ p->op_count = op_count;
+ p->dup_count = dup_count;
+ p->next = extractions;
+ extractions = p;
+ p->insns = link;
+ link->next = 0;
+
+ p->oplocs = (char **)((char *)p + sizeof (struct extraction));
+ p->duplocs = p->oplocs + op_count;
+ p->dupnums = (int *)(p->duplocs + dup_count);
+
+ memcpy(p->oplocs, VEC_address(locstr,acc.oplocs), op_count*sizeof(locstr));
+ memcpy(p->duplocs, VEC_address(locstr,acc.duplocs), dup_count*sizeof(locstr));
+ memcpy(p->dupnums, VEC_address(int, acc.dupnums), dup_count*sizeof(int));
+
+ done:
+ VEC_free (locstr,heap, acc.oplocs);
+ VEC_free (locstr,heap, acc.duplocs);
+ VEC_free (int,heap, acc.dupnums);
+ VEC_free (char,heap, acc.pathstr);