OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [eeprof-1.c] - Blame information for rev 298

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
#define ASSERT(X)       if (!(X)) abort ();
2
#define NOCHK __attribute__ ((no_instrument_function))
3
 
4
int entry_calls, exit_calls;
5
void (*last_fn_entered)();
6
void (*last_fn_exited)();
7
 
8
__attribute__ ((noinline))
9
int main () NOCHK;
10
 
11
__attribute__ ((noinline))
12
void foo ()
13
{
14
  ASSERT (last_fn_entered == foo);
15
}
16
 
17
__attribute__ ((noinline))
18
static void foo2 ()
19
{
20
  ASSERT (entry_calls == 1 && exit_calls == 0);
21
  ASSERT (last_fn_entered == foo2);
22
  foo ();
23
  ASSERT (entry_calls == 2 && exit_calls == 1);
24
  ASSERT (last_fn_entered == foo);
25
  ASSERT (last_fn_exited == foo);
26
}
27
 
28
__attribute__ ((noinline))
29
void nfoo (void) NOCHK;
30
void nfoo ()
31
{
32
  ASSERT (entry_calls == 2 && exit_calls == 2);
33
  ASSERT (last_fn_entered == foo);
34
  ASSERT (last_fn_exited == foo2);
35
  foo ();
36
  ASSERT (entry_calls == 3 && exit_calls == 3);
37
  ASSERT (last_fn_entered == foo);
38
  ASSERT (last_fn_exited == foo);
39
}
40
 
41
int main ()
42
{
43
  ASSERT (entry_calls == 0 && exit_calls == 0);
44
 
45
  foo2 ();
46
 
47
  ASSERT (entry_calls == 2 && exit_calls == 2);
48
  ASSERT (last_fn_entered == foo);
49
  ASSERT (last_fn_exited == foo2);
50
 
51
  nfoo ();
52
 
53
  ASSERT (entry_calls == 3 && exit_calls == 3);
54
  ASSERT (last_fn_entered == foo);
55
 
56
  return 0;
57
}
58
 
59
void __cyg_profile_func_enter (void (*fn)(), void (*parent)()) NOCHK;
60
void __cyg_profile_func_exit (void (*fn)(), void (*parent)()) NOCHK;
61
 
62
__attribute__ ((noinline))
63
void __cyg_profile_func_enter (void (*fn)(), void (*parent)())
64
{
65
  entry_calls++;
66
  last_fn_entered = fn;
67
}
68
__attribute__ ((noinline))
69
void __cyg_profile_func_exit (void (*fn)(), void (*parent)())
70
{
71
  exit_calls++;
72
  last_fn_exited = fn;
73
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.