Otawa  0.10
LBlock.h
Go to the documentation of this file.
1 /*
2  * LBlock interface
3  * Copyright (c) 2005-12, IRIT UPS <casse@irit.fr>
4  *
5  * LBlockBuilder class interface
6  * This file is part of OTAWA
7  *
8  * OTAWA is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * OTAWA is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Foobar; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 #ifndef OTAWA_CACHE_LBLOCK_H
23 #define OTAWA_CACHE_LBLOCK_H
24 
25 #include <elm/string.h>
26 #include <elm/genstruct/SLList.h>
27 #include <elm/genstruct/HashTable.h>
28 #include <elm/inhstruct/DLList.h>
29 #include <elm/PreIterator.h>
30 #include <otawa/instruction.h>
31 //#include <otawa/ccg/Node.h>
32 #include <otawa/cfg/BasicBlock.h>
33 #include <otawa/ilp/Var.h>
34 //#include <otawa/cache/categorisation/CATNode.h>
35 #include <otawa/hard/Cache.h>
36 
37 namespace otawa {
38 
39 // Extern classes
40 class LBlockSet;
41 
42 // LBlock class
43 class LBlock: public elm::inhstruct::DLNode, public PropList {
44  friend class LBlockSet;
45 public:
46  LBlock(LBlockSet *set, BasicBlock *bb, Inst *inst, t::uint32 size, int cache_index);
47  inline int index(void) const { return idx; }
48  inline Address address(void) const { return _inst->address(); }
49  inline BasicBlock *bb(void) const { return _bb; }
50  inline ot::size size(void) const { return _size; }
51  //inline bool sameCacheBlock(const LBlock *block) const { return cacheBlock() == block->cacheBlock(); }
52  inline LBlockSet *lblockset(void) const { return lbs; }
53  int countInsts(void);
54  inline int cacheBlock(void) const { return cid - 1; }
55  inline Inst *instruction(void) const { return _inst; }
56 
57  // deprecated
58  inline int number(void) const { return idx; }
59  inline int id(void) { return idx; }
60  inline int cacheblock(void) const { return cid; }
61 
62 private:
63  ~LBlock(void);
68  int idx, cid;
69 };
70 
71 Output& operator<<(Output& out, const LBlock *block);
72 
73 } // otawa
74 
75 #endif // OTAWA_CACHE_LBLOCK_H
struct otawa::sem::inst inst
void set(T *target, int size, const T &v)
Address address(void) const
Definition: LBlock.h:48
int idx
Definition: LBlock.h:68
int countInsts(void)
Count the instructions in the l-block.
Definition: cache_LBlock.cpp:78
Inst * instruction(void) const
Definition: LBlock.h:55
int id(void)
Definition: LBlock.h:59
elm::io::Output & operator<<(elm::io::Output &out, Address addr)
Definition: base.cpp:188
LBlockSet * lblockset(void) const
Definition: LBlock.h:52
ot::size size(void) const
Get the size of the current l-block.
Definition: LBlock.h:50
Inst * _inst
Definition: LBlock.h:65
uint32 size
t::uint32 size
Definition: base.h:46
BasicBlock * bb(void) const
Definition: LBlock.h:49
The l-block is an abstraction allowing to split the basic block according to the bound of the cache b...
Definition: LBlock.h:43
The representation of an address in OTAWA.
Definition: base.h:54
t::uint32 _size
Definition: LBlock.h:66
virtual address_t address(void) const =0
Get the address of the item .
sys::SystemOutStream & out
This class represents the list of l-blocks of a task for a chosen cache row.
Definition: LBlockSet.h:38
int cacheblock(void) const
Definition: LBlock.h:60
BasicBlock * _bb
Definition: LBlock.h:67
int number(void) const
Get the number of the LBlock in its cache row.
Definition: LBlock.h:58
This is the minimal definition of a basic block.
Definition: BasicBlock.h:43
This class represents assembly instruction of a piece of code.
Definition: Inst.h:62
This a list of properties.
Definition: PropList.h:63
~LBlock(void)
Definition: cache_LBlock.cpp:62
LBlock(LBlockSet *set, BasicBlock *bb, Inst *inst, t::uint32 size, int cache_index)
Build a new LBlock.
Definition: cache_LBlock.cpp:47
int cid
Definition: LBlock.h:68
int index(void) const
Definition: LBlock.h:47
uint32_t uint32
int cacheBlock(void) const
Compute the cache block of this L-block.
Definition: LBlock.h:54
LBlockSet * lbs
Definition: LBlock.h:64