ref: 3c4b4fecaf3841b492c75b6dacbc7b68c6aa1703
parent: f5aa5edb3073358748c0b4a27eb47c956d122e4b
author: Ori Bernstein <[email protected]>
date: Fri Jan 18 18:50:28 EST 2013
Use memmove everywhere.
--- a/6/isel.c
+++ b/6/isel.c
@@ -381,7 +381,7 @@
* one at a time, we evaluate the args in reverse order.
* Not good.
*
- * We skip the first operand, since it's the function itself */
+ * Skip the first operand, since it's the function itself */
for (i = 1; i < n->expr.nargs; i++) {
argsz = align(argsz, min(size(n->expr.args[i]), Ptrsz));
argsz += size(n->expr.args[i]);
--- a/6/ra.c
+++ b/6/ra.c
@@ -203,6 +203,7 @@
return j;
}
+/* The uses and defs for an entire BB. */
static void udcalc(Asmbb *bb)
{
/* up to 2 registers per memloc, so
--- a/6/simp.c
+++ b/6/simp.c
@@ -1140,7 +1140,7 @@
r = assign(s, args[0], args[1]);
break;
case Ocall:
- if (exprtype(n)->type != Tyvoid && size(n) > Ptrsz) {
+ if (exprtype(n)->type != Tyvoid && stacktype(exprtype(n))) {
r = temp(s, n);
linsert(&n->expr.args, &n->expr.nargs, 1, addr(r, exprtype(n)));
for (i = 0; i < n->expr.nargs; i++)
--- a/parse/util.c
+++ b/parse/util.c
@@ -130,13 +130,12 @@
void linsert(void *p, size_t *len, size_t idx, void *v)
{
void ***pl, **l;
- size_t i;
pl = p;
*pl = xrealloc(*pl, (*len + 1)*sizeof(void*));
l = *pl;
- for (i = idx; i < *len; i++)
- l[i + 1] = l[i];
+
+ memmove(&l[idx + 1], &l[idx], (*len - idx)*sizeof(void*));
l[idx] = v;
(*len)++;
}