Register template globals via compiler pass

Closes #114