The Go Programming Language

Text file src/cmd/8g/gg.h

     1	// Copyright 2009 The Go Authors. All rights reserved.
     2	// Use of this source code is governed by a BSD-style
     3	// license that can be found in the LICENSE file.
     4	
     5	#include <u.h>
     6	#include <libc.h>
     7	
     8	#include "../gc/go.h"
     9	#include "../8l/8.out.h"
    10	
    11	#ifndef	EXTERN
    12	#define	EXTERN	extern
    13	#endif
    14	
    15	typedef	struct	Addr	Addr;
    16	
    17	struct	Addr
    18	{
    19		int32	offset;
    20		int32	offset2;
    21	
    22		double	dval;
    23		Prog*	branch;
    24		char	sval[NSNAME];
    25	
    26		Sym*	gotype;
    27		Sym*	sym;
    28		Node*	node;
    29		int	width;
    30		uchar	type;
    31		uchar	index;
    32		uchar	etype;
    33		uchar	scale;	/* doubles as width in DATA op */
    34		uchar	pun;	/* dont register variable */
    35	};
    36	#define	A	((Addr*)0)
    37	
    38	struct	Prog
    39	{
    40		short	as;		// opcode
    41		uint32	loc;		// pc offset in this func
    42		uint32	lineno;		// source line that generated this
    43		Addr	from;		// src address
    44		Addr	to;		// dst address
    45		Prog*	link;		// next instruction in this func
    46		void*	reg;		// pointer to containing Reg struct
    47	};
    48	
    49	// foptoas flags
    50	enum
    51	{
    52		Frev = 1<<0,
    53		Fpop = 1<<1,
    54		Fpop2 = 1<<2,
    55	};
    56	
    57	EXTERN	Biobuf*	bout;
    58	EXTERN	int32	dynloc;
    59	EXTERN	uchar	reg[D_NONE];
    60	EXTERN	int32	pcloc;		// instruction counter
    61	EXTERN	Strlit	emptystring;
    62	extern	char*	anames[];
    63	EXTERN	Hist*	hist;
    64	EXTERN	Prog	zprog;
    65	EXTERN	Node*	curfn;
    66	EXTERN	Node*	newproc;
    67	EXTERN	Node*	deferproc;
    68	EXTERN	Node*	deferreturn;
    69	EXTERN	Node*	panicindex;
    70	EXTERN	Node*	panicslice;
    71	EXTERN	Node*	throwreturn;
    72	EXTERN	int	maxstksize;
    73	extern	uint32	unmappedzero;
    74	
    75	
    76	/*
    77	 * ggen.c
    78	 */
    79	void	compile(Node*);
    80	void	proglist(void);
    81	void	gen(Node*);
    82	Node*	lookdot(Node*, Node*, int);
    83	void	cgen_as(Node*, Node*);
    84	void	cgen_callmeth(Node*, int);
    85	void	cgen_callinter(Node*, Node*, int);
    86	void	cgen_proc(Node*, int);
    87	void	cgen_callret(Node*, Node*);
    88	void	cgen_div(int, Node*, Node*, Node*);
    89	void	cgen_bmul(int, Node*, Node*, Node*);
    90	void	cgen_shift(int, Node*, Node*, Node*);
    91	void	cgen_dcl(Node*);
    92	int	needconvert(Type*, Type*);
    93	void	genconv(Type*, Type*);
    94	void	allocparams(void);
    95	void	checklabels();
    96	void	ginscall(Node*, int);
    97	
    98	/*
    99	 * cgen.c
   100	 */
   101	void	agen(Node*, Node*);
   102	void	agenr(Node *n, Node *a, Node *res);
   103	void	igen(Node*, Node*, Node*);
   104	vlong	fieldoffset(Type*, Node*);
   105	void	bgen(Node*, int, Prog*);
   106	void	sgen(Node*, Node*, int32);
   107	void	gmove(Node*, Node*);
   108	Prog*	gins(int, Node*, Node*);
   109	int	samaddr(Node*, Node*);
   110	void	naddr(Node*, Addr*, int);
   111	void	cgen_aret(Node*, Node*);
   112	int	cgen_inline(Node*, Node*);
   113	Node*	ncon(uint32);
   114	void	mgen(Node*, Node*, Node*);
   115	void	mfree(Node*);
   116	
   117	/*
   118	 * cgen64.c
   119	 */
   120	void	cmp64(Node*, Node*, int, Prog*);
   121	void	cgen64(Node*, Node*);
   122	
   123	/*
   124	 * gsubr.c
   125	 */
   126	void	clearp(Prog*);
   127	void	proglist(void);
   128	Prog*	gbranch(int, Type*);
   129	Prog*	prog(int);
   130	void	gaddoffset(Node*);
   131	void	gconv(int, int);
   132	int	conv2pt(Type*);
   133	vlong	convvtox(vlong, int);
   134	void	fnparam(Type*, int, int);
   135	Prog*	gop(int, Node*, Node*, Node*);
   136	void	setconst(Addr*, vlong);
   137	void	setaddr(Addr*, Node*);
   138	int	optoas(int, Type*);
   139	int	foptoas(int, Type*, int);
   140	void	ginit(void);
   141	void	gclean(void);
   142	void	regalloc(Node*, Type*, Node*);
   143	void	regfree(Node*);
   144	Node*	nodarg(Type*, int);
   145	void	nodreg(Node*, Type*, int);
   146	void	nodindreg(Node*, Type*, int);
   147	void	nodconst(Node*, Type*, int64);
   148	void	gconreg(int, vlong, int);
   149	void	datagostring(Strlit*, Addr*);
   150	void	datastring(char*, int, Addr*);
   151	void	buildtxt(void);
   152	Plist*	newplist(void);
   153	int	isfat(Type*);
   154	void	sudoclean(void);
   155	int	sudoaddable(int, Node*, Addr*);
   156	int	dotaddable(Node*, Node*);
   157	void	afunclit(Addr*);
   158	void	split64(Node*, Node*, Node*);
   159	void	splitclean(void);
   160	void	nswap(Node*, Node*);
   161	
   162	/*
   163	 * cplx.c
   164	 */
   165	int	complexop(Node*, Node*);
   166	void	complexmove(Node*, Node*);
   167	void	complexgen(Node*, Node*);
   168	void	complexbool(int, Node*, Node*, int, Prog*);
   169	
   170	/*
   171	 * gobj.c
   172	 */
   173	void	data(void);
   174	void	text(void);
   175	
   176	/*
   177	 * list.c
   178	 */
   179	int	Aconv(Fmt*);
   180	int	Dconv(Fmt*);
   181	int	Pconv(Fmt*);
   182	int	Rconv(Fmt*);
   183	int	Yconv(Fmt*);
   184	void	listinit(void);
   185	
   186	void	zaddr(Biobuf*, Addr*, int, int);
   187	

release.r60.3. Except as noted, this content is licensed under a Creative Commons Attribution 3.0 License.