[llvm-commits] CVS: llvm/test/Programs/Makefile.programs

Chris Lattner lattner at cs.uiuc.edu
Tue Feb 10 12:58:02 PST 2004


Changes in directory llvm/test/Programs:

Makefile.programs updated: 1.113 -> 1.114

---
Log message:

Add rules for building and printing profile information:
make profile         - (builds an Output/test.prof profile database)
make print-profile   - (runs llvm-prof on it)


---
Diffs of the changes:  (+28 -0)

Index: llvm/test/Programs/Makefile.programs
diff -u llvm/test/Programs/Makefile.programs:1.113 llvm/test/Programs/Makefile.programs:1.114
--- llvm/test/Programs/Makefile.programs:1.113	Tue Feb 10 10:25:44 2004
+++ llvm/test/Programs/Makefile.programs	Tue Feb 10 12:57:39 2004
@@ -107,6 +107,10 @@
 LLCLSDIFFS  := $(addsuffix .diff-llc-ls, $(PREFIXED_PROGRAMS_TO_TEST))
 CBEDIFFS  := $(addsuffix .diff-cbe, $(PREFIXED_PROGRAMS_TO_TEST))
 
+# Profiles for the program.
+PROFOUTPUT := $(addsuffix .prof, $(PREFIXED_PROGRAMS_TO_TEST))
+PRINTPROFOUTPUT := $(addsuffix .printprof, $(PREFIXED_PROGRAMS_TO_TEST))
+
 # Build Program outputs:
 .PRECIOUS: Output/%.out-lli Output/%.out-jit Output/%.out-llc Output/%.out-llc-ls
 .PRECIOUS: Output/%.out-nat Output/%.out-cbe
@@ -119,6 +123,9 @@
 # Regardless of what other options are specified, build the program's bytecode
 # representation.
 all:: $(BYTECODE)
+profile:: $(PROFOUTPUT)
+print-profile:: $(PRINTPROFOUTPUT)
+
 
 ifdef RUN_GCC_ONLY
 DISABLE_DIFFS = 1
@@ -376,6 +383,27 @@
 	$(LBUGPOINT) $< -run-jit $(BUGPOINT_OPTIONS)
 
 endif
+
+
+#
+# Rules to generate profiling information
+#
+$(PROGRAMS_TO_TEST:%=Output/%.llvm-prof.bc): \
+Output/%.llvm-prof.bc: Output/%.llvm.bc
+	$(LOPT) -insert-block-profiling $< -o $@ -f
+
+$(PROGRAMS_TO_TEST:%=Output/%.prof): \
+Output/%.prof: Output/%.llvm-prof.bc Output/%.out-nat
+	@rm -f $@
+	-$(RUNSAFELY) $(STDIN_FILENAME) Output/$*.out-prof $(LLI) $(JIT_OPTS) \
+            -fake-argv0 'Output/$*.llvm.bc' -load $(LEVEL)/lib/Debug/libprofile_rt.so $< -llvmprof-output $@ $(RUN_OPTIONS)
+	@cmp -s Output/$*.out-prof Output/$*.out-nat || \
+		printf "***\n***\n*** WARNING: Output of profiled program (Output/$*.out-prof)\n*** doesn't match the output of the native program (Output/$*.out-nat)!\n***\n***\n";
+
+$(PROGRAMS_TO_TEST:%=Output/%.printprof): \
+Output/%.printprof: Output/%.llvm.bc Output/%.prof
+	$(LPROF) $< Output/$*.prof
+
 
 #
 # Rules to diff test output...





More information about the llvm-commits mailing list