summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/lib/Analysis/Analysis.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2014-11-24 17:02:24 +0000
committerdim <dim@FreeBSD.org>2014-11-24 17:02:24 +0000
commit2c8643c6396b0a3db33430cf9380e70bbb9efce0 (patch)
tree4df130b28021d86e13bf4565ef58c1c5a5e093b4 /contrib/llvm/lib/Analysis/Analysis.cpp
parent678318cd20f7db4e6c6b85d83fe00fa327b04fca (diff)
parente27feadae0885aa074df58ebfda2e7a7f7a7d590 (diff)
downloadFreeBSD-src-2c8643c6396b0a3db33430cf9380e70bbb9efce0.zip
FreeBSD-src-2c8643c6396b0a3db33430cf9380e70bbb9efce0.tar.gz
Merge llvm 3.5.0 release from ^/vendor/llvm/dist, resolve conflicts, and
preserve our customizations, where necessary.
Diffstat (limited to 'contrib/llvm/lib/Analysis/Analysis.cpp')
-rw-r--r--contrib/llvm/lib/Analysis/Analysis.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/contrib/llvm/lib/Analysis/Analysis.cpp b/contrib/llvm/lib/Analysis/Analysis.cpp
index 98f2a55..c58012f 100644
--- a/contrib/llvm/lib/Analysis/Analysis.cpp
+++ b/contrib/llvm/lib/Analysis/Analysis.cpp
@@ -9,10 +9,11 @@
#include "llvm-c/Analysis.h"
#include "llvm-c/Initialization.h"
-#include "llvm/Analysis/Verifier.h"
-#include "llvm/InitializePasses.h"
#include "llvm/IR/Module.h"
+#include "llvm/IR/Verifier.h"
+#include "llvm/InitializePasses.h"
#include "llvm/PassRegistry.h"
+#include "llvm/Support/raw_ostream.h"
#include <cstring>
using namespace llvm;
@@ -47,6 +48,7 @@ void llvm::initializeAnalysis(PassRegistry &Registry) {
initializeIVUsersPass(Registry);
initializeInstCountPass(Registry);
initializeIntervalPartitionPass(Registry);
+ initializeJumpInstrTableInfoPass(Registry);
initializeLazyValueInfoPass(Registry);
initializeLibCallAliasAnalysisPass(Registry);
initializeLintPass(Registry);
@@ -55,7 +57,7 @@ void llvm::initializeAnalysis(PassRegistry &Registry) {
initializeMemoryDependenceAnalysisPass(Registry);
initializeModuleDebugInfoPrinterPass(Registry);
initializePostDominatorTreePass(Registry);
- initializeRegionInfoPass(Registry);
+ initializeRegionInfoPassPass(Registry);
initializeRegionViewerPass(Registry);
initializeRegionPrinterPass(Registry);
initializeRegionOnlyViewerPass(Registry);
@@ -72,21 +74,34 @@ void LLVMInitializeAnalysis(LLVMPassRegistryRef R) {
LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
char **OutMessages) {
+ raw_ostream *DebugOS = Action != LLVMReturnStatusAction ? &errs() : nullptr;
std::string Messages;
+ raw_string_ostream MsgsOS(Messages);
+
+ LLVMBool Result = verifyModule(*unwrap(M), OutMessages ? &MsgsOS : DebugOS);
+
+ // Duplicate the output to stderr.
+ if (DebugOS && OutMessages)
+ *DebugOS << MsgsOS.str();
- LLVMBool Result = verifyModule(*unwrap(M),
- static_cast<VerifierFailureAction>(Action),
- OutMessages? &Messages : 0);
+ if (Action == LLVMAbortProcessAction && Result)
+ report_fatal_error("Broken module found, compilation aborted!");
if (OutMessages)
- *OutMessages = strdup(Messages.c_str());
+ *OutMessages = strdup(MsgsOS.str().c_str());
return Result;
}
LLVMBool LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action) {
- return verifyFunction(*unwrap<Function>(Fn),
- static_cast<VerifierFailureAction>(Action));
+ LLVMBool Result = verifyFunction(
+ *unwrap<Function>(Fn), Action != LLVMReturnStatusAction ? &errs()
+ : nullptr);
+
+ if (Action == LLVMAbortProcessAction && Result)
+ report_fatal_error("Broken function found, compilation aborted!");
+
+ return Result;
}
void LLVMViewFunctionCFG(LLVMValueRef Fn) {
OpenPOWER on IntegriCloud