mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Implement PR1240
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34959 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
415c1f7438
commit
c6551ffdd5
@ -21,6 +21,10 @@
|
||||
namespace llvm {
|
||||
namespace sys {
|
||||
|
||||
/// This function returns true, if there is possible to use some external
|
||||
/// disassembler library. False otherwise.
|
||||
bool hasDisassembler(void);
|
||||
|
||||
/// This function provides some "glue" code to call external disassembler
|
||||
/// libraries.
|
||||
std::string disassembleBuffer(uint8_t* start, size_t length, uint64_t pc = 0);
|
||||
|
@ -876,8 +876,9 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
|
||||
Relocations.clear();
|
||||
|
||||
#ifndef NDEBUG
|
||||
DOUT << "Disassembled code:\n"
|
||||
<< sys::disassembleBuffer(FnStart, FnEnd-FnStart, (uintptr_t)FnStart);
|
||||
if (sys::hasDisassembler())
|
||||
DOUT << "Disassembled code:\n"
|
||||
<< sys::disassembleBuffer(FnStart, FnEnd-FnStart, (uintptr_t)FnStart);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
|
@ -26,6 +26,16 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
bool llvm::sys::hasDisassembler(void)
|
||||
{
|
||||
#if defined (__i386__) || defined (__amd64__) || defined (__x86_64__)
|
||||
// We have option to enable udis86 library.
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string llvm::sys::disassembleBuffer(uint8_t* start, size_t length,
|
||||
uint64_t pc) {
|
||||
std::stringstream res;
|
||||
|
Loading…
Reference in New Issue
Block a user