|
Mark Wielaard |
c728a3 |
--- valgrind-3.8.1/cachegrind/cg_sim.c.jj 2011-10-26 23:24:32.000000000 +0200
|
|
Mark Wielaard |
c728a3 |
+++ valgrind-3.8.1/cachegrind/cg_sim.c 2011-12-09 17:31:19.256023683 +0100
|
|
Jakub Jelinek |
7657d9 |
@@ -42,27 +42,30 @@ typedef struct {
|
|
Jakub Jelinek |
8f5f0f |
Int size; /* bytes */
|
|
Jakub Jelinek |
8f5f0f |
Int assoc;
|
|
Jakub Jelinek |
8f5f0f |
Int line_size; /* bytes */
|
|
Jakub Jelinek |
8f5f0f |
- Int sets;
|
|
Jakub Jelinek |
8f5f0f |
Int sets_min_1;
|
|
Jakub Jelinek |
8f5f0f |
Int line_size_bits;
|
|
Jakub Jelinek |
8f5f0f |
Int tag_shift;
|
|
Mark Wielaard |
fc26e0 |
- HChar desc_line[128];
|
|
Jakub Jelinek |
8f5f0f |
UWord* tags;
|
|
Jakub Jelinek |
8f5f0f |
-} cache_t2;
|
|
Mark Wielaard |
fc26e0 |
+ HChar desc_line[128];
|
|
Jakub Jelinek |
8f5f0f |
+} cache_t2
|
|
Jakub Jelinek |
8f5f0f |
+#ifdef __GNUC__
|
|
Jakub Jelinek |
8f5f0f |
+__attribute__ ((aligned (8 * sizeof (Int))))
|
|
Jakub Jelinek |
8f5f0f |
+#endif
|
|
Jakub Jelinek |
8f5f0f |
+;
|
|
Jakub Jelinek |
8f5f0f |
|
|
Jakub Jelinek |
8f5f0f |
/* By this point, the size/assoc/line_size has been checked. */
|
|
Jakub Jelinek |
8f5f0f |
static void cachesim_initcache(cache_t config, cache_t2* c)
|
|
Jakub Jelinek |
8f5f0f |
{
|
|
Jakub Jelinek |
8f5f0f |
- Int i;
|
|
Jakub Jelinek |
8f5f0f |
+ Int sets;
|
|
Jakub Jelinek |
8f5f0f |
|
|
Jakub Jelinek |
8f5f0f |
c->size = config.size;
|
|
Jakub Jelinek |
8f5f0f |
c->assoc = config.assoc;
|
|
Jakub Jelinek |
8f5f0f |
c->line_size = config.line_size;
|
|
Jakub Jelinek |
8f5f0f |
|
|
Jakub Jelinek |
8f5f0f |
- c->sets = (c->size / c->line_size) / c->assoc;
|
|
Jakub Jelinek |
8f5f0f |
- c->sets_min_1 = c->sets - 1;
|
|
Jakub Jelinek |
8f5f0f |
+ sets = (c->size / c->line_size) / c->assoc;
|
|
Jakub Jelinek |
8f5f0f |
+ c->sets_min_1 = sets - 1;
|
|
Jakub Jelinek |
8f5f0f |
c->line_size_bits = VG_(log2)(c->line_size);
|
|
Jakub Jelinek |
8f5f0f |
- c->tag_shift = c->line_size_bits + VG_(log2)(c->sets);
|
|
Jakub Jelinek |
8f5f0f |
+ c->tag_shift = c->line_size_bits + VG_(log2)(sets);
|
|
Jakub Jelinek |
8f5f0f |
|
|
Jakub Jelinek |
8f5f0f |
if (c->assoc == 1) {
|
|
Jakub Jelinek |
8f5f0f |
VG_(sprintf)(c->desc_line, "%d B, %d B, direct-mapped",
|
|
Jakub Jelinek |
7657d9 |
@@ -72,11 +75,8 @@ static void cachesim_initcache(cache_t c
|
|
Jakub Jelinek |
8f5f0f |
c->size, c->line_size, c->assoc);
|
|
Jakub Jelinek |
8f5f0f |
}
|
|
Jakub Jelinek |
8f5f0f |
|
|
Jakub Jelinek |
76c2ba |
- c->tags = VG_(malloc)("cg.sim.ci.1",
|
|
Jakub Jelinek |
76c2ba |
- sizeof(UWord) * c->sets * c->assoc);
|
|
Jakub Jelinek |
8f5f0f |
-
|
|
Jakub Jelinek |
8f5f0f |
- for (i = 0; i < c->sets * c->assoc; i++)
|
|
Jakub Jelinek |
8f5f0f |
- c->tags[i] = 0;
|
|
Jakub Jelinek |
76c2ba |
+ c->tags = VG_(calloc)("cg.sim.ci.1",
|
|
Jakub Jelinek |
0a98d2 |
+ sizeof(UWord), sets * c->assoc);
|
|
Jakub Jelinek |
8f5f0f |
}
|
|
Jakub Jelinek |
8f5f0f |
|
|
Mark Wielaard |
fc26e0 |
/* This attribute forces GCC to inline the function, getting rid of a
|