rustc: Move code for discovering the crate entry point into its own pass

It doesn't have anything to do with resolve and the logic will likely get
more involved in the future, after #4433