Give sentinel traits the right to determine the policy where the sentinel is kept.

This should result in less indirect memory accesses, less dead writes and tighter code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66061 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Gabor Greif
2009-03-04 20:36:44 +00:00
parent 076aee32e8
commit c23b8719ef
7 changed files with 71 additions and 11 deletions

View File

@@ -38,6 +38,9 @@ public:
}
void destroySentinel(MachineInstr *) const {}
MachineInstr *provideInitialHead() const { return createSentinel(); }
MachineInstr *ensureHead(MachineInstr*) const { return createSentinel(); }
void addNodeToList(MachineInstr* N);
void removeNodeFromList(MachineInstr* N);
void transferNodesFromList(ilist_traits &SrcTraits,

View File

@@ -44,6 +44,11 @@ public:
}
void destroySentinel(MachineBasicBlock *) const {}
MachineBasicBlock *provideInitialHead() const { return createSentinel(); }
MachineBasicBlock *ensureHead(MachineBasicBlock*) const {
return createSentinel();
}
void addNodeToList(MachineBasicBlock* MBB);
void removeNodeFromList(MachineBasicBlock* MBB);
void deleteNode(MachineBasicBlock *MBB);
@@ -363,8 +368,12 @@ template <> struct GraphTraits<const MachineFunction*> :
// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
typedef MachineFunction::const_iterator nodes_iterator;
static nodes_iterator nodes_begin(const MachineFunction *F) { return F->begin(); }
static nodes_iterator nodes_end (const MachineFunction *F) { return F->end(); }
static nodes_iterator nodes_begin(const MachineFunction *F) {
return F->begin();
}
static nodes_iterator nodes_end (const MachineFunction *F) {
return F->end();
}
};

View File

@@ -46,6 +46,9 @@ public:
}
static void destroySentinel(SDNode *) {}
SDNode *provideInitialHead() const { return createSentinel(); }
SDNode *ensureHead(SDNode*) const { return createSentinel(); }
static void deleteNode(SDNode *) {
assert(0 && "ilist_traits<SDNode> shouldn't see a deleteNode call!");
}
@@ -112,7 +115,8 @@ class SelectionDAG {
/// setGraphColorHelper - Implementation of setSubgraphColor.
/// Return whether we had to truncate the search.
///
bool setSubgraphColorHelper(SDNode *N, const char *Color, DenseSet<SDNode *> &visited,
bool setSubgraphColorHelper(SDNode *N, const char *Color,
DenseSet<SDNode *> &visited,
int level, bool &printed);
public: