llvm/Support/Endian.h contains a bunch of functions and classes for working with values whose endianness is known at compile time. But it does not contain anything for working with values where the endianness is only known at runtime.
This patch adds overloads of read and write that take the endianness not as a template parameter, but as a function argument. The versions of the function that use the template parameter are updated to call the version that takes the runtime argument. Since all these functions are inlined, the demotion from a compile-time value to a runtime value should not incur any additional overhead.
The long term motivation for this is to convert LLDB's endian-aware code to use LLVM instead of reinventing all of their own code for doing byte swaps, theyir own enumeration for representing byte order, etc. For now, this just adds the necessary machinery.
Since the template functions now call the runtime functions, no additional tests are necessary, as there are already tests written against the templated versions of the functions.