diff options
41 files changed, 189 insertions, 514 deletions
diff --git a/test/Analysis/DSGraph/2003-06-29-IncompleteTDPass.ll b/test/Analysis/DSGraph/2003-06-29-IncompleteTDPass.ll index 0c462e1e6e..4b919c1a57 100644 --- a/test/Analysis/DSGraph/2003-06-29-IncompleteTDPass.ll +++ b/test/Analysis/DSGraph/2003-06-29-IncompleteTDPass.ll @@ -1,4 +1,4 @@ -; RUN: analyze %s -datastructure-gc -dsgc-dspass=td -dsgc-check-flags=Ptr:HR +; RUN: opt -analyze %s -datastructure-gc -dsgc-dspass=td -dsgc-check-flags=Ptr:HR diff --git a/test/Analysis/DSGraph/2003-06-29-NodeCollapsing2.ll b/test/Analysis/DSGraph/2003-06-29-NodeCollapsing2.ll index 99aae03adf..f357694d7a 100644 --- a/test/Analysis/DSGraph/2003-06-29-NodeCollapsing2.ll +++ b/test/Analysis/DSGraph/2003-06-29-NodeCollapsing2.ll @@ -1,7 +1,7 @@ ; This is the same testcase as 2003-06-29-NodeCollapsing2.ll, but it uses the ; graph checker. ; -; RUN: analyze %s -datastructure-gc -dsgc-abort-if-any-collapsed +; RUN: opt -analyze %s -datastructure-gc -dsgc-abort-if-any-collapsed ; %T = type { int} diff --git a/test/Analysis/DSGraph/2003-06-30-TopDownResolve.ll b/test/Analysis/DSGraph/2003-06-30-TopDownResolve.ll index 6622eb2ea3..f0cd849a4a 100644 --- a/test/Analysis/DSGraph/2003-06-30-TopDownResolve.ll +++ b/test/Analysis/DSGraph/2003-06-30-TopDownResolve.ll @@ -1,4 +1,4 @@ -; RUN: analyze %s -datastructure-gc -dsgc-dspass=td -dsgc-check-flags=X:GM +; RUN: opt -analyze %s -datastructure-gc -dsgc-dspass=td -dsgc-check-flags=X:GM %G = internal global int 5 diff --git a/test/Analysis/DSGraph/2003-07-01-FieldCollapse.ll b/test/Analysis/DSGraph/2003-07-01-FieldCollapse.ll index 3f1893ba03..58ddc46d49 100644 --- a/test/Analysis/DSGraph/2003-07-01-FieldCollapse.ll +++ b/test/Analysis/DSGraph/2003-07-01-FieldCollapse.ll @@ -1,4 +1,4 @@ -; RUN: analyze %s -datastructure-gc -dsgc-abort-if-any-collapsed +; RUN: opt -analyze %s -datastructure-gc -dsgc-abort-if-any-collapsed %X = internal global { int, short, short } { int 1, short 2, short 3 } diff --git a/test/Analysis/DSGraph/2003-07-16-ConstantExprCollapse.ll b/test/Analysis/DSGraph/2003-07-16-ConstantExprCollapse.ll index aec1e99fd8..38e57b888c 100644 --- a/test/Analysis/DSGraph/2003-07-16-ConstantExprCollapse.ll +++ b/test/Analysis/DSGraph/2003-07-16-ConstantExprCollapse.ll @@ -1,6 +1,6 @@ ; This should cause the global node to collapse!! ; XFAIL: * -; RUN: analyze %s -datastructure-gc --dsgc-check-flags=test:GAU +; RUN: opt -analyze %s -datastructure-gc --dsgc-check-flags=test:GAU %Tree = type { int, %Tree*, %Tree* } %T5 = external global %Tree diff --git a/test/Analysis/DSGraph/2003-11-02-NodeCollapsing.ll b/test/Analysis/DSGraph/2003-11-02-NodeCollapsing.ll index 37f5038cd4..3a58e057a7 100644 --- a/test/Analysis/DSGraph/2003-11-02-NodeCollapsing.ll +++ b/test/Analysis/DSGraph/2003-11-02-NodeCollapsing.ll @@ -1,7 +1,7 @@ ; This is the same testcase as 2003-06-29-NodeCollapsing2.ll, but it uses the ; graph checker. ; -; RUN: analyze %s -datastructure-gc -dsgc-abort-if-any-collapsed +; RUN: opt -analyze %s -datastructure-gc -dsgc-abort-if-any-collapsed ; %S = type { double, int } diff --git a/test/Analysis/DSGraph/2004-02-13-memcpy.ll b/test/Analysis/DSGraph/2004-02-13-memcpy.ll index 105709f12e..3b06bae73c 100644 --- a/test/Analysis/DSGraph/2004-02-13-memcpy.ll +++ b/test/Analysis/DSGraph/2004-02-13-memcpy.ll @@ -1,5 +1,5 @@ -; RUN: analyze %s -datastructure-gc -dsgc-check-flags=Xn:SMR -; RUN: analyze %s -datastructure-gc -dsgc-check-flags=X:SMR +; RUN: opt -analyze %s -datastructure-gc -dsgc-check-flags=Xn:SMR +; RUN: opt -analyze %s -datastructure-gc -dsgc-check-flags=X:SMR declare void %llvm.memcpy.i32(sbyte*, sbyte*, uint, uint) declare void %llvm.memmove.i32(sbyte*, sbyte*, uint, uint) diff --git a/test/Analysis/DSGraph/2005-03-22-IncompleteGlobal.ll b/test/Analysis/DSGraph/2005-03-22-IncompleteGlobal.ll index 0af1efab27..1d3240217a 100644 --- a/test/Analysis/DSGraph/2005-03-22-IncompleteGlobal.ll +++ b/test/Analysis/DSGraph/2005-03-22-IncompleteGlobal.ll @@ -1,5 +1,5 @@ -; RUN: analyze %s -datastructure-gc -dsgc-check-flags=G:GIM -dsgc-dspass=bu &&\ -; RUN: analyze %s -datastructure-gc -dsgc-check-flags=G:GIM -dsgc-dspass=td +; RUN: opt -analyze %s -datastructure-gc -dsgc-check-flags=G:GIM -dsgc-dspass=bu &&\ +; RUN: opt -analyze %s -datastructure-gc -dsgc-check-flags=G:GIM -dsgc-dspass=td %S = type { double, int } diff --git a/test/Analysis/DSGraph/2006-03-27-LinkedCollapsed.ll b/test/Analysis/DSGraph/2006-03-27-LinkedCollapsed.ll index 06af906323..ce1ebb9202 100644 --- a/test/Analysis/DSGraph/2006-03-27-LinkedCollapsed.ll +++ b/test/Analysis/DSGraph/2006-03-27-LinkedCollapsed.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | analyze -datastructure +; RUN: llvm-as < %s | opt -analyze -datastructure target endian = little target pointersize = 32 diff --git a/test/Analysis/DSGraph/2006-04-13-ZeroArrayStruct.ll b/test/Analysis/DSGraph/2006-04-13-ZeroArrayStruct.ll index c12bb9e837..0fa6ba8d8f 100644 --- a/test/Analysis/DSGraph/2006-04-13-ZeroArrayStruct.ll +++ b/test/Analysis/DSGraph/2006-04-13-ZeroArrayStruct.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | analyze -datastructure +; RUN: llvm-as < %s | opt -analyze -datastructure ; ModuleID = 'bug3.bc' target endian = little diff --git a/test/Analysis/DSGraph/2006-04-25-ZeroArrayStructUse.ll b/test/Analysis/DSGraph/2006-04-25-ZeroArrayStructUse.ll index b8238f06dd..aa41920252 100644 --- a/test/Analysis/DSGraph/2006-04-25-ZeroArrayStructUse.ll +++ b/test/Analysis/DSGraph/2006-04-25-ZeroArrayStructUse.ll @@ -1,4 +1,4 @@ -; RUN: analyze %s -datastructure-gc -dsgc-check-flags=x:IA +; RUN: opt -analyze %s -datastructure-gc -dsgc-check-flags=x:IA ; ModuleID = 'bug3.bc' target endian = little diff --git a/test/Analysis/DSGraph/FunctionPointerTable-const.ll b/test/Analysis/DSGraph/FunctionPointerTable-const.ll index 76c226570f..4031a09fb2 100644 --- a/test/Analysis/DSGraph/FunctionPointerTable-const.ll +++ b/test/Analysis/DSGraph/FunctionPointerTable-const.ll @@ -1,7 +1,7 @@ ; FIXME: this should be SHM for bu, but change it for now since besides incompleteness ; this is working -; RUN: analyze %s -datastructure-gc -dsgc-dspass=bu -dsgc-check-flags=Y:SHIM && \ -; RUN: analyze %s -datastructure-gc -dsgc-dspass=td -dsgc-check-flags=P1:SHM,P2:SHM +; RUN: opt -analyze %s -datastructure-gc -dsgc-dspass=bu -dsgc-check-flags=Y:SHIM && \ +; RUN: opt -analyze %s -datastructure-gc -dsgc-dspass=td -dsgc-check-flags=P1:SHM,P2:SHM %G = internal constant [2 x int*(int*)*] [ int*(int*)* %callee1, int*(int*)* %callee2 diff --git a/test/Analysis/DSGraph/GlobalsGraphFuncPtr.ll b/test/Analysis/DSGraph/GlobalsGraphFuncPtr.ll index 99ac4734d4..ea5c04e4c0 100644 --- a/test/Analysis/DSGraph/GlobalsGraphFuncPtr.ll +++ b/test/Analysis/DSGraph/GlobalsGraphFuncPtr.ll @@ -5,7 +5,7 @@ ; -- globals in GG pointed to by latter should be marked I, but not other nodes ; ; FIXME: KnownPtr should be just S. -; RUN: analyze %s -datastructure-gc -dsgc-check-flags=KnownPtr:SI,UnknownPtr:SI -dsgc-dspass=bu +; RUN: opt -analyze %s -datastructure-gc -dsgc-check-flags=KnownPtr:SI,UnknownPtr:SI -dsgc-dspass=bu %Z = internal global int 0 %X = internal global int 0 diff --git a/test/Analysis/DSGraph/HardBUCase.ll b/test/Analysis/DSGraph/HardBUCase.ll index 6d9aa055a9..318b4f28b9 100644 --- a/test/Analysis/DSGraph/HardBUCase.ll +++ b/test/Analysis/DSGraph/HardBUCase.ll @@ -1,4 +1,4 @@ -; RUN: analyze %s -budatastructure -dont-print-ds +; RUN: opt -analyze %s -budatastructure -dont-print-ds %MidFnTy = type void (\2*) diff --git a/test/Analysis/DSGraph/PhysicalSubtyping.ll b/test/Analysis/DSGraph/PhysicalSubtyping.ll index d9ac454522..59575484a4 100644 --- a/test/Analysis/DSGraph/PhysicalSubtyping.ll +++ b/test/Analysis/DSGraph/PhysicalSubtyping.ll @@ -1,6 +1,6 @@ ; Test to check for support for "physical subtyping" ; -; RUN: analyze %s -datastructure-gc -dsgc-abort-if-any-collapsed +; RUN: opt -analyze %s -datastructure-gc -dsgc-abort-if-any-collapsed ; %S = type { int } %T = type { int, float, double } diff --git a/test/Analysis/DSGraph/SCCSimpleExample.ll b/test/Analysis/DSGraph/SCCSimpleExample.ll index 3c71c3461c..825c579745 100644 --- a/test/Analysis/DSGraph/SCCSimpleExample.ll +++ b/test/Analysis/DSGraph/SCCSimpleExample.ll @@ -1,5 +1,5 @@ -; RUN: analyze %s -datastructure-gc --dsgc-abort-if-merged=Y,BVal +; RUN: opt -analyze %s -datastructure-gc --dsgc-abort-if-merged=Y,BVal implementation diff --git a/test/Analysis/DSGraph/constant_globals.ll b/test/Analysis/DSGraph/constant_globals.ll index f42aec91e5..2473d1dd83 100644 --- a/test/Analysis/DSGraph/constant_globals.ll +++ b/test/Analysis/DSGraph/constant_globals.ll @@ -1,5 +1,5 @@ ; FIXME: A should just be SM -; RUN: analyze %s -datastructure-gc -dsgc-dspass=bu -dsgc-check-flags=A:SIM +; RUN: opt -analyze %s -datastructure-gc -dsgc-dspass=bu -dsgc-check-flags=A:SIM ; Constant globals should not mark stuff incomplete. This should allow the ; bu pass to resolve the indirect call immediately in "test", allowing %A to ; be marked complete and the store to happen. diff --git a/test/Analysis/DSGraph/strcpy.ll b/test/Analysis/DSGraph/strcpy.ll index 7cb2011987..ae936d32a7 100644 --- a/test/Analysis/DSGraph/strcpy.ll +++ b/test/Analysis/DSGraph/strcpy.ll @@ -3,7 +3,7 @@ ; has no defined way to check for this, so DSA can know that strcpy doesn't ; require merging the input arguments. -; RUN: analyze %s -datastructure-gc --dsgc-abort-if-merged=A,B --dsgc-check-flags=A:ASM,B:ASR --dsgc-dspass=bu +; RUN: opt -analyze %s -datastructure-gc --dsgc-abort-if-merged=A,B --dsgc-check-flags=A:ASM,B:ASR --dsgc-dspass=bu implementation diff --git a/test/Analysis/Dominators/2003-05-12-UnreachableCode.ll b/test/Analysis/Dominators/2003-05-12-UnreachableCode.ll index e1e71cdc94..d781eb5374 100644 --- a/test/Analysis/Dominators/2003-05-12-UnreachableCode.ll +++ b/test/Analysis/Dominators/2003-05-12-UnreachableCode.ll @@ -1,4 +1,4 @@ -; RUN: analyze %s -domset -disable-verify +; RUN: opt -analyze %s -domset -disable-verify ; int %re_match_2() { ENTRY: diff --git a/test/Analysis/LoopInfo/2003-05-15-NestingProblem.ll b/test/Analysis/LoopInfo/2003-05-15-NestingProblem.ll index 4feee420dd..96099a8da9 100644 --- a/test/Analysis/LoopInfo/2003-05-15-NestingProblem.ll +++ b/test/Analysis/LoopInfo/2003-05-15-NestingProblem.ll @@ -1,7 +1,7 @@ ; This testcase was incorrectly computing that the loopentry.7 loop was ; not a child of the loopentry.6 loop. ; -; RUN: analyze %s -loops | grep "^ Loop Containing: %loopentry.7" +; RUN: opt -analyze %s -loops | grep "^ Loop Containing: %loopentry.7" void %getAndMoveToFrontDecode() { ; No predecessors! br label %endif.2 diff --git a/test/Transforms/DSAnalysis/arraymerge.ll b/test/Transforms/DSAnalysis/arraymerge.ll index c4ac718c1c..30f458308e 100644 --- a/test/Transforms/DSAnalysis/arraymerge.ll +++ b/test/Transforms/DSAnalysis/arraymerge.ll @@ -2,7 +2,7 @@ ; folded completely away if possible. This is a very common case, so it should ; be efficient. ; -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure ; implementation diff --git a/test/Transforms/DSAnalysis/arraytest.ll b/test/Transforms/DSAnalysis/arraytest.ll index 521bd630e3..bb6c4c148e 100644 --- a/test/Transforms/DSAnalysis/arraytest.ll +++ b/test/Transforms/DSAnalysis/arraytest.ll @@ -1,5 +1,5 @@ ; -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure %crazy = type [2 x { [2 x sbyte], short } ] implementation diff --git a/test/Transforms/DSAnalysis/badcases.ll b/test/Transforms/DSAnalysis/badcases.ll index b841b6e8d8..a977f23bb5 100644 --- a/test/Transforms/DSAnalysis/badcases.ll +++ b/test/Transforms/DSAnalysis/badcases.ll @@ -1,6 +1,6 @@ ; This file contains a list of situations where node folding should happen... ; -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure implementation diff --git a/test/Transforms/DSAnalysis/basictest.ll b/test/Transforms/DSAnalysis/basictest.ll index 615e0219cf..a3583a1475 100644 --- a/test/Transforms/DSAnalysis/basictest.ll +++ b/test/Transforms/DSAnalysis/basictest.ll @@ -1,6 +1,6 @@ ; very simple test ; -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure implementation diff --git a/test/Transforms/DSAnalysis/fieldmerge.ll b/test/Transforms/DSAnalysis/fieldmerge.ll index 4dcefb7f3b..a754d06643 100644 --- a/test/Transforms/DSAnalysis/fieldmerge.ll +++ b/test/Transforms/DSAnalysis/fieldmerge.ll @@ -1,5 +1,5 @@ ; -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure %str = type { int*, int* } diff --git a/test/Transforms/DSAnalysis/goodcases.ll b/test/Transforms/DSAnalysis/goodcases.ll index 1d545b3965..f6d9ff9fa2 100644 --- a/test/Transforms/DSAnalysis/goodcases.ll +++ b/test/Transforms/DSAnalysis/goodcases.ll @@ -1,6 +1,6 @@ ; This file contains a list of cases where node folding should NOT happen ; -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure ; implementation diff --git a/test/Transforms/DSAnalysis/indcalltest.ll b/test/Transforms/DSAnalysis/indcalltest.ll index 16cb6bea18..1ec92d30d7 100644 --- a/test/Transforms/DSAnalysis/indcalltest.ll +++ b/test/Transforms/DSAnalysis/indcalltest.ll @@ -1,5 +1,5 @@ ; -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure %G = global int 2 ; <int*> [#uses=1] %H = global int* null diff --git a/test/Transforms/DSAnalysis/misctests.ll b/test/Transforms/DSAnalysis/misctests.ll index 29c7079ac5..acdbabf836 100644 --- a/test/Transforms/DSAnalysis/misctests.ll +++ b/test/Transforms/DSAnalysis/misctests.ll @@ -1,5 +1,5 @@ ; -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure int* %test1(int *%A) { %R = getelementptr int* %A, long 1 diff --git a/test/Transforms/DSAnalysis/physicalsubtype.ll b/test/Transforms/DSAnalysis/physicalsubtype.ll index 2beb3eca6b..26fa511f40 100644 --- a/test/Transforms/DSAnalysis/physicalsubtype.ll +++ b/test/Transforms/DSAnalysis/physicalsubtype.ll @@ -1,6 +1,6 @@ ; A test for "physical subtyping" used in some C programs... ; -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure ; %ST = type { int, int* } ; "Subtype" %DT = type { int, int*, int } ; "derived type" diff --git a/test/Transforms/DSAnalysis/recursion.ll b/test/Transforms/DSAnalysis/recursion.ll index 6acdd24853..da075cd9c3 100644 --- a/test/Transforms/DSAnalysis/recursion.ll +++ b/test/Transforms/DSAnalysis/recursion.ll @@ -1,4 +1,4 @@ -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure implementation ; Functions: diff --git a/test/Transforms/DSAnalysis/simplest-test.ll b/test/Transforms/DSAnalysis/simplest-test.ll index b757403966..b398c28546 100644 --- a/test/Transforms/DSAnalysis/simplest-test.ll +++ b/test/Transforms/DSAnalysis/simplest-test.ll @@ -1,4 +1,4 @@ -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure void %foo(int* %X) { store int 4, int* %X diff --git a/test/Transforms/DSAnalysis/simpletest.ll b/test/Transforms/DSAnalysis/simpletest.ll index 298aa83671..80b94335d3 100644 --- a/test/Transforms/DSAnalysis/simpletest.ll +++ b/test/Transforms/DSAnalysis/simpletest.ll @@ -1,4 +1,4 @@ -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure implementation diff --git a/test/Transforms/DSAnalysis/structpadding.ll b/test/Transforms/DSAnalysis/structpadding.ll index 693c9888b9..5b3c8b86a4 100644 --- a/test/Transforms/DSAnalysis/structpadding.ll +++ b/test/Transforms/DSAnalysis/structpadding.ll @@ -1,4 +1,4 @@ -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure %str = type { int, int* } diff --git a/tools/Makefile b/tools/Makefile index 99e73960ac..649c655be9 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -9,8 +9,7 @@ LEVEL := .. PARALLEL_DIRS := llvm-config llvm-as llvm-dis opt gccas llc llvm-link lli gccld\ - llvm-stub analyze llvm-extract llvm-nm llvm-prof llvm-ar \ - llvm-ranlib llvm-bcanalyzer llvmc llvm-ld llvm-db bugpoint \ - llvm2cpp + llvm-stub llvm-extract llvm-nm llvm-prof llvm-ar llvm-ranlib \ + llvm-bcanalyzer llvmc llvm-ld llvm-db bugpoint llvm2cpp include $(LEVEL)/Makefile.common diff --git a/tools/analyze/AnalysisWrappers.cpp b/tools/analyze/AnalysisWrappers.cpp deleted file mode 100644 index b371d50ef3..0000000000 --- a/tools/analyze/AnalysisWrappers.cpp +++ /dev/null @@ -1,81 +0,0 @@ -//===- AnalysisWrappers.cpp - Wrappers around non-pass analyses -----------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines pass wrappers around LLVM analyses that don't make sense to -// be passes. It provides a nice standard pass interface to these classes so -// that they can be printed out by analyze. -// -// These classes are separated out of analyze.cpp so that it is more clear which -// code is the integral part of the analyze tool, and which part of the code is -// just making it so more passes are available. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Module.h" -#include "llvm/Pass.h" -#include "llvm/Support/CallSite.h" -#include "llvm/Analysis/CallGraph.h" -#include <iostream> -using namespace llvm; - -namespace { - /// ExternalFunctionsPassedConstants - This pass prints out call sites to - /// external functions that are called with constant arguments. This can be - /// useful when looking for standard library functions we should constant fold - /// or handle in alias analyses. - struct ExternalFunctionsPassedConstants : public ModulePass { - virtual bool runOnModule(Module &M) { - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (I->isExternal()) { - bool PrintedFn = false; - for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); - UI != E; ++UI) - if (Instruction *User = dyn_cast<Instruction>(*UI)) { - CallSite CS = CallSite::get(User); - if (CS.getInstruction()) { - for (CallSite::arg_iterator AI = CS.arg_begin(), - E = CS.arg_end(); AI != E; ++AI) - if (isa<Constant>(*AI)) { - if (!PrintedFn) { - std::cerr << "Function '" << I->getName() << "':\n"; - PrintedFn = true; - } - std::cerr << *User; - break; - } - } - } - } - - return false; - } - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesAll(); - } - }; - - RegisterAnalysis<ExternalFunctionsPassedConstants> - P1("externalfnconstants", "Print external fn callsites passed constants"); - - struct CallGraphPrinter : public ModulePass { - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesAll(); - AU.addRequired<CallGraph>(); - } - virtual bool runOnModule(Module &M) { return false; } - - virtual void print(std::ostream &OS, const Module *M) const { - getAnalysis<CallGraph>().print(OS, M); - } - }; - - RegisterAnalysis<CallGraphPrinter> - P2("callgraph", "Print a call graph"); -} diff --git a/tools/analyze/GraphPrinters.cpp b/tools/analyze/GraphPrinters.cpp deleted file mode 100644 index 8826cd2a77..0000000000 --- a/tools/analyze/GraphPrinters.cpp +++ /dev/null @@ -1,77 +0,0 @@ -//===- GraphPrinters.cpp - DOT printers for various graph types -----------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines several printers for various different types of graphs used -// by the LLVM infrastructure. It uses the generic graph interface to convert -// the graph into a .dot graph. These graphs can then be processed with the -// "dot" tool to convert them to postscript or some other suitable format. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Support/GraphWriter.h" -#include "llvm/Pass.h" -#include "llvm/Value.h" -#include "llvm/Analysis/CallGraph.h" -#include <fstream> -using namespace llvm; - -template<typename GraphType> -static void WriteGraphToFile(std::ostream &O, const std::string &GraphName, - const GraphType >) { - std::string Filename = GraphName + ".dot"; - O << "Writing '" << Filename << "'..."; - std::ofstream F(Filename.c_str()); - - if (F.good()) - WriteGraph(F, GT); - else - O << " error opening file for writing!"; - O << "\n"; -} - - -//===----------------------------------------------------------------------===// -// Call Graph Printer -//===----------------------------------------------------------------------===// - -namespace llvm { - template<> - struct DOTGraphTraits<CallGraph*> : public DefaultDOTGraphTraits { - static std::string getGraphName(CallGraph *F) { - return "Call Graph"; - } - - static std::string getNodeLabel(CallGraphNode *Node, CallGraph *Graph) { - if (Node->getFunction()) - return ((Value*)Node->getFunction())->getName(); - else - return "Indirect call node"; - } - }; -} - - -namespace { - struct CallGraphPrinter : public ModulePass { - virtual bool runOnModule(Module &M) { - |