split buffer management and diagnostic printing out of the tblgen