diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2017-02-24 09:48:53 -0500 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2017-02-24 09:50:35 -0500 |
commit | 1bb7652484e1c7ca2cd7fcab858b4bbb18509879 (patch) | |
tree | b04e582abaf59fdd220d9e68895d07902ccd865a | |
parent | f3301026fa404c68c7ad399b5a56a5135b88af04 (diff) | |
download | roux-1bb7652484e1c7ca2cd7fcab858b4bbb18509879.tar.gz |
deduplicate loadsz & storesz
-rw-r--r-- | all.h | 2 | ||||
-rw-r--r-- | load.c | 4 | ||||
-rw-r--r-- | mem.c | 25 |
3 files changed, 4 insertions, 27 deletions
diff --git a/all.h b/all.h index 887d680..b073124 100644 --- a/all.h +++ b/all.h @@ -576,6 +576,8 @@ int alias(Ref, int, Ref, int, int *, Fn *); int escapes(Ref, Fn *); /* load.c */ +int loadsz(Ins *); +int storesz(Ins *); void loadopt(Fn *); /* ssa.c */ diff --git a/load.c b/load.c index ca7d492..3e22b57 100644 --- a/load.c +++ b/load.c @@ -42,7 +42,7 @@ static uint inum; /* current insertion number */ static Insert *ilog; /* global insertion log */ static uint nlog; /* number of entries in the log */ -static int +int loadsz(Ins *l) { switch (l->op) { @@ -54,7 +54,7 @@ loadsz(Ins *l) die("unreachable"); } -static int +int storesz(Ins *s) { switch (s->op) { diff --git a/mem.c b/mem.c index 11527fa..fd6ee16 100644 --- a/mem.c +++ b/mem.c @@ -1,30 +1,5 @@ #include "all.h" -static int -loadsz(Ins *l) -{ - switch (l->op) { - case Oloadsb: case Oloadub: return 1; - case Oloadsh: case Oloaduh: return 2; - case Oloadsw: case Oloaduw: return 4; - case Oload: return KWIDE(l->cls) ? 8 : 4; - } - die("unreachable"); -} - -static int -storesz(Ins *s) -{ - switch (s->op) { - case Ostoreb: return 1; - case Ostoreh: return 2; - case Ostorew: case Ostores: return 4; - case Ostorel: case Ostored: return 8; - } - die("unreachable"); -} - - /* require use, maintains use counts */ void memopt(Fn *fn) |