mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +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 llvm {
|
||||||
namespace sys {
|
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
|
/// This function provides some "glue" code to call external disassembler
|
||||||
/// libraries.
|
/// libraries.
|
||||||
std::string disassembleBuffer(uint8_t* start, size_t length, uint64_t pc = 0);
|
std::string disassembleBuffer(uint8_t* start, size_t length, uint64_t pc = 0);
|
||||||
|
@ -876,6 +876,7 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
|
|||||||
Relocations.clear();
|
Relocations.clear();
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
if (sys::hasDisassembler())
|
||||||
DOUT << "Disassembled code:\n"
|
DOUT << "Disassembled code:\n"
|
||||||
<< sys::disassembleBuffer(FnStart, FnEnd-FnStart, (uintptr_t)FnStart);
|
<< sys::disassembleBuffer(FnStart, FnEnd-FnStart, (uintptr_t)FnStart);
|
||||||
#endif
|
#endif
|
||||||
|
@ -26,6 +26,16 @@
|
|||||||
|
|
||||||
using namespace llvm;
|
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,
|
std::string llvm::sys::disassembleBuffer(uint8_t* start, size_t length,
|
||||||
uint64_t pc) {
|
uint64_t pc) {
|
||||||
std::stringstream res;
|
std::stringstream res;
|
||||||
|
Loading…
Reference in New Issue
Block a user