Changes in directory llvm/lib/Target/X86:
X86ISelDAGToDAG.cpp updated: 1.81 -> 1.82 --- Log message: Node selected into address mode cannot be folded. --- Diffs of the changes: (+39 -0) X86ISelDAGToDAG.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+) Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.81 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.82 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.81 Thu Jul 27 19:10:59 2006 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Thu Jul 27 19:49:31 2006 @@ -211,6 +211,21 @@ return ReachibilityMatrix[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. + unsigned char *UnfoldableSet; + + inline void setUnfoldable(SDNode *N) { + unsigned Id = N->getNodeId(); + UnfoldableSet[Id / 8] |= 1 << (Id % 8); + } + + inline bool isUnfoldable(SDNode *N) { + unsigned Id = N->getNodeId(); + return UnfoldableSet[Id / 8] & (1 << (Id % 8)); + } + #ifndef NDEBUG unsigned Indent; #endif @@ -218,6 +233,10 @@ } bool X86DAGToDAGISel::IsFoldableBy(SDNode *N, SDNode *U) { + // Is it already folded by SelectAddr / SelectLEAAddr? + if (isUnfoldable(N)) + return false; + // If U use can somehow reach N through another path then U can't fold N or // it will create a cycle. e.g. In the following diagram, U can reach N // through X. If N is foled into into U, then X is both a predecessor and @@ -323,6 +342,10 @@ MachineFunction::iterator FirstMBB = BB; DAGSize = DAG.AssignNodeIds(); + unsigned NumBytes = (DAGSize+7) / 8; + UnfoldableSet = new unsigned char[NumBytes]; + memset(UnfoldableSet, 0, NumBytes); + DetermineTopologicalOrdering(); // Codegen the basic block. @@ -339,9 +362,11 @@ delete[] TopOrder; delete[] IdToOrder; delete[] RMRange; + delete[] UnfoldableSet; ReachibilityMatrix = NULL; TopOrder = NULL; IdToOrder = RMRange = NULL; + UnfoldableSet = NULL; CodeGenMap.clear(); HandleMap.clear(); ReplaceMap.clear(); @@ -615,6 +640,13 @@ getAddressOperands(AM, Base, Scale, Index, Disp); + int Id = Base.Val ? Base.Val->getNodeId() : -1; + if (Id != -1) + setUnfoldable(Base.Val); + Id = Index.Val ? Index.Val->getNodeId() : -1; + if (Id != -1) + setUnfoldable(Index.Val); + return true; } @@ -663,6 +695,13 @@ return true; } + int Id = Base.Val ? Base.Val->getNodeId() : -1; + if (Id != -1) + setUnfoldable(Base.Val); + Id = Index.Val ? Index.Val->getNodeId() : -1; + if (Id != -1) + setUnfoldable(Index.Val); + return false; } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits