[llvm-commits] CVS: llvm/test/Regression/Reoptimizer/inst/Test1.c
Joel Stanley
jstanley at cs.uiuc.edu
Fri May 30 10:25:01 PDT 2003
Changes in directory llvm/test/Regression/Reoptimizer/inst:
Test1.c updated: 1.4 -> 1.4.2.1
---
Log message:
Modified to use new dynamic-inst mechanism.
---
Diffs of the changes:
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.4.2.1
--- llvm/test/Regression/Reoptimizer/inst/Test1.c:1.4 Thu May 22 22:25:43 2003
+++ llvm/test/Regression/Reoptimizer/inst/Test1.c Fri May 30 10:23:50 2003
@@ -3,40 +3,33 @@
// 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();
+ registerIntervalInst(42, pp_L1_cache_miss_start,
+ pp_L1_cache_miss_end, sizeof(int),
+ &l1cachemiss);
- printf("Leaving main...\n");
+ printf("Just about to call fibs() for the second time...\n");
+ fibs();
- pp_regionPair(pp_elapsed_time_start, pp_elapsed_time_end);
- pp_regionPair(pp_L1_cache_miss_start, pp_L1_cache_miss_end);
+ printf("Leaving main...\n");
return 0;
}
@@ -49,39 +42,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 +56,10 @@
printf("after for loop...\n");
fflush(stdout);
- pp_elapsed_time_end(&elapsedTime, &y);
+ 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