github.com/rohankumardubey/syslog-redirector-golang@v0.0.0-20140320174030-4859f03d829a/src/cmd/5g/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 "../5l/5.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* sym; 27 Sym* gotype; 28 Node* node; 29 int width; 30 uchar type; 31 char name; 32 uchar reg; 33 uchar etype; 34 }; 35 #define A ((Addr*)0) 36 37 struct Prog 38 { 39 uint32 loc; // pc offset in this func 40 uint32 lineno; // source line that generated this 41 Prog* link; // next instruction in this func 42 void* opt; // for optimizer passes 43 short as; // opcode 44 uchar reg; // doubles as width in DATA op 45 uchar scond; 46 Addr from; // src address 47 Addr to; // dst address 48 }; 49 50 #define TEXTFLAG reg 51 52 #define REGALLOC_R0 0 53 #define REGALLOC_RMAX REGEXT 54 #define REGALLOC_F0 NREG 55 #define REGALLOC_FMAX (REGALLOC_F0 + FREGEXT) 56 57 EXTERN int32 dynloc; 58 EXTERN uchar reg[REGALLOC_FMAX+1]; 59 EXTERN int32 pcloc; // instruction counter 60 EXTERN Strlit emptystring; 61 extern char* anames[]; 62 EXTERN Prog zprog; 63 EXTERN Node* newproc; 64 EXTERN Node* deferproc; 65 EXTERN Node* deferreturn; 66 EXTERN Node* panicindex; 67 EXTERN Node* panicslice; 68 EXTERN Node* throwreturn; 69 extern long unmappedzero; 70 EXTERN int maxstksize; 71 72 /* 73 * gen.c 74 */ 75 void compile(Node*); 76 void gen(Node*); 77 Node* lookdot(Node*, Node*, int); 78 void cgen_as(Node*, Node*); 79 void cgen_callmeth(Node*, int); 80 void cgen_callinter(Node*, Node*, int); 81 void cgen_proc(Node*, int); 82 void cgen_callret(Node*, Node*); 83 void cgen_dcl(Node*); 84 int needconvert(Type*, Type*); 85 void genconv(Type*, Type*); 86 void allocparams(void); 87 void checklabels(void); 88 void ginscall(Node*, int); 89 90 /* 91 * cgen 92 */ 93 void agen(Node*, Node*); 94 Prog* cgenindex(Node *, Node *, int); 95 void igen(Node*, Node*, Node*); 96 void agenr(Node *n, Node *a, Node *res); 97 vlong fieldoffset(Type*, Node*); 98 void sgen(Node*, Node*, int64); 99 void gmove(Node*, Node*); 100 Prog* gins(int, Node*, Node*); 101 int samaddr(Node*, Node*); 102 void raddr(Node *n, Prog *p); 103 Prog* gcmp(int, Node*, Node*); 104 Prog* gshift(int as, Node *lhs, int32 stype, int32 sval, Node *rhs); 105 Prog * gregshift(int as, Node *lhs, int32 stype, Node *reg, Node *rhs); 106 void naddr(Node*, Addr*, int); 107 void cgen_aret(Node*, Node*); 108 void cgen_hmul(Node*, Node*, Node*); 109 void cgen_shift(int, int, Node*, Node*, Node*); 110 int componentgen(Node*, Node*); 111 112 /* 113 * cgen64.c 114 */ 115 void cmp64(Node*, Node*, int, int, Prog*); 116 void cgen64(Node*, Node*); 117 118 /* 119 * gsubr.c 120 */ 121 void clearp(Prog*); 122 Prog* gbranch(int, Type*, int); 123 Prog* prog(int); 124 void gconv(int, int); 125 int conv2pt(Type*); 126 vlong convvtox(vlong, int); 127 void fnparam(Type*, int, int); 128 Prog* gop(int, Node*, Node*, Node*); 129 int optoas(int, Type*); 130 void ginit(void); 131 void gclean(void); 132 void regalloc(Node*, Type*, Node*); 133 void regfree(Node*); 134 Node* nodarg(Type*, int); 135 void nodreg(Node*, Type*, int); 136 void nodindreg(Node*, Type*, int); 137 void buildtxt(void); 138 Plist* newplist(void); 139 int isfat(Type*); 140 int dotaddable(Node*, Node*); 141 void sudoclean(void); 142 int sudoaddable(int, Node*, Addr*, int*); 143 void afunclit(Addr*, Node*); 144 void datagostring(Strlit*, Addr*); 145 void split64(Node*, Node*, Node*); 146 void splitclean(void); 147 Node* ncon(uint32 i); 148 void gtrack(Sym*); 149 void gargsize(int32); 150 151 /* 152 * obj.c 153 */ 154 void datastring(char*, int, Addr*); 155 156 /* 157 * list.c 158 */ 159 int Aconv(Fmt*); 160 int Cconv(Fmt*); 161 int Dconv(Fmt*); 162 int Mconv(Fmt*); 163 int Pconv(Fmt*); 164 int Rconv(Fmt*); 165 int Yconv(Fmt*); 166 void listinit(void); 167 168 void zaddr(Biobuf*, Addr*, int, int); 169 170 #pragma varargck type "D" Addr* 171 #pragma varargck type "M" Addr*