mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-15 07:59:57 +00:00
Checkin debug implementation of MCE
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4893 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ffc2d6f485
commit
f815aebd20
41
lib/CodeGen/MachineCodeEmitter.cpp
Normal file
41
lib/CodeGen/MachineCodeEmitter.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
//===-- MachineCodeEmitter.cpp - Implement the MachineCodeEmitter itf -----===//
|
||||
//
|
||||
// This file implements the MachineCodeEmitter interface.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/CodeGen/MachineCodeEmitter.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/Function.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace {
|
||||
struct DebugMachineCodeEmitter : public MachineCodeEmitter {
|
||||
void startFunction(MachineFunction &F) {
|
||||
std::cout << "\n**** Writing machine code for function: "
|
||||
<< F.getFunction()->getName() << "\n";
|
||||
}
|
||||
void finishFunction(MachineFunction &F) {
|
||||
std::cout << "\n";
|
||||
}
|
||||
void startBasicBlock(MachineBasicBlock &BB) {
|
||||
std::cout << "\n--- Basic Block: " << BB.getBasicBlock()->getName()<<"\n";
|
||||
}
|
||||
|
||||
void emitByte(unsigned char B) {
|
||||
std::cout << "0x" << std::hex << (unsigned int)B << std::dec << " ";
|
||||
}
|
||||
void emitPCRelativeDisp(Value *V) {
|
||||
std::cout << "<" << V->getName() << ": 0xXX 0xXX 0xXX 0xXX> ";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// createDebugMachineCodeEmitter - Return a dynamically allocated machine
|
||||
/// code emitter, which just prints the opcodes and fields out the cout. This
|
||||
/// can be used for debugging users of the MachineCodeEmitter interface.
|
||||
///
|
||||
MachineCodeEmitter *MachineCodeEmitter::createDebugMachineCodeEmitter() {
|
||||
return new DebugMachineCodeEmitter();
|
||||
}
|
Loading…
Reference in New Issue
Block a user