2007-10-06 23:00:36 +02:00
|
|
|
//===-- Analysis.cpp ------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 21:36:04 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-10-06 23:00:36 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm-c/Analysis.h"
|
2011-08-19 03:36:54 +02:00
|
|
|
#include "llvm-c/Initialization.h"
|
2010-10-07 20:31:00 +02:00
|
|
|
#include "llvm/InitializePasses.h"
|
2007-10-06 23:00:36 +02:00
|
|
|
#include "llvm/Analysis/Verifier.h"
|
2008-02-20 12:08:44 +01:00
|
|
|
#include <cstring>
|
2007-10-06 23:00:36 +02:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2010-10-07 20:31:00 +02:00
|
|
|
/// initializeAnalysis - Initialize all passes linked into the Analysis library.
|
|
|
|
void llvm::initializeAnalysis(PassRegistry &Registry) {
|
|
|
|
initializeAliasAnalysisAnalysisGroup(Registry);
|
|
|
|
initializeAliasAnalysisCounterPass(Registry);
|
|
|
|
initializeAAEvalPass(Registry);
|
|
|
|
initializeAliasDebuggerPass(Registry);
|
|
|
|
initializeAliasSetPrinterPass(Registry);
|
|
|
|
initializeNoAAPass(Registry);
|
|
|
|
initializeBasicAliasAnalysisPass(Registry);
|
2011-07-25 21:25:40 +02:00
|
|
|
initializeBlockFrequencyInfoPass(Registry);
|
2011-06-04 03:16:30 +02:00
|
|
|
initializeBranchProbabilityInfoPass(Registry);
|
2010-10-07 20:31:00 +02:00
|
|
|
initializeCFGViewerPass(Registry);
|
|
|
|
initializeCFGPrinterPass(Registry);
|
|
|
|
initializeCFGOnlyViewerPass(Registry);
|
|
|
|
initializeCFGOnlyPrinterPass(Registry);
|
|
|
|
initializePrintDbgInfoPass(Registry);
|
2011-01-18 07:06:27 +01:00
|
|
|
initializeDominanceFrontierPass(Registry);
|
2010-10-07 20:31:00 +02:00
|
|
|
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);
|
|
|
|
initializeLoopDependenceAnalysisPass(Registry);
|
|
|
|
initializeLoopInfoPass(Registry);
|
|
|
|
initializeMemDepPrinterPass(Registry);
|
|
|
|
initializeMemoryDependenceAnalysisPass(Registry);
|
|
|
|
initializeModuleDebugInfoPrinterPass(Registry);
|
|
|
|
initializePostDominatorTreePass(Registry);
|
|
|
|
initializeProfileEstimatorPassPass(Registry);
|
|
|
|
initializeNoProfileInfoPass(Registry);
|
2011-01-29 02:09:53 +01:00
|
|
|
initializeNoPathProfileInfoPass(Registry);
|
2010-10-07 20:31:00 +02:00
|
|
|
initializeProfileInfoAnalysisGroup(Registry);
|
2011-01-29 02:09:53 +01:00
|
|
|
initializePathProfileInfoAnalysisGroup(Registry);
|
2010-10-07 20:31:00 +02:00
|
|
|
initializeLoaderPassPass(Registry);
|
2011-01-29 02:09:53 +01:00
|
|
|
initializePathProfileLoaderPassPass(Registry);
|
2010-10-07 20:31:00 +02:00
|
|
|
initializeProfileVerifierPassPass(Registry);
|
2011-01-29 02:09:53 +01:00
|
|
|
initializePathProfileVerifierPass(Registry);
|
2010-10-07 20:31:00 +02:00
|
|
|
initializeRegionInfoPass(Registry);
|
|
|
|
initializeRegionViewerPass(Registry);
|
|
|
|
initializeRegionPrinterPass(Registry);
|
|
|
|
initializeRegionOnlyViewerPass(Registry);
|
|
|
|
initializeRegionOnlyPrinterPass(Registry);
|
|
|
|
initializeScalarEvolutionPass(Registry);
|
|
|
|
initializeScalarEvolutionAliasAnalysisPass(Registry);
|
|
|
|
initializeTypeBasedAliasAnalysisPass(Registry);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMInitializeAnalysis(LLVMPassRegistryRef R) {
|
|
|
|
initializeAnalysis(*unwrap(R));
|
|
|
|
}
|
|
|
|
|
2010-01-09 23:27:07 +01:00
|
|
|
LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
|
|
|
|
char **OutMessages) {
|
2007-10-06 23:00:36 +02:00
|
|
|
std::string Messages;
|
2011-01-29 02:09:53 +01:00
|
|
|
|
2010-01-09 23:27:07 +01:00
|
|
|
LLVMBool Result = verifyModule(*unwrap(M),
|
2007-10-06 23:00:36 +02:00
|
|
|
static_cast<VerifierFailureAction>(Action),
|
|
|
|
OutMessages? &Messages : 0);
|
2011-01-29 02:09:53 +01:00
|
|
|
|
2007-10-06 23:00:36 +02:00
|
|
|
if (OutMessages)
|
|
|
|
*OutMessages = strdup(Messages.c_str());
|
2011-01-29 02:09:53 +01:00
|
|
|
|
2007-10-06 23:00:36 +02:00
|
|
|
return Result;
|
|
|
|
}
|
|
|
|
|
2010-01-09 23:27:07 +01:00
|
|
|
LLVMBool LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action) {
|
2007-10-06 23:00:36 +02:00
|
|
|
return verifyFunction(*unwrap<Function>(Fn),
|
|
|
|
static_cast<VerifierFailureAction>(Action));
|
|
|
|
}
|
|
|
|
|
2008-03-31 18:22:09 +02:00
|
|
|
void LLVMViewFunctionCFG(LLVMValueRef Fn) {
|
|
|
|
Function *F = unwrap<Function>(Fn);
|
|
|
|
F->viewCFG();
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMViewFunctionCFGOnly(LLVMValueRef Fn) {
|
|
|
|
Function *F = unwrap<Function>(Fn);
|
|
|
|
F->viewCFGOnly();
|
|
|
|
}
|