gem5
|
#include <trie.hh>
Classes | |
struct | Node |
Public Types | |
typedef Node * | Handle |
Public Member Functions | |
Trie () | |
Handle | insert (Key key, unsigned width, Value *val) |
Method which inserts a key/value pair into the trie. More... | |
Value * | lookup (Key key) |
Method which looks up the Value corresponding to a particular key. More... | |
Value * | remove (Handle handle) |
Method to delete a value from the trie. More... | |
Value * | remove (Key key) |
Method to lookup a value from the trie and then delete it. More... | |
void | clear () |
A method which removes all key/value pairs from the trie. More... | |
void | dump (const char *title) |
A debugging method which prints the contents of this trie. More... | |
Static Public Attributes | |
static const unsigned | MaxBits = sizeof(Key) * 8 |
Protected Attributes | |
Node | head |
Private Member Functions | |
bool | goesAfter (Node **parent, Node *kid, Key key, Key new_mask) |
A utility method which checks whether the key being looked up lies beyond the Node being examined. More... | |
Key | extendMask (Key orig) |
A utility method which extends a mask value one more bit towards the lsb. More... | |
Handle | lookupHandle (Key key) |
Method which looks up the Handle corresponding to a particular key. More... | |
|
inline |
|
inline |
|
inlineprivate |
A utility method which extends a mask value one more bit towards the lsb.
This is almost just a signed right shift, except that the shifted in bits are technically undefined. This is also slightly complicated by the zero case.
orig | The original mask to extend. |
Definition at line 144 of file trie.hh.
Referenced by Trie< Addr, X86ISA::TlbEntry >::insert().
|
inlineprivate |
A utility method which checks whether the key being looked up lies beyond the Node being examined.
If so, it returns true and advances the node being examined.
parent | The node we're currently "at", which can be updated. |
kid | The node we may want to move to. |
key | The key we're looking for. |
new_mask | The mask to use when matching against the key. |
Definition at line 125 of file trie.hh.
Referenced by Trie< Addr, X86ISA::TlbEntry >::insert().
|
inline |
Method which inserts a key/value pair into the trie.
key | The key which can later be used to look up this value. |
width | How many bits of the key (from msb) should be used. |
val | A pointer to the value to store in the trie. |
Definition at line 186 of file trie.hh.
Referenced by X86ISA::TLB::insert(), main(), and X86ISA::TLB::unserialize().
|
inline |
Method which looks up the Value corresponding to a particular key.
key | The key to look up. |
Definition at line 268 of file trie.hh.
Referenced by X86ISA::TLB::demapPage(), X86ISA::TLB::insert(), X86ISA::TLB::lookup(), and main().
Method which looks up the Handle corresponding to a particular key.
This is useful if you want to delete the Handle corresponding to a key since the "remove" function takes a Handle as its argument.
key | The key to look up. |
Definition at line 159 of file trie.hh.
Referenced by Trie< Addr, X86ISA::TlbEntry >::lookup(), and Trie< Addr, X86ISA::TlbEntry >::remove().
Method to delete a value from the trie.
node | A Handle to remove. |
Definition at line 283 of file trie.hh.
Referenced by X86ISA::TLB::demapPage(), X86ISA::TLB::evictLRU(), X86ISA::TLB::flushAll(), X86ISA::TLB::flushNonGlobal(), and main().
|
inline |
Definition at line 103 of file trie.hh.
Referenced by Trie< Addr, X86ISA::TlbEntry >::clear(), Trie< Addr, X86ISA::TlbEntry >::dump(), Trie< Addr, X86ISA::TlbEntry >::insert(), and Trie< Addr, X86ISA::TlbEntry >::lookupHandle().
|
static |
Definition at line 111 of file trie.hh.
Referenced by Trie< Addr, X86ISA::TlbEntry >::extendMask(), and Trie< Addr, X86ISA::TlbEntry >::insert().