summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base/inlinedvars.c
blob: 2756323e09f382b39a680b76e3e4ade273f8fc86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
static inline int
m(char *name, int i, long j)
{
  // Random syntactical block to be inlined.
  // Mimics what STAP_PROBE macro does a bit.
  do {
    volatile __typeof__(name) p_name = name;
    volatile __typeof__(i) p_i = i;
    volatile __typeof__(j) p_j = j;
    // empty asm to force locals into regs.
    inlined_label: asm volatile ("" :: "g"(p_name), "g"(p_i), "g"(p_j));
  } while (0);
  return i + 32;
}

/* XXX PR10537 label() doesn't select multiple instances.
static inline int
call(int pi, long pj)
{
  volatile ic = pi - 42;
  volatile jc = pj + 42;
  return m("call", ic, jc);
}

static inline int
call2(int pi2, long pj2)
{
  volatile ic2 = pi2 + 64;
  volatile jc2 = pj2 - 64;
  return m("call2", ic2, jc2);
}
*/

int
main (int argc, char **argv)
{
  volatile int i = 64;
  volatile long j = 42;
  i = 54;// XXX PR10537 call(i, j);
  j = 150; // XXX PR10537 call2(i, j);
  m("main", i, j);
  return 0;
}