github.com/xushiwei/go@v0.0.0-20130601165731-2b9d83f45bc9/src/cmd/6g/gg.h (about) 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 #ifndef EXTERN 6 #define EXTERN extern 7 #endif 8 9 #include "../gc/go.h" 10 #include "../6l/6.out.h" 11 12 typedef struct Addr Addr; 13 14 struct Addr 15 { 16 vlong offset; 17 18 union { 19 double dval; 20 vlong vval; 21 Prog* branch; 22 char sval[NSNAME]; 23 } u; 24 25 Sym* gotype; 26 Sym* sym; 27 Node* node; 28 int64 width; 29 uchar type; 30 uchar index; 31 uchar etype; 32 uchar scale; /* doubles as width in DATA op */ 33 }; 34 #define A ((Addr*)0) 35 36 struct Prog 37 { 38 short as; // opcode 39 uint32 loc; // pc offset in this func 40 uint32 lineno; // source line that generated this 41 Addr from; // src address 42 Addr to; // dst address 43 Prog* link; // next instruction in this func 44 void* reg; // pointer to containing Reg struct 45 }; 46 47 #define TEXTFLAG from.scale 48 49 EXTERN int32 dynloc; 50 EXTERN uchar reg[D_NONE]; 51 EXTERN int32 pcloc; // instruction counter 52 EXTERN Strlit emptystring; 53 extern char* anames[]; 54 EXTERN Prog zprog; 55 EXTERN Node* newproc; 56 EXTERN Node* deferproc; 57 EXTERN Node* deferreturn; 58 EXTERN Node* panicindex; 59 EXTERN Node* panicslice; 60 EXTERN Node* throwreturn; 61 extern vlong unmappedzero; 62 63 /* 64 * ggen.c 65 */ 66 void compile(Node*); 67 void proglist(void); 68 void gen(Node*); 69 Node* lookdot(Node*, Node*, int); 70 void cgen_as(Node*, Node*); 71 void cgen_callmeth(Node*, int); 72 void cgen_callinter(Node*, Node*, int); 73 void cgen_proc(Node*, int); 74 void cgen_callret(Node*, Node*); 75 void cgen_div(int, Node*, Node*, Node*); 76 void cgen_bmul(int, Node*, Node*, Node*); 77 void cgen_hmul(Node*, Node*, Node*); 78 void cgen_shift(int, int, Node*, Node*, Node*); 79 void cgen_dcl(Node*); 80 int needconvert(Type*, Type*); 81 void genconv(Type*, Type*); 82 void allocparams(void); 83 void checklabels(void); 84 void ginscall(Node*, int); 85 int gen_as_init(Node*); 86 void clearslim(Node*); 87 88 /* 89 * cgen.c 90 */ 91 void agen(Node*, Node*); 92 void agenr(Node*, Node*, Node*); 93 void cgenr(Node*, Node*, Node*); 94 void igen(Node*, Node*, Node*); 95 vlong fieldoffset(Type*, Node*); 96 void sgen(Node*, Node*, int64); 97 void gmove(Node*, Node*); 98 Prog* gins(int, Node*, Node*); 99 int samaddr(Node*, Node*); 100 void naddr(Node*, Addr*, int); 101 void cgen_aret(Node*, Node*); 102 void restx(Node*, Node*); 103 void savex(int, Node*, Node*, Node*, Type*); 104 int componentgen(Node*, Node*); 105 106 /* 107 * gsubr.c 108 */ 109 void clearp(Prog*); 110 void proglist(void); 111 Prog* gbranch(int, Type*, int); 112 Prog* prog(int); 113 void gconv(int, int); 114 int conv2pt(Type*); 115 vlong convvtox(vlong, int); 116 void fnparam(Type*, int, int); 117 Prog* gop(int, Node*, Node*, Node*); 118 int optoas(int, Type*); 119 void ginit(void); 120 void gclean(void); 121 void regalloc(Node*, Type*, Node*); 122 void regfree(Node*); 123 Node* nodarg(Type*, int); 124 void nodreg(Node*, Type*, int); 125 void nodindreg(Node*, Type*, int); 126 void gconreg(int, vlong, int); 127 void ginscon(int, vlong, Node*); 128 void buildtxt(void); 129 Plist* newplist(void); 130 int isfat(Type*); 131 void sudoclean(void); 132 int sudoaddable(int, Node*, Addr*); 133 void afunclit(Addr*, Node*); 134 void nodfconst(Node*, Type*, Mpflt*); 135 void gtrack(Sym*); 136 137 /* 138 * cplx.c 139 */ 140 int complexop(Node*, Node*); 141 void complexmove(Node*, Node*); 142 void complexgen(Node*, Node*); 143 144 /* 145 * gobj.c 146 */ 147 void datastring(char*, int, Addr*); 148 void datagostring(Strlit*, Addr*); 149 150 /* 151 * list.c 152 */ 153 int Aconv(Fmt*); 154 int Dconv(Fmt*); 155 int Pconv(Fmt*); 156 int Rconv(Fmt*); 157 int Yconv(Fmt*); 158 void listinit(void); 159 160 void zaddr(Biobuf*, Addr*, int, int); 161 162 #pragma varargck type "D" Addr* 163 #pragma varargck type "lD" Addr*