diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-10-06 13:22:46 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-10-06 13:22:46 -0400 |
commit | 1f7acbd88fe739798cc1fb83870690e88b5d04e9 (patch) | |
tree | 4c35a31510d9e852f7b5bb0266fc7bfc57b010d8 /lisc | |
parent | ce72ad0ecdb43f6572c1febe8993d817f572f269 (diff) | |
download | roux-1f7acbd88fe739798cc1fb83870690e88b5d04e9.tar.gz |
specialize vdup into idup
Diffstat (limited to 'lisc')
-rw-r--r-- | lisc/isel.c | 4 | ||||
-rw-r--r-- | lisc/lisc.h | 2 | ||||
-rw-r--r-- | lisc/parse.c | 2 | ||||
-rw-r--r-- | lisc/rega.c | 2 | ||||
-rw-r--r-- | lisc/spill.c | 2 | ||||
-rw-r--r-- | lisc/util.c | 6 |
6 files changed, 9 insertions, 9 deletions
diff --git a/lisc/isel.c b/lisc/isel.c index 17fc01e..48f9dfc 100644 --- a/lisc/isel.c +++ b/lisc/isel.c @@ -662,7 +662,7 @@ isel(Fn *fn) emit(i->op, i->wide, i->to, i->arg[0], i->arg[1]); } b->nins = &insb[NIns] - curi; - vdup(&b->ins, curi, b->nins * sizeof(Ins)); + idup(&b->ins, curi, b->nins); } if (debug['C']) { @@ -705,7 +705,7 @@ isel(Fn *fn) sel(*--i, fn); } b->nins = &insb[NIns] - curi; - vdup(&b->ins, curi, b->nins * sizeof(Ins)); + idup(&b->ins, curi, b->nins); } if (debug['I']) { diff --git a/lisc/lisc.h b/lisc/lisc.h index 7afce94..511498d 100644 --- a/lisc/lisc.h +++ b/lisc/lisc.h @@ -277,7 +277,7 @@ Blk *balloc(); void emit(int, int, Ref, Ref, Ref); void emiti(Ins); int bcnt(Bits *); -void vdup(void *, void *, size_t); +void idup(Ins **, Ins *, ulong); Ins *icpy(Ins *, Ins *, ulong); /* parse.c */ diff --git a/lisc/parse.c b/lisc/parse.c index a32df4b..fd135c1 100644 --- a/lisc/parse.c +++ b/lisc/parse.c @@ -423,7 +423,7 @@ static void closeblk() { curb->nins = curi - insb; - vdup(&curb->ins, insb, curb->nins * sizeof(Ins)); + idup(&curb->ins, insb, curb->nins); blink = &curb->link; curi = insb; } diff --git a/lisc/rega.c b/lisc/rega.c index cca3847..630298c 100644 --- a/lisc/rega.c +++ b/lisc/rega.c @@ -430,7 +430,7 @@ rega(Fn *fn) fn->nblk++; sprintf(b1->name, "%s_%s", b->name, s->name); b1->nins = curi - insb; - vdup(&b1->ins, insb, b1->nins * sizeof(Ins)); + idup(&b1->ins, insb, b1->nins); b1->jmp.type = JJmp; b1->s1 = s; **ps = b1; diff --git a/lisc/spill.c b/lisc/spill.c index 1b11031..aae214d 100644 --- a/lisc/spill.c +++ b/lisc/spill.c @@ -402,7 +402,7 @@ spill(Fn *fn) } b->in = v; b->nins = &insb[NIns] - curi; - vdup(&b->ins, curi, b->nins * sizeof(Ins)); + idup(&b->ins, curi, b->nins); } /* align the locals to a 16 byte boundary */ diff --git a/lisc/util.c b/lisc/util.c index 723a8db..c1bfa86 100644 --- a/lisc/util.c +++ b/lisc/util.c @@ -67,10 +67,10 @@ bcnt(Bits *b) } void -vdup(void *pd, void *s, size_t sz) +idup(Ins **pd, Ins *s, ulong n) { - free(*(void **)pd); - memcpy(*(void **)pd = alloc(sz), s, sz); + free(*pd); + memcpy(*pd = alloc(n * sizeof(Ins)), s, n * sizeof(Ins)); } Ins * |