+ assert(dp->magic == ARR_F_MAGIC);
+ ARR_VRFY(elts);
+
+ /* @@@ lots of resizes for small nelts */
+ n = MAX(1, dp->allocated);
+ while (nelts > n) n <<= 1;
+ while (3*nelts < n) n >>= 1;
+ assert(n >= nelts);
+
+ if (n != dp->allocated) {
+ dp = (ir_arr_descr*) xrealloc(dp, ARR_ELTS_OFFS+eltsize*n);
+ dp->allocated = n;
+ }
+ dp->nelts = nelts;
+
+ return dp->elts;
+}
+
+#ifdef DEBUG_libfirm
+/* forward declarations to avoid warnings */
+size_t array_len(const void *arr);
+ir_arr_descr *array_descr(const void *arr);
+
+/**
+ * This function returns the length of a flexible array.
+ * Do NOT use is in code, use ARR_LEN() macro!
+ * This function is intended to be called from a debugger.
+ */
+size_t array_len(const void *arr)