aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/LLVMContext.cpp
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2014-04-08 16:42:34 +0000
committerDiego Novillo <dnovillo@google.com>2014-04-08 16:42:34 +0000
commita9298b22976513857f7c8ded491e67c6a95a04c9 (patch)
tree0056e02220998ef3308d2892cf14773fb8df5980 /llvm/lib/IR/LLVMContext.cpp
parent1e25822f4d8fb8300e9292ef3d670e9d9803c83a (diff)
downloadllvm-a9298b22976513857f7c8ded491e67c6a95a04c9.zip
llvm-a9298b22976513857f7c8ded491e67c6a95a04c9.tar.gz
llvm-a9298b22976513857f7c8ded491e67c6a95a04c9.tar.bz2
Add support for optimization reports.
Summary: This patch adds backend support for -Rpass=, which indicates the name of the optimization pass that should emit remarks stating when it made a transformation to the code. Pass names are taken from their DEBUG_NAME definitions. When emitting an optimization report diagnostic, the lack of debug information causes the diagnostic to use "<unknown>:0:0" as the location string. This is the back end counterpart for http://llvm-reviews.chandlerc.com/D3226 Reviewers: qcolombet CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3227 llvm-svn: 205774
Diffstat (limited to 'llvm/lib/IR/LLVMContext.cpp')
-rw-r--r--llvm/lib/IR/LLVMContext.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp
index 1bfc515..3f05561 100644
--- a/llvm/lib/IR/LLVMContext.cpp
+++ b/llvm/lib/IR/LLVMContext.cpp
@@ -15,6 +15,7 @@
#include "llvm/IR/LLVMContext.h"
#include "LLVMContextImpl.h"
#include "llvm/IR/Constants.h"
+#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/IR/Instruction.h"
@@ -155,6 +156,13 @@ void LLVMContext::emitError(unsigned LocCookie, const Twine &ErrorStr) {
diagnose(DiagnosticInfoInlineAsm(LocCookie, ErrorStr));
}
+void LLVMContext::emitOptimizationRemark(const char *PassName,
+ const Function &Fn,
+ const DebugLoc &DLoc,
+ const Twine &Msg) {
+ diagnose(DiagnosticInfoOptimizationRemark(PassName, Fn, DLoc, Msg));
+}
+
//===----------------------------------------------------------------------===//
// Metadata Kind Uniquing
//===----------------------------------------------------------------------===//