Index: lib/llvm.exp =================================================================== --- lib/llvm.exp (revision 56916) +++ lib/llvm.exp (working copy) @@ -49,11 +49,14 @@ global srcroot objroot srcdir objdir subdir target_triplet prcontext global llvmgcc llvmgxx llvmgcc_version llvmgccmajvers ocamlc global gccpath gxxpath compile_c compile_cxx link shlibext llvmlibsdir + global valgrind set path [file join $srcdir $subdir] # Substitute all Tcl variables. set new_line [subst $line ] + #replace %% with _#MARKER#_ to make the replacement of %% more predictable + regsub -all {%%} $new_line {_#MARKER#_} new_line #replace %prcontext with prcontext.tcl (Must replace before %p) regsub -all {%prcontext} $new_line $prcontext new_line #replace %llvmgcc with actual path to llvmgcc @@ -78,8 +81,24 @@ regsub -all {%s} $new_line $test new_line #replace %t with temp filenames regsub -all {%t} $new_line $tmpFile new_line - #replace %% with % - regsub -all {%%} $new_line % new_line + #replace _#MARKER#_ with % + regsub -all {_#MARKER#_} $new_line % new_line + + #valgind related stuff + regsub -all {llc} $new_line "$valgrind llc" new_line + regsub -all {lli} $new_line "$valgrind lli" new_line + regsub -all {llvm-ar} $new_line "$valgrind llvm-ar" new_line + regsub -all {llvm-as} $new_line "$valgrind llvm-as" new_line + regsub -all {llvm-bcanalyzer} $new_line "$valgrind llvm-bcanalyzer" new_line + regsub -all {llvm-dis} $new_line "$valgrind llvm-dis" new_line + regsub -all {llvm-extract} $new_line "$valgrind llvm-extract" new_line + regsub -all {llvm-ld} $new_line "$valgrind llvm-ld" new_line + regsub -all {llvm-link} $new_line "$valgrind llvm-link" new_line + regsub -all {llvm-nm} $new_line "$valgrind llvm-nm" new_line + regsub -all {llvm-prof} $new_line "$valgrind llvm-prof" new_line + regsub -all {llvm-ranlib} $new_line "$valgrind llvm-ranlib" new_line + regsub -all {opt } $new_line "$valgrind opt " new_line + return $new_line } Index: Makefile =================================================================== --- Makefile (revision 56916) +++ Makefile (working copy) @@ -32,6 +32,12 @@ RUNTESTFLAGS += --tool $(CLEANED_TESTSUITE) endif +ifdef VG +VALGRIND="valgrind --tool=memcheck --quiet --log-fd=1" +else +VALGRIND="" +endif + IGNORE_TESTS := ifndef RUNLLVM2CPP @@ -77,7 +83,9 @@ clean:: $(RM) -rf `find $(LLVM_OBJ_ROOT)/test -name Output -type d -print` -site.exp: Makefile $(LLVM_OBJ_ROOT)/Makefile.config +FORCE: + +site.exp: FORCE @echo 'Making a new site.exp file...' @echo '## these variables are automatically generated by make ##' >site.tmp @echo '# Do not edit here. If you wish to override these values' >>site.tmp @@ -103,6 +111,7 @@ @echo 'set llvmgccmajvers "$(LLVMGCC_MAJVERS)"' >> site.tmp @echo 'set shlibext "$(SHLIBEXT)"' >> site.tmp @echo 'set ocamlc "$(OCAMLC) -cc $(CXX) -I $(LibDir)/ocaml"' >> site.tmp + @echo 'set valgrind $(VALGRIND)' >> site.tmp @echo '## All variables above are generated by configure. Do Not Edit ## ' >>site.tmp @test ! -f site.exp || \ sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp