Add support for generating switch instructions

This isn't strictly needed as branches can accomplish the same thing.
However, it can be a lot more concise and understandable in some
situations
Change genTypeCheck to use the switch instruction

This is unlikely to make a performance difference but it causes
significant reduction and simplification in typegen and our generated
Scala and LLVM IR