cmd/compile: remove unused code from typecheckdef
cmd/compile: remove unused code from typecheckdef

typecheckdef used to be used to handle references to package-level
declarations that hadn't yet been typechecked yet. It's no longer
needed, as the current IR frontends construct package-level
declarations with proper types upfront.

Exception: this code is still used for compiler-generated function
declarations, so that code needs to be kept. Eventually that code can
be moved elsewhere, but for now this CL makes it obvious that the rest
of the code paths really are unused.

Updates #51691.

Change-Id: I5322edb686aaf5dc4627288f3d9ba910a017b41d
Reviewed-on: https://go-review.googlesource.com/c/go/+/393256
Trust: Matthew Dempsky <e56ac2c500064424afac424d4b5e53bd0570a731@google.com>
Run-TryBot: Matthew Dempsky <e56ac2c500064424afac424d4b5e53bd0570a731@google.com>
TryBot-Result: Gopher Robot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Cuong Manh Le <54b4457f1dff6823379654eb5867596497ba782f@gmail.com>

CAFxX/go,CAFxX/go,golang/go,CAFxX/go,golang/go,nawawi/go,nawawi/go,nawawi/go,nawawi/go,golang/go,CAFxX/go,nawawi/go,nawawi/go,golang/go,CAFxX/go,golang/go,CAFxX/go,nawawi/go,golang/go,CAFxX/go,nawawi/go,golang/go,golang/go,CAFxX/go