github.com/spotify/syslog-redirector-golang@v0.0.0-20140320174030-4859f03d829a/src/cmd/8g/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 "../8l/8.out.h" 11 12 typedef struct Addr Addr; 13 14 struct Addr 15 { 16 int32 offset; 17 int32 offset2; 18 19 union { 20 double dval; 21 vlong vval; 22 Prog* branch; 23 char sval[NSNAME]; 24 } u; 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 }; 35 #define A ((Addr*)0) 36 37 struct Prog 38 { 39 short as; // opcode 40 uint32 loc; // pc offset in this func 41 uint32 lineno; // source line that generated this 42 Addr from; // src address 43 Addr to; // dst address 44 Prog* link; // next instruction in this func 45 void* opt; // for optimizer passes 46 }; 47 48 #define TEXTFLAG from.scale 49 50 // foptoas flags 51 enum 52 { 53 Frev = 1<<0, 54 Fpop = 1<<1, 55 Fpop2 = 1<<2, 56 }; 57 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 Prog zprog; 64 EXTERN Node* newproc; 65 EXTERN Node* deferproc; 66 EXTERN Node* deferreturn; 67 EXTERN Node* panicindex; 68 EXTERN Node* panicslice; 69 EXTERN Node* throwreturn; 70 EXTERN int maxstksize; 71 extern uint32 unmappedzero; 72 73 74 /* 75 * ggen.c 76 */ 77 void compile(Node*); 78 void gen(Node*); 79 Node* lookdot(Node*, Node*, int); 80 void cgen_as(Node*, Node*); 81 void cgen_callmeth(Node*, int); 82 void cgen_callinter(Node*, Node*, int); 83 void cgen_proc(Node*, int); 84 void cgen_callret(Node*, Node*); 85 void cgen_div(int, Node*, Node*, Node*); 86 void cgen_bmul(int, Node*, Node*, Node*); 87 void cgen_hmul(Node*, Node*, Node*); 88 void cgen_shift(int, int, Node*, Node*, Node*); 89 void cgen_float(Node*, Node*); 90 void bgen_float(Node *n, int true, int likely, Prog *to); 91 void cgen_dcl(Node*); 92 int needconvert(Type*, Type*); 93 void genconv(Type*, Type*); 94 void allocparams(void); 95 void checklabels(void); 96 void ginscall(Node*, int); 97 98 /* 99 * cgen.c 100 */ 101 void agen(Node*, Node*); 102 void igen(Node*, Node*, Node*); 103 vlong fieldoffset(Type*, Node*); 104 void sgen(Node*, Node*, int64); 105 void gmove(Node*, Node*); 106 Prog* gins(int, Node*, Node*); 107 int samaddr(Node*, Node*); 108 void naddr(Node*, Addr*, int); 109 void cgen_aret(Node*, Node*); 110 Node* ncon(uint32); 111 void mgen(Node*, Node*, Node*); 112 void mfree(Node*); 113 int componentgen(Node*, Node*); 114 115 /* 116 * cgen64.c 117 */ 118 void cmp64(Node*, Node*, int, int, Prog*); 119 void cgen64(Node*, Node*); 120 121 /* 122 * gsubr.c 123 */ 124 void clearp(Prog*); 125 Prog* gbranch(int, Type*, int); 126 Prog* prog(int); 127 void gconv(int, int); 128 int conv2pt(Type*); 129 vlong convvtox(vlong, int); 130 void fnparam(Type*, int, int); 131 Prog* gop(int, Node*, Node*, Node*); 132 int optoas(int, Type*); 133 int foptoas(int, Type*, int); 134 void ginit(void); 135 void gclean(void); 136 void regalloc(Node*, Type*, Node*); 137 void regfree(Node*); 138 Node* nodarg(Type*, int); 139 void nodreg(Node*, Type*, int); 140 void nodindreg(Node*, Type*, int); 141 void nodconst(Node*, Type*, int64); 142 void gconreg(int, vlong, int); 143 void buildtxt(void); 144 Plist* newplist(void); 145 int isfat(Type*); 146 void sudoclean(void); 147 int sudoaddable(int, Node*, Addr*); 148 int dotaddable(Node*, Node*); 149 void afunclit(Addr*, Node*); 150 void split64(Node*, Node*, Node*); 151 void splitclean(void); 152 void nswap(Node*, Node*); 153 void gtrack(Sym*); 154 void gargsize(int32); 155 /* 156 * cplx.c 157 */ 158 int complexop(Node*, Node*); 159 void complexmove(Node*, Node*); 160 void complexgen(Node*, Node*); 161 162 /* 163 * gobj.c 164 */ 165 void datastring(char*, int, Addr*); 166 void datagostring(Strlit*, Addr*); 167 168 /* 169 * list.c 170 */ 171 int Aconv(Fmt*); 172 int Dconv(Fmt*); 173 int Pconv(Fmt*); 174 int Rconv(Fmt*); 175 int Yconv(Fmt*); 176 void listinit(void); 177 178 void zaddr(Biobuf*, Addr*, int, int); 179 180 #pragma varargck type "D" Addr* 181 #pragma varargck type "lD" Addr*