From 1fc65a65fe54635d0e564559ba5a7b8a8a42d4d6 Mon Sep 17 00:00:00 2001 From: dim Date: Mon, 11 Oct 2010 17:22:16 +0000 Subject: Remove more unneeded files and directories from contrib/llvm. This still allows us to build tblgen and clang, and further reduces the footprint in the tree. Approved by: rpaulo (mentor) --- contrib/llvm/utils/DSAclean.py | 32 - contrib/llvm/utils/DSAextract.py | 111 - contrib/llvm/utils/FileCheck/CMakeLists.txt | 11 - contrib/llvm/utils/FileCheck/FileCheck.cpp | 732 --- contrib/llvm/utils/FileCheck/Makefile | 21 - contrib/llvm/utils/FileUpdate/CMakeLists.txt | 11 - contrib/llvm/utils/FileUpdate/FileUpdate.cpp | 87 - contrib/llvm/utils/FileUpdate/Makefile | 21 - contrib/llvm/utils/GenLibDeps.pl | 388 -- contrib/llvm/utils/GetSourceVersion | 27 - contrib/llvm/utils/Makefile | 22 - contrib/llvm/utils/Misc/zkill | 276 -- contrib/llvm/utils/NLT.schema | 8 - contrib/llvm/utils/NewNightlyTest.pl | 836 ---- contrib/llvm/utils/NightlyTest.gnuplot | 214 - contrib/llvm/utils/NightlyTestTemplate.html | 244 - contrib/llvm/utils/OldenDataRecover.pl | 37 - contrib/llvm/utils/PerfectShuffle/Makefile | 18 - .../llvm/utils/PerfectShuffle/PerfectShuffle.cpp | 571 --- contrib/llvm/utils/TableGen/CMakeLists.txt | 46 - contrib/llvm/utils/TableGen/Makefile | 20 - contrib/llvm/utils/UpdateCMakeLists.pl | 119 - contrib/llvm/utils/bugpoint/RemoteRunSafely.sh | 105 - contrib/llvm/utils/buildit/GNUmakefile | 131 - contrib/llvm/utils/buildit/build_llvm | 373 -- contrib/llvm/utils/cgiplotNLT.pl | 68 - contrib/llvm/utils/check-each-file | 150 - contrib/llvm/utils/codegen-diff | 135 - contrib/llvm/utils/count/CMakeLists.txt | 3 - contrib/llvm/utils/count/Makefile | 20 - contrib/llvm/utils/count/count.c | 50 - contrib/llvm/utils/countloc.sh | 40 - contrib/llvm/utils/crosstool/ARM/README | 37 - .../utils/crosstool/ARM/build-install-linux.sh | 200 - contrib/llvm/utils/crosstool/create-snapshots.sh | 41 - contrib/llvm/utils/emacs/README | 27 - contrib/llvm/utils/emacs/emacs.el | 39 - contrib/llvm/utils/emacs/llvm-mode.el | 128 - contrib/llvm/utils/emacs/tablegen-mode.el | 124 - contrib/llvm/utils/findmisopt | 178 - contrib/llvm/utils/findoptdiff | 101 - contrib/llvm/utils/findsym.pl | 33 - contrib/llvm/utils/fpcmp/Makefile | 16 - contrib/llvm/utils/fpcmp/fpcmp.cpp | 43 - contrib/llvm/utils/getsrcs.sh | 34 - contrib/llvm/utils/git/find-rev | 50 - contrib/llvm/utils/importNLT.pl | 86 - contrib/llvm/utils/jedit/README | 14 - contrib/llvm/utils/jedit/tablegen.xml | 39 - contrib/llvm/utils/lint/common_lint.py | 97 - contrib/llvm/utils/lint/cpp_lint.py | 94 - contrib/llvm/utils/lint/generic_lint.py | 24 - .../llvm/utils/lint/remove_trailing_whitespace.sh | 6 - contrib/llvm/utils/lit/TODO | 19 - contrib/llvm/utils/lit/lit.py | 5 - .../utils/lit/lit/ExampleTests.ObjDir/lit.site.cfg | 15 - .../lit/lit/ExampleTests/Clang/fsyntax-only.c | 4 - .../llvm/utils/lit/lit/ExampleTests/Clang/lit.cfg | 47 - .../ExampleTests/LLVM.InTree/test/Bar/bar-test.ll | 3 - .../lit/ExampleTests/LLVM.InTree/test/Bar/dg.exp | 6 - .../lit/lit/ExampleTests/LLVM.InTree/test/lit.cfg | 151 - .../lit/ExampleTests/LLVM.InTree/test/lit.site.cfg | 10 - .../lit/lit/ExampleTests/LLVM.InTree/test/site.exp | 28 - .../lit/ExampleTests/LLVM.OutOfTree/lit.local.cfg | 1 - .../LLVM.OutOfTree/obj/test/Foo/lit.local.cfg | 0 .../LLVM.OutOfTree/obj/test/lit.site.cfg | 11 - .../ExampleTests/LLVM.OutOfTree/obj/test/site.exp | 28 - .../LLVM.OutOfTree/src/test/Foo/data.txt | 1 - .../LLVM.OutOfTree/src/test/Foo/dg.exp | 6 - .../LLVM.OutOfTree/src/test/Foo/pct-S.ll | 1 - .../ExampleTests/LLVM.OutOfTree/src/test/lit.cfg | 151 - .../lit/lit/ExampleTests/ShExternal/lit.local.cfg | 6 - .../lit/lit/ExampleTests/ShInternal/lit.local.cfg | 6 - .../lit/lit/ExampleTests/TclTest/lit.local.cfg | 5 - .../lit/lit/ExampleTests/TclTest/stderr-pipe.ll | 1 - .../lit/lit/ExampleTests/TclTest/tcl-redir-1.ll | 7 - contrib/llvm/utils/lit/lit/ExampleTests/fail.c | 2 - contrib/llvm/utils/lit/lit/ExampleTests/lit.cfg | 26 - contrib/llvm/utils/lit/lit/ExampleTests/pass.c | 1 - .../lit/lit/ExampleTests/required-and-missing.c | 4 - .../lit/lit/ExampleTests/required-and-present.c | 2 - contrib/llvm/utils/lit/lit/ExampleTests/xfail.c | 2 - contrib/llvm/utils/lit/lit/ExampleTests/xpass.c | 2 - contrib/llvm/utils/lit/lit/LitConfig.py | 112 - contrib/llvm/utils/lit/lit/LitFormats.py | 2 - contrib/llvm/utils/lit/lit/LitTestCase.py | 30 - contrib/llvm/utils/lit/lit/ProgressBar.py | 267 -- contrib/llvm/utils/lit/lit/ShCommands.py | 85 - contrib/llvm/utils/lit/lit/ShUtil.py | 353 -- contrib/llvm/utils/lit/lit/TclUtil.py | 322 -- contrib/llvm/utils/lit/lit/Test.py | 79 - contrib/llvm/utils/lit/lit/TestFormats.py | 221 - contrib/llvm/utils/lit/lit/TestRunner.py | 586 --- contrib/llvm/utils/lit/lit/TestingConfig.py | 101 - contrib/llvm/utils/lit/lit/Util.py | 125 - contrib/llvm/utils/lit/lit/__init__.py | 10 - contrib/llvm/utils/lit/lit/lit.py | 648 --- contrib/llvm/utils/lit/setup.py | 69 - contrib/llvm/utils/llvm-lit/Makefile | 21 - contrib/llvm/utils/llvm-lit/llvm-lit.in | 21 - contrib/llvm/utils/llvm-native-gcc | 249 - contrib/llvm/utils/llvm-native-gxx | 249 - contrib/llvm/utils/llvm.grm | 418 -- contrib/llvm/utils/llvmdo | 184 - contrib/llvm/utils/llvmgrep | 39 - contrib/llvm/utils/makellvm | 145 - contrib/llvm/utils/not/CMakeLists.txt | 11 - contrib/llvm/utils/not/Makefile | 21 - contrib/llvm/utils/not/not.cpp | 17 - contrib/llvm/utils/parseNLT.pl | 34 - contrib/llvm/utils/plotNLT.pl | 53 - contrib/llvm/utils/profile.pl | 74 - contrib/llvm/utils/unittest/Makefile | 13 - contrib/llvm/utils/unittest/UnitTestMain/Makefile | 30 - .../llvm/utils/unittest/UnitTestMain/TestMain.cpp | 15 - contrib/llvm/utils/unittest/googletest/LICENSE.TXT | 28 - contrib/llvm/utils/unittest/googletest/Makefile | 39 - contrib/llvm/utils/unittest/googletest/README.LLVM | 31 - .../utils/unittest/googletest/gtest-death-test.cc | 1172 ----- .../utils/unittest/googletest/gtest-filepath.cc | 380 -- .../llvm/utils/unittest/googletest/gtest-port.cc | 711 --- .../utils/unittest/googletest/gtest-test-part.cc | 110 - .../utils/unittest/googletest/gtest-typed-test.cc | 110 - contrib/llvm/utils/unittest/googletest/gtest.cc | 4704 ------------------- .../googletest/include/gtest/gtest-death-test.h | 283 -- .../googletest/include/gtest/gtest-message.h | 230 - .../googletest/include/gtest/gtest-param-test.h | 1397 ------ .../unittest/googletest/include/gtest/gtest-spi.h | 232 - .../googletest/include/gtest/gtest-test-part.h | 176 - .../googletest/include/gtest/gtest-typed-test.h | 259 -- .../unittest/googletest/include/gtest/gtest.h | 2052 --------- .../googletest/include/gtest/gtest_pred_impl.h | 368 -- .../unittest/googletest/include/gtest/gtest_prod.h | 58 - .../gtest/internal/gtest-death-test-internal.h | 275 -- .../include/gtest/internal/gtest-filepath.h | 210 - .../include/gtest/internal/gtest-internal-inl.h | 1074 ----- .../include/gtest/internal/gtest-internal.h | 943 ---- .../include/gtest/internal/gtest-linked_ptr.h | 243 - .../gtest/internal/gtest-param-util-generated.h | 4820 -------------------- .../include/gtest/internal/gtest-param-util.h | 619 --- .../googletest/include/gtest/internal/gtest-port.h | 1501 ------ .../include/gtest/internal/gtest-string.h | 350 -- .../include/gtest/internal/gtest-tuple.h | 968 ---- .../include/gtest/internal/gtest-type-util.h | 3321 -------------- contrib/llvm/utils/valgrind/i386-pc-linux-gnu.supp | 41 - .../llvm/utils/valgrind/x86_64-pc-linux-gnu.supp | 46 - contrib/llvm/utils/vim/README | 43 - contrib/llvm/utils/vim/llvm.vim | 109 - contrib/llvm/utils/vim/tablegen.vim | 54 - contrib/llvm/utils/vim/vimrc | 220 - contrib/llvm/utils/webNLT.pl | 83 - 151 files changed, 38753 deletions(-) delete mode 100755 contrib/llvm/utils/DSAclean.py delete mode 100644 contrib/llvm/utils/DSAextract.py delete mode 100644 contrib/llvm/utils/FileCheck/CMakeLists.txt delete mode 100644 contrib/llvm/utils/FileCheck/FileCheck.cpp delete mode 100644 contrib/llvm/utils/FileCheck/Makefile delete mode 100644 contrib/llvm/utils/FileUpdate/CMakeLists.txt delete mode 100644 contrib/llvm/utils/FileUpdate/FileUpdate.cpp delete mode 100644 contrib/llvm/utils/FileUpdate/Makefile delete mode 100755 contrib/llvm/utils/GenLibDeps.pl delete mode 100755 contrib/llvm/utils/GetSourceVersion delete mode 100644 contrib/llvm/utils/Makefile delete mode 100755 contrib/llvm/utils/Misc/zkill delete mode 100644 contrib/llvm/utils/NLT.schema delete mode 100755 contrib/llvm/utils/NewNightlyTest.pl delete mode 100644 contrib/llvm/utils/NightlyTest.gnuplot delete mode 100644 contrib/llvm/utils/NightlyTestTemplate.html delete mode 100644 contrib/llvm/utils/OldenDataRecover.pl delete mode 100644 contrib/llvm/utils/PerfectShuffle/Makefile delete mode 100644 contrib/llvm/utils/PerfectShuffle/PerfectShuffle.cpp delete mode 100644 contrib/llvm/utils/TableGen/CMakeLists.txt delete mode 100644 contrib/llvm/utils/TableGen/Makefile delete mode 100755 contrib/llvm/utils/UpdateCMakeLists.pl delete mode 100644 contrib/llvm/utils/bugpoint/RemoteRunSafely.sh delete mode 100644 contrib/llvm/utils/buildit/GNUmakefile delete mode 100755 contrib/llvm/utils/buildit/build_llvm delete mode 100755 contrib/llvm/utils/cgiplotNLT.pl delete mode 100755 contrib/llvm/utils/check-each-file delete mode 100755 contrib/llvm/utils/codegen-diff delete mode 100644 contrib/llvm/utils/count/CMakeLists.txt delete mode 100644 contrib/llvm/utils/count/Makefile delete mode 100644 contrib/llvm/utils/count/count.c delete mode 100755 contrib/llvm/utils/countloc.sh delete mode 100644 contrib/llvm/utils/crosstool/ARM/README delete mode 100755 contrib/llvm/utils/crosstool/ARM/build-install-linux.sh delete mode 100755 contrib/llvm/utils/crosstool/create-snapshots.sh delete mode 100644 contrib/llvm/utils/emacs/README delete mode 100644 contrib/llvm/utils/emacs/emacs.el delete mode 100644 contrib/llvm/utils/emacs/llvm-mode.el delete mode 100644 contrib/llvm/utils/emacs/tablegen-mode.el delete mode 100755 contrib/llvm/utils/findmisopt delete mode 100755 contrib/llvm/utils/findoptdiff delete mode 100755 contrib/llvm/utils/findsym.pl delete mode 100644 contrib/llvm/utils/fpcmp/Makefile delete mode 100644 contrib/llvm/utils/fpcmp/fpcmp.cpp delete mode 100755 contrib/llvm/utils/getsrcs.sh delete mode 100755 contrib/llvm/utils/git/find-rev delete mode 100644 contrib/llvm/utils/importNLT.pl delete mode 100644 contrib/llvm/utils/jedit/README delete mode 100644 contrib/llvm/utils/jedit/tablegen.xml delete mode 100644 contrib/llvm/utils/lint/common_lint.py delete mode 100755 contrib/llvm/utils/lint/cpp_lint.py delete mode 100755 contrib/llvm/utils/lint/generic_lint.py delete mode 100755 contrib/llvm/utils/lint/remove_trailing_whitespace.sh delete mode 100644 contrib/llvm/utils/lit/TODO delete mode 100755 contrib/llvm/utils/lit/lit.py delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests.ObjDir/lit.site.cfg delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/Clang/fsyntax-only.c delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/Clang/lit.cfg delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/LLVM.InTree/test/Bar/bar-test.ll delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/LLVM.InTree/test/Bar/dg.exp delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/LLVM.InTree/test/lit.cfg delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/LLVM.InTree/test/lit.site.cfg delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/LLVM.InTree/test/site.exp delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/LLVM.OutOfTree/lit.local.cfg delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/Foo/lit.local.cfg delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/lit.site.cfg delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/site.exp delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/data.txt delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/dg.exp delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/pct-S.ll delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/lit.cfg delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/ShExternal/lit.local.cfg delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/ShInternal/lit.local.cfg delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/TclTest/lit.local.cfg delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/TclTest/stderr-pipe.ll delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/TclTest/tcl-redir-1.ll delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/fail.c delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/lit.cfg delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/pass.c delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/required-and-missing.c delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/required-and-present.c delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/xfail.c delete mode 100644 contrib/llvm/utils/lit/lit/ExampleTests/xpass.c delete mode 100644 contrib/llvm/utils/lit/lit/LitConfig.py delete mode 100644 contrib/llvm/utils/lit/lit/LitFormats.py delete mode 100644 contrib/llvm/utils/lit/lit/LitTestCase.py delete mode 100644 contrib/llvm/utils/lit/lit/ProgressBar.py delete mode 100644 contrib/llvm/utils/lit/lit/ShCommands.py delete mode 100644 contrib/llvm/utils/lit/lit/ShUtil.py delete mode 100644 contrib/llvm/utils/lit/lit/TclUtil.py delete mode 100644 contrib/llvm/utils/lit/lit/Test.py delete mode 100644 contrib/llvm/utils/lit/lit/TestFormats.py delete mode 100644 contrib/llvm/utils/lit/lit/TestRunner.py delete mode 100644 contrib/llvm/utils/lit/lit/TestingConfig.py delete mode 100644 contrib/llvm/utils/lit/lit/Util.py delete mode 100644 contrib/llvm/utils/lit/lit/__init__.py delete mode 100755 contrib/llvm/utils/lit/lit/lit.py delete mode 100644 contrib/llvm/utils/lit/setup.py delete mode 100644 contrib/llvm/utils/llvm-lit/Makefile delete mode 100644 contrib/llvm/utils/llvm-lit/llvm-lit.in delete mode 100755 contrib/llvm/utils/llvm-native-gcc delete mode 100755 contrib/llvm/utils/llvm-native-gxx delete mode 100644 contrib/llvm/utils/llvm.grm delete mode 100755 contrib/llvm/utils/llvmdo delete mode 100755 contrib/llvm/utils/llvmgrep delete mode 100755 contrib/llvm/utils/makellvm delete mode 100644 contrib/llvm/utils/not/CMakeLists.txt delete mode 100644 contrib/llvm/utils/not/Makefile delete mode 100644 contrib/llvm/utils/not/not.cpp delete mode 100644 contrib/llvm/utils/parseNLT.pl delete mode 100644 contrib/llvm/utils/plotNLT.pl delete mode 100755 contrib/llvm/utils/profile.pl delete mode 100644 contrib/llvm/utils/unittest/Makefile delete mode 100644 contrib/llvm/utils/unittest/UnitTestMain/Makefile delete mode 100644 contrib/llvm/utils/unittest/UnitTestMain/TestMain.cpp delete mode 100644 contrib/llvm/utils/unittest/googletest/LICENSE.TXT delete mode 100644 contrib/llvm/utils/unittest/googletest/Makefile delete mode 100644 contrib/llvm/utils/unittest/googletest/README.LLVM delete mode 100644 contrib/llvm/utils/unittest/googletest/gtest-death-test.cc delete mode 100644 contrib/llvm/utils/unittest/googletest/gtest-filepath.cc delete mode 100644 contrib/llvm/utils/unittest/googletest/gtest-port.cc delete mode 100644 contrib/llvm/utils/unittest/googletest/gtest-test-part.cc delete mode 100644 contrib/llvm/utils/unittest/googletest/gtest-typed-test.cc delete mode 100644 contrib/llvm/utils/unittest/googletest/gtest.cc delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/gtest-death-test.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/gtest-message.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/gtest-param-test.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/gtest-spi.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/gtest-test-part.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/gtest-typed-test.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/gtest.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/gtest_pred_impl.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/gtest_prod.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/internal/gtest-filepath.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/internal/gtest-internal-inl.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/internal/gtest-internal.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/internal/gtest-linked_ptr.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util-generated.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/internal/gtest-port.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/internal/gtest-string.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/internal/gtest-tuple.h delete mode 100644 contrib/llvm/utils/unittest/googletest/include/gtest/internal/gtest-type-util.h delete mode 100644 contrib/llvm/utils/valgrind/i386-pc-linux-gnu.supp delete mode 100644 contrib/llvm/utils/valgrind/x86_64-pc-linux-gnu.supp delete mode 100644 contrib/llvm/utils/vim/README delete mode 100644 contrib/llvm/utils/vim/llvm.vim delete mode 100644 contrib/llvm/utils/vim/tablegen.vim delete mode 100644 contrib/llvm/utils/vim/vimrc delete mode 100755 contrib/llvm/utils/webNLT.pl (limited to 'contrib/llvm/utils') diff --git a/contrib/llvm/utils/DSAclean.py b/contrib/llvm/utils/DSAclean.py deleted file mode 100755 index 6c43357..0000000 --- a/contrib/llvm/utils/DSAclean.py +++ /dev/null @@ -1,32 +0,0 @@ -#! /usr/bin/python - -#changelog: -#10/13/2005b: replaced the # in tmp(.#*)* with alphanumeric and _, this will then remove -#nodes such as %tmp.1.i and %tmp._i.3 -#10/13/2005: exntended to remove variables of the form %tmp(.#)* rather than just -#%tmp.#, i.e. it now will remove %tmp.12.3.15 etc, additionally fixed a spelling error in -#the comments -#10/12/2005: now it only removes nodes and edges for which the label is %tmp.# rather -#than removing all lines for which the lable CONTAINS %tmp.# -import re -import sys -if( len(sys.argv) < 3 ): - print 'usage is: ./DSAclean ' - sys.exit(1) -#get a file object -input = open(sys.argv[1], 'r') -output = open(sys.argv[2], 'w') -#we'll get this one line at a time...while we could just put the whole thing in a string -#it would kill old computers -buffer = input.readline() -while buffer != '': - if re.compile("label(\s*)=(\s*)\"\s%tmp(.\w*)*(\s*)\"").search(buffer): - #skip next line, write neither this line nor the next - buffer = input.readline() - else: - #this isn't a tmp Node, we can write it - output.write(buffer) - #prepare for the next iteration - buffer = input.readline() -input.close() -output.close() diff --git a/contrib/llvm/utils/DSAextract.py b/contrib/llvm/utils/DSAextract.py deleted file mode 100644 index 134e945..0000000 --- a/contrib/llvm/utils/DSAextract.py +++ /dev/null @@ -1,111 +0,0 @@ -#! /usr/bin/python - -#this is a script to extract given named nodes from a dot file, with -#the associated edges. An edge is kept iff for edge x -> y -# x and y are both nodes specified to be kept. - -#known issues: if a line contains '->' and is not an edge line -#problems will occur. If node labels do not begin with -#Node this also will not work. Since this is designed to work -#on DSA dot output and not general dot files this is ok. -#If you want to use this on other files rename the node labels -#to Node[.*] with a script or something. This also relies on -#the length of a node name being 13 characters (as it is in all -#DSA dot output files) - -#Note that the name of the node can be any substring of the actual -#name in the dot file. Thus if you say specify COLLAPSED -#as a parameter this script will pull out all COLLAPSED -#nodes in the file - -#Specifying escape characters in the name like \n also will not work, -#as Python -#will make it \\n, I'm not really sure how to fix this - -#currently the script prints the names it is searching for -#to STDOUT, so you can check to see if they are what you intend - -import re -import string -import sys - - -if len(sys.argv) < 3: - print 'usage is ./DSAextract \ - [list of nodes to extract]' - -#open the input file -input = open(sys.argv[1], 'r') - -#construct a set of node names -node_name_set = set() -for name in sys.argv[3:]: - node_name_set |= set([name]) - -#construct a list of compiled regular expressions from the -#node_name_set -regexp_list = [] -for name in node_name_set: - regexp_list.append(re.compile(name)) - -#used to see what kind of line we are on -nodeexp = re.compile('Node') -#used to check to see if the current line is an edge line -arrowexp = re.compile('->') - -node_set = set() - -#read the file one line at a time -buffer = input.readline() -while buffer != '': - #filter out the unecessary checks on all the edge lines - if not arrowexp.search(buffer): - #check to see if this is a node we are looking for - for regexp in regexp_list: - #if this name is for the current node, add the dot variable name - #for the node (it will be Node(hex number)) to our set of nodes - if regexp.search(buffer): - node_set |= set([re.split('\s+',buffer,2)[1]]) - break - buffer = input.readline() - - -#test code -#print '\n' - -print node_name_set - -#print node_set - - -#open the output file -output = open(sys.argv[2], 'w') -#start the second pass over the file -input = open(sys.argv[1], 'r') - -buffer = input.readline() -while buffer != '': - #there are three types of lines we are looking for - #1) node lines, 2) edge lines 3) support lines (like page size, etc) - - #is this an edge line? - #note that this is no completely robust, if a none edge line - #for some reason contains -> it will be missidentified - #hand edit the file if this happens - if arrowexp.search(buffer): - #check to make sure that both nodes are in the node list - #if they are print this to output - nodes = arrowexp.split(buffer) - nodes[0] = string.strip(nodes[0]) - nodes[1] = string.strip(nodes[1]) - if nodes[0][:13] in node_set and \ - nodes[1][:13] in node_set: - output.write(buffer) - elif nodeexp.search(buffer): #this is a node line - node = re.split('\s+', buffer,2)[1] - if node in node_set: - output.write(buffer) - else: #this is a support line - output.write(buffer) - buffer = input.readline() - diff --git a/contrib/llvm/utils/FileCheck/CMakeLists.txt b/contrib/llvm/utils/FileCheck/CMakeLists.txt deleted file mode 100644 index 8fee03f..0000000 --- a/contrib/llvm/utils/FileCheck/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -add_executable(FileCheck - FileCheck.cpp - ) - -target_link_libraries(FileCheck LLVMSupport LLVMSystem) -if( MINGW ) - target_link_libraries(FileCheck imagehlp psapi) -endif( MINGW ) -if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD ) - target_link_libraries(FileCheck pthread) -endif() diff --git a/contrib/llvm/utils/FileCheck/FileCheck.cpp b/contrib/llvm/utils/FileCheck/FileCheck.cpp deleted file mode 100644 index cd76d44..0000000 --- a/contrib/llvm/utils/FileCheck/FileCheck.cpp +++ /dev/null @@ -1,732 +0,0 @@ -//===- FileCheck.cpp - Check that File's Contents match what is expected --===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// FileCheck does a line-by line check of a file that validates whether it -// contains the expected content. This is useful for regression tests etc. -// -// This program exits with an error status of 2 on error, exit status of 0 if -// the file matched the expected contents, and exit status of 1 if it did not -// contain the expected contents. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/PrettyStackTrace.h" -#include "llvm/Support/Regex.h" -#include "llvm/Support/SourceMgr.h" -#include "llvm/Support/raw_ostream.h" -#include "llvm/System/Signals.h" -#include "llvm/ADT/SmallString.h" -#include "llvm/ADT/StringMap.h" -#include -using namespace llvm; - -static cl::opt -CheckFilename(cl::Positional, cl::desc(""), cl::Required); - -static cl::opt -InputFilename("input-file", cl::desc("File to check (defaults to stdin)"), - cl::init("-"), cl::value_desc("filename")); - -static cl::opt -CheckPrefix("check-prefix", cl::init("CHECK"), - cl::desc("Prefix to use from check file (defaults to 'CHECK')")); - -static cl::opt -NoCanonicalizeWhiteSpace("strict-whitespace", - cl::desc("Do not treat all horizontal whitespace as equivalent")); - -//===----------------------------------------------------------------------===// -// Pattern Handling Code. -//===----------------------------------------------------------------------===// - -class Pattern { - SMLoc PatternLoc; - - /// FixedStr - If non-empty, this pattern is a fixed string match with the - /// specified fixed string. - StringRef FixedStr; - - /// RegEx - If non-empty, this is a regex pattern. - std::string RegExStr; - - /// VariableUses - Entries in this vector map to uses of a variable in the - /// pattern, e.g. "foo[[bar]]baz". In this case, the RegExStr will contain - /// "foobaz" and we'll get an entry in this vector that tells us to insert the - /// value of bar at offset 3. - std::vector > VariableUses; - - /// VariableDefs - Entries in this vector map to definitions of a variable in - /// the pattern, e.g. "foo[[bar:.*]]baz". In this case, the RegExStr will - /// contain "foo(.*)baz" and VariableDefs will contain the pair "bar",1. The - /// index indicates what parenthesized value captures the variable value. - std::vector > VariableDefs; - -public: - - Pattern() { } - - bool ParsePattern(StringRef PatternStr, SourceMgr &SM); - - /// Match - Match the pattern string against the input buffer Buffer. This - /// returns the position that is matched or npos if there is no match. If - /// there is a match, the size of the matched string is returned in MatchLen. - /// - /// The VariableTable StringMap provides the current values of filecheck - /// variables and is updated if this match defines new values. - size_t Match(StringRef Buffer, size_t &MatchLen, - StringMap &VariableTable) const; - - /// PrintFailureInfo - Print additional information about a failure to match - /// involving this pattern. - void PrintFailureInfo(const SourceMgr &SM, StringRef Buffer, - const StringMap &VariableTable) const; - -private: - static void AddFixedStringToRegEx(StringRef FixedStr, std::string &TheStr); - bool AddRegExToRegEx(StringRef RegExStr, unsigned &CurParen, SourceMgr &SM); - - /// ComputeMatchDistance - Compute an arbitrary estimate for the quality of - /// matching this pattern at the start of \arg Buffer; a distance of zero - /// should correspond to a perfect match. - unsigned ComputeMatchDistance(StringRef Buffer, - const StringMap &VariableTable) const; -}; - - -bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM) { - PatternLoc = SMLoc::getFromPointer(PatternStr.data()); - - // Ignore trailing whitespace. - while (!PatternStr.empty() && - (PatternStr.back() == ' ' || PatternStr.back() == '\t')) - PatternStr = PatternStr.substr(0, PatternStr.size()-1); - - // Check that there is something on the line. - if (PatternStr.empty()) { - SM.PrintMessage(PatternLoc, "found empty check string with prefix '" + - CheckPrefix+":'", "error"); - return true; - } - - // Check to see if this is a fixed string, or if it has regex pieces. - if (PatternStr.size() < 2 || - (PatternStr.find("{{") == StringRef::npos && - PatternStr.find("[[") == StringRef::npos)) { - FixedStr = PatternStr; - return false; - } - - // Paren value #0 is for the fully matched string. Any new parenthesized - // values add from their. - unsigned CurParen = 1; - - // Otherwise, there is at least one regex piece. Build up the regex pattern - // by escaping scary characters in fixed strings, building up one big regex. - while (!PatternStr.empty()) { - // RegEx matches. - if (PatternStr.size() >= 2 && - PatternStr[0] == '{' && PatternStr[1] == '{') { - - // Otherwise, this is the start of a regex match. Scan for the }}. - size_t End = PatternStr.find("}}"); - if (End == StringRef::npos) { - SM.PrintMessage(SMLoc::getFromPointer(PatternStr.data()), - "found start of regex string with no end '}}'", "error"); - return true; - } - - if (AddRegExToRegEx(PatternStr.substr(2, End-2), CurParen, SM)) - return true; - PatternStr = PatternStr.substr(End+2); - continue; - } - - // Named RegEx matches. These are of two forms: [[foo:.*]] which matches .* - // (or some other regex) and assigns it to the FileCheck variable 'foo'. The - // second form is [[foo]] which is a reference to foo. The variable name - // itself must be of the form "[a-zA-Z_][0-9a-zA-Z_]*", otherwise we reject - // it. This is to catch some common errors. - if (PatternStr.size() >= 2 && - PatternStr[0] == '[' && PatternStr[1] == '[') { - // Verify that it is terminated properly. - size_t End = PatternStr.find("]]"); - if (End == StringRef::npos) { - SM.PrintMessage(SMLoc::getFromPointer(PatternStr.data()), - "invalid named regex reference, no ]] found", "error"); - return true; - } - - StringRef MatchStr = PatternStr.substr(2, End-2); - PatternStr = PatternStr.substr(End+2); - - // Get the regex name (e.g. "foo"). - size_t NameEnd = MatchStr.find(':'); - StringRef Name = MatchStr.substr(0, NameEnd); - - if (Name.empty()) { - SM.PrintMessage(SMLoc::getFromPointer(Name.data()), - "invalid name in named regex: empty name", "error"); - return true; - } - - // Verify that the name is well formed. - for (unsigned i = 0, e = Name.size(); i != e; ++i) - if (Name[i] != '_' && - (Name[i] < 'a' || Name[i] > 'z') && - (Name[i] < 'A' || Name[i] > 'Z') && - (Name[i] < '0' || Name[i] > '9')) { - SM.PrintMessage(SMLoc::getFromPointer(Name.data()+i), - "invalid name in named regex", "error"); - return true; - } - - // Name can't start with a digit. - if (isdigit(Name[0])) { - SM.PrintMessage(SMLoc::getFromPointer(Name.data()), - "invalid name in named regex", "error"); - return true; - } - - // Handle [[foo]]. - if (NameEnd == StringRef::npos) { - VariableUses.push_back(std::make_pair(Name, RegExStr.size())); - continue; - } - - // Handle [[foo:.*]]. - VariableDefs.push_back(std::make_pair(Name, CurParen)); - RegExStr += '('; - ++CurParen; - - if (AddRegExToRegEx(MatchStr.substr(NameEnd+1), CurParen, SM)) - return true; - - RegExStr += ')'; - } - - // Handle fixed string matches. - // Find the end, which is the start of the next regex. - size_t FixedMatchEnd = PatternStr.find("{{"); - FixedMatchEnd = std::min(FixedMatchEnd, PatternStr.find("[[")); - AddFixedStringToRegEx(PatternStr.substr(0, FixedMatchEnd), RegExStr); - PatternStr = PatternStr.substr(FixedMatchEnd); - continue; - } - - return false; -} - -void Pattern::AddFixedStringToRegEx(StringRef FixedStr, std::string &TheStr) { - // Add the characters from FixedStr to the regex, escaping as needed. This - // avoids "leaning toothpicks" in common patterns. - for (unsigned i = 0, e = FixedStr.size(); i != e; ++i) { - switch (FixedStr[i]) { - // These are the special characters matched in "p_ere_exp". - case '(': - case ')': - case '^': - case '$': - case '|': - case '*': - case '+': - case '?': - case '.': - case '[': - case '\\': - case '{': - TheStr += '\\'; - // FALL THROUGH. - default: - TheStr += FixedStr[i]; - break; - } - } -} - -bool Pattern::AddRegExToRegEx(StringRef RegexStr, unsigned &CurParen, - SourceMgr &SM) { - Regex R(RegexStr); - std::string Error; - if (!R.isValid(Error)) { - SM.PrintMessage(SMLoc::getFromPointer(RegexStr.data()), - "invalid regex: " + Error, "error"); - return true; - } - - RegExStr += RegexStr.str(); - CurParen += R.getNumMatches(); - return false; -} - -/// Match - Match the pattern string against the input buffer Buffer. This -/// returns the position that is matched or npos if there is no match. If -/// there is a match, the size of the matched string is returned in MatchLen. -size_t Pattern::Match(StringRef Buffer, size_t &MatchLen, - StringMap &VariableTable) const { - // If this is a fixed string pattern, just match it now. - if (!FixedStr.empty()) { - MatchLen = FixedStr.size(); - return Buffer.find(FixedStr); - } - - // Regex match. - - // If there are variable uses, we need to create a temporary string with the - // actual value. - StringRef RegExToMatch = RegExStr; - std::string TmpStr; - if (!VariableUses.empty()) { - TmpStr = RegExStr; - - unsigned InsertOffset = 0; - for (unsigned i = 0, e = VariableUses.size(); i != e; ++i) { - StringMap::iterator it = - VariableTable.find(VariableUses[i].first); - // If the variable is undefined, return an error. - if (it == VariableTable.end()) - return StringRef::npos; - - // Look up the value and escape it so that we can plop it into the regex. - std::string Value; - AddFixedStringToRegEx(it->second, Value); - - // Plop it into the regex at the adjusted offset. - TmpStr.insert(TmpStr.begin()+VariableUses[i].second+InsertOffset, - Value.begin(), Value.end()); - InsertOffset += Value.size(); - } - - // Match the newly constructed regex. - RegExToMatch = TmpStr; - } - - - SmallVector MatchInfo; - if (!Regex(RegExToMatch, Regex::Newline).match(Buffer, &MatchInfo)) - return StringRef::npos; - - // Successful regex match. - assert(!MatchInfo.empty() && "Didn't get any match"); - StringRef FullMatch = MatchInfo[0]; - - // If this defines any variables, remember their values. - for (unsigned i = 0, e = VariableDefs.size(); i != e; ++i) { - assert(VariableDefs[i].second < MatchInfo.size() && - "Internal paren error"); - VariableTable[VariableDefs[i].first] = MatchInfo[VariableDefs[i].second]; - } - - MatchLen = FullMatch.size(); - return FullMatch.data()-Buffer.data(); -} - -unsigned Pattern::ComputeMatchDistance(StringRef Buffer, - const StringMap &VariableTable) const { - // Just compute the number of matching characters. For regular expressions, we - // just compare against the regex itself and hope for the best. - // - // FIXME: One easy improvement here is have the regex lib generate a single - // example regular expression which matches, and use that as the example - // string. - StringRef ExampleString(FixedStr); - if (ExampleString.empty()) - ExampleString = RegExStr; - - // Only compare up to the first line in the buffer, or the string size. - StringRef BufferPrefix = Buffer.substr(0, ExampleString.size()); - BufferPrefix = BufferPrefix.split('\n').first; - return BufferPrefix.edit_distance(ExampleString); -} - -void Pattern::PrintFailureInfo(const SourceMgr &SM, StringRef Buffer, - const StringMap &VariableTable) const{ - // If this was a regular expression using variables, print the current - // variable values. - if (!VariableUses.empty()) { - for (unsigned i = 0, e = VariableUses.size(); i != e; ++i) { - StringRef Var = VariableUses[i].first; - StringMap::const_iterator it = VariableTable.find(Var); - SmallString<256> Msg; - raw_svector_ostream OS(Msg); - - // Check for undefined variable references. - if (it == VariableTable.end()) { - OS << "uses undefined variable \""; - OS.write_escaped(Var) << "\"";; - } else { - OS << "with variable \""; - OS.write_escaped(Var) << "\" equal to \""; - OS.write_escaped(it->second) << "\""; - } - - SM.PrintMessage(SMLoc::getFromPointer(Buffer.data()), OS.str(), "note", - /*ShowLine=*/false); - } - } - - // Attempt to find the closest/best fuzzy match. Usually an error happens - // because some string in the output didn't exactly match. In these cases, we - // would like to show the user a best guess at what "should have" matched, to - // save them having to actually check the input manually. - size_t NumLinesForward = 0; - size_t Best = StringRef::npos; - double BestQuality = 0; - - // Use an arbitrary 4k limit on how far we will search. - for (size_t i = 0, e = std::min(size_t(4096), Buffer.size()); i != e; ++i) { - if (Buffer[i] == '\n') - ++NumLinesForward; - - // Patterns have leading whitespace stripped, so skip whitespace when - // looking for something which looks like a pattern. - if (Buffer[i] == ' ' || Buffer[i] == '\t') - continue; - - // Compute the "quality" of this match as an arbitrary combination of the - // match distance and the number of lines skipped to get to this match. - unsigned Distance = ComputeMatchDistance(Buffer.substr(i), VariableTable); - double Quality = Distance + (NumLinesForward / 100.); - - if (Quality < BestQuality || Best == StringRef::npos) { - Best = i; - BestQuality = Quality; - } - } - - // Print the "possible intended match here" line if we found something - // reasonable and not equal to what we showed in the "scanning from here" - // line. - if (Best && Best != StringRef::npos && BestQuality < 50) { - SM.PrintMessage(SMLoc::getFromPointer(Buffer.data() + Best), - "possible intended match here", "note"); - - // FIXME: If we wanted to be really friendly we would show why the match - // failed, as it can be hard to spot simple one character differences. - } -} - -//===----------------------------------------------------------------------===// -// Check Strings. -//===----------------------------------------------------------------------===// - -/// CheckString - This is a check that we found in the input file. -struct CheckString { - /// Pat - The pattern to match. - Pattern Pat; - - /// Loc - The location in the match file that the check string was specified. - SMLoc Loc; - - /// IsCheckNext - This is true if this is a CHECK-NEXT: directive (as opposed - /// to a CHECK: directive. - bool IsCheckNext; - - /// NotStrings - These are all of the strings that are disallowed from - /// occurring between this match string and the previous one (or start of - /// file). - std::vector > NotStrings; - - CheckString(const Pattern &P, SMLoc L, bool isCheckNext) - : Pat(P), Loc(L), IsCheckNext(isCheckNext) {} -}; - -/// CanonicalizeInputFile - Remove duplicate horizontal space from the specified -/// memory buffer, free it, and return a new one. -static MemoryBuffer *CanonicalizeInputFile(MemoryBuffer *MB) { - SmallString<128> NewFile; - NewFile.reserve(MB->getBufferSize()); - - for (const char *Ptr = MB->getBufferStart(), *End = MB->getBufferEnd(); - Ptr != End; ++Ptr) { - // If C is not a horizontal whitespace, skip it. - if (*Ptr != ' ' && *Ptr != '\t') { - NewFile.push_back(*Ptr); - continue; - } - - // Otherwise, add one space and advance over neighboring space. - NewFile.push_back(' '); - while (Ptr+1 != End && - (Ptr[1] == ' ' || Ptr[1] == '\t')) - ++Ptr; - } - - // Free the old buffer and return a new one. - MemoryBuffer *MB2 = - MemoryBuffer::getMemBufferCopy(NewFile.str(), MB->getBufferIdentifier()); - - delete MB; - return MB2; -} - - -/// ReadCheckFile - Read the check file, which specifies the sequence of -/// expected strings. The strings are added to the CheckStrings vector. -static bool ReadCheckFile(SourceMgr &SM, - std::vector &CheckStrings) { - // Open the check file, and tell SourceMgr about it. - std::string ErrorStr; - MemoryBuffer *F = - MemoryBuffer::getFileOrSTDIN(CheckFilename.c_str(), &ErrorStr); - if (F == 0) { - errs() << "Could not open check file '" << CheckFilename << "': " - << ErrorStr << '\n'; - return true; - } - - // If we want to canonicalize whitespace, strip excess whitespace from the - // buffer containing the CHECK lines. - if (!NoCanonicalizeWhiteSpace) - F = CanonicalizeInputFile(F); - - SM.AddNewSourceBuffer(F, SMLoc()); - - // Find all instances of CheckPrefix followed by : in the file. - StringRef Buffer = F->getBuffer(); - - std::vector > NotMatches; - - while (1) { - // See if Prefix occurs in the memory buffer. - Buffer = Buffer.substr(Buffer.find(CheckPrefix)); - - // If we didn't find a match, we're done. - if (Buffer.empty()) - break; - - const char *CheckPrefixStart = Buffer.data(); - - // When we find a check prefix, keep track of whether we find CHECK: or - // CHECK-NEXT: - bool IsCheckNext = false, IsCheckNot = false; - - // Verify that the : is present after the prefix. - if (Buffer[CheckPrefix.size()] == ':') { - Buffer = Buffer.substr(CheckPrefix.size()+1); - } else if (Buffer.size() > CheckPrefix.size()+6 && - memcmp(Buffer.data()+CheckPrefix.size(), "-NEXT:", 6) == 0) { - Buffer = Buffer.substr(CheckPrefix.size()+7); - IsCheckNext = true; - } else if (Buffer.size() > CheckPrefix.size()+5 && - memcmp(Buffer.data()+CheckPrefix.size(), "-NOT:", 5) == 0) { - Buffer = Buffer.substr(CheckPrefix.size()+6); - IsCheckNot = true; - } else { - Buffer = Buffer.substr(1); - continue; - } - - // Okay, we found the prefix, yay. Remember the rest of the line, but - // ignore leading and trailing whitespace. - Buffer = Buffer.substr(Buffer.find_first_not_of(" \t")); - - // Scan ahead to the end of line. - size_t EOL = Buffer.find_first_of("\n\r"); - - // Remember the location of the start of the pattern, for diagnostics. - SMLoc PatternLoc = SMLoc::getFromPointer(Buffer.data()); - - // Parse the pattern. - Pattern P; - if (P.ParsePattern(Buffer.substr(0, EOL), SM)) - return true; - - Buffer = Buffer.substr(EOL); - - - // Verify that CHECK-NEXT lines have at least one CHECK line before them. - if (IsCheckNext && CheckStrings.empty()) { - SM.PrintMessage(SMLoc::getFromPointer(CheckPrefixStart), - "found '"+CheckPrefix+"-NEXT:' without previous '"+ - CheckPrefix+ ": line", "error"); - return true; - } - - // Handle CHECK-NOT. - if (IsCheckNot) { - NotMatches.push_back(std::make_pair(SMLoc::getFromPointer(Buffer.data()), - P)); - continue; - } - - - // Okay, add the string we captured to the output vector and move on. - CheckStrings.push_back(CheckString(P, - PatternLoc, - IsCheckNext)); - std::swap(NotMatches, CheckStrings.back().NotStrings); - } - - if (CheckStrings.empty()) { - errs() << "error: no check strings found with prefix '" << CheckPrefix - << ":'\n"; - return true; - } - - if (!NotMatches.empty()) { - errs() << "error: '" << CheckPrefix - << "-NOT:' not supported after last check line.\n"; - return true; - } - - return false; -} - -static void PrintCheckFailed(const SourceMgr &SM, const CheckString &CheckStr, - StringRef Buffer, - StringMap &VariableTable) { - // Otherwise, we have an error, emit an error message. - SM.PrintMessage(CheckStr.Loc, "expected string not found in input", - "error"); - - // Print the "scanning from here" line. If the current position is at the - // end of a line, advance to the start of the next line. - Buffer = Buffer.substr(Buffer.find_first_not_of(" \t\n\r")); - - SM.PrintMessage(SMLoc::getFromPointer(Buffer.data()), "scanning from here", - "note"); - - // Allow the pattern to print additional information if desired. - CheckStr.Pat.PrintFailureInfo(SM, Buffer, VariableTable); -} - -/// CountNumNewlinesBetween - Count the number of newlines in the specified -/// range. -static unsigned CountNumNewlinesBetween(StringRef Range) { - unsigned NumNewLines = 0; - while (1) { - // Scan for newline. - Range = Range.substr(Range.find_first_of("\n\r")); - if (Range.empty()) return NumNewLines; - - ++NumNewLines; - - // Handle \n\r and \r\n as a single newline. - if (Range.size() > 1 && - (Range[1] == '\n' || Range[1] == '\r') && - (Range[0] != Range[1])) - Range = Range.substr(1); - Range = Range.substr(1); - } -} - -int main(int argc, char **argv) { - sys::PrintStackTraceOnErrorSignal(); - PrettyStackTraceProgram X(argc, argv); - cl::ParseCommandLineOptions(argc, argv); - - SourceMgr SM; - - // Read the expected strings from the check file. - std::vector CheckStrings; - if (ReadCheckFile(SM, CheckStrings)) - return 2; - - // Open the file to check and add it to SourceMgr. - std::string ErrorStr; - MemoryBuffer *F = - MemoryBuffer::getFileOrSTDIN(InputFilename.c_str(), &ErrorStr); - if (F == 0) { - errs() << "Could not open input file '" << InputFilename << "': " - << ErrorStr << '\n'; - return true; - } - - // Remove duplicate spaces in the input file if requested. - if (!NoCanonicalizeWhiteSpace) - F = CanonicalizeInputFile(F); - - SM.AddNewSourceBuffer(F, SMLoc()); - - /// VariableTable - This holds all the current filecheck variables. - StringMap VariableTable; - - // Check that we have all of the expected strings, in order, in the input - // file. - StringRef Buffer = F->getBuffer(); - - const char *LastMatch = Buffer.data(); - - for (unsigned StrNo = 0, e = CheckStrings.size(); StrNo != e; ++StrNo) { - const CheckString &CheckStr = CheckStrings[StrNo]; - - StringRef SearchFrom = Buffer; - - // Find StrNo in the file. - size_t MatchLen = 0; - Buffer = Buffer.substr(CheckStr.Pat.Match(Buffer, MatchLen, VariableTable)); - - // If we didn't find a match, reject the input. - if (Buffer.empty()) { - PrintCheckFailed(SM, CheckStr, SearchFrom, VariableTable); - return 1; - } - - StringRef SkippedRegion(LastMatch, Buffer.data()-LastMatch); - - // If this check is a "CHECK-NEXT", verify that the previous match was on - // the previous line (i.e. that there is one newline between them). - if (CheckStr.IsCheckNext) { - // Count the number of newlines between the previous match and this one. - assert(LastMatch != F->getBufferStart() && - "CHECK-NEXT can't be the first check in a file"); - - unsigned NumNewLines = CountNumNewlinesBetween(SkippedRegion); - if (NumNewLines == 0) { - SM.PrintMessage(CheckStr.Loc, - CheckPrefix+"-NEXT: is on the same line as previous match", - "error"); - SM.PrintMessage(SMLoc::getFromPointer(Buffer.data()), - "'next' match was here", "note"); - SM.PrintMessage(SMLoc::getFromPointer(LastMatch), - "previous match was here", "note"); - return 1; - } - - if (NumNewLines != 1) { - SM.PrintMessage(CheckStr.Loc, - CheckPrefix+ - "-NEXT: is not on the line after the previous match", - "error"); - SM.PrintMessage(SMLoc::getFromPointer(Buffer.data()), - "'next' match was here", "note"); - SM.PrintMessage(SMLoc::getFromPointer(LastMatch), - "previous match was here", "note"); - return 1; - } - } - - // If this match had "not strings", verify that they don't exist in the - // skipped region. - for (unsigned ChunkNo = 0, e = CheckStr.NotStrings.size(); - ChunkNo != e; ++ChunkNo) { - size_t MatchLen = 0; - size_t Pos = CheckStr.NotStrings[ChunkNo].second.Match(SkippedRegion, - MatchLen, - VariableTable); - if (Pos == StringRef::npos) continue; - - SM.PrintMessage(SMLoc::getFromPointer(LastMatch+Pos), - CheckPrefix+"-NOT: string occurred!", "error"); - SM.PrintMessage(CheckStr.NotStrings[ChunkNo].first, - CheckPrefix+"-NOT: pattern specified here", "note"); - return 1; - } - - - // Otherwise, everything is good. Step over the matched text and remember - // the position after the match as the end of the last match. - Buffer = Buffer.substr(MatchLen); - LastMatch = Buffer.data(); - } - - return 0; -} diff --git a/contrib/llvm/utils/FileCheck/Makefile b/contrib/llvm/utils/FileCheck/Makefile deleted file mode 100644 index f1af5b6..0000000 --- a/contrib/llvm/utils/FileCheck/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -##===- utils/FileCheck/Makefile ----------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -LEVEL = ../.. -TOOLNAME = FileCheck -USEDLIBS = LLVMSupport.a LLVMSystem.a - -# This tool has no plugins, optimize startup time. -TOOL_NO_EXPORTS = 1 - -# Don't install this utility -NO_INSTALL = 1 - -include $(LEVEL)/Makefile.common - diff --git a/contrib/llvm/utils/FileUpdate/CMakeLists.txt b/contrib/llvm/utils/FileUpdate/CMakeLists.txt deleted file mode 100644 index bacbd16..0000000 --- a/contrib/llvm/utils/FileUpdate/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -add_executable(FileUpdate - FileUpdate.cpp - ) - -target_link_libraries(FileUpdate LLVMSupport LLVMSystem) -if( MINGW ) - target_link_libraries(FileUpdate imagehlp psapi) -endif( MINGW ) -if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD ) - target_link_libraries(FileUpdate pthread) -endif() diff --git a/contrib/llvm/utils/FileUpdate/FileUpdate.cpp b/contrib/llvm/utils/FileUpdate/FileUpdate.cpp deleted file mode 100644 index 2cf366f..0000000 --- a/contrib/llvm/utils/FileUpdate/FileUpdate.cpp +++ /dev/null @@ -1,87 +0,0 @@ -//===- FileUpdate.cpp - Conditionally update a file -----------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// FileUpdate is a utility for conditionally updating a file from its input -// based on whether the input differs from the output. It is used to avoid -// unnecessary modifications in a build system. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/PrettyStackTrace.h" -#include "llvm/Support/raw_ostream.h" -#include "llvm/System/Signals.h" -using namespace llvm; - -static cl::opt -Quiet("quiet", cl::desc("Don't print unnecessary status information"), - cl::init(false)); - -static cl::opt -InputFilename("input-file", cl::desc("Input file (defaults to stdin)"), - cl::init("-"), cl::value_desc("filename")); - -static cl::opt -OutputFilename(cl::Positional, cl::desc(""), cl::Required); - -int main(int argc, char **argv) { - sys::PrintStackTraceOnErrorSignal(); - PrettyStackTraceProgram X(argc, argv); - cl::ParseCommandLineOptions(argc, argv); - - if (OutputFilename == "-") { - errs() << argv[0] << ": error: Can't update standard output\n"; - return 1; - } - - // Get the input data. - std::string ErrorStr; - MemoryBuffer *In = - MemoryBuffer::getFileOrSTDIN(InputFilename.c_str(), &ErrorStr); - if (In == 0) { - errs() << argv[0] << ": error: Unable to get input '" - << InputFilename << "': " << ErrorStr << '\n'; - return 1; - } - - // Get the output data. - MemoryBuffer *Out = MemoryBuffer::getFile(OutputFilename.c_str(), &ErrorStr); - - // If the output exists and the contents match, we are done. - if (Out && In->getBufferSize() == Out->getBufferSize() && - memcmp(In->getBufferStart(), Out->getBufferStart(), - Out->getBufferSize()) == 0) { - if (!Quiet) - errs() << argv[0] << ": Not updating '" << OutputFilename - << "', contents match input.\n"; - return 0; - } - - delete Out; - - // Otherwise, overwrite the output. - if (!Quiet) - errs() << argv[0] << ": Updating '" << OutputFilename - << "', contents changed.\n"; - tool_output_file OutStream(OutputFilename.c_str(), ErrorStr, - raw_fd_ostream::F_Binary); - if (!ErrorStr.empty()) { - errs() << argv[0] << ": Unable to write output '" - << OutputFilename << "': " << ErrorStr << '\n'; - return 1; - } - - OutStream.os().write(In->getBufferStart(), In->getBufferSize()); - - // Declare success. - OutStream.keep(); - - return 0; -} diff --git a/contrib/llvm/utils/FileUpdate/Makefile b/contrib/llvm/utils/FileUpdate/Makefile deleted file mode 100644 index 5b545c2..0000000 --- a/contrib/llvm/utils/FileUpdate/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -##===- utils/FileUpdate/Makefile ---------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -LEVEL = ../.. -TOOLNAME = FileUpdate -USEDLIBS = LLVMSupport.a LLVMSystem.a - -# This tool has no plugins, optimize startup time. -TOOL_NO_EXPORTS = 1 - -# Don't install this utility -NO_INSTALL = 1 - -include $(LEVEL)/Makefile.common - diff --git a/contrib/llvm/utils/GenLibDeps.pl b/contrib/llvm/utils/GenLibDeps.pl deleted file mode 100755 index f1f7e72..0000000 --- a/contrib/llvm/utils/GenLibDeps.pl +++ /dev/null @@ -1,388 +0,0 @@ -#!/usr/bin/perl -w -# -# Program: GenLibDeps.pl -# -# Synopsis: Generate HTML output that shows the dependencies between a set of -# libraries. The output of this script should periodically replace -# the similar content in the UsingLibraries.html document. -# -# Syntax: GenLibDeps.pl [-flat] [path_to_nm_binary] -# -use strict; -use warnings; -# Parse arguments... -my $FLAT = 0; -my $WHY = 0; -my $PEROBJ = 0; -my $PEROBJINCL = 0; -while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) { - shift; - last if /^--$/; # Stop processing arguments on -- - - # List command line options here... - if (/^-flat$/) { $FLAT = 1; next; } - if (/^-why/) { $WHY = 1; $FLAT = 1; next; } - if (/^-perobj$/) { $PEROBJ = 1; next; } - if (/^-perobjincl/) { $PEROBJINCL = 1; next;} - print "Unknown option: $_ : ignoring!\n"; -} - -# Give first option a name. -my $Directory = $ARGV[0]; -if (!defined($Directory) || ! -d "$Directory") { - die "First argument must specify the directory containing LLVM libs\n"; -} - -my $nmPath = $ARGV[1]; - -# Find the "dot" program -my $DotPath=""; -if (!$FLAT) { - chomp($DotPath = `which dot`); - die "Can't find 'dot'" if (! -x "$DotPath"); -} - -if (defined($ENV{NM})) { - chomp($nmPath=$ENV{NM}); -} - -if (!defined($nmPath) || $nmPath eq "") { - chomp($nmPath=`which nm`); - die "Can't find 'nm'" if (! -x "$nmPath"); -} - -my $ranlibPath; -if ($PEROBJ) { - $ranlibPath = $ARGV[2]; - if (defined($ENV{RANLIB})) { - chomp($ranlibPath=$ENV{RANLIB}); - } - - if (!defined($ranlibPath) || $ranlibPath eq "") { - chomp($ranlibPath=`which ranlib`); - die "Can't find 'ranlib'" if (! -x "$ranlibPath"); - } -} - -# Open the directory and read its contents, sorting by name and differentiating -# by whether its a library (.a) or an object file (.o) -opendir DIR,$Directory; -my @files = readdir DIR; -closedir DIR; -my @libs = grep(/libLLVM.*\.(dylib|so|a)$/,sort(@files)); -# Omit the all-of-llvm shared library. -@libs = grep(!/libLLVM-\d\.\d(svn)?\.(dylib|so)/, @libs); -my @objs = grep(/LLVM.*\.o$/,sort(@files)); - -# Declare the hashes we will use to keep track of the library and object file -# symbol definitions. -my %libdefs; -my %objdefs; - -my %libobjs; -my %objdeps=(); -# Gather library definitions at object file granularity (optional) -if ($PEROBJ) { - foreach my $lib (@libs ) { - `$ranlibPath $Directory/$lib`; - my $libpath = $lib; - $libpath =~ s/^libLLVM(.*)\.a/$1/; - $libpath =~ s/(.+)CodeGen$/Target\/$1/; - $libpath =~ s/(.+)AsmPrinter$/Target\/$1\/AsmPrinter/; - $libpath =~ s/(.+)AsmParser$/Target\/$1\/AsmParser/; - $libpath =~ s/(.+)Info$/Target\/$1\/TargetInfo/; - $libpath =~ s/(.+)Disassembler$/Target\/$1\/Disassembler/; - $libpath =~ s/SelectionDAG/CodeGen\/SelectionDAG/; - $libpath =~ s/^AsmPrinter/CodeGen\/AsmPrinter/; - $libpath =~ s/^BitReader/Bitcode\/Reader/; - $libpath =~ s/^BitWriter/Bitcode\/Writer/; - $libpath =~ s/^CBackend/Target\/CBackend/; - $libpath =~ s/^CppBackend/Target\/CppBackend/; - $libpath =~ s/^MSIL/Target\/MSIL/; - $libpath =~ s/^Core/VMCore/; - $libpath =~ s/^Instrumentation/Transforms\/Instrumentation/; - $libpath =~ s/^Interpreter/ExecutionEngine\/Interpreter/; - $libpath =~ s/^JIT/ExecutionEngine\/JIT/; - $libpath =~ s/^ScalarOpts/Transforms\/Scalar/; - $libpath =~ s/^TransformUtils/Transforms\/Utils/; - $libpath =~ s/^ipa/Analysis\/IPA/; - $libpath =~ s/^ipo/Transforms\/IPO/; - $libpath =~ s/^pic16passes/Target\/PIC16\/PIC16Passes/; - $libpath = "lib/".$libpath."/"; - open DEFS, "$nmPath -sg $Directory/$lib|"; - while () { - chomp; - if (/^([^ ]*) in ([^ ]*)/) { - my $objfile = $libpath.$2; - $objdefs{$1} = $objfile; - $objdeps{$objfile} = {}; - $libobjs{$lib}{$objfile}=1; -# my $p = "../llvm/".$objfile; -# $p =~ s/Support\/reg(.*).o/Support\/reg$1.c/; -# $p =~ s/.o$/.cpp/; -# unless (-e $p) { -# die "$p\n" -# } - } - } - close DEFS or die "nm failed"; - } - foreach my $lib (@libs ) { - my $libpath = $lib; - $libpath =~ s/^libLLVM(.*)\.a/$1/; - $libpath =~ s/(.+)CodeGen$/Target\/$1/; - $libpath =~ s/(.+)AsmPrinter$/Target\/$1\/AsmPrinter/; - $libpath =~ s/(.+)AsmParser$/Target\/$1\/AsmParser/; - $libpath =~ s/(.+)Info$/Target\/$1\/TargetInfo/; - $libpath =~ s/(.+)Disassembler$/Target\/$1\/Disassembler/; - $libpath =~ s/SelectionDAG/CodeGen\/SelectionDAG/; - $libpath =~ s/^AsmPrinter/CodeGen\/AsmPrinter/; - $libpath =~ s/^BitReader/Bitcode\/Reader/; - $libpath =~ s/^BitWriter/Bitcode\/Writer/; - $libpath =~ s/^CBackend/Target\/CBackend/; - $libpath =~ s/^CppBackend/Target\/CppBackend/; - $libpath =~ s/^MSIL/Target\/MSIL/; - $libpath =~ s/^Core/VMCore/; - $libpath =~ s/^Instrumentation/Transforms\/Instrumentation/; - $libpath =~ s/^Interpreter/ExecutionEngine\/Interpreter/; - $libpath =~ s/^JIT/ExecutionEngine\/JIT/; - $libpath =~ s/^ScalarOpts/Transforms\/Scalar/; - $libpath =~ s/^TransformUtils/Transforms\/Utils/; - $libpath =~ s/^ipa/Analysis\/IPA/; - $libpath =~ s/^ipo/Transforms\/IPO/; - $libpath =~ s/^pic16passes/Target\/PIC16\/PIC16Passes/; - $libpath = "lib/".$libpath."/"; - open UDEFS, "$nmPath -Aup $Directory/$lib|"; - while () { - chomp; - if (/:([^:]+):/) { - my $obj = $libpath.$1; - s/[^ ]+: *U //; - if (defined($objdefs{$_})) { - $objdeps{$obj}{$objdefs{$_}}=1; - } - } - } - close UDEFS or die "nm failed" - } -} else { -# Gather definitions from the libraries -foreach my $lib (@libs ) { - open DEFS, "$nmPath -g $Directory/$lib|"; - while () { - next if (! / [ABCDGRST] /); - s/^[^ ]* [ABCDGRST] //; - s/\015?\012//; # not sure if is in binmode and uses LF or CRLF. - # this strips both LF and CRLF. - $libdefs{$_} = $lib; - } - close DEFS or die "nm failed"; -} -} - -# Gather definitions from the object files. -foreach my $obj (@objs ) { - open DEFS, "$nmPath -g $Directory/$obj |"; - while () { - next if (! / [ABCDGRST] /); - s/^[^ ]* [ABCDGRST] //; - s/\015?\012//; # not sure if is in binmode and uses LF or CRLF. - # this strips both LF and CRLF. - $objdefs{$_} = $obj; - } - close DEFS or die "nm failed"; -} - -# Generate one entry in the
list. This generates the
and
elements -# for one library or object file. The
provides the name of the library or -# object. The
provides a list of the libraries/objects it depends on. -sub gen_one_entry { - my $lib = $_[0]; - my $lib_ns = $lib; - $lib_ns =~ s/(.*)\.[oa]/$1/; - if ($FLAT) { - print "$lib:"; - if ($WHY) { print "\n"; } - } else { - print "
$lib
    \n"; - } - open UNDEFS, - "$nmPath -u $Directory/$lib | sed -e 's/^[ 0]* U //' | sort | uniq |"; - my %DepLibs; - while () { - chomp; - my $lib_printed = 0; - if (defined($libdefs{$_}) && $libdefs{$_} ne $lib) { - $DepLibs{$libdefs{$_}} = [] unless exists $DepLibs{$libdefs{$_}}; - push(@{$DepLibs{$libdefs{$_}}}, $_); - } elsif (defined($objdefs{$_}) && $objdefs{$_} ne $lib) { - if ($PEROBJ && !$PEROBJINCL) { - # -perobjincl makes .a files depend on .o files they contain themselves - # default is don't depend on these. - next if defined $libobjs{$lib}{$objdefs{$_}}; - } - my $libroot = $lib; - $libroot =~ s/lib(.*).a/$1/; - if ($objdefs{$_} ne "$libroot.o") { - $DepLibs{$objdefs{$_}} = [] unless exists $DepLibs{$objdefs{$_}}; - push(@{$DepLibs{$objdefs{$_}}}, $_); - } - } - } - close UNDEFS or die "nm failed"; - unless(keys %DepLibs) { - # above failed - open UNDEFS, "$nmPath -u $Directory/$lib |"; - while () { - # to bypass non-working sed - if (' ' eq substr($_,0,2) and index($_,'U ')) { - $_ = substr($_,index($_,'U ')+2) - }; - $_ = substr($_,index($_,' *U ')+5) if -1!=index($_,' *U '); - - chomp; - my $lib_printed = 0; - if (defined($libdefs{$_}) && $libdefs{$_} ne $lib) { - $DepLibs{$libdefs{$_}} = [] unless exists $DepLibs{$libdefs{$_}}; - push(@{$DepLibs{$libdefs{$_}}}, $_); - } elsif (defined($objdefs{$_}) && $objdefs{$_} ne $lib) { - my $libroot = $lib; - $libroot =~ s/lib(.*).a/$1/; - if ($objdefs{$_} ne "$libroot.o") { - $DepLibs{$objdefs{$_}} = [] unless exists $DepLibs{$objdefs{$_}}; - push(@{$DepLibs{$objdefs{$_}}}, $_); - } - } - } - close UNDEFS or die "nm failed"; - } - if ($PEROBJINCL) { - # include the .a's objects - for my $obj (keys %{$libobjs{$lib}}) { - $DepLibs{$obj} = ["<.a object>"] unless exists $DepLibs{$obj}; - } - my $madechange = 1; - while($madechange) { - $madechange = 0; - my %temp = %DepLibs; - foreach my $obj (keys %DepLibs) { - foreach my $objdeps (keys %{$objdeps{$obj}}) { - next if defined $temp{$objdeps}; - push(@{$temp{$objdeps}}, $obj); - $madechange = 1; - } - } - %DepLibs = %temp; - } - } - - for my $key (sort keys %DepLibs) { - if ($FLAT) { - print " $key"; - if ($WHY) { - print "\n"; - my @syms = @{$DepLibs{$key}}; - foreach my $sym (@syms) { - print " $sym\n"; - } - } - } else { - print "
  • $key
  • \n"; - } - my $suffix = substr($key,length($key)-1,1); - $key =~ s/(.*)\.[oa]/$1/; - if ($suffix eq "a") { - if (!$FLAT) { print DOT "$lib_ns -> $key [ weight=0 ];\n" }; - } else { - if (!$FLAT) { print DOT "$lib_ns -> $key [ weight=10];\n" }; - } - } - if ($FLAT) { - if (!$WHY) { - print "\n"; - } - } else { - print "
\n"; - } -} - -# Make sure we flush on write. This is slower but correct based on the way we -# write I/O in gen_one_entry. -$| = 1; - -# Print the definition list tag -if (!$FLAT) { - print "
\n"; - - open DOT, "| $DotPath -Tgif > libdeps.gif"; - - print DOT "digraph LibDeps {\n"; - print DOT " size=\"40,15\"; \n"; - print DOT " ratio=\"1.33333\"; \n"; - print DOT " margin=\"0.25\"; \n"; - print DOT " rankdir=\"LR\"; \n"; - print DOT " mclimit=\"50.0\"; \n"; - print DOT " ordering=\"out\"; \n"; - print DOT " center=\"1\";\n"; - print DOT "node [shape=\"box\",\n"; - print DOT " color=\"#000088\",\n"; - print DOT " fillcolor=\"#FFFACD\",\n"; - print DOT " fontcolor=\"#3355BB\",\n"; - print DOT " style=\"filled\",\n"; - print DOT " fontname=\"sans\",\n"; - print DOT " fontsize=\"24\"\n"; - print DOT "];\n"; - print DOT "edge [dir=\"forward\",style=\"solid\",color=\"#000088\"];\n"; -} - -# Print libraries first -foreach my $lib (@libs) { - gen_one_entry($lib); -} - -if ($PEROBJ) { - foreach my $obj (keys %objdeps) { - print "$obj:"; - if (!$PEROBJINCL) { - foreach my $dep (keys %{$objdeps{$obj}}) { - print " $dep"; - } - } - print "\n"; - } -} - -if (!$FLAT) { - print DOT "}\n"; - close DOT; - open DOT, "| $DotPath -Tgif > objdeps.gif"; - print DOT "digraph ObjDeps {\n"; - print DOT " size=\"8,10\";\n"; - print DOT " margin=\"0.25\";\n"; - print DOT " rankdir=\"LR\";\n"; - print DOT " mclimit=\"50.0\";\n"; - print DOT " ordering=\"out\";\n"; - print DOT " center=\"1\";\n"; - print DOT "node [shape=\"box\",\n"; - print DOT " color=\"#000088\",\n"; - print DOT " fillcolor=\"#FFFACD\",\n"; - print DOT " fontcolor=\"#3355BB\",\n"; - print DOT " fontname=\"sans\",\n"; - print DOT " style=\"filled\",\n"; - print DOT " fontsize=\"24\"\n"; - print DOT "];\n"; - print DOT "edge [dir=\"forward\",style=\"solid\",color=\"#000088\"];\n"; -} - -# Print objects second -foreach my $obj (@objs) { - gen_one_entry($obj); -} - -if (!$FLAT) { - print DOT "}\n"; - close DOT; - -# Print end tag of definition list element - print "
\n"; -} diff --git a/contrib/llvm/utils/GetSourceVersion b/contrib/llvm/utils/GetSourceVersion deleted file mode 100755 index b25f2f9..0000000 --- a/contrib/llvm/utils/GetSourceVersion +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -usage() { - echo "usage: $0 " - echo " Prints the source control revision of the given source directory," - echo " the exact format of the revision string depends on the source " - echo " control system. If the source control system isn't known, the output" - echo " is empty and the exit code is 1." - exit 1 -} - -if [ $# != 1 ] || [ ! -d $1 ]; then - usage; -fi - -cd $1 -if [ -d .svn ]; then - svnversion -elif [ -d .git/svn ]; then - git svn info | grep 'Revision:' | cut -d: -f2- -elif [ -d .git ]; then - git log -1 --pretty=format:%H -else - exit 1; -fi - -exit 0 diff --git a/contrib/llvm/utils/Makefile b/contrib/llvm/utils/Makefile deleted file mode 100644 index 1a4dcca..0000000 --- a/contrib/llvm/utils/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -##===- utils/Makefile --------------------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -LEVEL = .. -PARALLEL_DIRS := FileCheck FileUpdate TableGen PerfectShuffle \ - count fpcmp llvm-lit not unittest - -EXTRA_DIST := cgiplotNLT.pl check-each-file codegen-diff countloc.sh \ - DSAclean.py DSAextract.py emacs findsym.pl GenLibDeps.pl \ - getsrcs.sh importNLT.pl llvmdo llvmgrep llvm-native-gcc \ - llvm-native-gxx makellvm NightlyTest.gnuplot NightlyTest.pl \ - NightlyTestTemplate.html NLT.schema OldenDataRecover.pl \ - parseNLT.pl plotNLT.pl profile.pl \ - webNLT.pl vim - -include $(LEVEL)/Makefile.common diff --git a/contrib/llvm/utils/Misc/zkill b/contrib/llvm/utils/Misc/zkill deleted file mode 100755 index bc0bfd5..0000000 --- a/contrib/llvm/utils/Misc/zkill +++ /dev/null @@ -1,276 +0,0 @@ -#!/usr/bin/env python - -import os -import re -import sys - -def _write_message(kind, message): - import inspect, os, sys - - # Get the file/line where this message was generated. - f = inspect.currentframe() - # Step out of _write_message, and then out of wrapper. - f = f.f_back.f_back - file,line,_,_,_ = inspect.getframeinfo(f) - location = '%s:%d' % (os.path.basename(file), line) - - print >>sys.stderr, '%s: %s: %s' % (location, kind, message) - -note = lambda message: _write_message('note', message) -warning = lambda message: _write_message('warning', message) -error = lambda message: (_write_message('error', message), sys.exit(1)) - -def re_full_match(pattern, str): - m = re.match(pattern, str) - if m and m.end() != len(str): - m = None - return m - -def parse_time(value): - minutes,value = value.split(':',1) - if '.' in value: - seconds,fseconds = value.split('.',1) - else: - seconds = value - return int(minutes) * 60 + int(seconds) + float('.'+fseconds) - -def extractExecutable(command): - """extractExecutable - Given a string representing a command line, attempt - to extract the executable path, even if it includes spaces.""" - - # Split into potential arguments. - args = command.split(' ') - - # Scanning from the beginning, try to see if the first N args, when joined, - # exist. If so that's probably the executable. - for i in range(1,len(args)): - cmd = ' '.join(args[:i]) - if os.path.exists(cmd): - return cmd - - # Otherwise give up and return the first "argument". - return args[0] - -class Struct: - def __init__(self, **kwargs): - self.fields = kwargs.keys() - self.__dict__.update(kwargs) - - def __repr__(self): - return 'Struct(%s)' % ', '.join(['%s=%r' % (k,getattr(self,k)) - for k in self.fields]) - -kExpectedPSFields = [('PID', int, 'pid'), - ('USER', str, 'user'), - ('COMMAND', str, 'command'), - ('%CPU', float, 'cpu_percent'), - ('TIME', parse_time, 'cpu_time'), - ('VSZ', int, 'vmem_size'), - ('RSS', int, 'rss')] -def getProcessTable(): - import subprocess - p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - out,err = p.communicate() - res = p.wait() - if p.wait(): - error('unable to get process table') - elif err.strip(): - error('unable to get process table: %s' % err) - - lns = out.split('\n') - it = iter(lns) - header = it.next().split() - numRows = len(header) - - # Make sure we have the expected fields. - indexes = [] - for field in kExpectedPSFields: - try: - indexes.append(header.index(field[0])) - except: - if opts.debug: - raise - error('unable to get process table, no %r field.' % field[0]) - - table = [] - for i,ln in enumerate(it): - if not ln.strip(): - continue - - fields = ln.split(None, numRows - 1) - if len(fields) != numRows: - warning('unable to process row: %r' % ln) - continue - - record = {} - for field,idx in zip(kExpectedPSFields, indexes): - value = fields[idx] - try: - record[field[2]] = field[1](value) - except: - if opts.debug: - raise - warning('unable to process %r in row: %r' % (field[0], ln)) - break - else: - # Add our best guess at the executable. - record['executable'] = extractExecutable(record['command']) - table.append(Struct(**record)) - - return table - -def getSignalValue(name): - import signal - if name.startswith('SIG'): - value = getattr(signal, name) - if value and isinstance(value, int): - return value - error('unknown signal: %r' % name) - -import signal -kSignals = {} -for name in dir(signal): - if name.startswith('SIG') and name == name.upper() and name.isalpha(): - kSignals[name[3:]] = getattr(signal, name) - -def main(): - global opts - from optparse import OptionParser, OptionGroup - parser = OptionParser("usage: %prog [options] {pid}*") - - # FIXME: Add -NNN and -SIGNAME options. - - parser.add_option("-s", "", dest="signalName", - help="Name of the signal to use (default=%default)", - action="store", default='INT', - choices=kSignals.keys()) - parser.add_option("-l", "", dest="listSignals", - help="List known signal names", - action="store_true", default=False) - - parser.add_option("-n", "--dry-run", dest="dryRun", - help="Only print the actions that would be taken", - action="store_true", default=False) - parser.add_option("-v", "--verbose", dest="verbose", - help="Print more verbose output", - action="store_true", default=False) - parser.add_option("", "--debug", dest="debug", - help="Enable debugging output", - action="store_true", default=False) - parser.add_option("", "--force", dest="force", - help="Perform the specified commands, even if it seems like a bad idea", - action="store_true", default=False) - - inf = float('inf') - group = OptionGroup(parser, "Process Filters") - group.add_option("", "--name", dest="execName", metavar="REGEX", - help="Kill processes whose name matches the given regexp", - action="store", default=None) - group.add_option("", "--exec", dest="execPath", metavar="REGEX", - help="Kill processes whose executable matches the given regexp", - action="store", default=None) - group.add_option("", "--user", dest="userName", metavar="REGEX", - help="Kill processes whose user matches the given regexp", - action="store", default=None) - group.add_option("", "--min-cpu", dest="minCPU", metavar="PCT", - help="Kill processes with CPU usage >= PCT", - action="store", type=float, default=None) - group.add_option("", "--max-cpu", dest="maxCPU", metavar="PCT", - help="Kill processes with CPU usage <= PCT", - action="store", type=float, default=inf) - group.add_option("", "--min-mem", dest="minMem", metavar="N", - help="Kill processes with virtual size >= N (MB)", - action="store", type=float, default=None) - group.add_option("", "--max-mem", dest="maxMem", metavar="N", - help="Kill processes with virtual size <= N (MB)", - action="store", type=float, default=inf) - group.add_option("", "--min-rss", dest="minRSS", metavar="N", - help="Kill processes with RSS >= N", - action="store", type=float, default=None) - group.add_option("", "--max-rss", dest="maxRSS", metavar="N", - help="Kill processes with RSS <= N", - action="store", type=float, default=inf) - group.add_option("", "--min-time", dest="minTime", metavar="N", - help="Kill processes with CPU time >= N (seconds)", - action="store", type=float, default=None) - group.add_option("", "--max-time", dest="maxTime", metavar="N", - help="Kill processes with CPU time <= N (seconds)", - action="store", type=float, default=inf) - parser.add_option_group(group) - - (opts, args) = parser.parse_args() - - if opts.listSignals: - items = [(v,k) for k,v in kSignals.items()] - items.sort() - for i in range(0, len(items), 4): - print '\t'.join(['%2d) SIG%s' % (k,v) - for k,v in items[i:i+4]]) - sys.exit(0) - - # Figure out the signal to use. - signal = kSignals[opts.signalName] - signalValueName = str(signal) - if opts.verbose: - name = dict((v,k) for k,v in kSignals.items()).get(signal,None) - if name: - signalValueName = name - note('using signal %d (SIG%s)' % (signal, name)) - else: - note('using signal %d' % signal) - - # Get the pid list to consider. - pids = set() - for arg in args: - try: - pids.add(int(arg)) - except: - parser.error('invalid positional argument: %r' % arg) - - filtered = ps = getProcessTable() - - # Apply filters. - if pids: - filtered = [p for p in filtered - if p.pid in pids] - if opts.execName is not None: - filtered = [p for p in filtered - if re_full_match(opts.execName, - os.path.basename(p.executable))] - if opts.execPath is not None: - filtered = [p for p in filtered - if re_full_match(opts.execPath, p.executable)] - if opts.userName is not None: - filtered = [p for p in filtered - if re_full_match(opts.userName, p.user)] - filtered = [p for p in filtered - if opts.minCPU <= p.cpu_percent <= opts.maxCPU] - filtered = [p for p in filtered - if opts.minMem <= float(p.vmem_size) / (1<<20) <= opts.maxMem] - filtered = [p for p in filtered - if opts.minRSS <= p.rss <= opts.maxRSS] - filtered = [p for p in filtered - if opts.minTime <= p.cpu_time <= opts.maxTime] - - if len(filtered) == len(ps): - if not opts.force and not opts.dryRun: - error('refusing to kill all processes without --force') - - if not filtered: - warning('no processes selected') - - for p in filtered: - if opts.verbose: - note('kill(%r, %s) # (user=%r, executable=%r, CPU=%2.2f%%, time=%r, vmem=%r, rss=%r)' % - (p.pid, signalValueName, p.user, p.executable, p.cpu_percent, p.cpu_time, p.vmem_size, p.rss)) - if not opts.dryRun: - try: - os.kill(p.pid, signal) - except OSError: - if opts.debug: - raise - warning('unable to kill PID: %r' % p.pid) - -if __name__ == '__main__': - main() diff --git a/contrib/llvm/utils/NLT.schema b/contrib/llvm/utils/NLT.schema deleted file mode 100644 index 4bcddbc..0000000 --- a/contrib/llvm/utils/NLT.schema +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE `Tests` ( - `NAME` varchar(255) NOT NULL default '', - `RUN` date NOT NULL default '0000-00-00', - `TEST` varchar(32) NOT NULL default '', - `VALUE` double NOT NULL default '0', - KEY `name_index` (`NAME`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 - diff --git a/contrib/llvm/utils/NewNightlyTest.pl b/contrib/llvm/utils/NewNightlyTest.pl deleted file mode 100755 index 1b48168..0000000 --- a/contrib/llvm/utils/NewNightlyTest.pl +++ /dev/null @@ -1,836 +0,0 @@ -#!/usr/bin/perl -use POSIX qw(strftime); -use File::Copy; -use File::Find; -use Socket; - -# -# Program: NewNightlyTest.pl -# -# Synopsis: Perform a series of tests which are designed to be run nightly. -# This is used to keep track of the status of the LLVM tree, tracking -# regressions and performance changes. Submits this information -# to llvm.org where it is placed into the nightlytestresults database. -# -# Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR] -# where -# OPTIONS may include one or more of the following: -# -# MAIN OPTIONS: -# -config LLVMPATH If specified, use an existing LLVM build and only run and -# report the test information. The LLVMCONFIG argument should -# be the path to the llvm-config executable in the LLVM build. -# This should be the first argument if given. NOT YET -# IMPLEMENTED. -# -nickname NAME The NAME argument specifieds the nickname this script -# will submit to the nightlytest results repository. -# -nouname Don't include uname data (machine will be identified by nickname only). -# -submit-server Specifies a server to submit the test results too. If this -# option is not specified it defaults to -# llvm.org. This is basically just the address of the -# webserver -# -submit-script Specifies which script to call on the submit server. If -# this option is not specified it defaults to -# /nightlytest/NightlyTestAccept.php. This is basically -# everything after the www.yourserver.org. -# -submit-aux If specified, an auxiliary script to run in addition to the -# normal submit script. The script will be passed the path to -# the "sentdata.txt" file as its sole argument. -# -nosubmit Do not report the test results back to a submit server. -# -# -# BUILD OPTIONS (not used with -config): -# -nocheckout Do not create, checkout, update, or configure -# the source tree. -# -noremove Do not remove the BUILDDIR after it has been built. -# -noremoveresults Do not remove the WEBDIR after it has been built. -# -noclean Do not run 'make clean' before building. -# -nobuild Do not build llvm. If tests are enabled perform them -# on the llvm build specified in the build directory -# -release Build an LLVM Release+Asserts version -# -release-asserts Build an LLVM Release version -# -disable-bindings Disable building LLVM bindings. -# -with-clang Checkout Clang source into tools/clang. -# -compileflags Next argument specifies extra options passed to make when -# building LLVM. -# -use-gmake Use gmake instead of the default make command to build -# llvm and run tests. -# -llvmgccdir Next argument specifies the llvm-gcc install prefix. -# -# TESTING OPTIONS: -# -notest Do not even attempt to run the test programs. -# -nodejagnu Do not run feature or regression tests -# -enable-llcbeta Enable testing of beta features in llc. -# -enable-lli Enable testing of lli (interpreter) features, default is off -# -disable-pic Disable building with Position Independent Code. -# -disable-llc Disable LLC tests in the nightly tester. -# -disable-jit Disable JIT tests in the nightly tester. -# -disable-cbe Disable C backend tests in the nightly tester. -# -disable-lto Disable link time optimization. -# -test-cflags Next argument specifies that C compilation options that -# override the default when running the testsuite. -# -test-cxxflags Next argument specifies that C++ compilation options that -# override the default when running the testsuite. -# -extraflags Next argument specifies extra options that are passed to -# compile the tests. -# -noexternals Do not run the external tests (for cases where povray -# or SPEC are not installed) -# -with-externals Specify a directory where the external tests are located. -# -# OTHER OPTIONS: -# -parallel Run parallel jobs with GNU Make (see -parallel-jobs). -# -parallel-jobs The number of parallel Make jobs to use (default is two). -# -parallel-test Allow parallel execution of llvm-test -# -verbose Turn on some debug output -# -nice Checkout/Configure/Build with "nice" to reduce impact -# on busy servers. -# -f2c Next argument specifies path to F2C utility -# -gccpath Path to gcc/g++ used to build LLVM -# -target Specify the target triplet -# -cflags Next argument specifies that C compilation options that -# override the default. -# -cxxflags Next argument specifies that C++ compilation options that -# override the default. -# -ldflags Next argument specifies that linker options that override -# the default. -# -# CVSROOT is ignored, it is passed for backwards compatibility. -# BUILDDIR is the directory where sources for this test run will be checked out -# AND objects for this test run will be built. This directory MUST NOT -# exist before the script is run; it will be created by the svn checkout -# process and erased (unless -noremove is specified; see above.) -# WEBDIR is the directory into which the test results web page will be written, -# AND in which the "index.html" is assumed to be a symlink to the most recent -# copy of the results. This directory will be created if it does not exist. -# LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed -# to. This is the same as you would have for a normal LLVM build. -# -############################################################## -# -# Getting environment variables -# -############################################################## -my $HOME = $ENV{'HOME'}; -my $SVNURL = $ENV{"SVNURL"}; -$SVNURL = 'http://llvm.org/svn/llvm-project' unless $SVNURL; -my $TestSVNURL = $ENV{"TestSVNURL"}; -$TestSVNURL = 'http://llvm.org/svn/llvm-project' unless $TestSVNURL; -my $BuildDir = $ENV{'BUILDDIR'}; -my $WebDir = $ENV{'WEBDIR'}; - -############################################################## -# -# Calculate the date prefix... -# -############################################################## -use POSIX; -@TIME = localtime; -my $DATE = strftime("%Y-%m-%d_%H-%M-%S", localtime()); - -############################################################## -# -# Parse arguments... -# -############################################################## -$CONFIG_PATH=""; -$CONFIGUREARGS=""; -$nickname=""; -$NOTEST=0; -$MAKECMD="make"; -$SUBMITSERVER = "llvm.org"; -$SUBMITSCRIPT = "/nightlytest/NightlyTestAccept.php"; -$SUBMITAUX=""; -$SUBMIT = 1; -$PARALLELJOBS = "2"; -my $TESTFLAGS=""; - -if ($ENV{'LLVMGCCDIR'}) { - $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'}; - $LLVMGCCPATH = $ENV{'LLVMGCCDIR'} . '/bin'; -} -else { - $LLVMGCCPATH = ""; -} - -while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) { - shift; - last if /^--$/; # Stop processing arguments on -- - - # List command line options here... - if (/^-config$/) { $CONFIG_PATH = "$ARGV[0]"; shift; next; } - if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; } - if (/^-noclean$/) { $NOCLEAN = 1; next; } - if (/^-noremove$/) { $NOREMOVE = 1; next; } - if (/^-noremoveatend$/) { $NOREMOVEATEND = 1; next; } - if (/^-noremoveresults$/){ $NOREMOVERESULTS = 1; next; } - if (/^-notest$/) { $NOTEST = 1; next; } - if (/^-norunningtests$/) { next; } # Backward compatibility, ignored. - if (/^-parallel-jobs$/) { $PARALLELJOBS = "$ARGV[0]"; shift; next;} - if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j$PARALLELJOBS"; next; } - if (/^-parallel-test$/) { $PROGTESTOPTS .= " ENABLE_PARALLEL_REPORT=1"; next; } - if (/^-with-clang$/) { $WITHCLANG = 1; next; } - if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". - "OPTIMIZE_OPTION=-O2"; next;} - if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". - "DISABLE_ASSERTIONS=1 ". - "OPTIMIZE_OPTION=-O2"; next;} - if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; } - if (/^-disable-pic$/) { $CONFIGUREARGS .= " --enable-pic=no"; next; } - if (/^-enable-lli$/) { $PROGTESTOPTS .= " ENABLE_LLI=1"; - $CONFIGUREARGS .= " --enable-lli"; next; } - if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1"; - $CONFIGUREARGS .= " --disable-llc_diffs"; next; } - if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1"; - $CONFIGUREARGS .= " --disable-jit"; next; } - if (/^-disable-bindings$/) { $CONFIGUREARGS .= " --disable-bindings"; next; } - if (/^-disable-cbe$/) { $PROGTESTOPTS .= " DISABLE_CBE=1"; next; } - if (/^-disable-lto$/) { $PROGTESTOPTS .= " DISABLE_LTO=1"; next; } - if (/^-test-opts$/) { $PROGTESTOPTS .= " $ARGV[0]"; shift; next; } - if (/^-verbose$/) { $VERBOSE = 1; next; } - if (/^-teelogs$/) { $TEELOGS = 1; next; } - if (/^-nice$/) { $NICE = "nice "; next; } - if (/^-f2c$/) { $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; - shift; next; } - if (/^-with-externals$/) { $CONFIGUREARGS .= " --with-externals=$ARGV[0]"; - shift; next; } - if (/^-configure-args$/) { $CONFIGUREARGS .= " $ARGV[0]"; - shift; next; } - if (/^-submit-server/) { $SUBMITSERVER = "$ARGV[0]"; shift; next; } - if (/^-submit-script/) { $SUBMITSCRIPT = "$ARGV[0]"; shift; next; } - if (/^-submit-aux/) { $SUBMITAUX = "$ARGV[0]"; shift; next; } - if (/^-nosubmit$/) { $SUBMIT = 0; next; } - if (/^-nickname$/) { $nickname = "$ARGV[0]"; shift; next; } - if (/^-gccpath/) { $CONFIGUREARGS .= - " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; - $GCCPATH=$ARGV[0]; shift; next; } - else { $GCCPATH=""; } - if (/^-target/) { $CONFIGUREARGS .= " --target=$ARGV[0]"; - shift; next; } - if (/^-cflags/) { $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'"; - shift; next; } - if (/^-cxxflags/) { $MAKEOPTS = "$MAKEOPTS CXX.Flags=\'$ARGV[0]\'"; - shift; next; } - if (/^-ldflags/) { $MAKEOPTS = "$MAKEOPTS LD.Flags=\'$ARGV[0]\'"; - shift; next; } - if (/^-test-cflags/) { $TESTFLAGS = "$TESTFLAGS CFLAGS=\'$ARGV[0]\'"; - shift; next; } - if (/^-test-cxxflags/) { $TESTFLAGS = "$TESTFLAGS CXXFLAGS=\'$ARGV[0]\'"; - shift; next; } - if (/^-compileflags/) { $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next; } - if (/^-llvmgccdir/) { $CONFIGUREARGS .= " --with-llvmgccdir=\'$ARGV[0]\'"; - $LLVMGCCPATH = $ARGV[0] . '/bin'; - shift; next;} - if (/^-noexternals$/) { $NOEXTERNALS = 1; next; } - if (/^-nouname$/) { $NOUNAME = 1; next; } - if (/^-use-gmake/) { $MAKECMD = "gmake"; shift; next; } - if (/^-extraflags/) { $CONFIGUREARGS .= - " --with-extra-options=\'$ARGV[0]\'"; shift; next;} - if (/^-noexternals$/) { $NOEXTERNALS = 1; next; } - if (/^-nodejagnu$/) { next; } - if (/^-nobuild$/) { $NOBUILD = 1; next; } - print "Unknown option: $_ : ignoring!\n"; -} - -if ($CONFIGUREARGS !~ /--disable-jit/) { - $CONFIGUREARGS .= " --enable-jit"; -} - -if (@ARGV != 0 and @ARGV != 3) { - die "error: must specify 0 or 3 options!"; -} - -if (@ARGV == 3) { - if ($CONFIG_PATH ne "") { - die "error: arguments are unsupported in -config mode,"; - } - - # ARGV[0] used to be the CVS root, ignored for backward compatibility. - $BuildDir = $ARGV[1]; - $WebDir = $ARGV[2]; -} - -if ($CONFIG_PATH ne "") { - $BuildDir = ""; - $SVNURL = $TestSVNURL = ""; - if ($WebDir eq "") { - die("please specify a web directory"); - } -} else { - if ($BuildDir eq "" or - $WebDir eq "") { - die("please specify a build directory, and a web directory"); - } -} - -if ($nickname eq "") { - die ("Please invoke NewNightlyTest.pl with command line option " . - "\"-nickname \""); -} - -my $LLVMSrcDir = $ENV{'LLVMSRCDIR'}; -$LLVMSrcDir = "$BuildDir/llvm" unless $LLVMSrcDir; -my $LLVMObjDir = $ENV{'LLVMOBJDIR'}; -$LLVMObjDir = "$BuildDir/llvm" unless $LLVMObjDir; -my $LLVMTestDir = $ENV{'LLVMTESTDIR'}; -$LLVMTestDir = "$BuildDir/llvm/projects/llvm-test" unless $LLVMTestDir; - -############################################################## -# -# Define the file names we'll use -# -############################################################## - -my $Prefix = "$WebDir/$DATE"; -my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz"; -my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz"; -my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz"; - -# These are only valid in non-config mode. -my $ConfigureLog = "", $BuildLog = "", $COLog = ""; -my $DejagnuLog = "", $DejagnuSum = "", $DejagnuLog = ""; - -# Are we in config mode? -my $ConfigMode = 0; - -############################################################## -# -# Helper functions -# -############################################################## - -sub GetDir { - my $Suffix = shift; - opendir DH, $WebDir; - my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH; - closedir DH; - return @Result; -} - -sub RunLoggedCommand { - my $Command = shift; - my $Log = shift; - my $Title = shift; - if ($TEELOGS) { - if ($VERBOSE) { - print "$Title\n"; - print "$Command 2>&1 | tee $Log\n"; - } - system "$Command 2>&1 | tee $Log"; - } else { - if ($VERBOSE) { - print "$Title\n"; - print "$Command > $Log 2>&1\n"; - } - system "$Command > $Log 2>&1"; - } -} - -sub RunAppendingLoggedCommand { - my $Command = shift; - my $Log = shift; - my $Title = shift; - if ($TEELOGS) { - if ($VERBOSE) { - print "$Title\n"; - print "$Command 2>&1 | tee -a $Log\n"; - } - system "$Command 2>&1 | tee -a $Log"; - } else { - if ($VERBOSE) { - print "$Title\n"; - print "$Command >> $Log 2>&1\n"; - } - system "$Command >> $Log 2>&1"; - } -} - -sub GetRegex { # (Regex with ()'s, value) - if ($_[1] =~ /$_[0]/m) { - return $1; - } - return "0"; -} - -sub ChangeDir { # directory, logical name - my ($dir,$name) = @_; - chomp($dir); - if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; } - $result = chdir($dir); - if (!$result) { - print "ERROR!!! Cannot change directory to: $name ($dir) because $!\n"; - return false; - } - return true; -} - -sub ReadFile { - if (open (FILE, $_[0])) { - undef $/; - my $Ret = ; - close FILE; - $/ = '\n'; - return $Ret; - } else { - print "Could not open file '$_[0]' for reading!\n"; - return ""; - } -} - -sub WriteFile { # (filename, contents) - open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!\n"; - print FILE $_[1]; - close FILE; -} - -sub CopyFile { #filename, newfile - my ($file, $newfile) = @_; - chomp($file); - if ($VERBOSE) { print "Copying $file to $newfile\n"; } - copy($file, $newfile); -} - -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# This function acts as a mini web browswer submitting data -# to our central server via the post method -# -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -sub WriteSentData { - $variables = $_[0]; - - # Write out the "...-sentdata.txt" file. - - my $sentdata=""; - foreach $x (keys (%$variables)){ - $value = $variables->{$x}; - $sentdata.= "$x => $value\n"; - } - WriteFile "$Prefix-sentdata.txt", $sentdata; -} - -sub SendData { - $host = $_[0]; - $file = $_[1]; - $variables = $_[2]; - - if (!($SUBMITAUX eq "")) { - system "$SUBMITAUX \"$Prefix-sentdata.txt\""; - } - - if (!$SUBMIT) { - return "Skipped standard submit.\n"; - } - - # Create the content to send to the server. - - my $content; - foreach $key (keys (%$variables)){ - $value = $variables->{$key}; - $value =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; - $content .= "$key=$value&"; - } - - # Send the data to the server. - # - # FIXME: This code should be more robust? - - $port=80; - $socketaddr= sockaddr_in $port, inet_aton $host or die "Bad hostname\n"; - socket SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp') or - die "Bad socket\n"; - connect SOCK, $socketaddr or die "Bad connection\n"; - select((select(SOCK), $| = 1)[0]); - - $length = length($content); - - my $send= "POST $file HTTP/1.0\n"; - $send.= "Host: $host\n"; - $send.= "Content-Type: application/x-www-form-urlencoded\n"; - $send.= "Content-length: $length\n\n"; - $send.= "$content"; - - print SOCK $send; - my $result; - while(){ - $result .= $_; - } - close(SOCK); - - return $result; -} - -############################################################## -# -# Individual Build & Test Functions -# -############################################################## - -# Create the source repository directory. -sub CheckoutSource { - die "Invalid call!" unless $ConfigMode == 0; - if (-d $BuildDir) { - if (!$NOREMOVE) { - if ( $VERBOSE ) { - print "Build directory exists! Removing it\n"; - } - system "rm -rf $BuildDir"; - mkdir $BuildDir or die "Could not create checkout directory $BuildDir!"; - } else { - if ( $VERBOSE ) { - print "Build directory exists!\n"; - } - } - } else { - mkdir $BuildDir or die "Could not create checkout directory $BuildDir!"; - } - - ChangeDir( $BuildDir, "checkout directory" ); - my $SVNCMD = "$NICE svn co --non-interactive"; - RunLoggedCommand("( time -p $SVNCMD $SVNURL/llvm/trunk llvm; cd llvm/projects ; " . - " $SVNCMD $TestSVNURL/test-suite/trunk llvm-test )", $COLog, - "CHECKOUT LLVM"); - if ($WITHCLANG) { - RunLoggedCommand("( cd llvm/tools ; " . - " $SVNCMD $SVNURL/cfe/trunk clang )", $COLog, - "CHECKOUT CLANG"); - } -} - -# Build the entire tree, saving build messages to the build log. Returns false -# on build failure. -sub BuildLLVM { - die "Invalid call!" unless $ConfigMode == 0; - my $EXTRAFLAGS = "--enable-spec --with-objroot=."; - RunLoggedCommand("(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) ", - $ConfigureLog, "CONFIGURE"); - # Build the entire tree, capturing the output into $BuildLog - if (!$NOCLEAN) { - RunAppendingLoggedCommand("($NICE $MAKECMD $MAKEOPTS clean)", $BuildLog, "BUILD CLEAN"); - } - RunAppendingLoggedCommand("(time -p $NICE $MAKECMD $MAKEOPTS)", $BuildLog, "BUILD"); - - if (`grep -a '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 || - `grep -a '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l` + 0) { - return 0; - } - - return 1; -} - -# Run the named tests (i.e. "SingleSource" "MultiSource" "External") -sub TestDirectory { - my $SubDir = shift; - ChangeDir( "$LLVMTestDir/$SubDir", - "Programs Test Subdirectory" ) || return ("", ""); - - my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt"; - - # Make sure to clean the test results. - RunLoggedCommand("$MAKECMD -k $MAKEOPTS $PROGTESTOPTS clean $TESTFLAGS", - $ProgramTestLog, "TEST DIRECTORY $SubDir"); - - # Run the programs tests... creating a report.nightly.csv file. - my $LLCBetaOpts = ""; - RunLoggedCommand("$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ". - "$TESTFLAGS TEST=nightly", - $ProgramTestLog, "TEST DIRECTORY $SubDir"); - $LLCBetaOpts = `$MAKECMD print-llcbeta-option`; - - my $ProgramsTable; - if (`grep -a '^$MAKECMD\[^:]: .*Error' $ProgramTestLog | wc -l` + 0) { - $ProgramsTable="Error running test $SubDir\n"; - print "ERROR TESTING\n"; - } elsif (`grep -a '^$MAKECMD\[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) { - $ProgramsTable="Makefile error running tests $SubDir!\n"; - print "ERROR TESTING\n"; - } else { - # Create a list of the tests which were run... - system "egrep -a 'TEST-(PASS|FAIL)' < $ProgramTestLog ". - "| sort > $Prefix-$SubDir-Tests.txt"; - } - $ProgramsTable = ReadFile "report.nightly.csv"; - - ChangeDir( "../../..", "Programs Test Parent Directory" ); - return ($ProgramsTable, $LLCBetaOpts); -} - -# Run all the nightly tests and return the program tables and the list of tests, -# passes, fails, and xfails. -sub RunNightlyTest() { - ($SSProgs, $llcbeta_options) = TestDirectory("SingleSource"); - WriteFile "$Prefix-SingleSource-Performance.txt", $SSProgs; - ($MSProgs, $llcbeta_options) = TestDirectory("MultiSource"); - WriteFile "$Prefix-MultiSource-Performance.txt", $MSProgs; - if ( ! $NOEXTERNALS ) { - ($ExtProgs, $llcbeta_options) = TestDirectory("External"); - WriteFile "$Prefix-External-Performance.txt", $ExtProgs; - system "cat $Prefix-SingleSource-Tests.txt " . - "$Prefix-MultiSource-Tests.txt ". - "$Prefix-External-Tests.txt | sort > $Prefix-Tests.txt"; - system "cat $Prefix-SingleSource-Performance.txt " . - "$Prefix-MultiSource-Performance.txt ". - "$Prefix-External-Performance.txt | sort > $Prefix-Performance.txt"; - } else { - $ExtProgs = "External TEST STAGE SKIPPED\n"; - if ( $VERBOSE ) { - print "External TEST STAGE SKIPPED\n"; - } - system "cat $Prefix-SingleSource-Tests.txt " . - "$Prefix-MultiSource-Tests.txt ". - " | sort > $Prefix-Tests.txt"; - system "cat $Prefix-SingleSource-Performance.txt " . - "$Prefix-MultiSource-Performance.txt ". - " | sort > $Prefix-Performance.txt"; - } - - # Compile passes, fails, xfails. - my $All = (ReadFile "$Prefix-Tests.txt"); - my @TestSuiteResultLines = split "\n", $All; - my ($Passes, $Fails, $XFails) = ""; - - for ($x=0; $x < @TestSuiteResultLines; $x++) { - if (@TestSuiteResultLines[$x] =~ m/^PASS:/) { - $Passes .= "$TestSuiteResultLines[$x]\n"; - } - elsif (@TestSuiteResultLines[$x] =~ m/^FAIL:/) { - $Fails .= "$TestSuiteResultLines[$x]\n"; - } - elsif (@TestSuiteResultLines[$x] =~ m/^XFAIL:/) { - $XFails .= "$TestSuiteResultLines[$x]\n"; - } - } - - return ($SSProgs, $MSProgs, $ExtProgs, $All, $Passes, $Fails, $XFails); -} - -############################################################## -# -# Initialize filenames -# -############################################################## - -if (! -d $WebDir) { - mkdir $WebDir, 0777 or die "Unable to create web directory: '$WebDir'."; - if($VERBOSE){ - warn "$WebDir did not exist; creating it.\n"; - } -} - -if ($CONFIG_PATH ne "") { - $ConfigMode = 1; - $LLVMSrcDir = GetRegex "^(.*)\\s+", `$CONFIG_PATH --src-root`; - $LLVMObjDir = GetRegex "^(.*)\\s+", `$CONFIG_PATH --obj-root`; - # FIXME: Add llvm-config hook for this? - $LLVMTestDir = $LLVMObjDir . "/projects/test-suite"; -} else { - $ConfigureLog = "$Prefix-Configure-Log.txt"; - $BuildLog = "$Prefix-Build-Log.txt"; - $COLog = "$Prefix-CVS-Log.txt"; -} - -if ($VERBOSE) { - if ($CONFIG_PATH ne "") { - print "INITIALIZED (config mode)\n"; - print "WebDir = $WebDir\n"; - print "Prefix = $Prefix\n"; - print "LLVM Src = $LLVMSrcDir\n"; - print "LLVM Obj = $LLVMObjDir\n"; - print "LLVM Test = $LLVMTestDir\n"; - } else { - print "INITIALIZED\n"; - print "SVN URL = $SVNURL\n"; - print "COLog = $COLog\n"; - print "BuildDir = $BuildDir\n"; - print "WebDir = $WebDir\n"; - print "Prefix = $Prefix\n"; - print "BuildLog = $BuildLog\n"; - } -} - -############################################################## -# -# The actual NewNightlyTest logic. -# -############################################################## - -$starttime = `date "+20%y-%m-%d %H:%M:%S"`; - -my $BuildError = 0, $BuildStatus = "OK"; -if ($ConfigMode == 0) { - if (!$NOCHECKOUT) { - CheckoutSource(); - } - - # Build LLVM. - ChangeDir( $LLVMSrcDir , "llvm source directory") ; - if ($NOCHECKOUT || $NOBUILD) { - $BuildStatus = "Skipped by user"; - } else { - if (!BuildLLVM()) { - if( $VERBOSE) { print "\n***ERROR BUILDING TREE\n\n"; } - $BuildError = 1; - $BuildStatus = "Error: compilation aborted"; - } - } -} - -# Run the llvm-test tests. -my ($SingleSourceProgramsTable, $MultiSourceProgramsTable, $ExternalProgramsTable, - $all_tests, $passes, $fails, $xfails) = ""; -if (!$NOTEST && !$BuildError) { - ($SingleSourceProgramsTable, $MultiSourceProgramsTable, $ExternalProgramsTable, - $all_tests, $passes, $fails, $xfails) = RunNightlyTest(); -} - -$endtime = `date "+20%y-%m-%d %H:%M:%S"`; - -# The last bit of logic is to remove the build and web dirs, after sending data -# to the server. - -############################################################## -# -# Accumulate the information to send to the server. -# -############################################################## - -if ( $VERBOSE ) { print "PREPARING LOGS TO BE SENT TO SERVER\n"; } - -if ( ! $NOUNAME ) { - $machine_data = "uname: ".`uname -a`. - "hardware: ".`uname -m`. - "os: ".`uname -sr`. - "name: ".`uname -n`. - "date: ".`date \"+20%y-%m-%d\"`. - "time: ".`date +\"%H:%M:%S\"`; -} else { - $machine_data = "uname: (excluded)\n". - "hardware: ".`uname -m`. - "os: ".`uname -sr`. - "name: $nickname\n". - "date: ".`date \"+20%y-%m-%d\"`. - "time: ".`date +\"%H:%M:%S\"`; -} - -# Get gcc version. -my $gcc_version_long = ""; -if ($GCCPATH ne "") { - $gcc_version_long = `$GCCPATH/gcc --version`; -} elsif ($ENV{"CC"}) { - $gcc_version_long = `$ENV{"CC"} --version`; -} else { - $gcc_version_long = `gcc --version`; -} -my $gcc_version = (split '\n', $gcc_version_long)[0]; - -# Get llvm-gcc target triple. -# -# FIXME: This shouldn't be hardwired to llvm-gcc. -my $llvmgcc_version_long = ""; -if ($LLVMGCCPATH ne "") { - $llvmgcc_version_long = `$LLVMGCCPATH/llvm-gcc -v 2>&1`; -} else { - $llvmgcc_version_long = `llvm-gcc -v 2>&1`; -} -(split '\n', $llvmgcc_version_long)[1] =~ /Target: (.+)/; -my $targetTriple = $1; - -# Logs. -my ($ConfigureLogData, $BuildLogData, $CheckoutLogData) = ""; -if ($ConfigMode == 0) { - $ConfigureLogData = ReadFile $ConfigureLog; - $BuildLogData = ReadFile $BuildLog; - $CheckoutLogData = ReadFile $COLog; -} - -# Checkout info. -my $CheckoutTime_Wall = GetRegex "^real ([0-9.]+)", $CheckoutLogData; -my $CheckoutTime_User = GetRegex "^user ([0-9.]+)", $CheckoutLogData; -my $CheckoutTime_Sys = GetRegex "^sys ([0-9.]+)", $CheckoutLogData; -my $CheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys; - -# Configure info. -my $ConfigTimeU = GetRegex "^user ([0-9.]+)", $ConfigureLogData; -my $ConfigTimeS = GetRegex "^sys ([0-9.]+)", $ConfigureLogData; -my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System -my $ConfigWallTime = GetRegex "^real ([0-9.]+)",$ConfigureLogData; -$ConfigTime=-1 unless $ConfigTime; -$ConfigWallTime=-1 unless $ConfigWallTime; - -# Build info. -my $BuildTimeU = GetRegex "^user ([0-9.]+)", $BuildLogData; -my $BuildTimeS = GetRegex "^sys ([0-9.]+)", $BuildLogData; -my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System -my $BuildWallTime = GetRegex "^real ([0-9.]+)", $BuildLogData; -$BuildTime=-1 unless $BuildTime; -$BuildWallTime=-1 unless $BuildWallTime; - -if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; } - -my %hash_of_data = ( - 'machine_data' => $machine_data, - 'build_data' => $ConfigureLogData . $BuildLogData, - 'gcc_version' => $gcc_version, - 'nickname' => $nickname, - 'dejagnutime_wall' => "0.0", - 'dejagnutime_cpu' => "0.0", - 'cvscheckouttime_wall' => $CheckoutTime_Wall, - 'cvscheckouttime_cpu' => $CheckoutTime_CPU, - 'configtime_wall' => $ConfigWallTime, - 'configtime_cpu'=> $ConfigTime, - 'buildtime_wall' => $BuildWallTime, - 'buildtime_cpu' => $BuildTime, - 'buildstatus' => $BuildStatus, - 'singlesource_programstable' => $SingleSourceProgramsTable, - 'multisource_programstable' => $MultiSourceProgramsTable, - 'externalsource_programstable' => $ExternalProgramsTable, - 'llcbeta_options' => $llcbeta_options, - 'passing_tests' => $passes, - 'expfail_tests' => $xfails, - 'unexpfail_tests' => $fails, - 'all_tests' => $all_tests, - 'dejagnutests_results' => "Dejagnu skipped by user choice.", - 'dejagnutests_log' => "", - 'starttime' => $starttime, - 'endtime' => $endtime, - 'target_triple' => $targetTriple, - - # Unused, but left around for backwards compatability. - 'warnings' => "", - 'cvsusercommitlist' => "", - 'cvsuserupdatelist' => "", - 'cvsaddedfiles' => "", - 'cvsmodifiedfiles' => "", - 'cvsremovedfiles' => "", - 'lines_of_code' => "", - 'cvs_file_count' => 0, - 'cvs_dir_count' => 0, - 'warnings_removed' => "", - 'warnings_added' => "", - 'new_tests' => "", - 'removed_tests' => "", - 'o_file_sizes' => "", - 'a_file_sizes' => "" -); - -# Write out the "...-sentdata.txt" file. -WriteSentData \%hash_of_data; - -if ($SUBMIT || !($SUBMITAUX eq "")) { - my $response = SendData $SUBMITSERVER,$SUBMITSCRIPT,\%hash_of_data; - if( $VERBOSE) { print "============================\n$response"; } -} else { - print "============================\n"; - foreach $x(keys %hash_of_data){ - print "$x => $hash_of_data{$x}\n"; - } -} - -############################################################## -# -# Remove the source tree... -# -############################################################## -system ( "$NICE rm -rf $BuildDir") - if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVEATEND); -system ( "$NICE rm -rf $WebDir") - if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVERESULTS); diff --git a/contrib/llvm/utils/NightlyTest.gnuplot b/contrib/llvm/utils/NightlyTest.gnuplot deleted file mode 100644 index 514b72a..0000000 --- a/contrib/llvm/utils/NightlyTest.gnuplot +++ /dev/null @@ -1,214 +0,0 @@ -set terminal png - -##------- Plot small Date vs LOC ---- -set output "running_loc.png" -set xlabel "Date" -set ylabel "Lines of Code" -set xdata time -set timefmt "%Y-%m-%d-%H:%M:%S:" -set format x "%b %d, %Y" - -set size .75,.75 -set xtics rotate -set xlabel 0,-1 -plot "running_loc.txt" using 1:2 title '' with lines, \ - "running_loc.txt" using 1:2 title "Date vs. Lines of Code" with lines - -##------- Plot large Date vs LOC ---- -set size 1.5,1.5 -set xtics norotate -set xlabel 0,0 -set output "running_loc_large.png" -plot "running_loc.txt" using 1:2 title '', \ - "running_loc.txt" using 1:2 title "Date vs. Lines of Code" with lines - - -# Delete all labels... -set nolabel - -##------- Olden CBE performance ---- - -set size .75,.75 -set xtics rotate -set xlabel 0,-1 -set output "running_Olden_cbe_time.png" -set ylabel "CBE compiled execution time (s)" -plot "running_Olden_cbe_time.txt" u 1:2 t '' with lines, \ - "running_Olden_cbe_time.txt" u 1:2 t "bh" with lines, \ - "running_Olden_cbe_time.txt" u 1:3 t "em3d" with lines, \ - "running_Olden_cbe_time.txt" u 1:4 t "mst" with lines, \ - "running_Olden_cbe_time.txt" u 1:5 t "power" with lines, \ - "running_Olden_cbe_time.txt" u 1:6 t "tsp" with lines, \ - "running_Olden_cbe_time.txt" u 1:7 t "bisort" with lines, \ - "running_Olden_cbe_time.txt" u 1:8 t "health" with lines, \ - "running_Olden_cbe_time.txt" u 1:9 t "perimeter" with lines, \ - "running_Olden_cbe_time.txt" u 1:10 t "treeadd" with lines, \ - "running_Olden_cbe_time.txt" u 1:11 t "voronoi" \ - with lines - -set size 1.5,1.5 -set xtics norotate -set xlabel 0,0 -set output "running_Olden_cbe_time_large.png" -plot "running_Olden_cbe_time.txt" u 1:2 t '' with lines, \ - "running_Olden_cbe_time.txt" u 1:2 t "bh" with lines, \ - "running_Olden_cbe_time.txt" u 1:3 t "em3d" with lines, \ - "running_Olden_cbe_time.txt" u 1:4 t "mst" with lines, \ - "running_Olden_cbe_time.txt" u 1:5 t "power" with lines, \ - "running_Olden_cbe_time.txt" u 1:6 t "tsp" with lines, \ - "running_Olden_cbe_time.txt" u 1:7 t "bisort" with lines, \ - "running_Olden_cbe_time.txt" u 1:8 t "health" with lines, \ - "running_Olden_cbe_time.txt" u 1:9 t "perimeter" with lines, \ - "running_Olden_cbe_time.txt" u 1:10 t "treeadd" with lines, \ - "running_Olden_cbe_time.txt" u 1:11 t "voronoi" \ - with lines - -##------- Olden JIT performance ---- - -set size .75,.75 -set xtics rotate -set xlabel 0,-1 -set output "running_Olden_jit_time.png" -set ylabel "JIT execution time (s)" -plot "running_Olden_jit_time.txt" u 1:2 t '' with lines, \ - "running_Olden_jit_time.txt" u 1:2 t "bh" with lines, \ - "running_Olden_jit_time.txt" u 1:3 t "em3d" with lines, \ - "running_Olden_jit_time.txt" u 1:4 t "mst" with lines, \ - "running_Olden_jit_time.txt" u 1:5 t "power" with lines, \ - "running_Olden_jit_time.txt" u 1:6 t "tsp" with lines, \ - "running_Olden_jit_time.txt" u 1:7 t "bisort" with lines, \ - "running_Olden_jit_time.txt" u 1:8 t "health" with lines, \ - "running_Olden_jit_time.txt" u 1:9 t "perimeter" with lines, \ - "running_Olden_jit_time.txt" u 1:10 t "treeadd" with lines, \ - "running_Olden_jit_time.txt" u 1:11 t "voronoi" \ - with lines - -set size 1.5,1.5 -set xtics norotate -set xlabel 0,0 -set output "running_Olden_jit_time_large.png" -plot "running_Olden_jit_time.txt" u 1:2 t '' with lines, \ - "running_Olden_jit_time.txt" u 1:2 t "bh" with lines, \ - "running_Olden_jit_time.txt" u 1:3 t "em3d" with lines, \ - "running_Olden_jit_time.txt" u 1:4 t "mst" with lines, \ - "running_Olden_jit_time.txt" u 1:5 t "power" with lines, \ - "running_Olden_jit_time.txt" u 1:6 t "tsp" with lines, \ - "running_Olden_jit_time.txt" u 1:7 t "bisort" with lines, \ - "running_Olden_jit_time.txt" u 1:8 t "health" with lines, \ - "running_Olden_jit_time.txt" u 1:9 t "perimeter" with lines, \ - "running_Olden_jit_time.txt" u 1:10 t "treeadd" with lines, \ - "running_Olden_jit_time.txt" u 1:11 t "voronoi" \ - with lines - -##------- Olden LLC performance ---- - -set size .75,.75 -set xtics rotate -set xlabel 0,-1 -set output "running_Olden_llc_time.png" -set ylabel "LLC compiled execution time (s)" -plot "running_Olden_llc_time.txt" u 1:2 t '' with lines, \ - "running_Olden_llc_time.txt" u 1:2 t "bh" with lines, \ - "running_Olden_llc_time.txt" u 1:3 t "em3d" with lines, \ - "running_Olden_llc_time.txt" u 1:4 t "mst" with lines, \ - "running_Olden_llc_time.txt" u 1:5 t "power" with lines, \ - "running_Olden_llc_time.txt" u 1:6 t "tsp" with lines, \ - "running_Olden_llc_time.txt" u 1:7 t "bisort" with lines, \ - "running_Olden_llc_time.txt" u 1:8 t "health" with lines, \ - "running_Olden_llc_time.txt" u 1:9 t "perimeter" with lines, \ - "running_Olden_llc_time.txt" u 1:10 t "treeadd" with lines, \ - "running_Olden_llc_time.txt" u 1:11 t "voronoi" \ - with lines - -set size 1.5,1.5 -set xtics norotate -set xlabel 0,0 -set output "running_Olden_llc_time_large.png" -plot "running_Olden_llc_time.txt" u 1:2 t '' with lines, \ - "running_Olden_llc_time.txt" u 1:2 t "bh" with lines, \ - "running_Olden_llc_time.txt" u 1:3 t "em3d" with lines, \ - "running_Olden_llc_time.txt" u 1:4 t "mst" with lines, \ - "running_Olden_llc_time.txt" u 1:5 t "power" with lines, \ - "running_Olden_llc_time.txt" u 1:6 t "tsp" with lines, \ - "running_Olden_llc_time.txt" u 1:7 t "bisort" with lines, \ - "running_Olden_llc_time.txt" u 1:8 t "health" with lines, \ - "running_Olden_llc_time.txt" u 1:9 t "perimeter" with lines, \ - "running_Olden_llc_time.txt" u 1:10 t "treeadd" with lines, \ - "running_Olden_llc_time.txt" u 1:11 t "voronoi" \ - with lines - - -##------- Olden optimizer time ---- - -set size .75,.75 -set xtics rotate -set xlabel 0,-1 -set output "running_Olden_opt_time.png" -set ylabel "Time to run the optimizer (s)" -plot "running_Olden_opt_time.txt" u 1:2 t '' with lines, \ - "running_Olden_opt_time.txt" u 1:2 t "bh" with lines, \ - "running_Olden_opt_time.txt" u 1:3 t "em3d" with lines, \ - "running_Olden_opt_time.txt" u 1:4 t "mst" with lines, \ - "running_Olden_opt_time.txt" u 1:5 t "power" with lines, \ - "running_Olden_opt_time.txt" u 1:6 t "tsp" with lines, \ - "running_Olden_opt_time.txt" u 1:7 t "bisort" with lines, \ - "running_Olden_opt_time.txt" u 1:8 t "health" with lines, \ - "running_Olden_opt_time.txt" u 1:9 t "perimeter" with lines, \ - "running_Olden_opt_time.txt" u 1:10 t "treeadd" with lines, \ - "running_Olden_opt_time.txt" u 1:11 t "voronoi" \ - with lines - -set size 1.5,1.5 -set xtics norotate -set xlabel 0,0 -set output "running_Olden_opt_time_large.png" -plot "running_Olden_opt_time.txt" u 1:2 t '' with lines, \ - "running_Olden_opt_time.txt" u 1:2 t "bh" with lines, \ - "running_Olden_opt_time.txt" u 1:3 t "em3d" with lines, \ - "running_Olden_opt_time.txt" u 1:4 t "mst" with lines, \ - "running_Olden_opt_time.txt" u 1:5 t "power" with lines, \ - "running_Olden_opt_time.txt" u 1:6 t "tsp" with lines, \ - "running_Olden_opt_time.txt" u 1:7 t "bisort" with lines, \ - "running_Olden_opt_time.txt" u 1:8 t "health" with lines, \ - "running_Olden_opt_time.txt" u 1:9 t "perimeter" with lines, \ - "running_Olden_opt_time.txt" u 1:10 t "treeadd" with lines, \ - "running_Olden_opt_time.txt" u 1:11 t "voronoi" \ - with lines - - -##------- Bytecode size ---- - -set size .75,.75 -set xtics rotate -set xlabel 0,-1 -set output "running_Olden_bytecode.png" -set ylabel "Program bytecode size (bytes)" -plot "running_Olden_bytecode.txt" u 1:2 t '' with lines, \ - "running_Olden_bytecode.txt" u 1:2 t "bh" with lines, \ - "running_Olden_bytecode.txt" u 1:3 t "em3d" with lines, \ - "running_Olden_bytecode.txt" u 1:4 t "mst" with lines, \ - "running_Olden_bytecode.txt" u 1:5 t "power" with lines, \ - "running_Olden_bytecode.txt" u 1:6 t "tsp" with lines, \ - "running_Olden_bytecode.txt" u 1:7 t "bisort" with lines, \ - "running_Olden_bytecode.txt" u 1:8 t "health" with lines, \ - "running_Olden_bytecode.txt" u 1:9 t "perimeter" with lines, \ - "running_Olden_bytecode.txt" u 1:10 t "treeadd" with lines, \ - "running_Olden_bytecode.txt" u 1:11 t "voronoi" \ - with lines - -set size 1.5,1.5 -set xtics norotate -set xlabel 0,0 -set output "running_Olden_bytecode_large.png" -plot "running_Olden_bytecode.txt" u 1:2 t '' with lines, \ - "running_Olden_bytecode.txt" u 1:2 t "bh" with lines, \ - "running_Olden_bytecode.txt" u 1:3 t "em3d" with lines, \ - "running_Olden_bytecode.txt" u 1:4 t "mst" with lines, \ - "running_Olden_bytecode.txt" u 1:5 t "power" with lines, \ - "running_Olden_bytecode.txt" u 1:6 t "tsp" with lines, \ - "running_Olden_bytecode.txt" u 1:7 t "bisort" with lines, \ - "running_Olden_bytecode.txt" u 1:8 t "health" with lines, \ - "running_Olden_bytecode.txt" u 1:9 t "perimeter" with lines, \ - "running_Olden_bytecode.txt" u 1:10 t "treeadd" with lines, \ - "running_Olden_bytecode.txt" u 1:11 t "voronoi" \ - with lines diff --git a/contrib/llvm/utils/NightlyTestTemplate.html b/contrib/llvm/utils/NightlyTestTemplate.html deleted file mode 100644 index c38bb2e..0000000 --- a/contrib/llvm/utils/NightlyTestTemplate.html +++ /dev/null @@ -1,244 +0,0 @@ - -LLVM Test Results for $DateString - - -
LLVM Test Results for $DateString
-
- - -
- -
-
-Sections:
-
-Overview
-Changes
-Dejagnu Tests
-Trends
-Programs
-
- -

-
-
Previous:
-
- $PrevDaysList -
-

- -Back to:
-Test Results
-LLVM Page

- -

- -
-
-
Today's Test Results Overview -

- - - - - -
- -
Lines Of Code over Time
-Click for larger view -
- -

Nightly Test Overview:

-
    -
  • Start: $TestStartTime
  • -
  • Finish: $TestFinishTime
  • -
  • Platform: $TestPlatform
  • -
-

CVS Tree Overview:

-
    -
  • CVS Checkout Log -
      - $NumDirsInCVS dirs, $NumFilesInCVS files, $LOC - lines of code, checked out in $CVSCheckoutTime seconds
    -
  • Compilation Log - - - - - -
    ItemCPU TimeWall Clock
    Configure CVS Tree$ConfigTime$ConfigWallTime
    Build CVS Tree$BuildTime$BuildWallTime
    Run Dejagnu Tests$DejagnuTime$DejagnuWallTime
  • -
  • Number of object files compiled: $NumObjects
  • -
  • Number of libraries linked: $NumLibraries
  • -
  • Number of executables linked: $NumExecutables
  • -
  • Build Status: $BuildStatus
  • -
- -

Warnings during the build:

-$WarningsList - -

-
-
Changes from Yesterday -

- -

Changes to CVS:

-
    -
  • Users who committed to CVS: $UserCommitList -
  • Users who updated from CVS: $UserUpdateList -
  • Added Files: $AddedFilesList -
  • Modified Files: $ModifiedFilesList -
  • Removed Files: $RemovedFilesList -

- -

Changes to Warnings:

-

Warnings Added:

-$WarningsAdded -

Warnings Removed:

-$WarningsRemoved - -

Changes in the test suite:

-
    -
  • New Tests: $TestsAdded -
  • Removed Tests: $TestsRemoved -
  • Newly passing tests: $TestsFixed -
  • Newly failing tests: $TestsBroken -
-
- - -

-
-
Dejagnu Test Results -
-
-$DejagnuTestResults -

A complete log of testing Feature and Regression is available for further analysis.

- -

-
-
Changes Over Time -

- - -Here are some charts showing how the LLVM optimizer and code generators are -changing over time. For now we use the Olden benchmark suite to measure this, -but eventually we will switch to using SPEC CPU2000. All programs are run with -"LARGE_PROBLEM_SIZE" enabled. Click on any of the charts to get a larger -version.

- -

Compilation Measurements:

- - - - - -
-
-Size of LLVM bytecode files -
-
-Time to run the LLVM optimizer on each program -
- -

Program Execution Measurements:

- - - - - - - - - -
-
-Execution time for CBE generated executable -
-
-Execution time for the LLC generated executable -
-
-Execution time for program in the JIT -
- - - - -

-
-
Program Tests -

- -This section tests LLVM on a variety of programs in the test suite. This -includes benchmark suites like the Olden, McCat, Ptrdist, and SPEC benchmarks as -well as a few random programs with test inputs. This section is meant to track -how stable LLVM is as a whole. A failure in the execution of any test is marked -with an asterisk: `*'. The columns of the tables are:

- -

    -
  1. Program - The name of the program for that row.
  2. -
  3. GCCAS - Time to run LLVM optimizers on the program.
  4. -
  5. Bytecode - The size of the bytecode for the - program
  6. -
  7. Instrs - The number of LLVM instructions in the - compiled bytecode
  8. -
  9. LLC compile - The time taken compile with - LLC (the static backend)
  10. -
  11. JIT codegen - The amount of time spent in the - JIT itself, instead of executing the program.
  12. -
  13. Machine code - The number of bytes of machine - code generated by the JIT.
  14. -
  15. GCC - The time taken to execute the program when compiled - with GCC -O2.
  16. -
  17. CBE - The time taken to execute the program after - compilation through the C backend, compiled with -O2.
  18. -
  19. LLC - How long does the program generated by the static - backend LLC take to execute
  20. -
  21. JIT - The amount of time spent running the - program with the JIT; this includes the code generation phase (listed above) - and actually running the program.
  22. -
  23. GCC/LLC - The speed-up of the LLC output vs the native - GCC output: greater than 1 is a speedup, less than 1 is a slowdown.
  24. -
  25. GCC/CBE - The speed-up of the CBE output vs the native - GCC output: greater than 1 is a speedup, less than 1 is a slowdown.
  26. -
  27. LLC-BETA - How long does the program generated by the static - backend LLC take to execute the program, when compiled with new experimental - features. This is temporary, for tuning.
  28. -

- -A complete log of testing -SingleSource, -MultiSource, and -External programs are -available for further analysis. - -

Programs/External

- -
-
-$ExternalProgramsTable -
- -

Programs/MultiSource

- -
-
-$MultiSourceProgramsTable -
- -

Programs/SingleSource

- -
-
-$SingleSourceProgramsTable -
- - - diff --git a/contrib/llvm/utils/OldenDataRecover.pl b/contrib/llvm/utils/OldenDataRecover.pl deleted file mode 100644 index 7678394..0000000 --- a/contrib/llvm/utils/OldenDataRecover.pl +++ /dev/null @@ -1,37 +0,0 @@ -#this script is intended to help recover the running graphs when -#the nightly tester decides to eat them. - -#zgrep -E "(=========)|(TEST-RESULT-llc-time)" *-Olden-tests.txt* |perl this > file -#zgrep -E "(=========)|(TEST-RESULT-compile.*bc)" *-Olden-tests.tx* |perl this >file - -while (<>) { - if (/(\d*-\d*-\d*)-.*=========.*\/(.*)\' Program/) { -# print "$1 $2\n"; - $curP = $2; - $curD = $1; - $dates{$1} = 1; - } elsif (/(\d*-\d*-\d*)-.*TEST-RESULT-.*: program (\d*\.\d*)/) { -# print "$1 $2\n"; - if ($curD eq $1) { - $$data{$curD}{$curP} = $2; - } - } elsif (/(\d*-\d*-\d*)-.*TEST-RESULT-.*: (\d*)/) { -# print "$1 $2\n"; - if ($curD eq $1) { - $$data{$curD}{$curP} = $2; - } - } -} -@progs = ("bh", "em3d", "mst", "power", "tsp", "bisort", "health", "perimeter", "treeadd", "voronoi"); - -foreach $date (sort keys %dates) { - print "$date: "; - foreach $prog (@progs) { - if ($$data{$date}{$prog}) { - print " $$data{$date}{$prog}"; - } else { - print " 0"; - } - } - print "\n"; -} diff --git a/contrib/llvm/utils/PerfectShuffle/Makefile b/contrib/llvm/utils/PerfectShuffle/Makefile deleted file mode 100644 index 28709fe..0000000 --- a/contrib/llvm/utils/PerfectShuffle/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -##===- utils/PerfectShuffle/Makefile -----------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -LEVEL = ../.. -TOOLNAME = llvm-PerfectShuffle -NO_INSTALL = 1 - -# This tool has no plugins, optimize startup time. -TOOL_NO_EXPORTS = 1 - -include $(LEVEL)/Makefile.common - diff --git a/contrib/llvm/utils/PerfectShuffle/PerfectShuffle.cpp b/contrib/llvm/utils/PerfectShuffle/PerfectShuffle.cpp deleted file mode 100644 index b94a7d3..0000000 --- a/contrib/llvm/utils/PerfectShuffle/PerfectShuffle.cpp +++ /dev/null @@ -1,571 +0,0 @@ -//===-- PerfectShuffle.cpp - Perfect Shuffle Generator --------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file computes an optimal sequence of instructions for doing all shuffles -// of two 4-element vectors. With a release build and when configured to emit -// an altivec instruction table, this takes about 30s to run on a 2.7Ghz -// PowerPC G5. -// -//===----------------------------------------------------------------------===// - -#include -#include -#include -#include -struct Operator; - -// Masks are 4-nibble hex numbers. Values 0-7 in any nibble means that it takes -// an element from that value of the input vectors. A value of 8 means the -// entry is undefined. - -// Mask manipulation functions. -static inline unsigned short MakeMask(unsigned V0, unsigned V1, - unsigned V2, unsigned V3) { - return (V0 << (3*4)) | (V1 << (2*4)) | (V2 << (1*4)) | (V3 << (0*4)); -} - -/// getMaskElt - Return element N of the specified mask. -static unsigned getMaskElt(unsigned Mask, unsigned Elt) { - return (Mask >> ((3-Elt)*4)) & 0xF; -} - -static unsigned setMaskElt(unsigned Mask, unsigned Elt, unsigned NewVal) { - unsigned FieldShift = ((3-Elt)*4); - return (Mask & ~(0xF << FieldShift)) | (NewVal << FieldShift); -} - -// Reject elements where the values are 9-15. -static bool isValidMask(unsigned short Mask) { - unsigned short UndefBits = Mask & 0x8888; - return (Mask & ((UndefBits >> 1)|(UndefBits>>2)|(UndefBits>>3))) == 0; -} - -/// hasUndefElements - Return true if any of the elements in the mask are undefs -/// -static bool hasUndefElements(unsigned short Mask) { - return (Mask & 0x8888) != 0; -} - -/// isOnlyLHSMask - Return true if this mask only refers to its LHS, not -/// including undef values.. -static bool isOnlyLHSMask(unsigned short Mask) { - return (Mask & 0x4444) == 0; -} - -/// getLHSOnlyMask - Given a mask that refers to its LHS and RHS, modify it to -/// refer to the LHS only (for when one argument value is passed into the same -/// function twice). -#if 0 -static unsigned short getLHSOnlyMask(unsigned short Mask) { - return Mask & 0xBBBB; // Keep only LHS and Undefs. -} -#endif - -/// getCompressedMask - Turn a 16-bit uncompressed mask (where each elt uses 4 -/// bits) into a compressed 13-bit mask, where each elt is multiplied by 9. -static unsigned getCompressedMask(unsigned short Mask) { - return getMaskElt(Mask, 0)*9*9*9 + getMaskElt(Mask, 1)*9*9 + - getMaskElt(Mask, 2)*9 + getMaskElt(Mask, 3); -} - -static void PrintMask(unsigned i, std::ostream &OS) { - OS << "<" << (char)(getMaskElt(i, 0) == 8 ? 'u' : ('0'+getMaskElt(i, 0))) - << "," << (char)(getMaskElt(i, 1) == 8 ? 'u' : ('0'+getMaskElt(i, 1))) - << "," << (char)(getMaskElt(i, 2) == 8 ? 'u' : ('0'+getMaskElt(i, 2))) - << "," << (char)(getMaskElt(i, 3) == 8 ? 'u' : ('0'+getMaskElt(i, 3))) - << ">"; -} - -/// ShuffleVal - This represents a shufflevector operation. -struct ShuffleVal { - unsigned Cost; // Number of instrs used to generate this value. - Operator *Op; // The Operation used to generate this value. - unsigned short Arg0, Arg1; // Input operands for this value. - - ShuffleVal() : Cost(1000000) {} -}; - - -/// ShufTab - This is the actual shuffle table that we are trying to generate. -/// -static ShuffleVal ShufTab[65536]; - -/// TheOperators - All of the operators that this target supports. -static std::vector TheOperators; - -/// Operator - This is a vector operation that is available for use. -struct Operator { - unsigned short ShuffleMask; - unsigned short OpNum; - const char *Name; - unsigned Cost; - - Operator(unsigned short shufflemask, const char *name, unsigned opnum, - unsigned cost = 1) - : ShuffleMask(shufflemask), OpNum(opnum), Name(name), Cost(cost) { - TheOperators.push_back(this); - } - ~Operator() { - assert(TheOperators.back() == this); - TheOperators.pop_back(); - } - - bool isOnlyLHSOperator() const { - return isOnlyLHSMask(ShuffleMask); - } - - const char *getName() const { return Name; } - unsigned getCost() const { return Cost; } - - unsigned short getTransformedMask(unsigned short LHSMask, unsigned RHSMask) { - // Extract the elements from LHSMask and RHSMask, as appropriate. - unsigned Result = 0; - for (unsigned i = 0; i != 4; ++i) { - unsigned SrcElt = (ShuffleMask >> (4*i)) & 0xF; - unsigned ResElt; - if (SrcElt < 4) - ResElt = getMaskElt(LHSMask, SrcElt); - else if (SrcElt < 8) - ResElt = getMaskElt(RHSMask, SrcElt-4); - else { - assert(SrcElt == 8 && "Bad src elt!"); - ResElt = 8; - } - Result |= ResElt << (4*i); - } - return Result; - } -}; - -static const char *getZeroCostOpName(unsigned short Op) { - if (ShufTab[Op].Arg0 == 0x0123) - return "LHS"; - else if (ShufTab[Op].Arg0 == 0x4567) - return "RHS"; - else { - assert(0 && "bad zero cost operation"); - abort(); - } -} - -static void PrintOperation(unsigned ValNo, unsigned short Vals[]) { - unsigned short ThisOp = Vals[ValNo]; - std::cerr << "t" << ValNo; - PrintMask(ThisOp, std::cerr); - std::cerr << " = " << ShufTab[ThisOp].Op->getName() << "("; - - if (ShufTab[ShufTab[ThisOp].Arg0].Cost == 0) { - std::cerr << getZeroCostOpName(ShufTab[ThisOp].Arg0); - PrintMask(ShufTab[ThisOp].Arg0, std::cerr); - } else { - // Figure out what tmp # it is. - for (unsigned i = 0; ; ++i) - if (Vals[i] == ShufTab[ThisOp].Arg0) { - std::cerr << "t" << i; - break; - } - } - - if (!ShufTab[Vals[ValNo]].Op->isOnlyLHSOperator()) { - std::cerr << ", "; - if (ShufTab[ShufTab[ThisOp].Arg1].Cost == 0) { - std::cerr << getZeroCostOpName(ShufTab[ThisOp].Arg1); - PrintMask(ShufTab[ThisOp].Arg1, std::cerr); - } else { - // Figure out what tmp # it is. - for (unsigned i = 0; ; ++i) - if (Vals[i] == ShufTab[ThisOp].Arg1) { - std::cerr << "t" << i; - break; - } - } - } - std::cerr << ") "; -} - -static unsigned getNumEntered() { - unsigned Count = 0; - for (unsigned i = 0; i != 65536; ++i) - Count += ShufTab[i].Cost < 100; - return Count; -} - -static void EvaluateOps(unsigned short Elt, unsigned short Vals[], - unsigned &NumVals) { - if (ShufTab[Elt].Cost == 0) return; - - // If this value has already been evaluated, it is free. FIXME: match undefs. - for (unsigned i = 0, e = NumVals; i != e; ++i) - if (Vals[i] == Elt) return; - - // Otherwise, get the operands of the value, then add it. - unsigned Arg0 = ShufTab[Elt].Arg0, Arg1 = ShufTab[Elt].Arg1; - if (ShufTab[Arg0].Cost) - EvaluateOps(Arg0, Vals, NumVals); - if (Arg0 != Arg1 && ShufTab[Arg1].Cost) - EvaluateOps(Arg1, Vals, NumVals); - - Vals[NumVals++] = Elt; -} - - -int main() { - // Seed the table with accesses to the LHS and RHS. - ShufTab[0x0123].Cost = 0; - ShufTab[0x0123].Op = 0; - ShufTab[0x0123].Arg0 = 0x0123; - ShufTab[0x4567].Cost = 0; - ShufTab[0x4567].Op = 0; - ShufTab[0x4567].Arg0 = 0x4567; - - // Seed the first-level of shuffles, shuffles whose inputs are the input to - // the vectorshuffle operation. - bool MadeChange = true; - unsigned OpCount = 0; - while (MadeChange) { - MadeChange = false; - ++OpCount; - std::cerr << "Starting iteration #" << OpCount << " with " - << getNumEntered() << " entries established.\n"; - - // Scan the table for two reasons: First, compute the maximum cost of any - // operation left in the table. Second, make sure that values with undefs - // have the cheapest alternative that they match. - unsigned MaxCost = ShufTab[0].Cost; - for (unsigned i = 1; i != 0x8889; ++i) { - if (!isValidMask(i)) continue; - if (ShufTab[i].Cost > MaxCost) - MaxCost = ShufTab[i].Cost; - - // If this value has an undef, make it be computed the cheapest possible - // way of any of the things that it matches. - if (hasUndefElements(i)) { - // This code is a little bit tricky, so here's the idea: consider some - // permutation, like 7u4u. To compute the lowest cost for 7u4u, we - // need to take the minimum cost of all of 7[0-8]4[0-8], 81 entries. If - // there are 3 undefs, the number rises to 729 entries we have to scan, - // and for the 4 undef case, we have to scan the whole table. - // - // Instead of doing this huge amount of scanning, we process the table - // entries *in order*, and use the fact that 'u' is 8, larger than any - // valid index. Given an entry like 7u4u then, we only need to scan - // 7[0-7]4u - 8 entries. We can get away with this, because we already - // know that each of 704u, 714u, 724u, etc contain the minimum value of - // all of the 704[0-8], 714[0-8] and 724[0-8] entries respectively. - unsigned UndefIdx; - if (i & 0x8000) - UndefIdx = 0; - else if (i & 0x0800) - UndefIdx = 1; - else if (i & 0x0080) - UndefIdx = 2; - else if (i & 0x0008) - UndefIdx = 3; - else - abort(); - - unsigned MinVal = i; - unsigned MinCost = ShufTab[i].Cost; - - // Scan the 8 entries. - for (unsigned j = 0; j != 8; ++j) { - unsigned NewElt = setMaskElt(i, UndefIdx, j); - if (ShufTab[NewElt].Cost < MinCost) { - MinCost = ShufTab[NewElt].Cost; - MinVal = NewElt; - } - } - - // If we found something cheaper than what was here before, use it. - if (i != MinVal) { - MadeChange = true; - ShufTab[i] = ShufTab[MinVal]; - } - } - } - - for (unsigned LHS = 0; LHS != 0x8889; ++LHS) { - if (!isValidMask(LHS)) continue; - if (ShufTab[LHS].Cost > 1000) continue; - - // If nothing involving this operand could possibly be cheaper than what - // we already have, don't consider it. - if (ShufTab[LHS].Cost + 1 >= MaxCost) - continue; - - for (unsigned opnum = 0, e = TheOperators.size(); opnum != e; ++opnum) { - Operator *Op = TheOperators[opnum]; - - // Evaluate op(LHS,LHS) - unsigned ResultMask = Op->getTransformedMask(LHS, LHS); - - unsigned Cost = ShufTab[LHS].Cost + Op->getCost(); - if (Cost < ShufTab[ResultMask].Cost) { - ShufTab[ResultMask].Cost = Cost; - ShufTab[ResultMask].Op = Op; - ShufTab[ResultMask].Arg0 = LHS; - ShufTab[ResultMask].Arg1 = LHS; - MadeChange = true; - } - - // If this is a two input instruction, include the op(x,y) cases. If - // this is a one input instruction, skip this. - if (Op->isOnlyLHSOperator()) continue; - - for (unsigned RHS = 0; RHS != 0x8889; ++RHS) { - if (!isValidMask(RHS)) continue; - if (ShufTab[RHS].Cost > 1000) continue; - - // If nothing involving this operand could possibly be cheaper than - // what we already have, don't consider it. - if (ShufTab[RHS].Cost + 1 >= MaxCost) - continue; - - - // Evaluate op(LHS,RHS) - unsigned ResultMask = Op->getTransformedMask(LHS, RHS); - - if (ShufTab[ResultMask].Cost <= OpCount || - ShufTab[ResultMask].Cost <= ShufTab[LHS].Cost || - ShufTab[ResultMask].Cost <= ShufTab[RHS].Cost) - continue; - - // Figure out the cost to evaluate this, knowing that CSE's only need - // to be evaluated once. - unsigned short Vals[30]; - unsigned NumVals = 0; - EvaluateOps(LHS, Vals, NumVals); - EvaluateOps(RHS, Vals, NumVals); - - unsigned Cost = NumVals + Op->getCost(); - if (Cost < ShufTab[ResultMask].Cost) { - ShufTab[ResultMask].Cost = Cost; - ShufTab[ResultMask].Op = Op; - ShufTab[ResultMask].Arg0 = LHS; - ShufTab[ResultMask].Arg1 = RHS; - MadeChange = true; - } - } - } - } - } - - std::cerr << "Finished Table has " << getNumEntered() - << " entries established.\n"; - - unsigned CostArray[10] = { 0 }; - - // Compute a cost histogram. - for (unsigned i = 0; i != 65536; ++i) { - if (!isValidMask(i)) continue; - if (ShufTab[i].Cost > 9) - ++CostArray[9]; - else - ++CostArray[ShufTab[i].Cost]; - } - - for (unsigned i = 0; i != 9; ++i) - if (CostArray[i]) - std::cout << "// " << CostArray[i] << " entries have cost " << i << "\n"; - if (CostArray[9]) - std::cout << "// " << CostArray[9] << " entries have higher cost!\n"; - - - // Build up the table to emit. - std::cout << "\n// This table is 6561*4 = 26244 bytes in size.\n"; - std::cout << "static const unsigned PerfectShuffleTable[6561+1] = {\n"; - - for (unsigned i = 0; i != 0x8889; ++i) { - if (!isValidMask(i)) continue; - - // CostSat - The cost of this operation saturated to two bits. - unsigned CostSat = ShufTab[i].Cost; - if (CostSat > 4) CostSat = 4; - if (CostSat == 0) CostSat = 1; - --CostSat; // Cost is now between 0-3. - - unsigned OpNum = ShufTab[i].Op ? ShufTab[i].Op->OpNum : 0; - assert(OpNum < 16 && "Too few bits to encode operation!"); - - unsigned LHS = getCompressedMask(ShufTab[i].Arg0); - unsigned RHS = getCompressedMask(ShufTab[i].Arg1); - - // Encode this as 2 bits of saturated cost, 4 bits of opcodes, 13 bits of - // LHS, and 13 bits of RHS = 32 bits. - unsigned Val = (CostSat << 30) | (OpNum << 26) | (LHS << 13) | RHS; - - std::cout << " " << Val << "U,\t// "; - PrintMask(i, std::cout); - std::cout << ": Cost " << ShufTab[i].Cost; - std::cout << " " << (ShufTab[i].Op ? ShufTab[i].Op->getName() : "copy"); - std::cout << " "; - if (ShufTab[ShufTab[i].Arg0].Cost == 0) { - std::cout << getZeroCostOpName(ShufTab[i].Arg0); - } else { - PrintMask(ShufTab[i].Arg0, std::cout); - } - - if (ShufTab[i].Op && !ShufTab[i].Op->isOnlyLHSOperator()) { - std::cout << ", "; - if (ShufTab[ShufTab[i].Arg1].Cost == 0) { - std::cout << getZeroCostOpName(ShufTab[i].Arg1); - } else { - PrintMask(ShufTab[i].Arg1, std::cout); - } - } - std::cout << "\n"; - } - std::cout << " 0\n};\n"; - - if (0) { - // Print out the table. - for (unsigned i = 0; i != 0x8889; ++i) { - if (!isValidMask(i)) continue; - if (ShufTab[i].Cost < 1000) { - PrintMask(i, std::cerr); - std::cerr << " - Cost " << ShufTab[i].Cost << " - "; - - unsigned short Vals[30]; - unsigned NumVals = 0; - EvaluateOps(i, Vals, NumVals); - - for (unsigned j = 0, e = NumVals; j != e; ++j) - PrintOperation(j, Vals); - std::cerr << "\n"; - } - } - } -} - - -#ifdef GENERATE_ALTIVEC - -///===---------------------------------------------------------------------===// -/// The altivec instruction definitions. This is the altivec-specific part of -/// this file. -///===---------------------------------------------------------------------===// - -// Note that the opcode numbers here must match those in the PPC backend. -enum { - OP_COPY = 0, // Copy, used for things like to say it is <0,1,2,3> - OP_VMRGHW, - OP_VMRGLW, - OP_VSPLTISW0, - OP_VSPLTISW1, - OP_VSPLTISW2, - OP_VSPLTISW3, - OP_VSLDOI4, - OP_VSLDOI8, - OP_VSLDOI12 -}; - -struct vmrghw : public Operator { - vmrghw() : Operator(0x0415, "vmrghw", OP_VMRGHW) {} -} the_vmrghw; - -struct vmrglw : public Operator { - vmrglw() : Operator(0x2637, "vmrglw", OP_VMRGLW) {} -} the_vmrglw; - -template -struct vspltisw : public Operator { - vspltisw(const char *N, unsigned Opc) - : Operator(MakeMask(Elt, Elt, Elt, Elt), N, Opc) {} -}; - -vspltisw<0> the_vspltisw0("vspltisw0", OP_VSPLTISW0); -vspltisw<1> the_vspltisw1("vspltisw1", OP_VSPLTISW1); -vspltisw<2> the_vspltisw2("vspltisw2", OP_VSPLTISW2); -vspltisw<3> the_vspltisw3("vspltisw3", OP_VSPLTISW3); - -template -struct vsldoi : public Operator { - vsldoi(const char *Name, unsigned Opc) - : Operator(MakeMask(N&7, (N+1)&7, (N+2)&7, (N+3)&7), Name, Opc) { - } -}; - -vsldoi<1> the_vsldoi1("vsldoi4" , OP_VSLDOI4); -vsldoi<2> the_vsldoi2("vsldoi8" , OP_VSLDOI8); -vsldoi<3> the_vsldoi3("vsldoi12", OP_VSLDOI12); - -#endif - -#define GENERATE_NEON - -#ifdef GENERATE_NEON -enum { - OP_COPY = 0, // Copy, used for things like to say it is <0,1,2,3> - OP_VREV, - OP_VDUP0, - OP_VDUP1, - OP_VDUP2, - OP_VDUP3, - OP_VEXT1, - OP_VEXT2, - OP_VEXT3, - OP_VUZPL, // VUZP, left result - OP_VUZPR, // VUZP, right result - OP_VZIPL, // VZIP, left result - OP_VZIPR, // VZIP, right result - OP_VTRNL, // VTRN, left result - OP_VTRNR // VTRN, right result -}; - -struct vrev : public Operator { - vrev() : Operator(0x1032, "vrev", OP_VREV) {} -} the_vrev; - -template -struct vdup : public Operator { - vdup(const char *N, unsigned Opc) - : Operator(MakeMask(Elt, Elt, Elt, Elt), N, Opc) {} -}; - -vdup<0> the_vdup0("vdup0", OP_VDUP0); -vdup<1> the_vdup1("vdup1", OP_VDUP1); -vdup<2> the_vdup2("vdup2", OP_VDUP2); -vdup<3> the_vdup3("vdup3", OP_VDUP3); - -template -struct vext : public Operator { - vext(const char *Name, unsigned Opc) - : Operator(MakeMask(N&7, (N+1)&7, (N+2)&7, (N+3)&7), Name, Opc) { - } -}; - -vext<1> the_vext1("vext1", OP_VEXT1); -vext<2> the_vext2("vext2", OP_VEXT2); -vext<3> the_vext3("vext3", OP_VEXT3); - -struct vuzpl : public Operator { - vuzpl() : Operator(0x0246, "vuzpl", OP_VUZPL, 2) {} -} the_vuzpl; - -struct vuzpr : public Operator { - vuzpr() : Operator(0x1357, "vuzpr", OP_VUZPR, 2) {} -} the_vuzpr; - -struct vzipl : public Operator { - vzipl() : Operator(0x0415, "vzipl", OP_VZIPL, 2) {} -} the_vzipl; - -struct vzipr : public Operator { - vzipr() : Operator(0x2637, "vzipr", OP_VZIPR, 2) {} -} the_vzipr; - -struct vtrnl : public Operator { - vtrnl() : Operator(0x0426, "vtrnl", OP_VTRNL, 2) {} -} the_vtrnl; - -struct vtrnr : public Operator { - vtrnr() : Operator(0x1537, "vtrnr", OP_VTRNR, 2) {} -} the_vtrnr; - -#endif diff --git a/contrib/llvm/utils/TableGen/CMakeLists.txt b/contrib/llvm/utils/TableGen/CMakeLists.txt deleted file mode 100644 index 972989b..0000000 --- a/contrib/llvm/utils/TableGen/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -add_executable(tblgen - ARMDecoderEmitter.cpp - AsmMatcherEmitter.cpp - AsmWriterEmitter.cpp - AsmWriterInst.cpp - CallingConvEmitter.cpp - ClangASTNodesEmitter.cpp - ClangAttrEmitter.cpp - ClangDiagnosticsEmitter.cpp - CodeEmitterGen.cpp - CodeGenDAGPatterns.cpp - CodeGenInstruction.cpp - CodeGenTarget.cpp - DAGISelEmitter.cpp - DAGISelMatcherEmitter.cpp - DAGISelMatcherGen.cpp - DAGISelMatcherOpt.cpp - DAGISelMatcher.cpp - DisassemblerEmitter.cpp - EDEmitter.cpp - FastISelEmitter.cpp - InstrEnumEmitter.cpp - InstrInfoEmitter.cpp - IntrinsicEmitter.cpp - LLVMCConfigurationEmitter.cpp - NeonEmitter.cpp - OptParserEmitter.cpp - Record.cpp - RegisterInfoEmitter.cpp - SubtargetEmitter.cpp - TGLexer.cpp - TGParser.cpp - TGValueTypes.cpp - TableGen.cpp - TableGenBackend.cpp - X86DisassemblerTables.cpp - X86RecognizableInstr.cpp - ) - -target_link_libraries(tblgen LLVMSupport LLVMSystem) -if( MINGW ) - target_link_libraries(tblgen imagehlp psapi) -endif( MINGW ) -if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD AND NOT BEOS ) - target_link_libraries(tblgen pthread) -endif() diff --git a/contrib/llvm/utils/TableGen/Makefile b/contrib/llvm/utils/TableGen/Makefile deleted file mode 100644 index f27cd99..0000000 --- a/contrib/llvm/utils/TableGen/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -##===- utils/TableGen/Makefile -----------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -LEVEL = ../.. -TOOLNAME = tblgen -USEDLIBS = LLVMSupport.a LLVMSystem.a -REQUIRES_EH := 1 -REQUIRES_RTTI := 1 - -# This tool has no plugins, optimize startup time. -TOOL_NO_EXPORTS = 1 - -include $(LEVEL)/Makefile.common - diff --git a/contrib/llvm/utils/UpdateCMakeLists.pl b/contrib/llvm/utils/UpdateCMakeLists.pl deleted file mode 100755 index 8f535145..0000000 --- a/contrib/llvm/utils/UpdateCMakeLists.pl +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env perl -use strict; -use File::Find; -use File::Copy; -use Digest::MD5; - -my @fileTypes = ("cpp", "c"); -my %dirFiles; -my %dirCMake; - -sub GetFiles { - my $dir = shift; - my $x = $dirFiles{$dir}; - if (!defined $x) { - $x = []; - $dirFiles{$dir} = $x; - } - return $x; -} - -sub ProcessFile { - my $file = $_; - my $dir = $File::Find::dir; - # Record if a CMake file was found. - if ($file eq "CMakeLists.txt") { - $dirCMake{$dir} = $File::Find::name; - return 0; - } - # Grab the extension of the file. - $file =~ /\.([^.]+)$/; - my $ext = $1; - my $files; - foreach my $x (@fileTypes) { - if ($ext eq $x) { - if (!defined $files) { - $files = GetFiles($dir); - } - push @$files, $file; - return 0; - } - } - return 0; -} - -sub EmitCMakeList { - my $dir = shift; - my $files = $dirFiles{$dir}; - - if (!defined $files) { - return; - } - - foreach my $file (sort @$files) { - print OUT " "; - print OUT $file; - print OUT "\n"; - } -} - -sub UpdateCMake { - my $cmakeList = shift; - my $dir = shift; - my $cmakeListNew = $cmakeList . ".new"; - open(IN, $cmakeList); - open(OUT, ">", $cmakeListNew); - my $foundLibrary = 0; - - while() { - if (!$foundLibrary) { - print OUT $_; - if (/^add_clang_library\(/ || /^add_llvm_library\(/ || /^add_llvm_target\(/ - || /^add_executable\(/) { - $foundLibrary = 1; - EmitCMakeList($dir); - } - } - else { - if (/\)/) { - print OUT $_; - $foundLibrary = 0; - } - } - } - - close(IN); - close(OUT); - - open(FILE, $cmakeList) or - die("Cannot open $cmakeList when computing digest\n"); - binmode FILE; - my $digestA = Digest::MD5->new->addfile(*FILE)->hexdigest; - close(FILE); - - open(FILE, $cmakeListNew) or - die("Cannot open $cmakeListNew when computing digest\n"); - binmode FILE; - my $digestB = Digest::MD5->new->addfile(*FILE)->hexdigest; - close(FILE); - - if ($digestA ne $digestB) { - move($cmakeListNew, $cmakeList); - return 1; - } - - unlink($cmakeListNew); - return 0; -} - -sub UpdateCMakeFiles { - foreach my $dir (sort keys %dirCMake) { - if (UpdateCMake($dirCMake{$dir}, $dir)) { - print "Updated: $dir\n"; - } - } -} - -find({ wanted => \&ProcessFile, follow => 1 }, '.'); -UpdateCMakeFiles(); - diff --git a/contrib/llvm/utils/bugpoint/RemoteRunSafely.sh b/contrib/llvm/utils/bugpoint/RemoteRunSafely.sh deleted file mode 100644 index f390e33..0000000 --- a/contrib/llvm/utils/bugpoint/RemoteRunSafely.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/sh -# -# Program: RemoteRunSafely.sh -# -# Synopsis: This script simply runs another program remotely using ssh. -# It always returns the another program exit code or exit with -# code 255 which indicates that the program could not be executed. -# -# Syntax: -# -# RemoteRunSafely.sh [-l ] [-p ] -# -# -# where: -# is the remote host to execute the program, -# is the username on the remote host, -# is the port used by the remote client, -# is the path to the program to run, -# are the arguments to pass to the program. -# - -printUsageAndExit() -{ - echo "Usage:" - echo "./RemoteRunSafely.sh [-l ] [-p ] " \ - " " - exit 255 -} - -moreArgsExpected() -{ - # $1 - remaining number of arguments - # $2 - number of arguments to shift - if [ $1 -lt $2 ] - then - echo "Error: Wrong number of argumants." - printUsageAndExit - fi -} - -# Save a copy of the original arguments in a string before we -# clobber them with the shift command. -ORIG_ARGS="$*" -#DEBUG: echo 'GOT: '$ORIG_ARGS - -moreArgsExpected $# 1 -RHOST=$1 -shift 1 - -RUSER=`id -un` -RCLIENT=ssh -RPORT= -WORKING_DIR= - -moreArgsExpected $# 1 -if [ $1 = "-l" ]; then - moreArgsExpected $# 2 - RUSER=$2 - shift 2 -fi -moreArgsExpected $# 1 -if [ $1 = "-p" ]; then - moreArgsExpected $# 2 - RPORT="-p $2" - shift 2 -fi - -moreArgsExpected $# 1 -PROGRAM=$(basename $1) -WORKING_DIR=$(dirname $1) -shift 1 - -#DEBUG: echo 'DIR='${0%%`basename $0`} -#DEBUG: echo 'RHOST='$RHOST -#DEBUG: echo 'RUSER='$RUSER -#DEBUG: echo 'PROGRAM='$PROGRAM -#DEBUG: echo 'WORKING_DIR='$WORKING_DIR -#DEBUG: echo 'ARGS='$* - -# Sanity check -if [ "$RHOST" = "" -o "$PROGRAM" = "" ]; then - printUsageAndExit -fi - -# Local program file must exist and be execuatble -local_program=$WORKING_DIR"/"$PROGRAM -if [ ! -x "$local_program" ]; then - echo "File "$local_program" does not exist or is not an executable.." - exit 255 -fi - -connection=$RUSER'@'$RHOST -remote="./"$PROGRAM -( - cat $local_program | \ - $RCLIENT $connection $RPORT \ - 'rm -f '$remote' ; ' \ - 'cat > '$remote' ; chmod +x '$remote' ; '$remote' '$*' ; ' \ - 'err=$? ; rm -f '$remote' ; exit $err' -) -err=$? - -#DEBUG: echo script exit $err -exit $err - diff --git a/contrib/llvm/utils/buildit/GNUmakefile b/contrib/llvm/utils/buildit/GNUmakefile deleted file mode 100644 index 54577e2..0000000 --- a/contrib/llvm/utils/buildit/GNUmakefile +++ /dev/null @@ -1,131 +0,0 @@ -# LLVM LOCAL file build machinery -# LLVM Compiler Makefile for use by buildit. -# -# This makefile is intended only for use with B&I buildit. For "normal" builds -# use the conventional top-level makefile. -# -# You can specify TARGETS=ppc (or i386) on the buildit command line to limit the -# build to just one target. The default is for ppc and i386. The compiler -# targetted at this host gets built anyway, but not installed unless it's listed -# in TARGETS. - -# Include the set of standard Apple makefile definitions. -ifndef CoreOSMakefiles -CoreOSMakefiles = $(MAKEFILEPATH)/CoreOS -endif -include $(CoreOSMakefiles)/Standard/Standard.make - -# Enable Apple extensions to (gnu)make. -USE_APPLE_PB_SUPPORT = all - -RC_ARCHS := ppc i386 -HOSTS = $(RC_ARCHS) -targets = echo $(RC_ARCHS) -TARGETS := $(shell $(targets)) - -SRCROOT = . - -SRC = $(shell cd $(SRCROOT) && pwd | sed s,/private,,) -OBJROOT = $(SRC)/obj -SYMROOT = $(OBJROOT)/../sym -DSTROOT = $(OBJROOT)/../dst - -####################################################################### - -PREFIX = /Developer/usr/local - -# Unless assertions are forced on in the GMAKE command line, disable them. -ifndef ENABLE_ASSERTIONS -ENABLE_ASSERTIONS := no -endif - -# Default is optimized build. -ifeq ($(LLVM_DEBUG),1) -LLVM_OPTIMIZED := no -else -LLVM_OPTIMIZED := yes -endif - -# Default to not install libLTO.dylib. -INSTALL_LIBLTO := no - -# Default to do a native build, not a cross-build for an ARM host or simulator. -ARM_HOSTED_BUILD := no -IOS_SIM_BUILD := no - -ifndef RC_ProjectSourceVersion -RC_ProjectSourceVersion = 9999 -endif - -ifndef RC_ProjectSourceSubversion -RC_ProjectSourceSubversion = 0 -endif - -# NOTE : Always put version numbers at the end because they are optional. -install: $(OBJROOT) $(SYMROOT) $(DSTROOT) - cd $(OBJROOT) && \ - $(SRC)/utils/buildit/build_llvm "$(RC_ARCHS)" "$(TARGETS)" \ - $(SRC) $(PREFIX) $(DSTROOT) $(SYMROOT) \ - $(ENABLE_ASSERTIONS) $(LLVM_OPTIMIZED) $(INSTALL_LIBLTO) \ - $(ARM_HOSTED_BUILD) $(IOS_SIM_BUILD) \ - $(RC_ProjectSourceVersion) $(RC_ProjectSourceSubversion) - -EmbeddedHosted: - $(MAKE) ARM_HOSTED_BUILD=yes PREFIX=/usr/local install - -# When building for the iOS simulator, MACOSX_DEPLOYMENT_TARGET is not set -# by default, but it needs to be set when building tools that run on the host -# (e.g., tblgen), so set it here. -EmbeddedSim: - export MACOSX_DEPLOYMENT_TARGET=`sw_vers -productVersion`; \ - $(MAKE) IOS_SIM_BUILD=yes PREFIX=$(SDKROOT)/usr/local install - -# installhdrs does nothing, because the headers aren't useful until -# the compiler is installed. -installhdrs: - -# We build and install in one shell script. -build: - -installsrc: - @echo - @echo ++++++++++++++++++++++ - @echo + Installing sources + - @echo ++++++++++++++++++++++ - @echo - if [ $(SRCROOT) != . ]; then \ - $(PAX) -rw . $(SRCROOT); \ - fi - find -d "$(SRCROOT)" \( -type d -a -name .svn -o \ - -type f -a -name .DS_Store -o \ - -name \*~ -o -name .\#\* \) \ - -exec rm -rf {} \; - rm -rf "$(SRCROOT)/test" - -####################################################################### - -clean: - @echo - @echo ++++++++++++ - @echo + Cleaning + - @echo ++++++++++++ - @echo - @if [ -d $(OBJROOT) -a "$(OBJROOT)" != / ]; then \ - echo '*** DELETING ' $(OBJROOT); \ - rm -rf $(OBJROOT); \ - fi - @if [ -d $(SYMROOT) -a "$(SYMROOT)" != / ]; then \ - echo '*** DELETING ' $(SYMROOT); \ - rm -rf $(SYMROOT); \ - fi - @if [ -d $(DSTROOT) -a "$(DSTROOT)" != / ]; then \ - echo '*** DELETING ' $(DSTROOT); \ - rm -rf $(DSTROOT); \ - fi - -####################################################################### - -$(OBJROOT) $(SYMROOT) $(DSTROOT): - mkdir -p $@ - -.PHONY: install installsrc clean EmbeddedHosted EmbeddedSim diff --git a/contrib/llvm/utils/buildit/build_llvm b/contrib/llvm/utils/buildit/build_llvm deleted file mode 100755 index 39ec1cc..0000000 --- a/contrib/llvm/utils/buildit/build_llvm +++ /dev/null @@ -1,373 +0,0 @@ -#!/bin/sh -# LLVM LOCAL file B&I - -set -x - -# Build LLVM the "Apple way". -# Parameters: - -# The first parameter is a space-separated list of the architectures the -# compilers will run on. For instance, "ppc i386". If the current machine -# isn't in the list, it will (effectively) be added. -HOSTS="$1" - -# The second parameter is a space-separated list of the architectures the -# compilers will generate code for. If the current machine isn't in the list, a -# compiler for it will get built anyway, but won't be installed. -# FIXME: The list of targets is currently hard-coded and TARGETS is not used. -TARGETS="$2" - -# The third parameter is the path to the compiler sources. There should be a -# shell script named 'configure' in this directory. This script makes a copy... -ORIG_SRC_DIR="$3" - -# The fourth parameter is the location where the LLVM will be installed. You can -# move it once it's built, so this mostly controls the layout of $DEST_DIR. -DEST_ROOT="$4" - -# The fifth parameter is the place where the compiler will be copied once it's -# built. -DEST_DIR="$5" - -# The sixth parameter is a directory in which to place information (like -# unstripped executables and generated source files) helpful in debugging the -# resulting compiler. -SYM_DIR="$6" - -# The seventh parameter is a yes/no that indicates whether assertions should be -# enabled in the LLVM libs/tools. -LLVM_ASSERTIONS="$7" - -# The eighth parameter is a yes/no that indicates whether this is an optimized -# build. -LLVM_OPTIMIZED="$8" - -# The ninth parameter is a yes/no that indicates whether libLTO.dylib -# should be installed. -INSTALL_LIBLTO="$9" - -# A yes/no parameter that controls whether to cross-build for an ARM host. -ARM_HOSTED_BUILD="${10}" - -# A yes/no parameter that controls whether to cross-build for the iOS simulator -IOS_SIM_BUILD="${11}" - -# The version number of the submission, e.g. 1007. -LLVM_SUBMIT_VERSION="${12}" - -# The subversion number of the submission, e.g. 03. -LLVM_SUBMIT_SUBVERSION="${13}" - -# The current working directory is where the build will happen. It may already -# contain a partial result of an interrupted build, in which case this script -# will continue where it left off. -DIR=`pwd` - -DARWIN_VERS=`uname -r | sed 's/\..*//'` -echo DARWIN_VERS = $DARWIN_VERS - -################################################################################ -# Run the build. - -# Create the source tree we'll actually use to build, deleting -# tcl since it doesn't actually build properly in a cross environment -# and we don't really need it. -SRC_DIR=$DIR/src -rm -rf $SRC_DIR || exit 1 -mkdir $SRC_DIR || exit 1 -ln -s $ORIG_SRC_DIR/* $SRC_DIR/ || exit 1 -# We can't use the top-level Makefile as-is. Remove the soft link: -rm $SRC_DIR/Makefile || exit 1 -# Now create our own by editing the top-level Makefile, deleting every line marked "Apple-style": -sed -e '/[Aa]pple-style/d' -e '/include.*GNUmakefile/d' $ORIG_SRC_DIR/Makefile > $SRC_DIR/Makefile || exit 1 - -# Build the LLVM tree universal. -mkdir -p $DIR/obj-llvm || exit 1 -cd $DIR/obj-llvm || exit 1 - -if [ "$ARM_HOSTED_BUILD" = yes ]; then - # The cross-tools' build process expects to find an existing cross toolchain - # under names like 'arm-apple-darwin$DARWIN_VERS-as'; so make them. - rm -rf $DIR/bin || exit 1 - mkdir $DIR/bin || exit 1 - for prog in ar nm ranlib strip lipo ld as ; do - P=$DIR/bin/arm-apple-darwin$DARWIN_VERS-${prog} - T=`xcrun -sdk $SDKROOT -find ${prog}` - echo '#!/bin/sh' > $P || exit 1 - echo 'exec '$T' "$@"' >> $P || exit 1 - chmod a+x $P || exit 1 - done - # Try to use the platform llvm-gcc. Fall back to gcc if it's not available. - for prog in gcc g++ ; do - P=$DIR/bin/arm-apple-darwin$DARWIN_VERS-${prog} - T=`xcrun -sdk $SDKROOT -find llvm-${prog}` - if [ "x$T" = "x" ] ; then - T=`xcrun -sdk $SDKROOT -find ${prog}` - fi - echo '#!/bin/sh' > $P || exit 1 - echo 'exec '$T' -arch armv6 -isysroot '${SDKROOT}' "$@"' >> $P || exit 1 - chmod a+x $P || exit 1 - done - - PATH=$DIR/bin:$PATH -# otherwise, try to use llvm-gcc if it's available -elif [ $DARWIN_VERS -gt 9 ]; then - # If the user has set CC or CXX, respect their wishes. If not, - # compile with LLVM-GCC/LLVM-G++ if available; if LLVM is not - # available, fall back to usual GCC/G++ default. - savedPATH=$PATH ; PATH="/Developer/usr/bin:$PATH" - XTMPCC=$(which llvm-gcc) - if [ x$CC = x -a x$XTMPCC != x ] ; then export CC=$XTMPCC ; fi - XTMPCC=$(which llvm-g++) - if [ x$CXX = x -a x$XTMPCC != x ] ; then export CXX=$XTMPCC ; fi - PATH=$savedPATH - unset XTMPCC savedPATH -fi - -if [ "$ARM_HOSTED_BUILD" = yes ]; then - configure_opts="--enable-targets=arm --host=arm-apple-darwin10 \ - --target=arm-apple-darwin10 --build=i686-apple-darwin10" -elif [ "$IOS_SIM_BUILD" = yes ]; then - # Use a non-standard "darwin_sim" host triple to trigger a cross-build. - configure_opts="--enable-targets=x86 --host=i686-apple-darwin_sim \ - --build=i686-apple-darwin10" -else - configure_opts="--enable-targets=arm,x86,powerpc,cbe" -fi - -if [ \! -f Makefile.config ]; then - $SRC_DIR/configure --prefix=$DEST_DIR$DEST_ROOT $configure_opts \ - --enable-assertions=$LLVM_ASSERTIONS \ - --enable-optimized=$LLVM_OPTIMIZED \ - --disable-bindings \ - || exit 1 -fi - -SUBVERSION=`echo $RC_ProjectSourceVersion | sed -e 's/[^.]*\.\([0-9]*\).*/\1/'` - -if [ "x$SUBVERSION" != "x$RC_ProjectSourceVersion" ]; then - LLVM_SUBMIT_SUBVERSION=`printf "%02d" $SUBVERSION` - RC_ProjectSourceVersion=`echo $RC_ProjectSourceVersion | sed -e 's/\..*//'` - LLVM_SUBMIT_VERSION=$RC_ProjectSourceVersion -fi - -if [ "x$LLVM_SUBMIT_SUBVERSION" = "x00" -o "x$LLVM_SUBMIT_SUBVERSION" = "x0" ]; then - LLVM_VERSION="$LLVM_SUBMIT_VERSION" -else - LLVM_VERSION="$LLVM_SUBMIT_VERSION-$LLVM_SUBMIT_SUBVERSION" -fi - -GCC_VER=`cc --version 2>/dev/null | sed 1q` - -if echo "$GCC_VER" | grep GCC > /dev/null; then - GCC_VER=`echo $GCC_VER | sed -e 's/.*(GCC) \([0-9.][0-9.]*\).*/\1/'` - MAJ_VER=`echo $GCC_VER | sed 's/\..*//'` - MIN_VER=`echo $GCC_VER | sed 's/[^.]*\.\([0-9]*\).*/\1/'` -fi - -JOBS_FLAG="" - -# Note: If compiling with GCC 4.0, don't pass the -jN flag. Building universal -# already has parallelism and we don't want to make the builders hit swap by -# firing off too many gccs at the same time. -if [ "x$MAJ_VER" != "x4" -o "x$MIN_VER" != "x0" ]; then - # Figure out how many make processes to run. - SYSCTL=`sysctl -n hw.activecpu` - - # hw.activecpu only available in 10.2.6 and later - if [ -z "$SYSCTL" ]; then - SYSCTL=`sysctl -n hw.ncpu` - fi - - # sysctl -n hw.* does not work when invoked via B&I chroot /BuildRoot. - # Builders can default to 2, since even if they are single processor, - # nothing else is running on the machine. - if [ -z "$SYSCTL" ]; then - SYSCTL=2 - fi - - JOBS_FLAG="-j $SYSCTL" -fi - -make $JOBS_FLAG $OPTIMIZE_OPTS UNIVERSAL=1 UNIVERSAL_ARCH="$HOSTS" \ - UNIVERSAL_SDK_PATH=$SDKROOT \ - NO_RUNTIME_LIBS=1 \ - DISABLE_EDIS=1 \ - DEBUG_SYMBOLS=1 \ - LLVM_SUBMIT_VERSION=$LLVM_SUBMIT_VERSION \ - LLVM_SUBMIT_SUBVERSION=$LLVM_SUBMIT_SUBVERSION \ - CXXFLAGS="-DLLVM_VERSION_INFO='\" Apple Build #$LLVM_VERSION\"'" \ - VERBOSE=1 - -if [ $? != 0 ] ; then - echo "error: LLVM 'make' failed!" - exit 1 -fi - -################################################################################ -# Construct the actual destination root, by copying stuff from $DIR/dst-* to -# $DEST_DIR, with occasional 'lipo' commands. - -cd $DEST_DIR || exit 1 - -# Clean out DEST_DIR in case -noclean was passed to buildit. -rm -rf * || exit 1 - -cd $DIR/obj-llvm || exit 1 - -# Install the tree into the destination directory. -make $LOCAL_MAKEFLAGS $OPTIMIZE_OPTS UNIVERSAL=1 UNIVERSAL_ARCH="$HOSTS" \ - NO_RUNTIME_LIBS=1 \ - DISABLE_EDIS=1 \ - DEBUG_SYMBOLS=1 \ - LLVM_SUBMIT_VERSION=$LLVM_SUBMIT_VERSION \ - LLVM_SUBMIT_SUBVERSION=$LLVM_SUBMIT_SUBVERSION \ - OPTIMIZE_OPTION='-O3' VERBOSE=1 install - -if ! test $? == 0 ; then - echo "error: LLVM 'make install' failed!" - exit 1 -fi - -# Install Version.h -LLVM_MINOR_VERSION=`echo $LLVM_SUBMIT_SUBVERSION | sed -e 's,0*\([1-9][0-9]*\),\1,'` -if [ "x$LLVM_MINOR_VERSION" = "x" ]; then - LLVM_MINOR_VERSION=0 -fi -RC_ProjectSourceSubversion=`printf "%d" $LLVM_MINOR_VERSION` -echo "#define LLVM_VERSION ${RC_ProjectSourceVersion}" > $DEST_DIR$DEST_ROOT/include/llvm/Version.h -echo "#define LLVM_MINOR_VERSION ${RC_ProjectSourceSubversion}" >> $DEST_DIR$DEST_ROOT/include/llvm/Version.h - -if [ "x$LLVM_DEBUG" != "x1" ]; then - # Strip local symbols from llvm libraries. - # - # Use '-l' to strip i386 modules. N.B. that flag doesn't work with kext or - # PPC objects! - strip -Sl $DEST_DIR$DEST_ROOT/lib/*.[oa] - for f in `ls $DEST_DIR$DEST_ROOT/lib/*.so`; do - strip -Sxl $f - done -fi - -# Copy over the tblgen utility. -cp `find $DIR -name tblgen` $DEST_DIR$DEST_ROOT/bin - -# Remove .dir files -cd $DEST_DIR$DEST_ROOT -rm -f bin/.dir etc/llvm/.dir lib/.dir - -# Remove PPC64 fat slices. -cd $DEST_DIR$DEST_ROOT/bin -if [ $MACOSX_DEPLOYMENT_TARGET = "10.4" ]; then - find . -perm 755 -type f \! \( -name '*gccas' -o -name '*gccld' -o -name llvm-config \) \ - -exec lipo -extract ppc -extract i386 {} -output {} \; -elif [ $MACOSX_DEPLOYMENT_TARGET = "10.5" ]; then - find . -perm 755 -type f \! \( -name '*gccas' -o -name '*gccld' -o -name llvm-config \) \ - -exec lipo -extract ppc7400 -extract i386 {} -output {} \; -else - find . -perm 755 -type f \! \( -name '*gccas' -o -name '*gccld' -o -name llvm-config \) \ - -exec lipo -extract ppc7400 -extract i386 -extract x86_64 {} -output {} \; -fi - -# The Hello dylib is an example of how to build a pass. No need to install it. -rm $DEST_DIR$DEST_ROOT/lib/LLVMHello.dylib - -# Compress manpages -MDIR=$DEST_DIR$DEST_ROOT/share/man/man1 -gzip -f $MDIR/* - -################################################################################ -# Create SYM_DIR with information required for debugging. - -# Figure out how many make processes to run. -SYSCTL=`sysctl -n hw.activecpu` - -# hw.activecpu only available in 10.2.6 and later -if [ -z "$SYSCTL" ]; then - SYSCTL=`sysctl -n hw.ncpu` -fi - -# sysctl -n hw.* does not work when invoked via B&I chroot /BuildRoot. Builders -# can default to 2, since even if they are single processor, nothing else is -# running on the machine. -if [ -z "$SYSCTL" ]; then - SYSCTL=2 -fi - -cd $SYM_DIR || exit 1 - -# Clean out SYM_DIR in case -noclean was passed to buildit. -rm -rf * || exit 1 - -# Generate .dSYM files -find $DEST_DIR -perm -0111 -type f \ - ! \( -name '*.la' -o -name gccas -o -name gccld -o -name llvm-config -o -name '*.a' \) \ - -print | xargs -n 1 -P ${SYSCTL} dsymutil - -# Save .dSYM files and .a archives -cd $DEST_DIR || exit 1 -find . \( -path \*.dSYM/\* -or -name \*.a \) -print \ - | cpio -pdml $SYM_DIR || exit 1 - -# Save source files. -mkdir $SYM_DIR/src || exit 1 -cd $DIR || exit 1 -find obj-* -name \*.\[chy\] -o -name \*.cpp -print \ - | cpio -pdml $SYM_DIR/src || exit 1 - -################################################################################ -# Install and strip libLTO.dylib - -cd $DEST_DIR$DEST_ROOT -if [ "$INSTALL_LIBLTO" = "yes" ]; then - DT_HOME="$DEST_DIR/Developer/usr" - mkdir -p $DT_HOME/lib - mv lib/libLTO.dylib $DT_HOME/lib/libLTO.dylib - - # Save a copy of the unstripped dylib - mkdir -p $SYM_DIR/Developer/usr/lib - cp $DT_HOME/lib/libLTO.dylib $SYM_DIR/Developer/usr/lib/libLTO.dylib - - # Use '-l' to strip i386 modules. N.B. that flag doesn't work with kext or - # PPC objects! - strip -arch all -Sl $DT_HOME/lib/libLTO.dylib - - if [ "x$DISABLE_USR_LINKS" == "x" ]; then - # Add a symlink in /usr/lib for B&I. - mkdir -p $DEST_DIR/usr/lib/ - (cd $DEST_DIR/usr/lib && \ - ln -s ../../Developer/usr/lib/libLTO.dylib ./libLTO.dylib) - fi -else - rm -f lib/libLTO.dylib -fi -rm -f lib/libLTO.a lib/libLTO.la - -################################################################################ -# Remove debugging information from DEST_DIR. - -cd $DIR || exit 1 - -find $DEST_DIR -name \*.a -print | xargs ranlib || exit 1 -find $DEST_DIR -name \*.dSYM -print | xargs rm -r || exit 1 - -# Strip debugging information from files -# -# Use '-l' to strip i386 modules. N.B. that flag doesn't work with kext or -# PPC objects! -find $DEST_DIR -perm -0111 -type f \ - ! \( -name '*.la' -o -name gccas -o -name gccld -o -name llvm-config \) \ - -print | xargs -n 1 -P ${SYSCTL} strip -arch all -Sl - -chgrp -h -R wheel $DEST_DIR -chgrp -R wheel $DEST_DIR - -################################################################################ -# Remove the docs directory - -rm -rf $DEST_DIR$DEST_ROOT/docs - -################################################################################ -# w00t! Done! - -exit 0 diff --git a/contrib/llvm/utils/cgiplotNLT.pl b/contrib/llvm/utils/cgiplotNLT.pl deleted file mode 100755 index 0360e41..0000000 --- a/contrib/llvm/utils/cgiplotNLT.pl +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/perl -#takes a test and a program from a dp and produces a gnuplot script -#use like perl plotNLT.pl password Programs/MultiSource/Benchmarks/ASCI_Purple/SMG2000/smg2000 llc - -use CGI; -use DBI; -my $q = new CGI; - -# database information -$db="llvmalpha"; -$host="localhost"; -$userid="llvmdbuser"; -$passwd=$q->param('pwd'); -$connectionInfo="dbi:mysql:$db;$host"; - -# make connection to database -$dbh = DBI->connect($connectionInfo,$userid,$passwd) or die DBI->errstr; - - -$count = 0; -while ($q->param('n' . $count)) - { - $count++; - } - -$| = 1; -print "Content-type: image/png", "\n\n"; - -open CMDSTREAM, "|gnuplot"; -#open CMDSTREAM, "|echo"; - -print CMDSTREAM "set terminal png\n"; -print CMDSTREAM "set output\n"; -print CMDSTREAM "set xdata time\n"; -print CMDSTREAM 'set timefmt "%Y-%m-%d"'; -print CMDSTREAM "\nplot"; -for ($iter = 0; $iter < $count; $iter++) { - if ($iter) - { print CMDSTREAM ","; } - print CMDSTREAM " '-' using 1:2 title \"" . $q->param('t' . $iter) . "," . $q->param('n' . $iter) . "\"with lines"; -} - -print CMDSTREAM "\n"; - -for ($iter = 0; $iter < $count; $iter++) { - - $prog = $q->param('n' . $iter); - $test = $q->param('t' . $iter); - - $query = "Select RUN, VALUE from Tests where TEST = '$test' AND NAME = '$prog' ORDER BY RUN"; - #print "\n$query\n"; - - my $sth = $dbh->prepare( $query) || die "Can't prepare statement: $DBI::errstr";; - - my $rc = $sth->execute or die DBI->errstr; - - while(($da,$v) = $sth->fetchrow_array) - { - print CMDSTREAM "$da $v\n"; - } - - print CMDSTREAM "e\n"; -} -print CMDSTREAM "exit\n"; -close CMDSTREAM; - -# disconnect from database -$dbh->disconnect; diff --git a/contrib/llvm/utils/check-each-file b/contrib/llvm/utils/check-each-file deleted file mode 100755 index bd76333..0000000 --- a/contrib/llvm/utils/check-each-file +++ /dev/null @@ -1,150 +0,0 @@ -#!/bin/sh -# check-each-file -# Used to narrow down a miscompilation to one .o file from a list. Please read -# the usage procedure, below, for command-line syntax (or run it with --help). -# This script depends on the llvm-native-gcc script. - -if [ x$1 = x--make-linker-script ] -then - program=$2 - linker=./link-$program - echo "Building $program with llvm-native-gcc" - rm -f $program - gmake -e $program CC=llvm-native-gcc CXX=llvm-native-gxx - echo "Erasing $program and re-linking it" - rm -f $program - echo "rm -f $program" > $linker - gmake -n $program >> $linker - chmod 755 $linker - echo "Linker script created in $linker; testing it out" - output=`./$linker 2>&1` - case "$output" in - *undefined*reference*__main*) - echo "$program appears to need a dummy __main function; adding one" - echo "void __main () { }" > __main.c - gcc -c __main.c - echo "Done; rebuilding $linker" - echo "rm -f $program" > $linker - gmake -n $program 2>&1 | sed '/gcc/s/$/__main.o/' >> $linker - ./$linker > /dev/null 2>&1 - if [ ! -x $program ] - then - echo "WARNING: linker script didn't work" - fi - ;; - *) - if [ ! -x $program ] - then - echo "WARNING: linker script didn't work" - fi - ;; - esac - echo "Linker script created in $linker; please check it manually" - exit 0 -fi - -checkfiles="$1" -program="$2" -linker="$3" -checker="$4" - -usage () { - myname=`basename $0` - echo "$myname --make-linker-script PROGRAM" - echo "$myname OBJECTS-FILE PROGRAM LINKER CHECKER" - echo "" - echo "OBJECTS-FILE is a text file containing the names of all the .o files" - echo "PROGRAM is the name of the executable under test" - echo "(there must also exist a Makefile in the current directory which" - echo "has PROGRAM as a target)" - echo "LINKER is the script that builds PROGRAM; try --make-linker-script" - echo "to automatically generate it" - echo "CHECKER is the script that exits 0 if PROGRAM is ok, 1 if it is not OK" - echo "(LINKER and CHECKER must be in your PATH, or you should specify ./)" - echo "" - echo "Bugs to ." - exit 1 -} - -if [ x$1 = x--help ] -then - usage -fi - -if [ -z "$checkfiles" ] -then - echo "ERROR: Must specify name of file w/ list of objects as 1st arg." - echo "(got \"$checkfiles\")" - usage -fi -if [ ! -f "$checkfiles" ] -then - echo "ERROR: $checkfiles not found" - usage -fi -if [ -z "$program" ] -then - echo "ERROR: Must specify name of program as 2nd arg." - usage -fi -if [ -z "$linker" ] -then - echo "ERROR: Must specify name of link script as 3rd arg." - usage -fi -if [ ! -x "$linker" ] -then - echo "ERROR: $linker not found or not executable" - echo "You may wish to try: $0 --make-linker-script $program" - usage -fi -if [ -z "$checker" ] -then - echo "ERROR: Must specify name of $program check script as 3rd arg." - usage -fi -if [ ! -x "$checker" ] -then - echo "ERROR: $checker not found or not executable" - usage -fi - -files=`cat $checkfiles` -echo "Recompiling everything with llvm-native-gcc" -for f in $files -do - rm -f $f - gmake $f CC=llvm-native-gcc CXX=llvm-native-gxx -done -rm -f $program -$linker -if $checker -then - echo "Sorry, I can't help you, $program is OK when compiled with llvm-native-gcc" - exit 1 -fi -for f in $files -do - echo Trying to compile $f with native gcc and rebuild $program - mv ${f} ${f}__OLD__ - gmake ${f} CC=gcc > /dev/null 2>&1 - $linker - echo Checking validity of new $program - if $checker - then - echo Program is OK - okfiles="$okfiles $f" - else - echo Program is not OK - notokfiles="$notokfiles $f" - fi - mv ${f}__OLD__ ${f} -done -echo "" -echo "Program is OK when these files are recompiled with native gcc: " -echo "$okfiles" -echo "" -echo "Program is not OK when these files are recompiled with native gcc: " -echo "$notokfiles" -echo "" -exit 0 diff --git a/contrib/llvm/utils/codegen-diff b/contrib/llvm/utils/codegen-diff deleted file mode 100755 index 2c3ac4c..0000000 --- a/contrib/llvm/utils/codegen-diff +++ /dev/null @@ -1,135 +0,0 @@ -#!/usr/bin/perl - -use Getopt::Std; -$DEBUG = 0; - -sub parse_objdump_file { - my ($filename) = @_; - my @result; - open (INPUT, $filename) or die "$filename: $!\n"; - print "opened objdump output file $filename\n" if $DEBUG; - while () { - if (/\s*([0-9a-f]*):\t(([0-9a-f]{2} )+) *\t(.*)$/) { - my ($addr, $bytes, $instr) = ($1, $2, $4); - $addr = "0x" . $addr; - $bytes =~ s/\s*(.*\S)\s*/$1/; # trim any remaining whitespace - $instr =~ s/\s*(.*\S)\s*/$1/; - push (@result, {'addr' => $addr, 'bytes' => $bytes, 'instr' => $instr}); - print "addr=$addr bytes='$bytes' instr='$instr'\n" if $DEBUG; - } - } - close INPUT; - return @result; -} - -sub parse_gdb_file { - my ($filename) = @_; - my @result; - my $got_addr; - open (INPUT, $filename) or die "$filename: $!\n"; - print "opened gdb output file $filename\n" if $DEBUG; - while () { - if (/^(0x[0-9a-f]*):\t([^\t]*)\t[^:]*:\t((0x[0-9a-f]{2}\s*)+)\s*$/) { - my ($addr, $bytes, $instr) = ($1, $3, $2); - $bytes =~ s/0x//g; - $bytes =~ s/\s+/ /g; # regularize whitespace - $bytes =~ s/\s*(.*\S)\s*/$1/; # trim any remaining whitespace - $instr =~ s/\s*(.*\S)\s*/$1/; - push (@result, {'addr' => $addr, 'bytes' => $bytes, 'instr' => $instr}); - print "addr=$addr bytes='$bytes' instr='$instr'\n" if $DEBUG; - } elsif (/^(0x[0-9a-f]*):\t$/) { # deal with gdb's line breaker - $got_addr = $1; - } elsif ($got_addr && /^ ([^\t]*)\t[^:]*:\t((0x[0-9a-f]{2}\s*)+)\s*$/) { - my ($addr, $bytes, $instr) = ($got_addr, $2, $1); - $bytes =~ s/0x//g; - $bytes =~ s/\s+/ /g; # regularize whitespace - $bytes =~ s/\s*(.*\S)\s*/$1/; # trim any remaining whitespace - $instr =~ s/\s*(.*\S)\s*/$1/; - push (@result, {'addr' => $addr, 'bytes' => $bytes, 'instr' => $instr}); - print "addr=$addr bytes='$bytes' instr='$instr'\n" if $DEBUG; - undef $got_addr; - } - } - close INPUT; - return @result; -} - -sub binary_diffs { - my ($objdump_file, $gdb_file) = @_; - my @file1 = parse_objdump_file ($objdump_file); - my @file2 = parse_gdb_file ($gdb_file); - my $lastrecord = ($#file1 >= $#file2) ? ($#file1) : ($#file2); - for (my $i = 0; $i <= $lastrecord; ++$i) { - my $d1 = $file1[$i]; - my $d2 = $file2[$i]; - if ($d1->{'bytes'} ne $d2->{'bytes'}) { - next if (($d1->{'instr'} eq $d2->{'instr'}) && $opt_d); - printf "0x%08x:\t%30s \t%s\n", 0+$d1->{'addr'}, $d1->{'bytes'}, $d1->{'instr'}; - printf "0x%08x:\t%30s \t%s\n\n", 0+$d2->{'addr'}, $d2->{'bytes'}, $d2->{'instr'}; - } - } -} - -&getopts('d'); -$objdump_file = $ARGV[0]; -$gdb_file = $ARGV[1]; -binary_diffs ($objdump_file, $gdb_file); -exit (0); -__END__ -=pod - -=head1 NAME - -codegen-diff - -=head1 SYNOPSIS - -codegen-diff [-d] I I - -=head1 DESCRIPTION - -B is a program that tries to show you the differences -between the code that B generated and the code that B generated. - -The way you use it is as follows: first, you create I -by running B on the B compiled and linked binary. You need to -trim down the result so it contains only the function of interest. - -Second, you create I by running B, with my patch -to print out hex bytes in the B command output, on -B. Set a breakpoint in C and wait until -the function you want is compiled. Then use the B command -to print out the assembly dump of the function B just compiled. -(Use C to find out where the function starts and ends in memory.) -It's easiest to save this output by using B