mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 00:11:00 +00:00
a7a1c7e971
This directory needs to be reorganized and some of the tests need changes to make them executable. Also comments would help... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2865 91177308-0d34-0410-b5e6-96231b3b80d8
45 lines
811 B
C
45 lines
811 B
C
#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;
|
|
}
|