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.
BCodeICodeCommon through composition rather than inheritance
Merge pull request #3721 from lrytz/t7852

SI-7852 for GenBCode