Switch to insertion-ordered sets and maps in the IR

Fixes #85.

The side effect is also a predictible IR and bytecode generation across
compilations, which is useful for, say, diagnosis.