add id-name mapping for gates, and use that for template rules for
forward compatibility