added helper functions for IR generation