SI-7852 for GenBCode

Avoid null checks for "someLiteral".== and SomeModule.==. This has
been implemented in GenICode in #2954.

Introduces a trait to share code between GenICode and GenBCode. This
is just a start, more such refactorings will come quite certainly.

Test already exists. The new `scala-nightly-genbcode-2.1X.x` nightly build
runs all tests on the new backend (that's how the difference was found).