github.com/rohankumardubey/syslog-redirector-golang@v0.0.0-20140320174030-4859f03d829a/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* opt; // for optimizer passes 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 gen(Node*); 68 Node* lookdot(Node*, Node*, int); 69 void cgen_as(Node*, Node*); 70 void cgen_callmeth(Node*, int); 71 void cgen_callinter(Node*, Node*, int); 72 void cgen_proc(Node*, int); 73 void cgen_callret(Node*, Node*); 74 void cgen_div(int, Node*, Node*, Node*); 75 void cgen_bmul(int, Node*, Node*, Node*); 76 void cgen_hmul(Node*, Node*, Node*); 77 void cgen_shift(int, int, Node*, Node*, Node*); 78 void cgen_dcl(Node*); 79 int needconvert(Type*, Type*); 80 void genconv(Type*, Type*); 81 void allocparams(void); 82 void checklabels(void); 83 void ginscall(Node*, int); 84 int gen_as_init(Node*); 85 void clearslim(Node*); 86 87 /* 88 * cgen.c 89 */ 90 void agen(Node*, Node*); 91 void agenr(Node*, Node*, Node*); 92 void cgenr(Node*, Node*, Node*); 93 void igen(Node*, Node*, Node*); 94 vlong fieldoffset(Type*, Node*); 95 void sgen(Node*, Node*, int64); 96 void gmove(Node*, Node*); 97 Prog* gins(int, Node*, Node*); 98 int samaddr(Node*, Node*); 99 void naddr(Node*, Addr*, int); 100 void cgen_aret(Node*, Node*); 101 void restx(Node*, Node*); 102 void savex(int, Node*, Node*, Node*, Type*); 103 int componentgen(Node*, Node*); 104 105 /* 106 * gsubr.c 107 */ 108 void clearp(Prog*); 109 Prog* gbranch(int, Type*, int); 110 Prog* prog(int); 111 void gconv(int, int); 112 int conv2pt(Type*); 113 vlong convvtox(vlong, int); 114 void fnparam(Type*, int, int); 115 Prog* gop(int, Node*, Node*, Node*); 116 int optoas(int, Type*); 117 void ginit(void); 118 void gclean(void); 119 void regalloc(Node*, Type*, Node*); 120 void regfree(Node*); 121 Node* nodarg(Type*, int); 122 void nodreg(Node*, Type*, int); 123 void nodindreg(Node*, Type*, int); 124 void gconreg(int, vlong, int); 125 void ginscon(int, vlong, Node*); 126 void buildtxt(void); 127 Plist* newplist(void); 128 int isfat(Type*); 129 void sudoclean(void); 130 int sudoaddable(int, Node*, Addr*); 131 void afunclit(Addr*, Node*); 132 void nodfconst(Node*, Type*, Mpflt*); 133 void gtrack(Sym*); 134 void gargsize(vlong); 135 void fixlargeoffset(Node *n); 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*