Fixed some bugs.
[llvm/zpu.git] / lib / Analysis / Analysis.cpp
blobb2a109bd57bf2baae534fbc26453f06c29dba0f9
1 //===-- Analysis.cpp ------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
10 #include "llvm-c/Analysis.h"
11 #include "llvm/InitializePasses.h"
12 #include "llvm/Analysis/Verifier.h"
13 #include <cstring>
15 using namespace llvm;
17 /// initializeAnalysis - Initialize all passes linked into the Analysis library.
18 void llvm::initializeAnalysis(PassRegistry &Registry) {
19 initializeAliasAnalysisAnalysisGroup(Registry);
20 initializeAliasAnalysisCounterPass(Registry);
21 initializeAAEvalPass(Registry);
22 initializeAliasDebuggerPass(Registry);
23 initializeAliasSetPrinterPass(Registry);
24 initializeNoAAPass(Registry);
25 initializeBasicAliasAnalysisPass(Registry);
26 initializeCFGViewerPass(Registry);
27 initializeCFGPrinterPass(Registry);
28 initializeCFGOnlyViewerPass(Registry);
29 initializeCFGOnlyPrinterPass(Registry);
30 initializePrintDbgInfoPass(Registry);
31 initializeDomViewerPass(Registry);
32 initializeDomPrinterPass(Registry);
33 initializeDomOnlyViewerPass(Registry);
34 initializePostDomViewerPass(Registry);
35 initializeDomOnlyPrinterPass(Registry);
36 initializePostDomPrinterPass(Registry);
37 initializePostDomOnlyViewerPass(Registry);
38 initializePostDomOnlyPrinterPass(Registry);
39 initializeIVUsersPass(Registry);
40 initializeInstCountPass(Registry);
41 initializeIntervalPartitionPass(Registry);
42 initializeLazyValueInfoPass(Registry);
43 initializeLibCallAliasAnalysisPass(Registry);
44 initializeLintPass(Registry);
45 initializeLiveValuesPass(Registry);
46 initializeLoopDependenceAnalysisPass(Registry);
47 initializeLoopInfoPass(Registry);
48 initializeMemDepPrinterPass(Registry);
49 initializeMemoryDependenceAnalysisPass(Registry);
50 initializeModuleDebugInfoPrinterPass(Registry);
51 initializePostDominatorTreePass(Registry);
52 initializePostDominanceFrontierPass(Registry);
53 initializeProfileEstimatorPassPass(Registry);
54 initializeNoProfileInfoPass(Registry);
55 initializeProfileInfoAnalysisGroup(Registry);
56 initializeLoaderPassPass(Registry);
57 initializeProfileVerifierPassPass(Registry);
58 initializeRegionInfoPass(Registry);
59 initializeRegionViewerPass(Registry);
60 initializeRegionPrinterPass(Registry);
61 initializeRegionOnlyViewerPass(Registry);
62 initializeRegionOnlyPrinterPass(Registry);
63 initializeScalarEvolutionPass(Registry);
64 initializeScalarEvolutionAliasAnalysisPass(Registry);
65 initializeTypeBasedAliasAnalysisPass(Registry);
68 void LLVMInitializeAnalysis(LLVMPassRegistryRef R) {
69 initializeAnalysis(*unwrap(R));
72 LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
73 char **OutMessages) {
74 std::string Messages;
76 LLVMBool Result = verifyModule(*unwrap(M),
77 static_cast<VerifierFailureAction>(Action),
78 OutMessages? &Messages : 0);
80 if (OutMessages)
81 *OutMessages = strdup(Messages.c_str());
83 return Result;
86 LLVMBool LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action) {
87 return verifyFunction(*unwrap<Function>(Fn),
88 static_cast<VerifierFailureAction>(Action));
91 void LLVMViewFunctionCFG(LLVMValueRef Fn) {
92 Function *F = unwrap<Function>(Fn);
93 F->viewCFG();
96 void LLVMViewFunctionCFGOnly(LLVMValueRef Fn) {
97 Function *F = unwrap<Function>(Fn);
98 F->viewCFGOnly();