From: pierwill Date: Wed, 2 Feb 2022 18:21:04 +0000 (+0000) Subject: cmd/compile: edit README X-Git-Tag: go1.18rc1~126 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=edbe4742a296239c06cd99721bb0dbc5008d35a1;p=gostls13.git cmd/compile: edit README Make some small edits for clarification of important concepts. Change-Id: I1f78f2a59489ac71e3948dc924641540508613ce GitHub-Last-Rev: 1819140ee607edf8be3ed35f846848178065391a GitHub-Pull-Request: golang/go#50980 Reviewed-on: https://go-review.googlesource.com/c/go/+/382458 Reviewed-by: Robert Griesemer Reviewed-by: Matthew Dempsky --- diff --git a/src/cmd/compile/README.md b/src/cmd/compile/README.md index babc3f7679..25fa8187bb 100644 --- a/src/cmd/compile/README.md +++ b/src/cmd/compile/README.md @@ -40,12 +40,12 @@ which is used for error reporting and the creation of debugging information. * `cmd/compile/internal/gc` (create compiler AST, type checking, AST transformations) -The gc package includes an AST definition carried over from when it was written -in C. All of its code is written in terms of it, so the first thing that the gc +The gc package includes its own AST definition carried over from when it was written +in C. All of its code is written in terms of this AST, so the first thing that the gc package must do is convert the syntax package's syntax tree to the compiler's AST representation. This extra step may be refactored away in the future. -The AST is then type-checked. The first steps are name resolution and type +The gc AST is then type-checked. The first steps are name resolution and type inference, which determine which object belongs to which identifier, and what type each expression has. Type-checking includes certain extra checks, such as "declared and not used" as well as determining whether or not a function @@ -79,8 +79,7 @@ historical reasons, but the long-term plan is to move all of them here. Then, a series of machine-independent passes and rules are applied. These do not concern any single computer architecture, and thus run on all `GOARCH` variants. - -Some examples of these generic passes include dead code elimination, removal of +These passes include dead code elimination, removal of unneeded nil checks, and removal of unused branches. The generic rewrite rules mainly concern expressions, such as replacing some expressions with constant values, and optimizing multiplications and float operations.