1. A method of optimizing an intermediate representation of program code used during the translation of the program code, comprising: identifying register definitions in the intermediate representation; determining whether a top-level expression for an identified register definition is a byteswap operation; and applying a lazy byteswapping optimization algorithm to delay performance of said byteswap operation on a value until a byteswapped value is actually required.