summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-07-09 10:18:26 -0700
committerOri Bernstein <ori@eigenstate.org>2017-07-09 10:18:26 -0700
commit95f4d0b36eb2d25889eed6ab48fb025d5b346b67 (patch)
treed5e206f2a9c6713c193911370958826928c91294 /mi
parent25d91f98a97df36e1da381b273219ceedf256a4d (diff)
downloadmc-95f4d0b36eb2d25889eed6ab48fb025d5b346b67.tar.gz
Style(9)-ify.
Diffstat (limited to 'mi')
-rw-r--r--mi/cfg.c42
-rw-r--r--mi/dfcheck.c15
-rw-r--r--mi/flatten.c119
-rw-r--r--mi/match.c102
-rw-r--r--mi/reaching.c20
5 files changed, 195 insertions, 103 deletions
diff --git a/mi/cfg.c b/mi/cfg.c
index 5405cd4..e647733 100644
--- a/mi/cfg.c
+++ b/mi/cfg.c
@@ -15,7 +15,8 @@
#include "mi.h"
-static Bb *mkbb(Cfg *cfg)
+static Bb *
+mkbb(Cfg *cfg)
{
Bb *bb;
@@ -28,7 +29,8 @@ static Bb *mkbb(Cfg *cfg)
}
-static void strlabel(Cfg *cfg, char *lbl, Bb *bb)
+static void
+strlabel(Cfg *cfg, char *lbl, Bb *bb)
{
if (htget(cfg->lblmap, lbl) != bb) {
htput(cfg->lblmap, lbl, bb);
@@ -36,12 +38,14 @@ static void strlabel(Cfg *cfg, char *lbl, Bb *bb)
}
}
-static void label(Cfg *cfg, Node *lbl, Bb *bb)
+static void
+label(Cfg *cfg, Node *lbl, Bb *bb)
{
strlabel(cfg, lblstr(lbl), bb);
}
-static int isnonretcall(Node *fn)
+static int
+isnonretcall(Node *fn)
{
Node *dcl;
@@ -51,7 +55,8 @@ static int isnonretcall(Node *fn)
return dcl->decl.isnoret;
}
-static int addnode(Cfg *cfg, Bb *bb, Node *n)
+static int
+addnode(Cfg *cfg, Bb *bb, Node *n)
{
switch (exprop(n)) {
case Ojmp:
@@ -74,7 +79,8 @@ static int addnode(Cfg *cfg, Bb *bb, Node *n)
return 0;
}
-static int islabel(Node *n)
+static int
+islabel(Node *n)
{
Node *l;
if (n->type != Nexpr)
@@ -89,7 +95,8 @@ static int islabel(Node *n)
return 1;
}
-static Bb *addlabel(Cfg *cfg, Bb *bb, Node **nl, size_t i, Srcloc loc)
+static Bb *
+addlabel(Cfg *cfg, Bb *bb, Node **nl, size_t i, Srcloc loc)
{
/* if the current block assumes fall-through, insert an explicit jump */
if (i > 0 && nl[i - 1]->type == Nexpr) {
@@ -102,7 +109,8 @@ static Bb *addlabel(Cfg *cfg, Bb *bb, Node **nl, size_t i, Srcloc loc)
return bb;
}
-void delete(Cfg *cfg, Bb *bb)
+void
+delete(Cfg *cfg, Bb *bb)
{
size_t i, j;
@@ -121,7 +129,8 @@ void delete(Cfg *cfg, Bb *bb)
cfg->bb[bb->id] = NULL;
}
-void noexit(Cfg *cfg, Bb *bb)
+void
+noexit(Cfg *cfg, Bb *bb)
{
size_t i;
for (i = 0; bsiter(bb->succ, &i); i++)
@@ -129,7 +138,8 @@ void noexit(Cfg *cfg, Bb *bb)
bsclear(bb->succ);
}
-void trimdead(Cfg *cfg, Bb *bb)
+void
+trimdead(Cfg *cfg, Bb *bb)
{
size_t i;
@@ -162,7 +172,8 @@ void trimdead(Cfg *cfg, Bb *bb)
}
}
-void trim(Cfg *cfg)
+void
+trim(Cfg *cfg)
{
Bb *bb;
size_t i;
@@ -184,7 +195,8 @@ void trim(Cfg *cfg)
}
}
-Cfg *mkcfg(Node *fn, Node **nl, size_t nn)
+Cfg *
+mkcfg(Node *fn, Node **nl, size_t nn)
{
Cfg *cfg;
Bb *pre, *post;
@@ -265,7 +277,8 @@ Cfg *mkcfg(Node *fn, Node **nl, size_t nn)
return cfg;
}
-void dumpbb(Bb *bb, FILE *fd)
+void
+dumpbb(Bb *bb, FILE *fd)
{
size_t i;
char *sep;
@@ -305,7 +318,8 @@ void dumpbb(Bb *bb, FILE *fd)
fprintf(fd, "\n");
}
-void dumpcfg(Cfg *cfg, FILE *fd)
+void
+dumpcfg(Cfg *cfg, FILE *fd)
{
size_t i;
diff --git a/mi/dfcheck.c b/mi/dfcheck.c
index 5ccdf58..b43ef9c 100644
--- a/mi/dfcheck.c
+++ b/mi/dfcheck.c
@@ -14,7 +14,8 @@
#include "parse.h"
#include "mi.h"
-static void checkundef(Node *n, Reaching *r, Bitset *reach, Bitset *kill)
+static void
+checkundef(Node *n, Reaching *r, Bitset *reach, Bitset *kill)
{
size_t i, j, did;
Node *def;
@@ -64,7 +65,8 @@ static void checkundef(Node *n, Reaching *r, Bitset *reach, Bitset *kill)
}
}
-static void checkreach(Cfg *cfg)
+static void
+checkreach(Cfg *cfg)
{
Bitset *reach, *kill;
size_t i, j, k;
@@ -97,7 +99,8 @@ static void checkreach(Cfg *cfg)
reachingfree(r);
}
-static void checkpredret(Cfg *cfg, Bb *bb)
+static void
+checkpredret(Cfg *cfg, Bb *bb)
{
Bb *pred;
Op op;
@@ -116,7 +119,8 @@ static void checkpredret(Cfg *cfg, Bb *bb)
}
}
-static void checkret(Cfg *cfg)
+static void
+checkret(Cfg *cfg)
{
Type *ft;
@@ -128,7 +132,8 @@ static void checkret(Cfg *cfg)
checkpredret(cfg, cfg->end);
}
-void check(Cfg *cfg)
+void
+check(Cfg *cfg)
{
checkret(cfg);
checkreach(cfg);
diff --git a/mi/flatten.c b/mi/flatten.c
index 0733a12..005ed06 100644
--- a/mi/flatten.c
+++ b/mi/flatten.c
@@ -18,9 +18,9 @@
/* takes a list of nodes, and reduces it (and it's subnodes) to a list
* following these constraints:
- * - All nodes are expression nodes
- * - Nodes with side effects are root nodes
- * - All nodes operate on machine-primitive types and tuples
+ * - All nodes are expression node
+ * - Nodes with side effects are root node
+ * - All nodes operate on machine-primitive types and tuple
*/
typedef struct Flattenctx Flattenctx;
struct Flattenctx {
@@ -55,14 +55,16 @@ static Node *rval(Flattenctx *s, Node *n);
static Node *lval(Flattenctx *s, Node *n);
static Node *assign(Flattenctx *s, Node *lhs, Node *rhs);
-static void append(Flattenctx *s, Node *n)
+static void
+append(Flattenctx *s, Node *n)
{
if (debugopt['F'])
dump(n, stdout);
lappend(&s->stmts, &s->nstmts, n);
}
-static void cjmp(Flattenctx *s, Node *cond, Node *iftrue, Node *iffalse)
+static void
+cjmp(Flattenctx *s, Node *cond, Node *iftrue, Node *iffalse)
{
Node *jmp;
@@ -71,7 +73,8 @@ static void cjmp(Flattenctx *s, Node *cond, Node *iftrue, Node *iffalse)
append(s, jmp);
}
-static void jmp(Flattenctx *s, Node *lbl)
+static void
+jmp(Flattenctx *s, Node *lbl)
{
Node *n;
@@ -80,7 +83,8 @@ static void jmp(Flattenctx *s, Node *lbl)
append(s, n);
}
-static Node *asn(Node *a, Node *b)
+static Node *
+asn(Node *a, Node *b)
{
Node *n;
@@ -93,7 +97,8 @@ static Node *asn(Node *a, Node *b)
return n;
}
-static int islbl(Node *n)
+static int
+islbl(Node *n)
{
Node *l;
if (exprop(n) != Olit)
@@ -102,7 +107,8 @@ static int islbl(Node *n)
return l->type == Nlit && l->lit.littype == Llbl;
}
-static Node *temp(Flattenctx *flatten, Node *e)
+static Node *
+temp(Flattenctx *flatten, Node *e)
{
Node *t, *dcl;
@@ -111,7 +117,8 @@ static Node *temp(Flattenctx *flatten, Node *e)
return t;
}
-static Node *add(Node *a, Node *b)
+static Node *
+add(Node *a, Node *b)
{
Node *n;
@@ -120,7 +127,8 @@ static Node *add(Node *a, Node *b)
return n;
}
-static Node *addk(Node *n, uvlong v)
+static Node *
+addk(Node *n, uvlong v)
{
Node *k;
@@ -129,7 +137,8 @@ static Node *addk(Node *n, uvlong v)
return add(n, k);
}
-static Node *sub(Node *a, Node *b)
+static Node *
+sub(Node *a, Node *b)
{
Node *n;
@@ -138,7 +147,8 @@ static Node *sub(Node *a, Node *b)
return n;
}
-static Node *subk(Node *n, uvlong v)
+static Node *
+subk(Node *n, uvlong v)
{
Node *k;
@@ -147,7 +157,8 @@ static Node *subk(Node *n, uvlong v)
return sub(n, k);
}
-static Node *seqlen(Flattenctx *s, Node *n, Type *ty)
+static Node *
+seqlen(Flattenctx *s, Node *n, Type *ty)
{
Node *r;
@@ -165,7 +176,8 @@ static Node *seqlen(Flattenctx *s, Node *n, Type *ty)
return r;
}
-static Node *visit(Flattenctx *s, Node *n)
+static Node *
+visit(Flattenctx *s, Node *n)
{
size_t i;
Node *r;
@@ -187,7 +199,8 @@ static Node *visit(Flattenctx *s, Node *n)
return r;
}
-static void flattencond(Flattenctx *s, Node *n, Node *ltrue, Node *lfalse)
+static void
+flattencond(Flattenctx *s, Node *n, Node *ltrue, Node *lfalse)
{
Node **args;
Node *v, *lnext;
@@ -225,7 +238,8 @@ static void flattencond(Flattenctx *s, Node *n, Node *ltrue, Node *lfalse)
* t = false
* ;;
*/
-static Node *flattenlazy(Flattenctx *s, Node *n)
+static Node *
+flattenlazy(Flattenctx *s, Node *n)
{
Node *r, *t, *u;
Node *ltrue, *lfalse, *ldone;
@@ -261,7 +275,8 @@ static Node *flattenlazy(Flattenctx *s, Node *n)
return r;
}
-static Node *destructure(Flattenctx *s, Node *lhs, Node *rhs)
+static Node *
+destructure(Flattenctx *s, Node *lhs, Node *rhs)
{
Node *lv, *rv, *idx;
Node **args;
@@ -285,13 +300,15 @@ static Node *destructure(Flattenctx *s, Node *lhs, Node *rhs)
return rhs;
}
-static Node *comparecomplex(Flattenctx *s, Node *n, Op op)
+static Node *
+comparecomplex(Flattenctx *s, Node *n, Op op)
{
fatal(n, "Complex comparisons not yet supported\n");
return NULL;
}
-static Node *compare(Flattenctx *s, Node *n, int fields)
+static Node *
+compare(Flattenctx *s, Node *n, int fields)
{
const Op cmpmap[Numops][3] = {
[Oeq] = {Oeq, Oueq, Ofeq},
@@ -334,7 +351,8 @@ static Node *compare(Flattenctx *s, Node *n, int fields)
return r;
}
-static Node *assign(Flattenctx *s, Node *lhs, Node *rhs)
+static Node *
+assign(Flattenctx *s, Node *lhs, Node *rhs)
{
Node *r, *t, *u;
@@ -350,7 +368,8 @@ static Node *assign(Flattenctx *s, Node *lhs, Node *rhs)
return r;
}
-static Node *rval(Flattenctx *s, Node *n)
+static Node *
+rval(Flattenctx *s, Node *n)
{
Node *t, *u, *v; /* temporary nodes */
Node *r; /* expression result */
@@ -456,7 +475,7 @@ static Node *rval(Flattenctx *s, Node *n)
case Lchr:
case Lbool:
case Llbl:
- case Lint:
+ case Lint:
case Lstr:
case Lflt:
case Lfunc:
@@ -521,7 +540,8 @@ static Node *rval(Flattenctx *s, Node *n)
return r;
}
-static Node *lval(Flattenctx *s, Node *n)
+static Node *
+lval(Flattenctx *s, Node *n)
{
Node *r;
@@ -548,7 +568,8 @@ static Node *lval(Flattenctx *s, Node *n)
return r;
}
-static void flattenblk(Flattenctx *fc, Node *n)
+static void
+flattenblk(Flattenctx *fc, Node *n)
{
size_t i;
@@ -558,7 +579,7 @@ static void flattenblk(Flattenctx *fc, Node *n)
}
}
-/* init; while cond; body;;
+/* init; while cond; body;;
* => init
* jmp :cond
* :body
@@ -569,7 +590,8 @@ static void flattenblk(Flattenctx *fc, Node *n)
* cjmp (cond) :body :end
* :end
*/
-static void flattenloop(Flattenctx *s, Node *n)
+static void
+flattenloop(Flattenctx *s, Node *n)
{
Node *lbody;
Node *lend;
@@ -611,7 +633,8 @@ static void flattenloop(Flattenctx *s, Node *n)
/* if foo; bar; else baz;;
* => cjmp (foo) :bar :baz */
-static void flattenif(Flattenctx *s, Node *n, Node *exit)
+static void
+flattenif(Flattenctx *s, Node *n, Node *exit)
{
Node *l1, *l2, *l3;
Node *iftrue, *iffalse;
@@ -639,7 +662,7 @@ static void flattenif(Flattenctx *s, Node *n, Node *exit)
append(s, s->incqueue[i]);
lfree(&s->incqueue, &s->nqueue);
/* because lots of bunched up end labels are ugly,
- * coalesce them by handling 'elif'-like constructs
+ * coalesce them by handling 'elif'-like construct
* separately */
if (iffalse && iffalse->type == Nifstmt) {
flattenif(s, iffalse, exit);
@@ -652,7 +675,8 @@ static void flattenif(Flattenctx *s, Node *n, Node *exit)
flatten(s, l3);
}
-static void flattenloopmatch(Flattenctx *s, Node *pat, Node *val, Node *ltrue, Node *lfalse)
+static void
+flattenloopmatch(Flattenctx *s, Node *pat, Node *val, Node *ltrue, Node *lfalse)
{
Node **cap, **out, *lload;
size_t i, ncap, nout;
@@ -672,7 +696,7 @@ static void flattenloopmatch(Flattenctx *s, Node *pat, Node *val, Node *ltrue, N
jmp(s, ltrue);
}
-/* pat; seq;
+/* pat; seq;
* body;;
*
* =>
@@ -692,7 +716,8 @@ static void flattenloopmatch(Flattenctx *s, Node *pat, Node *val, Node *ltrue, N
* matchval = load
* :end
*/
-static void flattenidxiter(Flattenctx *s, Node *n)
+static void
+flattenidxiter(Flattenctx *s, Node *n)
{
Node *lbody, *lstep, *lcond, *lmatch, *lend;
Node *idx, *len, *dcl, *seq, *val, *done;
@@ -745,7 +770,8 @@ static void flattenidxiter(Flattenctx *s, Node *n)
s->nloopexit--;
}
-static Node *itertraitfn(Srcloc loc, Trait *tr, char *fn, Type *ty)
+static Node *
+itertraitfn(Srcloc loc, Trait *tr, char *fn, Type *ty)
{
Node *proto, *dcl, *var;
char *name;
@@ -783,7 +809,8 @@ static Node *itertraitfn(Srcloc loc, Trait *tr, char *fn, Type *ty)
* ...load matches...
* :end
*/
-static void flattentraititer(Flattenctx *s, Node *n)
+static void
+flattentraititer(Flattenctx *s, Node *n)
{
Node *lbody, *lclean, *lstep, *lmatch, *lend;
Node *done, *val, *iter, *valptr, *iterptr;
@@ -839,7 +866,8 @@ static void flattentraititer(Flattenctx *s, Node *n)
s->nloopexit--;
}
-static void flatteniter(Flattenctx *s, Node *n)
+static void
+flatteniter(Flattenctx *s, Node *n)
{
switch (tybase(exprtype(n->iterstmt.seq))->type) {
case Tyarray: flattenidxiter(s, n); break;
@@ -847,7 +875,8 @@ static void flatteniter(Flattenctx *s, Node *n)
default: flattentraititer(s, n); break;
}
}
-static void flattenmatch(Flattenctx *fc, Node *n)
+static void
+flattenmatch(Flattenctx *fc, Node *n)
{
Node *val;
Node **match;
@@ -862,7 +891,8 @@ static void flattenmatch(Flattenctx *fc, Node *n)
flatten(fc, match[i]);
}
-static void flattenexpr(Flattenctx *fc, Node *n)
+static void
+flattenexpr(Flattenctx *fc, Node *n)
{
Node *r;
size_t i;
@@ -880,7 +910,8 @@ static void flattenexpr(Flattenctx *fc, Node *n)
lfree(&fc->incqueue, &fc->nqueue);
}
-static Node *flatten(Flattenctx *fc, Node *n)
+static Node *
+flatten(Flattenctx *fc, Node *n)
{
Node *r, *u, *t;
@@ -914,7 +945,8 @@ static Node *flatten(Flattenctx *fc, Node *n)
return r;
}
-static Node *flatteninit(Node *dcl)
+static Node *
+flatteninit(Node *dcl)
{
Flattenctx fc = {0,};
Node *lit, *fn, *blk, *body;
@@ -931,7 +963,8 @@ static Node *flatteninit(Node *dcl)
return dcl;
}
-static int ismain(Node *n)
+static int
+ismain(Node *n)
{
n = n->decl.name;
if (n->name.ns)
@@ -939,7 +972,8 @@ static int ismain(Node *n)
return strcmp(n->name.name, "main") == 0;
}
-Node *flattenfn(Node *dcl)
+Node *
+flattenfn(Node *dcl)
{
if (ismain(dcl))
dcl->decl.vis = Vishidden;
@@ -954,7 +988,8 @@ Node *flattenfn(Node *dcl)
return dcl;
}
-int isconstfn(Node *n)
+int
+isconstfn(Node *n)
{
Node *d, *e;
Type *t;
diff --git a/mi/match.c b/mi/match.c
index 0ea30ea..736c0a6 100644
--- a/mi/match.c
+++ b/mi/match.c
@@ -46,7 +46,8 @@ static int addpat(Node *pat, Node *val,
void dtreedump(FILE *fd, Dtree *dt);
-static Node *utag(Node *n)
+static Node *
+utag(Node *n)
{
Node *tag;
@@ -55,7 +56,8 @@ static Node *utag(Node *n)
return tag;
}
-static Node *uvalue(Node *n, Type *ty)
+static Node *
+uvalue(Node *n, Type *ty)
{
Node *elt;
@@ -64,7 +66,8 @@ static Node *uvalue(Node *n, Type *ty)
return elt;
}
-static Node *tupelt(Node *n, size_t i)
+static Node *
+tupelt(Node *n, size_t i)
{
Node *idx, *elt;
@@ -75,7 +78,8 @@ static Node *tupelt(Node *n, size_t i)
return elt;
}
-static Node *arrayelt(Node *n, size_t i)
+static Node *
+arrayelt(Node *n, size_t i)
{
Node *idx, *elt;
@@ -86,7 +90,8 @@ static Node *arrayelt(Node *n, size_t i)
return elt;
}
-static Node *findmemb(Node *pat, Node *name)
+static Node *
+findmemb(Node *pat, Node *name)
{
Node *n;
size_t i;
@@ -99,7 +104,8 @@ static Node *findmemb(Node *pat, Node *name)
return NULL;
}
-static Dtree *dtbytag(Dtree *t, Ucon *uc)
+static Dtree *
+dtbytag(Dtree *t, Ucon *uc)
{
uint32_t tagval;
Node *taglit;
@@ -115,7 +121,8 @@ static Dtree *dtbytag(Dtree *t, Ucon *uc)
return NULL;
}
-static Node *structmemb(Node *n, Node *name, Type *ty)
+static Node *
+structmemb(Node *n, Node *name, Type *ty)
{
Node *elt;
@@ -124,7 +131,8 @@ static Node *structmemb(Node *n, Node *name, Type *ty)
return elt;
}
-static Node *addcapture(Node *n, Node **cap, size_t ncap)
+static Node *
+addcapture(Node *n, Node **cap, size_t ncap)
{
Node **blk;
size_t nblk, i;
@@ -142,7 +150,8 @@ static Node *addcapture(Node *n, Node **cap, size_t ncap)
return n;
}
-static Dtree *mkdtree(Srcloc loc, Node *lbl)
+static Dtree *
+mkdtree(Srcloc loc, Node *lbl)
{
static int ndtree;
Dtree *t;
@@ -154,7 +163,8 @@ static Dtree *mkdtree(Srcloc loc, Node *lbl)
return t;
}
-static Dtree *nextnode(Srcloc loc, size_t idx, size_t count, Dtree *accept)
+static Dtree *
+nextnode(Srcloc loc, size_t idx, size_t count, Dtree *accept)
{
if (idx == count - 1)
return accept;
@@ -162,7 +172,8 @@ static Dtree *nextnode(Srcloc loc, size_t idx, size_t count, Dtree *accept)
return mkdtree(loc, genlbl(loc));
}
-static size_t nconstructors(Type *t)
+static size_t
+nconstructors(Type *t)
{
if (!t)
return 0;
@@ -209,7 +220,8 @@ static size_t nconstructors(Type *t)
return 0;
}
-static int verifymatch(Dtree *t)
+static int
+verifymatch(Dtree *t)
{
size_t i;
int ret;
@@ -226,7 +238,8 @@ static int verifymatch(Dtree *t)
return ret;
}
-static int acceptall(Dtree *t, Dtree *accept)
+static int
+acceptall(Dtree *t, Dtree *accept)
{
size_t i;
int ret;
@@ -249,7 +262,8 @@ static int acceptall(Dtree *t, Dtree *accept)
return ret;
}
-static int isnonrecursive(Dtree *dt, Type *ty)
+static int
+isnonrecursive(Dtree *dt, Type *ty)
{
if (istyprimitive(ty) || ty->type == Tyvoid || ty->type == Tyfunc || ty->type == Typtr)
return 1;
@@ -260,12 +274,14 @@ static int isnonrecursive(Dtree *dt, Type *ty)
return 0;
}
-static int ismatchable(Type *ty)
+static int
+ismatchable(Type *ty)
{
return ty->type != Tyfunc && ty->type != Tycode && ty->type != Tyvalist;
}
-static int addwildrec(Srcloc loc, Type *ty, Dtree *start, Dtree *accept, Dtree ***end, size_t *nend)
+static int
+addwildrec(Srcloc loc, Type *ty, Dtree *start, Dtree *accept, Dtree ***end, size_t *nend)
{
Dtree *next, **last, **tail;
size_t i, j, nelt, nlast, ntail;
@@ -378,7 +394,8 @@ static int addwildrec(Srcloc loc, Type *ty, Dtree *start, Dtree *accept, Dtree *
return ret;
}
-static int addwild(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
+static int
+addwild(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
{
Node *asn;
@@ -390,7 +407,8 @@ static int addwild(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***ca
return addwildrec(pat->loc, exprtype(pat), start, accept, end, nend);
}
-static int addunion(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
+static int
+addunion(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
{
Node *tagid;
Dtree *next;
@@ -431,7 +449,8 @@ static int addunion(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***c
return 1;
}
-static int addstr(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
+static int
+addstr(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
{
Dtree **tail, **last, *next;
size_t i, j, n, ntail, nlast;
@@ -469,7 +488,7 @@ static int addstr(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap
tail = NULL;
ntail = 0;
next = nextnode(pat->loc, i, n, accept);
- for (j = 0; j < nlast; j++)
+ for (j = 0; j < nlast; j++)
if (addpat(p, v, last[j], next, NULL, NULL, &tail, &ntail))
ret = 1;
lfree(&last, &nlast);
@@ -481,7 +500,8 @@ static int addstr(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap
return ret;
}
-static int addlit(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
+static int
+addlit(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
{
size_t i;
@@ -513,7 +533,8 @@ static int addlit(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap
}
}
-static int addtup(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
+static int
+addtup(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
{
size_t nargs, nlast, ntail, i, j;
Dtree *next, **last, **tail;
@@ -531,7 +552,7 @@ static int addtup(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap
next = nextnode(args[i]->loc, i, nargs, accept);
tail = NULL;
ntail = 0;
- for (j = 0; j < nlast; j++)
+ for (j = 0; j < nlast; j++)
if (addpat(pat->expr.args[i], tupelt(val, i), last[j], next, cap, ncap, &tail, &ntail))
ret = 1;
lfree(&last, &nlast);
@@ -543,7 +564,8 @@ static int addtup(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap
return ret;
}
-static int addarr(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
+static int
+addarr(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
{
size_t nargs, nlast, ntail, i, j;
Dtree *next, **last, **tail;
@@ -561,7 +583,7 @@ static int addarr(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap
next = nextnode(args[i]->loc, i, nargs, accept);
tail = NULL;
ntail = 0;
- for (j = 0; j < nlast; j++)
+ for (j = 0; j < nlast; j++)
if (addpat(pat->expr.args[i], arrayelt(val, i), last[j], next, cap, ncap, &tail, &ntail))
ret = 1;
lfree(&last, &nlast);
@@ -573,7 +595,8 @@ static int addarr(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap
return ret;
}
-static int addstruct(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
+static int
+addstruct(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
{
Dtree *next, **last, **tail;
Node *memb, *name;
@@ -613,7 +636,8 @@ static int addstruct(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***
return ret;
}
-static int addderefpat(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
+static int
+addderefpat(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
{
Node *deref;
Dtree *walk;
@@ -630,7 +654,8 @@ static int addderefpat(Node *pat, Node *val, Dtree *start, Dtree *accept, Node *
return addpat(pat->expr.args[0], deref, walk, accept, cap, ncap, end, nend);
}
-static int addpat(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
+static int
+addpat(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend)
{
int ret;
Node *dcl;
@@ -678,7 +703,8 @@ static int addpat(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap
/* val must be a pure, fully evaluated value */
-Dtree *gendtree(Node *m, Node *val, Node **lbl, size_t nlbl)
+Dtree *
+gendtree(Node *m, Node *val, Node **lbl, size_t nlbl)
{
Dtree *start, *accept, **end;
Node **pat, **cap;
@@ -706,7 +732,8 @@ Dtree *gendtree(Node *m, Node *val, Node **lbl, size_t nlbl)
return start;
}
-void genmatchcode(Dtree *dt, Node ***out, size_t *nout)
+void
+genmatchcode(Dtree *dt, Node ***out, size_t *nout)
{
Node *jmp, *eq, *fail;
int emit;
@@ -752,7 +779,8 @@ void genmatchcode(Dtree *dt, Node ***out, size_t *nout)
}
}
-void genonematch(Node *pat, Node *val, Node *iftrue, Node *iffalse, Node ***out, size_t *nout, Node ***cap, size_t *ncap)
+void
+genonematch(Node *pat, Node *val, Node *iftrue, Node *iffalse, Node ***out, size_t *nout, Node ***cap, size_t *ncap)
{
Dtree *start, *accept, *reject, **end;
size_t nend;
@@ -771,7 +799,8 @@ void genonematch(Node *pat, Node *val, Node *iftrue, Node *iffalse, Node ***out,
genmatchcode(start, out, nout);
}
-void genmatch(Node *m, Node *val, Node ***out, size_t *nout)
+void
+genmatch(Node *m, Node *val, Node ***out, size_t *nout)
{
Node **pat, **lbl, *end, *endlbl;
size_t npat, nlbl, i;
@@ -807,7 +836,8 @@ void genmatch(Node *m, Node *val, Node ***out, size_t *nout)
}
-void dtreedumplit(FILE *fd, Dtree *dt, Node *n, size_t depth)
+void
+dtreedumplit(FILE *fd, Dtree *dt, Node *n, size_t depth)
{
char *s;
@@ -824,7 +854,8 @@ void dtreedumplit(FILE *fd, Dtree *dt, Node *n, size_t depth)
}
}
-void dtreedumpnode(FILE *fd, Dtree *dt, size_t depth)
+void
+dtreedumpnode(FILE *fd, Dtree *dt, size_t depth)
{
size_t i;
@@ -841,7 +872,8 @@ void dtreedumpnode(FILE *fd, Dtree *dt, size_t depth)
}
}
-void dtreedump(FILE *fd, Dtree *dt)
+void
+dtreedump(FILE *fd, Dtree *dt)
{
dtreedumpnode(fd, dt, 0);
}
diff --git a/mi/reaching.c b/mi/reaching.c
index e1b8090..8ac9244 100644
--- a/mi/reaching.c
+++ b/mi/reaching.c
@@ -14,7 +14,8 @@
#include "parse.h"
#include "mi.h"
-Node *assignee(Node *n)
+Node *
+assignee(Node *n)
{
Node *a;
@@ -44,7 +45,8 @@ Node *assignee(Node *n)
return NULL;
}
-static void collectdefs(Cfg *cfg, size_t **defs, size_t *ndefs)
+static void
+collectdefs(Cfg *cfg, size_t **defs, size_t *ndefs)
{
size_t i, j, did;
Node *n;
@@ -66,7 +68,8 @@ static void collectdefs(Cfg *cfg, size_t **defs, size_t *ndefs)
}
}
-static void genkill(Bb *bb, size_t **defs, size_t *ndefs, Bitset *gen, Bitset *kill)
+static void
+genkill(Bb *bb, size_t **defs, size_t *ndefs, Bitset *gen, Bitset *kill)
{
size_t i, j, did;
Node *n;
@@ -85,7 +88,8 @@ static void genkill(Bb *bb, size_t **defs, size_t *ndefs, Bitset *gen, Bitset *k
}
}
-void bsdump(Bitset *bs)
+void
+bsdump(Bitset *bs)
{
size_t i;
for (i = 0; bsiter(bs, &i); i++)
@@ -93,14 +97,15 @@ void bsdump(Bitset *bs)
printf("\n");
}
-Reaching *reaching(Cfg *cfg)
+Reaching *
+reaching(Cfg *cfg)
{
Bitset **in, **out;
Bitset **gen, **kill;
Bitset *bbin, *bbout;
Reaching *reaching;
size_t **defs; /* mapping from did => [def,list] */
- size_t *ndefs;
+ size_t *ndefs;
size_t i, j;
int changed;
@@ -163,7 +168,8 @@ Reaching *reaching(Cfg *cfg)
return reaching;
}
-void reachingfree(Reaching *r)
+void
+reachingfree(Reaching *r)
{
size_t i;