github.com/varialus/godfly@v0.0.0-20130904042352-1934f9f095ab/src/cmd/gc/go.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 #include <bio.h> 6 7 #undef OAPPEND 8 9 // avoid <ctype.h> 10 #undef isblank 11 #define isblank goisblank 12 13 #ifndef EXTERN 14 #define EXTERN extern 15 #endif 16 17 #undef BUFSIZ 18 19 // The parser's maximum stack size. 20 // We have to use a #define macro here since yacc 21 // or bison will check for its definition and use 22 // a potentially smaller value if it is undefined. 23 #define YYMAXDEPTH 500 24 25 enum 26 { 27 NHUNK = 50000, 28 BUFSIZ = 8192, 29 NSYMB = 500, 30 NHASH = 1024, 31 STRINGSZ = 200, 32 MAXALIGN = 7, 33 UINF = 100, 34 HISTSZ = 10, 35 36 PRIME1 = 3, 37 38 AUNK = 100, 39 40 // These values are known by runtime. 41 // The MEMx and NOEQx values must run in parallel. See algtype. 42 AMEM = 0, 43 AMEM0, 44 AMEM8, 45 AMEM16, 46 AMEM32, 47 AMEM64, 48 AMEM128, 49 ANOEQ, 50 ANOEQ0, 51 ANOEQ8, 52 ANOEQ16, 53 ANOEQ32, 54 ANOEQ64, 55 ANOEQ128, 56 ASTRING, 57 AINTER, 58 ANILINTER, 59 ASLICE, 60 AFLOAT32, 61 AFLOAT64, 62 ACPLX64, 63 ACPLX128, 64 65 BADWIDTH = -1000000000, 66 67 MaxStackVarSize = 10*1024*1024, 68 }; 69 70 extern vlong MAXWIDTH; 71 72 /* 73 * note this is the representation 74 * of the compilers string literals, 75 * it is not the runtime representation 76 */ 77 typedef struct Strlit Strlit; 78 struct Strlit 79 { 80 int32 len; 81 char s[3]; // variable 82 }; 83 84 enum 85 { 86 Mpscale = 29, // safely smaller than bits in a long 87 Mpprec = 16, // Mpscale*Mpprec is max number of bits 88 Mpnorm = Mpprec - 1, // significant words in a normalized float 89 Mpbase = 1L << Mpscale, 90 Mpsign = Mpbase >> 1, 91 Mpmask = Mpbase - 1, 92 Mpdebug = 0, 93 }; 94 95 typedef struct Mpint Mpint; 96 struct Mpint 97 { 98 long a[Mpprec]; 99 uchar neg; 100 uchar ovf; 101 }; 102 103 typedef struct Mpflt Mpflt; 104 struct Mpflt 105 { 106 Mpint val; 107 short exp; 108 }; 109 110 typedef struct Mpcplx Mpcplx; 111 struct Mpcplx 112 { 113 Mpflt real; 114 Mpflt imag; 115 }; 116 117 typedef struct Val Val; 118 struct Val 119 { 120 short ctype; 121 union 122 { 123 short reg; // OREGISTER 124 short bval; // bool value CTBOOL 125 Mpint* xval; // int CTINT, rune CTRUNE 126 Mpflt* fval; // float CTFLT 127 Mpcplx* cval; // float CTCPLX 128 Strlit* sval; // string CTSTR 129 } u; 130 }; 131 132 typedef struct Bvec Bvec; 133 typedef struct Pkg Pkg; 134 typedef struct Sym Sym; 135 typedef struct Node Node; 136 typedef struct NodeList NodeList; 137 typedef struct Type Type; 138 typedef struct Label Label; 139 140 struct Type 141 { 142 uchar etype; 143 uchar nointerface; 144 uchar chan; 145 uchar trecur; // to detect loops 146 uchar printed; 147 uchar embedded; // TFIELD embedded type 148 uchar siggen; 149 uchar funarg; // on TSTRUCT and TFIELD 150 uchar copyany; 151 uchar local; // created in this file 152 uchar deferwidth; 153 uchar broke; // broken type definition. 154 uchar isddd; // TFIELD is ... argument 155 uchar align; 156 uchar haspointers; // 0 unknown, 1 no, 2 yes 157 158 Node* nod; // canonical OTYPE node 159 Type* orig; // original type (type literal or predefined type) 160 int lineno; 161 162 // TFUNC 163 int thistuple; 164 int outtuple; 165 int intuple; 166 uchar outnamed; 167 168 Type* method; 169 Type* xmethod; 170 171 Sym* sym; 172 int32 vargen; // unique name for OTYPE/ONAME 173 174 Node* nname; 175 vlong argwid; 176 177 // most nodes 178 Type* type; // actual type for TFIELD, element type for TARRAY, TCHAN, TMAP, TPTRxx 179 vlong width; // offset in TFIELD, width in all others 180 181 // TFIELD 182 Type* down; // next struct field, also key type in TMAP 183 Type* outer; // outer struct 184 Strlit* note; // literal string annotation 185 186 // TARRAY 187 vlong bound; // negative is dynamic array 188 189 // TMAP 190 Type* bucket; // internal type representing a hash bucket 191 Type* hmap; // internal type representing a Hmap (map header object) 192 193 int32 maplineno; // first use of TFORW as map key 194 int32 embedlineno; // first use of TFORW as embedded type 195 196 // for TFORW, where to copy the eventual value to 197 NodeList *copyto; 198 199 Node *lastfn; // for usefield 200 }; 201 #define T ((Type*)0) 202 203 typedef struct InitEntry InitEntry; 204 typedef struct InitPlan InitPlan; 205 206 struct InitEntry 207 { 208 vlong xoffset; // struct, array only 209 Node *key; // map only 210 Node *expr; 211 }; 212 213 struct InitPlan 214 { 215 vlong lit; // bytes of initialized non-zero literals 216 vlong zero; // bytes of zeros 217 vlong expr; // bytes of run-time computed expressions 218 219 InitEntry *e; 220 int len; 221 int cap; 222 }; 223 224 enum 225 { 226 EscUnknown, 227 EscHeap, 228 EscScope, 229 EscNone, 230 EscReturn, 231 EscNever, 232 EscBits = 4, 233 EscMask = (1<<EscBits) - 1, 234 }; 235 236 struct Node 237 { 238 // Tree structure. 239 // Generic recursive walks should follow these fields. 240 Node* left; 241 Node* right; 242 Node* ntest; 243 Node* nincr; 244 NodeList* ninit; 245 NodeList* nbody; 246 NodeList* nelse; 247 NodeList* list; 248 NodeList* rlist; 249 250 uchar op; 251 uchar nointerface; 252 uchar ullman; // sethi/ullman number 253 uchar addable; // type of addressability - 0 is not addressable 254 uchar trecur; // to detect loops 255 uchar etype; // op for OASOP, etype for OTYPE, exclam for export 256 uchar bounded; // bounds check unnecessary 257 uchar class; // PPARAM, PAUTO, PEXTERN, etc 258 uchar method; // OCALLMETH name 259 uchar embedded; // ODCLFIELD embedded type 260 uchar colas; // OAS resulting from := 261 uchar diag; // already printed error about this 262 uchar noescape; // func arguments do not escape 263 uchar builtin; // built-in name, like len or close 264 uchar walkdef; 265 uchar typecheck; 266 uchar local; 267 uchar dodata; 268 uchar initorder; 269 uchar used; 270 uchar isddd; 271 uchar readonly; 272 uchar implicit; 273 uchar addrtaken; // address taken, even if not moved to heap 274 uchar dupok; // duplicate definitions ok (for func) 275 schar likely; // likeliness of if statement 276 uchar hasbreak; // has break statement 277 uchar needzero; // if it contains pointers, needs to be zeroed on function entry 278 uint esc; // EscXXX 279 int funcdepth; 280 281 // most nodes 282 Type* type; 283 Node* orig; // original form, for printing, and tracking copies of ONAMEs 284 285 // func 286 Node* nname; 287 Node* shortname; 288 NodeList* enter; 289 NodeList* exit; 290 NodeList* cvars; // closure params 291 NodeList* dcl; // autodcl for this func/closure 292 NodeList* inl; // copy of the body for use in inlining 293 NodeList* inldcl; // copy of dcl for use in inlining 294 295 // OLITERAL/OREGISTER 296 Val val; 297 298 // ONAME 299 Node* ntype; 300 Node* defn; // ONAME: initializing assignment; OLABEL: labeled statement 301 Node* pack; // real package for import . names 302 Node* curfn; // function for local variables 303 Type* paramfld; // TFIELD for this PPARAM; also for ODOT, curfn 304 305 // ONAME func param with PHEAP 306 Node* heapaddr; // temp holding heap address of param 307 Node* stackparam; // OPARAM node referring to stack copy of param 308 Node* alloc; // allocation call 309 310 // ONAME closure param with PPARAMREF 311 Node* outer; // outer PPARAMREF in nested closure 312 Node* closure; // ONAME/PHEAP <-> ONAME/PPARAMREF 313 314 // ONAME substitute while inlining 315 Node* inlvar; 316 317 // OPACK 318 Pkg* pkg; 319 320 // OARRAYLIT, OMAPLIT, OSTRUCTLIT. 321 InitPlan* initplan; 322 323 // Escape analysis. 324 NodeList* escflowsrc; // flow(this, src) 325 NodeList* escretval; // on OCALLxxx, list of dummy return values 326 int escloopdepth; // -1: global, 0: return variables, 1:function top level, increased inside function for every loop or label to mark scopes 327 328 Sym* sym; // various 329 int32 vargen; // unique name for OTYPE/ONAME 330 int32 lineno; 331 int32 endlineno; 332 vlong xoffset; 333 vlong stkdelta; // offset added by stack frame compaction phase. 334 int32 ostk; 335 int32 iota; 336 uint32 walkgen; 337 int32 esclevel; 338 void* opt; // for optimization passes 339 }; 340 #define N ((Node*)0) 341 342 /* 343 * Every node has a walkgen field. 344 * If you want to do a traversal of a node graph that 345 * might contain duplicates and want to avoid 346 * visiting the same nodes twice, increment walkgen 347 * before starting. Then before processing a node, do 348 * 349 * if(n->walkgen == walkgen) 350 * return; 351 * n->walkgen = walkgen; 352 * 353 * Such a walk cannot call another such walk recursively, 354 * because of the use of the global walkgen. 355 */ 356 EXTERN uint32 walkgen; 357 358 struct NodeList 359 { 360 Node* n; 361 NodeList* next; 362 NodeList* end; 363 }; 364 365 enum 366 { 367 SymExport = 1<<0, // to be exported 368 SymPackage = 1<<1, 369 SymExported = 1<<2, // already written out by export 370 SymUniq = 1<<3, 371 SymSiggen = 1<<4, 372 SymGcgen = 1<<5, 373 }; 374 375 struct Sym 376 { 377 ushort lexical; 378 uchar flags; 379 uchar sym; // huffman encoding in object file 380 Sym* link; 381 int32 npkg; // number of imported packages with this name 382 uint32 uniqgen; 383 384 // saved and restored by dcopy 385 Pkg* pkg; 386 char* name; // variable name 387 Node* def; // definition: ONAME OTYPE OPACK or OLITERAL 388 Label* label; // corresponding label (ephemeral) 389 int32 block; // blocknumber to catch redeclaration 390 int32 lastlineno; // last declaration for diagnostic 391 Pkg* origpkg; // original package for . import 392 }; 393 #define S ((Sym*)0) 394 395 EXTERN Sym* dclstack; 396 397 struct Pkg 398 { 399 char* name; // package name 400 Strlit* path; // string literal used in import statement 401 Sym* pathsym; 402 char* prefix; // escaped path for use in symbol table 403 Pkg* link; 404 uchar imported; // export data of this package was parsed 405 char exported; // import line written in export data 406 char direct; // imported directly 407 char safe; // whether the package is marked as safe 408 }; 409 410 typedef struct Iter Iter; 411 struct Iter 412 { 413 int done; 414 Type* tfunc; 415 Type* t; 416 Node** an; 417 Node* n; 418 }; 419 420 typedef struct Hist Hist; 421 struct Hist 422 { 423 Hist* link; 424 char* name; 425 int32 line; 426 int32 offset; 427 }; 428 #define H ((Hist*)0) 429 430 // Node ops. 431 enum 432 { 433 OXXX, 434 435 // names 436 ONAME, // var, const or func name 437 ONONAME, // unnamed arg or return value: f(int, string) (int, error) { etc } 438 OTYPE, // type name 439 OPACK, // import 440 OLITERAL, // literal 441 442 // expressions 443 OADD, // x + y 444 OSUB, // x - y 445 OOR, // x | y 446 OXOR, // x ^ y 447 OADDSTR, // s + "foo" 448 OADDR, // &x 449 OANDAND, // b0 && b1 450 OAPPEND, // append 451 OARRAYBYTESTR, // string(bytes) 452 OARRAYRUNESTR, // string(runes) 453 OSTRARRAYBYTE, // []byte(s) 454 OSTRARRAYRUNE, // []rune(s) 455 OAS, // x = y or x := y 456 OAS2, // x, y, z = xx, yy, zz 457 OAS2FUNC, // x, y = f() 458 OAS2RECV, // x, ok = <-c 459 OAS2MAPR, // x, ok = m["foo"] 460 OAS2DOTTYPE, // x, ok = I.(int) 461 OASOP, // x += y 462 OCALL, // function call, method call or type conversion, possibly preceded by defer or go. 463 OCALLFUNC, // f() 464 OCALLMETH, // t.Method() 465 OCALLINTER, // err.Error() 466 OCALLPART, // t.Method (without ()) 467 OCAP, // cap 468 OCLOSE, // close 469 OCLOSURE, // f = func() { etc } 470 OCMPIFACE, // err1 == err2 471 OCMPSTR, // s1 == s2 472 OCOMPLIT, // composite literal, typechecking may convert to a more specific OXXXLIT. 473 OMAPLIT, // M{"foo":3, "bar":4} 474 OSTRUCTLIT, // T{x:3, y:4} 475 OARRAYLIT, // [2]int{3, 4} 476 OPTRLIT, // &T{x:3, y:4} 477 OCONV, // var i int; var u uint; i = int(u) 478 OCONVIFACE, // I(t) 479 OCONVNOP, // type Int int; var i int; var j Int; i = int(j) 480 OCOPY, // copy 481 ODCL, // var x int 482 ODCLFUNC, // func f() or func (r) f() 483 ODCLFIELD, // struct field, interface field, or func/method argument/return value. 484 ODCLCONST, // const pi = 3.14 485 ODCLTYPE, // type Int int 486 ODELETE, // delete 487 ODOT, // t.x 488 ODOTPTR, // p.x that is implicitly (*p).x 489 ODOTMETH, // t.Method 490 ODOTINTER, // err.Error 491 OXDOT, // t.x, typechecking may convert to a more specific ODOTXXX. 492 ODOTTYPE, // e = err.(MyErr) 493 ODOTTYPE2, // e, ok = err.(MyErr) 494 OEQ, // x == y 495 ONE, // x != y 496 OLT, // x < y 497 OLE, // x <= y 498 OGE, // x >= y 499 OGT, // x > y 500 OIND, // *p 501 OINDEX, // a[i] 502 OINDEXMAP, // m[s] 503 OKEY, // The x:3 in t{x:3, y:4}, the 1:2 in a[1:2], the 2:20 in [3]int{2:20}, etc. 504 OPARAM, // The on-stack copy of a parameter or return value that escapes. 505 OLEN, // len 506 OMAKE, // make, typechecking may convert to a more specfic OMAKEXXX. 507 OMAKECHAN, // make(chan int) 508 OMAKEMAP, // make(map[string]int) 509 OMAKESLICE, // make([]int, 0) 510 OMUL, // x * y 511 ODIV, // x / y 512 OMOD, // x % y 513 OLSH, // x << u 514 ORSH, // x >> u 515 OAND, // x & y 516 OANDNOT, // x &^ y 517 ONEW, // new 518 ONOT, // !b 519 OCOM, // ^x 520 OPLUS, // +x 521 OMINUS, // -y 522 OOROR, // b1 || b2 523 OPANIC, // panic 524 OPRINT, // print 525 OPRINTN, // println 526 OPAREN, // (x) 527 OSEND, // c <- x 528 OSLICE, // v[1:2], typechecking may convert to a more specfic OSLICEXXX. 529 OSLICEARR, // a[1:2] 530 OSLICESTR, // s[1:2] 531 OSLICE3, // v[1:2:3], typechecking may convert to OSLICE3ARR. 532 OSLICE3ARR, // a[1:2:3] 533 ORECOVER, // recover 534 ORECV, // <-c 535 ORUNESTR, // string(i) 536 OSELRECV, // case x = <-c: 537 OSELRECV2, // case x, ok = <-c: 538 OIOTA, // iota 539 OREAL, // real 540 OIMAG, // imag 541 OCOMPLEX, // complex 542 543 // statements 544 OBLOCK, // block of code 545 OBREAK, // break 546 OCASE, // case, after being verified by swt.c's casebody. 547 OXCASE, // case, before verification. 548 OCONTINUE, // continue 549 ODEFER, // defer 550 OEMPTY, // no-op 551 OFALL, // fallthrough, after being verified by swt.c's casebody. 552 OXFALL, // fallthrough, before verification. 553 OFOR, // for 554 OGOTO, // goto 555 OIF, // if 556 OLABEL, // label: 557 OPROC, // go 558 ORANGE, // range 559 ORETURN, // return 560 OSELECT, // select 561 OSWITCH, // switch x 562 OTYPESW, // switch err.(type) 563 564 // types 565 OTCHAN, // chan int 566 OTMAP, // map[string]int 567 OTSTRUCT, // struct{} 568 OTINTER, // interface{} 569 OTFUNC, // func() 570 OTARRAY, // []int, [8]int, [N]int or [...]int 571 OTPAREN, // (T) 572 573 // misc 574 ODDD, // func f(args ...int) or f(l...) or var a = [...]int{0, 1, 2}. 575 ODDDARG, // func f(args ...int), introduced by escape analysis. 576 OINLCALL, // intermediary representation of an inlined call. 577 OEFACE, // itable and data words of an empty-interface value. 578 OITAB, // itable word of an interface value. 579 OCLOSUREVAR, // variable reference at beginning of closure function 580 OCFUNC, // reference to c function pointer (not go func value) 581 OCHECKNIL, // emit code to ensure pointer/interface not nil 582 583 // arch-specific registers 584 OREGISTER, // a register, such as AX. 585 OINDREG, // offset plus indirect of a register, such as 8(SP). 586 587 // 386/amd64-specific opcodes 588 OCMP, // compare: ACMP. 589 ODEC, // decrement: ADEC. 590 OINC, // increment: AINC. 591 OEXTEND, // extend: ACWD/ACDQ/ACQO. 592 OHMUL, // high mul: AMUL/AIMUL for unsigned/signed (OMUL uses AIMUL for both). 593 OLROT, // left rotate: AROL. 594 ORROTC, // right rotate-carry: ARCR. 595 ORETJMP, // return to other function 596 597 OEND, 598 }; 599 600 enum 601 { 602 Txxx, // 0 603 604 TINT8, TUINT8, // 1 605 TINT16, TUINT16, 606 TINT32, TUINT32, 607 TINT64, TUINT64, 608 TINT, TUINT, TUINTPTR, 609 610 TCOMPLEX64, // 12 611 TCOMPLEX128, 612 613 TFLOAT32, // 14 614 TFLOAT64, 615 616 TBOOL, // 16 617 618 TPTR32, TPTR64, // 17 619 620 TFUNC, // 19 621 TARRAY, 622 T_old_DARRAY, 623 TSTRUCT, // 22 624 TCHAN, 625 TMAP, 626 TINTER, // 25 627 TFORW, 628 TFIELD, 629 TANY, 630 TSTRING, 631 TUNSAFEPTR, 632 633 // pseudo-types for literals 634 TIDEAL, // 31 635 TNIL, 636 TBLANK, 637 638 // pseudo-type for frame layout 639 TFUNCARGS, 640 TCHANARGS, 641 TINTERMETH, 642 643 NTYPE, 644 }; 645 646 enum 647 { 648 CTxxx, 649 650 CTINT, 651 CTRUNE, 652 CTFLT, 653 CTCPLX, 654 CTSTR, 655 CTBOOL, 656 CTNIL, 657 }; 658 659 enum 660 { 661 /* types of channel */ 662 /* must match ../../pkg/nreflect/type.go:/Chandir */ 663 Cxxx, 664 Crecv = 1<<0, 665 Csend = 1<<1, 666 Cboth = Crecv | Csend, 667 }; 668 669 // declaration context 670 enum 671 { 672 Pxxx, 673 674 PEXTERN, // global variable 675 PAUTO, // local variables 676 PPARAM, // input arguments 677 PPARAMOUT, // output results 678 PPARAMREF, // closure variable reference 679 PFUNC, // global function 680 681 PDISCARD, // discard during parse of duplicate import 682 683 PHEAP = 1<<7, // an extra bit to identify an escaped variable 684 }; 685 686 enum 687 { 688 Etop = 1<<1, // evaluated at statement level 689 Erv = 1<<2, // evaluated in value context 690 Etype = 1<<3, 691 Ecall = 1<<4, // call-only expressions are ok 692 Efnstruct = 1<<5, // multivalue function returns are ok 693 Eiota = 1<<6, // iota is ok 694 Easgn = 1<<7, // assigning to expression 695 Eindir = 1<<8, // indirecting through expression 696 Eaddr = 1<<9, // taking address of expression 697 Eproc = 1<<10, // inside a go statement 698 Ecomplit = 1<<11, // type in composite literal 699 }; 700 701 #define BITS 5 702 #define NVAR (BITS*sizeof(uint32)*8) 703 704 typedef struct Bits Bits; 705 struct Bits 706 { 707 uint32 b[BITS]; 708 }; 709 710 EXTERN Bits zbits; 711 712 struct Bvec 713 { 714 int32 n; // number of bits 715 uint32 b[]; 716 }; 717 718 typedef struct Var Var; 719 struct Var 720 { 721 vlong offset; 722 Node* node; 723 int width; 724 char name; 725 char etype; 726 char addr; 727 }; 728 729 EXTERN Var var[NVAR]; 730 731 typedef struct Typedef Typedef; 732 struct Typedef 733 { 734 char* name; 735 int etype; 736 int sameas; 737 }; 738 739 extern Typedef typedefs[]; 740 741 typedef struct Sig Sig; 742 struct Sig 743 { 744 char* name; 745 Pkg* pkg; 746 Sym* isym; 747 Sym* tsym; 748 Type* type; 749 Type* mtype; 750 int32 offset; 751 Sig* link; 752 }; 753 754 typedef struct Io Io; 755 struct Io 756 { 757 char* infile; 758 Biobuf* bin; 759 int32 ilineno; 760 int nlsemi; 761 int eofnl; 762 int last; 763 int peekc; 764 int peekc1; // second peekc for ... 765 char* cp; // used for content when bin==nil 766 int importsafe; 767 }; 768 769 typedef struct Dlist Dlist; 770 struct Dlist 771 { 772 Type* field; 773 }; 774 775 typedef struct Idir Idir; 776 struct Idir 777 { 778 Idir* link; 779 char* dir; 780 }; 781 782 /* 783 * argument passing to/from 784 * smagic and umagic 785 */ 786 typedef struct Magic Magic; 787 struct Magic 788 { 789 int w; // input for both - width 790 int s; // output for both - shift 791 int bad; // output for both - unexpected failure 792 793 // magic multiplier for signed literal divisors 794 int64 sd; // input - literal divisor 795 int64 sm; // output - multiplier 796 797 // magic multiplier for unsigned literal divisors 798 uint64 ud; // input - literal divisor 799 uint64 um; // output - multiplier 800 int ua; // output - adder 801 }; 802 803 typedef struct Prog Prog; 804 #pragma incomplete Prog 805 806 struct Label 807 { 808 uchar used; 809 Sym* sym; 810 Node* def; 811 NodeList* use; 812 Label* link; 813 814 // for use during gen 815 Prog* gotopc; // pointer to unresolved gotos 816 Prog* labelpc; // pointer to code 817 Prog* breakpc; // pointer to code 818 Prog* continpc; // pointer to code 819 }; 820 #define L ((Label*)0) 821 822 /* 823 * note this is the runtime representation 824 * of the compilers arrays. 825 * 826 * typedef struct 827 * { // must not move anything 828 * uchar array[8]; // pointer to data 829 * uchar nel[4]; // number of elements 830 * uchar cap[4]; // allocated number of elements 831 * } Array; 832 */ 833 EXTERN int Array_array; // runtime offsetof(Array,array) - same for String 834 EXTERN int Array_nel; // runtime offsetof(Array,nel) - same for String 835 EXTERN int Array_cap; // runtime offsetof(Array,cap) 836 EXTERN int sizeof_Array; // runtime sizeof(Array) 837 838 839 /* 840 * note this is the runtime representation 841 * of the compilers strings. 842 * 843 * typedef struct 844 * { // must not move anything 845 * uchar array[8]; // pointer to data 846 * uchar nel[4]; // number of elements 847 * } String; 848 */ 849 EXTERN int sizeof_String; // runtime sizeof(String) 850 851 EXTERN Dlist dotlist[10]; // size is max depth of embeddeds 852 853 EXTERN Io curio; 854 EXTERN Io pushedio; 855 EXTERN int32 lexlineno; 856 EXTERN int32 lineno; 857 EXTERN int32 prevlineno; 858 EXTERN char* pathname; 859 EXTERN Hist* hist; 860 EXTERN Hist* ehist; 861 862 EXTERN char* infile; 863 EXTERN char* outfile; 864 EXTERN Biobuf* bout; 865 EXTERN int nerrors; 866 EXTERN int nsavederrors; 867 EXTERN int nsyntaxerrors; 868 EXTERN int safemode; 869 EXTERN char namebuf[NSYMB]; 870 EXTERN char lexbuf[NSYMB]; 871 EXTERN char litbuf[NSYMB]; 872 EXTERN int debug[256]; 873 EXTERN char* debugstr; 874 EXTERN int debug_checknil; 875 EXTERN Sym* hash[NHASH]; 876 EXTERN Sym* importmyname; // my name for package 877 EXTERN Pkg* localpkg; // package being compiled 878 EXTERN Pkg* importpkg; // package being imported 879 EXTERN Pkg* structpkg; // package that declared struct, during import 880 EXTERN Pkg* builtinpkg; // fake package for builtins 881 EXTERN Pkg* gostringpkg; // fake pkg for Go strings 882 EXTERN Pkg* itabpkg; // fake pkg for itab cache 883 EXTERN Pkg* runtimepkg; // package runtime 884 EXTERN Pkg* racepkg; // package runtime/race 885 EXTERN Pkg* stringpkg; // fake package for C strings 886 EXTERN Pkg* typepkg; // fake package for runtime type info (headers) 887 EXTERN Pkg* typelinkpkg; // fake package for runtime type info (data) 888 EXTERN Pkg* weaktypepkg; // weak references to runtime type info 889 EXTERN Pkg* unsafepkg; // package unsafe 890 EXTERN Pkg* trackpkg; // fake package for field tracking 891 EXTERN Pkg* phash[128]; 892 EXTERN int tptr; // either TPTR32 or TPTR64 893 extern char* runtimeimport; 894 extern char* unsafeimport; 895 EXTERN char* myimportpath; 896 EXTERN Idir* idirs; 897 EXTERN char* localimport; 898 899 EXTERN Type* types[NTYPE]; 900 EXTERN Type* idealstring; 901 EXTERN Type* idealbool; 902 EXTERN Type* bytetype; 903 EXTERN Type* runetype; 904 EXTERN Type* errortype; 905 EXTERN uchar simtype[NTYPE]; 906 EXTERN uchar isptr[NTYPE]; 907 EXTERN uchar isforw[NTYPE]; 908 EXTERN uchar isint[NTYPE]; 909 EXTERN uchar isfloat[NTYPE]; 910 EXTERN uchar iscomplex[NTYPE]; 911 EXTERN uchar issigned[NTYPE]; 912 EXTERN uchar issimple[NTYPE]; 913 914 EXTERN uchar okforeq[NTYPE]; 915 EXTERN uchar okforadd[NTYPE]; 916 EXTERN uchar okforand[NTYPE]; 917 EXTERN uchar okfornone[NTYPE]; 918 EXTERN uchar okforcmp[NTYPE]; 919 EXTERN uchar okforbool[NTYPE]; 920 EXTERN uchar okforcap[NTYPE]; 921 EXTERN uchar okforlen[NTYPE]; 922 EXTERN uchar okforarith[NTYPE]; 923 EXTERN uchar okforconst[NTYPE]; 924 EXTERN uchar* okfor[OEND]; 925 EXTERN uchar iscmp[OEND]; 926 927 EXTERN Mpint* minintval[NTYPE]; 928 EXTERN Mpint* maxintval[NTYPE]; 929 EXTERN Mpflt* minfltval[NTYPE]; 930 EXTERN Mpflt* maxfltval[NTYPE]; 931 932 EXTERN NodeList* xtop; 933 EXTERN NodeList* externdcl; 934 EXTERN NodeList* closures; 935 EXTERN NodeList* exportlist; 936 EXTERN NodeList* importlist; // imported functions and methods with inlinable bodies 937 EXTERN NodeList* funcsyms; 938 EXTERN int dclcontext; // PEXTERN/PAUTO 939 EXTERN int incannedimport; 940 EXTERN int statuniqgen; // name generator for static temps 941 EXTERN int loophack; 942 943 EXTERN int32 iota; 944 EXTERN NodeList* lastconst; 945 EXTERN Node* lasttype; 946 EXTERN vlong maxarg; 947 EXTERN vlong stksize; // stack size for current frame 948 EXTERN vlong stkptrsize; // prefix of stack containing pointers 949 EXTERN vlong stkzerosize; // prefix of stack that must be zeroed on entry 950 EXTERN int32 blockgen; // max block number 951 EXTERN int32 block; // current block number 952 EXTERN int hasdefer; // flag that curfn has defer statetment 953 954 EXTERN Node* curfn; 955 956 EXTERN int widthptr; 957 EXTERN int widthint; 958 959 EXTERN Node* typesw; 960 EXTERN Node* nblank; 961 962 extern int thechar; 963 extern char* thestring; 964 EXTERN int use_sse; 965 966 EXTERN char* hunk; 967 EXTERN int32 nhunk; 968 EXTERN int32 thunk; 969 970 EXTERN int funcdepth; 971 EXTERN int typecheckok; 972 EXTERN int compiling_runtime; 973 EXTERN int compiling_wrappers; 974 EXTERN int pure_go; 975 EXTERN int flag_race; 976 EXTERN int flag_largemodel; 977 EXTERN int noescape; 978 979 EXTERN int nointerface; 980 EXTERN int fieldtrack_enabled; 981 982 /* 983 * y.tab.c 984 */ 985 int yyparse(void); 986 987 /* 988 * align.c 989 */ 990 int argsize(Type *t); 991 void checkwidth(Type *t); 992 void defercheckwidth(void); 993 void dowidth(Type *t); 994 void resumecheckwidth(void); 995 vlong rnd(vlong o, vlong r); 996 void typeinit(void); 997 998 /* 999 * bits.c 1000 */ 1001 int Qconv(Fmt *fp); 1002 Bits band(Bits a, Bits b); 1003 int bany(Bits *a); 1004 int beq(Bits a, Bits b); 1005 int bitno(int32 b); 1006 Bits blsh(uint n); 1007 Bits bnot(Bits a); 1008 int bnum(Bits a); 1009 Bits bor(Bits a, Bits b); 1010 int bset(Bits a, uint n); 1011 1012 /* 1013 * bv.c 1014 */ 1015 Bvec* bvalloc(int32 n); 1016 void bvset(Bvec *bv, int32 i); 1017 void bvres(Bvec *bv, int32 i); 1018 int bvget(Bvec *bv, int32 i); 1019 int bvisempty(Bvec *bv); 1020 int bvcmp(Bvec *bv1, Bvec *bv2); 1021 1022 /* 1023 * closure.c 1024 */ 1025 Node* closurebody(NodeList *body); 1026 void closurehdr(Node *ntype); 1027 void typecheckclosure(Node *func, int top); 1028 Node* walkclosure(Node *func, NodeList **init); 1029 void typecheckpartialcall(Node*, Node*); 1030 Node* walkpartialcall(Node*, NodeList**); 1031 1032 /* 1033 * const.c 1034 */ 1035 int cmpslit(Node *l, Node *r); 1036 int consttype(Node *n); 1037 void convconst(Node *con, Type *t, Val *val); 1038 void convlit(Node **np, Type *t); 1039 void convlit1(Node **np, Type *t, int explicit); 1040 void defaultlit(Node **np, Type *t); 1041 void defaultlit2(Node **lp, Node **rp, int force); 1042 void evconst(Node *n); 1043 int isconst(Node *n, int ct); 1044 int isgoconst(Node *n); 1045 Node* nodcplxlit(Val r, Val i); 1046 Node* nodlit(Val v); 1047 long nonnegconst(Node *n); 1048 int doesoverflow(Val v, Type *t); 1049 void overflow(Val v, Type *t); 1050 int smallintconst(Node *n); 1051 Val toint(Val v); 1052 Mpflt* truncfltlit(Mpflt *oldv, Type *t); 1053 1054 /* 1055 * cplx.c 1056 */ 1057 void complexadd(int op, Node *nl, Node *nr, Node *res); 1058 void complexbool(int op, Node *nl, Node *nr, int true, int likely, Prog *to); 1059 void complexgen(Node *n, Node *res); 1060 void complexminus(Node *nl, Node *res); 1061 void complexmove(Node *f, Node *t); 1062 void complexmul(Node *nl, Node *nr, Node *res); 1063 int complexop(Node *n, Node *res); 1064 void nodfconst(Node *n, Type *t, Mpflt* fval); 1065 1066 /* 1067 * dcl.c 1068 */ 1069 void addmethod(Sym *sf, Type *t, int local, int nointerface); 1070 void addvar(Node *n, Type *t, int ctxt); 1071 NodeList* checkarglist(NodeList *all, int input); 1072 Node* colas(NodeList *left, NodeList *right, int32 lno); 1073 void colasdefn(NodeList *left, Node *defn); 1074 NodeList* constiter(NodeList *vl, Node *t, NodeList *cl); 1075 Node* dclname(Sym *s); 1076 void declare(Node *n, int ctxt); 1077 void dumpdcl(char *st); 1078 Node* embedded(Sym *s); 1079 Node* fakethis(void); 1080 void funcbody(Node *n); 1081 void funccompile(Node *n, int isclosure); 1082 void funchdr(Node *n); 1083 Type* functype(Node *this, NodeList *in, NodeList *out); 1084 void ifacedcl(Node *n); 1085 int isifacemethod(Type *f); 1086 void markdcl(void); 1087 Node* methodname(Node *n, Type *t); 1088 Node* methodname1(Node *n, Node *t); 1089 Sym* methodsym(Sym *nsym, Type *t0, int iface); 1090 Node* newname(Sym *s); 1091 Node* oldname(Sym *s); 1092 void popdcl(void); 1093 void poptodcl(void); 1094 void redeclare(Sym *s, char *where); 1095 void testdclstack(void); 1096 Type* tointerface(NodeList *l); 1097 Type* tostruct(NodeList *l); 1098 Node* typedcl0(Sym *s); 1099 Node* typedcl1(Node *n, Node *t, int local); 1100 Node* typenod(Type *t); 1101 NodeList* variter(NodeList *vl, Node *t, NodeList *el); 1102 Sym* funcsym(Sym*); 1103 1104 /* 1105 * esc.c 1106 */ 1107 void escapes(NodeList*); 1108 1109 /* 1110 * export.c 1111 */ 1112 void autoexport(Node *n, int ctxt); 1113 void dumpexport(void); 1114 int exportname(char *s); 1115 void exportsym(Node *n); 1116 void importconst(Sym *s, Type *t, Node *n); 1117 void importimport(Sym *s, Strlit *z); 1118 Sym* importsym(Sym *s, int op); 1119 void importtype(Type *pt, Type *t); 1120 void importvar(Sym *s, Type *t); 1121 Type* pkgtype(Sym *s); 1122 1123 /* 1124 * fmt.c 1125 */ 1126 void fmtinstallgo(void); 1127 void dump(char *s, Node *n); 1128 void dumplist(char *s, NodeList *l); 1129 1130 /* 1131 * gen.c 1132 */ 1133 void addrescapes(Node *n); 1134 void cgen_as(Node *nl, Node *nr); 1135 void cgen_callmeth(Node *n, int proc); 1136 void cgen_eface(Node* n, Node* res); 1137 void cgen_slice(Node* n, Node* res); 1138 void clearlabels(void); 1139 void checklabels(void); 1140 int dotoffset(Node *n, int64 *oary, Node **nn); 1141 void gen(Node *n); 1142 void genlist(NodeList *l); 1143 Node* sysfunc(char *name); 1144 void tempname(Node *n, Type *t); 1145 Node* temp(Type*); 1146 1147 /* 1148 * init.c 1149 */ 1150 void fninit(NodeList *n); 1151 Sym* renameinit(void); 1152 1153 /* 1154 * inl.c 1155 */ 1156 void caninl(Node *fn); 1157 void inlcalls(Node *fn); 1158 void typecheckinl(Node *fn); 1159 1160 /* 1161 * lex.c 1162 */ 1163 void cannedimports(char *file, char *cp); 1164 void importfile(Val *f, int line); 1165 char* lexname(int lex); 1166 char* expstring(void); 1167 void mkpackage(char* pkgname); 1168 void unimportfile(void); 1169 int32 yylex(void); 1170 extern int windows; 1171 extern int yylast; 1172 extern int yyprev; 1173 1174 /* 1175 * mparith1.c 1176 */ 1177 int Bconv(Fmt *fp); 1178 int Fconv(Fmt *fp); 1179 void mpaddcfix(Mpint *a, vlong c); 1180 void mpaddcflt(Mpflt *a, double c); 1181 void mpatofix(Mpint *a, char *as); 1182 void mpatoflt(Mpflt *a, char *as); 1183 int mpcmpfixc(Mpint *b, vlong c); 1184 int mpcmpfixfix(Mpint *a, Mpint *b); 1185 int mpcmpfixflt(Mpint *a, Mpflt *b); 1186 int mpcmpfltc(Mpflt *b, double c); 1187 int mpcmpfltfix(Mpflt *a, Mpint *b); 1188 int mpcmpfltflt(Mpflt *a, Mpflt *b); 1189 void mpcomfix(Mpint *a); 1190 void mpdivfixfix(Mpint *a, Mpint *b); 1191 void mpmodfixfix(Mpint *a, Mpint *b); 1192 void mpmovefixfix(Mpint *a, Mpint *b); 1193 void mpmovefixflt(Mpflt *a, Mpint *b); 1194 int mpmovefltfix(Mpint *a, Mpflt *b); 1195 void mpmovefltflt(Mpflt *a, Mpflt *b); 1196 void mpmulcfix(Mpint *a, vlong c); 1197 void mpmulcflt(Mpflt *a, double c); 1198 void mpsubfixfix(Mpint *a, Mpint *b); 1199 void mpsubfltflt(Mpflt *a, Mpflt *b); 1200 1201 /* 1202 * mparith2.c 1203 */ 1204 void mpaddfixfix(Mpint *a, Mpint *b, int); 1205 void mpandfixfix(Mpint *a, Mpint *b); 1206 void mpandnotfixfix(Mpint *a, Mpint *b); 1207 void mpdivfract(Mpint *a, Mpint *b); 1208 void mpdivmodfixfix(Mpint *q, Mpint *r, Mpint *n, Mpint *d); 1209 vlong mpgetfix(Mpint *a); 1210 void mplshfixfix(Mpint *a, Mpint *b); 1211 void mpmovecfix(Mpint *a, vlong c); 1212 void mpmulfixfix(Mpint *a, Mpint *b); 1213 void mpmulfract(Mpint *a, Mpint *b); 1214 void mpnegfix(Mpint *a); 1215 void mporfixfix(Mpint *a, Mpint *b); 1216 void mprshfixfix(Mpint *a, Mpint *b); 1217 void mpshiftfix(Mpint *a, int s); 1218 int mptestfix(Mpint *a); 1219 void mpxorfixfix(Mpint *a, Mpint *b); 1220 1221 /* 1222 * mparith3.c 1223 */ 1224 void mpaddfltflt(Mpflt *a, Mpflt *b); 1225 void mpdivfltflt(Mpflt *a, Mpflt *b); 1226 double mpgetflt(Mpflt *a); 1227 void mpmovecflt(Mpflt *a, double c); 1228 void mpmulfltflt(Mpflt *a, Mpflt *b); 1229 void mpnegflt(Mpflt *a); 1230 void mpnorm(Mpflt *a); 1231 int mptestflt(Mpflt *a); 1232 int sigfig(Mpflt *a); 1233 1234 /* 1235 * obj.c 1236 */ 1237 void Bputname(Biobuf *b, Sym *s); 1238 int duint16(Sym *s, int off, uint16 v); 1239 int duint32(Sym *s, int off, uint32 v); 1240 int duint64(Sym *s, int off, uint64 v); 1241 int duint8(Sym *s, int off, uint8 v); 1242 int duintptr(Sym *s, int off, uint64 v); 1243 int dsname(Sym *s, int off, char *dat, int ndat); 1244 void dumpobj(void); 1245 void ieeedtod(uint64 *ieee, double native); 1246 Sym* stringsym(char*, int); 1247 1248 /* 1249 * order.c 1250 */ 1251 void order(Node *fn); 1252 1253 /* 1254 * range.c 1255 */ 1256 void typecheckrange(Node *n); 1257 void walkrange(Node *n); 1258 1259 /* 1260 * reflect.c 1261 */ 1262 void dumptypestructs(void); 1263 Type* methodfunc(Type *f, Type*); 1264 Node* typename(Type *t); 1265 Sym* typesym(Type *t); 1266 Sym* typenamesym(Type *t); 1267 Sym* tracksym(Type *t); 1268 Sym* typesymprefix(char *prefix, Type *t); 1269 int haspointers(Type *t); 1270 void usefield(Node*); 1271 1272 /* 1273 * select.c 1274 */ 1275 void typecheckselect(Node *sel); 1276 void walkselect(Node *sel); 1277 1278 /* 1279 * sinit.c 1280 */ 1281 void anylit(int, Node *n, Node *var, NodeList **init); 1282 int gen_as_init(Node *n); 1283 NodeList* initfix(NodeList *l); 1284 int oaslit(Node *n, NodeList **init); 1285 int stataddr(Node *nam, Node *n); 1286 1287 /* 1288 * subr.c 1289 */ 1290 Node* adddot(Node *n); 1291 int adddot1(Sym *s, Type *t, int d, Type **save, int ignorecase); 1292 void addinit(Node**, NodeList*); 1293 Type* aindex(Node *b, Type *t); 1294 int algtype(Type *t); 1295 int algtype1(Type *t, Type **bad); 1296 void argtype(Node *on, Type *t); 1297 Node* assignconv(Node *n, Type *t, char *context); 1298 int assignop(Type *src, Type *dst, char **why); 1299 void badtype(int o, Type *tl, Type *tr); 1300 int brcom(int a); 1301 int brrev(int a); 1302 NodeList* concat(NodeList *a, NodeList *b); 1303 int convertop(Type *src, Type *dst, char **why); 1304 Node* copyexpr(Node*, Type*, NodeList**); 1305 int count(NodeList *l); 1306 int cplxsubtype(int et); 1307 int eqtype(Type *t1, Type *t2); 1308 int eqtypenoname(Type *t1, Type *t2); 1309 void errorexit(void); 1310 void expandmeth(Type *t); 1311 void fatal(char *fmt, ...); 1312 void flusherrors(void); 1313 void frame(int context); 1314 Type* funcfirst(Iter *s, Type *t); 1315 Type* funcnext(Iter *s); 1316 void genwrapper(Type *rcvr, Type *method, Sym *newnam, int iface); 1317 void genhash(Sym *sym, Type *t); 1318 void geneq(Sym *sym, Type *t); 1319 Type** getinarg(Type *t); 1320 Type* getinargx(Type *t); 1321 Type** getoutarg(Type *t); 1322 Type* getoutargx(Type *t); 1323 Type** getthis(Type *t); 1324 Type* getthisx(Type *t); 1325 int implements(Type *t, Type *iface, Type **missing, Type **have, int *ptr); 1326 void importdot(Pkg *opkg, Node *pack); 1327 int is64(Type *t); 1328 int isbadimport(Strlit *s); 1329 int isblank(Node *n); 1330 int isblanksym(Sym *s); 1331 int isfixedarray(Type *t); 1332 int isideal(Type *t); 1333 int isinter(Type *t); 1334 int isnil(Node *n); 1335 int isnilinter(Type *t); 1336 int isptrto(Type *t, int et); 1337 int isslice(Type *t); 1338 int istype(Type *t, int et); 1339 void linehist(char *file, int32 off, int relative); 1340 NodeList* list(NodeList *l, Node *n); 1341 NodeList* list1(Node *n); 1342 void listsort(NodeList**, int(*f)(Node*, Node*)); 1343 Node* liststmt(NodeList *l); 1344 NodeList* listtreecopy(NodeList *l); 1345 Sym* lookup(char *name); 1346 void* mal(int32 n); 1347 Type* maptype(Type *key, Type *val); 1348 Type* methtype(Type *t, int mustname); 1349 Pkg* mkpkg(Strlit *path); 1350 Sym* ngotype(Node *n); 1351 int noconv(Type *t1, Type *t2); 1352 Node* nod(int op, Node *nleft, Node *nright); 1353 Node* nodbool(int b); 1354 void nodconst(Node *n, Type *t, int64 v); 1355 Node* nodintconst(int64 v); 1356 Node* nodfltconst(Mpflt *v); 1357 Node* nodnil(void); 1358 int parserline(void); 1359 Sym* pkglookup(char *name, Pkg *pkg); 1360 int powtwo(Node *n); 1361 Type* ptrto(Type *t); 1362 void* remal(void *p, int32 on, int32 n); 1363 Sym* restrictlookup(char *name, Pkg *pkg); 1364 Node* safeexpr(Node *n, NodeList **init); 1365 void saveerrors(void); 1366 Node* cheapexpr(Node *n, NodeList **init); 1367 Node* localexpr(Node *n, Type *t, NodeList **init); 1368 void saveorignode(Node *n); 1369 int32 setlineno(Node *n); 1370 void setmaxarg(Type *t); 1371 Type* shallow(Type *t); 1372 int simsimtype(Type *t); 1373 void smagic(Magic *m); 1374 Type* sortinter(Type *t); 1375 uint32 stringhash(char *p); 1376 Strlit* strlit(char *s); 1377 int structcount(Type *t); 1378 Type* structfirst(Iter *s, Type **nn); 1379 Type* structnext(Iter *s); 1380 Node* syslook(char *name, int copy); 1381 Type* tounsigned(Type *t); 1382 Node* treecopy(Node *n); 1383 Type* typ(int et); 1384 uint32 typehash(Type *t); 1385 void ullmancalc(Node *n); 1386 void umagic(Magic *m); 1387 void warn(char *fmt, ...); 1388 void warnl(int line, char *fmt, ...); 1389 void yyerror(char *fmt, ...); 1390 void yyerrorl(int line, char *fmt, ...); 1391 1392 /* 1393 * swt.c 1394 */ 1395 void typecheckswitch(Node *n); 1396 void walkswitch(Node *sw); 1397 1398 /* 1399 * typecheck.c 1400 */ 1401 int islvalue(Node *n); 1402 Node* typecheck(Node **np, int top); 1403 void typechecklist(NodeList *l, int top); 1404 Node* typecheckdef(Node *n); 1405 void copytype(Node *n, Type *t); 1406 void checkreturn(Node*); 1407 void queuemethod(Node *n); 1408 1409 /* 1410 * unsafe.c 1411 */ 1412 int isunsafebuiltin(Node *n); 1413 Node* unsafenmagic(Node *n); 1414 1415 /* 1416 * walk.c 1417 */ 1418 Node* callnew(Type *t); 1419 Node* chanfn(char *name, int n, Type *t); 1420 Node* mkcall(char *name, Type *t, NodeList **init, ...); 1421 Node* mkcall1(Node *fn, Type *t, NodeList **init, ...); 1422 int vmatch1(Node *l, Node *r); 1423 void walk(Node *fn); 1424 void walkexpr(Node **np, NodeList **init); 1425 void walkexprlist(NodeList *l, NodeList **init); 1426 void walkexprlistsafe(NodeList *l, NodeList **init); 1427 void walkstmt(Node **np); 1428 void walkstmtlist(NodeList *l); 1429 Node* conv(Node*, Type*); 1430 int candiscard(Node*); 1431 1432 /* 1433 * arch-specific ggen.c/gsubr.c/gobj.c/pgen.c 1434 */ 1435 #define P ((Prog*)0) 1436 1437 typedef struct Plist Plist; 1438 struct Plist 1439 { 1440 Node* name; 1441 Prog* firstpc; 1442 int recur; 1443 Plist* link; 1444 }; 1445 1446 EXTERN Plist* plist; 1447 EXTERN Plist* plast; 1448 1449 EXTERN Prog* continpc; 1450 EXTERN Prog* breakpc; 1451 EXTERN Prog* pc; 1452 EXTERN Prog* firstpc; 1453 EXTERN Prog* retpc; 1454 1455 EXTERN Node* nodfp; 1456 EXTERN int disable_checknil; 1457 1458 int anyregalloc(void); 1459 void betypeinit(void); 1460 void bgen(Node *n, int true, int likely, Prog *to); 1461 void checknil(Node*, NodeList**); 1462 void expandchecks(Prog*); 1463 void cgen(Node*, Node*); 1464 void cgen_asop(Node *n); 1465 void cgen_call(Node *n, int proc); 1466 void cgen_callinter(Node *n, Node *res, int proc); 1467 void cgen_checknil(Node*); 1468 void cgen_ret(Node *n); 1469 void clearfat(Node *n); 1470 void compile(Node*); 1471 void defframe(Prog*, Bvec*); 1472 int dgostringptr(Sym*, int off, char *str); 1473 int dgostrlitptr(Sym*, int off, Strlit*); 1474 int dstringptr(Sym *s, int off, char *str); 1475 int dsymptr(Sym *s, int off, Sym *x, int xoff); 1476 int duintxx(Sym *s, int off, uint64 v, int wid); 1477 void dumpdata(void); 1478 void dumpfuncs(void); 1479 void fixautoused(Prog*); 1480 void gdata(Node*, Node*, int); 1481 void gdatacomplex(Node*, Mpcplx*); 1482 void gdatastring(Node*, Strlit*); 1483 void ggloblnod(Node *nam); 1484 void ggloblsym(Sym *s, int32 width, int dupok, int rodata); 1485 Prog* gjmp(Prog*); 1486 void gused(Node*); 1487 void movelarge(NodeList*); 1488 int isfat(Type*); 1489 void markautoused(Prog*); 1490 Plist* newplist(void); 1491 Node* nodarg(Type*, int); 1492 void nopout(Prog*); 1493 void patch(Prog*, Prog*); 1494 Prog* unpatch(Prog*); 1495 void zfile(Biobuf *b, char *p, int n); 1496 void zhist(Biobuf *b, int line, vlong offset); 1497 void zname(Biobuf *b, Sym *s, int t); 1498 1499 #pragma varargck type "A" int 1500 #pragma varargck type "B" Mpint* 1501 #pragma varargck type "D" Addr* 1502 #pragma varargck type "lD" Addr* 1503 #pragma varargck type "E" int 1504 #pragma varargck type "E" uint 1505 #pragma varargck type "F" Mpflt* 1506 #pragma varargck type "H" NodeList* 1507 #pragma varargck type "J" Node* 1508 #pragma varargck type "lL" int 1509 #pragma varargck type "lL" uint 1510 #pragma varargck type "L" int 1511 #pragma varargck type "L" uint 1512 #pragma varargck type "N" Node* 1513 #pragma varargck type "lN" Node* 1514 #pragma varargck type "O" uint 1515 #pragma varargck type "P" Prog* 1516 #pragma varargck type "Q" Bits 1517 #pragma varargck type "R" int 1518 #pragma varargck type "S" Sym* 1519 #pragma varargck type "lS" Sym* 1520 #pragma varargck type "T" Type* 1521 #pragma varargck type "lT" Type* 1522 #pragma varargck type "V" Val* 1523 #pragma varargck type "Y" char* 1524 #pragma varargck type "Z" Strlit* 1525 1526 /* 1527 * racewalk.c 1528 */ 1529 void racewalk(Node *fn);