CodeGen: Refactor dynamic_cast and typeid

This refactors the emission of dynamic_cast and typeid expressions so
that ABI specific knowledge lives in appropriate places.  There are
quite a few benefits for having the two implementations share a common
core like sharing logic for optimization opportunities.

While we are at it, clean up the tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211402 91177308-0d34-0410-b5e6-96231b3b80d8