summaryrefslogtreecommitdiff
path: root/lisc
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-25 11:33:50 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-25 11:33:50 -0400
commit4dccbf22f3be3b206f8d8e6690adbdd2c1a6550c (patch)
tree390fca57a96d865bac686584a55ff61bd3111f32 /lisc
parent2d5302df71e80ce2acc25c5bc91b148cee6e7c5c (diff)
downloadroux-4dccbf22f3be3b206f8d8e6690adbdd2c1a6550c.tar.gz
move return type information into Fn
Diffstat (limited to 'lisc')
-rw-r--r--lisc/lisc.h2
-rw-r--r--lisc/parse.c26
2 files changed, 13 insertions, 15 deletions
diff --git a/lisc/lisc.h b/lisc/lisc.h
index 0678b13..fbd2310 100644
--- a/lisc/lisc.h
+++ b/lisc/lisc.h
@@ -204,7 +204,6 @@ struct Blk {
struct {
short type;
Ref arg;
- int rettyn;
} jmp;
Blk *s1;
Blk *s2;
@@ -246,6 +245,7 @@ struct Fn {
int ntmp;
int ncon;
int nblk;
+ int retty;
Blk **rpo;
ulong reg;
int svec[NAlign];
diff --git a/lisc/parse.c b/lisc/parse.c
index a6957f2..137e4ad 100644
--- a/lisc/parse.c
+++ b/lisc/parse.c
@@ -11,7 +11,7 @@ enum {
Ins insb[NIns], *curi;
OpDesc opdesc[NOp] = {
- /* NAME ARTY NM */
+ /* NAME NM */
[OAdd] = { "add", 2 },
[OSub] = { "sub", 2 },
[ODiv] = { "div", 2 },
@@ -117,7 +117,6 @@ static Blk *curb;
static Blk **blink;
static int nblk;
static int rcls;
-static int rtyn;
void *
@@ -514,7 +513,6 @@ parseline(PState ps)
JRetw, JRetl,
JRetc, JRet0
}[rcls];
- curb->jmp.rettyn = rtyn;
if (rcls < 3) {
r = parseref();
if (req(r, R))
@@ -623,24 +621,24 @@ parsefn()
PState ps;
Fn *fn;
- if (peek() != TGlo)
- rcls = parsecls(&rtyn);
- else
- rcls = 3;
- if (next() != TGlo)
- err("function name expected");
- for (i=0; i<NBlk; i++)
- bmap[i] = 0;
- for (i=Tmp0; i<NTmp; i++)
- tmp[i] = (Tmp){.name = ""};
ntmp = Tmp0;
ncon = 1; /* first constant must be 0 */
curb = 0;
nblk = 0;
curi = insb;
fn = alloc(sizeof *fn);
- strcpy(fn->name, tokval.str);
blink = &fn->start;
+ for (i=0; i<NBlk; i++)
+ bmap[i] = 0;
+ for (i=Tmp0; i<NTmp; i++)
+ tmp[i] = (Tmp){.name = ""};
+ if (peek() != TGlo)
+ rcls = parsecls(&fn->retty);
+ else
+ rcls = 3;
+ if (next() != TGlo)
+ err("function name expected");
+ strcpy(fn->name, tokval.str);
parserefl(0);
if (nextnl() != TLBrace)
err("function body must start with {");