mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 02:52:53 +02:00
[CodeGen] Teach opt remarks how to print MI instructions.
This will be used with GISel opt remarks. llvm-svn: 296012
This commit is contained in:
parent
66d4daa6cf
commit
c860642291
@ -22,6 +22,7 @@
|
||||
namespace llvm {
|
||||
class MachineBasicBlock;
|
||||
class MachineBlockFrequencyInfo;
|
||||
class MachineInstr;
|
||||
|
||||
/// \brief Common features for diagnostics dealing with optimization remarks
|
||||
/// that are used by machine passes.
|
||||
@ -34,6 +35,12 @@ public:
|
||||
*MBB->getParent()->getFunction(), DLoc),
|
||||
MBB(MBB) {}
|
||||
|
||||
/// MI-specific kinds of diagnostic Arguments.
|
||||
struct MachineArgument : public DiagnosticInfoOptimizationBase::Argument {
|
||||
/// Print an entire MachineInstr.
|
||||
MachineArgument(StringRef Key, const MachineInstr &MI);
|
||||
};
|
||||
|
||||
static bool classof(const DiagnosticInfo *DI) {
|
||||
return DI->getKind() >= DK_FirstMachineRemark &&
|
||||
DI->getKind() <= DK_LastMachineRemark;
|
||||
@ -116,6 +123,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/// Extend llvm::ore:: with MI-specific helper names.
|
||||
namespace ore {
|
||||
using MNV = DiagnosticInfoMIROptimization::MachineArgument;
|
||||
}
|
||||
|
||||
/// The optimization diagnostic interface.
|
||||
///
|
||||
/// It allows reporting when optimizations are performed and when they are not
|
||||
|
@ -15,12 +15,22 @@
|
||||
|
||||
#include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h"
|
||||
#include "llvm/CodeGen/LazyMachineBlockFrequencyInfo.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/IR/DebugInfo.h"
|
||||
#include "llvm/IR/DiagnosticInfo.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
DiagnosticInfoMIROptimization::MachineArgument::MachineArgument(
|
||||
StringRef MKey, const MachineInstr &MI)
|
||||
: Argument() {
|
||||
Key = MKey;
|
||||
|
||||
raw_string_ostream OS(Val);
|
||||
MI.print(OS, /*SkipOpers=*/false, /*SkipDebugLoc=*/true);
|
||||
}
|
||||
|
||||
Optional<uint64_t>
|
||||
MachineOptimizationRemarkEmitter::computeHotness(const MachineBasicBlock &MBB) {
|
||||
if (!MBFI)
|
||||
|
Loading…
Reference in New Issue
Block a user