summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/ResetMachineFunctionPass.cpp
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2016-08-31 18:43:01 +0000
committerQuentin Colombet <qcolombet@apple.com>2016-08-31 18:43:01 +0000
commit612cd1fdd64cc7593b38115abd0e1bfb6f552b9d (patch)
treeed7c7cb984bd4086734bee3fdc20fb396b4b53bb /llvm/lib/CodeGen/ResetMachineFunctionPass.cpp
parent0a243f47b0e88ef348100234ec7a6cc2d9e43728 (diff)
downloadbcm5719-llvm-612cd1fdd64cc7593b38115abd0e1bfb6f552b9d.tar.gz
bcm5719-llvm-612cd1fdd64cc7593b38115abd0e1bfb6f552b9d.zip
[ResetMachineFunction] Emit the diagnostic isel fallback when asked.
This pass is now able to report when the function is being reset. llvm-svn: 280272
Diffstat (limited to 'llvm/lib/CodeGen/ResetMachineFunctionPass.cpp')
-rw-r--r--llvm/lib/CodeGen/ResetMachineFunctionPass.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/ResetMachineFunctionPass.cpp b/llvm/lib/CodeGen/ResetMachineFunctionPass.cpp
index 3b7729a0540..07a8259a70c 100644
--- a/llvm/lib/CodeGen/ResetMachineFunctionPass.cpp
+++ b/llvm/lib/CodeGen/ResetMachineFunctionPass.cpp
@@ -13,6 +13,7 @@
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/Support/Debug.h"
using namespace llvm;
@@ -20,11 +21,14 @@ using namespace llvm;
namespace {
class ResetMachineFunction : public MachineFunctionPass {
+ /// Tells whether or not this pass should emit a fallback
+ /// diagnostic when it resets a function.
+ bool EmitFallbackDiag;
+
public:
static char ID; // Pass identification, replacement for typeid
- ResetMachineFunction() :
- MachineFunctionPass(ID) {
- }
+ ResetMachineFunction(bool EmitFallbackDiag = false)
+ : MachineFunctionPass(ID), EmitFallbackDiag(EmitFallbackDiag) {}
const char *getPassName() const override {
return "ResetMachineFunction";
@@ -35,6 +39,11 @@ namespace {
MachineFunctionProperties::Property::FailedISel)) {
DEBUG(dbgs() << "Reseting: " << MF.getName() << '\n');
MF.reset();
+ if (EmitFallbackDiag) {
+ const Function &F = *MF.getFunction();
+ DiagnosticInfoISelFallback DiagFallback(F);
+ F.getContext().diagnose(DiagFallback);
+ }
return true;
}
return false;
@@ -48,6 +57,6 @@ INITIALIZE_PASS(ResetMachineFunction, DEBUG_TYPE,
"reset machine function if ISel failed", false, false)
MachineFunctionPass *
-llvm::createResetMachineFunctionPass() {
- return new ResetMachineFunction();
+llvm::createResetMachineFunctionPass(bool EmitFallbackDiag = false) {
+ return new ResetMachineFunction(EmitFallbackDiag);
}
OpenPOWER on IntegriCloud