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

Joel Stanley jstanley at cs.uiuc.edu
Tue Jun 24 10:34:01 PDT 2003


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

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

---
Log message:

Merge from branch.


---
Diffs of the changes:

Index: llvm/test/Regression/Reoptimizer/inst/Makefile
diff -u llvm/test/Regression/Reoptimizer/inst/Makefile:1.5 llvm/test/Regression/Reoptimizer/inst/Makefile:1.6
--- llvm/test/Regression/Reoptimizer/inst/Makefile:1.5	Thu May 22 22:25:43 2003
+++ llvm/test/Regression/Reoptimizer/inst/Makefile	Tue Jun 24 10:33:31 2003
@@ -1,4 +1,5 @@
-LEVEL = /localhome/$(USER)/Research/llvm
+LEVEL = ../../../../
+#LEVEL = /localhome/$(USER)/Research/llvm
 
 CC = /usr/dcs/software/evaluation/bin/gcc
 CXX = /usr/dcs/software/evaluation/bin/g++
@@ -10,8 +11,8 @@
 	   $(LEVEL)/lib/Debug/libtracecache.a   \
 	   $(LEVEL)/lib/Debug/libbininterface.a
 
-
-LIBINSTRBC = /home/vadve/lattner/cvs/gcc_install_sparc/llvm/lib/libinstr.bc
+CRTEND = $(LLVM_LIB_SEARCH_PATH)/crtend.o
+LIBINSTRBC = $(LEVEL)/test/Libraries/Output/libinstr.bc
 
 Test1: Test1.o $(PERFOBJS)
         # NB: The only reason we don't include the PAPI library in the list of exclusions
@@ -19,8 +20,8 @@
         #     tables, and thus will never try to instrument the PAPI functions, which are
         #     dynamically linked.
 
-	mkexcl $(PERFOBJS) libinstr.o > mkexcl.cpp
-	$(CXX) -o Test1 $^ mkexcl.cpp -L$(PAPIDIR) -lpapi -lelf
+	mkexcl $(PERFOBJS) libinstr.o crtend.o > mkexcl.cpp
+	$(CXX) -o Test1 $^ mkexcl.cpp crtend.o -L$(PAPIDIR) -lpapi -lelf
 
 Test1.o: Test1.opt.c
 	$(CC) -c Test1.opt.c -o Test1.o
@@ -28,12 +29,16 @@
 Test1.opt.c: Test1.opt.bc
 	dis -c < Test1.opt.bc > Test1.opt.c
 
-Test1.opt.bc: Test1.bc libinstr.o $(LEVEL)/lib/Debug/libperf.so
+Test1.opt.bc: Test1.bc libinstr.o crtend.o $(LEVEL)/lib/Debug/libperf.so
 	opt -load $(LEVEL)/lib/Debug/libperf.so -pp1 -emitfuncs -deadtypeelim < Test1.bc > Test1.opt.o
 	gccld -disable-internalize $(LIBINSTRBC) Test1.opt.o -o Test1.opt
 
 Test1.bc: Test1.c
 	$(LLVMGCC) -I$(LOCAL_CVSROOT)/llvm/lib/Reoptimizer/Inst/rtl -c Test1.c -o Test1.bc
+
+crtend.o: $(CRTEND)
+	dis -c < $^ > $(@:.o=.c)
+	$(CC) -c $(@:.o=.c) 2>/dev/null
 
 libinstr.o: $(LIBINSTRBC)
 	dis -c < $^ > $(@:.o=.c)


Index: llvm/test/Regression/Reoptimizer/inst/Test1.c
diff -u llvm/test/Regression/Reoptimizer/inst/Test1.c:1.4 llvm/test/Regression/Reoptimizer/inst/Test1.c:1.5
--- llvm/test/Regression/Reoptimizer/inst/Test1.c:1.4	Thu May 22 22:25:43 2003
+++ llvm/test/Regression/Reoptimizer/inst/Test1.c	Tue Jun 24 10:33:31 2003
@@ -3,41 +3,30 @@
 // The following is actually the semantic result of processing a metric
 // declaration (need more sigfun support)
 
-double elapsedTime = 0;
-double elapsedTime2 = 0;
+double elapsedTime = 3.14;
 int l1cachemiss = 0;
 
 #include <stdio.h>
 
-void phase2();
-
 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();
 
-    printf("Just about to call fibs()...\n");
+    registerIntervalInst(42, pp_elapsed_time_start,
+                         pp_elapsed_time_end, sizeof(double),
+                         &elapsedTime);
+
+    printf("Just about to call fibs() for the first time...\n");
     fibs();
 
-    printf("Just about to call someOtherFunction()...\n");
-    someOtherFunction();
+    printf("Just about to call fibs() for the second time...\n");
+    fibs();
 
     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;
 }
 
@@ -49,39 +38,12 @@
         return fib(n-2) + fib(n-1);
 }
 
-void functionToBeInlined()
-{
-    double y;
-    pp_elapsed_time_start(&y);
-    printf("This function should be inlined...");
-    pp_elapsed_time_end(&elapsedTime2, &y);
-}
-
 void fibs() 
 {
     int i;
+    double tmp;
 
-    printf("Inside fibs now, calling functionToBeInlined...\n");
-    
-    functionToBeInlined();
-
-    ////////////////
-    // The following is the "scope" that the sampling applies to, represented by
-    // sigfuns. We need better sigfun support.
-    //
-    // That is, the below should look like:
-    //
-    // pp_region_start(elapsedTime);
-    // <for loop>
-    // pp_region_end(elaspedTime);
-    //
-    // or something similar. We should not be putting the actual invoked functions below,
-    // although the post-phase1 transformed code should be "similar" (calls removed and
-    // volatile loads put in their place, of course!)
-
-    long x;
-    double y;
-    pp_elapsed_time_start(&y);
+    pp_declareIntervalStart(&tmp, 42);
 
     for(i = 10; i > 0; i--) {
         printf("fib(%d) = %d\n", i, fib(i));
@@ -90,9 +52,14 @@
     printf("after for loop...\n");
     fflush(stdout);
 
-    pp_elapsed_time_end(&elapsedTime, &y);
+    registerIntervalInst(42, pp_L1_cache_miss_start,
+                         pp_L1_cache_miss_end, sizeof(int),
+                         &l1cachemiss);
+
+    pp_declareIntervalEnd(42, &tmp);
 
-    printf("ElapsedTime (metric variable) has address %lx, value %f\n", &elapsedTime, elapsedTime);
+    printf("value of variable elapsedTime: %f\n", elapsedTime);
+    printf("value of variable l1cachemiss: %d\n", l1cachemiss);
     
     //
     ////////////////





More information about the llvm-commits mailing list