diff options
Diffstat (limited to 'contrib/llvm/lib/MC/MCInstPrinter.cpp')
-rw-r--r-- | contrib/llvm/lib/MC/MCInstPrinter.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/contrib/llvm/lib/MC/MCInstPrinter.cpp b/contrib/llvm/lib/MC/MCInstPrinter.cpp index 41d90ab..73f30ff 100644 --- a/contrib/llvm/lib/MC/MCInstPrinter.cpp +++ b/contrib/llvm/lib/MC/MCInstPrinter.cpp @@ -8,10 +8,11 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/MCInstPrinter.h" -#include "llvm/MC/MCInstrInfo.h" -#include "llvm/MC/MCAsmInfo.h" #include "llvm/ADT/StringRef.h" +#include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCInstrInfo.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -50,3 +51,11 @@ StringRef MCInstPrinter::markup(StringRef a, StringRef b) const { else return b; } + +/// Utility function to print immediates in decimal or hex. +format_object1<int64_t> MCInstPrinter::formatImm(const int64_t Value) const { + if (getPrintImmHex()) + return format("0x%" PRIx64, Value); + else + return format("%" PRId64, Value); +} |