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

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


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

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

---
Log message:



---
Diffs of the changes:

Index: llvm/test/Regression/Reoptimizer/inst/Makefile
diff -u llvm/test/Regression/Reoptimizer/inst/Makefile:1.3 llvm/test/Regression/Reoptimizer/inst/Makefile:1.4
--- llvm/test/Regression/Reoptimizer/inst/Makefile:1.3	Sun May  4 16:16:53 2003
+++ llvm/test/Regression/Reoptimizer/inst/Makefile	Thu May 22 08:16:53 2003
@@ -1,31 +1,40 @@
-LEVEL = ../../../..
+LEVEL = /localhome/$(USER)/Research/llvm
 
-PERFOBJS = $(LEVEL)/lib/Debug/libperfinst.a     \
+CC = /usr/dcs/software/evaluation/bin/gcc
+CXX = /usr/dcs/software/evaluation/bin/g++
+LLVMGCC = /home/vadve/lattner/local/sparc/llvm-gcc/bin/gcc
+
+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)
-	mkexcl $(PERFOBJS) > mkexcl.cpp
-	/usr/dcs/software/evaluation/bin/g++ -o Test1 -lelf mkexcl.cpp $^
+	mkexcl $(PERFOBJS) libinstr.o > mkexcl.cpp
+	$(CXX) -o Test1 -lelf mkexcl.cpp $^
 
 Test1.o: Test1.opt.c
-	/usr/dcs/software/evaluation/bin/gcc -c Test1.opt.c -o Test1.o
+	$(CC) -c Test1.opt.c -o Test1.o
 
 Test1.opt.c: Test1.opt.bc
 	dis -c < Test1.opt.bc > Test1.opt.c
 
-Test1.opt.bc: Test1.bc
+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
-	llvm-gcc -Wl,-disable-internalize Test1.opt.o -o Test1.opt
+#	$(LLVMGCC) -Wl,-disable-internalize Test1.opt.o -o Test1.opt
+	gccld -disable-internalize $(LIBINSTRBC) Test1.opt.o -o Test1.opt
 
 Test1.bc: Test1.c
-	llvm-gcc -c Test1.c -o Test1.bc
+	$(LLVMGCC) -I$(LOCAL_CVSROOT)/llvm/lib/Reoptimizer/Inst/rtl -c Test1.c -o Test1.bc
+
+libinstr.o: $(LIBINSTRBC)
+	dis -c < $^ > $(@:.o=.c)
+	$(CC) -c $(@:.o=.c) 2>/dev/null
 
 test1asm:
 	/usr/ccs/bin/dis Test1 > Test1.s
 
 clean:
-	rm -f *.o *.bc *.opt *.opt.c Test1
-
-
-
+	rm -f *.o *.bc *.opt *.opt.c mkexcl.cpp libinstr.c Test1


Index: llvm/test/Regression/Reoptimizer/inst/Test1.c
diff -u llvm/test/Regression/Reoptimizer/inst/Test1.c:1.2 llvm/test/Regression/Reoptimizer/inst/Test1.c:1.3
--- llvm/test/Regression/Reoptimizer/inst/Test1.c:1.2	Wed Apr 30 17:17:37 2003
+++ llvm/test/Regression/Reoptimizer/inst/Test1.c	Thu May 22 08:16:54 2003
@@ -1,59 +1,18 @@
-// begin includes for rtl, etc...
+#include "pprtl.h"
 
-#include <sys/time.h>
-
-// RTL functions && sigfun protos
-extern void doAbsolutelyNothing();
-
-long     pp_timestamp(void);
-double   pp_elapsed_time_start(void);
-double   pp_elapsed_time_end(double* start);
-unsigned pp_counterPrim(void);
-void     pp_regionPair(void*, void*);
-void     pp_metricSpec(void*);
-
-// implementations of RTL stuff, etc
-
-double pp_elapsed_time_start(void) 
-{
-    struct timeval tv;
-    gettimeofday(&tv, 0);
-
-    // return result in ms
-    return (tv.tv_sec * 1000000 + tv.tv_usec) / 1000.0;
-}
-
-double pp_elapsed_time_end(double* start) 
-{
-    struct timeval tv;
-    double end;
-
-    gettimeofday(&tv, 0);
-    end = (tv.tv_sec * 1000000 + tv.tv_usec) / 1000.0; // convert to ms
-    return end - *start;                               // compute diff & return
-}
-
-// Begin user source file!
-
-// The following is actually the semantic result of processing a metric declaration (need
-// more sigfun support)
+// The following is actually the semantic result of processing a metric
+// declaration (need more sigfun support)
 
 double elapsedTime = 0;
+double elapsedTime2 = 0;
 
 #include <stdio.h>
 
-//extern "C" void phase2();
 void phase2();
 
 int fib(int n);
 void fibs();
 
-
-void floogle() 
-{
-    printf("this is lame");
-}
-
 int main(int argc, char** argv) 
 {
     phase2();
@@ -61,6 +20,7 @@
     printf("Just about to call fibs()...\n");
     fibs();
 
+    printf("Leaving main...\n");
     return 0;
 }
 
@@ -72,15 +32,25 @@
         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;
 
-    printf("Inside fibs now, sleeping for 2 seconds...\n");
+    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 so that the phase 1.
+    // sigfuns. We need better sigfun support.
     //
     // That is, the below should look like:
     //
@@ -92,8 +62,10 @@
     // although the post-phase1 transformed code should be "similar" (calls removed and
     // volatile loads put in their place, of course!)
 
-    double y = pp_elapsed_time_start();
-    
+    long x;
+    double y;
+    pp_elapsed_time_start(&y);
+
     for(i = 10; i > 0; i--) {
         printf("fib(%d) = %d\n", i, fib(i));
     }
@@ -101,10 +73,12 @@
     printf("after for loop...\n");
     fflush(stdout);
 
-    elapsedTime = pp_elapsed_time_end(&y);
+    pp_elapsed_time_end(&elapsedTime, &y);
+
+    printf("ElapsedTime (metric variable) has address %lx, value %f\n", &elapsedTime, elapsedTime);
     
     //
     ////////////////
 
-    printf("Leaving fibs...");
+    printf("Leaving fibs...\n");
 }





More information about the llvm-commits mailing list