- some strange combination of cond-eval and gvn-pre
[libfirm] / ir / be / test / llvm / testtrace.c
1 #include <stdio.h>
2
3 /*
4  * Test routines for testing the tracing code.
5  */
6
7 struct DummyStruct {
8   struct DummyStruct* next;
9   int seqnum;
10 };
11
12 int
13 AddCounts(struct DummyStruct* S1,
14           struct DummyStruct* S2,
15           struct DummyStruct* S3, int noPrint)
16 {
17   if (!noPrint)
18     printf("&S1 = %p\t&S2 = %p\t&S3 = %p\n", S1, S2, S3);
19   return S1->seqnum + S2->seqnum + S3->seqnum;
20 }
21
22 void
23 testAllocaOrder(int noPrint)
24 {
25   static int count = 0;
26   struct DummyStruct S1, S2, S3;
27
28   S1.seqnum = ++count;
29   S2.seqnum = ++count;
30   S3.seqnum = ++count;
31
32   printf("sum = %d\n", AddCounts(&S1, &S2, &S3, noPrint));
33 }
34
35 int
36 main(int argc, char** argv)
37 {
38   unsigned int i, noPrint = 1;
39   if (argc > 1 && ! strcmp(argv[1], "-d"))
40     noPrint = 0;
41   for (i=0; i < 10; ++i)
42     testAllocaOrder(noPrint);
43   return 0;
44 }