cmd/cgo: split name rewriting out of rewriteRef
cmd/cgo: split name rewriting out of rewriteRef

This is in preparation for later changes.

Change-Id: I2b9b77a782cf65a2fcec5e700ec6bb8b1476f6b5
Reviewed-on: https://go-review.googlesource.com/c/142882
Run-TryBot: Ian Lance Taylor <87e9c6d529889242b7e184afb632328636553ab4@golang.org>
TryBot-Result: Gobot Gobot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Brad Fitzpatrick <ae9783c0b0efc69cd85ab025ddd17aa44cdc4aa5@golang.org>

nawawi/go,golang/go,CAFxX/go,josharian/go,golang/go,golang/go,golang/go,cloudflare/go,cloudflare/go,nawawi/go,cloudflare/go,golang/go,nawawi/go,CAFxX/go,CAFxX/go,akutz/go,akutz/go,akutz/go,josharian/go,josharian/go,akutz/go,CAFxX/go,cloudflare/go,CAFxX/go,cloudflare/go,nawawi/go,cloudflare/go,josharian/go,josharian/go,akutz/go,akutz/go,golang/go,CAFxX/go,akutz/go,josharian/go,cloudflare/go,cloudflare/go,nawawi/go,nawawi/go,nawawi/go,CAFxX/go,golang/go,josharian/go,akutz/go,golang/go,CAFxX/go,nawawi/go,josharian/go