mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 12:50:30 +00:00
97b830a9d8
This debugger was designed to catch places where the old update API was failing to be used correctly. As I've removed the update API, it no longer serves any purpose. We can introduce new debugging aid passes around any future work w.r.t. updating AAs. Note that I've updated the documentation here, but really I need to rewrite the documentation to carefully spell out the ideas around stateful AA and how things are changing in the AA world. However, I'm hoping to do that as a follow-up to the refactoring of the AA infrastructure to work in both old and new pass managers so that I can write the documentation specific to that world. Differential Revision: http://reviews.llvm.org/D11984 llvm-svn: 244825
118 lines
4.1 KiB
C++
118 lines
4.1 KiB
C++
//===-- Analysis.cpp ------------------------------------------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm-c/Analysis.h"
|
|
#include "llvm-c/Initialization.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;
|
|
|
|
/// initializeAnalysis - Initialize all passes linked into the Analysis library.
|
|
void llvm::initializeAnalysis(PassRegistry &Registry) {
|
|
initializeAliasAnalysisAnalysisGroup(Registry);
|
|
initializeAliasAnalysisCounterPass(Registry);
|
|
initializeAAEvalPass(Registry);
|
|
initializeAliasSetPrinterPass(Registry);
|
|
initializeNoAAPass(Registry);
|
|
initializeBasicAliasAnalysisPass(Registry);
|
|
initializeBlockFrequencyInfoWrapperPassPass(Registry);
|
|
initializeBranchProbabilityInfoWrapperPassPass(Registry);
|
|
initializeCostModelAnalysisPass(Registry);
|
|
initializeCFGViewerPass(Registry);
|
|
initializeCFGPrinterPass(Registry);
|
|
initializeCFGOnlyViewerPass(Registry);
|
|
initializeCFGOnlyPrinterPass(Registry);
|
|
initializeCFLAliasAnalysisPass(Registry);
|
|
initializeDependenceAnalysisPass(Registry);
|
|
initializeDelinearizationPass(Registry);
|
|
initializeDivergenceAnalysisPass(Registry);
|
|
initializeDominanceFrontierPass(Registry);
|
|
initializeDomViewerPass(Registry);
|
|
initializeDomPrinterPass(Registry);
|
|
initializeDomOnlyViewerPass(Registry);
|
|
initializePostDomViewerPass(Registry);
|
|
initializeDomOnlyPrinterPass(Registry);
|
|
initializePostDomPrinterPass(Registry);
|
|
initializePostDomOnlyViewerPass(Registry);
|
|
initializePostDomOnlyPrinterPass(Registry);
|
|
initializeIVUsersPass(Registry);
|
|
initializeInstCountPass(Registry);
|
|
initializeIntervalPartitionPass(Registry);
|
|
initializeLazyValueInfoPass(Registry);
|
|
initializeLibCallAliasAnalysisPass(Registry);
|
|
initializeLintPass(Registry);
|
|
initializeLoopInfoWrapperPassPass(Registry);
|
|
initializeMemDepPrinterPass(Registry);
|
|
initializeMemDerefPrinterPass(Registry);
|
|
initializeMemoryDependenceAnalysisPass(Registry);
|
|
initializeModuleDebugInfoPrinterPass(Registry);
|
|
initializePostDominatorTreePass(Registry);
|
|
initializeRegionInfoPassPass(Registry);
|
|
initializeRegionViewerPass(Registry);
|
|
initializeRegionPrinterPass(Registry);
|
|
initializeRegionOnlyViewerPass(Registry);
|
|
initializeRegionOnlyPrinterPass(Registry);
|
|
initializeScalarEvolutionPass(Registry);
|
|
initializeScalarEvolutionAliasAnalysisPass(Registry);
|
|
initializeTargetTransformInfoWrapperPassPass(Registry);
|
|
initializeTypeBasedAliasAnalysisPass(Registry);
|
|
initializeScopedNoAliasAAPass(Registry);
|
|
}
|
|
|
|
void LLVMInitializeAnalysis(LLVMPassRegistryRef R) {
|
|
initializeAnalysis(*unwrap(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();
|
|
|
|
if (Action == LLVMAbortProcessAction && Result)
|
|
report_fatal_error("Broken module found, compilation aborted!");
|
|
|
|
if (OutMessages)
|
|
*OutMessages = strdup(MsgsOS.str().c_str());
|
|
|
|
return Result;
|
|
}
|
|
|
|
LLVMBool LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction 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) {
|
|
Function *F = unwrap<Function>(Fn);
|
|
F->viewCFG();
|
|
}
|
|
|
|
void LLVMViewFunctionCFGOnly(LLVMValueRef Fn) {
|
|
Function *F = unwrap<Function>(Fn);
|
|
F->viewCFGOnly();
|
|
}
|