summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2016-11-08 01:12:17 +0000
committerTim Northover <tnorthover@apple.com>2016-11-08 01:12:17 +0000
commit60f2349b50a29a993595dff6b56203fd7594a55e (patch)
tree9bb6504b3b65bd259b0a72fba37cc2b6cf2ea1bf /llvm/lib/CodeGen
parent5e052985496b6fd9785024a7c4dacace7cbe4072 (diff)
downloadbcm5719-llvm-60f2349b50a29a993595dff6b56203fd7594a55e.tar.gz
bcm5719-llvm-60f2349b50a29a993595dff6b56203fd7594a55e.zip
GlobalISel: improve error diagnostics when IRTranslation fails.
llvm-svn: 286190
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index dcf69f5e060..79cce6a6f96 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -38,6 +38,13 @@ INITIALIZE_PASS_DEPENDENCY(TargetPassConfig)
INITIALIZE_PASS_END(IRTranslator, DEBUG_TYPE, "IRTranslator LLVM IR -> MI",
false, false)
+static void reportTranslationError(const Value &V, const Twine &Message) {
+ std::string ErrStorage;
+ raw_string_ostream Err(ErrStorage);
+ Err << Message << ": " << V << '\n';
+ report_fatal_error(Err.str());
+}
+
IRTranslator::IRTranslator() : MachineFunctionPass(ID), MRI(nullptr) {
initializeIRTranslatorPass(*PassRegistry::getPassRegistry());
}
@@ -67,7 +74,7 @@ unsigned IRTranslator::getOrCreateVReg(const Value &Val) {
MachineFunctionProperties::Property::FailedISel);
return 0;
}
- report_fatal_error("unable to translate constant");
+ reportTranslationError(Val, "unable to translate constant");
}
}
}
@@ -661,9 +668,8 @@ bool IRTranslator::runOnMachineFunction(MachineFunction &MF) {
for (const Instruction &Inst: BB) {
bool Succeeded = translate(Inst);
if (!Succeeded) {
- DEBUG(dbgs() << "Cannot translate: " << Inst << '\n');
if (TPC->isGlobalISelAbortEnabled())
- report_fatal_error("Unable to translate instruction");
+ reportTranslationError(Inst, "unable to translate instruction");
MF.getProperties().set(MachineFunctionProperties::Property::FailedISel);
break;
}
OpenPOWER on IntegriCloud