Development questions regarding debugging and control flow
You want to look at miner.cpp, and perhaps at rpc/mining.cpp for the generate function that's exposed to RPC.

blockencodings.cpp is pretty much only used for the compact blocks P2P format specified by BIP152, and has nothing to do with normal block generation.