const hello … // This program demonstrates how to run the SSA builder on a single // package of one or more already-parsed files. Its dependencies are // loaded from compiler export data. This is what you'd typically use // for a compiler; it does not depend on the obsolete // [golang.org/x/tools/go/loader]. // // It shows the printed representation of packages, functions, and // instructions. Within the function listing, the name of each // BasicBlock such as ".0.entry" is printed left-aligned, followed by // the block's Instructions. // // For each instruction that defines an SSA virtual register // (i.e. implements Value), the type of that value is shown in the // right column. // // Build and run the ssadump.go program if you want a standalone tool // with similar functionality. It is located at // [golang.org/x/tools/cmd/ssadump]. // // Use ssautil.BuildPackage only if you have parsed--but not // type-checked--syntax trees. Typically, clients already have typed // syntax, perhaps obtained from golang.org/x/tools/go/packages. // In that case, see the other examples for simpler approaches. func Example_buildPackage() { … } // This example builds SSA code for a set of packages using the // [golang.org/x/tools/go/packages] API. This is what you would typically use for a // analysis capable of operating on a single package. func Example_loadPackages() { … } // This example builds SSA code for a set of packages plus all their dependencies, // using the [golang.org/x/tools/go/packages] API. // This is what you'd typically use for a whole-program analysis. func Example_loadWholeProgram() { … }