type Entry … type Plan … type Schedule … func (s *Schedule) append(n ir.Node) { … } // StaticInit adds an initialization statement n to the schedule. func (s *Schedule) StaticInit(n ir.Node) { … } var varToMapInit … var MapInitToVar … // recordFuncForVar establishes a mapping between global map var "v" and // outlined init function "fn" (and vice versa); so that we can use // the mappings later on to update relocations. func recordFuncForVar(v *ir.Name, fn *ir.Func) { … } // allBlank reports whether every node in exprs is blank. func allBlank(exprs []ir.Node) bool { … } // tryStaticInit attempts to statically execute an initialization // statement and reports whether it succeeded. func (s *Schedule) tryStaticInit(n ir.Node) bool { … } // like staticassign but we are copying an already // initialized value r. func (s *Schedule) staticcopy(l *ir.Name, loff int64, rn *ir.Name, typ *types.Type) bool { … } func (s *Schedule) StaticAssign(l *ir.Name, loff int64, r ir.Node, typ *types.Type) bool { … } func (s *Schedule) initplan(n ir.Node) { … } func (s *Schedule) addvalue(p *Plan, xoffset int64, n ir.Node) { … } func (s *Schedule) staticAssignInlinedCall(l *ir.Name, loff int64, call *ir.InlinedCallExpr, typ *types.Type) bool { … } var statuniqgen … // StaticName returns a name backed by a (writable) static data symbol. // Use readonlystaticname for read-only node. func StaticName(t *types.Type) *ir.Name { … } // StaticLoc returns the static address of n, if n has one, or else nil. func StaticLoc(n ir.Node) (name *ir.Name, offset int64, ok bool) { … } func isSideEffect(n ir.Node) bool { … } // AnySideEffects reports whether n contains any operations that could have observable side effects. func AnySideEffects(n ir.Node) bool { … } // mayModifyPkgVar reports whether expression n may modify any // package-scope variables declared within the current package. func mayModifyPkgVar(n ir.Node) bool { … } // canRepeat reports whether executing n multiple times has the same effect as // assigning n to a single variable and using that variable multiple times. func canRepeat(n ir.Node) bool { … } func getlit(lit ir.Node) int { … } func isvaluelit(n ir.Node) bool { … } func subst(n ir.Node, m map[*ir.Name]ir.Node) (ir.Node, bool) { … } // truncate returns the result of force converting c to type t, // truncating its value as needed, like a conversion of a variable. // If the conversion is too difficult, truncate returns nil, false. func truncate(c ir.Node, t *types.Type) (ir.Node, bool) { … } func addStr(n *ir.AddStringExpr) ir.Node { … } const wrapGlobalMapInitSizeThreshold … // tryWrapGlobalInit returns a new outlined function to contain global // initializer statement n, if possible and worthwhile. Otherwise, it // returns nil. // // Currently, it outlines map assignment statements with large, // side-effect-free RHS expressions. func tryWrapGlobalInit(n ir.Node) *ir.Func { … } var mapinitgen … // AddKeepRelocations adds a dummy "R_KEEP" relocation from each // global map variable V to its associated outlined init function. // These relocation ensure that if the map var itself is determined to // be reachable at link time, we also mark the init function as // reachable. func AddKeepRelocations() { … } // OutlineMapInits replaces global map initializers with outlined // calls to separate "map init" functions (where possible and // profitable), to facilitate better dead-code elimination by the // linker. func OutlineMapInits(fn *ir.Func) { … }