aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-08-02 09:18:33 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-08-02 09:18:33 +0000
commit686c4a18f1e9f1decdb2d95a2d0f6bf925d55d93 (patch)
tree603adef4996669490ba37e366b8d2524f12bba97
parent83a6d4910238fc70a5fa3e81fc52fd64587e2613 (diff)
Use of vector<bool> causes some horrendous compile time regression (2x)!
Looks like libstdc++ implementation does not scale very well. Switch back to using directly managed arrays. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29469 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/X86ISelDAGToDAG.cpp39
1 files changed, 26 insertions, 13 deletions
diff --git a/lib/Target/X86/X86ISelDAGToDAG.cpp b/lib/Target/X86/X86ISelDAGToDAG.cpp
index 6123e4c629..3896797724 100644
--- a/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -99,7 +99,7 @@ namespace {
: SelectionDAGISel(X86Lowering),
X86Lowering(*TM.getTargetLowering()),
Subtarget(&TM.getSubtarget<X86Subtarget>()),
- DAGSize(0) {}
+ DAGSize(0), ReachabilityMatrix(NULL), ReachMatrixRange(NULL) {}
virtual bool runOnFunction(Function &Fn) {
// Make sure we re-emit a set of the global base reg if necessary
@@ -189,33 +189,35 @@ namespace {
/// ReachabilityMatrix - A N x N matrix representing all pairs reachability
/// information. One bit per potential edge.
- std::vector<bool> ReachabilityMatrix;
+ unsigned char *ReachabilityMatrix;
- /// RMRange - The range of reachability information available for the
- /// particular source node.
- std::vector<unsigned> ReachMatrixRange;
+ /// ReachMatrixRange - The range of reachability information available for
+ /// the particular source node.
+ unsigned *ReachMatrixRange;
inline void setReachable(SDNode *f, SDNode *t) {
unsigned Idx = f->getNodeId() * DAGSize + t->getNodeId();
- ReachabilityMatrix[Idx] = true;
+ ReachabilityMatrix[Idx / 8] |= 1 << (Idx % 8);
}
inline bool isReachable(SDNode *f, SDNode *t) {
unsigned Idx = f->getNodeId() * DAGSize + t->getNodeId();
- return ReachabilityMatrix[Idx];
+ return ReachabilityMatrix[Idx / 8] & (1 << (Idx % 8));
}
/// UnfoldableSet - An boolean array representing nodes which have been
/// folded into addressing modes and therefore should not be folded in
/// another operation.
- std::vector<bool> UnfoldableSet;
+ unsigned char *UnfoldableSet;
inline void setUnfoldable(SDNode *N) {
- UnfoldableSet[N->getNodeId()] = true;
+ unsigned Id = N->getNodeId();
+ UnfoldableSet[Id / 8] |= 1 << (Id % 8);
}
inline bool isUnfoldable(SDNode *N) {
- return UnfoldableSet[N->getNodeId()];
+ unsigned Id = N->getNodeId();
+ return UnfoldableSet[Id / 8] & (1 << (Id % 8));
}
#ifndef NDEBUG
@@ -291,9 +293,14 @@ void X86DAGToDAGISel::InstructionSelectBasicBlock(SelectionDAG &DAG) {
TopOrder = DAG.AssignTopologicalOrder();
DAGSize = TopOrder.size();
- ReachabilityMatrix.assign(DAGSize*DAGSize, false);
- ReachMatrixRange.assign(DAGSize, 0);
- UnfoldableSet.assign(DAGSize, false);
+ unsigned RMSize = (DAGSize * DAGSize + 7) / 8;
+ ReachabilityMatrix = new unsigned char[RMSize];
+ memset(ReachabilityMatrix, 0, RMSize);
+ ReachMatrixRange = new unsigned[DAGSize];
+ memset(ReachMatrixRange, 0, DAGSize * sizeof(unsigned));
+ unsigned NumBytes = (DAGSize + 7) / 8;
+ UnfoldableSet = new unsigned char[NumBytes];
+ memset(UnfoldableSet, 0, NumBytes);
// Codegen the basic block.
#ifndef NDEBUG
@@ -305,6 +312,12 @@ void X86DAGToDAGISel::InstructionSelectBasicBlock(SelectionDAG &DAG) {
DEBUG(std::cerr << "===== Instruction selection ends:\n");
#endif
+ delete[] ReachabilityMatrix;
+ delete[] ReachMatrixRange;
+ delete[] UnfoldableSet;
+ ReachabilityMatrix = NULL;
+ ReachMatrixRange = NULL;
+ UnfoldableSet = NULL;
CodeGenMap.clear();
HandleMap.clear();
ReplaceMap.clear();