Ir cleanup.
Ir cleanup.

- Added Ir.val_type utility routines
- Replaced some type asserts with exceptions
- Minor style cleanup

Former-commit-id: ed4c64eb4dd4e0321b05f8985f5e13f1acecc2ad
darkbuck/Halide,Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,Trass3r/Halide,Trass3r/Halide,Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,Trass3r/Halide,darkbuck/Halide,darkbuck/Halide,darkbuck/Halide,darkbuck/Halide