1/*	Id: pass1.h,v 1.291 2016/02/09 17:57:35 ragge Exp 	*/
2/*	$NetBSD: pass1.h,v 1.5 2016/02/09 20:37:32 plunky Exp $	*/
3/*
4 * Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * Redistributions of source code and documentation must retain the above
11 * copyright notice, this list of conditions and the following disclaimer.
12 * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditionsand the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * 	This product includes software developed or owned by Caldera
18 *	International, Inc.
19 * Neither the name of Caldera International, Inc. nor the names of other
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
24 * INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED.  IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE
28 * FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT,
32 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
33 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#include "config.h"
38
39#include <sys/types.h>
40#include <stdarg.h>
41#include <string.h>
42#ifdef HAVE_STDINT_H
43#include <stdint.h>
44#endif
45#include <stdlib.h>
46
47#ifndef MKEXT
48#include "external.h"
49#else
50typedef unsigned int bittype; /* XXX - for basicblock */
51#endif
52#include "manifest.h"
53#include "softfloat.h"
54
55/*
56 * Storage classes
57 */
58#define SNULL		0
59#define AUTO		1
60#define EXTERN		2
61#define STATIC		3
62#define REGISTER	4
63#define EXTDEF		5
64#define THLOCAL		6
65#define KEYWORD		7
66#define MOS		8
67#define PARAM		9
68#define STNAME		10
69#define MOU		11
70#define UNAME		12
71#define TYPEDEF		13
72/* #define FORTRAN		14 */
73#define ENAME		15
74#define MOE		16
75/* #define UFORTRAN 	17 */
76#define USTATIC		18
77
78	/* field size is ORed in */
79#define FIELD		0200
80#define FLDSIZ		0177
81extern	char *scnames(int);
82
83/*
84 * Symbol table flags
85 */
86#define	SNORMAL		0
87#define	STAGNAME	01
88#define	SLBLNAME	02
89#define	SMOSNAME	03
90#define	SSTRING		04
91#define	NSTYPES		05
92#define	SMASK		07
93
94#define	STLS		00010	/* Thread Local Support variable */
95#define SINSYS		00020	/* Declared in system header */
96#define	SSTMT		SINSYS	/* Allocate symtab on statement stack */
97#define SNOCREAT	00040	/* don't create a symbol in lookup() */
98#define STEMP		00100	/* Allocate symtab from temp or perm mem */
99#define	SDYNARRAY	00200	/* symbol is dynamic array on stack */
100#define	SINLINE		00400	/* function is of type inline */
101#define	SBLK		SINLINE	/* Allocate symtab from blk mem */
102#define	STNODE		01000	/* symbol shall be a temporary node */
103#define	SBUILTIN	02000	/* this is a builtin function */
104#define	SASG		04000	/* symbol is assigned to already */
105#define	SLOCAL1		010000
106#define	SLOCAL2		020000
107#define	SLOCAL3		040000
108
109	/* alignment of initialized quantities */
110#ifndef AL_INIT
111#define	AL_INIT ALINT
112#endif
113
114struct rstack;
115struct symtab;
116union arglist;
117#ifdef GCC_COMPAT
118struct gcc_attr_pack;
119#endif
120
121/*
122 * Dimension/prototype information.
123 * 	ddim > 0 holds the dimension of an array.
124 *	ddim < 0 is a dynamic array and refers to a tempnode.
125 *	...unless:
126 *		ddim == NOOFFSET, an array without dimenston, "[]"
127 *		ddim == -1, dynamic array while building before defid.
128 */
129union dimfun {
130	int	ddim;		/* Dimension of an array */
131	union arglist *dfun;	/* Prototype index */
132};
133
134/*
135 * Argument list member info when storing prototypes.
136 */
137union arglist {
138	TWORD type;
139	union dimfun *df;
140	struct attr *sap;
141};
142#define TNULL		INCREF(FARG) /* pointer to FARG -- impossible type */
143#define TELLIPSIS 	INCREF(INCREF(FARG))
144
145/*
146 * Symbol table definition.
147 */
148struct	symtab {
149	struct	symtab *snext;	/* link to other symbols in the same scope */
150	int	soffset;	/* offset or value */
151	char	sclass;		/* storage class */
152	char	slevel;		/* scope level */
153	short	sflags;		/* flags, see below */
154	char	*sname;		/* Symbol name */
155	TWORD	stype;		/* type word */
156	TWORD	squal;		/* qualifier word */
157	union	dimfun *sdf;	/* ptr to the dimension/prototype array */
158	struct	attr *sap;	/* the base type attribute list */
159};
160
161#define	ISSOU(ty)   ((ty) == STRTY || (ty) == UNIONTY)
162
163/*
164 * External definitions
165 */
166struct swents {			/* switch table */
167	struct swents *next;	/* Next struct in linked list */
168	CONSZ	sval;		/* case value */
169	int	slab;		/* associated label */
170};
171int mygenswitch(int, TWORD, struct swents **, int);
172
173extern	int blevel;
174extern	int oldstyle;
175
176extern	int lineno, nerrors, issyshdr;
177
178extern	char *ftitle;
179extern	struct symtab *cftnsp;
180extern	int autooff, maxautooff, argoff;
181
182extern	OFFSZ inoff;
183
184extern	int reached;
185extern	int isinlining;
186extern	int xinline, xgnu89, xgnu99;
187extern	int bdebug, ddebug, edebug, idebug, ndebug;
188extern	int odebug, pdebug, sdebug, tdebug, xdebug;
189
190/* various labels */
191extern	int brklab;
192extern	int contlab;
193extern	int flostat;
194extern	int retlab;
195extern	int doing_init, statinit;
196extern	short sztable[];
197extern	char *astypnames[];
198
199/* pragma globals */
200extern int pragma_allpacked, pragma_packed, pragma_aligned;
201
202/*
203 * Flags used in the (elementary) flow analysis ...
204 */
205#define FBRK		02
206#define FCONT		04
207#define FDEF		010
208#define FLOOP		020
209
210/*
211 * Location counters
212 */
213#define NOSEG		-1
214#define PROG		0		/* (ro) program segment */
215#define DATA		1		/* (rw) data segment */
216#define RDATA		2		/* (ro) data segment */
217#define LDATA		3		/* (rw) local data */
218#define UDATA		4		/* (rw) uninitialized data */
219#define STRNG		5		/* (ro) string segment */
220#define PICDATA		6		/* (rw) relocatable data segment */
221#define PICRDATA	7		/* (ro) relocatable data segment */
222#define PICLDATA	8		/* (rw) local relocatable data */
223#define TLSDATA		9		/* (rw) TLS data segment */
224#define TLSUDATA	10		/* (rw) TLS uninitialized segment */
225#define CTORS		11		/* constructor */
226#define DTORS		12		/* destructor */
227#define	NMSEG		13		/* other (named) segment */
228
229extern int lastloc;
230void locctr(int type, struct symtab *sp);
231void setseg(int type, char *name);
232void defalign(int al);
233void symdirec(struct symtab *sp);
234
235/*
236 * Tree struct for pass1.
237 */
238typedef struct p1node {
239	int	n_op;
240	TWORD	n_type;
241	TWORD	n_qual;
242	union {
243		char *	_name;
244		union	dimfun *_df;
245	} n_5;
246	struct attr *n_ap;
247	union {
248		struct {
249			union {
250				struct p1node *_left;
251				CONSZ _val;
252			} n_l;
253			union {
254				struct p1node *_right;
255				int _rval;
256				struct symtab *_sp;
257			} n_r;
258		} n_u;
259		struct {
260			union flt *_dcon;
261			union flt *_ccon;
262		};
263	} n_f;
264} P1ND;
265
266#define glval(p)	((p)->n_f.n_u.n_l._val)
267#define slval(p,v)	((p)->n_f.n_u.n_l._val = (v))
268#define	n_ccon		n_f._ccon
269
270
271/*	mark an offset which is undefined */
272
273#define NOOFFSET	(-10201)
274
275/* declarations of various functions */
276extern	P1ND
277	*buildtree(int, P1ND *, P1ND *r),
278	*mkty(unsigned, union dimfun *, struct attr *),
279	*rstruct(char *, int),
280	*dclstruct(struct rstack *),
281	*strend(char *, TWORD),
282	*tymerge(P1ND *, P1ND *),
283	*stref(P1ND *),
284#ifdef WORD_ADDRESSED
285	*offcon(OFFSZ, TWORD, union dimfun *, struct attr *),
286#endif
287	*bcon(int),
288	*xbcon(CONSZ, struct symtab *, TWORD),
289	*bpsize(P1ND *),
290	*convert(P1ND *, int),
291	*pconvert(P1ND *),
292	*oconvert(P1ND *),
293	*ptmatch(P1ND *),
294	*makety(P1ND *, TWORD, TWORD, union dimfun *, struct attr *),
295	*block(int, P1ND *, P1ND *, TWORD, union dimfun *, struct attr *),
296	*doszof(P1ND *),
297	*p1alloc(void),
298	*optim(P1ND *),
299	*clocal(P1ND *),
300	*tempnode(int, TWORD, union dimfun *, struct attr *),
301	*eve(P1ND *),
302	*doacall(struct symtab *, P1ND *, P1ND *);
303P1ND	*intprom(P1ND *);
304OFFSZ	tsize(TWORD, union dimfun *, struct attr *),
305	psize(P1ND *);
306P1ND *	typenode(P1ND *new);
307void	spalloc(P1ND *, P1ND *, OFFSZ);
308char	*exname(char *);
309union flt *floatcon(char *);
310union flt *fhexcon(char *);
311P1ND	*bdty(int op, ...);
312extern struct rstack *rpole;
313
314int oalloc(struct symtab *, int *);
315void deflabel(char *, P1ND *);
316void gotolabel(char *);
317unsigned int esccon(char **);
318void inline_start(struct symtab *, int class);
319void inline_end(void);
320void inline_addarg(struct interpass *);
321void inline_ref(struct symtab *);
322void inline_prtout(void);
323void inline_args(struct symtab **, int);
324P1ND *inlinetree(struct symtab *, P1ND *, P1ND *);
325void ftnarg(P1ND *);
326struct rstack *bstruct(char *, int, P1ND *);
327void moedef(char *);
328void beginit(struct symtab *);
329void simpleinit(struct symtab *, P1ND *);
330struct symtab *lookup(char *, int);
331struct symtab *getsymtab(char *, int);
332char *addstring(char *);
333char *addname(char *);
334void symclear(int);
335struct symtab *hide(struct symtab *);
336void soumemb(P1ND *, char *, int);
337int talign(unsigned int, struct attr *);
338void bfcode(struct symtab **, int);
339int chkftn(union arglist *, union arglist *);
340void branch(int);
341void cbranch(P1ND *, P1ND *);
342void extdec(struct symtab *);
343void defzero(struct symtab *);
344int falloc(struct symtab *, int, P1ND *);
345TWORD ctype(TWORD);
346void inval(CONSZ, int, P1ND *);
347int ninval(CONSZ, int, P1ND *);
348void infld(CONSZ, int, CONSZ);
349void zbits(CONSZ, int);
350void instring(struct symtab *);
351void inwstring(struct symtab *);
352void plabel(int);
353void bjobcode(void);
354void ejobcode(int);
355void calldec(P1ND *, P1ND *);
356int cisreg(TWORD);
357void asginit(P1ND *);
358void desinit(P1ND *);
359void endinit(int);
360void endictx(void);
361void sspinit(void);
362void sspstart(void);
363void sspend(void);
364void ilbrace(void);
365void irbrace(void);
366CONSZ scalinit(P1ND *);
367void p1print(char *, ...);
368char *copst(int);
369int cdope(int);
370void myp2tree(P1ND *);
371void lcommprint(void), strprint(void);
372void lcommdel(struct symtab *);
373P1ND *funcode(P1ND *);
374struct symtab *enumhd(char *);
375P1ND *enumdcl(struct symtab *);
376P1ND *enumref(char *);
377CONSZ icons(P1ND *);
378CONSZ valcast(CONSZ v, TWORD t);
379int mypragma(char *);
380char *pragtok(char *);
381int eat(int);
382void fixdef(struct symtab *);
383int cqual(TWORD, TWORD);
384void defloc(struct symtab *);
385int fldchk(int);
386int nncon(P1ND *);
387void cunput(char);
388P1ND *nametree(struct symtab *sp);
389void pass1_lastchance(struct interpass *);
390void fldty(struct symtab *p);
391struct suedef *sueget(struct suedef *p);
392void complinit(void);
393void kwinit(void);
394P1ND *structref(P1ND *p, int f, char *name);
395P1ND *cxop(int op, P1ND *l, P1ND *r);
396P1ND *imop(int op, P1ND *l, P1ND *r);
397P1ND *cxelem(int op, P1ND *p);
398P1ND *cxconj(P1ND *p);
399P1ND *cxcast(P1ND *p1, P1ND *p2);
400P1ND *cxret(P1ND *p, P1ND *q);
401P1ND *imret(P1ND *p, P1ND *q);
402P1ND *cast(P1ND *p, TWORD t, TWORD q);
403P1ND *ccast(P1ND *p, TWORD t, TWORD u, union dimfun *df, struct attr *sue);
404int andable(P1ND *);
405int conval(P1ND *, int, P1ND *);
406int ispow2(CONSZ);
407void defid(P1ND *q, int class);
408void defid2(P1ND *q, int class, char *astr);
409void efcode(void);
410void ecomp(P1ND *p);
411int upoff(int size, int alignment, int *poff);
412void nidcl(P1ND *p, int class);
413void nidcl2(P1ND *p, int class, char *astr);
414void eprint(P1ND *, int, int *, int *);
415int uclass(int class);
416int notlval(P1ND *);
417void ecode(P1ND *p);
418void ftnend(void);
419void dclargs(void);
420int suemeq(struct attr *s1, struct attr *s2);
421struct symtab *strmemb(struct attr *ap);
422int yylex(void);
423void yyerror(char *);
424int pragmas_gcc(char *t);
425int concast(P1ND *p, TWORD t);
426char *stradd(char *old, char *new);
427#ifdef WORD_ADDRESSED
428#define rmpconv(p) (p)
429#else
430P1ND *rmpconv(P1ND *);
431#endif
432P1ND *optloop(P1ND *);
433P1ND *nlabel(int label);
434TWORD styp(void);
435void *stmtalloc(size_t);
436void *blkalloc(size_t);
437void stmtfree(void);
438void blkfree(void);
439char *getexname(struct symtab *sp);
440void putjops(P1ND *p, void *arg);
441
442void p1walkf(P1ND *, void (*f)(P1ND *, void *), void *);
443void p1fwalk(P1ND *t, void (*f)(P1ND *, int, int *, int *), int down);
444void p1listf(P1ND *p, void (*f)(P1ND *));
445void p1flist(P1ND *p, void (*f)(P1ND *, void *), void *);
446P1ND *p1nfree(P1ND *);
447void p1tfree(P1ND *);
448P1ND *p1tcopy(P1ND *);
449
450enum {	ATTR_FIRST = ATTR_MI_MAX + 1,
451
452	/* PCC used attributes */
453	ATTR_COMPLEX,	/* Internal definition of complex */
454	xxxATTR_BASETYP,	/* Internal; see below */
455	ATTR_QUALTYP,	/* Internal; const/volatile, see below */
456	ATTR_ALIGNED,	/* Internal; also used as gcc type attribute */
457	ATTR_NORETURN,	/* Function does not return */
458	ATTR_STRUCT,	/* Internal; element list */
459#define ATTR_MAX ATTR_STRUCT
460
461	ATTR_P1LABELS,	/* used to store stuff while parsing */
462	ATTR_SONAME,	/* output name of symbol */
463
464#ifdef GCC_COMPAT
465	/* type attributes */
466	GCC_ATYP_PACKED,
467	GCC_ATYP_SECTION,
468	GCC_ATYP_TRANSP_UNION,
469	GCC_ATYP_UNUSED,
470	GCC_ATYP_DEPRECATED,
471	GCC_ATYP_MAYALIAS,
472
473	/* variable attributes */
474	GCC_ATYP_MODE,
475
476	/* function attributes */
477	GCC_ATYP_FORMAT,
478	GCC_ATYP_NONNULL,
479	GCC_ATYP_SENTINEL,
480	GCC_ATYP_WEAK,
481	GCC_ATYP_FORMATARG,
482	GCC_ATYP_GNU_INLINE,
483	GCC_ATYP_MALLOC,
484	GCC_ATYP_NOTHROW,
485	GCC_ATYP_CONST,
486	GCC_ATYP_PURE,
487	GCC_ATYP_CONSTRUCTOR,
488	GCC_ATYP_DESTRUCTOR,
489	GCC_ATYP_VISIBILITY,
490	GCC_ATYP_WARN_UNUSED_RESULT,
491	GCC_ATYP_USED,
492	GCC_ATYP_NO_INSTR_FUN,
493	GCC_ATYP_NOINLINE,
494	GCC_ATYP_ALIAS,
495	GCC_ATYP_WEAKREF,
496	GCC_ATYP_ALLOCSZ,
497	GCC_ATYP_ALW_INL,
498	GCC_ATYP_TLSMODEL,
499	GCC_ATYP_ALIASWEAK,
500	GCC_ATYP_RETURNS_TWICE,
501	GCC_ATYP_WARNING,
502	GCC_ATYP_NOCLONE,
503	GCC_ATYP_REGPARM,
504	GCC_ATYP_FASTCALL,
505
506	/* other stuff */
507	GCC_ATYP_BOUNDED,	/* OpenBSD extra boundary checks */
508
509	/* OSX toolchain */
510	GCC_ATYP_WEAKIMPORT,
511
512	GCC_ATYP_MAX,
513#endif
514#ifdef ATTR_P1_TARGET
515	ATTR_P1_TARGET,
516#endif
517	ATTR_P1_MAX
518};
519
520/*
521#ifdef notdef
522 * ATTR_BASETYP has the following layout:
523 * aa[0].iarg has size
524 * aa[1].iarg has alignment
525#endif
526 * ATTR_QUALTYP has the following layout:
527 * aa[0].iarg has CON/VOL + FUN/ARY/PTR
528 * Not defined yet...
529 * aa[3].iarg is dimension for arrays (XXX future)
530 * aa[3].varg is function defs for functions.
531 */
532#ifdef notdef
533#define	atypsz	aa[0].iarg
534#define	aalign	aa[1].iarg
535#endif
536
537/*
538 * ATTR_STRUCT member list.
539 */
540#define amlist  aa[0].varg
541#define amsize  aa[1].iarg
542#define	strattr(x)	(attr_find(x, ATTR_STRUCT))
543
544void gcc_init(void);
545int gcc_keyword(char *);
546struct attr *gcc_attr_parse(P1ND *);
547void gcc_tcattrfix(P1ND *);
548struct gcc_attrib *gcc_get_attr(struct suedef *, int);
549void dump_attr(struct attr *gap);
550void gcc_modefix(P1ND *);
551P1ND *gcc_eval_timode(int op, P1ND *, P1ND *);
552P1ND *gcc_eval_ticast(int op, P1ND *, P1ND *);
553P1ND *gcc_eval_tiuni(int op, P1ND *);
554struct attr *isti(P1ND *p);
555
556#ifndef NO_C_BUILTINS
557struct bitable {
558	char *name;
559	P1ND *(*fun)(const struct bitable *, P1ND *a);
560	short flags;
561#define	BTNOPROTO	001
562#define	BTNORVAL	002
563#define	BTNOEVE		004
564#define	BTGNUONLY	010
565	short narg;
566	TWORD *tp;
567	TWORD rt;
568};
569
570P1ND *builtin_check(struct symtab *, P1ND *a);
571void builtin_init(void);
572
573/* Some builtins targets need to implement */
574P1ND *builtin_frame_address(const struct bitable *bt, P1ND *a);
575P1ND *builtin_return_address(const struct bitable *bt, P1ND *a);
576P1ND *builtin_cfa(const struct bitable *bt, P1ND *a);
577#endif
578
579
580#ifdef STABS
581void stabs_init(void);
582void stabs_file(char *);
583void stabs_efile(char *);
584void stabs_line(int);
585void stabs_rbrac(int);
586void stabs_lbrac(int);
587void stabs_func(struct symtab *);
588void stabs_newsym(struct symtab *);
589void stabs_chgsym(struct symtab *);
590void stabs_struct(struct symtab *, struct attr *);
591#endif
592
593#ifndef CHARCAST
594/* to make character constants into character connstants */
595/* this is a macro to defend against cross-compilers, etc. */
596#define CHARCAST(x) (char)(x)
597#endif
598
599/* sometimes int is smaller than pointers */
600#if SZPOINT(CHAR) <= SZINT
601#define INTPTR  INT
602#elif SZPOINT(CHAR) <= SZLONG
603#define INTPTR  LONG
604#elif SZPOINT(CHAR) <= SZLONGLONG
605#define INTPTR  LONGLONG
606#else
607#error int size unknown
608#endif
609
610/* Generate a bitmask from a given type size */
611#define SZMASK(y) ((((1LL << ((y)-1))-1) << 1) | 1)
612
613/*
614 * finction specifiers.
615 */
616#define	INLINE		1
617#define	NORETURN	2
618
619/*
620 * C compiler first pass extra defines.
621 */
622#define	QUALIFIER	(MAXOP+1)
623#define	CLASS		(MAXOP+2)
624#define	RB		(MAXOP+3)
625#define	DOT		(MAXOP+4)
626#define	ELLIPSIS	(MAXOP+5)
627#define	TYPE		(MAXOP+6)
628#define	LB		(MAXOP+7)
629#define	COMOP		(MAXOP+8)
630#define	QUEST		(MAXOP+9)
631#define	COLON		(MAXOP+10)
632#define	ANDAND		(MAXOP+11)
633#define	OROR		(MAXOP+12)
634#define	NOT		(MAXOP+13)
635#define	CAST		(MAXOP+14)
636#define	STRING		(MAXOP+15)
637
638/* The following must be in the same order as their NOASG counterparts */
639#define	PLUSEQ		(MAXOP+16)
640#define	MINUSEQ		(MAXOP+17)
641#define	DIVEQ		(MAXOP+18)
642#define	MODEQ		(MAXOP+19)
643#define	MULEQ		(MAXOP+20)
644#define	ANDEQ		(MAXOP+21)
645#define	OREQ		(MAXOP+22)
646#define	EREQ		(MAXOP+23)
647#define	LSEQ		(MAXOP+24)
648#define	RSEQ		(MAXOP+25)
649
650#define	UNASG		(-(PLUSEQ-PLUS))+
651
652#define INCR		(MAXOP+26)
653#define DECR		(MAXOP+27)
654#define SZOF		(MAXOP+28)
655#define CLOP		(MAXOP+29)
656#define ATTRIB		(MAXOP+30)
657#define XREAL		(MAXOP+31)
658#define XIMAG		(MAXOP+32)
659#define TYMERGE		(MAXOP+33)
660#define LABEL		(MAXOP+34)
661#define BIQUEST		(MAXOP+35)
662#define UPLUS		(MAXOP+36)
663#define ALIGN		(MAXOP+37)
664#define FUNSPEC		(MAXOP+38)
665#define STREF		(MAXOP+39)
666
667/*
668 * The following types are only used in pass1.
669 */
670#define SIGNED		(MAXTYPES+1)
671#define FARG		(MAXTYPES+2)
672#define	FIMAG		(MAXTYPES+3)
673#define	IMAG		(MAXTYPES+4)
674#define	LIMAG		(MAXTYPES+5)
675#define	FCOMPLEX	(MAXTYPES+6)
676#define	COMPLEX		(MAXTYPES+7)
677#define	LCOMPLEX	(MAXTYPES+8)
678#define	ENUMTY		(MAXTYPES+9)
679
680#define	ISFTY(x)	((x) >= FLOAT && (x) <= LDOUBLE)
681#define	ISCTY(x)	((x) >= FCOMPLEX && (x) <= LCOMPLEX)
682#define	ISITY(x)	((x) >= FIMAG && (x) <= LIMAG)
683#define ANYCX(p) (p->n_type == STRTY && attr_find(p->n_ap, ATTR_COMPLEX))
684
685#define coptype(o)	(cdope(o)&TYFLG)
686#define clogop(o)	(cdope(o)&LOGFLG)
687#define casgop(o)	(cdope(o)&ASGFLG)
688
689#ifdef TWOPASS
690#define	PRTPREF	"* "
691#else
692#define	PRTPREF ""
693#endif
694
695/*
696 * Allocation routines.
697 */
698#if defined(__PCC__) || defined(__GNUC__)
699#define	FUNALLO(x)	__builtin_alloca(x)
700#define	FUNFREE(x)
701#elif defined(HAVE_ALLOCA)
702#define FUNALLO(x)      alloca(x)
703#define FUNFREE(x)
704#else
705#define FUNALLO(x)	malloc(x)
706#define FUNFREE(x)	free(x)
707#endif
708