diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-11-22 16:59:20 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-11-22 16:59:20 -0800 |
commit | 52dbb5df6fcadc576d18e2f0f459986d01bb6191 (patch) | |
tree | f307183e5584729b5b88d56bed744b213301af37 /lib/Target/CppBackend/CPPBackend.cpp | |
parent | 3ad9c4ef9547611c451eefe9e5c35b03cdad3fe0 (diff) |
ir debugger helper
Diffstat (limited to 'lib/Target/CppBackend/CPPBackend.cpp')
-rw-r--r-- | lib/Target/CppBackend/CPPBackend.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 453da61561..77de00c477 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -51,6 +51,13 @@ using namespace llvm; #define dumpfail(x) { fprintf(stderr, x "\n"); fprintf(stderr, "%s : %d\n", __FILE__, __LINE__); report_fatal_error("fail"); } #define dumpfailv(x, ...) { fprintf(stderr, x "\n", __VA_ARGS__); fprintf(stderr, "%s : %d\n", __FILE__, __LINE__); report_fatal_error("fail"); } +#define dumpIR(value) { \ + std::string temp; \ + raw_string_ostream stream(temp); \ + stream << *value; \ + std::cout << temp << "\n"; \ +} + #undef assert #define assert(x) { if (!x) dumpfail(#x); } @@ -2026,6 +2033,7 @@ void CppWriter::allocateConstant(const Constant* CV) { GlobalData = &GlobalData64; break; default: + dumpIR(CV); assert(false); } // assuming compiler is little endian |