Register template globals in compiler pass

Closes #114