Thermodynamic theory of computation