Commit a829d69c authored by Grebant Sandro's avatar Grebant Sandro
Browse files

correct wrong loop_id for instruction cache block

parent 139bb647
......@@ -1297,7 +1297,7 @@ Retourne le noeud qui est dominé par tous les autres
{ // nullptr means that it's a new block, associated with cache
BasicCacheBlock *bcb = static_cast<BasicCacheBlock *>(b);
f->kind = KIND_CONST;
f->aw.loop_id = -1;
f->aw.loop_id = bcb->getLoopId();
// manage annotations
if (bcb->getType() == HIT)
......@@ -1608,6 +1608,11 @@ Retourne le noeud qui est dominé par tous les autres
category_t cat = CATEGORY(lBlock);
//cout << "\n\tLBlock " << lBlock->id() << " : " << cat << endl;
// get the loop header
Block* header = CATEGORY_HEADER(lBlock);
int loop_id = header != nullptr ? header->id() : -1;
//cout << "Loop id : " << loop_id << endl;
// create a fake array of instructions
NullInst nullInst;
NullInst nullInstArray[1];
......@@ -1622,7 +1627,7 @@ Retourne le noeud qui est dominé par tous les autres
{
case ALWAYS_HIT:
{
BasicCacheBlock *block = new BasicCacheBlock(instsHit, lBlock->id(), basicBlockId, HIT, cat);
BasicCacheBlock *block = new BasicCacheBlock(instsHit, lBlock->id(), basicBlockId, HIT, cat, loop_id);
CFTreeLeaf *leaf = new CFTreeLeaf(block);
return leaf;
break;
......@@ -1630,7 +1635,7 @@ Retourne le noeud qui est dominé par tous les autres
case ALWAYS_MISS:
{
BasicCacheBlock *block = new BasicCacheBlock(instsMiss, lBlock->id(), basicBlockId, MISS, cat);
BasicCacheBlock *block = new BasicCacheBlock(instsMiss, lBlock->id(), basicBlockId, MISS, cat, loop_id);
CFTreeLeaf *leaf = new CFTreeLeaf(block);
return leaf;
break;
......@@ -1638,10 +1643,10 @@ Retourne le noeud qui est dominé par tous les autres
case FIRST_HIT:
{
BasicCacheBlock *blockHit = new BasicCacheBlock(instsHit, lBlock->id(), basicBlockId, HIT, cat);
BasicCacheBlock *blockHit = new BasicCacheBlock(instsHit, lBlock->id(), basicBlockId, HIT, cat, loop_id);
CFTreeLeaf *leafHit = new CFTreeLeaf(blockHit);
BasicCacheBlock *blockMiss = new BasicCacheBlock(instsMiss, lBlock->id(), basicBlockId, MISS, cat);
BasicCacheBlock *blockMiss = new BasicCacheBlock(instsMiss, lBlock->id(), basicBlockId, MISS, cat, loop_id);
CFTreeLeaf *leafMiss = new CFTreeLeaf(blockMiss);
std::vector<CFTree *> *alts = new std::vector<CFTree *>();
......@@ -1654,10 +1659,10 @@ Retourne le noeud qui est dominé par tous les autres
case FIRST_MISS:
{
BasicCacheBlock *blockHit = new BasicCacheBlock(instsHit, lBlock->id(), basicBlockId, HIT, cat);
BasicCacheBlock *blockHit = new BasicCacheBlock(instsHit, lBlock->id(), basicBlockId, HIT, cat, loop_id);
CFTreeLeaf *leafHit = new CFTreeLeaf(blockHit);
BasicCacheBlock *blockMiss = new BasicCacheBlock(instsMiss, lBlock->id(), basicBlockId, MISS, cat);
BasicCacheBlock *blockMiss = new BasicCacheBlock(instsMiss, lBlock->id(), basicBlockId, MISS, cat, loop_id);
CFTreeLeaf *leafMiss = new CFTreeLeaf(blockMiss);
std::vector<CFTree *> *alts = new std::vector<CFTree *>();
......@@ -1671,10 +1676,10 @@ Retourne le noeud qui est dominé par tous les autres
case INVALID_CATEGORY:
case NOT_CLASSIFIED:
{
BasicCacheBlock *blockHit = new BasicCacheBlock(instsHit, lBlock->id(), basicBlockId, HIT, cat);
BasicCacheBlock *blockHit = new BasicCacheBlock(instsHit, lBlock->id(), basicBlockId, HIT, cat, loop_id);
CFTreeLeaf *leafHit = new CFTreeLeaf(blockHit);
BasicCacheBlock *blockMiss = new BasicCacheBlock(instsMiss, lBlock->id(), basicBlockId, MISS, cat);
BasicCacheBlock *blockMiss = new BasicCacheBlock(instsMiss, lBlock->id(), basicBlockId, MISS, cat, loop_id);
CFTreeLeaf *leafMiss = new CFTreeLeaf(blockMiss);
std::vector<CFTree *> *alts = new std::vector<CFTree *>();
......
......@@ -2,7 +2,7 @@
<!DOCTYPE processor SYSTEM "/home/casse/otawa/otawa/data/dtd/cache.dtd">
<cache-config>
<icache>
<block_bits>7</block_bits>
<block_bits>4</block_bits>
<row_bits>1</row_bits>
<way_bits>2</way_bits>
<replace>LRU</replace>
......
......@@ -444,14 +444,16 @@ namespace otawa
CacheBlocType type;
static int penalty;
category_t contextCategory;
int loop_id;
public:
BasicCacheBlock(const Array<Inst *> &insts, int lBlockId, int basicBlockId, CacheBlocType cacheType, category_t lBlockCategory) : BasicBlock(insts)
BasicCacheBlock(const Array<Inst *> &insts, int lBlockId, int basicBlockId, CacheBlocType cacheType, category_t lBlockCategory, int loopId) : BasicBlock(insts)
{
blockId = blockCount++;
lBlock = lBlockId;
type = cacheType;
contextCategory = lBlockCategory;
loop_id = loopId;
bbid = basicBlockId;
//cout << "\t\tCreated BasicCacheBloc with id : " << blockId << endl;
}
......@@ -462,6 +464,7 @@ namespace otawa
static void setPenalty(int value) {penalty = value;}
category_t getContextCategory() const { return contextCategory; }
int getBasicBlockId() const{ return bbid;}
int getLoopId() const{return loop_id;}
};
} // namespace cftree
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment