aboutsummaryrefslogtreecommitdiffstats
path: root/test/LLC/testtrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/LLC/testtrace.c')
-rw-r--r--test/LLC/testtrace.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/LLC/testtrace.c b/test/LLC/testtrace.c
new file mode 100644
index 0000000..c7b3e8a
--- /dev/null
+++ b/test/LLC/testtrace.c
@@ -0,0 +1,44 @@
+#include <stdio.h>
+
+/*
+ * Test routines for testing the tracing code.
+ */
+
+struct DummyStruct {
+ struct DummyStruct* next;
+ int seqnum;
+};
+
+int
+AddCounts(struct DummyStruct* S1,
+ struct DummyStruct* S2,
+ struct DummyStruct* S3, int noPrint)
+{
+ if (!noPrint)
+ printf("&S1 = %p\t&S2 = %p\t&S3 = %p\n", S1, S2, S3);
+ return S1->seqnum + S2->seqnum + S3->seqnum;
+}
+
+void
+testAllocaOrder(int noPrint)
+{
+ static int count = 0;
+ struct DummyStruct S1, S2, S3;
+
+ S1.seqnum = ++count;
+ S2.seqnum = ++count;
+ S3.seqnum = ++count;
+
+ printf("sum = %d\n", AddCounts(&S1, &S2, &S3, noPrint));
+}
+
+int
+main(int argc, char** argv)
+{
+ unsigned int i, noPrint = 1;
+ if (argc > 1 && ! strcmp(argv[1], "-d"))
+ noPrint = 0;
+ for (i=0; i < 10; ++i)
+ testAllocaOrder(noPrint);
+ return 0;
+}