void
cgen(Node *n, Node *res)
{
- long lno;
Node *nl, *nr, *r;
Node n1, n2;
int a;
if(n == N || n->type == T)
return;
- lno = setlineno(n);
-
if(res == N || res->type == T)
fatal("cgen: res nil");
goto ret;
ret:
- lineno = lno;
+ ;
}
void
Node n1, n2, n3, tmp;
ulong w;
Type *t;
- long lno;
if(debug['g']) {
dump("\nagen-res", res);
if(n == N || n->type == T)
return;
- lno = setlineno(n);
-
if(!isptr[res->type->etype])
fatal("agen: not tptr: %T", res->type);
}
ret:
- lineno = lno;
+ ;
}
vlong
void
bgen(Node *n, int true, Prog *to)
{
- long lno;
int et, a;
Node *nl, *nr, *r;
Node n1, n2, tmp;
if(debug['g']) {
dump("\nbgen", n);
}
+
if(n == N)
n = booltrue;
- lno = setlineno(n);
-
nl = n->left;
nr = n->right;
goto ret;
ret:
- lineno = lno;
+ ;
}
void
sgen(Node *n, Node *ns, ulong w)
{
Node nodl, nodr;
- long c, lno;
-
- lno = setlineno(n);
+ long c;
if(debug['g']) {
dump("\nsgen-res", ns);
gins(AMOVSB, N, N); // MOVB *(SI)+,*(DI)+
}
- lineno = lno;
}
Prog *ptxt;
long lno;
-
if(fn->nbody == N)
return;
lno = setlineno(fn);
curfn = fn;
- lineno = curfn->lineno; // for diagnostics
dowidth(curfn->type);
walk(curfn);
// gins(AGOK, N, N);
pc->as = ARET; // overwrite AEND
+ pc->lineno = lineno;
// fill in final stack size
ptxt->to.offset = rnd(stksize+maxarg, maxround);
dflt = P;
c1 = listfirst(&save1, &n->nbody);
while(c1 != N) {
- lineno = c1->lineno; // for diagnostics
+ setlineno(c1);
if(c1->op != OCASE) {
if(s0 == C && dflt == P)
yyerror("unreachable statements in a switch");
c1 = listnext(&save1);
}
+ lineno = lno;
+
if(any)
patch(gbranch(AJMP, T), breakpc);
cgen(n->ntest, &tmp);
for(s=s0; s!=C; s=s->slink) {
+ setlineno(s->scase);
memset(&n1, 0, sizeof(n1));
n1.op = OEQ;
n1.left = &tmp;
{
Node *i, *f;
Node tmpi, nodo, nodr, nodsp;
- long lno;
-
- lno = setlineno(n);
i = n->left;
if(i->op != ODOTINTER)
regfree(&nodr);
setmaxarg(n->left->type);
- lineno = lno;
}
void
cgen_callmeth(Node *n)
{
Node *l;
- long lno;
// generate a rewrite for method call
// (p.f)(...) goes to (f)(p,...)
- lno = setlineno(n);
-
l = n->left;
if(l->op != ODOTMETH)
fatal("cgen_callmeth: not dotmethod: %N");
if(n->left->op == ONAME)
n->left->class = PEXTERN;
cgen_call(n);
- lineno = lno;
}
void
{
Type *t;
Node nod, afun;
- long lno;
if(n == N)
return;
- lno = setlineno(n);
-
if(n->left->ullman >= UINF) {
// if name involves a fn call
// precompute the address of the fn
gins(ACALL, N, n->left);
ret:
- lineno = lno;
+ ;
}
void
Node nod;
Type *fp, *t;
Iter flist;
- long lno;
-
- lno = setlineno(n);
t = n->left->type;
if(t->etype == TPTR32 || t->etype == TPTR64)
nod.op = OINDREG;
nod.val.vval = D_SP;
nod.addable = 1;
- nod.lineno = lineno;
nod.xoffset = fp->width;
nod.type = fp->type;
cgen_as(res, &nod, 0);
- lineno = lno;
}
void
Node nod1, nod2;
Type *fp, *t;
Iter flist;
- long lno;
-
- lno = setlineno(n);
t = n->left->type;
if(isptr[t->etype])
nod1.op = OINDREG;
nod1.val.vval = D_SP;
nod1.addable = 1;
- nod1.lineno = lineno;
nod1.xoffset = fp->width;
nod1.type = fp->type;
gins(ALEAQ, &nod1, res);
- lineno = lno;
}
void
cgen_ret(Node *n)
{
- long lno;
-
- lno = setlineno(n);
gen(n->left); // copy out args
gins(ARET, N, N);
- lineno = lno;
}
void
Node *nl, *nr;
long lno;
- lno = setlineno(n);
-
nl = n->left;
nr = n->right;
n2 = *n;
n2.right = &n1;
cgen_asop(&n2);
- return;
+ goto ret;
}
if(nr->ullman > nl->ullman) {
regfree(&n1);
regfree(&n2);
regfree(&n4);
- lineno = lno;
+
+ret:
+ ;
}
void
Node nc, n1;
Type *tl;
ulong w, c;
- long lno;
if(nl == N)
return;
if(tl == T)
return;
- lno = setlineno(nl);
-
if(nr == N || isnil(nr)) {
if(isfat(tl)) {
/* clear a fat object */
cgen(nr, nl);
ret:
- lineno = lno;
+ ;
}
int
{
Node n1, n2, n3;
int a, rax, rdx;
- long lno;
-
- lno = setlineno(nl);
rax = reg[D_AX];
rdx = reg[D_DX];
regfree(&n2);
ret:
- lineno = lno;
+ ;
}
/*
{
Node n1, n2;
int a, rcl;
- long lno;
-
- lno = setlineno(nl);
a = optoas(op, nl->type);
regfree(&n2);
ret:
- lineno = lno;
+ ;
}
clearp(pc);
+ if(lineno == 0) {
+ if(debug['K'])
+ warn("prog: line 0");
+ }
+
p->as = as;
p->lineno = lineno;
p->link = pc;
-if(lineno == 0)
-warn("line 0 %P\n", p);
return p;
}
memset(n, 0, sizeof(*n));
n->op = OREGISTER;
n->addable = 1;
- n->lineno = lineno;
ullmancalc(n);
n->val.vval = r;
n->type = t;
n->sym = t->sym;
n->xoffset = t->width;
n->addable = 1;
- n->lineno = lineno;
switch(fp) {
case 0: // output arg
memset(n, 0, sizeof(*n));
n->op = OLITERAL;
n->addable = 1;
- n->lineno = lineno;
ullmancalc(n);
n->val.vval = v;
n->val.ctype = CTINT;
n->etype = t->etype;
n->class = PAUTO;
n->addable = 1;
- n->lineno = lineno;
n->ullman = 0;
dowidth(t);
if(curio.bin != nil) {
Bterm(curio.bin);
curio.bin = nil;
- }
+ } else
+ lineno--; // re correct sys.6 line number
curio = pushedio;
pushedio.bin = nil;
inimportsys = 0;
char *file;
file = "sys.6";
- linehist(file, 0);
+ lineno++; // if sys.6 is included on line 1,
+ linehist(file, 0); // the debugger gets confused
pushedio = curio;
curio.bin = nil;
long lno;
lno = lineno;
- if(n != N && n->op != ONAME)
+ if(n != N && n->op != ONAME) {
lineno = n->lineno;
+ if(lineno == 0) {
+ if(debug['K'])
+ warn("setlineno: line 0");
+ lineno = lno;
+ }
+ }
return lno;
}
Node *r, *l;
Type *t;
Sym *s;
- long lno;
int et, cl, cr;
+ long lno;
+
+ lno = setlineno(n);
/*
* walk the whole tree of the body of a function.
* compile-time constants are evaluated.
*/
- lno = setlineno(n);
if(top == Exxx || top == Eyyy) {
dump("", n);
fatal("walktype: bad top=%d", top);
loop:
if(n == N)
goto ret;
+
setlineno(n);
if(debug['w'] > 1 && top == Etop && n->op != OLIST)
Type *place;
place = call(sw->ntest, T);
+ setlineno(sw);
+
n = sw->nbody;
if(n->op == OLIST)
n = n->left;
fatal("walkswitch: not case %O\n", n->op);
for(c=n->left; c!=N; c=c->right) {
if(c->op != OLIST) {
+ setlineno(c);
place = call(c, place);
break;
}
+ setlineno(c);
place = call(c->left, place);
}
}
stringop(Node *n, int top)
{
Node *r, *c, *on;
- long lno, l;
-
- lno = setlineno(n);
+ long l;
switch(n->op) {
default:
}
walktype(r, top);
- lineno = lno;
return r;
}
Node*
mapop(Node *n, int top)
{
- long lno;
Node *r, *a;
Type *t;
Node *on;
int alg1, alg2, cl, cr;
- lno = setlineno(n);
-
//dump("mapop", n);
r = n;
break;
}
- lineno = lno;
return r;
shape:
dump("shape", n);
fatal("mapop: cl=%d cr=%d, %O", top, n->op);
- lineno = lno;
return N;
nottop:
dump("bad top", n);
fatal("mapop: top=%d %O", top, n->op);
- lineno = lno;
return N;
}