flow.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  1. /***** spin: flow.c *****/
  2. /* Copyright (c) 1991-2000 by Lucent Technologies - Bell Laboratories */
  3. /* All Rights Reserved. This software is for educational purposes only. */
  4. /* Permission is given to distribute this code provided that this intro- */
  5. /* ductory message is not removed and no monies are exchanged. */
  6. /* No guarantee is expressed or implied by the distribution of this code. */
  7. /* Software written by Gerard J. Holzmann as part of the book: */
  8. /* `Design and Validation of Computer Protocols,' ISBN 0-13-539925-4, */
  9. /* Prentice Hall, Englewood Cliffs, NJ, 07632. */
  10. /* Send bug-reports and/or questions to: gerard@research.bell-labs.com */
  11. #include "spin.h"
  12. #ifdef PC
  13. #include "y_tab.h"
  14. #else
  15. #include "y.tab.h"
  16. #endif
  17. extern Symbol *Fname;
  18. extern int nr_errs, lineno, verbose;
  19. extern short has_unless, has_badelse;
  20. Element *Al_El = ZE;
  21. Label *labtab = (Label *) 0;
  22. int Unique=0, Elcnt=0, DstepStart = -1;
  23. static Lbreak *breakstack = (Lbreak *) 0;
  24. static Lextok *innermost;
  25. static SeqList *cur_s = (SeqList *) 0;
  26. static int break_id=0;
  27. static Element *if_seq(Lextok *);
  28. static Element *new_el(Lextok *);
  29. static Element *unless_seq(Lextok *);
  30. static void add_el(Element *, Sequence *);
  31. static void attach_escape(Sequence *, Sequence *);
  32. static void mov_lab(Symbol *, Element *, Element *);
  33. static void walk_atomic(Element *, Element *, int);
  34. void
  35. open_seq(int top)
  36. { SeqList *t;
  37. Sequence *s = (Sequence *) emalloc(sizeof(Sequence));
  38. t = seqlist(s, cur_s);
  39. cur_s = t;
  40. if (top) Elcnt = 1;
  41. }
  42. void
  43. rem_Seq(void)
  44. {
  45. DstepStart = Unique;
  46. }
  47. void
  48. unrem_Seq(void)
  49. {
  50. DstepStart = -1;
  51. }
  52. static int
  53. Rjumpslocal(Element *q, Element *stop)
  54. { Element *lb, *f;
  55. SeqList *h;
  56. /* allow no jumps out of a d_step sequence */
  57. for (f = q; f && f != stop; f = f->nxt)
  58. { if (f && f->n && f->n->ntyp == GOTO)
  59. { lb = get_lab(f->n, 0);
  60. if (!lb || lb->Seqno < DstepStart)
  61. { lineno = f->n->ln;
  62. Fname = f->n->fn;
  63. return 0;
  64. } }
  65. for (h = f->sub; h; h = h->nxt)
  66. { if (!Rjumpslocal(h->this->frst, h->this->last))
  67. return 0;
  68. } }
  69. return 1;
  70. }
  71. void
  72. cross_dsteps(Lextok *a, Lextok *b)
  73. {
  74. if (a && b
  75. && a->indstep != b->indstep)
  76. { lineno = a->ln;
  77. Fname = a->fn;
  78. fatal("jump into d_step sequence", (char *) 0);
  79. }
  80. }
  81. int
  82. is_skip(Lextok *n)
  83. {
  84. return (n->ntyp == PRINT
  85. || (n->ntyp == 'c'
  86. && n->lft
  87. && n->lft->ntyp == CONST
  88. && n->lft->val == 1));
  89. }
  90. void
  91. check_sequence(Sequence *s)
  92. { Element *e, *le = ZE;
  93. Lextok *n;
  94. int cnt = 0;
  95. for (e = s->frst; e; le = e, e = e->nxt)
  96. { n = e->n;
  97. if (is_skip(n) && !has_lab(e, 0))
  98. { cnt++;
  99. if (cnt > 1 && n->ntyp != PRINT)
  100. { if (verbose&32)
  101. printf("spin: line %d %s, redundant skip\n",
  102. n->ln, n->fn->name);
  103. if (le)
  104. { e->status |= DONE; /* not unreachable */
  105. le->nxt = e->nxt; /* remove it */
  106. e = le;
  107. } /* else, can't happen */
  108. }
  109. } else
  110. cnt = 0;
  111. }
  112. }
  113. void
  114. prune_opts(Lextok *n)
  115. { SeqList *l;
  116. extern Symbol *context;
  117. extern char *claimproc;
  118. if (!n
  119. || (context && claimproc && strcmp(context->name, claimproc) == 0))
  120. return;
  121. for (l = n->sl; l; l = l->nxt) /* find sequences of unlabeled skips */
  122. check_sequence(l->this);
  123. }
  124. Sequence *
  125. close_seq(int nottop)
  126. { Sequence *s = cur_s->this;
  127. Symbol *z;
  128. if (nottop > 0 && (z = has_lab(s->frst, 0)))
  129. { printf("error: (%s:%d) label %s placed incorrectly\n",
  130. (s->frst->n)?s->frst->n->fn->name:"-",
  131. (s->frst->n)?s->frst->n->ln:0,
  132. z->name);
  133. switch (nottop) {
  134. case 1:
  135. printf("=====> stmnt unless Label: stmnt\n");
  136. printf("sorry, cannot jump to the guard of an\n");
  137. printf("escape (it is not a unique state)\n");
  138. break;
  139. case 2:
  140. printf("=====> instead of ");
  141. printf("\"Label: stmnt unless stmnt\"\n");
  142. printf("=====> always use ");
  143. printf("\"Label: { stmnt unless stmnt }\"\n");
  144. break;
  145. case 3:
  146. printf("=====> instead of ");
  147. printf("\"atomic { Label: statement ... }\"\n");
  148. printf("=====> always use ");
  149. printf("\"Label: atomic { statement ... }\"\n");
  150. break;
  151. case 4:
  152. printf("=====> instead of ");
  153. printf("\"d_step { Label: statement ... }\"\n");
  154. printf("=====> always use ");
  155. printf("\"Label: d_step { statement ... }\"\n");
  156. break;
  157. case 5:
  158. printf("=====> instead of ");
  159. printf("\"{ Label: statement ... }\"\n");
  160. printf("=====> always use ");
  161. printf("\"Label: { statement ... }\"\n");
  162. break;
  163. case 6:
  164. printf("=====>instead of\n");
  165. printf(" do (or if)\n");
  166. printf(" :: ...\n");
  167. printf(" :: Label: statement\n");
  168. printf(" od (of fi)\n");
  169. printf("=====>always use\n");
  170. printf("Label: do (or if)\n");
  171. printf(" :: ...\n");
  172. printf(" :: statement\n");
  173. printf(" od (or fi)\n");
  174. break;
  175. case 7:
  176. printf("cannot happen - labels\n");
  177. break;
  178. }
  179. alldone(1);
  180. }
  181. if (nottop == 4
  182. && !Rjumpslocal(s->frst, s->last))
  183. fatal("non_local jump in d_step sequence", (char *) 0);
  184. cur_s = cur_s->nxt;
  185. s->maxel = Elcnt;
  186. s->extent = s->last;
  187. if (!s->last)
  188. fatal("sequence must have at least one statement", (char *) 0);
  189. return s;
  190. }
  191. Lextok *
  192. do_unless(Lextok *No, Lextok *Es)
  193. { SeqList *Sl;
  194. Lextok *Re = nn(ZN, UNLESS, ZN, ZN);
  195. Re->ln = No->ln;
  196. Re->fn = No->fn;
  197. has_unless++;
  198. if (Es->ntyp == NON_ATOMIC)
  199. Sl = Es->sl;
  200. else
  201. { open_seq(0); add_seq(Es);
  202. Sl = seqlist(close_seq(1), 0);
  203. }
  204. if (No->ntyp == NON_ATOMIC)
  205. { No->sl->nxt = Sl;
  206. Sl = No->sl;
  207. } else if (No->ntyp == ':'
  208. && (No->lft->ntyp == NON_ATOMIC
  209. || No->lft->ntyp == ATOMIC
  210. || No->lft->ntyp == D_STEP))
  211. {
  212. int tok = No->lft->ntyp;
  213. No->lft->sl->nxt = Sl;
  214. Re->sl = No->lft->sl;
  215. open_seq(0); add_seq(Re);
  216. Re = nn(ZN, tok, ZN, ZN);
  217. Re->sl = seqlist(close_seq(7), 0);
  218. Re->ln = No->ln;
  219. Re->fn = No->fn;
  220. Re = nn(No, ':', Re, ZN); /* lift label */
  221. Re->ln = No->ln;
  222. Re->fn = No->fn;
  223. return Re;
  224. } else
  225. { open_seq(0); add_seq(No);
  226. Sl = seqlist(close_seq(2), Sl);
  227. }
  228. Re->sl = Sl;
  229. return Re;
  230. }
  231. SeqList *
  232. seqlist(Sequence *s, SeqList *r)
  233. { SeqList *t = (SeqList *) emalloc(sizeof(SeqList));
  234. t->this = s;
  235. t->nxt = r;
  236. return t;
  237. }
  238. static Element *
  239. new_el(Lextok *n)
  240. { Element *m;
  241. if (n)
  242. { if (n->ntyp == IF || n->ntyp == DO)
  243. return if_seq(n);
  244. if (n->ntyp == UNLESS)
  245. return unless_seq(n);
  246. }
  247. m = (Element *) emalloc(sizeof(Element));
  248. m->n = n;
  249. m->seqno = Elcnt++;
  250. m->Seqno = Unique++;
  251. m->Nxt = Al_El; Al_El = m;
  252. return m;
  253. }
  254. static int
  255. has_chanref(Lextok *n)
  256. {
  257. if (!n) return 0;
  258. switch (n->ntyp) {
  259. case 's': case 'r':
  260. #if 0
  261. case 'R': case LEN:
  262. #endif
  263. case FULL: case NFULL:
  264. case EMPTY: case NEMPTY:
  265. return 1;
  266. default:
  267. break;
  268. }
  269. if (has_chanref(n->lft))
  270. return 1;
  271. return has_chanref(n->rgt);
  272. }
  273. static Element *
  274. if_seq(Lextok *n)
  275. { int tok = n->ntyp;
  276. SeqList *s = n->sl;
  277. Element *e = new_el(ZN);
  278. Element *t = new_el(nn(ZN,'.',ZN,ZN)); /* target */
  279. SeqList *z, *prev_z = (SeqList *) 0;
  280. SeqList *move_else = (SeqList *) 0; /* to end of optionlist */
  281. int ref_chans = 0;
  282. for (z = s; z; z = z->nxt)
  283. { if (!z->this->frst)
  284. continue;
  285. if (z->this->frst->n->ntyp == ELSE)
  286. { if (move_else)
  287. fatal("duplicate `else'", (char *) 0);
  288. if (z->nxt) /* is not already at the end */
  289. { move_else = z;
  290. if (prev_z)
  291. prev_z->nxt = z->nxt;
  292. else
  293. s = n->sl = z->nxt;
  294. continue;
  295. }
  296. } else
  297. ref_chans |= has_chanref(z->this->frst->n);
  298. prev_z = z;
  299. }
  300. if (move_else)
  301. { move_else->nxt = (SeqList *) 0;
  302. /* if there is no prev, then else was at the end */
  303. if (!prev_z) fatal("cannot happen - if_seq", (char *) 0);
  304. prev_z->nxt = move_else;
  305. prev_z = move_else;
  306. }
  307. if (prev_z
  308. && ref_chans
  309. && prev_z->this->frst->n->ntyp == ELSE)
  310. { prev_z->this->frst->n->val = 1;
  311. has_badelse++;
  312. non_fatal("dubious use of 'else' combined with i/o,",
  313. (char *)0);
  314. nr_errs--;
  315. }
  316. e->n = nn(n, tok, ZN, ZN);
  317. e->n->sl = s; /* preserve as info only */
  318. e->sub = s;
  319. for (z = s; z; prev_z = z, z = z->nxt)
  320. add_el(t, z->this); /* append target */
  321. if (tok == DO)
  322. { add_el(t, cur_s->this); /* target upfront */
  323. t = new_el(nn(n, BREAK, ZN, ZN)); /* break target */
  324. set_lab(break_dest(), t); /* new exit */
  325. breakstack = breakstack->nxt; /* pop stack */
  326. }
  327. add_el(e, cur_s->this);
  328. add_el(t, cur_s->this);
  329. return e; /* destination node for label */
  330. }
  331. static void
  332. escape_el(Element *f, Sequence *e)
  333. { SeqList *z;
  334. for (z = f->esc; z; z = z->nxt)
  335. if (z->this == e)
  336. return; /* already there */
  337. /* cover the lower-level escapes of this state */
  338. for (z = f->esc; z; z = z->nxt)
  339. attach_escape(z->this, e);
  340. /* now attach escape to the state itself */
  341. f->esc = seqlist(e, f->esc); /* in lifo order... */
  342. #ifdef DEBUG
  343. printf("attach %d (", e->frst->Seqno);
  344. comment(stdout, e->frst->n, 0);
  345. printf(") to %d (", f->Seqno);
  346. comment(stdout, f->n, 0);
  347. printf(")\n");
  348. #endif
  349. switch (f->n->ntyp) {
  350. case UNLESS:
  351. attach_escape(f->sub->this, e);
  352. break;
  353. case IF:
  354. case DO:
  355. for (z = f->sub; z; z = z->nxt)
  356. attach_escape(z->this, e);
  357. break;
  358. case D_STEP:
  359. /* attach only to the guard stmnt */
  360. escape_el(f->n->sl->this->frst, e);
  361. break;
  362. case ATOMIC:
  363. case NON_ATOMIC:
  364. /* attach to all stmnts */
  365. attach_escape(f->n->sl->this, e);
  366. break;
  367. }
  368. }
  369. static void
  370. attach_escape(Sequence *n, Sequence *e)
  371. { Element *f;
  372. for (f = n->frst; f; f = f->nxt)
  373. { escape_el(f, e);
  374. if (f == n->extent)
  375. break;
  376. }
  377. }
  378. static Element *
  379. unless_seq(Lextok *n)
  380. { SeqList *s = n->sl;
  381. Element *e = new_el(ZN);
  382. Element *t = new_el(nn(ZN,'.',ZN,ZN)); /* target */
  383. SeqList *z;
  384. e->n = nn(n, UNLESS, ZN, ZN);
  385. e->n->sl = s; /* info only */
  386. e->sub = s;
  387. /* need 2 sequences: normal execution and escape */
  388. if (!s || !s->nxt || s->nxt->nxt)
  389. fatal("unexpected unless structure", (char *)0);
  390. /* append the target state to both */
  391. for (z = s; z; z = z->nxt)
  392. add_el(t, z->this);
  393. /* attach escapes to all states in normal sequence */
  394. attach_escape(s->this, s->nxt->this);
  395. add_el(e, cur_s->this);
  396. add_el(t, cur_s->this);
  397. #ifdef DEBUG
  398. printf("unless element (%d,%d):\n", e->Seqno, t->Seqno);
  399. for (z = s; z; z = z->nxt)
  400. { Element *x; printf("\t%d,%d,%d :: ",
  401. z->this->frst->Seqno,
  402. z->this->extent->Seqno,
  403. z->this->last->Seqno);
  404. for (x = z->this->frst; x; x = x->nxt)
  405. printf("(%d)", x->Seqno);
  406. printf("\n");
  407. }
  408. #endif
  409. return e;
  410. }
  411. Element *
  412. mk_skip(void)
  413. { Lextok *t = nn(ZN, CONST, ZN, ZN);
  414. t->val = 1;
  415. return new_el(nn(ZN, 'c', t, ZN));
  416. }
  417. static void
  418. add_el(Element *e, Sequence *s)
  419. {
  420. if (e->n->ntyp == GOTO)
  421. { Symbol *z = has_lab(e, (1|2|4));
  422. if (z)
  423. { Element *y; /* insert a skip */
  424. y = mk_skip();
  425. mov_lab(z, e, y); /* inherit label */
  426. add_el(y, s);
  427. } }
  428. #ifdef DEBUG
  429. printf("add_el %d after %d -- ",
  430. e->Seqno, (s->last)?s->last->Seqno:-1);
  431. comment(stdout, e->n, 0);
  432. printf("\n");
  433. #endif
  434. if (!s->frst)
  435. s->frst = e;
  436. else
  437. s->last->nxt = e;
  438. s->last = e;
  439. }
  440. static Element *
  441. colons(Lextok *n)
  442. {
  443. if (!n)
  444. return ZE;
  445. if (n->ntyp == ':')
  446. { Element *e = colons(n->lft);
  447. set_lab(n->sym, e);
  448. return e;
  449. }
  450. innermost = n;
  451. return new_el(n);
  452. }
  453. void
  454. add_seq(Lextok *n)
  455. { Element *e;
  456. if (!n) return;
  457. innermost = n;
  458. e = colons(n);
  459. if (innermost->ntyp != IF
  460. && innermost->ntyp != DO
  461. && innermost->ntyp != UNLESS)
  462. add_el(e, cur_s->this);
  463. }
  464. void
  465. set_lab(Symbol *s, Element *e)
  466. { Label *l; extern Symbol *context;
  467. if (!s) return;
  468. for (l = labtab; l; l = l->nxt)
  469. if (l->s == s && l->c == context)
  470. { non_fatal("label %s redeclared", s->name);
  471. break;
  472. }
  473. l = (Label *) emalloc(sizeof(Label));
  474. l->s = s;
  475. l->c = context;
  476. l->e = e;
  477. l->nxt = labtab;
  478. labtab = l;
  479. }
  480. Element *
  481. get_lab(Lextok *n, int md)
  482. { Label *l;
  483. Symbol *s = n->sym;
  484. for (l = labtab; l; l = l->nxt)
  485. if (s == l->s)
  486. return (l->e);
  487. lineno = n->ln;
  488. Fname = n->fn;
  489. if (md) fatal("undefined label %s", s->name);
  490. return ZE;
  491. }
  492. Symbol *
  493. has_lab(Element *e, int special)
  494. { Label *l;
  495. for (l = labtab; l; l = l->nxt)
  496. { if (e != l->e)
  497. continue;
  498. if (special == 0
  499. || ((special&1) && !strncmp(l->s->name, "accept", 6))
  500. || ((special&2) && !strncmp(l->s->name, "end", 3))
  501. || ((special&4) && !strncmp(l->s->name, "progress", 8)))
  502. return (l->s);
  503. }
  504. return ZS;
  505. }
  506. static void
  507. mov_lab(Symbol *z, Element *e, Element *y)
  508. { Label *l;
  509. for (l = labtab; l; l = l->nxt)
  510. if (e == l->e)
  511. { l->e = y;
  512. return;
  513. }
  514. if (e->n)
  515. { lineno = e->n->ln;
  516. Fname = e->n->fn;
  517. }
  518. fatal("cannot happen - mov_lab %s", z->name);
  519. }
  520. void
  521. fix_dest(Symbol *c, Symbol *a) /* label, proctype */
  522. { Label *l; extern Symbol *context;
  523. for (l = labtab; l; l = l->nxt)
  524. { if (strcmp(c->name, l->s->name) == 0
  525. && strcmp(a->name, l->c->name) == 0)
  526. break;
  527. }
  528. if (!l)
  529. { printf("spin: label '%s' (proctype %s)\n", c->name, a->name);
  530. non_fatal("unknown label '%s'", c->name);
  531. if (context == a)
  532. printf("spin: cannot remote ref a label inside the same proctype\n");
  533. return;
  534. }
  535. if (!l->e || !l->e->n)
  536. fatal("fix_dest error (%s)", c->name);
  537. if (l->e->n->ntyp == GOTO)
  538. { Element *y = (Element *) emalloc(sizeof(Element));
  539. int keep_ln = l->e->n->ln;
  540. Symbol *keep_fn = l->e->n->fn;
  541. /* insert skip - or target is optimized away */
  542. y->n = l->e->n; /* copy of the goto */
  543. y->seqno = find_maxel(a); /* unique seqno within proc */
  544. y->nxt = l->e->nxt;
  545. y->Seqno = Unique++; y->Nxt = Al_El; Al_El = y;
  546. /* turn the original element+seqno into a skip */
  547. l->e->n = nn(ZN, 'c', nn(ZN, CONST, ZN, ZN), ZN);
  548. l->e->n->ln = l->e->n->lft->ln = keep_ln;
  549. l->e->n->fn = l->e->n->lft->fn = keep_fn;
  550. l->e->n->lft->val = 1;
  551. l->e->nxt = y; /* append the goto */
  552. }
  553. l->e->status |= CHECK2; /* treat as if global */
  554. }
  555. int
  556. find_lab(Symbol *s, Symbol *c, int markit)
  557. { Label *l;
  558. for (l = labtab; l; l = l->nxt)
  559. { if (strcmp(s->name, l->s->name) == 0
  560. && strcmp(c->name, l->c->name) == 0)
  561. { l->visible |= markit;
  562. return (l->e->seqno);
  563. } }
  564. return 0;
  565. }
  566. void
  567. pushbreak(void)
  568. { Lbreak *r = (Lbreak *) emalloc(sizeof(Lbreak));
  569. Symbol *l;
  570. char buf[64];
  571. sprintf(buf, ":b%d", break_id++);
  572. l = lookup(buf);
  573. r->l = l;
  574. r->nxt = breakstack;
  575. breakstack = r;
  576. }
  577. Symbol *
  578. break_dest(void)
  579. {
  580. if (!breakstack)
  581. fatal("misplaced break statement", (char *)0);
  582. return breakstack->l;
  583. }
  584. void
  585. make_atomic(Sequence *s, int added)
  586. {
  587. walk_atomic(s->frst, s->last, added);
  588. s->last->status &= ~ATOM;
  589. s->last->status |= L_ATOM;
  590. }
  591. static void
  592. walk_atomic(Element *a, Element *b, int added)
  593. { Element *f; Symbol *ofn; int oln;
  594. SeqList *h;
  595. ofn = Fname;
  596. oln = lineno;
  597. for (f = a; ; f = f->nxt)
  598. { f->status |= (ATOM|added);
  599. switch (f->n->ntyp) {
  600. case ATOMIC:
  601. if (verbose&32)
  602. printf("spin: warning, line %3d %s, atomic inside %s (ignored)\n",
  603. f->n->ln, f->n->fn->name, (added)?"d_step":"atomic");
  604. goto mknonat;
  605. case D_STEP:
  606. if (!(verbose&32))
  607. { if (added) goto mknonat;
  608. break;
  609. }
  610. printf("spin: warning, line %3d %s, d_step inside ",
  611. f->n->ln, f->n->fn->name);
  612. if (added)
  613. { printf("d_step (ignored)\n");
  614. goto mknonat;
  615. }
  616. printf("atomic\n");
  617. break;
  618. case NON_ATOMIC:
  619. mknonat: f->n->ntyp = NON_ATOMIC; /* can jump here */
  620. h = f->n->sl;
  621. walk_atomic(h->this->frst, h->this->last, added);
  622. break;
  623. }
  624. for (h = f->sub; h; h = h->nxt)
  625. walk_atomic(h->this->frst, h->this->last, added);
  626. if (f == b)
  627. break;
  628. }
  629. Fname = ofn;
  630. lineno = oln;
  631. }
  632. void
  633. dumplabels(void)
  634. { Label *l;
  635. for (l = labtab; l; l = l->nxt)
  636. if (l->c != 0 && l->s->name[0] != ':')
  637. printf("label %s %d <%s>\n",
  638. l->s->name, l->e->seqno, l->c->name);
  639. }