[WIP] code generation refactor

This PR is based the llvmlite2 branch. My aim was to factor out the code generation machinery from the target context and into a separate facility. CUDA is probably broken as I don't have a device to test (yet).
I wonder if we can put `exceptions` in `library`.  Other functions in the same compilation unit needs to know about existing exceptions.  Perhaps, materialization of exception ID can be deferred to finalization.  We can put an external symbol for the exception ID in lowering