diff --git a/llvm/test/Regression/Analysis/DSGraph/2003-06-29-IncompleteTDPass.ll b/llvm/test/Regression/Analysis/DSGraph/2003-06-29-IncompleteTDPass.ll index 0c462e1e6ea1..4b919c1a57bf 100644 --- a/llvm/test/Regression/Analysis/DSGraph/2003-06-29-IncompleteTDPass.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/DSGraph/2003-06-29-NodeCollapsing2.ll b/llvm/test/Regression/Analysis/DSGraph/2003-06-29-NodeCollapsing2.ll index 99aae03adf6b..f357694d7a25 100644 --- a/llvm/test/Regression/Analysis/DSGraph/2003-06-29-NodeCollapsing2.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/DSGraph/2003-06-30-TopDownResolve.ll b/llvm/test/Regression/Analysis/DSGraph/2003-06-30-TopDownResolve.ll index 6622eb2ea3e8..f0cd849a4a1a 100644 --- a/llvm/test/Regression/Analysis/DSGraph/2003-06-30-TopDownResolve.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/DSGraph/2003-07-01-FieldCollapse.ll b/llvm/test/Regression/Analysis/DSGraph/2003-07-01-FieldCollapse.ll index 3f1893ba03bc..58ddc46d49d3 100644 --- a/llvm/test/Regression/Analysis/DSGraph/2003-07-01-FieldCollapse.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/DSGraph/2003-07-16-ConstantExprCollapse.ll b/llvm/test/Regression/Analysis/DSGraph/2003-07-16-ConstantExprCollapse.ll index aec1e99fd8b8..38e57b888c6e 100644 --- a/llvm/test/Regression/Analysis/DSGraph/2003-07-16-ConstantExprCollapse.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/DSGraph/2003-11-02-NodeCollapsing.ll b/llvm/test/Regression/Analysis/DSGraph/2003-11-02-NodeCollapsing.ll index 37f5038cd440..3a58e057a7fc 100644 --- a/llvm/test/Regression/Analysis/DSGraph/2003-11-02-NodeCollapsing.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/DSGraph/2004-02-13-memcpy.ll b/llvm/test/Regression/Analysis/DSGraph/2004-02-13-memcpy.ll index 105709f12ecc..3b06bae73c66 100644 --- a/llvm/test/Regression/Analysis/DSGraph/2004-02-13-memcpy.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/DSGraph/2005-03-22-IncompleteGlobal.ll b/llvm/test/Regression/Analysis/DSGraph/2005-03-22-IncompleteGlobal.ll index 0af1efab27f8..1d3240217af7 100644 --- a/llvm/test/Regression/Analysis/DSGraph/2005-03-22-IncompleteGlobal.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/DSGraph/2006-03-27-LinkedCollapsed.ll b/llvm/test/Regression/Analysis/DSGraph/2006-03-27-LinkedCollapsed.ll index 06af90632338..ce1ebb920270 100644 --- a/llvm/test/Regression/Analysis/DSGraph/2006-03-27-LinkedCollapsed.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/DSGraph/2006-04-13-ZeroArrayStruct.ll b/llvm/test/Regression/Analysis/DSGraph/2006-04-13-ZeroArrayStruct.ll index c12bb9e83795..0fa6ba8d8f3c 100644 --- a/llvm/test/Regression/Analysis/DSGraph/2006-04-13-ZeroArrayStruct.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/DSGraph/2006-04-25-ZeroArrayStructUse.ll b/llvm/test/Regression/Analysis/DSGraph/2006-04-25-ZeroArrayStructUse.ll index b8238f06dd34..aa41920252fc 100644 --- a/llvm/test/Regression/Analysis/DSGraph/2006-04-25-ZeroArrayStructUse.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/DSGraph/FunctionPointerTable-const.ll b/llvm/test/Regression/Analysis/DSGraph/FunctionPointerTable-const.ll index 76c226570f56..4031a09fb232 100644 --- a/llvm/test/Regression/Analysis/DSGraph/FunctionPointerTable-const.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/DSGraph/GlobalsGraphFuncPtr.ll b/llvm/test/Regression/Analysis/DSGraph/GlobalsGraphFuncPtr.ll index 99ac4734d424..ea5c04e4c037 100644 --- a/llvm/test/Regression/Analysis/DSGraph/GlobalsGraphFuncPtr.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/DSGraph/HardBUCase.ll b/llvm/test/Regression/Analysis/DSGraph/HardBUCase.ll index 6d9aa055a920..318b4f28b9e5 100644 --- a/llvm/test/Regression/Analysis/DSGraph/HardBUCase.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/DSGraph/PhysicalSubtyping.ll b/llvm/test/Regression/Analysis/DSGraph/PhysicalSubtyping.ll index d9ac454522f6..59575484a43a 100644 --- a/llvm/test/Regression/Analysis/DSGraph/PhysicalSubtyping.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/DSGraph/SCCSimpleExample.ll b/llvm/test/Regression/Analysis/DSGraph/SCCSimpleExample.ll index 3c71c3461c3c..825c5797455b 100644 --- a/llvm/test/Regression/Analysis/DSGraph/SCCSimpleExample.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/DSGraph/constant_globals.ll b/llvm/test/Regression/Analysis/DSGraph/constant_globals.ll index f42aec91e5d2..2473d1dd8318 100644 --- a/llvm/test/Regression/Analysis/DSGraph/constant_globals.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/DSGraph/strcpy.ll b/llvm/test/Regression/Analysis/DSGraph/strcpy.ll index 7cb201198794..ae936d32a7d7 100644 --- a/llvm/test/Regression/Analysis/DSGraph/strcpy.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/Dominators/2003-05-12-UnreachableCode.ll b/llvm/test/Regression/Analysis/Dominators/2003-05-12-UnreachableCode.ll index e1e71cdc94b2..d781eb537425 100644 --- a/llvm/test/Regression/Analysis/Dominators/2003-05-12-UnreachableCode.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Analysis/LoopInfo/2003-05-15-NestingProblem.ll b/llvm/test/Regression/Analysis/LoopInfo/2003-05-15-NestingProblem.ll index 4feee420dd55..96099a8da974 100644 --- a/llvm/test/Regression/Analysis/LoopInfo/2003-05-15-NestingProblem.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Transforms/DSAnalysis/arraymerge.ll b/llvm/test/Regression/Transforms/DSAnalysis/arraymerge.ll index c4ac718c1c2d..30f458308e7b 100644 --- a/llvm/test/Regression/Transforms/DSAnalysis/arraymerge.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Transforms/DSAnalysis/arraytest.ll b/llvm/test/Regression/Transforms/DSAnalysis/arraytest.ll index 521bd630e354..bb6c4c148e06 100644 --- a/llvm/test/Regression/Transforms/DSAnalysis/arraytest.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Transforms/DSAnalysis/badcases.ll b/llvm/test/Regression/Transforms/DSAnalysis/badcases.ll index b841b6e8d850..a977f23bb571 100644 --- a/llvm/test/Regression/Transforms/DSAnalysis/badcases.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Transforms/DSAnalysis/basictest.ll b/llvm/test/Regression/Transforms/DSAnalysis/basictest.ll index 615e0219cf1d..a3583a1475ce 100644 --- a/llvm/test/Regression/Transforms/DSAnalysis/basictest.ll +++ b/llvm/test/Regression/Transforms/DSAnalysis/basictest.ll @@ -1,6 +1,6 @@ ; very simple test ; -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure implementation diff --git a/llvm/test/Regression/Transforms/DSAnalysis/fieldmerge.ll b/llvm/test/Regression/Transforms/DSAnalysis/fieldmerge.ll index 4dcefb7f3b4d..a754d0664361 100644 --- a/llvm/test/Regression/Transforms/DSAnalysis/fieldmerge.ll +++ b/llvm/test/Regression/Transforms/DSAnalysis/fieldmerge.ll @@ -1,5 +1,5 @@ ; -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure %str = type { int*, int* } diff --git a/llvm/test/Regression/Transforms/DSAnalysis/goodcases.ll b/llvm/test/Regression/Transforms/DSAnalysis/goodcases.ll index 1d545b3965e1..f6d9ff9fa285 100644 --- a/llvm/test/Regression/Transforms/DSAnalysis/goodcases.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Transforms/DSAnalysis/indcalltest.ll b/llvm/test/Regression/Transforms/DSAnalysis/indcalltest.ll index 16cb6bea18f3..1ec92d30d74f 100644 --- a/llvm/test/Regression/Transforms/DSAnalysis/indcalltest.ll +++ b/llvm/test/Regression/Transforms/DSAnalysis/indcalltest.ll @@ -1,5 +1,5 @@ ; -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure %G = global int 2 ; [#uses=1] %H = global int* null diff --git a/llvm/test/Regression/Transforms/DSAnalysis/misctests.ll b/llvm/test/Regression/Transforms/DSAnalysis/misctests.ll index 29c7079ac53f..acdbabf8362e 100644 --- a/llvm/test/Regression/Transforms/DSAnalysis/misctests.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Transforms/DSAnalysis/physicalsubtype.ll b/llvm/test/Regression/Transforms/DSAnalysis/physicalsubtype.ll index 2beb3eca6bcc..26fa511f40db 100644 --- a/llvm/test/Regression/Transforms/DSAnalysis/physicalsubtype.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Transforms/DSAnalysis/recursion.ll b/llvm/test/Regression/Transforms/DSAnalysis/recursion.ll index 6acdd24853a8..da075cd9c37a 100644 --- a/llvm/test/Regression/Transforms/DSAnalysis/recursion.ll +++ b/llvm/test/Regression/Transforms/DSAnalysis/recursion.ll @@ -1,4 +1,4 @@ -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure implementation ; Functions: diff --git a/llvm/test/Regression/Transforms/DSAnalysis/simplest-test.ll b/llvm/test/Regression/Transforms/DSAnalysis/simplest-test.ll index b75740396647..b398c2854676 100644 --- a/llvm/test/Regression/Transforms/DSAnalysis/simplest-test.ll +++ b/llvm/test/Regression/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/llvm/test/Regression/Transforms/DSAnalysis/simpletest.ll b/llvm/test/Regression/Transforms/DSAnalysis/simpletest.ll index 298aa836710b..80b94335d3d9 100644 --- a/llvm/test/Regression/Transforms/DSAnalysis/simpletest.ll +++ b/llvm/test/Regression/Transforms/DSAnalysis/simpletest.ll @@ -1,4 +1,4 @@ -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure implementation diff --git a/llvm/test/Regression/Transforms/DSAnalysis/structpadding.ll b/llvm/test/Regression/Transforms/DSAnalysis/structpadding.ll index 693c9888b98e..5b3c8b86a4db 100644 --- a/llvm/test/Regression/Transforms/DSAnalysis/structpadding.ll +++ b/llvm/test/Regression/Transforms/DSAnalysis/structpadding.ll @@ -1,4 +1,4 @@ -; RUN: analyze %s -tddatastructure +; RUN: opt -analyze %s -tddatastructure %str = type { int, int* } diff --git a/llvm/tools/Makefile b/llvm/tools/Makefile index 99e73960ac37..649c655be9ff 100644 --- a/llvm/tools/Makefile +++ b/llvm/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/llvm/tools/analyze/Makefile b/llvm/tools/analyze/Makefile deleted file mode 100644 index e3885a935819..000000000000 --- a/llvm/tools/analyze/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -##===- tools/analyze/Makefile ------------------------------*- Makefile -*-===## -# -# 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. -# -##===----------------------------------------------------------------------===## -LEVEL = ../.. -TOOLNAME = analyze -USEDLIBS = LLVMAsmParser.a LLVMBCReader.a LLVMAnalysis.a LLVMipa.a \ - LLVMDataStructure \ - LLVMScalarOpts.a LLVMTransforms.a LLVMTarget.a LLVMScalarOpts.a \ - LLVMTransformUtils.a LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a -REQUIRES_EH := 1 - -include $(LEVEL)/Makefile.common diff --git a/llvm/tools/analyze/analyze.cpp b/llvm/tools/analyze/analyze.cpp deleted file mode 100644 index e6b2be5adab9..000000000000 --- a/llvm/tools/analyze/analyze.cpp +++ /dev/null @@ -1,188 +0,0 @@ -//===- analyze.cpp - The LLVM analyze utility -----------------------------===// -// -// 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 utility is designed to print out the results of running various analysis -// passes on a program. This is useful for understanding a program, or for -// debugging an analysis pass. -// -// analyze --help - Output information about command line switches -// analyze --quiet - Do not print analysis name before output -// -//===----------------------------------------------------------------------===// - -#include "llvm/Module.h" -#include "llvm/PassManager.h" -#include "llvm/Bytecode/Reader.h" -#include "llvm/Assembly/Parser.h" -#include "llvm/Analysis/Verifier.h" -#include "llvm/Analysis/LinkAllAnalyses.h" -#include "llvm/Target/TargetData.h" -#include "llvm/Support/PassNameParser.h" -#include "llvm/System/Signals.h" -#include "llvm/Support/PluginLoader.h" -#include "llvm/Support/Timer.h" -#include "llvm/LinkAllVMCore.h" -#include - -using namespace llvm; - -namespace { - cl::opt - InputFilename(cl::Positional, cl::desc(""), cl::init("-"), - cl::value_desc("filename")); - - cl::opt Quiet("q", cl::desc("Don't print analysis pass names")); - cl::alias QuietA("quiet", cl::desc("Alias for -q"), - cl::aliasopt(Quiet)); - - cl::opt NoVerify("disable-verify", cl::Hidden, - cl::desc("Do not verify input module")); - - // The AnalysesList is automatically populated with registered Passes by the - // PassNameParser. - // - cl::list > - AnalysesList(cl::desc("Analyses available:")); - - Timer BytecodeLoadTimer("Bytecode Loader"); -} - -struct ModulePassPrinter : public ModulePass { - const PassInfo *PassToPrint; - ModulePassPrinter(const PassInfo *PI) : PassToPrint(PI) {} - - virtual bool runOnModule(Module &M) { - if (!Quiet) { - std::cout << "Printing analysis '" << PassToPrint->getPassName() << "':\n"; - getAnalysisID(PassToPrint).print(std::cout, &M); - } - - // Get and print pass... - return false; - } - - virtual const char *getPassName() const { return "'Pass' Printer"; } - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequiredID(PassToPrint); - AU.setPreservesAll(); - } -}; - -struct FunctionPassPrinter : public FunctionPass { - const PassInfo *PassToPrint; - FunctionPassPrinter(const PassInfo *PI) : PassToPrint(PI) {} - - virtual bool runOnFunction(Function &F) { - if (!Quiet) { - std::cout << "Printing analysis '" << PassToPrint->getPassName() - << "' for function '" << F.getName() << "':\n"; - } - // Get and print pass... - getAnalysisID(PassToPrint).print(std::cout, F.getParent()); - return false; - } - - virtual const char *getPassName() const { return "FunctionPass Printer"; } - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequiredID(PassToPrint); - AU.setPreservesAll(); - } -}; - -struct BasicBlockPassPrinter : public BasicBlockPass { - const PassInfo *PassToPrint; - BasicBlockPassPrinter(const PassInfo *PI) : PassToPrint(PI) {} - - virtual bool runOnBasicBlock(BasicBlock &BB) { - if (!Quiet) { - std::cout << "Printing Analysis info for BasicBlock '" << BB.getName() - << "': Pass " << PassToPrint->getPassName() << ":\n"; - } - - // Get and print pass... - getAnalysisID(PassToPrint).print(std::cout, BB.getParent()->getParent()); - return false; - } - - virtual const char *getPassName() const { return "BasicBlockPass Printer"; } - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequiredID(PassToPrint); - AU.setPreservesAll(); - } -}; - - - -int main(int argc, char **argv) { - try { - cl::ParseCommandLineOptions(argc, argv, " llvm analysis printer tool\n"); - sys::PrintStackTraceOnErrorSignal(); - - Module *CurMod = 0; - try { -#if 0 - TimeRegion RegionTimer(BytecodeLoadTimer); -#endif - CurMod = ParseBytecodeFile(InputFilename); - if (!CurMod && !(CurMod = ParseAssemblyFile(InputFilename))){ - std::cerr << argv[0] << ": input file didn't read correctly.\n"; - return 1; - } - } catch (const ParseException &E) { - std::cerr << argv[0] << ": " << E.getMessage() << "\n"; - return 1; - } - - // Create a PassManager to hold and optimize the collection of passes we are - // about to build... - // - PassManager Passes; - - // Add an appropriate TargetData instance for this module... - Passes.add(new TargetData(CurMod)); - - // Make sure the input LLVM is well formed. - if (!NoVerify) - Passes.add(createVerifierPass()); - - // Create a new optimization pass for each one specified on the command line - for (unsigned i = 0; i < AnalysesList.size(); ++i) { - const PassInfo *Analysis = AnalysesList[i]; - - if (Analysis->getNormalCtor()) { - Pass *P = Analysis->getNormalCtor()(); - Passes.add(P); - - if (BasicBlockPass *BBP = dynamic_cast(P)) - Passes.add(new BasicBlockPassPrinter(Analysis)); - else if (FunctionPass *FP = dynamic_cast(P)) - Passes.add(new FunctionPassPrinter(Analysis)); - else - Passes.add(new ModulePassPrinter(Analysis)); - - } else - std::cerr << argv[0] << ": cannot create pass: " - << Analysis->getPassName() << "\n"; - } - - Passes.run(*CurMod); - - delete CurMod; - return 0; - - } catch (const std::string& msg) { - std::cerr << argv[0] << ": " << msg << "\n"; - } catch (...) { - std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; - } - return 1; -} diff --git a/llvm/tools/analyze/AnalysisWrappers.cpp b/llvm/tools/opt/AnalysisWrappers.cpp similarity index 100% rename from llvm/tools/analyze/AnalysisWrappers.cpp rename to llvm/tools/opt/AnalysisWrappers.cpp diff --git a/llvm/tools/analyze/GraphPrinters.cpp b/llvm/tools/opt/GraphPrinters.cpp similarity index 100% rename from llvm/tools/analyze/GraphPrinters.cpp rename to llvm/tools/opt/GraphPrinters.cpp diff --git a/llvm/tools/opt/Makefile b/llvm/tools/opt/Makefile index f310639c08b2..9e4cddfa976b 100644 --- a/llvm/tools/opt/Makefile +++ b/llvm/tools/opt/Makefile @@ -10,9 +10,9 @@ LEVEL = ../.. TOOLNAME = opt REQUIRES_EH := 1 -USEDLIBS = LLVMBCReader.a LLVMBCWriter.a LLVMInstrumentation.a \ - LLVMScalarOpts.a LLVMipo.a LLVMipa.a LLVMDataStructure LLVMTransforms.a \ - LLVMTarget.a LLVMTransformUtils.a LLVMAnalysis.a LLVMCore.a LLVMSupport.a \ - LLVMbzip2.a LLVMSystem.a +USEDLIBS = LLVMAsmParser.a LLVMBCReader.a LLVMBCWriter.a LLVMInstrumentation.a \ + LLVMScalarOpts.a LLVMipo.a LLVMipa.a LLVMDataStructure \ + LLVMTransforms.a LLVMTarget.a LLVMTransformUtils.a LLVMAnalysis.a \ + LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a include $(LEVEL)/Makefile.common diff --git a/llvm/tools/analyze/PrintSCC.cpp b/llvm/tools/opt/PrintSCC.cpp similarity index 100% rename from llvm/tools/analyze/PrintSCC.cpp rename to llvm/tools/opt/PrintSCC.cpp diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp index 096506ff3929..b67892bb34a8 100644 --- a/llvm/tools/opt/opt.cpp +++ b/llvm/tools/opt/opt.cpp @@ -8,11 +8,12 @@ //===----------------------------------------------------------------------===// // // Optimizations may be specified an arbitrary number of times on the command -// line, they are run in the order specified. +// line, They are run in the order specified. // //===----------------------------------------------------------------------===// #include "llvm/Module.h" +#include "llvm/Assembly/Parser.h" #include "llvm/PassManager.h" #include "llvm/Bytecode/Reader.h" #include "llvm/Bytecode/WriteBytecodePass.h" @@ -24,6 +25,8 @@ #include "llvm/System/Signals.h" #include "llvm/Support/PluginLoader.h" #include "llvm/Support/SystemUtils.h" +#include "llvm/Support/Timer.h" +#include "llvm/Analysis/LinkAllAnalyses.h" #include "llvm/Transforms/LinkAllPasses.h" #include "llvm/LinkAllVMCore.h" #include @@ -43,7 +46,8 @@ OptimizationList(cl::desc("Optimizations available:")); // Other command line options... // static cl::opt -InputFilename(cl::Positional, cl::desc(""), cl::init("-")); +InputFilename(cl::Positional, cl::desc(""), + cl::init("-"), cl::value_desc("filename")); static cl::opt OutputFilename("o", cl::desc("Override output filename"), @@ -68,6 +72,91 @@ Quiet("q", cl::desc("Obsolete option"), cl::Hidden); static cl::alias QuietA("quiet", cl::desc("Alias for -q"), cl::aliasopt(Quiet)); +static cl::opt +AnalyzeOnly("analyze", cl::desc("Only perform analysis, no optimization")); + +// The AnalysesList is automatically populated with registered Passes by the +// PassNameParser. +static + cl::list > + AnalysesList(cl::desc("Analyses available:")); + +static Timer BytecodeLoadTimer("Bytecode Loader"); + +// ---------- Define Printers for module and function passes ------------ +namespace { + +struct ModulePassPrinter : public ModulePass { + const PassInfo *PassToPrint; + ModulePassPrinter(const PassInfo *PI) : PassToPrint(PI) {} + + virtual bool runOnModule(Module &M) { + if (!Quiet) { + std::cout << "Printing analysis '" << PassToPrint->getPassName() + << "':\n"; + getAnalysisID(PassToPrint).print(std::cout, &M); + } + + // Get and print pass... + return false; + } + + virtual const char *getPassName() const { return "'Pass' Printer"; } + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequiredID(PassToPrint); + AU.setPreservesAll(); + } +}; + +struct FunctionPassPrinter : public FunctionPass { + const PassInfo *PassToPrint; + FunctionPassPrinter(const PassInfo *PI) : PassToPrint(PI) {} + + virtual bool runOnFunction(Function &F) { + if (!Quiet) { + std::cout << "Printing analysis '" << PassToPrint->getPassName() + << "' for function '" << F.getName() << "':\n"; + } + // Get and print pass... + getAnalysisID(PassToPrint).print(std::cout, F.getParent()); + return false; + } + + virtual const char *getPassName() const { return "FunctionPass Printer"; } + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequiredID(PassToPrint); + AU.setPreservesAll(); + } +}; + +struct BasicBlockPassPrinter : public BasicBlockPass { + const PassInfo *PassToPrint; + BasicBlockPassPrinter(const PassInfo *PI) : PassToPrint(PI) {} + + virtual bool runOnBasicBlock(BasicBlock &BB) { + if (!Quiet) { + std::cout << "Printing Analysis info for BasicBlock '" << BB.getName() + << "': Pass " << PassToPrint->getPassName() << ":\n"; + } + + // Get and print pass... + getAnalysisID(PassToPrint).print( + std::cout, BB.getParent()->getParent()); + return false; + } + + virtual const char *getPassName() const { return "BasicBlockPass Printer"; } + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequiredID(PassToPrint); + AU.setPreservesAll(); + } +}; + +} // anonymous namespace + //===----------------------------------------------------------------------===// // main for opt @@ -75,9 +164,63 @@ QuietA("quiet", cl::desc("Alias for -q"), cl::aliasopt(Quiet)); int main(int argc, char **argv) { try { cl::ParseCommandLineOptions(argc, argv, - " llvm .bc -> .bc modular optimizer\n"); + " llvm .bc -> .bc modular optimizer and analysis printer \n"); sys::PrintStackTraceOnErrorSignal(); + if (AnalyzeOnly) { + Module *CurMod = 0; + try { +#if 0 + TimeRegion RegionTimer(BytecodeLoadTimer); +#endif + CurMod = ParseBytecodeFile(InputFilename); + if (!CurMod && !(CurMod = ParseAssemblyFile(InputFilename))){ + std::cerr << argv[0] << ": input file didn't read correctly.\n"; + return 1; + } + } catch (const ParseException &E) { + std::cerr << argv[0] << ": " << E.getMessage() << "\n"; + return 1; + } + + // Create a PassManager to hold and optimize the collection of passes we + // are about to build... + PassManager Passes; + + // Add an appropriate TargetData instance for this module... + Passes.add(new TargetData(CurMod)); + + // Make sure the input LLVM is well formed. + if (!NoVerify) + Passes.add(createVerifierPass()); + + // Create a new optimization pass for each one specified on the + // command line + for (unsigned i = 0; i < AnalysesList.size(); ++i) { + const PassInfo *Analysis = AnalysesList[i]; + + if (Analysis->getNormalCtor()) { + Pass *P = Analysis->getNormalCtor()(); + Passes.add(P); + + if (BasicBlockPass *BBP = dynamic_cast(P)) + Passes.add(new BasicBlockPassPrinter(Analysis)); + else if (FunctionPass *FP = dynamic_cast(P)) + Passes.add(new FunctionPassPrinter(Analysis)); + else + Passes.add(new ModulePassPrinter(Analysis)); + + } else + std::cerr << argv[0] << ": cannot create pass: " + << Analysis->getPassName() << "\n"; + } + + Passes.run(*CurMod); + + delete CurMod; + return 0; + } + // Allocate a full target machine description only if necessary... // FIXME: The choice of target should be controllable on the command line. std::auto_ptr target; @@ -169,6 +312,7 @@ int main(int argc, char **argv) { Passes.run(*M.get()); return 0; + } catch (const std::string& msg) { std::cerr << argv[0] << ": " << msg << "\n"; } catch (...) {