4 * Test Name: badfuncptr.c
7 * Indirect call via function pointer is mishandled in reg. alloc.
8 * The indirect call address was allocated the same register as the
9 * first outgoing argument, so it was overwritten before the call.
12 * In PhyRegAlloc.cpp, mark the live range for the indirect call
13 * address as having a Call Interference. This has to be done
14 * as a special case since it may not be live after the call.
17 * Fixed on 3/29/02 -- Adve.
19 /* For copyright information, see olden_v1.0/COPYRIGHT */
22 /* #include "hash.h" */
26 /* For copyright information, see olden_v1.0/COPYRIGHT */
30 typedef struct hash_entry {
33 struct hash_entry *next;
38 int (*mapfunc)(unsigned int);
42 Hash MakeHash(int size, int (*map)(unsigned int));
43 void *HashLookup(unsigned int key, Hash hash);
44 void HashInsert(void *entry,unsigned int key, Hash hash);
45 void HashDelete(unsigned int key, Hash hash);
50 #define assert(num,a) if (!(a)) {printf("Assertion failure:%d in hash\n",num); exit(-1);}
52 void *HashLookup(unsigned int key, Hash hash)
57 j = (hash->mapfunc)(key); /* 14% miss in hash->mapfunc */
59 assert(2,j<hash->size);
60 for (ent = hash->array[j]; /* 17% miss in hash->array[j] */ /* adt_pf can't detect :( */
61 ent && /* 47% miss in ent->key */ /* adt_pf can detect :) */
63 ent=ent->next); /* 8% miss in ent->next */ /* adt_pf can detect :) */
64 if (ent) return ent->entry;
68 /* essentially dummy main so testing does not fail */
72 printf("&HashLookup = %d\n", !!HashLookup);