[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.403 - 1.404 --- Log message: Add explicit qualification for namespace MVT members. --- Diffs of the changes: (+1 -1) SelectionDAG.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.403 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.404 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.403Tue Apr 24 19:00:45 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu May 24 09:33:05 2007 @@ -3048,7 +3048,7 @@ else cerr null: M-getOffset() ; } else if (const VTSDNode *N = dyn_castVTSDNode(this)) { -cerr : getValueTypeString(N-getVT()); +cerr : MVT::getValueTypeString(N-getVT()); } else if (const LoadSDNode *LD = dyn_castLoadSDNode(this)) { bool doExt = true; switch (LD-getExtensionType()) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.402 - 1.403 --- Log message: Be more careful about folding op(x, undef) when we have vector operands. This fixes CodeGen/X86/2007-04-24-VectorCrash.ll --- Diffs of the changes: (+16 -9) SelectionDAG.cpp | 25 - 1 files changed, 16 insertions(+), 9 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.402 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.403 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.402Sun Apr 22 18:15:30 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Apr 24 19:00:45 2007 @@ -1294,13 +1294,8 @@ double F; uint64_t I; } u1; -union { - double F; - int64_t I; -} u2; u1.F = C1; -u2.F = C2; -if (u2.I 0) // Sign bit of RHS set? +if (int64_t(DoubleToBits(C2)) 0) // Sign bit of RHS set? u1.I |= 1ULL 63; // Set the sign bit of the LHS. else u1.I = (1ULL 63)-1; // Clear the sign bit of the LHS. @@ -1336,7 +1331,11 @@ case ISD::SREM: case ISD::SRL: case ISD::SHL: -return getConstant(0, VT);// fold op(undef, arg2) - 0 +if (!MVT::isVector(VT)) + return getConstant(0, VT);// fold op(undef, arg2) - 0 +// For vectors, we can't easily build an all zero vector, just return +// the LHS. +return N2; } } } @@ -1363,9 +1362,17 @@ case ISD::AND: case ISD::SRL: case ISD::SHL: - return getConstant(0, VT); // fold op(arg1, undef) - 0 + if (!MVT::isVector(VT)) +return getConstant(0, VT); // fold op(arg1, undef) - 0 + // For vectors, we can't easily build an all zero vector, just return + // the LHS. + return N1; case ISD::OR: - return getConstant(MVT::getIntVTBitMask(VT), VT); + if (!MVT::isVector(VT)) +return getConstant(MVT::getIntVTBitMask(VT), VT); + // For vectors, we can't easily build an all one vector, just return + // the LHS. + return N1; case ISD::SRA: return N1; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.400 - 1.401 --- Log message: X86 TLS: Implement review feedback. --- Diffs of the changes: (+11 -1) SelectionDAG.cpp | 12 +++- 1 files changed, 11 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.400 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.401 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.400Sat Apr 21 13:36:27 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Apr 21 15:56:26 2007 @@ -13,7 +13,6 @@ #include llvm/CodeGen/SelectionDAG.h #include llvm/Constants.h -#include llvm/GlobalValue.h #include llvm/GlobalVariable.h #include llvm/Intrinsics.h #include llvm/Assembly/Writer.h @@ -2573,6 +2572,17 @@ MorphNodeTo(ISD::HANDLENODE, VTs, 0, 0); // Drops operand uses. } +GlobalAddressSDNode::GlobalAddressSDNode(bool isTarget, const GlobalValue *GA, + MVT::ValueType VT, int o) + : SDNode(isaGlobalVariable(GA) + dyn_castGlobalVariable(GA)-isThreadLocal() ? + // Thread Local + (isTarget ? ISD::TargetGlobalTLSAddress : ISD::GlobalTLSAddress) : + // Non Thread Local + (isTarget ? ISD::TargetGlobalAddress : ISD::GlobalAddress), + getSDVTList(VT)), Offset(o) { + TheGlobal = const_castGlobalValue*(GA); +} /// Profile - Gather unique data for the node. /// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.395 - 1.396 --- Log message: add some assertions --- Diffs of the changes: (+13 -0) SelectionDAG.cpp | 13 + 1 files changed, 13 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.395 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.396 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.395Sun Apr 1 02:32:19 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Apr 9 00:23:13 2007 @@ -1046,19 +1046,30 @@ switch (Opcode) { case ISD::TokenFactor: return Operand; // Factor of one node? No factor. + case ISD::FP_ROUND: + case ISD::FP_EXTEND: +assert(MVT::isFloatingPoint(VT) + MVT::isFloatingPoint(Operand.getValueType()) Invalid FP cast!); +break; case ISD::SIGN_EXTEND: +assert(MVT::isInteger(VT) MVT::isInteger(Operand.getValueType()) + Invalid SIGN_EXTEND!); if (Operand.getValueType() == VT) return Operand; // noop extension assert(Operand.getValueType() VT Invalid sext node, dst src!); if (OpOpcode == ISD::SIGN_EXTEND || OpOpcode == ISD::ZERO_EXTEND) return getNode(OpOpcode, VT, Operand.Val-getOperand(0)); break; case ISD::ZERO_EXTEND: +assert(MVT::isInteger(VT) MVT::isInteger(Operand.getValueType()) + Invalid ZERO_EXTEND!); if (Operand.getValueType() == VT) return Operand; // noop extension assert(Operand.getValueType() VT Invalid zext node, dst src!); if (OpOpcode == ISD::ZERO_EXTEND) // (zext (zext x)) - (zext x) return getNode(ISD::ZERO_EXTEND, VT, Operand.Val-getOperand(0)); break; case ISD::ANY_EXTEND: +assert(MVT::isInteger(VT) MVT::isInteger(Operand.getValueType()) + Invalid ANY_EXTEND!); if (Operand.getValueType() == VT) return Operand; // noop extension assert(Operand.getValueType() VT Invalid anyext node, dst src!); if (OpOpcode == ISD::ZERO_EXTEND || OpOpcode == ISD::SIGN_EXTEND) @@ -1066,6 +1077,8 @@ return getNode(OpOpcode, VT, Operand.Val-getOperand(0)); break; case ISD::TRUNCATE: +assert(MVT::isInteger(VT) MVT::isInteger(Operand.getValueType()) + Invalid TRUNCATE!); if (Operand.getValueType() == VT) return Operand; // noop truncate assert(Operand.getValueType() VT Invalid truncate node, src dst!); if (OpOpcode == ISD::TRUNCATE) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.394 - 1.395 --- Log message: For PR1297: http://llvm.org/PR1297 : Change getOperationName to return std::string instead of const char* --- Diffs of the changes: (+1 -1) SelectionDAG.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.394 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.395 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.394Fri Mar 30 16:38:07 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Apr 1 02:32:19 2007 @@ -2644,7 +2644,7 @@ return castConstantSDNode(OperandList[Num])-getValue(); } -const char *SDNode::getOperationName(const SelectionDAG *G) const { +std::string SDNode::getOperationName(const SelectionDAG *G) const { switch (getOpcode()) { default: if (getOpcode() ISD::BUILTIN_OP_END) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.391 - 1.392 --- Log message: eliminate some ops if they have an undef RHS --- Diffs of the changes: (+2 -0) SelectionDAG.cpp |2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.391 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.392 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.391Sun Feb 25 02:24:27 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Mar 4 14:01:46 2007 @@ -1325,6 +1325,8 @@ if (N2.getOpcode() == ISD::UNDEF) { switch (Opcode) { case ISD::ADD: +case ISD::ADDC: +case ISD::ADDE: case ISD::SUB: case ISD::FADD: case ISD::FSUB: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.390 - 1.391 --- Log message: fold trivial token factor nodes. This allows us to compile test/CodeGen/X86/fp-stack-ret.ll into: movl 4(%esp), %eax fldl (%eax) ret instead of: subl $12, %esp movl 16(%esp), %eax movsd (%eax), %xmm0 movsd %xmm0, (%esp) fldl (%esp) addl $12, %esp ret by eliminating a token factor that blocked a check. --- Diffs of the changes: (+6 -0) SelectionDAG.cpp |6 ++ 1 files changed, 6 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.390 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.391 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.390Wed Feb 21 16:53:45 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Feb 25 02:24:27 2007 @@ -1351,6 +1351,12 @@ // Fold operations. switch (Opcode) { + case ISD::TokenFactor: +// Fold trivial token factors. +if (N1.getOpcode() == ISD::EntryToken) return N2; +if (N2.getOpcode() == ISD::EntryToken) return N1; +break; + case ISD::AND: // (X 0) - 0. This commonly occurs when legalizing i64 values, so it's // worth handling here. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.388 - 1.389 --- Log message: Introduce new UnarySDNode/BinarySDNode/TernarySDNode nodes, which coallocate their operands with the node itself. This reduces malloc traffic for operand lists. This reduces isel time on kc++ from 2.6164 to 2.5570s, about 2.3%. --- Diffs of the changes: (+29 -12) SelectionDAG.cpp | 41 + 1 files changed, 29 insertions(+), 12 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.388 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.389 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.388Sun Feb 4 01:37:24 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Feb 4 02:35:21 2007 @@ -939,7 +939,7 @@ void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); - SDNode *N = new SDNode(Opcode, SDNode::getSDVTList(VT), 0, 0); + SDNode *N = new SDNode(Opcode, SDNode::getSDVTList(VT)); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); @@ -1113,17 +1113,17 @@ SDNode *N; SDVTList VTs = getVTList(VT); - SDOperand Ops[1] = { Operand }; if (VT != MVT::Flag) { // Don't CSE flag producing nodes FoldingSetNodeID ID; +SDOperand Ops[1] = { Operand }; AddNodeIDNode(ID, Opcode, VTs, Ops, 1); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); -N = new SDNode(Opcode, VTs, Ops, 1); +N = new UnarySDNode(Opcode, VTs, Operand); CSEMap.InsertNode(N, IP); } else { -N = new SDNode(Opcode, VTs, Ops, 1); +N = new UnarySDNode(Opcode, VTs, Operand); } AllNodes.push_back(N); return SDOperand(N, 0); @@ -1413,17 +1413,17 @@ // Memoize this node if possible. SDNode *N; SDVTList VTs = getVTList(VT); - SDOperand Ops[] = { N1, N2 }; if (VT != MVT::Flag) { +SDOperand Ops[] = { N1, N2 }; FoldingSetNodeID ID; AddNodeIDNode(ID, Opcode, VTs, Ops, 2); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); -N = new SDNode(Opcode, VTs, Ops, 2); +N = new BinarySDNode(Opcode, VTs, N1, N2); CSEMap.InsertNode(N, IP); } else { -N = new SDNode(Opcode, VTs, Ops, 2); +N = new BinarySDNode(Opcode, VTs, N1, N2); } AllNodes.push_back(N); @@ -1470,17 +1470,17 @@ // Memoize node if it doesn't produce a flag. SDNode *N; SDVTList VTs = getVTList(VT); - SDOperand Ops[] = { N1, N2, N3 }; if (VT != MVT::Flag) { +SDOperand Ops[] = { N1, N2, N3 }; FoldingSetNodeID ID; AddNodeIDNode(ID, Opcode, VTs, Ops, 3); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); -N = new SDNode(Opcode, VTs, Ops, 3); +N = new TernarySDNode(Opcode, VTs, N1, N2, N3); CSEMap.InsertNode(N, IP); } else { -N = new SDNode(Opcode, VTs, Ops, 3); +N = new TernarySDNode(Opcode, VTs, N1, N2, N3); } AllNodes.push_back(N); return SDOperand(N, 0); @@ -1809,10 +1809,24 @@ void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); -N = new SDNode(Opcode, VTList, Ops, NumOps); +if (NumOps == 1) + N = new UnarySDNode(Opcode, VTList, Ops[0]); +else if (NumOps == 2) + N = new BinarySDNode(Opcode, VTList, Ops[0], Ops[1]); +else if (NumOps == 3) + N = new TernarySDNode(Opcode, VTList, Ops[0], Ops[1], Ops[2]); +else + N = new SDNode(Opcode, VTList, Ops, NumOps); CSEMap.InsertNode(N, IP); } else { -N = new SDNode(Opcode, VTList, Ops, NumOps); +if (NumOps == 1) + N = new UnarySDNode(Opcode, VTList, Ops[0]); +else if (NumOps == 2) + N = new BinarySDNode(Opcode, VTList, Ops[0], Ops[1]); +else if (NumOps == 3) + N = new TernarySDNode(Opcode, VTList, Ops[0], Ops[1], Ops[2]); +else + N = new SDNode(Opcode, VTList, Ops, NumOps); } AllNodes.push_back(N); return SDOperand(N, 0); @@ -2490,6 +2504,9 @@ // Out-of-line virtual method to give class a home. void SDNode::ANCHOR() {} +void UnarySDNode::ANCHOR() {} +void BinarySDNode::ANCHOR() {} +void TernarySDNode::ANCHOR() {} void HandleSDNode::ANCHOR() {} void StringSDNode::ANCHOR() {} void ConstantSDNode::ANCHOR() {} ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.381 - 1.382 --- Log message: Eliminate some std::sets. This speeds up isel of kimwitu by about 0.9% --- Diffs of the changes: (+6 -6) SelectionDAG.cpp | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.381 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.382 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.381Sat Feb 3 18:14:31 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Feb 3 18:24:41 2007 @@ -24,9 +24,9 @@ #include llvm/Target/TargetInstrInfo.h #include llvm/Target/TargetMachine.h #include llvm/ADT/SetVector.h +#include llvm/ADT/SmallPtrSet.h #include llvm/ADT/SmallVector.h #include llvm/ADT/StringExtras.h -#include set #include algorithm #include cmath using namespace llvm; @@ -2548,12 +2548,12 @@ SDOperand TheValue(const_castSDNode *(this), Value); - std::setSDNode* UsersHandled; + SmallPtrSetSDNode*, 32 UsersHandled; for (SDNode::use_iterator UI = Uses.begin(), E = Uses.end(); UI != E; ++UI) { SDNode *User = *UI; if (User-getNumOperands() == 1 || -UsersHandled.insert(User).second) // First time we've seen this? +UsersHandled.insert(User)) // First time we've seen this? for (unsigned i = 0, e = User-getNumOperands(); i != e; ++i) if (User-getOperand(i) == TheValue) { if (NUses == 0) @@ -2599,8 +2599,8 @@ } static void findPredecessor(SDNode *N, const SDNode *P, bool found, -std::setSDNode * Visited) { - if (found || !Visited.insert(N).second) +SmallPtrSetSDNode *, 32 Visited) { + if (found || !Visited.insert(N)) return; for (unsigned i = 0, e = N-getNumOperands(); !found i != e; ++i) { @@ -2618,7 +2618,7 @@ /// up the operands. /// NOTE: this is an expensive method. Use it carefully. bool SDNode::isPredecessor(SDNode *N) const { - std::setSDNode * Visited; + SmallPtrSetSDNode *, 32 Visited; bool found = false; findPredecessor(N, this, found, Visited); return found; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.382 - 1.383 --- Log message: Give each selectiondag node class a home for it's vtable and rtti info --- Diffs of the changes: (+17 -2) SelectionDAG.cpp | 19 +-- 1 files changed, 17 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.382 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.383 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.382Sat Feb 3 18:24:41 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Feb 3 20:23:32 2007 @@ -2518,8 +2518,23 @@ //===--===// // Out-of-line virtual method to give class a home. -void SDNode::ANCHOR() { -} +void SDNode::ANCHOR() {} +void HandleSDNode::ANCHOR() {} +void StringSDNode::ANCHOR() {} +void ConstantSDNode::ANCHOR() {} +void ConstantFPSDNode::ANCHOR() {} +void GlobalAddressSDNode::ANCHOR() {} +void FrameIndexSDNode::ANCHOR() {} +void JumpTableSDNode::ANCHOR() {} +void ConstantPoolSDNode::ANCHOR() {} +void BasicBlockSDNode::ANCHOR() {} +void SrcValueSDNode::ANCHOR() {} +void RegisterSDNode::ANCHOR() {} +void ExternalSymbolSDNode::ANCHOR() {} +void CondCodeSDNode::ANCHOR() {} +void VTSDNode::ANCHOR() {} +void LoadSDNode::ANCHOR() {} +void StoreSDNode::ANCHOR() {} /// Profile - Gather unique data for the node. /// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.383 - 1.384 --- Log message: eliminate some extraneous methods in SDNode --- Diffs of the changes: (+16 -5) SelectionDAG.cpp | 21 - 1 files changed, 16 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.383 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.384 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.383Sat Feb 3 20:23:32 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Feb 3 20:32:44 2007 @@ -2103,9 +2103,11 @@ return ON; RemoveNodeFromCSEMaps(N); + SDOperand OperandList[] = { Op1 }; + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); N-setValueTypes(VTs); - N-setOperands(Op1); + N-setOperands(OperandList, 1); CSEMap.InsertNode(N, IP); return N; } @@ -2122,9 +2124,12 @@ return ON; RemoveNodeFromCSEMaps(N); + + SDOperand OperandList[] = { Op1, Op2 }; + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); N-setValueTypes(VTs); - N-setOperands(Op1, Op2); + N-setOperands(OperandList, 2); CSEMap.InsertNode(N, IP); // Memoize the new node. return N; @@ -2142,9 +2147,11 @@ return ON; RemoveNodeFromCSEMaps(N); + + SDOperand OperandList[] = { Op1, Op2, Op3 }; N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); N-setValueTypes(VTs); - N-setOperands(Op1, Op2, Op3); + N-setOperands(OperandList, 3); CSEMap.InsertNode(N, IP); // Memoize the new node. return N; @@ -2181,9 +2188,11 @@ return ON; RemoveNodeFromCSEMaps(N); + + SDOperand OperandList[] = { Op1, Op2 }; N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); N-setValueTypes(VTs); - N-setOperands(Op1, Op2); + N-setOperands(OperandList, 2); CSEMap.InsertNode(N, IP); // Memoize the new node. return N; @@ -2202,9 +2211,11 @@ return ON; RemoveNodeFromCSEMaps(N); + + SDOperand OperandList[] = { Op1, Op2, Op3 }; N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); N-setValueTypes(VTs); - N-setOperands(Op1, Op2, Op3); + N-setOperands(OperandList, 3); CSEMap.InsertNode(N, IP); // Memoize the new node. return N; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.384 - 1.385 --- Log message: simplify MorphNodeTo to take a VTList operand. --- Diffs of the changes: (+13 -14) SelectionDAG.cpp | 27 +-- 1 files changed, 13 insertions(+), 14 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.384 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.385 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.384Sat Feb 3 20:32:44 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Feb 3 20:41:42 2007 @@ -2085,8 +2085,7 @@ RemoveNodeFromCSEMaps(N); - N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); - N-setValueTypes(VTs); + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs); CSEMap.InsertNode(N, IP); return N; @@ -2105,8 +2104,7 @@ RemoveNodeFromCSEMaps(N); SDOperand OperandList[] = { Op1 }; - N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); - N-setValueTypes(VTs); + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs); N-setOperands(OperandList, 1); CSEMap.InsertNode(N, IP); return N; @@ -2127,8 +2125,7 @@ SDOperand OperandList[] = { Op1, Op2 }; - N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); - N-setValueTypes(VTs); + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs); N-setOperands(OperandList, 2); CSEMap.InsertNode(N, IP); // Memoize the new node. @@ -2149,8 +2146,7 @@ RemoveNodeFromCSEMaps(N); SDOperand OperandList[] = { Op1, Op2, Op3 }; - N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); - N-setValueTypes(VTs); + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs); N-setOperands(OperandList, 3); CSEMap.InsertNode(N, IP); // Memoize the new node. @@ -2169,8 +2165,7 @@ return ON; RemoveNodeFromCSEMaps(N); - N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); - N-setValueTypes(VTs); + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs); N-setOperands(Ops, NumOps); CSEMap.InsertNode(N, IP); // Memoize the new node. @@ -2190,8 +2185,7 @@ RemoveNodeFromCSEMaps(N); SDOperand OperandList[] = { Op1, Op2 }; - N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); - N-setValueTypes(VTs); + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs); N-setOperands(OperandList, 2); CSEMap.InsertNode(N, IP); // Memoize the new node. @@ -2213,8 +2207,7 @@ RemoveNodeFromCSEMaps(N); SDOperand OperandList[] = { Op1, Op2, Op3 }; - N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); - N-setValueTypes(VTs); + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs); N-setOperands(OperandList, 3); CSEMap.InsertNode(N, IP); // Memoize the new node. @@ -2547,6 +2540,12 @@ void LoadSDNode::ANCHOR() {} void StoreSDNode::ANCHOR() {} +HandleSDNode::~HandleSDNode() { + SDVTList VTs = { 0, 0 }; + MorphNodeTo(ISD::HANDLENODE, VTs); // Drops operand uses. +} + + /// Profile - Gather unique data for the node. /// void SDNode::Profile(FoldingSetNodeID ID) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.385 - 1.386 --- Log message: move MorphNode to out of line and merge setNodeOperands into it. There is no behavior or performance change here. --- Diffs of the changes: (+34 -15) SelectionDAG.cpp | 49 ++--- 1 files changed, 34 insertions(+), 15 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.385 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.386 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.385Sat Feb 3 20:41:42 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Feb 3 20:49:29 2007 @@ -2064,7 +2064,32 @@ } - +/// MorphNodeTo - This frees the operands of the current node, resets the +/// opcode, types, and operands to the specified value. This should only be +/// used by the SelectionDAG class. +void SDNode::MorphNodeTo(unsigned Opc, SDVTList L, + const SDOperand *Ops, unsigned NumOps) { + NodeType = Opc; + ValueList = L.VTs; + NumValues = L.NumVTs; + + // Clear the operands list, updating used nodes to remove this from their + // use list. + for (op_iterator I = op_begin(), E = op_end(); I != E; ++I) +I-Val-removeUser(this); + delete [] OperandList; + + + // Assign the new operands. + NumOperands = NumOps; + OperandList = NumOperands ? new SDOperand[NumOperands] : 0; + + for (unsigned i = 0, e = NumOps; i != e; ++i) { +OperandList[i] = Ops[i]; +SDNode *N = OperandList[i].Val; +N-Uses.push_back(this); + } +} /// SelectNodeTo - These are used for target selectors to *mutate* the /// specified node to have the specified return type, Target opcode, and @@ -2085,7 +2110,7 @@ RemoveNodeFromCSEMaps(N); - N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs); + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, 0, 0); CSEMap.InsertNode(N, IP); return N; @@ -2104,8 +2129,7 @@ RemoveNodeFromCSEMaps(N); SDOperand OperandList[] = { Op1 }; - N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs); - N-setOperands(OperandList, 1); + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, OperandList, 1); CSEMap.InsertNode(N, IP); return N; } @@ -2125,8 +2149,7 @@ SDOperand OperandList[] = { Op1, Op2 }; - N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs); - N-setOperands(OperandList, 2); + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, OperandList, 2); CSEMap.InsertNode(N, IP); // Memoize the new node. return N; @@ -2146,8 +2169,7 @@ RemoveNodeFromCSEMaps(N); SDOperand OperandList[] = { Op1, Op2, Op3 }; - N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs); - N-setOperands(OperandList, 3); + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, OperandList, 3); CSEMap.InsertNode(N, IP); // Memoize the new node. return N; @@ -2165,8 +2187,7 @@ return ON; RemoveNodeFromCSEMaps(N); - N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs); - N-setOperands(Ops, NumOps); + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, Ops, NumOps); CSEMap.InsertNode(N, IP); // Memoize the new node. return N; @@ -2185,8 +2206,7 @@ RemoveNodeFromCSEMaps(N); SDOperand OperandList[] = { Op1, Op2 }; - N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs); - N-setOperands(OperandList, 2); + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, OperandList, 2); CSEMap.InsertNode(N, IP); // Memoize the new node. return N; @@ -2207,8 +2227,7 @@ RemoveNodeFromCSEMaps(N); SDOperand OperandList[] = { Op1, Op2, Op3 }; - N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs); - N-setOperands(OperandList, 3); + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, OperandList, 3); CSEMap.InsertNode(N, IP); // Memoize the new node. return N; @@ -2542,7 +2561,7 @@ HandleSDNode::~HandleSDNode() { SDVTList VTs = { 0, 0 }; - MorphNodeTo(ISD::HANDLENODE, VTs); // Drops operand uses. + MorphNodeTo(ISD::HANDLENODE, VTs, 0, 0); // Drops operand uses. } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.386 - 1.387 --- Log message: eliminate a bunch of duplicate ctors and helper functions. --- Diffs of the changes: (+81 -116) SelectionDAG.cpp | 197 ++- 1 files changed, 81 insertions(+), 116 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.386 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.387 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.386Sat Feb 3 20:49:29 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Feb 4 01:28:00 2007 @@ -257,66 +257,16 @@ ID.AddPointer(VTList.VTs); } -/// AddNodeIDOperand - Add an operands data to the NodeID data. -/// -static void AddNodeIDOperand(FoldingSetNodeID ID, SDOperand Op) { - ID.AddPointer(Op.Val); - ID.AddInteger(Op.ResNo); -} - /// AddNodeIDOperands - Various routines for adding operands to the NodeID data. /// -static void AddNodeIDOperands(FoldingSetNodeID ID) { -} -static void AddNodeIDOperands(FoldingSetNodeID ID, SDOperand Op) { - AddNodeIDOperand(ID, Op); -} -static void AddNodeIDOperands(FoldingSetNodeID ID, - SDOperand Op1, SDOperand Op2) { - AddNodeIDOperand(ID, Op1); - AddNodeIDOperand(ID, Op2); -} -static void AddNodeIDOperands(FoldingSetNodeID ID, - SDOperand Op1, SDOperand Op2, SDOperand Op3) { - AddNodeIDOperand(ID, Op1); - AddNodeIDOperand(ID, Op2); - AddNodeIDOperand(ID, Op3); -} static void AddNodeIDOperands(FoldingSetNodeID ID, const SDOperand *Ops, unsigned NumOps) { - for (; NumOps; --NumOps, ++Ops) -AddNodeIDOperand(ID, *Ops); + for (; NumOps; --NumOps, ++Ops) { +ID.AddPointer(Ops-Val); +ID.AddInteger(Ops-ResNo); + } } -/// AddNodeIDOperands - Various routines for adding node info to the NodeID -/// data. -static void AddNodeIDNode(FoldingSetNodeID ID, - unsigned short OpC, SDVTList VTList) { - AddNodeIDOpcode(ID, OpC); - AddNodeIDValueTypes(ID, VTList); - AddNodeIDOperands(ID); -} -static void AddNodeIDNode(FoldingSetNodeID ID, - unsigned short OpC, SDVTList VTList, - SDOperand Op) { - AddNodeIDOpcode(ID, OpC); - AddNodeIDValueTypes(ID, VTList); - AddNodeIDOperands(ID, Op); -} -static void AddNodeIDNode(FoldingSetNodeID ID, - unsigned short OpC, SDVTList VTList, - SDOperand Op1, SDOperand Op2) { - AddNodeIDOpcode(ID, OpC); - AddNodeIDValueTypes(ID, VTList); - AddNodeIDOperands(ID, Op1, Op2); -} -static void AddNodeIDNode(FoldingSetNodeID ID, - unsigned short OpC, SDVTList VTList, - SDOperand Op1, SDOperand Op2, SDOperand Op3) { - AddNodeIDOpcode(ID, OpC); - AddNodeIDValueTypes(ID, VTList); - AddNodeIDOperands(ID, Op1, Op2, Op3); -} static void AddNodeIDNode(FoldingSetNodeID ID, unsigned short OpC, SDVTList VTList, const SDOperand *OpList, unsigned N) { @@ -447,7 +397,8 @@ if (Operand-use_empty()) DeadNodes.push_back(Operand); } -delete[] N-OperandList; +if (N-OperandsNeedDelete) + delete[] N-OperandList; N-OperandList = 0; N-NumOperands = 0; @@ -482,7 +433,8 @@ if (Operand-use_empty()) DeadNodes.push_back(Operand); } -delete[] N-OperandList; +if (N-OperandsNeedDelete) + delete[] N-OperandList; N-OperandList = 0; N-NumOperands = 0; @@ -511,7 +463,8 @@ // Drop all of the operands and decrement used nodes use counts. for (SDNode::op_iterator I = N-op_begin(), E = N-op_end(); I != E; ++I) I-Val-removeUser(N); - delete[] N-OperandList; + if (N-OperandsNeedDelete) +delete[] N-OperandList; N-OperandList = 0; N-NumOperands = 0; @@ -598,8 +551,9 @@ if (N-getValueType(i) == MVT::Flag) return 0; // Never CSE anything that produces a flag. + SDOperand Ops[] = { Op }; FoldingSetNodeID ID; - AddNodeIDNode(ID, N-getOpcode(), N-getVTList(), Op); + AddNodeIDNode(ID, N-getOpcode(), N-getVTList(), Ops, 1); return CSEMap.FindNodeOrInsertPos(ID, InsertPos); } @@ -618,8 +572,9 @@ if (N-getValueType(i) == MVT::Flag) return 0; // Never CSE anything that produces a flag. + SDOperand Ops[] = { Op1, Op2 }; FoldingSetNodeID ID; - AddNodeIDNode(ID, N-getOpcode(), N-getVTList(), Op1, Op2); + AddNodeIDNode(ID, N-getOpcode(), N-getVTList(), Ops, 2); return CSEMap.FindNodeOrInsertPos(ID, InsertPos); } @@ -640,7 +595,7 @@ return 0; // Never CSE anything that produces a flag. FoldingSetNodeID ID; - AddNodeIDNode(ID, N-getOpcode(), N-getVTList()); + AddNodeIDNode(ID, N-getOpcode(), N-getVTList(), 0, 0); if
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.387 - 1.388 --- Log message: eliminate the SDNode::setValueTypes method. --- Diffs of the changes: (+17 -34) SelectionDAG.cpp | 51 +-- 1 files changed, 17 insertions(+), 34 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.387 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.388 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.387Sun Feb 4 01:28:00 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Feb 4 01:37:24 2007 @@ -939,8 +939,7 @@ void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); - SDNode *N = new SDNode(Opcode, 0, 0); - N-setValueTypes(SDNode::getSDVTList(VT)); + SDNode *N = new SDNode(Opcode, SDNode::getSDVTList(VT), 0, 0); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); @@ -1121,12 +1120,10 @@ void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); -N = new SDNode(Opcode, Ops, 1); -N-setValueTypes(VTs); +N = new SDNode(Opcode, VTs, Ops, 1); CSEMap.InsertNode(N, IP); } else { -N = new SDNode(Opcode, Ops, 1); -N-setValueTypes(VTs); +N = new SDNode(Opcode, VTs, Ops, 1); } AllNodes.push_back(N); return SDOperand(N, 0); @@ -1423,12 +1420,10 @@ void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); -N = new SDNode(Opcode, Ops, 2); -N-setValueTypes(VTs); +N = new SDNode(Opcode, VTs, Ops, 2); CSEMap.InsertNode(N, IP); } else { -N = new SDNode(Opcode, Ops, 2); -N-setValueTypes(VTs); +N = new SDNode(Opcode, VTs, Ops, 2); } AllNodes.push_back(N); @@ -1482,12 +1477,10 @@ void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); -N = new SDNode(Opcode, Ops, 3); -N-setValueTypes(VTs); +N = new SDNode(Opcode, VTs, Ops, 3); CSEMap.InsertNode(N, IP); } else { -N = new SDNode(Opcode, Ops, 3); -N-setValueTypes(VTs); +N = new SDNode(Opcode, VTs, Ops, 3); } AllNodes.push_back(N); return SDOperand(N, 0); @@ -1528,10 +1521,9 @@ void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); - SDNode *N = new LoadSDNode(Ops, ISD::UNINDEXED, + SDNode *N = new LoadSDNode(Ops, VTs, ISD::UNINDEXED, ISD::NON_EXTLOAD, VT, SV, SVOffset, Alignment, isVolatile); - N-setValueTypes(VTs); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDOperand(N, 0); @@ -1573,9 +1565,8 @@ void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); - SDNode *N = new LoadSDNode(Ops, ISD::UNINDEXED, ExtType, EVT, + SDNode *N = new LoadSDNode(Ops, VTs, ISD::UNINDEXED, ExtType, EVT, SV, SVOffset, Alignment, isVolatile); - N-setValueTypes(VTs); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDOperand(N, 0); @@ -1602,11 +1593,10 @@ void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); - SDNode *N = new LoadSDNode(Ops, AM, + SDNode *N = new LoadSDNode(Ops, VTs, AM, LD-getExtensionType(), LD-getLoadedVT(), LD-getSrcValue(), LD-getSrcValueOffset(), LD-getAlignment(), LD-isVolatile()); - N-setValueTypes(VTs); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDOperand(N, 0); @@ -1642,9 +1632,8 @@ void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); - SDNode *N = new StoreSDNode(Ops, ISD::UNINDEXED, false, + SDNode *N = new StoreSDNode(Ops, VTs, ISD::UNINDEXED, false, VT, SV, SVOffset, Alignment, isVolatile); - N-setValueTypes(VTs); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDOperand(N, 0); @@ -1678,9 +1667,8 @@ void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); - SDNode *N = new StoreSDNode(Ops, ISD::UNINDEXED, isTrunc, + SDNode *N = new StoreSDNode(Ops, VTs, ISD::UNINDEXED, isTrunc, SVT, SV, SVOffset, Alignment, isVolatile); - N-setValueTypes(VTs); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDOperand(N, 0); @@ -1706,11 +1694,10 @@ void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); - SDNode *N = new StoreSDNode(Ops, AM, + SDNode *N = new StoreSDNode(Ops, VTs, AM, ST-isTruncatingStore(), ST-getStoredVT(), ST-getSrcValue(), ST-getSrcValueOffset(), ST-getAlignment(),
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.376 - 1.377 --- Log message: Removed more iostream includes --- Diffs of the changes: (+1 -2) SelectionDAG.cpp |3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.376 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.377 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.376Thu Dec 7 14:04:42 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Dec 7 14:28:15 2006 @@ -26,7 +26,6 @@ #include llvm/ADT/SetVector.h #include llvm/ADT/SmallVector.h #include llvm/ADT/StringExtras.h -#include iostream #include set #include algorithm #include cmath @@ -2887,7 +2886,7 @@ dyn_castGlobalAddressSDNode(this)) { int offset = GADN-getOffset(); cerr ; -WriteAsOperand(std::cerr, GADN-getGlobal()) ; +WriteAsOperand(*cerr.stream(), GADN-getGlobal()) ; if (offset 0) cerr + offset; else ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.372 - 1.373 --- Log message: Make an assert comment match the tested assertion. --- Diffs of the changes: (+1 -1) SelectionDAG.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.372 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.373 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.372Thu Nov 9 11:54:19 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Nov 11 14:07:59 2006 @@ -1130,7 +1130,7 @@ case ISD::BIT_CONVERT: // Basic sanity checking. assert(MVT::getSizeInBits(VT) == MVT::getSizeInBits(Operand.getValueType()) -Cannot BIT_CONVERT between two different types!); +Cannot BIT_CONVERT between types of different sizes!); if (VT == Operand.getValueType()) return Operand; // noop conversion. if (OpOpcode == ISD::BIT_CONVERT) // bitconv(bitconv(x)) - bitconv(x) return getNode(ISD::BIT_CONVERT, VT, Operand.getOperand(0)); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.368 - 1.369 --- Log message: Added getIndexedStore. --- Diffs of the changes: (+30 -0) SelectionDAG.cpp | 30 ++ 1 files changed, 30 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.368 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.369 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.368Fri Nov 3 01:31:32 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Nov 5 03:30:09 2006 @@ -1723,6 +1723,36 @@ return SDOperand(N, 0); } +SDOperand SelectionDAG::getIndexedStore(SDOperand OrigStore, SDOperand Base, + SDOperand Offset, ISD::MemOpAddrMode AM){ + StoreSDNode *ST = castStoreSDNode(OrigStore); + assert(ST-getOffset().getOpcode() == ISD::UNDEF + Store is already a indexed store!); + SDVTList VTs = getVTList(Base.getValueType(), MVT::Other); + SDOperand Ops[] = { ST-getChain(), ST-getValue(), Base, Offset }; + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); + ID.AddInteger(AM); + ID.AddInteger(ST-isTruncatingStore()); + ID.AddInteger(ST-getStoredVT()); + ID.AddPointer(ST-getSrcValue()); + ID.AddInteger(ST-getSrcValueOffset()); + ID.AddInteger(ST-getAlignment()); + ID.AddInteger(ST-isVolatile()); + void *IP = 0; + if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) +return SDOperand(E, 0); + SDNode *N = new StoreSDNode(ST-getChain(), ST-getValue(), + Base, Offset, AM, + ST-isTruncatingStore(), ST-getStoredVT(), + ST-getSrcValue(), ST-getSrcValueOffset(), + ST-getAlignment(), ST-isVolatile()); + N-setValueTypes(VTs); + CSEMap.InsertNode(N, IP); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + SDOperand SelectionDAG::getVAArg(MVT::ValueType VT, SDOperand Chain, SDOperand Ptr, SDOperand SV) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.366 - 1.367 --- Log message: Added isPredecessor. --- Diffs of the changes: (+23 -0) SelectionDAG.cpp | 23 +++ 1 files changed, 23 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.366 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.367 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.366Thu Nov 2 19:28:29 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Nov 2 21:05:24 2006 @@ -2563,6 +2563,29 @@ return false; } +static void findPredecessor(SDNode *N, const SDNode *P, bool found, +std::setSDNode * Visited) { + if (found || !Visited.insert(N).second) +return; + + for (unsigned i = 0, e = N-getNumOperands(); !found i != e; ++i) { +SDNode *Op = N-getOperand(i).Val; +if (Op == P) { + found = true; + return; +} +findPredecessor(Op, P, found, Visited); + } +} + +// isPredecessor - Return true if this node is a predecessor of N. +bool SDNode::isPredecessor(SDNode *N) const { + std::setSDNode * Visited; + bool found = false; + findPredecessor(N, this, found, Visited); + return found; +} + uint64_t SDNode::getConstantOperandVal(unsigned Num) const { assert(Num NumOperands Invalid child # of SDNode!); return castConstantSDNode(OperandList[Num])-getValue(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.367 - 1.368 --- Log message: Fix comments. --- Diffs of the changes: (+8 -3) SelectionDAG.cpp | 11 --- 1 files changed, 8 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.367 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.368 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.367Thu Nov 2 21:05:24 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Nov 3 01:31:32 2006 @@ -2534,7 +2534,8 @@ } -// isOnlyUse - Return true if this node is the only use of N. +/// isOnlyUse - Return true if this node is the only use of N. +/// bool SDNode::isOnlyUse(SDNode *N) const { bool Seen = false; for (SDNode::use_iterator I = N-use_begin(), E = N-use_end(); I != E; ++I) { @@ -2548,7 +2549,8 @@ return Seen; } -// isOperand - Return true if this node is an operand of N. +/// isOperand - Return true if this node is an operand of N. +/// bool SDOperand::isOperand(SDNode *N) const { for (unsigned i = 0, e = N-getNumOperands(); i != e; ++i) if (*this == N-getOperand(i)) @@ -2578,7 +2580,10 @@ } } -// isPredecessor - Return true if this node is a predecessor of N. +/// isPredecessor - Return true if this node is a predecessor of N. This node +/// is either an operand of N or it can be reached by recursively traversing +/// up the operands. +/// NOTE: this is an expensive method. Use it carefully. bool SDNode::isPredecessor(SDNode *N) const { std::setSDNode * Visited; bool found = false; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp SelectionDAGPrinter.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.363 - 1.364 SelectionDAGPrinter.cpp updated: 1.41 - 1.42 --- Log message: Print jumptable index. --- Diffs of the changes: (+4 -0) SelectionDAG.cpp|2 ++ SelectionDAGPrinter.cpp |2 ++ 2 files changed, 4 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.363 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.364 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.363Mon Oct 30 01:59:36 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Oct 31 22:48:30 2006 @@ -2851,6 +2851,8 @@ std::cerr offset; } else if (const FrameIndexSDNode *FIDN = dyn_castFrameIndexSDNode(this)) { std::cerrFIDN-getIndex() ; + } else if (const JumpTableSDNode *JTDN = dyn_castJumpTableSDNode(this)) { +std::cerrJTDN-getIndex() ; } else if (const ConstantPoolSDNode *CP = dyn_castConstantPoolSDNode(this)){ int offset = CP-getOffset(); if (CP-isMachineConstantPoolEntry()) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.41 llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.42 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.41 Fri Oct 20 13:06:09 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Tue Oct 31 22:48:30 2006 @@ -105,6 +105,8 @@ Op += itostr(offset); } else if (const FrameIndexSDNode *FIDN = dyn_castFrameIndexSDNode(Node)) { Op += + itostr(FIDN-getIndex()); + } else if (const JumpTableSDNode *JTDN = dyn_castJumpTableSDNode(Node)) { +Op += + itostr(JTDN-getIndex()); } else if (const ConstantPoolSDNode *CP = dyn_castConstantPoolSDNode(Node)){ if (CP-isMachineConstantPoolEntry()) { std::ostringstream SS; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.362 - 1.363 --- Log message: Added a new SDNode type: BR_JT for jumptable branch. --- Diffs of the changes: (+1 -0) SelectionDAG.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.362 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.363 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.362Sun Oct 29 01:14:47 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Oct 30 01:59:36 2006 @@ -2734,6 +2734,7 @@ // Control flow instructions case ISD::BR: return br; case ISD::BRIND: return brind; + case ISD::BR_JT: return br_jt; case ISD::BRCOND: return brcond; case ISD::BR_CC: return br_cc; case ISD::RET: return ret; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.361 - 1.362 --- Log message: VLOAD is not the LoadSDNode opcode. --- Diffs of the changes: (+0 -1) SelectionDAG.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.361 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.362 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.361Sat Oct 28 21:26:30 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Oct 29 01:14:47 2006 @@ -400,7 +400,6 @@ ID.AddPointer(CP-getConstVal()); break; } -case ISD::VLOAD: case ISD::LOAD: { LoadSDNode *LD = castLoadSDNode(N); ID.AddInteger(LD-getAddressingMode()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Nick and I fixed it by simply removing the ISD::EXTLOAD case. Just wanted to make sure that's the correct thing to do (seems to fix it). Also removed the ISD::VLOAD case. We should be in good shape now. Thanks! Evan +case ISD::LOAD: { + LoadSDNode *LD = castLoadSDNode(N); + ID.AddInteger(LD-getAddressingMode()); + ID.AddInteger(LD-getExtensionType()); + ID.AddInteger(LD-getLoadedVT()); + ID.AddPointer(LD-getSrcValue()); + ID.AddInteger(LD-getSrcValueOffset()); + ID.AddInteger(LD-getAlignment()); + ID.AddInteger(LD-isVolatile()); + break; +} +case ISD::STORE: { + StoreSDNode *ST = castStoreSDNode(N); + ID.AddInteger(ST-getAddressingMode()); + ID.AddInteger(ST-isTruncatingStore()); + ID.AddInteger(ST-getStoredVT()); + ID.AddPointer(ST-getSrcValue()); + ID.AddInteger(ST-getSrcValueOffset()); + ID.AddInteger(ST-getAlignment()); + ID.AddInteger(ST-isVolatile()); break; } +} } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.358 - 1.359 --- Log message: Fix a serious bug that caused any x86 vector stuff to infinite loop --- Diffs of the changes: (+1 -1) SelectionDAG.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.358 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.359 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.358Fri Oct 27 18:52:51 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Oct 28 01:15:26 2006 @@ -331,7 +331,7 @@ SDOperand Op1, SDOperand Op2, SDOperand Op3) { AddNodeIDOpcode(ID, OpC); AddNodeIDValueTypes(ID, VTList); - AddNodeIDOperands(ID, Op1, Op2); + AddNodeIDOperands(ID, Op1, Op2, Op3); } static void AddNodeIDNode(FoldingSetNodeID ID, unsigned short OpC, SDVTList VTList, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.359 - 1.360 --- Log message: Load and stores have not been uniqued properly. --- Diffs of the changes: (+42 -13) SelectionDAG.cpp | 55 ++- 1 files changed, 42 insertions(+), 13 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.359 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.360 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.359Sat Oct 28 01:15:26 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Oct 28 12:25:28 2006 @@ -363,20 +363,24 @@ ID.AddDouble(castConstantFPSDNode(N)-getValue()); break; case ISD::TargetGlobalAddress: -case ISD::GlobalAddress: - ID.AddPointer(castGlobalAddressSDNode(N)-getGlobal()); - ID.AddInteger(castGlobalAddressSDNode(N)-getOffset()); +case ISD::GlobalAddress: { + GlobalAddressSDNode *GA = castGlobalAddressSDNode(N); + ID.AddPointer(GA-getGlobal()); + ID.AddInteger(GA-getOffset()); break; +} case ISD::BasicBlock: ID.AddPointer(castBasicBlockSDNode(N)-getBasicBlock()); break; case ISD::Register: ID.AddInteger(castRegisterSDNode(N)-getReg()); break; -case ISD::SRCVALUE: - ID.AddPointer(castSrcValueSDNode(N)-getValue()); - ID.AddInteger(castSrcValueSDNode(N)-getOffset()); +case ISD::SRCVALUE: { + SrcValueSDNode *SV = castSrcValueSDNode(N); + ID.AddPointer(SV-getValue()); + ID.AddInteger(SV-getOffset()); break; +} case ISD::FrameIndex: case ISD::TargetFrameIndex: ID.AddInteger(castFrameIndexSDNode(N)-getIndex()); @@ -386,16 +390,41 @@ ID.AddInteger(castJumpTableSDNode(N)-getIndex()); break; case ISD::ConstantPool: -case ISD::TargetConstantPool: - ID.AddInteger(castConstantPoolSDNode(N)-getAlignment()); - ID.AddInteger(castConstantPoolSDNode(N)-getOffset()); - if (castConstantPoolSDNode(N)-isMachineConstantPoolEntry()) -castConstantPoolSDNode(N)-getMachineCPVal()- - AddSelectionDAGCSEId(ID); +case ISD::TargetConstantPool: { + ConstantPoolSDNode *CP = castConstantPoolSDNode(N); + ID.AddInteger(CP-getAlignment()); + ID.AddInteger(CP-getOffset()); + if (CP-isMachineConstantPoolEntry()) +CP-getMachineCPVal()-AddSelectionDAGCSEId(ID); else -ID.AddPointer(castConstantPoolSDNode(N)-getConstVal()); +ID.AddPointer(CP-getConstVal()); + break; +} +case ISD::VLOAD: +case ISD::EXTLOAD: +case ISD::LOAD: { + LoadSDNode *LD = castLoadSDNode(N); + ID.AddInteger(LD-getAddressingMode()); + ID.AddInteger(LD-getExtensionType()); + ID.AddInteger(LD-getLoadedVT()); + ID.AddPointer(LD-getSrcValue()); + ID.AddInteger(LD-getSrcValueOffset()); + ID.AddInteger(LD-getAlignment()); + ID.AddInteger(LD-isVolatile()); + break; +} +case ISD::STORE: { + StoreSDNode *ST = castStoreSDNode(N); + ID.AddInteger(ST-getAddressingMode()); + ID.AddInteger(ST-isTruncatingStore()); + ID.AddInteger(ST-getStoredVT()); + ID.AddPointer(ST-getSrcValue()); + ID.AddInteger(ST-getSrcValueOffset()); + ID.AddInteger(ST-getAlignment()); + ID.AddInteger(ST-isVolatile()); break; } +} } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.360 - 1.361 --- Log message: Remove spurious case. EXTLOAD is not one of the node opcodes. --- Diffs of the changes: (+0 -1) SelectionDAG.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.360 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.361 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.360Sat Oct 28 12:25:28 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Oct 28 21:26:30 2006 @@ -401,7 +401,6 @@ break; } case ISD::VLOAD: -case ISD::EXTLOAD: case ISD::LOAD: { LoadSDNode *LD = castLoadSDNode(N); ID.AddInteger(LD-getAddressingMode()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Jim, This commit broke llc, see below .. On Sat, 2006-10-28 at 12:25 -0500, Jim Laskey wrote: Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.359 - 1.360 --- Log message: Load and stores have not been uniqued properly. --- Diffs of the changes: (+42 -13) SelectionDAG.cpp | 55 ++- 1 files changed, 42 insertions(+), 13 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.359 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.360 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.359 Sat Oct 28 01:15:26 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cppSat Oct 28 12:25:28 2006 @@ -363,20 +363,24 @@ ID.AddDouble(castConstantFPSDNode(N)-getValue()); break; case ISD::TargetGlobalAddress: -case ISD::GlobalAddress: - ID.AddPointer(castGlobalAddressSDNode(N)-getGlobal()); - ID.AddInteger(castGlobalAddressSDNode(N)-getOffset()); +case ISD::GlobalAddress: { + GlobalAddressSDNode *GA = castGlobalAddressSDNode(N); + ID.AddPointer(GA-getGlobal()); + ID.AddInteger(GA-getOffset()); break; +} case ISD::BasicBlock: ID.AddPointer(castBasicBlockSDNode(N)-getBasicBlock()); break; case ISD::Register: ID.AddInteger(castRegisterSDNode(N)-getReg()); break; -case ISD::SRCVALUE: - ID.AddPointer(castSrcValueSDNode(N)-getValue()); - ID.AddInteger(castSrcValueSDNode(N)-getOffset()); +case ISD::SRCVALUE: { + SrcValueSDNode *SV = castSrcValueSDNode(N); + ID.AddPointer(SV-getValue()); + ID.AddInteger(SV-getOffset()); break; +} case ISD::FrameIndex: case ISD::TargetFrameIndex: ID.AddInteger(castFrameIndexSDNode(N)-getIndex()); @@ -386,16 +390,41 @@ ID.AddInteger(castJumpTableSDNode(N)-getIndex()); break; case ISD::ConstantPool: -case ISD::TargetConstantPool: - ID.AddInteger(castConstantPoolSDNode(N)-getAlignment()); - ID.AddInteger(castConstantPoolSDNode(N)-getOffset()); - if (castConstantPoolSDNode(N)-isMachineConstantPoolEntry()) -castConstantPoolSDNode(N)-getMachineCPVal()- - AddSelectionDAGCSEId(ID); +case ISD::TargetConstantPool: { + ConstantPoolSDNode *CP = castConstantPoolSDNode(N); + ID.AddInteger(CP-getAlignment()); + ID.AddInteger(CP-getOffset()); + if (CP-isMachineConstantPoolEntry()) +CP-getMachineCPVal()-AddSelectionDAGCSEId(ID); else -ID.AddPointer(castConstantPoolSDNode(N)-getConstVal()); +ID.AddPointer(CP-getConstVal()); + break; +} +case ISD::VLOAD: +case ISD::EXTLOAD: This value isn't in the same enum as that on which we're switching here. However, it does have the same value (1) as NodeType::EntryToken. So when N is an EntryToken it comes in here and the cast below fails. You will see this: /proj/llvm/llvm2/include/llvm/Support/Casting.h:199: typename llvm::cast_rettyTo, From::ret_type llvm::cast(const Y) [with X = llvm::LoadSDNode, Y = llvm::SDNode*]: Assertion `isaX(Val) castTy() argument of incompatible type!' failed. Nick and I fixed it by simply removing the ISD::EXTLOAD case. Just wanted to make sure that's the correct thing to do (seems to fix it). +case ISD::LOAD: { + LoadSDNode *LD = castLoadSDNode(N); + ID.AddInteger(LD-getAddressingMode()); + ID.AddInteger(LD-getExtensionType()); + ID.AddInteger(LD-getLoadedVT()); + ID.AddPointer(LD-getSrcValue()); + ID.AddInteger(LD-getSrcValueOffset()); + ID.AddInteger(LD-getAlignment()); + ID.AddInteger(LD-isVolatile()); + break; +} +case ISD::STORE: { + StoreSDNode *ST = castStoreSDNode(N); + ID.AddInteger(ST-getAddressingMode()); + ID.AddInteger(ST-isTruncatingStore()); + ID.AddInteger(ST-getStoredVT()); + ID.AddPointer(ST-getSrcValue()); + ID.AddInteger(ST-getSrcValueOffset()); + ID.AddInteger(ST-getAlignment()); + ID.AddInteger(ST-isVolatile()); break; } +} } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp SelectionDAGCSEMap.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.356 - 1.357 SelectionDAGCSEMap.cpp (r1.9) removed --- Log message: Switch over from SelectionNodeCSEMap to FoldingSet. --- Diffs of the changes: (+211 -49) SelectionDAG.cpp | 260 --- 1 files changed, 211 insertions(+), 49 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.356 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.357 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.356Thu Oct 26 16:53:40 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Oct 27 18:46:08 2006 @@ -252,6 +252,144 @@ } //===--===// +// SDNode Profile Support +//===--===// + +/// getNodeIDOpcode - Return the opcode that has been set for this NodeID. +/// +static unsigned getNodeIDOpcode(FoldingSetNodeID ID) { + return ID.getRawData(0); +} +static void AddNodeIDOpcode(FoldingSetNodeID ID, unsigned OpC) { + ID.AddInteger(OpC); +} + +/// AddNodeIDValueTypes - Value type lists are intern'd so we can represent them +/// solely with their pointer. +void AddNodeIDValueTypes(FoldingSetNodeID ID, SDVTList VTList) { + ID.AddPointer(VTList.VTs); +} + + +static void AddNodeIDOperand(FoldingSetNodeID ID, SDOperand Op) { + ID.AddPointer(Op.Val); + ID.AddInteger(Op.ResNo); +} + +static void AddNodeIDOperands(FoldingSetNodeID ID) { +} +void AddNodeIDOperands(FoldingSetNodeID ID, SDOperand Op) { + AddNodeIDOperand(ID, Op); +} +static void AddNodeIDOperands(FoldingSetNodeID ID, + SDOperand Op1, SDOperand Op2) { + AddNodeIDOperand(ID, Op1); + AddNodeIDOperand(ID, Op2); +} +static void AddNodeIDOperands(FoldingSetNodeID ID, + SDOperand Op1, SDOperand Op2, SDOperand Op3) { + AddNodeIDOperand(ID, Op1); + AddNodeIDOperand(ID, Op2); + AddNodeIDOperand(ID, Op3); +} +static void AddNodeIDOperands(FoldingSetNodeID ID, + const SDOperand *Ops, unsigned NumOps) { + for (; NumOps; --NumOps, ++Ops) +AddNodeIDOperand(ID, *Ops); +} + +static void AddNodeIDNode(FoldingSetNodeID ID, + unsigned short OpC, SDVTList VTList) { + AddNodeIDOpcode(ID, OpC); + AddNodeIDValueTypes(ID, VTList); + AddNodeIDOperands(ID); +} +static void AddNodeIDNode(FoldingSetNodeID ID, + unsigned short OpC, SDVTList VTList, + SDOperand Op) { + AddNodeIDOpcode(ID, OpC); + AddNodeIDValueTypes(ID, VTList); + AddNodeIDOperands(ID, Op); +} +static void AddNodeIDNode(FoldingSetNodeID ID, + unsigned short OpC, SDVTList VTList, + SDOperand Op1, SDOperand Op2) { + AddNodeIDOpcode(ID, OpC); + AddNodeIDValueTypes(ID, VTList); + AddNodeIDOperands(ID, Op1, Op2); +} +static void AddNodeIDNode(FoldingSetNodeID ID, + unsigned short OpC, SDVTList VTList, + SDOperand Op1, SDOperand Op2, SDOperand Op3) { + AddNodeIDOpcode(ID, OpC); + AddNodeIDValueTypes(ID, VTList); + AddNodeIDOperands(ID, Op1, Op2); +} +static void AddNodeIDNode(FoldingSetNodeID ID, + unsigned short OpC, SDVTList VTList, + const SDOperand *OpList, unsigned N) { + AddNodeIDOpcode(ID, OpC); + AddNodeIDValueTypes(ID, VTList); + AddNodeIDOperands(ID, OpList, N); +} + +static void AddNodeIDNode(FoldingSetNodeID ID, SDNode *N) { + AddNodeIDOpcode(ID, N-getOpcode()); + // Add the return value info. + AddNodeIDValueTypes(ID, N-getVTList()); + // Add the operand info. + AddNodeIDOperands(ID, N-op_begin(), N-getNumOperands()); + + // Handle SDNode leafs with special info. + if (N-getNumOperands() == 0) { +switch (N-getOpcode()) { +default: break; // Normal nodes don't need extra info. +case ISD::TargetConstant: +case ISD::Constant: + ID.AddInteger(castConstantSDNode(N)-getValue()); + break; +case ISD::TargetConstantFP: +case ISD::ConstantFP: + ID.AddDouble(castConstantFPSDNode(N)-getValue()); + break; +case ISD::TargetGlobalAddress: +case ISD::GlobalAddress: + ID.AddPointer(castGlobalAddressSDNode(N)-getGlobal()); + ID.AddInteger(castGlobalAddressSDNode(N)-getOffset()); + break; +case ISD::BasicBlock: + ID.AddPointer(castBasicBlockSDNode(N)-getBasicBlock()); + break; +case ISD::Register: + ID.AddInteger(castRegisterSDNode(N)-getReg()); + break; +case ISD::SRCVALUE: + ID.AddPointer(castSrcValueSDNode(N)-getValue()); + ID.AddInteger(castSrcValueSDNode(N)-getOffset()); + break; +case ISD::FrameIndex: +case ISD::TargetFrameIndex: +
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.357 - 1.358 --- Log message: Clean up. --- Diffs of the changes: (+12 -2) SelectionDAG.cpp | 14 -- 1 files changed, 12 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.357 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.358 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.357Fri Oct 27 18:46:08 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Oct 27 18:52:51 2006 @@ -260,6 +260,9 @@ static unsigned getNodeIDOpcode(FoldingSetNodeID ID) { return ID.getRawData(0); } + +/// AddNodeIDOpcode - Add the node opcode to the NodeID data. +/// static void AddNodeIDOpcode(FoldingSetNodeID ID, unsigned OpC) { ID.AddInteger(OpC); } @@ -270,15 +273,18 @@ ID.AddPointer(VTList.VTs); } - +/// AddNodeIDOperand - Add an operands data to the NodeID data. +/// static void AddNodeIDOperand(FoldingSetNodeID ID, SDOperand Op) { ID.AddPointer(Op.Val); ID.AddInteger(Op.ResNo); } +/// AddNodeIDOperands - Various routines for adding operands to the NodeID data. +/// static void AddNodeIDOperands(FoldingSetNodeID ID) { } -void AddNodeIDOperands(FoldingSetNodeID ID, SDOperand Op) { +static void AddNodeIDOperands(FoldingSetNodeID ID, SDOperand Op) { AddNodeIDOperand(ID, Op); } static void AddNodeIDOperands(FoldingSetNodeID ID, @@ -298,6 +304,8 @@ AddNodeIDOperand(ID, *Ops); } +/// AddNodeIDOperands - Various routines for adding node info to the NodeID +/// data. static void AddNodeIDNode(FoldingSetNodeID ID, unsigned short OpC, SDVTList VTList) { AddNodeIDOpcode(ID, OpC); @@ -333,6 +341,8 @@ AddNodeIDOperands(ID, OpList, N); } +/// AddNodeIDNode - Generic routine for adding a nodes info to the NodeID +/// data. static void AddNodeIDNode(FoldingSetNodeID ID, SDNode *N) { AddNodeIDOpcode(ID, N-getOpcode()); // Add the return value info. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.355 - 1.356 --- Log message: getPreIndexedLoad - getIndexedLoad. --- Diffs of the changes: (+7 -21) SelectionDAG.cpp | 28 +++- 1 files changed, 7 insertions(+), 21 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.355 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.356 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.355Tue Oct 17 16:47:13 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Oct 26 16:53:40 2006 @@ -1447,28 +1447,14 @@ return SDOperand(N, 0); } -SDOperand SelectionDAG::getPreIndexedLoad(SDOperand OrigLoad, SDOperand Base) { +SDOperand SelectionDAG::getIndexedLoad(SDOperand OrigLoad, SDOperand Base, + SDOperand Offset, ISD::MemOpAddrMode AM){ LoadSDNode *LD = castLoadSDNode(OrigLoad); - SDOperand Ptr = LD-getBasePtr(); - MVT::ValueType PtrVT = Ptr.getValueType(); - unsigned Opc = Ptr.getOpcode(); - SDOperand Offset = LD-getOffset(); - assert(Offset.getOpcode() == ISD::UNDEF); - assert((Opc == ISD::ADD || Opc == ISD::SUB) - Load address must be base +/- offset!); - ISD::MemOpAddrMode AM = (Opc == ISD::ADD) ? ISD::PRE_INC : ISD::PRE_DEC; - if (Ptr.getOperand(0) == Base) { -Offset = Ptr.getOperand(1); -Ptr = Ptr.getOperand(0); - } else { -assert(Ptr.getOperand(1) == Base); -Offset = Ptr.getOperand(0); -Ptr = Ptr.getOperand(1); - } - + assert(LD-getOffset().getOpcode() == ISD::UNDEF + Load is already a indexed load!); MVT::ValueType VT = OrigLoad.getValueType(); - SDVTList VTs = getVTList(VT, PtrVT, MVT::Other); - SelectionDAGCSEMap::NodeID ID(ISD::LOAD, VTs, LD-getChain(), Ptr, Offset); + SDVTList VTs = getVTList(VT, Base.getValueType(), MVT::Other); + SelectionDAGCSEMap::NodeID ID(ISD::LOAD, VTs, LD-getChain(), Base, Offset); ID.AddInteger(AM); ID.AddInteger(LD-getExtensionType()); ID.AddInteger(LD-getLoadedVT()); @@ -1479,7 +1465,7 @@ void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); - SDNode *N = new LoadSDNode(LD-getChain(), Ptr, Offset, AM, + SDNode *N = new LoadSDNode(LD-getChain(), Base, Offset, AM, LD-getExtensionType(), LD-getLoadedVT(), LD-getSrcValue(), LD-getSrcValueOffset(), LD-getAlignment(), LD-isVolatile()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.353 - 1.354 --- Log message: Reflect MemOpAddrMode change; added a helper to create pre-indexed load. --- Diffs of the changes: (+68 -4) SelectionDAG.cpp | 72 +++ 1 files changed, 68 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.353 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.354 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.353Tue Oct 17 14:33:52 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Oct 17 16:14:32 2006 @@ -1440,6 +1440,48 @@ return SDOperand(N, 0); } +SDOperand SelectionDAG::getPreIndexedLoad(SDOperand OrigLoad, SDOperand Base) { + LoadSDNode *LD = castLoadSDNode(OrigLoad); + SDOperand Ptr = LD-getBasePtr(); + MVT::ValueType PtrVT = Ptr.getValueType(); + unsigned Opc = Ptr.getOpcode(); + SDOperand Offset = LD-getOffset(); + assert(Offset.getOpcode() == ISD::UNDEF); + assert((Opc == ISD::ADD || Opc == ISD::SUB) + Load address must be base +/- offset!); + ISD::MemOpAddrMode AM = (Opc == ISD::ADD) ? ISD::PRE_INC : ISD::PRE_DEC; + if (Ptr.getOperand(0) == Base) { +Offset = Ptr.getOperand(1); +Ptr = Ptr.getOperand(0); + } else { +assert(Ptr.getOperand(1) == Base); +Offset = Ptr.getOperand(0); +Ptr = Ptr.getOperand(1); + } + + MVT::ValueType VT = OrigLoad.getValueType(); + SDVTList VTs = getVTList(VT, PtrVT, MVT::Other); + SelectionDAGCSEMap::NodeID ID(ISD::LOAD, VTs, LD-getChain(), Ptr, Offset); + ID.AddInteger(AM); + ID.AddInteger(LD-getExtensionType()); + ID.AddInteger(LD-getLoadedVT()); + ID.AddPointer(LD-getSrcValue()); + ID.AddInteger(LD-getSrcValueOffset()); + ID.AddInteger(LD-getAlignment()); + ID.AddInteger(LD-isVolatile()); + void *IP = 0; + if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) +return SDOperand(E, 0); + SDNode *N = new LoadSDNode(LD-getChain(), Ptr, Offset, AM, + LD-getExtensionType(), LD-getLoadedVT(), + LD-getSrcValue(), LD-getSrcValueOffset(), + LD-getAlignment(), LD-isVolatile()); + N-setValueTypes(VTs); + CSEMap.InsertNode(N, IP); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + SDOperand SelectionDAG::getVecLoad(unsigned Count, MVT::ValueType EVT, SDOperand Chain, SDOperand Ptr, SDOperand SV) { @@ -2565,6 +2607,21 @@ } } +const char *SDNode::getAddressingModeName(ISD::MemOpAddrMode AM) { + switch (AM) { + default: +return ; + case ISD::PRE_INC: +return pre-inc; + case ISD::PRE_DEC: +return pre-dec; + case ISD::POST_INC: +return post-inc; + case ISD::POST_DEC: +return post-dec; + } +} + void SDNode::dump() const { dump(0); } void SDNode::dump(const SelectionDAG *G) const { std::cerr (void*)this : ; @@ -2650,10 +2707,17 @@ if (doExt) std::cerr MVT::getValueTypeString(LD-getLoadedVT()) ; -if (LD-getAddressingMode() == ISD::PRE_INDEXED) - std::cerr pre; -else if (LD-getAddressingMode() == ISD::POST_INDEXED) - std::cerr post; +const char *AM = getAddressingModeName(LD-getAddressingMode()); +if (AM != ) + std::cerr AM; + } else if (const StoreSDNode *ST = dyn_castStoreSDNode(this)) { +if (ST-isTruncatingStore()) + std::cerr trunc + MVT::getValueTypeString(ST-getStoredVT()) ; + +const char *AM = getAddressingModeName(ST-getAddressingMode()); +if (AM != ) + std::cerr AM; } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.354 - 1.355 --- Log message: Trivial patch to speed up legalizing common i64 constants. --- Diffs of the changes: (+7 -0) SelectionDAG.cpp |7 +++ 1 files changed, 7 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.354 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.355 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.354Tue Oct 17 16:14:32 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Oct 17 16:47:13 2006 @@ -1234,6 +1234,13 @@ if (N2C N2C-getValue() == 0) return N2; break; + case ISD::OR: + case ISD::XOR: +// (X ^| 0) - X. This commonly occurs when legalizing i64 values, so it's +// worth handling here. +if (N2C N2C-getValue() == 0) + return N1; +break; case ISD::FP_ROUND_INREG: if (castVTSDNode(N2)-getVT() == VT) return N1; // Not actually rounding. break; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.350 - 1.351 --- Log message: Fix a bug where we incorrectly turned '(X 0) == 0' into '(X 0) -1', which is undefined. 0 isn't a power of 2. --- Diffs of the changes: (+2 -2) SelectionDAG.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.350 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.351 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.350Fri Oct 13 16:12:22 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Oct 13 17:46:18 2006 @@ -910,7 +910,7 @@ dyn_castConstantSDNode(N1.getOperand(1))) { if (Cond == ISD::SETNE C2 == 0) {// (X 8) != 0 -- (X 8) 3 // Perform the xform if the AND RHS is a single bit. -if ((AndRHS-getValue() (AndRHS-getValue()-1)) == 0) { +if (isPowerOf2_64(AndRHS-getValue())) { return getNode(ISD::SRL, VT, N1, getConstant(Log2_64(AndRHS-getValue()), TLI.getShiftAmountTy())); @@ -918,7 +918,7 @@ } else if (Cond == ISD::SETEQ C2 == AndRHS-getValue()) { // (X 8) == 8 -- (X 8) 3 // Perform the xform if C2 is a single bit. -if ((C2 (C2-1)) == 0) { +if (isPowerOf2_64(C2)) { return getNode(ISD::SRL, VT, N1, getConstant(Log2_64(C2),TLI.getShiftAmountTy())); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.348 - 1.349 --- Log message: Add RemoveDeadNode to remove a dead node and its (potentially) dead operands. --- Diffs of the changes: (+33 -0) SelectionDAG.cpp | 33 + 1 files changed, 33 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.348 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.349 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.348Wed Oct 11 02:09:31 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Oct 12 15:34:05 2006 @@ -300,6 +300,39 @@ setRoot(Dummy.getValue()); } +void SelectionDAG::RemoveDeadNode(SDNode *N, std::vectorSDNode* Deleted) { + SmallVectorSDNode*, 16 DeadNodes; + DeadNodes.push_back(N); + + // Process the worklist, deleting the nodes and adding their uses to the + // worklist. + while (!DeadNodes.empty()) { +SDNode *N = DeadNodes.back(); +DeadNodes.pop_back(); + +// Take the node out of the appropriate CSE map. +RemoveNodeFromCSEMaps(N); + +// Next, brutally remove the operand list. This is safe to do, as there are +// no cycles in the graph. +for (SDNode::op_iterator I = N-op_begin(), E = N-op_end(); I != E; ++I) { + SDNode *Operand = I-Val; + Operand-removeUser(N); + + // Now that we removed this operand, see if there are no uses of it left. + if (Operand-use_empty()) +DeadNodes.push_back(Operand); +} +delete[] N-OperandList; +N-OperandList = 0; +N-NumOperands = 0; + +// Finally, remove N itself. +Deleted.push_back(N); +AllNodes.erase(N); + } +} + void SelectionDAG::DeleteNode(SDNode *N) { assert(N-use_empty() Cannot delete a node that is not dead!); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.344 - 1.345 --- Log message: SDNode::dump should also print out extension type and VT. --- Diffs of the changes: (+21 -0) SelectionDAG.cpp | 21 + 1 files changed, 21 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.344 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.345 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.344Mon Oct 9 15:57:24 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Oct 10 15:05:10 2006 @@ -2691,6 +2691,27 @@ std::cerr null: M-getOffset() ; } else if (const VTSDNode *N = dyn_castVTSDNode(this)) { std::cerr : getValueTypeString(N-getVT()); + } else if (const LoadSDNode *LD = dyn_castLoadSDNode(this)) { +bool doExt = true; +switch (LD-getExtensionType()) { +default: doExt = false; break; +case ISD::EXTLOAD: + std::cerr anyext ; + break; +case ISD::SEXTLOAD: + std::cerr sext ; + break; +case ISD::ZEXTLOAD: + std::cerr zext ; + break; +} +if (doExt) + std::cerr MVT::getValueTypeString(LD-getLoadVT()) ; + +if (LD-getAddressingMode() == ISD::PRE_INDEXED) + std::cerr pre; +else if (LD-getAddressingMode() == ISD::POST_INDEXED) + std::cerr post; } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.345 - 1.346 --- Log message: FindModifiedNodeSlot needs to add LoadSDNode ivars to create proper SelectionDAGCSEMap ID. --- Diffs of the changes: (+9 -0) SelectionDAG.cpp |9 + 1 files changed, 9 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.345 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.346 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.345Tue Oct 10 15:05:10 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Oct 10 20:47:58 2006 @@ -454,6 +454,15 @@ SelectionDAGCSEMap::NodeID ID; ID.SetOpcode(N-getOpcode()); ID.SetValueTypes(N-getVTList()); + if (const LoadSDNode *LD = dyn_castLoadSDNode(N)) { +ID.AddInteger(LD-getAddressingMode()); +ID.AddInteger(LD-getExtensionType()); +ID.AddInteger(LD-getLoadVT()); +ID.AddPointer(LD-getSrcValue()); +ID.AddInteger(LD-getSrcValueOffset()); +ID.AddInteger(LD-getAlignment()); +ID.AddInteger(LD-isVolatile()); + } ID.SetOperands(Ops, NumOps); return CSEMap.FindNodeOrInsertPos(ID, InsertPos); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.342 - 1.343 --- Log message: Add getStore() helper function to create ISD::STORE nodes. --- Diffs of the changes: (+16 -1) SelectionDAG.cpp | 17 - 1 files changed, 16 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.342 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.343 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.342Tue Oct 3 19:52:21 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Oct 5 17:57:11 2006 @@ -1490,6 +1490,21 @@ return getNode(ISD::LOADX, getVTList(VT, MVT::Other), Ops, 5); } +SDOperand SelectionDAG::getStore(SDOperand Chain, SDOperand Value, + SDOperand Ptr, SDOperand SV) { + SDVTList VTs = getVTList(MVT::Other); + SDOperand Ops[] = { Chain, Value, Ptr, SV }; + SelectionDAGCSEMap::NodeID ID(ISD::STORE, VTs, Ops, 4); + void *IP = 0; + if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) +return SDOperand(E, 0); + SDNode *N = new SDNode(ISD::STORE, Chain, Value, Ptr, SV); + N-setValueTypes(VTs); + CSEMap.InsertNode(N, IP); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + SDOperand SelectionDAG::getVAArg(MVT::ValueType VT, SDOperand Chain, SDOperand Ptr, SDOperand SV) { @@ -1523,7 +1538,7 @@ // Also for ConstantFP? #endif if (Ops[0].getValueType() == EVT) // Normal store? - return getNode(ISD::STORE, VT, Ops[0], Ops[1], Ops[2], Ops[3]); + return getStore(Ops[0], Ops[1], Ops[2], Ops[3]); assert(Ops[1].getValueType() EVT Not a truncation?); assert(MVT::isInteger(Ops[1].getValueType()) == MVT::isInteger(EVT) Can't do FP-INT conversion!); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.340 - 1.341 SelectionDAGISel.cpp updated: 1.279 - 1.280 --- Log message: Comments on JumpTableness --- Diffs of the changes: (+4 -0) SelectionDAG.cpp |1 + SelectionDAGISel.cpp |3 +++ 2 files changed, 4 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.340 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.341 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.340Tue Sep 19 00:02:39 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 26 15:02:30 2006 @@ -2403,6 +2403,7 @@ case ISD::GlobalAddress: return GlobalAddress; case ISD::FrameIndex:return FrameIndex; case ISD::JumpTable: return JumpTable; + case ISD::JumpTableRelocBase: return JumpTableRelocBase; case ISD::ConstantPool: return ConstantPool; case ISD::ExternalSymbol: return ExternalSymbol; case ISD::INTRINSIC_WO_CHAIN: { Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.279 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.280 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.279Sun Sep 24 14:44:59 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Sep 26 15:02:30 2006 @@ -868,6 +868,9 @@ SDOperand LD = DAG.getLoad(isPIC ? MVT::i32 : PTy, Copy.getValue(1), ADD, DAG.getSrcValue(0)); if (isPIC) { +// For Pic, the sequence is: +// BRIND(load(Jumptable + index) + RelocBase) +// RelocBase is the JumpTable on PPC and X86, GOT on Alpha SDOperand Reloc = DAG.getNode(ISD::JumpTableRelocBase, PTy, TAB); ADD = DAG.getNode(ISD::ADD, PTy, ((PTy != MVT::i32) ? DAG.getNode(ISD::SIGN_EXTEND, PTy, LD) : LD), Reloc); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.338 - 1.339 --- Log message: Minor speedup for legalize by avoiding some malloc traffic --- Diffs of the changes: (+9 -0) SelectionDAG.cpp |9 + 1 files changed, 9 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.338 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.339 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.338Tue Sep 12 16:00:35 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Sep 18 23:51:23 2006 @@ -1329,6 +1329,15 @@ if (EVT == VT) return N1; // Not actually extending break; } + case ISD::EXTRACT_ELEMENT: +// EXTRACT_ELEMENT of BUILD_PAIR is often formed while legalize is expanding +// 64-bit integers into 32-bit parts. Instead of building the extract of +// the BUILD_PAIR, only to have legalize rip it apart, just do it now. +if (N2C N1.getOpcode() == ISD::BUILD_PAIR) { + assert((unsigned)N2C-getValue() 2 Bad EXTRACT_ELEMENT!); + return N1.getOperand(N2C-getValue()); +} +break; // FIXME: figure out how to safely handle things like // int foo(int x) { return 1 (x 255); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.339 - 1.340 --- Log message: Fold extract_element(cst) to cst --- Diffs of the changes: (+8 -2) SelectionDAG.cpp | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.339 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.340 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.339Mon Sep 18 23:51:23 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 19 00:02:39 2006 @@ -1330,12 +1330,18 @@ break; } case ISD::EXTRACT_ELEMENT: +assert(N2C (unsigned)N2C-getValue() 2 Bad EXTRACT_ELEMENT!); + // EXTRACT_ELEMENT of BUILD_PAIR is often formed while legalize is expanding // 64-bit integers into 32-bit parts. Instead of building the extract of // the BUILD_PAIR, only to have legalize rip it apart, just do it now. -if (N2C N1.getOpcode() == ISD::BUILD_PAIR) { - assert((unsigned)N2C-getValue() 2 Bad EXTRACT_ELEMENT!); +if (N1.getOpcode() == ISD::BUILD_PAIR) return N1.getOperand(N2C-getValue()); + +// EXTRACT_ELEMENT of a constant int is also very common. +if (ConstantSDNode *C = dyn_castConstantSDNode(N1)) { + unsigned Shift = MVT::getSizeInBits(VT) * N2C-getValue(); + return getConstant(C-getValue() Shift, VT); } break; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.334 - 1.335 --- Log message: Eliminate SelectNodeTo() and getTargetNode() variants which take more than 3 SDOperand operands. They are replaced by versions which take an array of SDOperand and the number of operands. --- Diffs of the changes: (+12 -254) SelectionDAG.cpp | 266 ++- 1 files changed, 12 insertions(+), 254 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.334 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.335 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.334Sat Aug 26 02:56:00 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Aug 27 03:08:54 2006 @@ -1908,93 +1908,13 @@ } SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT::ValueType VT, SDOperand Op1, - SDOperand Op2, SDOperand Op3, - SDOperand Op4) { + MVT::ValueType VT, const SDOperand *Ops, + unsigned NumOps) { // If an identical node already exists, use it. SDVTList VTs = getVTList(VT); SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs); - ID.AddOperand(Op1); - ID.AddOperand(Op2); - ID.AddOperand(Op3); - ID.AddOperand(Op4); - void *IP = 0; - if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) -return ON; - - RemoveNodeFromCSEMaps(N); - N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); - N-setValueTypes(VTs); - N-setOperands(Op1, Op2, Op3, Op4); - - CSEMap.InsertNode(N, IP); // Memoize the new node. - return N; -} - -SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT::ValueType VT, SDOperand Op1, - SDOperand Op2, SDOperand Op3, - SDOperand Op4, SDOperand Op5) { - SDVTList VTs = getVTList(VT); - SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs); - ID.AddOperand(Op1); - ID.AddOperand(Op2); - ID.AddOperand(Op3); - ID.AddOperand(Op4); - ID.AddOperand(Op5); - void *IP = 0; - if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) -return ON; - - RemoveNodeFromCSEMaps(N); - N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); - N-setValueTypes(VTs); - N-setOperands(Op1, Op2, Op3, Op4, Op5); - - CSEMap.InsertNode(N, IP); // Memoize the new node. - return N; -} - -SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT::ValueType VT, SDOperand Op1, - SDOperand Op2, SDOperand Op3, SDOperand Op4, - SDOperand Op5, SDOperand Op6) { - SDVTList VTs = getVTList(VT); - SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs); - ID.AddOperand(Op1); - ID.AddOperand(Op2); - ID.AddOperand(Op3); - ID.AddOperand(Op4); - ID.AddOperand(Op5); - ID.AddOperand(Op6); - void *IP = 0; - if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) -return ON; - - RemoveNodeFromCSEMaps(N); - N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); - N-setValueTypes(VTs); - N-setOperands(Op1, Op2, Op3, Op4, Op5, Op6); - - CSEMap.InsertNode(N, IP); // Memoize the new node. - return N; -} - -SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT::ValueType VT, SDOperand Op1, - SDOperand Op2, SDOperand Op3,SDOperand Op4, - SDOperand Op5, SDOperand Op6, - SDOperand Op7) { - SDVTList VTs = getVTList(VT); - // If an identical node already exists, use it. - SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs); - ID.AddOperand(Op1); - ID.AddOperand(Op2); - ID.AddOperand(Op3); - ID.AddOperand(Op4); - ID.AddOperand(Op5); - ID.AddOperand(Op6); - ID.AddOperand(Op7); + for (unsigned i = 0; i != NumOps; ++i) +ID.AddOperand(Ops[i]); void *IP = 0; if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) return ON; @@ -2002,35 +1922,7 @@ RemoveNodeFromCSEMaps(N); N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); N-setValueTypes(VTs); - N-setOperands(Op1, Op2, Op3, Op4, Op5, Op6, Op7); - - CSEMap.InsertNode(N, IP); // Memoize the new node. - return N; -} -SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT::ValueType VT, SDOperand Op1, - SDOperand Op2, SDOperand Op3,SDOperand Op4, - SDOperand Op5, SDOperand Op6, - SDOperand Op7, SDOperand Op8) { - // If an identical node already exists, use it. - SDVTList
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.331 - 1.332 --- Log message: Use the appropriate typedef --- Diffs of the changes: (+1 -2) SelectionDAG.cpp |3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.331 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.332 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.331Tue Aug 15 14:11:05 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Aug 16 15:59:32 2006 @@ -2540,8 +2540,7 @@ std::setSDNode* UsersHandled; - for (std::vectorSDNode*::const_iterator UI = Uses.begin(), E = Uses.end(); - UI != E; ++UI) { + for (SDNode::use_iterator UI = Uses.begin(), E = Uses.end(); UI != E; ++UI) { SDNode *User = *UI; if (User-getNumOperands() == 1 || UsersHandled.insert(User).second) // First time we've seen this? ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.329 - 1.330 --- Log message: add a new SDVTList type and new SelectionDAG::getVTList methods to streamline the creation of canonical VTLists. --- Diffs of the changes: (+79 -68) SelectionDAG.cpp | 147 +-- 1 files changed, 79 insertions(+), 68 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.329 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.330 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.329Mon Aug 14 18:31:51 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Aug 15 12:46:01 2006 @@ -893,7 +893,7 @@ /// getNode - Gets or creates the specified node. /// SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT) { - MVT::ValueType *VTs = getNodeValueTypes(VT); + const MVT::ValueType *VTs = getNodeValueTypes(VT); SelectionDAGCSEMap::NodeID ID(Opcode, VTs); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) @@ -1071,7 +1071,7 @@ } SDNode *N; - MVT::ValueType *VTs = getNodeValueTypes(VT); + const MVT::ValueType *VTs = getNodeValueTypes(VT); if (VT != MVT::Flag) { // Don't CSE flag producing nodes SelectionDAGCSEMap::NodeID ID(Opcode, VTs, Operand); void *IP = 0; @@ -1343,7 +1343,7 @@ // Memoize this node if possible. SDNode *N; - MVT::ValueType *VTs = getNodeValueTypes(VT); + const MVT::ValueType *VTs = getNodeValueTypes(VT); if (VT != MVT::Flag) { SelectionDAGCSEMap::NodeID ID(Opcode, VTs, N1, N2); void *IP = 0; @@ -1401,7 +1401,7 @@ // Memoize node if it doesn't produce a flag. SDNode *N; - MVT::ValueType *VTs = getNodeValueTypes(VT); + const MVT::ValueType *VTs = getNodeValueTypes(VT); if (VT != MVT::Flag) { SelectionDAGCSEMap::NodeID ID(Opcode, VTs, N1, N2, N3); @@ -1436,7 +1436,7 @@ SDOperand SelectionDAG::getLoad(MVT::ValueType VT, SDOperand Chain, SDOperand Ptr, SDOperand SV) { - MVT::ValueType *VTs = getNodeValueTypes(VT, MVT::Other); + const MVT::ValueType *VTs = getNodeValueTypes(VT, MVT::Other); SelectionDAGCSEMap::NodeID ID(ISD::LOAD, VTs, Chain, Ptr, SV); void *IP = 0; @@ -1455,7 +1455,7 @@ SDOperand Ops[] = { Chain, Ptr, SV, getConstant(Count, MVT::i32), getValueType(EVT) }; // Add token chain. - MVT::ValueType *VTs = getNodeValueTypes(MVT::Vector, MVT::Other); + const MVT::ValueType *VTs = getNodeValueTypes(MVT::Vector, MVT::Other); return getNode(ISD::VLOAD, VTs, 2, Ops, 5); } @@ -1463,7 +1463,7 @@ SDOperand Chain, SDOperand Ptr, SDOperand SV, MVT::ValueType EVT) { SDOperand Ops[] = { Chain, Ptr, SV, getValueType(EVT) }; - MVT::ValueType *VTs = getNodeValueTypes(VT, MVT::Other); + const MVT::ValueType *VTs = getNodeValueTypes(VT, MVT::Other); return getNode(Opcode, VTs, 2, Ops, 4); } @@ -1472,7 +1472,7 @@ SDOperand SV) { SDOperand Ops[] = { Chain, Ptr, SV }; // Add token chain. - MVT::ValueType *VTs = getNodeValueTypes(VT, MVT::Other); + const MVT::ValueType *VTs = getNodeValueTypes(VT, MVT::Other); return getNode(ISD::VAARG, VTs, 2, Ops, 3); } @@ -1528,7 +1528,7 @@ // Memoize nodes. SDNode *N; - MVT::ValueType *VTs = getNodeValueTypes(VT); + const MVT::ValueType *VTs = getNodeValueTypes(VT); if (VT != MVT::Flag) { SelectionDAGCSEMap::NodeID ID(Opcode, VTs, Ops, NumOps); void *IP = 0; @@ -1625,59 +1625,70 @@ return SDOperand(N, 0); } - -MVT::ValueType *SelectionDAG::getNodeValueTypes(MVT::ValueType VT) { - return SDNode::getValueTypeList(VT); +/// makeVTList - Return an instance of the SDVTList struct initialized with the +/// specified members. +static SDVTList makeVTList(const MVT::ValueType *VTs, unsigned NumVTs) { + SDVTList Res = {VTs, NumVTs}; + return Res; } -MVT::ValueType *SelectionDAG::getNodeValueTypes( -std::vectorMVT::ValueType RetVals) { - switch (RetVals.size()) { - case 0: assert(0 Cannot have nodes without results!); - case 1: return SDNode::getValueTypeList(RetVals[0]); - case 2: return getNodeValueTypes(RetVals[0], RetVals[1]); - default: break; - } - - std::liststd::vectorMVT::ValueType ::iterator I = -std::find(VTList.begin(), VTList.end(), RetVals); - if (I == VTList.end()) { -VTList.push_front(RetVals); -I = VTList.begin(); - } - - return (*I)[0]; +SDVTList SelectionDAG::getVTList(MVT::ValueType VT) { + return makeVTList(SDNode::getValueTypeList(VT), 1); } -MVT::ValueType *SelectionDAG::getNodeValueTypes(MVT::ValueType VT1, -MVT::ValueType VT2) { +SDVTList SelectionDAG::getVTList(MVT::ValueType VT1, MVT::ValueType VT2) {
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp SelectionDAGCSEMap.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.330 - 1.331 SelectionDAGCSEMap.cpp updated: 1.7 - 1.8 --- Log message: Start using SDVTList more consistently --- Diffs of the changes: (+78 -72) SelectionDAG.cpp | 132 - SelectionDAGCSEMap.cpp | 18 -- 2 files changed, 78 insertions(+), 72 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.330 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.331 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.330Tue Aug 15 12:46:01 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Aug 15 14:11:05 2006 @@ -31,6 +31,13 @@ #include algorithm using namespace llvm; +/// makeVTList - Return an instance of the SDVTList struct initialized with the +/// specified members. +static SDVTList makeVTList(const MVT::ValueType *VTs, unsigned NumVTs) { + SDVTList Res = {VTs, NumVTs}; + return Res; +} + static bool isCommutativeBinOp(unsigned Opcode) { switch (Opcode) { case ISD::ADD: @@ -415,7 +422,7 @@ SelectionDAGCSEMap::NodeID ID; ID.SetOpcode(N-getOpcode()); - ID.SetValueTypes(N-value_begin()); + ID.SetValueTypes(N-getVTList()); ID.SetOperands(Op); return CSEMap.FindNodeOrInsertPos(ID, InsertPos); } @@ -437,7 +444,7 @@ SelectionDAGCSEMap::NodeID ID; ID.SetOpcode(N-getOpcode()); - ID.SetValueTypes(N-value_begin()); + ID.SetValueTypes(N-getVTList()); ID.SetOperands(Op1, Op2); return CSEMap.FindNodeOrInsertPos(ID, InsertPos); } @@ -460,7 +467,7 @@ SelectionDAGCSEMap::NodeID ID; ID.SetOpcode(N-getOpcode()); - ID.SetValueTypes(N-value_begin()); + ID.SetValueTypes(N-getVTList()); ID.SetOperands(Ops, NumOps); return CSEMap.FindNodeOrInsertPos(ID, InsertPos); } @@ -501,7 +508,7 @@ Val = MVT::getIntVTBitMask(VT); unsigned Opc = isT ? ISD::TargetConstant : ISD::Constant; - SelectionDAGCSEMap::NodeID ID(Opc, getNodeValueTypes(VT)); + SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT)); ID.AddInteger(Val); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) @@ -523,7 +530,7 @@ // value, so that we don't have problems with 0.0 comparing equal to -0.0, and // we don't have issues with SNANs. unsigned Opc = isTarget ? ISD::TargetConstantFP : ISD::ConstantFP; - SelectionDAGCSEMap::NodeID ID(Opc, getNodeValueTypes(VT)); + SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT)); ID.AddInteger(DoubleToBits(Val)); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) @@ -538,7 +545,7 @@ MVT::ValueType VT, int Offset, bool isTargetGA) { unsigned Opc = isTargetGA ? ISD::TargetGlobalAddress : ISD::GlobalAddress; - SelectionDAGCSEMap::NodeID ID(Opc, getNodeValueTypes(VT)); + SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT)); ID.AddPointer(GV); ID.AddInteger(Offset); void *IP = 0; @@ -553,7 +560,7 @@ SDOperand SelectionDAG::getFrameIndex(int FI, MVT::ValueType VT, bool isTarget) { unsigned Opc = isTarget ? ISD::TargetFrameIndex : ISD::FrameIndex; - SelectionDAGCSEMap::NodeID ID(Opc, getNodeValueTypes(VT)); + SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT)); ID.AddInteger(FI); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) @@ -566,7 +573,7 @@ SDOperand SelectionDAG::getJumpTable(int JTI, MVT::ValueType VT, bool isTarget){ unsigned Opc = isTarget ? ISD::TargetJumpTable : ISD::JumpTable; - SelectionDAGCSEMap::NodeID ID(Opc, getNodeValueTypes(VT)); + SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT)); ID.AddInteger(JTI); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) @@ -581,7 +588,7 @@ unsigned Alignment, int Offset, bool isTarget) { unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool; - SelectionDAGCSEMap::NodeID ID(Opc, getNodeValueTypes(VT)); + SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT)); ID.AddInteger(Alignment); ID.AddInteger(Offset); ID.AddPointer(C); @@ -596,7 +603,7 @@ SDOperand SelectionDAG::getBasicBlock(MachineBasicBlock *MBB) { - SelectionDAGCSEMap::NodeID ID(ISD::BasicBlock, getNodeValueTypes(MVT::Other)); + SelectionDAGCSEMap::NodeID ID(ISD::BasicBlock, getVTList(MVT::Other)); ID.AddPointer(MBB); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) @@ -647,7 +654,7 @@ } SDOperand SelectionDAG::getRegister(unsigned RegNo, MVT::ValueType VT) { - SelectionDAGCSEMap::NodeID ID(ISD::Register, getNodeValueTypes(VT)); + SelectionDAGCSEMap::NodeID ID(ISD::Register, getVTList(VT)); ID.AddInteger(RegNo); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) @@
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp SelectionDAGCSEMap.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.325 - 1.326 SelectionDAGCSEMap.cpp updated: 1.5 - 1.6 --- Log message: Add the actual constant to the hash for ConstantPool nodes. Thanks to Rafael Espindola for pointing this out. --- Diffs of the changes: (+2 -0) SelectionDAG.cpp |1 + SelectionDAGCSEMap.cpp |1 + 2 files changed, 2 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.325 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.326 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.325Fri Aug 11 16:55:30 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Aug 14 15:12:44 2006 @@ -583,6 +583,7 @@ SelectionDAGCSEMap::NodeID ID(Opc, getNodeValueTypes(VT)); ID.AddInteger(Alignment); ID.AddInteger(Offset); + ID.AddPointer(C); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cpp:1.5 llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cpp:1.6 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cpp:1.5Fri Aug 11 20:07:10 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cppMon Aug 14 15:12:44 2006 @@ -64,6 +64,7 @@ case ISD::TargetConstantPool: AddInteger(castConstantPoolSDNode(N)-getAlignment()); AddInteger(castConstantPoolSDNode(N)-getOffset()); + AddPointer(castConstantPoolSDNode(N)-get()); break; } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp SelectionDAGCSEMap.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.326 - 1.327 SelectionDAGCSEMap.cpp updated: 1.6 - 1.7 --- Log message: Add code to resize the CSEMap hash table. This doesn't speedup codegen of kimwitu, but seems like a good idea from a avoid performance cliffs standpoint :) --- Diffs of the changes: (+47 -3) SelectionDAG.cpp |1 + SelectionDAGCSEMap.cpp | 49 ++--- 2 files changed, 47 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.326 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.327 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.326Mon Aug 14 15:12:44 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Aug 14 17:19:25 2006 @@ -469,6 +469,7 @@ SelectionDAG::~SelectionDAG() { while (!AllNodes.empty()) { SDNode *N = AllNodes.begin(); +N-SetNextInBucket(0); delete [] N-OperandList; N-OperandList = 0; N-NumOperands = 0; Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cpp:1.6 llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cpp:1.7 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cpp:1.6Mon Aug 14 15:12:44 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cppMon Aug 14 17:19:25 2006 @@ -157,7 +157,7 @@ // SelectionDAGCSEMap Implementation SelectionDAGCSEMap::SelectionDAGCSEMap() : NumNodes(0) { - NumBuckets = 256; + NumBuckets = 64; Buckets = new void*[NumBuckets]; memset(Buckets, 0, NumBuckets*sizeof(void*)); } @@ -176,6 +176,15 @@ return static_castSDNode*(NextInBucketPtr); } +/// GetNextPtr - This is just like the previous GetNextPtr implementation, but +/// allows a bucket array to be specified. +SDNode *SelectionDAGCSEMap::GetNextPtr(void *NextInBucketPtr, void **Bucks, + unsigned NumBuck) { + if (NextInBucketPtr = Bucks NextInBucketPtr Bucks+NumBuck) +return 0; + return static_castSDNode*(NextInBucketPtr); +} + void **SelectionDAGCSEMap::GetBucketPtr(void *NextInBucketPtr) { //assert(NextInBucketPtr = Buckets NextInBucketPtr Buckets+NumBuckets // NextInBucketPtr is not a bucket ptr); @@ -185,13 +194,42 @@ /// GetBucketFor - Hash the specified node ID and return the hash bucket for the /// specified ID. void **SelectionDAGCSEMap::GetBucketFor(const NodeID ID) const { - // TODO: if load is high, resize hash table. - // NumBuckets is always a power of 2. unsigned BucketNum = ID.ComputeHash() (NumBuckets-1); return Buckets+BucketNum; } +/// GrowHashTable - Double the size of the hash table and rehash everything. +/// +void SelectionDAGCSEMap::GrowHashTable() { + void **OldBuckets = Buckets; + unsigned OldNumBuckets = NumBuckets; + NumBuckets = 1; + + // Reset the node count to zero: we're going to reinsert everything. + NumNodes = 0; + + // Clear out new buckets. + Buckets = new void*[NumBuckets]; + memset(Buckets, 0, NumBuckets*sizeof(void*)); + + // Walk the old buckets, rehashing nodes into their new place. + for (unsigned i = 0; i != OldNumBuckets; ++i) { +void *Probe = OldBuckets[i]; +if (!Probe) continue; +while (SDNode *NodeInBucket = GetNextPtr(Probe, OldBuckets, OldNumBuckets)){ + // Figure out the next link, remove NodeInBucket from the old link. + Probe = NodeInBucket-getNextInBucket(); + NodeInBucket-SetNextInBucket(0); + + // Insert the node into the new bucket, after recomputing the hash. + InsertNode(NodeInBucket, GetBucketFor(NodeID(NodeInBucket))); +} + } + + delete[] OldBuckets; +} + /// FindNodeOrInsertPos - Look up the node specified by ID. If it exists, /// return it. If not, return the insertion token that will make insertion /// faster. @@ -226,6 +264,11 @@ /// FindNodeOrInsertPos. void SelectionDAGCSEMap::InsertNode(SDNode *N, void *InsertPos) { ++NumNodes; + // Do we need to grow the hashtable? + if (NumNodes NumBuckets*2) { +GrowHashTable(); +InsertPos = GetBucketFor(NodeID(N)); + } /// The insert position is actually a bucket pointer. void **Bucket = static_castvoid**(InsertPos); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.327 - 1.328 --- Log message: remove SelectionDAG::InsertISelMapEntry, it is dead --- Diffs of the changes: (+0 -9) SelectionDAG.cpp |9 - 1 files changed, 9 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.327 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.328 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.327Mon Aug 14 17:19:25 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Aug 14 17:24:39 2006 @@ -2901,12 +2901,3 @@ std::cerr \n\n; } -/// InsertISelMapEntry - A helper function to insert a key / element pair -/// into a SDOperand to SDOperand map. This is added to avoid the map -/// insertion operator from being inlined. -void SelectionDAG::InsertISelMapEntry(std::mapSDOperand, SDOperand Map, - SDNode *Key, unsigned KeyResNo, - SDNode *Element, unsigned ElementResNo) { - Map.insert(std::make_pair(SDOperand(Key, KeyResNo), -SDOperand(Element, ElementResNo))); -} ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.328 - 1.329 --- Log message: Add a new getNode() method that takes a pointer to an already-intern'd list of value-type nodes. This avoids having to do mallocs for std::vectors of valuetypes when a node returns more than one type. --- Diffs of the changes: (+70 -78) SelectionDAG.cpp | 148 ++- 1 files changed, 70 insertions(+), 78 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.328 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.329 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.328Mon Aug 14 17:24:39 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Aug 14 18:31:51 2006 @@ -1454,30 +1454,26 @@ SDOperand SV) { SDOperand Ops[] = { Chain, Ptr, SV, getConstant(Count, MVT::i32), getValueType(EVT) }; - std::vectorMVT::ValueType VTs; - VTs.reserve(2); - VTs.push_back(MVT::Vector); VTs.push_back(MVT::Other); // Add token chain. - return getNode(ISD::VLOAD, VTs, Ops, 5); + // Add token chain. + MVT::ValueType *VTs = getNodeValueTypes(MVT::Vector, MVT::Other); + return getNode(ISD::VLOAD, VTs, 2, Ops, 5); } SDOperand SelectionDAG::getExtLoad(unsigned Opcode, MVT::ValueType VT, SDOperand Chain, SDOperand Ptr, SDOperand SV, MVT::ValueType EVT) { SDOperand Ops[] = { Chain, Ptr, SV, getValueType(EVT) }; - std::vectorMVT::ValueType VTs; - VTs.reserve(2); - VTs.push_back(VT); VTs.push_back(MVT::Other); // Add token chain. - return getNode(Opcode, VTs, Ops, 4); + MVT::ValueType *VTs = getNodeValueTypes(VT, MVT::Other); + return getNode(Opcode, VTs, 2, Ops, 4); } SDOperand SelectionDAG::getVAArg(MVT::ValueType VT, SDOperand Chain, SDOperand Ptr, SDOperand SV) { SDOperand Ops[] = { Chain, Ptr, SV }; - std::vectorMVT::ValueType VTs; - VTs.reserve(2); - VTs.push_back(VT); VTs.push_back(MVT::Other); // Add token chain. - return getNode(ISD::VAARG, VTs, Ops, 3); + // Add token chain. + MVT::ValueType *VTs = getNodeValueTypes(VT, MVT::Other); + return getNode(ISD::VAARG, VTs, 2, Ops, 3); } SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, @@ -1552,29 +1548,36 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, std::vectorMVT::ValueType ResultTys, const SDOperand *Ops, unsigned NumOps) { - if (ResultTys.size() == 1) -return getNode(Opcode, ResultTys[0], Ops, NumOps); + return getNode(Opcode, getNodeValueTypes(ResultTys), ResultTys.size(), + Ops, NumOps); +} + +SDOperand SelectionDAG::getNode(unsigned Opcode, +const MVT::ValueType *VTs, unsigned NumVTs, +const SDOperand *Ops, unsigned NumOps) { + if (NumVTs == 1) +return getNode(Opcode, VTs[0], Ops, NumOps); switch (Opcode) { case ISD::EXTLOAD: case ISD::SEXTLOAD: case ISD::ZEXTLOAD: { MVT::ValueType EVT = castVTSDNode(Ops[3])-getVT(); -assert(NumOps == 4 ResultTys.size() == 2 Bad *EXTLOAD!); +assert(NumOps == 4 NumVTs == 2 Bad *EXTLOAD!); // If they are asking for an extending load from/to the same thing, return a // normal load. -if (ResultTys[0] == EVT) - return getLoad(ResultTys[0], Ops[0], Ops[1], Ops[2]); -if (MVT::isVector(ResultTys[0])) { - assert(EVT == MVT::getVectorBaseType(ResultTys[0]) +if (VTs[0] == EVT) + return getLoad(VTs[0], Ops[0], Ops[1], Ops[2]); +if (MVT::isVector(VTs[0])) { + assert(EVT == MVT::getVectorBaseType(VTs[0]) Invalid vector extload!); } else { - assert(EVT ResultTys[0] + assert(EVT VTs[0] Should only be an extending load, not truncating!); } -assert((Opcode == ISD::EXTLOAD || MVT::isInteger(ResultTys[0])) +assert((Opcode == ISD::EXTLOAD || MVT::isInteger(VTs[0])) Cannot sign/zero extend a FP/Vector load!); -assert(MVT::isInteger(ResultTys[0]) == MVT::isInteger(EVT) +assert(MVT::isInteger(VTs[0]) == MVT::isInteger(EVT) Cannot convert from FP to Int or Int - FP!); break; } @@ -1603,8 +1606,7 @@ // Memoize the node unless it returns a flag. SDNode *N; - MVT::ValueType *VTs = getNodeValueTypes(ResultTys); - if (ResultTys.back() != MVT::Flag) { + if (VTs[NumVTs-1] != MVT::Flag) { SelectionDAGCSEMap::NodeID ID; ID.SetOpcode(Opcode); ID.SetValueTypes(VTs); @@ -1613,11 +1615,11 @@ if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); N = new SDNode(Opcode, Ops, NumOps); -N-setValueTypes(VTs, ResultTys.size()); +N-setValueTypes(VTs, NumVTs);
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.322 - 1.323 --- Log message: eliminate the NullaryOps map, use CSEMap instead. --- Diffs of the changes: (+18 -22) SelectionDAG.cpp | 40 ++-- 1 files changed, 18 insertions(+), 22 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.322 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.323 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.322Fri Aug 11 12:46:28 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Aug 11 13:38:11 2006 @@ -430,18 +430,8 @@ break; } default: -if (N-getNumValues() == 1) { - if (N-getNumOperands() == 0) { -Erased = NullaryOps.erase(std::make_pair(N-getOpcode(), - N-getValueType(0))); - } else { -// Remove it from the CSE Map. -Erased = CSEMap.RemoveNode(N); - } -} else { - // Remove it from the CSE Map. - Erased = CSEMap.RemoveNode(N); -} +// Remove it from the CSE Map. +Erased = CSEMap.RemoveNode(N); break; } #ifndef NDEBUG @@ -973,11 +963,15 @@ /// getNode - Gets or creates the specified node. /// SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT) { - SDNode *N = NullaryOps[std::make_pair(Opcode, VT)]; - if (!N) { -N = new SDNode(Opcode, VT); -AllNodes.push_back(N); - } + MVT::ValueType *VTs = getNodeValueTypes(VT); + SelectionDAGCSEMap::NodeID ID(Opcode, VTs); + void *IP = 0; + if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) +return SDOperand(E, 0); + SDNode *N = new SDNode(Opcode, VT); + CSEMap.InsertNode(N, IP); + + AllNodes.push_back(N); return SDOperand(N, 0); } @@ -1892,16 +1886,18 @@ /// the current one. SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT) { - // If an identical node already exists, use it. - SDNode *ON = NullaryOps[std::make_pair(ISD::BUILTIN_OP_END+TargetOpc, VT)]; - if (ON) return SDOperand(ON, 0); - + MVT::ValueType *VTs = getNodeValueTypes(VT); + SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs); + void *IP = 0; + if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) +return SDOperand(ON, 0); + RemoveNodeFromCSEMaps(N); N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); N-setValueTypes(getNodeValueTypes(VT), 1); - ON = N; // Memoize the new node. + CSEMap.InsertNode(N, IP); return SDOperand(N, 0); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp SelectionDAGCSEMap.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.323 - 1.324 SelectionDAGCSEMap.cpp updated: 1.1 - 1.2 --- Log message: Move the BBNodes, GlobalValues, TargetGlobalValues, Constants, TargetConstants, RegNodes, and ValueNodes maps into the CSEMap. --- Diffs of the changes: (+83 -88) SelectionDAG.cpp | 145 +++-- SelectionDAGCSEMap.cpp | 26 2 files changed, 83 insertions(+), 88 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.323 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.324 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.323Fri Aug 11 13:38:11 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Aug 11 16:01:22 2006 @@ -341,15 +341,6 @@ bool Erased = false; switch (N-getOpcode()) { case ISD::HANDLENODE: return; // noop. - case ISD::Constant: -Erased = Constants.erase(std::make_pair(castConstantSDNode(N)-getValue(), -N-getValueType(0))); -break; - case ISD::TargetConstant: -Erased = TargetConstants.erase(std::make_pair( -castConstantSDNode(N)-getValue(), - N-getValueType(0))); -break; case ISD::ConstantFP: { uint64_t V = DoubleToBits(castConstantFPSDNode(N)-getValue()); Erased = ConstantFPs.erase(std::make_pair(V, N-getValueType(0))); @@ -369,18 +360,6 @@ Erased = CondCodeNodes[castCondCodeSDNode(N)-get()] != 0; CondCodeNodes[castCondCodeSDNode(N)-get()] = 0; break; - case ISD::GlobalAddress: { -GlobalAddressSDNode *GN = castGlobalAddressSDNode(N); -Erased = GlobalValues.erase(std::make_pair(GN-getGlobal(), - GN-getOffset())); -break; - } - case ISD::TargetGlobalAddress: { -GlobalAddressSDNode *GN = castGlobalAddressSDNode(N); -Erased =TargetGlobalValues.erase(std::make_pair(GN-getGlobal(), -GN-getOffset())); -break; - } case ISD::FrameIndex: Erased = FrameIndices.erase(castFrameIndexSDNode(N)-getIndex()); break; @@ -406,9 +385,6 @@ std::make_pair(castConstantPoolSDNode(N)-getOffset(), castConstantPoolSDNode(N)-getAlignment(; break; - case ISD::BasicBlock: -Erased = BBNodes.erase(castBasicBlockSDNode(N)-getBasicBlock()); -break; case ISD::ExternalSymbol: Erased = ExternalSymbols.erase(castExternalSymbolSDNode(N)-getSymbol()); break; @@ -420,15 +396,6 @@ Erased = ValueTypeNodes[castVTSDNode(N)-getVT()] != 0; ValueTypeNodes[castVTSDNode(N)-getVT()] = 0; break; - case ISD::Register: -Erased = RegNodes.erase(std::make_pair(castRegisterSDNode(N)-getReg(), - N-getValueType(0))); -break; - case ISD::SRCVALUE: { -SrcValueSDNode *SVN = castSrcValueSDNode(N); -Erased =ValueNodes.erase(std::make_pair(SVN-getValue(), SVN-getOffset())); -break; - } default: // Remove it from the CSE Map. Erased = CSEMap.RemoveNode(N); @@ -551,21 +518,6 @@ getConstant(Imm, Op.getValueType())); } -SDOperand SelectionDAG::getConstant(uint64_t Val, MVT::ValueType VT) { - assert(MVT::isInteger(VT) Cannot create FP integer constant!); - assert(!MVT::isVector(VT) Cannot create Vector ConstantSDNodes!); - - // Mask out any bits that are not valid for this constant. - if (VT != MVT::i64) -Val = ((uint64_t)1 MVT::getSizeInBits(VT)) - 1; - - SDNode *N = Constants[std::make_pair(Val, VT)]; - if (N) return SDOperand(N, 0); - N = new ConstantSDNode(false, Val, VT); - AllNodes.push_back(N); - return SDOperand(N, 0); -} - SDOperand SelectionDAG::getString(const std::string Val) { StringSDNode *N = StringNodes[Val]; if (!N) { @@ -575,19 +527,26 @@ return SDOperand(N, 0); } -SDOperand SelectionDAG::getTargetConstant(uint64_t Val, MVT::ValueType VT) { +SDOperand SelectionDAG::getConstant(uint64_t Val, MVT::ValueType VT, bool isT) { assert(MVT::isInteger(VT) Cannot create FP integer constant!); - // Mask out any bits that are not valid for this constant. - if (VT != MVT::i64) -Val = ((uint64_t)1 MVT::getSizeInBits(VT)) - 1; + assert(!MVT::isVector(VT) Cannot create Vector ConstantSDNodes!); - SDNode *N = TargetConstants[std::make_pair(Val, VT)]; - if (N) return SDOperand(N, 0); - N = new ConstantSDNode(true, Val, VT); + // Mask out any bits that are not valid for this constant. + Val = MVT::getIntVTBitMask(VT); + + unsigned Opc = isT ? ISD::TargetConstant : ISD::Constant; + SelectionDAGCSEMap::NodeID ID(Opc, getNodeValueTypes(VT)); + ID.AddInteger(Val); + void *IP = 0; + if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) +return SDOperand(E, 0); + SDNode *N
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp SelectionDAGCSEMap.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.324 - 1.325 SelectionDAGCSEMap.cpp updated: 1.2 - 1.3 --- Log message: Remove 8 more std::map's. --- Diffs of the changes: (+58 -92) SelectionDAG.cpp | 132 ++--- SelectionDAGCSEMap.cpp | 18 ++ 2 files changed, 58 insertions(+), 92 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.324 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.325 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.324Fri Aug 11 16:01:22 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Aug 11 16:55:30 2006 @@ -341,16 +341,6 @@ bool Erased = false; switch (N-getOpcode()) { case ISD::HANDLENODE: return; // noop. - case ISD::ConstantFP: { -uint64_t V = DoubleToBits(castConstantFPSDNode(N)-getValue()); -Erased = ConstantFPs.erase(std::make_pair(V, N-getValueType(0))); -break; - } - case ISD::TargetConstantFP: { -uint64_t V = DoubleToBits(castConstantFPSDNode(N)-getValue()); -Erased = TargetConstantFPs.erase(std::make_pair(V, N-getValueType(0))); -break; - } case ISD::STRING: Erased = StringNodes.erase(castStringSDNode(N)-getValue()); break; @@ -360,31 +350,6 @@ Erased = CondCodeNodes[castCondCodeSDNode(N)-get()] != 0; CondCodeNodes[castCondCodeSDNode(N)-get()] = 0; break; - case ISD::FrameIndex: -Erased = FrameIndices.erase(castFrameIndexSDNode(N)-getIndex()); -break; - case ISD::TargetFrameIndex: -Erased = TargetFrameIndices.erase(castFrameIndexSDNode(N)-getIndex()); -break; - case ISD::JumpTable: -Erased = JumpTableIndices.erase(castJumpTableSDNode(N)-getIndex()); -break; - case ISD::TargetJumpTable: -Erased = - TargetJumpTableIndices.erase(castJumpTableSDNode(N)-getIndex()); -break; - case ISD::ConstantPool: -Erased = ConstantPoolIndices. - erase(std::make_pair(castConstantPoolSDNode(N)-get(), - std::make_pair(castConstantPoolSDNode(N)-getOffset(), - castConstantPoolSDNode(N)-getAlignment(; -break; - case ISD::TargetConstantPool: -Erased = TargetConstantPoolIndices. - erase(std::make_pair(castConstantPoolSDNode(N)-get(), - std::make_pair(castConstantPoolSDNode(N)-getOffset(), - castConstantPoolSDNode(N)-getAlignment(; -break; case ISD::ExternalSymbol: Erased = ExternalSymbols.erase(castExternalSymbolSDNode(N)-getSymbol()); break; @@ -547,7 +512,8 @@ } -SDOperand SelectionDAG::getConstantFP(double Val, MVT::ValueType VT) { +SDOperand SelectionDAG::getConstantFP(double Val, MVT::ValueType VT, + bool isTarget) { assert(MVT::isFloatingPoint(VT) Cannot create integer FP constant!); if (VT == MVT::f32) Val = (float)Val; // Mask out extra precision. @@ -555,24 +521,14 @@ // Do the map lookup using the actual bit pattern for the floating point // value, so that we don't have problems with 0.0 comparing equal to -0.0, and // we don't have issues with SNANs. - SDNode *N = ConstantFPs[std::make_pair(DoubleToBits(Val), VT)]; - if (N) return SDOperand(N, 0); - N = new ConstantFPSDNode(false, Val, VT); - AllNodes.push_back(N); - return SDOperand(N, 0); -} - -SDOperand SelectionDAG::getTargetConstantFP(double Val, MVT::ValueType VT) { - assert(MVT::isFloatingPoint(VT) Cannot create integer FP constant!); - if (VT == MVT::f32) -Val = (float)Val; // Mask out extra precision. - - // Do the map lookup using the actual bit pattern for the floating point - // value, so that we don't have problems with 0.0 comparing equal to -0.0, and - // we don't have issues with SNANs. - SDNode *N = TargetConstantFPs[std::make_pair(DoubleToBits(Val), VT)]; - if (N) return SDOperand(N, 0); - N = new ConstantFPSDNode(true, Val, VT); + unsigned Opc = isTarget ? ISD::TargetConstantFP : ISD::ConstantFP; + SelectionDAGCSEMap::NodeID ID(Opc, getNodeValueTypes(VT)); + ID.AddInteger(DoubleToBits(Val)); + void *IP = 0; + if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) +return SDOperand(E, 0); + SDNode *N = new ConstantFPSDNode(isTarget, Val, VT); + CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDOperand(N, 0); } @@ -593,57 +549,49 @@ return SDOperand(N, 0); } -SDOperand SelectionDAG::getFrameIndex(int FI, MVT::ValueType VT) { - SDNode *N = FrameIndices[FI]; - if (N) return SDOperand(N, 0); - N = new FrameIndexSDNode(FI, VT, false); - AllNodes.push_back(N); - return SDOperand(N, 0); -} - -SDOperand SelectionDAG::getTargetFrameIndex(int FI, MVT::ValueType VT) { - SDNode *N = TargetFrameIndices[FI]; - if (N) return SDOperand(N, 0); - N = new FrameIndexSDNode(FI, VT, true); - AllNodes.push_back(N); - return SDOperand(N, 0); -} -
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.317 - 1.318 --- Log message: Clear TopOrder before assigning topological order. Some clean ups. --- Diffs of the changes: (+3 -1) SelectionDAG.cpp |4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.317 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.318 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.317Fri Aug 4 12:45:20 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Aug 7 17:13:29 2006 @@ -474,6 +474,7 @@ if (!Erased N-getValueType(N-getNumValues()-1) != MVT::Flag !N-isTargetOpcode()) { N-dump(); +std::cerr \n; assert(0 Node is not in map!); } #endif @@ -2497,7 +2498,7 @@ return getNode(ISD::BUILTIN_OP_END+Opcode, ResultTys, Ops).Val; } -// ReplaceAllUsesWith - Modify anything using 'From' to use 'To' instead. +/// ReplaceAllUsesWith - Modify anything using 'From' to use 'To' instead. /// This can cause recursive merging of nodes in the DAG. /// /// This version assumes From/To have a single result value. @@ -2711,6 +2712,7 @@ Sources.push_back(N); } + TopOrder.clear(); while (!Sources.empty()) { SDNode *N = Sources.back(); Sources.pop_back(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.315 - 1.316 --- Log message: - Change AssignTopologicalOrder to return vector of SDNode* by reference. - Tweak implementation to avoid using std::map. --- Diffs of the changes: (+22 -16) SelectionDAG.cpp | 38 ++ 1 files changed, 22 insertions(+), 16 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.315 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.316 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.315Tue Aug 1 03:20:41 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Aug 2 17:00:34 2006 @@ -28,7 +28,7 @@ #include set #include cmath #include algorithm -#include deque +#include queue using namespace llvm; static bool isCommutativeBinOp(unsigned Opcode) { @@ -2711,37 +2711,43 @@ } /// AssignTopologicalOrder - Assign a unique node id for each node in the DAG -/// based on their topological order. It returns a vector of the SDNodes* in -/// assigned order. -std::vectorSDNode* SelectionDAG::AssignTopologicalOrder() { +/// based on their topological order. It returns the maximum id and a vector +/// of the SDNodes* in assigned order by reference. +unsigned SelectionDAG::AssignTopologicalOrder(std::vectorSDNode* TopOrder) { unsigned DAGSize = AllNodes.size(); - std::vectorSDNode* TopOrder; - std::mapSDNode*, unsigned InDegree; - std::dequeSDNode* Sources; + std::vectorunsigned InDegree(DAGSize); + std::vectorSDNode* Sources; + + // Use a two pass approach to avoid using a std::map which is slow. + unsigned Id = 0; for (allnodes_iterator I = allnodes_begin(),E = allnodes_end(); I != E; ++I){ SDNode *N = I; +N-setNodeId(Id++); unsigned Degree = N-use_size(); -InDegree[N] = Degree; +InDegree[N-getNodeId()] = Degree; if (Degree == 0) - Sources.push_back(I); + Sources.push_back(N); } - int Id = 0; while (!Sources.empty()) { -SDNode *N = Sources.front(); -Sources.pop_front(); +SDNode *N = Sources.back(); +Sources.pop_back(); TopOrder.push_back(N); -N-setNodeId(Id++); for (SDNode::op_iterator I = N-op_begin(), E = N-op_end(); I != E; ++I) { SDNode *P = I-Val; - unsigned Degree = InDegree[P] - 1; + unsigned Degree = --InDegree[P-getNodeId()]; if (Degree == 0) Sources.push_back(P); - InDegree[P] = Degree; } } - return TopOrder; + // Second pass, assign the actual topological order as node ids. + Id = 0; + for (std::vectorSDNode*::iterator TI = TopOrder.begin(),TE = TopOrder.end(); + TI != TE; ++TI) +(*TI)-setNodeId(Id++); + + return Id; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.314 - 1.315 --- Log message: Added AssignTopologicalOrder() to assign each node an unique id based on their topological order. --- Diffs of the changes: (+38 -2) SelectionDAG.cpp | 40 ++-- 1 files changed, 38 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.314 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.315 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.314Thu Jul 27 19:45:53 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Aug 1 03:20:41 2006 @@ -28,6 +28,7 @@ #include set #include cmath #include algorithm +#include deque using namespace llvm; static bool isCommutativeBinOp(unsigned Opcode) { @@ -2698,8 +2699,8 @@ } -/// AssignNodeIds - Assign a unique node id for each node in the DAG. It returns -/// the maximum id. +/// AssignNodeIds - Assign a unique node id for each node in the DAG based on +/// their allnodes order. It returns the maximum id. unsigned SelectionDAG::AssignNodeIds() { unsigned Id = 0; for (allnodes_iterator I = allnodes_begin(), E = allnodes_end(); I != E; ++I){ @@ -2709,6 +2710,41 @@ return Id; } +/// AssignTopologicalOrder - Assign a unique node id for each node in the DAG +/// based on their topological order. It returns a vector of the SDNodes* in +/// assigned order. +std::vectorSDNode* SelectionDAG::AssignTopologicalOrder() { + unsigned DAGSize = AllNodes.size(); + std::vectorSDNode* TopOrder; + std::mapSDNode*, unsigned InDegree; + std::dequeSDNode* Sources; + for (allnodes_iterator I = allnodes_begin(),E = allnodes_end(); I != E; ++I){ +SDNode *N = I; +unsigned Degree = N-use_size(); +InDegree[N] = Degree; +if (Degree == 0) + Sources.push_back(I); + } + + int Id = 0; + while (!Sources.empty()) { +SDNode *N = Sources.front(); +Sources.pop_front(); +TopOrder.push_back(N); +N-setNodeId(Id++); +for (SDNode::op_iterator I = N-op_begin(), E = N-op_end(); I != E; ++I) { + SDNode *P = I-Val; + unsigned Degree = InDegree[P] - 1; + if (Degree == 0) +Sources.push_back(P); + InDegree[P] = Degree; +} + } + + return TopOrder; +} + + //===--===// // SDNode Class ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.313 - 1.314 --- Log message: Remove InFlightSet hack. No longer needed. --- Diffs of the changes: (+0 -14) SelectionDAG.cpp | 14 -- 1 files changed, 14 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.313 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.314 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.313Thu Jul 27 02:36:47 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Jul 27 19:45:53 2006 @@ -3115,17 +3115,3 @@ Map.insert(std::make_pair(SDOperand(Key, KeyResNo), SDOperand(Element, ElementResNo))); } - -/// InsertInFlightSetEntry - A helper function to insert a SDNode* to a -/// SDNode* set. This is added to avoid the set insertion operator from being -/// inlined. -void SelectionDAG::InsertInFlightSetEntry(std::setSDNode* Set, SDNode *N) { - Set.insert(N); -} - -/// RemoveInFlightSetEntry - A helper function to remove a SDNode* from a -/// SDNode* set. This is added to avoid the set removal operator from being -/// inlined. -void SelectionDAG::RemoveInFlightSetEntry(std::setSDNode* Set, SDNode *N) { - Set.erase(N); -} ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.310 - 1.311 --- Log message: Add an out-of-line virtual method for the sdnode class to give it a home. --- Diffs of the changes: (+4 -0) SelectionDAG.cpp |4 1 files changed, 4 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.310 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.311 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.310Thu Jun 29 18:57:05 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Jul 18 19:00:37 2006 @@ -2702,6 +2702,10 @@ // SDNode Class //===--===// +// Out-of-line virtual method to give class a home. +void SDNode::ANCHOR() { +} + /// getValueTypeList - Return a pointer to the specified value type. /// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.309 - 1.310 --- Log message: Ugly hack! Add helper functions InsertInFlightSetEntry and RemoveInFlightSetEntry. They are used in place of direct set operators to reduce instruction selection function stack size. --- Diffs of the changes: (+14 -0) SelectionDAG.cpp | 14 ++ 1 files changed, 14 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.309 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.310 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.309Wed Jun 28 13:29:47 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Jun 29 18:57:05 2006 @@ -3099,3 +3099,17 @@ Map.insert(std::make_pair(SDOperand(Key, KeyResNo), SDOperand(Element, ElementResNo))); } + +/// InsertInFlightSetEntry - A helper function to insert a SDNode* to a +/// SDNode* set. This is added to avoid the set insertion operator from being +/// inlined. +void SelectionDAG::InsertInFlightSetEntry(std::setSDNode* Set, SDNode *N) { + Set.insert(N); +} + +/// RemoveInFlightSetEntry - A helper function to remove a SDNode* from a +/// SDNode* set. This is added to avoid the set removal operator from being +/// inlined. +void SelectionDAG::RemoveInFlightSetEntry(std::setSDNode* Set, SDNode *N) { + Set.erase(N); +} ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.306 - 1.307 --- Log message: remove dead vars --- Diffs of the changes: (+1 -2) SelectionDAG.cpp |3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.306 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.307 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.306Fri May 12 12:03:46 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri May 12 13:04:28 2006 @@ -1539,7 +1539,7 @@ // Perform various simplifications. ConstantSDNode *N1C = dyn_castConstantSDNode(N1.Val); ConstantSDNode *N2C = dyn_castConstantSDNode(N2.Val); - ConstantSDNode *N3C = dyn_castConstantSDNode(N3.Val); + //ConstantSDNode *N3C = dyn_castConstantSDNode(N3.Val); switch (Opcode) { case ISD::SETCC: { // Use SimplifySetCC to simplify SETCC's. @@ -1696,7 +1696,6 @@ default: break; } - ConstantSDNode *N1C = dyn_castConstantSDNode(Ops[1].Val); switch (Opcode) { default: break; case ISD::TRUNCSTORE: { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.304 - 1.305 --- Log message: Fold shifts with undef operands. --- Diffs of the changes: (+7 -0) SelectionDAG.cpp |7 +++ 1 files changed, 7 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.304 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.305 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.304Sat May 6 18:05:41 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon May 8 12:29:49 2006 @@ -1439,11 +1439,14 @@ case ISD::FSUB: case ISD::FDIV: case ISD::FREM: + case ISD::SRA: return N1; // fold op(undef, arg2) - undef case ISD::UDIV: case ISD::SDIV: case ISD::UREM: case ISD::SREM: + case ISD::SRL: + case ISD::SHL: return getConstant(0, VT);// fold op(undef, arg2) - 0 } } @@ -1467,9 +1470,13 @@ return N2; // fold op(arg1, undef) - undef case ISD::MUL: case ISD::AND: +case ISD::SRL: +case ISD::SHL: return getConstant(0, VT); // fold op(arg1, undef) - 0 case ISD::OR: return getConstant(MVT::getIntVTBitMask(VT), VT); +case ISD::SRA: + return N1; } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.303 - 1.304 --- Log message: constant fold sign_extend_inreg --- Diffs of the changes: (+9 -1) SelectionDAG.cpp | 10 +- 1 files changed, 9 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.303 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.304 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.303Thu Apr 27 00:01:07 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat May 6 18:05:41 2006 @@ -1335,6 +1335,14 @@ ConstantSDNode *N1C = dyn_castConstantSDNode(N1.Val); ConstantSDNode *N2C = dyn_castConstantSDNode(N2.Val); if (N1C) { +if (Opcode == ISD::SIGN_EXTEND_INREG) { + int64_t Val = N1C-getValue(); + unsigned FromBits = MVT::getSizeInBits(castVTSDNode(N2)-getVT()); + Val = 64-FromBits; + Val = 64-FromBits; + return getConstant(Val, VT); +} + if (N2C) { uint64_t C1 = N1C-getValue(), C2 = N2C-getValue(); switch (Opcode) { @@ -1441,7 +1449,7 @@ } } - // Fold a bunch of operators that + // Fold a bunch of operators when the RHS is undef. if (N2.getOpcode() == ISD::UNDEF) { switch (Opcode) { case ISD::ADD: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.302 - 1.303 --- Log message: Fix Regression/CodeGen/Generic/2006-04-26-SetCCAnd.ll and PR748: http://llvm.cs.uiuc.edu/PR748 . --- Diffs of the changes: (+29 -1) SelectionDAG.cpp | 30 +- 1 files changed, 29 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.302 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.303 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.302Sat Apr 22 13:53:45 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Apr 27 00:01:07 2006 @@ -232,7 +232,22 @@ return ISD::SETCC_INVALID; // Combine all of the condition bits. - return ISD::CondCode(Op1 Op2); + ISD::CondCode Result = ISD::CondCode(Op1 Op2); + + // Canonicalize illegal integer setcc's. + if (isInteger) { +switch (Result) { +default: break; +case ISD::SETUO: // e.g. SETUGT SETULT + Result = ISD::SETFALSE; + break; +case ISD::SETUEQ: // e.g. SETUGE SETULE + Result = ISD::SETEQ; + break; +} + } + + return Result; } const TargetMachine SelectionDAG::getTarget() const { @@ -849,6 +864,19 @@ case ISD::SETFALSE2: return getConstant(0, VT); case ISD::SETTRUE: case ISD::SETTRUE2: return getConstant(1, VT); + + case ISD::SETOEQ: + case ISD::SETOGT: + case ISD::SETOGE: + case ISD::SETOLT: + case ISD::SETOLE: + case ISD::SETONE: + case ISD::SETO: + case ISD::SETUO: + case ISD::SETUEQ: + case ISD::SETUNE: +assert(!MVT::isInteger(N1.getValueType()) Illegal setcc for integer!); +break; } if (ConstantSDNode *N2C = dyn_castConstantSDNode(N2.Val)) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.300 - 1.301 --- Log message: Implement folding of a bunch of binops with undef --- Diffs of the changes: (+46 -0) SelectionDAG.cpp | 46 ++ 1 files changed, 46 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.300 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.301 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.300Sat Apr 15 18:38:00 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Apr 20 00:39:12 2006 @@ -1367,6 +1367,52 @@ } } } + + // Canonicalize an UNDEF to the RHS, even over a constant. + if (N1.getOpcode() == ISD::UNDEF) { +if (isCommutativeBinOp(Opcode)) { + std::swap(N1, N2); +} else { + switch (Opcode) { + case ISD::FP_ROUND_INREG: + case ISD::SIGN_EXTEND_INREG: + case ISD::SUB: + case ISD::FSUB: + case ISD::FDIV: + case ISD::FREM: +return N1; // fold op(undef, arg2) - undef + case ISD::UDIV: + case ISD::SDIV: + case ISD::UREM: + case ISD::SREM: +return getConstant(0, VT);// fold op(undef, arg2) - 0 + } +} + } + + // Fold a bunch of operators that + if (N2.getOpcode() == ISD::UNDEF) { +switch (Opcode) { +case ISD::ADD: +case ISD::SUB: +case ISD::FADD: +case ISD::FSUB: +case ISD::FMUL: +case ISD::FDIV: +case ISD::FREM: +case ISD::UDIV: +case ISD::SDIV: +case ISD::UREM: +case ISD::SREM: +case ISD::XOR: + return N2; // fold op(arg1, undef) - undef +case ISD::MUL: +case ISD::AND: + return getConstant(0, VT); // fold op(arg1, undef) - 0 +case ISD::OR: + return getConstant(MVT::getIntVTBitMask(VT), VT); +} + } // Finally, fold operations that do not require constants. switch (Opcode) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.299 - 1.300 --- Log message: Make these predicates return true for bit_convert(buildvector)'s as well as buildvectors. --- Diffs of the changes: (+8 -0) SelectionDAG.cpp |8 1 files changed, 8 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.299 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.300 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.299Wed Apr 12 11:20:43 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Apr 15 18:38:00 2006 @@ -73,6 +73,10 @@ /// isBuildVectorAllOnes - Return true if the specified node is a /// BUILD_VECTOR where all of the elements are ~0 or undef. bool ISD::isBuildVectorAllOnes(const SDNode *N) { + // Look through a bit convert. + if (N-getOpcode() == ISD::BIT_CONVERT) +N = N-getOperand(0).Val; + if (N-getOpcode() != ISD::BUILD_VECTOR) return false; unsigned i = 0, e = N-getNumOperands(); @@ -117,6 +121,10 @@ /// isBuildVectorAllZeros - Return true if the specified node is a /// BUILD_VECTOR where all of the elements are 0 or undef. bool ISD::isBuildVectorAllZeros(const SDNode *N) { + // Look through a bit convert. + if (N-getOpcode() == ISD::BIT_CONVERT) +N = N-getOperand(0).Val; + if (N-getOpcode() != ISD::BUILD_VECTOR) return false; unsigned i = 0, e = N-getNumOperands(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.297 - 1.298 --- Log message: Don't memoize vloads in the load map! Don't memoize them anywhere here, let getNode do it. This fixes CodeGen/Generic/2006-04-11-vecload.ll --- Diffs of the changes: (+0 -2) SelectionDAG.cpp |2 -- 1 files changed, 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.297 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.298 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.297Sat Apr 8 17:22:57 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Apr 11 22:25:41 2006 @@ -1508,8 +1508,6 @@ SDOperand SelectionDAG::getVecLoad(unsigned Count, MVT::ValueType EVT, SDOperand Chain, SDOperand Ptr, SDOperand SV) { - SDNode *N = Loads[std::make_pair(Ptr, std::make_pair(Chain, EVT))]; - if (N) return SDOperand(N, 0); std::vectorSDOperand Ops; Ops.reserve(5); Ops.push_back(Chain); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.293 - 1.294 --- Log message: Add some missing node names --- Diffs of the changes: (+9 -0) SelectionDAG.cpp |9 + 1 files changed, 9 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.293 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.294 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.293Thu Mar 30 20:06:56 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Apr 1 20:41:18 2006 @@ -2749,6 +2749,15 @@ case ISD::VADD: return vadd; case ISD::VSUB: return vsub; case ISD::VMUL: return vmul; + + case ISD::VADD: return vadd; + case ISD::VSUB: return vsub; + case ISD::VMUL: return vmul; + case ISD::VSDIV: return vsdiv; + case ISD::VUDIV: return vudiv; + case ISD::VAND: return vand; + case ISD::VOR:return vor; + case ISD::VXOR: return vxor; case ISD::SETCC: return setcc; case ISD::SELECT: return select; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.294 - 1.295 --- Log message: These entries already exist --- Diffs of the changes: (+0 -4) SelectionDAG.cpp |4 1 files changed, 4 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.294 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.295 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.294Sat Apr 1 20:41:18 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Apr 1 20:51:27 2006 @@ -2749,10 +2749,6 @@ case ISD::VADD: return vadd; case ISD::VSUB: return vsub; case ISD::VMUL: return vmul; - - case ISD::VADD: return vadd; - case ISD::VSUB: return vsub; - case ISD::VMUL: return vmul; case ISD::VSDIV: return vsdiv; case ISD::VUDIV: return vudiv; case ISD::VAND: return vand; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.290 - 1.291 --- Log message: Add an assertion --- Diffs of the changes: (+2 -0) SelectionDAG.cpp |2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.290 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.291 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.290Mon Mar 27 18:40:09 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Mar 28 13:04:49 2006 @@ -634,6 +634,8 @@ SDOperand SelectionDAG::getConstant(uint64_t Val, MVT::ValueType VT) { assert(MVT::isInteger(VT) Cannot create FP integer constant!); + assert(!MVT::isVector(VT) Cannot create Vector ConstantSDNodes!); + // Mask out any bits that are not valid for this constant. if (VT != MVT::i64) Val = ((uint64_t)1 MVT::getSizeInBits(VT)) - 1; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.291 - 1.292 --- Log message: new node --- Diffs of the changes: (+1 -0) SelectionDAG.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.291 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.292 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.291Tue Mar 28 13:04:49 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Mar 28 13:54:42 2006 @@ -2761,6 +2761,7 @@ case ISD::SCALAR_TO_VECTOR: return scalar_to_vector; case ISD::VBUILD_VECTOR: return vbuild_vector; case ISD::VECTOR_SHUFFLE: return vector_shuffle; + case ISD::VVECTOR_SHUFFLE: return vvector_shuffle; case ISD::VBIT_CONVERT: return vbit_convert; case ISD::ADDC:return addc; case ISD::ADDE:return adde; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.287 - 1.288 --- Log message: Try again --- Diffs of the changes: (+10 -3) SelectionDAG.cpp | 13 ++--- 1 files changed, 10 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.287 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.288 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.287Mon Mar 27 01:26:17 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Mar 27 02:10:26 2006 @@ -91,9 +91,16 @@ if (!castConstantSDNode(NotZero)-isAllOnesValue()) return false; } else if (isaConstantFPSDNode(NotZero)) { -if (DoubleToBits(castConstantFPSDNode(NotZero)-getValue()) == -(0ULL - 1)) - return false; +MVT::ValueType VT = NotZero.getValueType(); +if (VT== MVT::f64) { + if (DoubleToBits(castConstantFPSDNode(NotZero)-getValue()) != + (uint64_t)-1) +return false; +} else { + if (FloatToBits(castConstantFPSDNode(NotZero)-getValue()) != + (uint32_t)-1) +return false; +} } else return false; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.288 - 1.289 --- Log message: Unbreak the build on non-apple compilers :-( --- Diffs of the changes: (+2 -1) SelectionDAG.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.288 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.289 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.288Mon Mar 27 02:10:26 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Mar 27 10:10:59 2006 @@ -2689,10 +2689,11 @@ case ISD::FrameIndex:return FrameIndex; case ISD::ConstantPool: return ConstantPool; case ISD::ExternalSymbol: return ExternalSymbol; - case ISD::INTRINSIC: + case ISD::INTRINSIC: { bool hasChain = getOperand(0).getValueType() == MVT::Other; unsigned IID = castConstantSDNode(getOperand(hasChain))-getValue(); return Intrinsic::getName((Intrinsic::ID)IID); + } case ISD::BUILD_VECTOR: return BUILD_VECTOR; case ISD::TargetConstant: return TargetConstant; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.283 - 1.284 --- Log message: Add ISD::isBuildVectorAllZeros predicate --- Diffs of the changes: (+24 -0) SelectionDAG.cpp | 24 1 files changed, 24 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.283 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.284 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.283Sat Mar 25 16:59:28 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Mar 26 03:50:58 2006 @@ -101,6 +101,30 @@ } +/// isBuildVectorAllZeros - Return true if the specified node is a +/// BUILD_VECTOR where all of the elements are 0 or undef. +bool ISD::isBuildVectorAllZeros(const SDNode *N) { + if (N-getOpcode() != ISD::BUILD_VECTOR) return false; + + bool AllUndef = true; + for (unsigned i = 0, e = N-getNumOperands(); i != e; ++i) { +SDOperand Elt = N-getOperand(i); +if (Elt.getOpcode() != ISD::UNDEF) { + AllUndef = false; + if (isaConstantSDNode(Elt)) { +if (!castConstantSDNode(Elt)-isNullValue()) + return false; + } else if (isaConstantFPSDNode(Elt)) { +if (!castConstantFPSDNode(Elt)-isExactlyValue(0.0)) + return false; + } else +return false; +} + } + + return !AllUndef; +} + /// getSetCCSwappedOperands - Return the operation corresponding to (Y op X) /// when given the operation for (X op Y). ISD::CondCode ISD::getSetCCSwappedOperands(ISD::CondCode Operation) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.284 - 1.285 --- Log message: Instead of printing INTRINSIC on intrinsic node, print the intrinsic name. --- Diffs of the changes: (+5 -1) SelectionDAG.cpp |6 +- 1 files changed, 5 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.284 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.285 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.284Sun Mar 26 03:50:58 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Mar 27 00:45:25 2006 @@ -14,6 +14,7 @@ #include llvm/CodeGen/SelectionDAG.h #include llvm/Constants.h #include llvm/GlobalValue.h +#include llvm/Intrinsics.h #include llvm/Assembly/Writer.h #include llvm/CodeGen/MachineBasicBlock.h #include llvm/Support/MathExtras.h @@ -2665,7 +2666,10 @@ case ISD::FrameIndex:return FrameIndex; case ISD::ConstantPool: return ConstantPool; case ISD::ExternalSymbol: return ExternalSymbol; - case ISD::INTRINSIC: return INTRINSIC; + case ISD::INTRINSIC: +bool hasChain = getOperand(0).getValueType() == MVT::Other; +unsigned IID = castConstantSDNode(getOperand(hasChain))-getValue(); +return Intrinsic::getName((Intrinsic::ID)IID); case ISD::BUILD_VECTOR: return BUILD_VECTOR; case ISD::TargetConstant: return TargetConstant; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.286 - 1.287 --- Log message: Incorrect check for FP all one's --- Diffs of the changes: (+2 -1) SelectionDAG.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.286 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.287 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.286Mon Mar 27 00:58:47 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Mar 27 01:26:17 2006 @@ -91,7 +91,8 @@ if (!castConstantSDNode(NotZero)-isAllOnesValue()) return false; } else if (isaConstantFPSDNode(NotZero)) { -if (!castConstantFPSDNode(NotZero)-isExactlyValue(-1)) +if (DoubleToBits(castConstantFPSDNode(NotZero)-getValue()) == +(0ULL - 1)) return false; } else return false; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.281 - 1.282 --- Log message: Implement the ISD::isBuildVectorAllOnesInteger predicate --- Diffs of the changes: (+32 -1) SelectionDAG.cpp | 33 - 1 files changed, 32 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.281 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.282 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.281Thu Mar 23 20:20:47 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Mar 25 16:57:01 2006 @@ -66,9 +66,40 @@ } //===--===// -// ISD Class +// ISD Namespace //===--===// +/// isBuildVectorAllOnesInteger - Return true if the specified node is a +/// BUILD_VECTOR where all of the elements are ~0 or undef. +bool ISD::isBuildVectorAllOnesInteger(const SDNode *N) { + if (N-getOpcode() != ISD::BUILD_VECTOR || + !MVT::isInteger(N-getOperand(0).getValueType())) return false; + + unsigned i = 0, e = N-getNumOperands(); + + // Skip over all of the undef values. + while (i != e N-getOperand(i).getOpcode() == ISD::UNDEF) +++i; + + // Do not accept an all-undef vector. + if (i == e) return false; + + // Do not accept build_vectors that aren't all constants or which have non-~0 + // elements. + if (!isaConstantSDNode(N) || !castConstantSDNode(N)-isAllOnesValue()) +return false; + + // Okay, we have at least one ~0 value, check to see if the rest match or are + // undefs. + SDOperand NotZero = N-getOperand(i); + for (++i; i != e; ++i) +if (N-getOperand(i) != NotZero +N-getOperand(i).getOpcode() != ISD::UNDEF) + return false; + return true; +} + + /// getSetCCSwappedOperands - Return the operation corresponding to (Y op X) /// when given the operation for (X op Y). ISD::CondCode ISD::getSetCCSwappedOperands(ISD::CondCode Operation) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.282 - 1.283 --- Log message: Fix a bug in ISD::isBuildVectorAllOnesInteger that caused it to always return false --- Diffs of the changes: (+3 -2) SelectionDAG.cpp |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.282 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.283 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.282Sat Mar 25 16:57:01 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Mar 25 16:59:28 2006 @@ -86,12 +86,13 @@ // Do not accept build_vectors that aren't all constants or which have non-~0 // elements. - if (!isaConstantSDNode(N) || !castConstantSDNode(N)-isAllOnesValue()) + SDOperand NotZero = N-getOperand(i); + if (!isaConstantSDNode(NotZero) || + !castConstantSDNode(NotZero)-isAllOnesValue()) return false; // Okay, we have at least one ~0 value, check to see if the rest match or are // undefs. - SDOperand NotZero = N-getOperand(i); for (++i; i != e; ++i) if (N-getOperand(i) != NotZero N-getOperand(i).getOpcode() != ISD::UNDEF) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.279 - 1.280 --- Log message: Identify the INTRINSIC node --- Diffs of the changes: (+1 -0) SelectionDAG.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.279 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.280 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.279Wed Mar 22 14:09:34 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Mar 23 19:04:30 2006 @@ -2615,6 +2615,7 @@ case ISD::FrameIndex:return FrameIndex; case ISD::ConstantPool: return ConstantPool; case ISD::ExternalSymbol: return ExternalSymbol; + case ISD::INTRINSIC: return INTRINSIC; case ISD::BUILD_VECTOR: return BUILD_VECTOR; case ISD::TargetConstant: return TargetConstant; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.280 - 1.281 --- Log message: fix some bogus assertions: noop bitconverts are legal --- Diffs of the changes: (+4 -10) SelectionDAG.cpp | 14 -- 1 files changed, 4 insertions(+), 10 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.280 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.281 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.280Thu Mar 23 19:04:30 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Mar 23 20:20:47 2006 @@ -956,13 +956,10 @@ case ISD::SINT_TO_FP: return getConstantFP(C-getSignExtended(), VT); case ISD::UINT_TO_FP: return getConstantFP(C-getValue(), VT); case ISD::BIT_CONVERT: - if (VT == MVT::f32) { -assert(C-getValueType(0) == MVT::i32 Invalid bit_convert!); + if (VT == MVT::f32 C-getValueType(0) == MVT::i32) return getConstantFP(BitsToFloat(Val), VT); - } else if (VT == MVT::f64) { -assert(C-getValueType(0) == MVT::i64 Invalid bit_convert!); + else if (VT == MVT::f64 C-getValueType(0) == MVT::i64) return getConstantFP(BitsToDouble(Val), VT); - } break; case ISD::BSWAP: switch(VT) { @@ -1035,13 +1032,10 @@ case ISD::FP_TO_UINT: return getConstant((uint64_t)C-getValue(), VT); case ISD::BIT_CONVERT: - if (VT == MVT::i32) { -assert(C-getValueType(0) == MVT::f32 Invalid bit_convert!); + if (VT == MVT::i32 C-getValueType(0) == MVT::f32) return getConstant(FloatToBits(C-getValue()), VT); - } else if (VT == MVT::i64) { -assert(C-getValueType(0) == MVT::f64 Invalid bit_convert!); + else if (VT == MVT::i64 C-getValueType(0) == MVT::f64) return getConstant(DoubleToBits(C-getValue()), VT); - } break; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.275 - 1.276 --- Log message: Add very basic support for VECTOR_SHUFFLE --- Diffs of the changes: (+9 -1) SelectionDAG.cpp | 10 +- 1 files changed, 9 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.275 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.276 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.275Sun Mar 19 00:31:19 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Mar 19 17:56:04 2006 @@ -1360,6 +1360,13 @@ else return N1; // Never-taken branch break; + case ISD::VECTOR_SHUFFLE: +assert(VT == N1.getValueType() VT == N2.getValueType() + MVT::isVector(VT) MVT::isVector(N3.getValueType()) + N3.getOpcode() == ISD::BUILD_VECTOR + MVT::getVectorNumElements(VT) == N3.getNumOperands() + Illegal VECTOR_SHUFFLE node!); +break; } std::vectorSDOperand Ops; @@ -2615,7 +2622,6 @@ case ISD::TargetFrameIndex: return TargetFrameIndex; case ISD::TargetConstantPool: return TargetConstantPool; case ISD::TargetExternalSymbol: return TargetExternalSymbol; - case ISD::VBUILD_VECTOR: return VBUILD_VECTOR; case ISD::CopyToReg: return CopyToReg; case ISD::CopyFromReg: return CopyFromReg; @@ -2665,6 +2671,8 @@ case ISD::INSERT_VECTOR_ELT: return insert_vector_elt; case ISD::VINSERT_VECTOR_ELT: return vinsert_vector_elt; case ISD::SCALAR_TO_VECTOR: return scalar_to_vector; + case ISD::VBUILD_VECTOR: return vbuild_vector; + case ISD::VECTOR_SHUFFLE: return vector_shuffle; case ISD::ADDC:return addc; case ISD::ADDE:return adde; case ISD::SUBC:return subc; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.271 - 1.272 --- Log message: add a couple enum values --- Diffs of the changes: (+3 -1) SelectionDAG.cpp |4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.271 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.272 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.271Thu Mar 16 19:40:33 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Mar 17 13:53:59 2006 @@ -2649,10 +2649,12 @@ case ISD::VADD: return vadd; case ISD::VSUB: return vsub; case ISD::VMUL: return vmul; - + case ISD::SETCC: return setcc; case ISD::SELECT: return select; case ISD::SELECT_CC: return select_cc; + case ISD::INSERT_VECTOR_ELT: return insert_vector_elt; + case ISD::VINSERT_VECTOR_ELT: return vinsert_vector_elt; case ISD::ADDC:return addc; case ISD::ADDE:return adde; case ISD::SUBC:return subc; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.269 - 1.270 SelectionDAGISel.cpp updated: 1.188 - 1.189 --- Log message: add support for vector-vector casts --- Diffs of the changes: (+79 -35) SelectionDAG.cpp |4 - SelectionDAGISel.cpp | 110 +++ 2 files changed, 79 insertions(+), 35 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.269 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.270 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.269Sun Mar 5 17:57:58 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Mar 15 16:19:46 2006 @@ -1086,8 +1086,8 @@ break; case ISD::BIT_CONVERT: // Basic sanity checking. -assert(MVT::getSizeInBits(VT)==MVT::getSizeInBits(Operand.getValueType()) - Cannot BIT_CONVERT between two different types!); +assert(MVT::getSizeInBits(VT) == MVT::getSizeInBits(Operand.getValueType()) +Cannot BIT_CONVERT between two different types!); if (VT == Operand.getValueType()) return Operand; // noop conversion. if (OpOpcode == ISD::BIT_CONVERT) // bitconv(bitconv(x)) - bitconv(x) return getNode(ISD::BIT_CONVERT, VT, Operand.getOperand(0)); Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.188 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.189 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.188Mon Mar 13 07:07:37 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Mar 15 16:19:46 2006 @@ -362,6 +362,9 @@ void setCurrentBasicBlock(MachineBasicBlock *MBB) { CurMBB = MBB; } + SDOperand getLoadFrom(const Type *Ty, SDOperand Ptr, +SDOperand SrcValue, SDOperand Root, +bool isVolatile); SDOperand getIntPtrConstant(uint64_t Val) { return DAG.getConstant(Val, TLI.getPointerTy()); @@ -726,42 +729,78 @@ void SelectionDAGLowering::visitCast(User I) { SDOperand N = getValue(I.getOperand(0)); - MVT::ValueType SrcTy = TLI.getValueType(I.getOperand(0)-getType()); - MVT::ValueType DestTy = TLI.getValueType(I.getType()); + MVT::ValueType SrcVT = TLI.getValueType(I.getOperand(0)-getType()); + MVT::ValueType DestVT = TLI.getValueType(I.getType()); - if (N.getValueType() == DestTy) { + if (N.getValueType() == DestVT) { setValue(I, N); // noop cast. - } else if (DestTy == MVT::i1) { + } else if (DestVT == MVT::i1) { // Cast to bool is a comparison against zero, not truncation to zero. -SDOperand Zero = isInteger(SrcTy) ? DAG.getConstant(0, N.getValueType()) : +SDOperand Zero = isInteger(SrcVT) ? DAG.getConstant(0, N.getValueType()) : DAG.getConstantFP(0.0, N.getValueType()); setValue(I, DAG.getSetCC(MVT::i1, N, Zero, ISD::SETNE)); - } else if (isInteger(SrcTy)) { -if (isInteger(DestTy)) {// Int - Int cast - if (DestTy SrcTy) // Truncating cast? -setValue(I, DAG.getNode(ISD::TRUNCATE, DestTy, N)); + } else if (isInteger(SrcVT)) { +if (isInteger(DestVT)) {// Int - Int cast + if (DestVT SrcVT) // Truncating cast? +setValue(I, DAG.getNode(ISD::TRUNCATE, DestVT, N)); else if (I.getOperand(0)-getType()-isSigned()) -setValue(I, DAG.getNode(ISD::SIGN_EXTEND, DestTy, N)); +setValue(I, DAG.getNode(ISD::SIGN_EXTEND, DestVT, N)); else -setValue(I, DAG.getNode(ISD::ZERO_EXTEND, DestTy, N)); +setValue(I, DAG.getNode(ISD::ZERO_EXTEND, DestVT, N)); } else {// Int - FP cast if (I.getOperand(0)-getType()-isSigned()) -setValue(I, DAG.getNode(ISD::SINT_TO_FP, DestTy, N)); +setValue(I, DAG.getNode(ISD::SINT_TO_FP, DestVT, N)); else -setValue(I, DAG.getNode(ISD::UINT_TO_FP, DestTy, N)); +setValue(I, DAG.getNode(ISD::UINT_TO_FP, DestVT, N)); } - } else { -assert(isFloatingPoint(SrcTy) Unknown value type!); -if (isFloatingPoint(DestTy)) { // FP - FP cast - if (DestTy SrcTy) // Rounding cast? -setValue(I, DAG.getNode(ISD::FP_ROUND, DestTy, N)); + } else if (isFloatingPoint(SrcVT)) { +if (isFloatingPoint(DestVT)) { // FP - FP cast + if (DestVT SrcVT) // Rounding cast? +setValue(I, DAG.getNode(ISD::FP_ROUND, DestVT, N)); else -setValue(I, DAG.getNode(ISD::FP_EXTEND, DestTy, N)); +setValue(I, DAG.getNode(ISD::FP_EXTEND, DestVT, N)); } else {// FP - Int cast. if (I.getType()-isSigned()) -setValue(I, DAG.getNode(ISD::FP_TO_SINT, DestTy, N)); +setValue(I, DAG.getNode(ISD::FP_TO_SINT, DestVT, N)); else -setValue(I, DAG.getNode(ISD::FP_TO_UINT, DestTy, N)); +setValue(I, DAG.getNode(ISD::FP_TO_UINT, DestVT, N)); +
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.264 - 1.265 --- Log message: SDOperand::isOperand should not be a forwarding. It must check *this against N's operands. --- Diffs of the changes: (+7 -0) SelectionDAG.cpp |7 +++ 1 files changed, 7 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.264 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.265 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.264Fri Mar 3 00:24:54 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Mar 3 00:42:32 2006 @@ -2534,6 +2534,13 @@ } // isOperand - Return true if this node is an operand of N. +bool SDOperand::isOperand(SDNode *N) const { + for (unsigned i = 0, e = N-getNumOperands(); i != e; ++i) +if (*this == N-getOperand(i)) + return true; + return false; +} + bool SDNode::isOperand(SDNode *N) const { for (unsigned i = 0, e = N-NumOperands; i != e; ++i) if (this == N-OperandList[i].Val) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.261 - 1.262 --- Log message: - Added VConstant as an abstract version of ConstantVec. - All abstrct vector nodes must have # of elements and element type as their first two operands. --- Diffs of the changes: (+19 -12) SelectionDAG.cpp | 31 +++ 1 files changed, 19 insertions(+), 12 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.261 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.262 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.261Sun Feb 26 02:36:57 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Feb 28 18:51:13 2006 @@ -1400,10 +1400,10 @@ if (N) return SDOperand(N, 0); std::vectorSDOperand Ops; Ops.reserve(5); - Ops.push_back(Chain); - Ops.push_back(Ptr); Ops.push_back(getConstant(Count, MVT::i32)); Ops.push_back(getValueType(EVT)); + Ops.push_back(Chain); + Ops.push_back(Ptr); Ops.push_back(SV); std::vectorMVT::ValueType VTs; VTs.reserve(2); @@ -2557,26 +2557,33 @@ case ISD::PCMARKER: return PCMarker; case ISD::READCYCLECOUNTER: return ReadCycleCounter; case ISD::SRCVALUE: return SrcValue; - case ISD::VALUETYPE: return ValueType; - case ISD::STRING:return String; case ISD::EntryToken:return EntryToken; case ISD::TokenFactor: return TokenFactor; case ISD::AssertSext:return AssertSext; case ISD::AssertZext:return AssertZext; + + case ISD::STRING:return String; + case ISD::BasicBlock:return BasicBlock; + case ISD::VALUETYPE: return ValueType; + case ISD::Register: return Register; + case ISD::Constant: return Constant; - case ISD::TargetConstant: return TargetConstant; case ISD::ConstantFP:return ConstantFP; - case ISD::ConstantVec: return ConstantVec; case ISD::GlobalAddress: return GlobalAddress; - case ISD::TargetGlobalAddress: return TargetGlobalAddress; case ISD::FrameIndex:return FrameIndex; - case ISD::TargetFrameIndex: return TargetFrameIndex; - case ISD::BasicBlock:return BasicBlock; - case ISD::Register: return Register; - case ISD::ExternalSymbol: return ExternalSymbol; - case ISD::TargetExternalSymbol: return TargetExternalSymbol; case ISD::ConstantPool: return ConstantPool; + case ISD::ExternalSymbol: return ExternalSymbol; + + case ISD::ConstantVec: return ConstantVec; + case ISD::TargetConstant: return TargetConstant; + case ISD::TargetConstantFP:return TargetConstantFP; + case ISD::TargetConstantVec:return TargetConstantVec; + case ISD::TargetGlobalAddress: return TargetGlobalAddress; + case ISD::TargetFrameIndex: return TargetFrameIndex; case ISD::TargetConstantPool: return TargetConstantPool; + case ISD::TargetExternalSymbol: return TargetExternalSymbol; + case ISD::VConstant: return VConstant; + case ISD::CopyToReg: return CopyToReg; case ISD::CopyFromReg: return CopyFromReg; case ISD::UNDEF: return undef; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.260 - 1.261 --- Log message: Print ConstantPoolSDNode offset field. --- Diffs of the changes: (+5 -0) SelectionDAG.cpp |5 + 1 files changed, 5 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.260 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.261 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.260Sat Feb 25 03:53:49 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Feb 26 02:36:57 2006 @@ -2761,7 +2761,12 @@ } else if (const FrameIndexSDNode *FIDN = dyn_castFrameIndexSDNode(this)) { std::cerrFIDN-getIndex() ; } else if (const ConstantPoolSDNode *CP = dyn_castConstantPoolSDNode(this)){ +int offset = CP-getOffset(); std::cerr*CP-get() ; +if (offset 0) + std::cerr + offset; +else + std::cerr offset; } else if (const BasicBlockSDNode *BBDN = dyn_castBasicBlockSDNode(this)) { std::cerr ; const Value *LBB = (const Value*)BBDN-getBasicBlock()-getBasicBlock(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.255 - 1.256 --- Log message: Added SelectionDAG::InsertISelMapEntry(). This is used to workaround the gcc problem where it inline the map insertion call too aggressively. Before this change it was producing a frame size of 24k for Select_store(), now it's down to 10k (by calling this method rather than calling the map insertion operator). --- Diffs of the changes: (+9 -0) SelectionDAG.cpp |9 + 1 files changed, 9 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.255 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.256 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.255Thu Feb 9 01:15:23 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Feb 9 16:11:03 2006 @@ -2748,3 +2748,12 @@ std::cerr \n\n; } +/// InsertISelMapEntry - A helper function to insert a key / element pair +/// into a SDOperand to SDOperand map. This is added to avoid the map +/// insertion operator from being inlined. +void SelectionDAG::InsertISelMapEntry(std::mapSDOperand, SDOperand Map, + SDNode *Key, unsigned KeyResNo, + SDNode *Element, unsigned ElementResNo) { + Map.insert(std::make_pair(SDOperand(Key, KeyResNo), +SDOperand(Element, ElementResNo))); +} ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.254 - 1.255 --- Log message: More changes to reduce frame size. Move all getTargetNode() out of SelectionDAG.h into SelectionDAG.cpp. This prevents them from being inlined. Change getTargetNode() so they return SDNode * instead of SDOperand to prevent copying. It should also help compilation speed. --- Diffs of the changes: (+243 -0) SelectionDAG.cpp | 243 +++ 1 files changed, 243 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.254 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.255 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.254Sun Feb 5 00:29:23 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Feb 9 01:15:23 2006 @@ -2037,6 +2037,249 @@ return SDOperand(N, 0); } +/// getTargetNode - These are used for target selectors to create a new node +/// with specified return type(s), target opcode, and operands. +/// +/// Note that getTargetNode returns the resultant node. If there is already a +/// node of the specified opcode and operands, it returns that node instead of +/// the current one. +SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT::ValueType VT) { + return getNode(ISD::BUILTIN_OP_END+Opcode, VT).Val; +} +SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT::ValueType VT, +SDOperand Op1) { + return getNode(ISD::BUILTIN_OP_END+Opcode, VT, Op1).Val; +} +SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT::ValueType VT, +SDOperand Op1, SDOperand Op2) { + return getNode(ISD::BUILTIN_OP_END+Opcode, VT, Op1, Op2).Val; +} +SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT::ValueType VT, +SDOperand Op1, SDOperand Op2, SDOperand Op3) { + return getNode(ISD::BUILTIN_OP_END+Opcode, VT, Op1, Op2, Op3).Val; +} +SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT::ValueType VT, +SDOperand Op1, SDOperand Op2, SDOperand Op3, +SDOperand Op4) { + return getNode(ISD::BUILTIN_OP_END+Opcode, VT, Op1, Op2, Op3, Op4).Val; +} +SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT::ValueType VT, +SDOperand Op1, SDOperand Op2, SDOperand Op3, +SDOperand Op4, SDOperand Op5) { + return getNode(ISD::BUILTIN_OP_END+Opcode, VT, Op1, Op2, Op3, Op4, Op5).Val; +} +SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT::ValueType VT, +SDOperand Op1, SDOperand Op2, SDOperand Op3, +SDOperand Op4, SDOperand Op5, SDOperand Op6) { + std::vectorSDOperand Ops; + Ops.reserve(6); + Ops.push_back(Op1); + Ops.push_back(Op2); + Ops.push_back(Op3); + Ops.push_back(Op4); + Ops.push_back(Op5); + Ops.push_back(Op6); + return getNode(ISD::BUILTIN_OP_END+Opcode, VT, Ops).Val; +} +SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT::ValueType VT, +SDOperand Op1, SDOperand Op2, SDOperand Op3, +SDOperand Op4, SDOperand Op5, SDOperand Op6, +SDOperand Op7) { + std::vectorSDOperand Ops; + Ops.reserve(7); + Ops.push_back(Op1); + Ops.push_back(Op2); + Ops.push_back(Op3); + Ops.push_back(Op4); + Ops.push_back(Op5); + Ops.push_back(Op6); + Ops.push_back(Op7); + return getNode(ISD::BUILTIN_OP_END+Opcode, VT, Ops).Val; +} +SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT::ValueType VT, +SDOperand Op1, SDOperand Op2, SDOperand Op3, +SDOperand Op4, SDOperand Op5, SDOperand Op6, +SDOperand Op7, SDOperand Op8) { + std::vectorSDOperand Ops; + Ops.reserve(8); + Ops.push_back(Op1); + Ops.push_back(Op2); + Ops.push_back(Op3); + Ops.push_back(Op4); + Ops.push_back(Op5); + Ops.push_back(Op6); + Ops.push_back(Op7); + Ops.push_back(Op8); + return getNode(ISD::BUILTIN_OP_END+Opcode, VT, Ops).Val; +} +SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT::ValueType VT, +std::vectorSDOperand Ops) { + return getNode(ISD::BUILTIN_OP_END+Opcode, VT, Ops).Val; +} +SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT::ValueType VT1, +MVT::ValueType VT2, SDOperand Op1) { + std::vectorMVT::ValueType ResultTys; + ResultTys.push_back(VT1); + ResultTys.push_back(VT2); + std::vectorSDOperand Ops; + Ops.push_back(Op1); + return getNode(ISD::BUILTIN_OP_END+Opcode, ResultTys, Ops).Val; +} +SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT::ValueType VT1, +MVT::ValueType VT2, SDOperand
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.253 - 1.254 --- Log message: * Added SDNode::isOnlyUse(). * Fix hasNUsesOfValue(), it should be const. --- Diffs of the changes: (+18 -3) SelectionDAG.cpp | 21 ++--- 1 files changed, 18 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.253 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.254 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.253Fri Feb 3 00:51:34 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Feb 5 00:29:23 2006 @@ -2177,7 +2177,7 @@ /// hasNUsesOfValue - Return true if there are exactly NUSES uses of the /// indicated value. This method ignores uses of other values defined by this /// operation. -bool SDNode::hasNUsesOfValue(unsigned NUses, unsigned Value) { +bool SDNode::hasNUsesOfValue(unsigned NUses, unsigned Value) const { assert(Value getNumValues() Bad value!); // If there is only one value, this is easy. @@ -2185,11 +2185,11 @@ return use_size() == NUses; if (Uses.size() NUses) return false; - SDOperand TheValue(this, Value); + SDOperand TheValue(const_castSDNode *(this), Value); std::setSDNode* UsersHandled; - for (std::vectorSDNode*::iterator UI = Uses.begin(), E = Uses.end(); + for (std::vectorSDNode*::const_iterator UI = Uses.begin(), E = Uses.end(); UI != E; ++UI) { SDNode *User = *UI; if (User-getNumOperands() == 1 || @@ -2207,6 +2207,21 @@ } +// isOnlyUse - Return true if this node is the only use of N. +bool SDNode::isOnlyUse(SDNode *N) const { + bool Seen = false; + for (SDNode::use_iterator I = N-use_begin(), E = N-use_end(); I != E; ++I) { +SDNode *User = *I; +if (User == this) + Seen = true; +else + return false; + } + + return Seen; +} + + const char *SDNode::getOperationName(const SelectionDAG *G) const { switch (getOpcode()) { default: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.251 - 1.252 --- Log message: Added case HANDLENODE to getOperationName(). --- Diffs of the changes: (+1 -0) SelectionDAG.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.251 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.252 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.251Tue Jan 31 16:23:14 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Feb 2 19:33:01 2006 @@ -2266,6 +2266,7 @@ case ISD::UNDEF: return undef; case ISD::MERGE_VALUES: return mergevalues; case ISD::INLINEASM: return inlineasm; + case ISD::HANDLENODE:return handlenode; // Unary operators case ISD::FABS: return fabs; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.252 - 1.253 --- Log message: remove dead fn --- Diffs of the changes: (+0 -11) SelectionDAG.cpp | 11 --- 1 files changed, 11 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.252 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.253 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.252Thu Feb 2 19:33:01 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Feb 3 00:51:34 2006 @@ -43,17 +43,6 @@ } } -static bool isAssociativeBinOp(unsigned Opcode) { - switch (Opcode) { - case ISD::ADD: - case ISD::MUL: - case ISD::AND: - case ISD::OR: - case ISD::XOR: return true; - default: return false; // FIXME: Need associative info for user ops! - } -} - // isInvertibleForFree - Return true if there is no cost to emitting the logical // inverse of this node. static bool isInvertibleForFree(SDOperand N) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.247 - 1.248 --- Log message: add another method variant --- Diffs of the changes: (+18 -3) SelectionDAG.cpp | 21 ++--- 1 files changed, 18 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.247 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.248 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.247Sat Jan 28 03:32:45 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Jan 28 04:09:25 2006 @@ -317,7 +317,8 @@ Erased = ExternalSymbols.erase(castExternalSymbolSDNode(N)-getSymbol()); break; case ISD::TargetExternalSymbol: -Erased = TargetExternalSymbols.erase(castExternalSymbolSDNode(N)-getSymbol()); +Erased = + TargetExternalSymbols.erase(castExternalSymbolSDNode(N)-getSymbol()); break; case ISD::VALUETYPE: Erased = ValueTypeNodes[castVTSDNode(N)-getVT()] != 0; @@ -416,7 +417,7 @@ } else { std::vectorSDOperand Ops(N-op_begin(), N-op_end()); SDNode *ORN = OneResultNodes[std::make_pair(N-getOpcode(), - std::make_pair(N-getValueType(0), Ops))]; + std::make_pair(N-getValueType(0), Ops))]; if (ORN) return ORN; ORN = N; } @@ -687,7 +688,8 @@ return SDOperand(N, 0); } -SDOperand SelectionDAG::getTargetExternalSymbol(const char *Sym, MVT::ValueType VT) { +SDOperand SelectionDAG::getTargetExternalSymbol(const char *Sym, +MVT::ValueType VT) { SDNode *N = TargetExternalSymbols[Sym]; if (N) return SDOperand(N, 0); N = new ExternalSymbolSDNode(true, Sym, VT); @@ -1728,6 +1730,19 @@ } SDOperand SelectionDAG:: +UpdateNodeOperands(SDOperand N, SDOperand Op1, SDOperand Op2, + SDOperand Op3, SDOperand Op4, SDOperand Op5) { + std::vectorSDOperand Ops; + Ops.push_back(Op1); + Ops.push_back(Op2); + Ops.push_back(Op3); + Ops.push_back(Op4); + Ops.push_back(Op5); + return UpdateNodeOperands(N, Ops); +} + + +SDOperand SelectionDAG:: UpdateNodeOperands(SDOperand InN, const std::vectorSDOperand Ops) { SDNode *N = InN.Val; assert(N-getNumOperands() == Ops.size() ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.240 - 1.241 --- Log message: another selectto --- Diffs of the changes: (+23 -0) SelectionDAG.cpp | 23 +++ 1 files changed, 23 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.240 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.241 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.240Mon Jan 16 02:07:10 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Jan 23 14:59:12 2006 @@ -1649,6 +1649,29 @@ return SDOperand(N, 0); } +SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT::ValueType VT, SDOperand Op1, + SDOperand Op2, SDOperand Op3,SDOperand Op4, + SDOperand Op5, SDOperand Op6, +SDOperand Op7) { + // If an identical node already exists, use it. + std::vectorSDOperand OpList; + OpList.push_back(Op1); OpList.push_back(Op2); OpList.push_back(Op3); + OpList.push_back(Op4); OpList.push_back(Op5); OpList.push_back(Op6); + OpList.push_back(Op7); + SDNode *ON = OneResultNodes[std::make_pair(ISD::BUILTIN_OP_END+TargetOpc, + std::make_pair(VT, OpList))]; + if (ON) return SDOperand(ON, 0); + + RemoveNodeFromCSEMaps(N); + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); + N-setValueTypes(VT); + N-setOperands(Op1, Op2, Op3, Op4, Op5, Op6, Op7); + + ON = N; // Memoize the new node. + return SDOperand(N, 0); +} + SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1, MVT::ValueType VT2, SDOperand Op1, SDOperand Op2) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.241 - 1.242 --- Log message: another couple selects --- Diffs of the changes: (+22 -0) SelectionDAG.cpp | 22 ++ 1 files changed, 22 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.241 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.242 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.241Mon Jan 23 14:59:12 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Jan 23 15:51:14 2006 @@ -1671,6 +1671,28 @@ ON = N; // Memoize the new node. return SDOperand(N, 0); } +SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT::ValueType VT, SDOperand Op1, + SDOperand Op2, SDOperand Op3,SDOperand Op4, + SDOperand Op5, SDOperand Op6, +SDOperand Op7, SDOperand Op8) { + // If an identical node already exists, use it. + std::vectorSDOperand OpList; + OpList.push_back(Op1); OpList.push_back(Op2); OpList.push_back(Op3); + OpList.push_back(Op4); OpList.push_back(Op5); OpList.push_back(Op6); + OpList.push_back(Op7); OpList.push_back(Op8); + SDNode *ON = OneResultNodes[std::make_pair(ISD::BUILTIN_OP_END+TargetOpc, + std::make_pair(VT, OpList))]; + if (ON) return SDOperand(ON, 0); + + RemoveNodeFromCSEMaps(N); + N-MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); + N-setValueTypes(VT); + N-setOperands(Op1, Op2, Op3, Op4, Op5, Op6, Op7, Op8); + + ON = N; // Memoize the new node. + return SDOperand(N, 0); +} SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1, MVT::ValueType VT2, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.239 - 1.240 --- Log message: Constant fold ctpop/ctlz/cttz, and a couple other small cleanups --- Diffs of the changes: (+58 -2) SelectionDAG.cpp | 60 +-- 1 files changed, 58 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.239 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.240 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.239Sun Jan 15 02:39:35 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Jan 16 02:07:10 2006 @@ -32,6 +32,8 @@ switch (Opcode) { case ISD::ADD: case ISD::MUL: + case ISD::MULHU: + case ISD::MULHS: case ISD::FADD: case ISD::FMUL: case ISD::AND: @@ -828,6 +830,7 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, SDOperand Operand) { + unsigned Tmp1; // Constant fold unary operations with an integer constant operand. if (ConstantSDNode *C = dyn_castConstantSDNode(Operand.Val)) { uint64_t Val = C-getValue(); @@ -848,6 +851,59 @@ return getConstantFP(BitsToDouble(Val), VT); } break; +case ISD::BSWAP: + switch(VT) { + default: assert(0 Invalid bswap!); break; + case MVT::i16: return getConstant(ByteSwap_16((unsigned short)Val), VT); + case MVT::i32: return getConstant(ByteSwap_32((unsigned)Val), VT); + case MVT::i64: return getConstant(ByteSwap_64(Val), VT); + } + break; +case ISD::CTPOP: + switch(VT) { + default: assert(0 Invalid ctpop!); break; + case MVT::i1: return getConstant(Val != 0, VT); + case MVT::i8: +Tmp1 = (unsigned)Val 0xFF; +return getConstant(CountPopulation_32(Tmp1), VT); + case MVT::i16: +Tmp1 = (unsigned)Val 0x; +return getConstant(CountPopulation_32(Tmp1), VT); + case MVT::i32: +return getConstant(CountPopulation_32((unsigned)Val), VT); + case MVT::i64: +return getConstant(CountPopulation_64(Val), VT); + } +case ISD::CTLZ: + switch(VT) { + default: assert(0 Invalid ctlz!); break; + case MVT::i1: return getConstant(Val == 0, VT); + case MVT::i8: +Tmp1 = (unsigned)Val 0xFF; +return getConstant(CountLeadingZeros_32(Tmp1)-24, VT); + case MVT::i16: +Tmp1 = (unsigned)Val 0x; +return getConstant(CountLeadingZeros_32(Tmp1)-16, VT); + case MVT::i32: +return getConstant(CountLeadingZeros_32((unsigned)Val), VT); + case MVT::i64: +return getConstant(CountLeadingZeros_64(Val), VT); + } +case ISD::CTTZ: + switch(VT) { + default: assert(0 Invalid cttz!); break; + case MVT::i1: return getConstant(Val == 0, VT); + case MVT::i8: +Tmp1 = (unsigned)Val | 0x100; +return getConstant(CountTrailingZeros_32(Tmp1), VT); + case MVT::i16: +Tmp1 = (unsigned)Val | 0x1; +return getConstant(CountTrailingZeros_32(Tmp1), VT); + case MVT::i32: +return getConstant(CountTrailingZeros_32((unsigned)Val), VT); + case MVT::i64: +return getConstant(CountTrailingZeros_64(Val), VT); + } } } @@ -1926,7 +1982,6 @@ case ISD::SRL:return srl; case ISD::ROTL: return rotl; case ISD::ROTR: return rotr; - case ISD::BSWAP: return bswap; case ISD::FADD: return fadd; case ISD::FSUB: return fsub; case ISD::FMUL: return fmul; @@ -1993,7 +2048,8 @@ case ISD::MEMCPY: return memcpy; case ISD::MEMMOVE: return memmove; - // Bit counting + // Bit manipulation + case ISD::BSWAP: return bswap; case ISD::CTPOP: return ctpop; case ISD::CTTZ:return cttz; case ISD::CTLZ:return ctlz; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.238 - 1.239 --- Log message: add a missing node name --- Diffs of the changes: (+1 -0) SelectionDAG.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.238 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.239 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.238Thu Jan 12 20:39:42 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Jan 15 02:39:35 2006 @@ -1899,6 +1899,7 @@ case ISD::CopyToReg: return CopyToReg; case ISD::CopyFromReg: return CopyFromReg; case ISD::UNDEF: return undef; + case ISD::MERGE_VALUES: return mergevalues; // Unary operators case ISD::FABS: return fabs; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.234 - 1.235 --- Log message: New getNode() variants. --- Diffs of the changes: (+0 -14) SelectionDAG.cpp | 14 -- 1 files changed, 14 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.234 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.235 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.234Wed Jan 4 19:25:28 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Jan 9 12:29:18 2006 @@ -1200,20 +1200,6 @@ return getNode(Opcode, VT, Ops); } -SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, -SDOperand N1, SDOperand N2, SDOperand N3, -SDOperand N4, SDOperand N5, SDOperand N6) { - std::vectorSDOperand Ops; - Ops.reserve(6); - Ops.push_back(N1); - Ops.push_back(N2); - Ops.push_back(N3); - Ops.push_back(N4); - Ops.push_back(N5); - Ops.push_back(N6); - return getNode(Opcode, VT, Ops); -} - // setAdjCallChain - This method changes the token chain of an // CALLSEQ_START/END node to be the specified operand. void SDNode::setAdjCallChain(SDOperand N) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.225 - 1.226 --- Log message: Fix a case where the DAG Combiner would accidentally CSE flag-producing nodes, creating graphs that cannot be scheduled. --- Diffs of the changes: (+6 -1) SelectionDAG.cpp |7 ++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.225 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.226 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.225Fri Dec 16 16:45:28 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Dec 19 16:21:21 2005 @@ -389,9 +389,14 @@ assert(N-getNumOperands() This is a leaf node!); if (N-getOpcode() == ISD::CALLSEQ_START || N-getOpcode() == ISD::CALLSEQ_END || - N-getOpcode() == ISD::HANDLENODE) + N-getOpcode() == ISD::HANDLENODE || N-getValueType(0) == MVT::Flag) return 0;// Never add these nodes. + // Check that remaining values produced are not flags. + for (unsigned i = 1, e = N-getNumValues(); i != e; ++i) +if (N-getValueType(i) == MVT::Flag) + return 0; // Never CSE anything that produces a flag. + if (N-getNumValues() == 1) { if (N-getNumOperands() == 1) { SDNode *U = UnaryOps[std::make_pair(N-getOpcode(), ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.226 - 1.227 --- Log message: Print out opcode number if it's an unknown target node. --- Diffs of the changes: (+6 -1) SelectionDAG.cpp |7 ++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.226 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.227 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.226Mon Dec 19 16:21:21 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Dec 19 17:11:49 2005 @@ -21,6 +21,7 @@ #include llvm/Target/TargetLowering.h #include llvm/Target/TargetInstrInfo.h #include llvm/Target/TargetMachine.h +#include llvm/ADT/StringExtras.h #include iostream #include set #include cmath @@ -1838,7 +1839,11 @@ if (const TargetInstrInfo *TII = G-getTarget().getInstrInfo()) if (getOpcode()-ISD::BUILTIN_OP_END TII-getNumOpcodes()) return TII-getName(getOpcode()-ISD::BUILTIN_OP_END); - return Unknown Target Node; + + std::string Name += Unknown Target Node: ++ itostr((int)getOpcode()-ISD::BUILTIN_OP_END) + ; + return Name.c_str(); } case ISD::PCMARKER: return PCMarker; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.227 - 1.228 --- Log message: Added a hook to print out names of target specific DAG nodes. --- Diffs of the changes: (+8 -5) SelectionDAG.cpp | 13 - 1 files changed, 8 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.227 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.228 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.227Mon Dec 19 17:11:49 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Dec 20 00:22:03 2005 @@ -1835,15 +1835,18 @@ if (getOpcode() ISD::BUILTIN_OP_END) return Unknown DAG Node; else { - if (G) + if (G) { if (const TargetInstrInfo *TII = G-getTarget().getInstrInfo()) if (getOpcode()-ISD::BUILTIN_OP_END TII-getNumOpcodes()) return TII-getName(getOpcode()-ISD::BUILTIN_OP_END); - std::string Name -= Unknown Target Node: -+ itostr((int)getOpcode()-ISD::BUILTIN_OP_END) + ; - return Name.c_str(); +TargetLowering TLI = G-getTargetLoweringInfo(); +const char *Name = + TLI.getTargetNodeName(getOpcode()); +if (Name) return Name; + } + + return Unknown Target Node; } case ISD::PCMARKER: return PCMarker; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.223 - 1.224 --- Log message: Added new getNode and getTargetNode variants for X86 stores. --- Diffs of the changes: (+73 -60) SelectionDAG.cpp | 133 ++- 1 files changed, 73 insertions(+), 60 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.223 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.224 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.223Tue Dec 6 00:18:55 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Dec 9 18:37:58 2005 @@ -1088,66 +1088,6 @@ return SDOperand(N, 0); } -// setAdjCallChain - This method changes the token chain of an -// CALLSEQ_START/END node to be the specified operand. -void SDNode::setAdjCallChain(SDOperand N) { - assert(N.getValueType() == MVT::Other); - assert((getOpcode() == ISD::CALLSEQ_START || - getOpcode() == ISD::CALLSEQ_END) Cannot adjust this node!); - - OperandList[0].Val-removeUser(this); - OperandList[0] = N; - OperandList[0].Val-Uses.push_back(this); -} - - - -SDOperand SelectionDAG::getLoad(MVT::ValueType VT, -SDOperand Chain, SDOperand Ptr, -SDOperand SV) { - SDNode *N = Loads[std::make_pair(Ptr, std::make_pair(Chain, VT))]; - if (N) return SDOperand(N, 0); - N = new SDNode(ISD::LOAD, Chain, Ptr, SV); - - // Loads have a token chain. - setNodeValueTypes(N, VT, MVT::Other); - AllNodes.push_back(N); - return SDOperand(N, 0); -} - -SDOperand SelectionDAG::getVecLoad(unsigned Count, MVT::ValueType EVT, - SDOperand Chain, SDOperand Ptr, - SDOperand SV) { - SDNode *N = Loads[std::make_pair(Ptr, std::make_pair(Chain, EVT))]; - if (N) return SDOperand(N, 0); - std::vectorSDOperand Ops; - Ops.reserve(5); - Ops.push_back(Chain); - Ops.push_back(Ptr); - Ops.push_back(getConstant(Count, MVT::i32)); - Ops.push_back(getValueType(EVT)); - Ops.push_back(SV); - std::vectorMVT::ValueType VTs; - VTs.reserve(2); - VTs.push_back(MVT::Vector); VTs.push_back(MVT::Other); // Add token chain. - return getNode(ISD::VLOAD, VTs, Ops); -} - -SDOperand SelectionDAG::getExtLoad(unsigned Opcode, MVT::ValueType VT, - SDOperand Chain, SDOperand Ptr, SDOperand SV, - MVT::ValueType EVT) { - std::vectorSDOperand Ops; - Ops.reserve(4); - Ops.push_back(Chain); - Ops.push_back(Ptr); - Ops.push_back(SV); - Ops.push_back(getValueType(EVT)); - std::vectorMVT::ValueType VTs; - VTs.reserve(2); - VTs.push_back(VT); VTs.push_back(MVT::Other); // Add token chain. - return getNode(Opcode, VTs, Ops); -} - SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, SDOperand N1, SDOperand N2, SDOperand N3) { // Perform various simplifications. @@ -1224,6 +1164,79 @@ return getNode(Opcode, VT, Ops); } +SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, +SDOperand N1, SDOperand N2, SDOperand N3, +SDOperand N4, SDOperand N5, SDOperand N6) { + std::vectorSDOperand Ops; + Ops.reserve(6); + Ops.push_back(N1); + Ops.push_back(N2); + Ops.push_back(N3); + Ops.push_back(N4); + Ops.push_back(N5); + Ops.push_back(N6); + return getNode(Opcode, VT, Ops); +} + +// setAdjCallChain - This method changes the token chain of an +// CALLSEQ_START/END node to be the specified operand. +void SDNode::setAdjCallChain(SDOperand N) { + assert(N.getValueType() == MVT::Other); + assert((getOpcode() == ISD::CALLSEQ_START || + getOpcode() == ISD::CALLSEQ_END) Cannot adjust this node!); + + OperandList[0].Val-removeUser(this); + OperandList[0] = N; + OperandList[0].Val-Uses.push_back(this); +} + + + +SDOperand SelectionDAG::getLoad(MVT::ValueType VT, +SDOperand Chain, SDOperand Ptr, +SDOperand SV) { + SDNode *N = Loads[std::make_pair(Ptr, std::make_pair(Chain, VT))]; + if (N) return SDOperand(N, 0); + N = new SDNode(ISD::LOAD, Chain, Ptr, SV); + + // Loads have a token chain. + setNodeValueTypes(N, VT, MVT::Other); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + +SDOperand SelectionDAG::getVecLoad(unsigned Count, MVT::ValueType EVT, + SDOperand Chain, SDOperand Ptr, + SDOperand SV) { + SDNode *N = Loads[std::make_pair(Ptr, std::make_pair(Chain, EVT))]; + if (N) return SDOperand(N, 0); + std::vectorSDOperand Ops; + Ops.reserve(5); + Ops.push_back(Chain); + Ops.push_back(Ptr); + Ops.push_back(getConstant(Count, MVT::i32)); + Ops.push_back(getValueType(EVT)); + Ops.push_back(SV); + std::vectorMVT::ValueType VTs; + VTs.reserve(2); +
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.221 - 1.222 --- Log message: Don't remove two operand, two result nodes from the binary ops map. These should come from the arbitrary ops map. This fixes Regression/CodeGen/PowerPC/2005-12-01-Crash.ll --- Diffs of the changes: (+40 -37) SelectionDAG.cpp | 77 --- 1 files changed, 40 insertions(+), 37 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.221 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.222 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.221Thu Dec 1 12:00:57 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Dec 1 17:14:50 2005 @@ -388,43 +388,46 @@ SDNode *SelectionDAG::AddNonLeafNodeToCSEMaps(SDNode *N) { assert(N-getNumOperands() This is a leaf node!); if (N-getOpcode() == ISD::CALLSEQ_START || - N-getOpcode() == ISD::CALLSEQ_END) -return 0; - - if (N-getOpcode() == ISD::LOAD) { -SDNode *L = Loads[std::make_pair(N-getOperand(1), - std::make_pair(N-getOperand(0), - N-getValueType(0)))]; -if (L) return L; -L = N; - } else if (N-getOpcode() == ISD::HANDLENODE) { -return 0; // never add it. - } else if (N-getNumOperands() == 1) { -SDNode *U = UnaryOps[std::make_pair(N-getOpcode(), - std::make_pair(N-getOperand(0), -N-getValueType(0)))]; -if (U) return U; -U = N; - } else if (N-getNumOperands() == 2) { -SDNode *B = BinaryOps[std::make_pair(N-getOpcode(), - std::make_pair(N-getOperand(0), - N-getOperand(1)))]; -if (B) return B; -B = N; - } else if (N-getNumValues() == 1) { -std::vectorSDOperand Ops(N-op_begin(), N-op_end()); -SDNode *ORN = OneResultNodes[std::make_pair(N-getOpcode(), - std::make_pair(N-getValueType(0), Ops))]; -if (ORN) return ORN; -ORN = N; - } else { -// Remove the node from the ArbitraryNodes map. -std::vectorMVT::ValueType RV(N-value_begin(), N-value_end()); -std::vectorSDOperand Ops(N-op_begin(), N-op_end()); -SDNode *AN = ArbitraryNodes[std::make_pair(N-getOpcode(), -std::make_pair(RV, Ops))]; -if (AN) return AN; -AN = N; + N-getOpcode() == ISD::CALLSEQ_END || + N-getOpcode() == ISD::HANDLENODE) +return 0;// Never add these nodes. + + if (N-getNumValues() == 1) { +if (N-getNumOperands() == 1) { + SDNode *U = UnaryOps[std::make_pair(N-getOpcode(), + std::make_pair(N-getOperand(0), + N-getValueType(0)))]; + if (U) return U; + U = N; +} else if (N-getNumOperands() == 2) { + SDNode *B = BinaryOps[std::make_pair(N-getOpcode(), +std::make_pair(N-getOperand(0), + N-getOperand(1)))]; + if (B) return B; + B = N; +} else { + std::vectorSDOperand Ops(N-op_begin(), N-op_end()); + SDNode *ORN = OneResultNodes[std::make_pair(N-getOpcode(), + std::make_pair(N-getValueType(0), Ops))]; + if (ORN) return ORN; + ORN = N; +} + } else { +if (N-getOpcode() == ISD::LOAD) { + SDNode *L = Loads[std::make_pair(N-getOperand(1), +std::make_pair(N-getOperand(0), + N-getValueType(0)))]; + if (L) return L; + L = N; +} else { + // Remove the node from the ArbitraryNodes map. + std::vectorMVT::ValueType RV(N-value_begin(), N-value_end()); + std::vectorSDOperand Ops(N-op_begin(), N-op_end()); + SDNode *AN = ArbitraryNodes[std::make_pair(N-getOpcode(), + std::make_pair(RV, Ops))]; + if (AN) return AN; + AN = N; +} } return 0; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits