[llvm-commits] CVS: llvm/test/Regression/Reoptimizer/inst/Makefile Test1.c

Joel Stanley jstanley at cs.uiuc.edu
Thu May 22 22:26:01 PDT 2003


Changes in directory llvm/test/Regression/Reoptimizer/inst:

Makefile updated: 1.4 -> 1.5
Test1.c updated: 1.3 -> 1.4

---
Log message:

Modified to link against the PAPI library; Test1.c uses perf prims implemented
using the PAPI lib.


---
Diffs of the changes:

Index: llvm/test/Regression/Reoptimizer/inst/Makefile
diff -u llvm/test/Regression/Reoptimizer/inst/Makefile:1.4 llvm/test/Regression/Reoptimizer/inst/Makefile:1.5
--- llvm/test/Regression/Reoptimizer/inst/Makefile:1.4	Thu May 22 08:16:53 2003
+++ llvm/test/Regression/Reoptimizer/inst/Makefile	Thu May 22 22:25:43 2003
@@ -3,17 +3,24 @@
 CC = /usr/dcs/software/evaluation/bin/gcc
 CXX = /usr/dcs/software/evaluation/bin/g++
 LLVMGCC = /home/vadve/lattner/local/sparc/llvm-gcc/bin/gcc
+PAPIDIR = /home/vadve/shared/papi-2.3.4.1/lib
 
 PERFOBJS = $(LEVEL)/lib/Debug/libpprtl.a        \
            $(LEVEL)/lib/Debug/libperfinst.a     \
 	   $(LEVEL)/lib/Debug/libtracecache.a   \
 	   $(LEVEL)/lib/Debug/libbininterface.a
 
+
 LIBINSTRBC = /home/vadve/lattner/cvs/gcc_install_sparc/llvm/lib/libinstr.bc
 
 Test1: Test1.o $(PERFOBJS)
+        # NB: The only reason we don't include the PAPI library in the list of exclusions
+        #     is that the current phase2 (etc.) does not look at the dynamic symbol
+        #     tables, and thus will never try to instrument the PAPI functions, which are
+        #     dynamically linked.
+
 	mkexcl $(PERFOBJS) libinstr.o > mkexcl.cpp
-	$(CXX) -o Test1 -lelf mkexcl.cpp $^
+	$(CXX) -o Test1 $^ mkexcl.cpp -L$(PAPIDIR) -lpapi -lelf
 
 Test1.o: Test1.opt.c
 	$(CC) -c Test1.opt.c -o Test1.o
@@ -23,7 +30,6 @@
 
 Test1.opt.bc: Test1.bc libinstr.o $(LEVEL)/lib/Debug/libperf.so
 	opt -load $(LEVEL)/lib/Debug/libperf.so -pp1 -emitfuncs -deadtypeelim < Test1.bc > Test1.opt.o
-#	$(LLVMGCC) -Wl,-disable-internalize Test1.opt.o -o Test1.opt
 	gccld -disable-internalize $(LIBINSTRBC) Test1.opt.o -o Test1.opt
 
 Test1.bc: Test1.c


Index: llvm/test/Regression/Reoptimizer/inst/Test1.c
diff -u llvm/test/Regression/Reoptimizer/inst/Test1.c:1.3 llvm/test/Regression/Reoptimizer/inst/Test1.c:1.4
--- llvm/test/Regression/Reoptimizer/inst/Test1.c:1.3	Thu May 22 08:16:54 2003
+++ llvm/test/Regression/Reoptimizer/inst/Test1.c	Thu May 22 22:25:43 2003
@@ -5,6 +5,7 @@
 
 double elapsedTime = 0;
 double elapsedTime2 = 0;
+int l1cachemiss = 0;
 
 #include <stdio.h>
 
@@ -13,6 +14,15 @@
 int fib(int n);
 void fibs();
 
+void someOtherFunction()
+{
+    int x;
+    pp_L1_cache_miss_start(&x);
+    printf("this statement resides within a region!\n");
+    pp_L1_cache_miss_end(&l1cachemiss, &x);
+    printf("someOtherFunction complete: retval is %d\n", l1cachemiss);
+}
+
 int main(int argc, char** argv) 
 {
     phase2();
@@ -20,7 +30,14 @@
     printf("Just about to call fibs()...\n");
     fibs();
 
+    printf("Just about to call someOtherFunction()...\n");
+    someOtherFunction();
+
     printf("Leaving main...\n");
+
+    pp_regionPair(pp_elapsed_time_start, pp_elapsed_time_end);
+    pp_regionPair(pp_L1_cache_miss_start, pp_L1_cache_miss_end);
+
     return 0;
 }
 





More information about the llvm-commits mailing list