[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp
Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.80 -> 1.81 --- Log message: Implement a few symbolic constant folding things. X ? Y : Y is Y. Fold: seteq ({ short }* cast (int 1 to { short }*), { short }* null) setlt ({ short }* cast (int 1 to { short }*), { short }* cast (int 2 to { short }*)) to false/true. These last two commonly occur in the output of compilers that tag integers, like cozmic's scheme compiler. Tested by Regression/Assembler/ConstantExprFold.llx --- Diffs of the changes: (+32 -7) ConstantFolding.cpp | 39 --- 1 files changed, 32 insertions(+), 7 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.80 llvm/lib/VMCore/ConstantFolding.cpp:1.81 --- llvm/lib/VMCore/ConstantFolding.cpp:1.80Thu Jan 5 01:19:51 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Thu Jan 5 01:49:30 2006 @@ -720,6 +720,7 @@ if (isa(V1)) return const_cast(V2); if (isa(V2)) return const_cast(V1); if (isa(Cond)) return const_cast(V1); + if (V1 == V2) return const_cast(V1); return 0; } @@ -786,16 +787,27 @@ /// constants (like ConstantInt) to be the simplest, followed by /// GlobalValues, followed by ConstantExpr's (the most complex). /// -static Instruction::BinaryOps evaluateRelation(const Constant *V1, - const Constant *V2) { +static Instruction::BinaryOps evaluateRelation(Constant *V1, Constant *V2) { assert(V1->getType() == V2->getType() && "Cannot compare different types of values!"); if (V1 == V2) return Instruction::SetEQ; if (!isa(V1) && !isa(V1)) { +if (!isa(V2) && !isa(V2)) { + // We distilled this down to a simple case, use the standard constant + // folder. + ConstantBool *R = dyn_cast(ConstantExpr::getSetEQ(V1, V2)); + if (R == ConstantBool::True) return Instruction::SetEQ; + R = dyn_cast(ConstantExpr::getSetLT(V1, V2)); + if (R == ConstantBool::True) return Instruction::SetLT; + R = dyn_cast(ConstantExpr::getSetGT(V1, V2)); + if (R == ConstantBool::True) return Instruction::SetGT; + + // If we couldn't figure it out, bail. + return Instruction::BinaryOpsEnd; +} + // If the first operand is simple, swap operands. -assert((isa(V2) || isa(V2)) && - "Simple cases should have been handled by caller!"); Instruction::BinaryOps SwappedRelation = evaluateRelation(V2, V1); if (SwappedRelation != Instruction::BinaryOpsEnd) return SetCondInst::getSwappedCondition(SwappedRelation); @@ -826,7 +838,7 @@ } else { // Ok, the LHS is known to be a constantexpr. The RHS can be any of a // constantexpr, a CPR, or a simple constant. -const ConstantExpr *CE1 = cast(V1); +ConstantExpr *CE1 = cast(V1); Constant *CE1Op0 = CE1->getOperand(0); switch (CE1->getOpcode()) { @@ -834,9 +846,21 @@ // If the cast is not actually changing bits, and the second operand is a // null pointer, do the comparison with the pre-casted value. if (V2->isNullValue() && - CE1->getType()->isLosslesslyConvertibleTo(CE1Op0->getType())) + (isa(CE1->getType()) || CE1->getType()->isIntegral())) return evaluateRelation(CE1Op0, Constant::getNullValue(CE1Op0->getType())); + + // If the dest type is a pointer type, and the RHS is a constantexpr cast + // from the same type as the src of the LHS, evaluate the inputs. This is + // important for things like "seteq (cast 4 to int*), (cast 5 to int*)", + // which happens a lot in compilers with tagged integers. + if (ConstantExpr *CE2 = dyn_cast(V2)) +if (isa(CE1->getType()) && +CE2->getOpcode() == Instruction::Cast && +CE1->getOperand(0)->getType() == CE2->getOperand(0)->getType() && +CE1->getOperand(0)->getType()->isIntegral()) { + return evaluateRelation(CE1->getOperand(0), CE2->getOperand(0)); +} break; case Instruction::GetElementPtr: @@ -977,7 +1001,8 @@ if (SetCondInst::isRelational(Opcode)) { if (isa(V1) || isa(V2)) return UndefValue::get(Type::BoolTy); -switch (evaluateRelation(V1, V2)) { +switch (evaluateRelation(const_cast(V1), + const_cast(V2))) { default: assert(0 && "Unknown relational!"); case Instruction::BinaryOpsEnd: break; // Couldn't determine anything about these constants. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/Assembler/ConstantExprFold.llx
Changes in directory llvm/test/Regression/Assembler: ConstantExprFold.llx updated: 1.2 -> 1.3 --- Log message: new tests, derived from cosmics scheme output --- Diffs of the changes: (+5 -1) ConstantExprFold.llx |6 +- 1 files changed, 5 insertions(+), 1 deletion(-) Index: llvm/test/Regression/Assembler/ConstantExprFold.llx diff -u llvm/test/Regression/Assembler/ConstantExprFold.llx:1.2 llvm/test/Regression/Assembler/ConstantExprFold.llx:1.3 --- llvm/test/Regression/Assembler/ConstantExprFold.llx:1.2 Thu Jul 8 10:38:23 2004 +++ llvm/test/Regression/Assembler/ConstantExprFold.llx Thu Jan 5 01:46:46 2006 @@ -1,6 +1,7 @@ ; This test checks to make sure that constant exprs fold in some simple situations -; RUN: llvm-as < %s | llvm-dis | not grep '(' +; RUN: llvm-as < %s | llvm-dis | not grep '(' && +; RUN: llvm-as < %s %A = global long 0 @@ -23,3 +24,6 @@ int* getelementptr (%Ty* %B, long 0, ubyte 1)); true ;global bool setne (long* %A, long* cast (%Ty* %B to long*)) ; true +global bool seteq ({ short }* cast (int 1 to { short }*), { short }* null) +global bool setlt ({ short }* cast (int 1 to { short }*), { short }* cast (int 2 to { short }*)) + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp
Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.79 -> 1.80 --- Log message: fix some formatting problems --- Diffs of the changes: (+7 -7) ConstantFolding.cpp | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.79 llvm/lib/VMCore/ConstantFolding.cpp:1.80 --- llvm/lib/VMCore/ConstantFolding.cpp:1.79Tue Jan 3 20:20:54 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Thu Jan 5 01:19:51 2006 @@ -235,7 +235,7 @@ // struct BoolRules : public TemplateRules { - static Constant *LessThan(const ConstantBool *V1, const ConstantBool *V2){ + static Constant *LessThan(const ConstantBool *V1, const ConstantBool *V2) { return ConstantBool::get(V1->getValue() < V2->getValue()); } @@ -800,13 +800,13 @@ if (SwappedRelation != Instruction::BinaryOpsEnd) return SetCondInst::getSwappedCondition(SwappedRelation); - } else if (const GlobalValue *CPR1 = dyn_cast(V1)){ + } else if (const GlobalValue *CPR1 = dyn_cast(V1)) { if (isa(V2)) { // Swap as necessary. -Instruction::BinaryOps SwappedRelation = evaluateRelation(V2, V1); -if (SwappedRelation != Instruction::BinaryOpsEnd) - return SetCondInst::getSwappedCondition(SwappedRelation); -else - return Instruction::BinaryOpsEnd; + Instruction::BinaryOps SwappedRelation = evaluateRelation(V2, V1); + if (SwappedRelation != Instruction::BinaryOpsEnd) +return SetCondInst::getSwappedCondition(SwappedRelation); + else +return Instruction::BinaryOpsEnd; } // Now we know that the RHS is a GlobalValue or simple constant, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaInstrInfo.td
Changes in directory llvm/lib/Target/Alpha: AlphaInstrInfo.td updated: 1.97 -> 1.98 --- Log message: unbreak the build, these are now in TargetSelectionDAG.td --- Diffs of the changes: (+0 -3) AlphaInstrInfo.td |3 --- 1 files changed, 3 deletions(-) Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.97 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.98 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.97Sun Jan 1 16:16:14 2006 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Wed Jan 4 22:48:15 2006 @@ -34,9 +34,6 @@ def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_AlphaCallSeq,[SDNPHasChain]>; def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_AlphaCallSeq,[SDNPHasChain]>; -def SDTFPLeaf : SDTypeProfile<1, 0, [SDTCisFP<0>]>; // for 'fpimm'. -def fpimm : SDNode<"ISD::ConstantFP" , SDTFPLeaf , [], "ConstantFPSDNode">; - // //Paterns for matching // ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp X86InstrInfo.td
Changes in directory llvm/lib/Target/X86: X86ISelDAGToDAG.cpp updated: 1.20 -> 1.21 X86InstrInfo.td updated: 1.187 -> 1.188 --- Log message: Added ConstantFP patterns. --- Diffs of the changes: (+33 -31) X86ISelDAGToDAG.cpp | 27 --- X86InstrInfo.td | 37 + 2 files changed, 33 insertions(+), 31 deletions(-) Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.20 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.21 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.20Wed Jan 4 18:27:02 2006 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jan 4 20:08:37 2006 @@ -410,33 +410,6 @@ return CodeGenMap[N] = CurDAG->getTargetNode(Opc, VT, Result); break; } - -case ISD::ConstantFP: { - Opc = 0; - if (X86ScalarSSE) { -assert(cast(N)->isExactlyValue(+0.0) && - "SSE only supports +0.0"); -Opc = (NVT == MVT::f32) ? X86::FLD0SS : X86::FLD0SD; - } - - if (cast(N)->isExactlyValue(+0.0) || - cast(N)->isExactlyValue(-0.0)) -Opc = X86::FpLD0; - else if (cast(N)->isExactlyValue(+1.0) || - cast(N)->isExactlyValue(-1.0)) -Opc = X86::FpLD1; - - assert(Opc != 0 && "Unexpected constant!"); - - SDOperand Result = CurDAG->getTargetNode(Opc, NVT); - - if (cast(N)->getValue() < 0.0 || - cast(N)->isExactlyValue(-0.0)) -Result = CurDAG->getTargetNode(X86::FpCHS, NVT, Result); - - CodeGenMap[N] = Result; - return Result; -} } return SelectCode(N); Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.187 llvm/lib/Target/X86/X86InstrInfo.td:1.188 --- llvm/lib/Target/X86/X86InstrInfo.td:1.187 Wed Jan 4 18:27:02 2006 +++ llvm/lib/Target/X86/X86InstrInfo.td Wed Jan 4 20:08:37 2006 @@ -244,6 +244,26 @@ return (unsigned)N->getValue() == (unsigned char)N->getValue(); }]>; +def fp32imm0 : PatLeaf<(f32 fpimm), [{ + return N->isExactlyValue(+0.0); +}]>; + +def fp64imm0 : PatLeaf<(f64 fpimm), [{ + return N->isExactlyValue(+0.0); +}]>; + +def fp64immneg0 : PatLeaf<(f64 fpimm), [{ + return N->isExactlyValue(-0.0); +}]>; + +def fp64imm1 : PatLeaf<(f64 fpimm), [{ + return N->isExactlyValue(+1.0); +}]>; + +def fp64immneg1 : PatLeaf<(f64 fpimm), [{ + return N->isExactlyValue(-1.0); +}]>; + // Helper fragments for loads. def loadi8 : PatFrag<(ops node:$ptr), (i8 (load node:$ptr))>; def loadi16 : PatFrag<(ops node:$ptr), (i16 (load node:$ptr))>; @@ -2187,9 +2207,13 @@ // Pseudo-instructions that map fld0 to xorps/xorpd for sse. // FIXME: remove when we can teach regalloc that xor reg, reg is ok. def FLD0SS : I<0x57, MRMSrcReg, (ops FR32:$dst), - "xorps $dst, $dst", []>, Requires<[HasSSE1]>, TB; + "xorps $dst, $dst", + [(set FR32:$dst, fp32imm0)]>, + Requires<[HasSSE1]>, TB; def FLD0SD : I<0x57, MRMSrcReg, (ops FR64:$dst), - "xorpd $dst, $dst", []>, Requires<[HasSSE2]>, TB, OpSize; + "xorpd $dst, $dst", + [(set FR64:$dst, fp64imm0)]>, + Requires<[HasSSE2]>, TB, OpSize; let isTwoAddress = 1 in { // SSE Scalar Arithmetic @@ -2568,8 +2592,13 @@ def FXCH: FPI<0xC8, AddRegFrm, (ops RST:$op), "fxch $op">, D9; // Floating point constant loads. -def FpLD0 : FpI<(ops RFP:$dst), ZeroArgFP, []>; -def FpLD1 : FpI<(ops RFP:$dst), ZeroArgFP, []>; +def FpLD0 : FpI<(ops RFP:$dst), ZeroArgFP, +[(set RFP:$dst, fp64imm0)]>; +def FpLD1 : FpI<(ops RFP:$dst), ZeroArgFP, +[(set RFP:$dst, fp64imm1)]>; + +def : Pat<(f64 fp64immneg0), (FpCHS (FpLD0))>, Requires<[FPStack]>; +def : Pat<(f64 fp64immneg1), (FpCHS (FpLD1))>, Requires<[FPStack]>; def FLD0 : FPI<0xEE, RawFrm, (ops), "fldz">, D9; def FLD1 : FPI<0xE8, RawFrm, (ops), "fld1">, D9; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/TargetSelectionDAG.td
Changes in directory llvm/lib/Target: TargetSelectionDAG.td updated: 1.40 -> 1.41 --- Log message: Added fpimm node for ConstantFP. --- Diffs of the changes: (+2 -0) TargetSelectionDAG.td |2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Target/TargetSelectionDAG.td diff -u llvm/lib/Target/TargetSelectionDAG.td:1.40 llvm/lib/Target/TargetSelectionDAG.td:1.41 --- llvm/lib/Target/TargetSelectionDAG.td:1.40 Wed Jan 4 19:25:28 2006 +++ llvm/lib/Target/TargetSelectionDAG.td Wed Jan 4 20:07:49 2006 @@ -70,6 +70,7 @@ // Builtin profiles. def SDTIntLeaf: SDTypeProfile<1, 0, [SDTCisInt<0>]>; // for 'imm'. +def SDTFPLeaf : SDTypeProfile<1, 0, [SDTCisFP<0>]>; // for 'fpimm'. def SDTPtrLeaf: SDTypeProfile<1, 0, [SDTCisPtrTy<0>]>; // for '&g'. def SDTOther : SDTypeProfile<1, 0, [SDTCisVT<0, OtherVT>]>; // for 'vt'. def SDTUNDEF : SDTypeProfile<1, 0, []>; // for 'undef'. @@ -190,6 +191,7 @@ def srcvalue; def imm: SDNode<"ISD::Constant" , SDTIntLeaf , [], "ConstantSDNode">; +def fpimm : SDNode<"ISD::ConstantFP", SDTFPLeaf , [], "ConstantFPSDNode">; def vt : SDNode<"ISD::VALUETYPE" , SDTOther , [], "VTSDNode">; def bb : SDNode<"ISD::BasicBlock", SDTOther , [], "BasicBlockSDNode">; def cond : SDNode<"ISD::CONDCODE" , SDTOther , [], "CondCodeSDNode">; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
Changes in directory llvm/include/llvm/CodeGen: SelectionDAGNodes.h updated: 1.87 -> 1.88 --- Log message: Grammer correction. --- Diffs of the changes: (+2 -2) SelectionDAGNodes.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.87 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.88 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.87 Wed Jan 4 19:25:28 2006 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Wed Jan 4 19:53:28 2006 @@ -362,8 +362,8 @@ // DEBUG_LABEL - This node is used to mark a location in the code where a // label should be generated for use by the debug information. It takes a -// token chain as input, the a unique id (provided by MachineDebugInfo.) It -// produces a token chain as output. +// token chain as input and then a unique id (provided by MachineDebugInfo.) +// It produces a token chain as output. DEBUG_LABEL, // BUILTIN_OP_END - This must be the last enum value in this list. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/IA64/IA64ISelLowering.cpp IA64ISelPattern.cpp
Changes in directory llvm/lib/Target/IA64: IA64ISelLowering.cpp updated: 1.10 -> 1.11 IA64ISelPattern.cpp updated: 1.72 -> 1.73 --- Log message: Had expand logic backward. --- Diffs of the changes: (+4 -0) IA64ISelLowering.cpp |2 ++ IA64ISelPattern.cpp |2 ++ 2 files changed, 4 insertions(+) Index: llvm/lib/Target/IA64/IA64ISelLowering.cpp diff -u llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.10 llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.11 --- llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.10 Wed Jan 4 19:25:28 2006 +++ llvm/lib/Target/IA64/IA64ISelLowering.cpp Wed Jan 4 19:47:43 2006 @@ -74,6 +74,8 @@ // We don't have line number support yet. setOperationAction(ISD::LOCATION, MVT::Other, Expand); + setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); + setOperationAction(ISD::DEBUG_LABEL, MVT::Other, Expand); //IA64 has these, but they are not implemented setOperationAction(ISD::CTTZ , MVT::i64 , Expand); Index: llvm/lib/Target/IA64/IA64ISelPattern.cpp diff -u llvm/lib/Target/IA64/IA64ISelPattern.cpp:1.72 llvm/lib/Target/IA64/IA64ISelPattern.cpp:1.73 --- llvm/lib/Target/IA64/IA64ISelPattern.cpp:1.72 Wed Jan 4 19:25:28 2006 +++ llvm/lib/Target/IA64/IA64ISelPattern.cppWed Jan 4 19:47:43 2006 @@ -102,6 +102,8 @@ // We don't have line number support yet. setOperationAction(ISD::LOCATION, MVT::Other, Expand); + setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); + setOperationAction(ISD::DEBUG_LABEL, MVT::Other, Expand); computeRegisterProperties(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.20 -> 1.21 --- Log message: Had expand logic backward. --- Diffs of the changes: (+2 -0) X86ISelLowering.cpp |2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.20 llvm/lib/Target/X86/X86ISelLowering.cpp:1.21 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.20Wed Jan 4 19:25:28 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Wed Jan 4 19:47:43 2006 @@ -130,6 +130,8 @@ // We don't have line number support yet. setOperationAction(ISD::LOCATION, MVT::Other, Expand); + setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); + setOperationAction(ISD::DEBUG_LABEL, MVT::Other, Expand); if (X86ScalarSSE) { // Set up the FP register classes. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelLowering.cpp
Changes in directory llvm/lib/Target/Alpha: AlphaISelLowering.cpp updated: 1.17 -> 1.18 --- Log message: Had expand logic backward. --- Diffs of the changes: (+2 -0) AlphaISelLowering.cpp |2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Target/Alpha/AlphaISelLowering.cpp diff -u llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.17 llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.18 --- llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.17Wed Jan 4 19:25:28 2006 +++ llvm/lib/Target/Alpha/AlphaISelLowering.cpp Wed Jan 4 19:47:43 2006 @@ -103,6 +103,8 @@ // We don't have line number support yet. setOperationAction(ISD::LOCATION, MVT::Other, Expand); + setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); + setOperationAction(ISD::DEBUG_LABEL, MVT::Other, Expand); // We want to legalize GlobalAddress and ConstantPool and // ExternalSymbols nodes into the appropriate instructions to ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCISelLowering.cpp updated: 1.57 -> 1.58 --- Log message: Had expand logic backward. --- Diffs of the changes: (+2 -1) PPCISelLowering.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.57 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.58 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.57Wed Jan 4 19:25:28 2006 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Wed Jan 4 19:47:43 2006 @@ -96,8 +96,9 @@ // Support label based line numbers. setOperationAction(ISD::LOCATION, MVT::Other, Expand); + setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); // FIXME - use subtarget debug flags - if (TM.getSubtarget().isDarwin()) + if (!TM.getSubtarget().isDarwin()) setOperationAction(ISD::DEBUG_LABEL, MVT::Other, Expand); // We want to legalize GlobalAddress and ConstantPool nodes into the ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp
Changes in directory llvm/lib/Target/SparcV8: SparcV8ISelDAGToDAG.cpp updated: 1.39 -> 1.40 --- Log message: Had expand logic backward. --- Diffs of the changes: (+2 -0) SparcV8ISelDAGToDAG.cpp |2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp diff -u llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp:1.39 llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp:1.40 --- llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp:1.39Wed Jan 4 19:25:28 2006 +++ llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp Wed Jan 4 19:47:43 2006 @@ -153,6 +153,8 @@ // We don't have line number support yet. setOperationAction(ISD::LOCATION, MVT::Other, Expand); + setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); + setOperationAction(ISD::DEBUG_LABEL, MVT::Other, Expand); computeRegisterProperties(); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp
Changes in directory llvm/lib/Target/SparcV8: SparcV8ISelDAGToDAG.cpp updated: 1.38 -> 1.39 --- Log message: Added initial support for DEBUG_LABEL allowing debug specific labels to be inserted in the code. --- Diffs of the changes: (+0 -1) SparcV8ISelDAGToDAG.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp diff -u llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp:1.38 llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp:1.39 --- llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp:1.38Wed Jan 4 18:26:14 2006 +++ llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp Wed Jan 4 19:25:28 2006 @@ -153,7 +153,6 @@ // We don't have line number support yet. setOperationAction(ISD::LOCATION, MVT::Other, Expand); - setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); computeRegisterProperties(); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.19 -> 1.20 --- Log message: Added initial support for DEBUG_LABEL allowing debug specific labels to be inserted in the code. --- Diffs of the changes: (+0 -1) X86ISelLowering.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.19 llvm/lib/Target/X86/X86ISelLowering.cpp:1.20 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.19Wed Jan 4 18:27:02 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Wed Jan 4 19:25:28 2006 @@ -130,7 +130,6 @@ // We don't have line number support yet. setOperationAction(ISD::LOCATION, MVT::Other, Expand); - setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); if (X86ScalarSSE) { // Set up the FP register classes. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/TargetSelectionDAG.td
Changes in directory llvm/lib/Target: TargetSelectionDAG.td updated: 1.39 -> 1.40 --- Log message: Added initial support for DEBUG_LABEL allowing debug specific labels to be inserted in the code. --- Diffs of the changes: (+6 -3) TargetSelectionDAG.td |9 ++--- 1 files changed, 6 insertions(+), 3 deletions(-) Index: llvm/lib/Target/TargetSelectionDAG.td diff -u llvm/lib/Target/TargetSelectionDAG.td:1.39 llvm/lib/Target/TargetSelectionDAG.td:1.40 --- llvm/lib/Target/TargetSelectionDAG.td:1.39 Wed Jan 4 09:04:11 2006 +++ llvm/lib/Target/TargetSelectionDAG.td Wed Jan 4 19:25:28 2006 @@ -440,9 +440,12 @@ //===--===// // Dwarf support. // -def SDT_dwarf_loc : SDTypeProfile<0, 4, - [SDTCisInt<0>, SDTCisInt<1>, SDTCisInt<2>, SDTCisInt<3>]>; -def dwarf_loc : SDNode<"ISD::DEBUG_LOC", SDT_dwarf_loc,[SDNPHasChain]>; +def SDT_dwarf_loc : SDTypeProfile<0, 3, + [SDTCisInt<0>, SDTCisInt<1>, SDTCisInt<2>]>; +def dwarf_loc : SDNode<"ISD::DEBUG_LOC", SDT_dwarf_loc,[SDNPHasChain]>; + +def SDT_dwarf_label : SDTypeProfile<0, 1, [SDTCisInt<0>]>; +def dwarf_label : SDNode<"ISD::DEBUG_LABEL", SDT_dwarf_label,[SDNPHasChain]>; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelLowering.cpp
Changes in directory llvm/lib/Target/Alpha: AlphaISelLowering.cpp updated: 1.16 -> 1.17 --- Log message: Added initial support for DEBUG_LABEL allowing debug specific labels to be inserted in the code. --- Diffs of the changes: (+0 -1) AlphaISelLowering.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaISelLowering.cpp diff -u llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.16 llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.17 --- llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.16Sat Dec 24 19:34:27 2005 +++ llvm/lib/Target/Alpha/AlphaISelLowering.cpp Wed Jan 4 19:25:28 2006 @@ -103,7 +103,6 @@ // We don't have line number support yet. setOperationAction(ISD::LOCATION, MVT::Other, Expand); - setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); // We want to legalize GlobalAddress and ConstantPool and // ExternalSymbols nodes into the appropriate instructions to ___ 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/DAGCombiner.cpp LegalizeDAG.cpp SelectionDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.76 -> 1.77 LegalizeDAG.cpp updated: 1.252 -> 1.253 SelectionDAG.cpp updated: 1.233 -> 1.234 --- Log message: Added initial support for DEBUG_LABEL allowing debug specific labels to be inserted in the code. --- Diffs of the changes: (+57 -31) DAGCombiner.cpp |3 - LegalizeDAG.cpp | 84 --- SelectionDAG.cpp |1 3 files changed, 57 insertions(+), 31 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.76 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.77 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.76 Wed Jan 4 09:04:11 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Jan 4 19:25:28 2006 @@ -2117,8 +2117,7 @@ return DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Chain.getOperand(0), N->getOperand(1), N->getOperand(2), - N->getOperand(3), - N->getOperand(4)); + N->getOperand(3)); } return SDOperand(); Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.252 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.253 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.252 Wed Jan 4 16:28:25 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Jan 4 19:25:28 2006 @@ -619,20 +619,33 @@ default: assert(0 && "This action is not supported yet!"); case TargetLowering::Expand: { MachineDebugInfo *DebugInfo = DAG.getMachineDebugInfo(); - if (TLI.isOperationLegal(ISD::DEBUG_LOC, MVT::Other) && DebugInfo) { -std::vector Ops; -Ops.push_back(Tmp1); // chain -Ops.push_back(Node->getOperand(1)); // line # -Ops.push_back(Node->getOperand(2)); // col # -const std::string &fname = + bool useDEBUG_LOC = TLI.isOperationLegal(ISD::DEBUG_LOC, MVT::Other); + bool useDEBUG_LABEL = TLI.isOperationLegal(ISD::DEBUG_LABEL, MVT::Other); + + if (DebugInfo && (useDEBUG_LOC || useDEBUG_LABEL)) { +const std::string &FName = cast(Node->getOperand(3))->getValue(); -const std::string &dirname = +const std::string &DirName = cast(Node->getOperand(4))->getValue(); -unsigned srcfile = DebugInfo->getUniqueSourceID(fname, dirname); -Ops.push_back(DAG.getConstant(srcfile, MVT::i32)); // source file id -unsigned id = DebugInfo->getNextUniqueID(); -Ops.push_back(DAG.getConstant(id, MVT::i32)); // label id -Result = DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Ops); +unsigned SrcFile = DebugInfo->getUniqueSourceID(FName, DirName); + +std::vector Ops; +Ops.push_back(Tmp1); // chain +SDOperand LineOp = Node->getOperand(1); +SDOperand ColOp = Node->getOperand(2); + +if (useDEBUG_LOC) { + Ops.push_back(LineOp); // line # + Ops.push_back(ColOp); // col # + Ops.push_back(DAG.getConstant(SrcFile, MVT::i32)); // source file id + Result = DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Ops); +} else { + unsigned Line = dyn_cast(LineOp)->getValue(); + unsigned Col = dyn_cast(ColOp)->getValue(); + unsigned ID = DebugInfo->RecordLabel(Line, Col, SrcFile); + Ops.push_back(DAG.getConstant(ID, MVT::i32)); + Result = DAG.getNode(ISD::DEBUG_LABEL, MVT::Other, Ops); +} } else { Result = Tmp1; // chain } @@ -661,27 +674,40 @@ break; case ISD::DEBUG_LOC: -assert(Node->getNumOperands() == 5 && "Invalid DEBUG_LOC node!"); +assert(Node->getNumOperands() == 4 && "Invalid DEBUG_LOC node!"); switch (TLI.getOperationAction(ISD::DEBUG_LOC, MVT::Other)) { case TargetLowering::Promote: case TargetLowering::Expand: default: assert(0 && "This action is not supported yet!"); -case TargetLowering::Legal: { -SDOperand Tmp5; -Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. -Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the line #. -Tmp3 = LegalizeOp(Node->getOperand(2)); // Legalize the col #. -Tmp4 = LegalizeOp(Node->getOperand(3)); // Legalize the source file id. -Tmp5 = LegalizeOp(Node->getOperand(4)); // Legalize the label id. - -if (Tmp1 != Node->getOperand(0) || -Tmp2 != Node->getOperand(1) || -Tmp3 != Node->getOperand(2) || -Tmp4 != Node->getOperand(3) || -Tmp5 != Node->getOperand(4)) { - Result = - DAG.getNode(ISD::DEBUG_LOC,MVT::Other, Tmp1, Tmp2, Tmp3, Tmp4, Tmp5); -
[llvm-commits] CVS: llvm/include/llvm/CodeGen/DwarfWriter.h MachineDebugInfo.h SelectionDAGNodes.h
Changes in directory llvm/include/llvm/CodeGen: DwarfWriter.h updated: 1.5 -> 1.6 MachineDebugInfo.h updated: 1.4 -> 1.5 SelectionDAGNodes.h updated: 1.86 -> 1.87 --- Log message: Added initial support for DEBUG_LABEL allowing debug specific labels to be inserted in the code. --- Diffs of the changes: (+19 -6) DwarfWriter.h |5 +++-- MachineDebugInfo.h |7 +++ SelectionDAGNodes.h | 13 + 3 files changed, 19 insertions(+), 6 deletions(-) Index: llvm/include/llvm/CodeGen/DwarfWriter.h diff -u llvm/include/llvm/CodeGen/DwarfWriter.h:1.5 llvm/include/llvm/CodeGen/DwarfWriter.h:1.6 --- llvm/include/llvm/CodeGen/DwarfWriter.h:1.5 Wed Jan 4 16:28:25 2006 +++ llvm/include/llvm/CodeGen/DwarfWriter.h Wed Jan 4 19:25:28 2006 @@ -550,8 +550,9 @@ /// void EmitInitial() const; -/// ShouldEmitDwarf - Determine if dwarf declarations should be made. -/// +/// ShouldEmitDwarf - Returns true if dwarf declarations should be made. +/// When called it also checks to see if debug info is newly available. if +/// so the initial dwarf headers are emitted. bool ShouldEmitDwarf(); /// BeginModule - Emit all dwarf sections that should come prior to the Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.4 llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.5 --- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.4Wed Jan 4 16:28:25 2006 +++ llvm/include/llvm/CodeGen/MachineDebugInfo.hWed Jan 4 19:25:28 2006 @@ -52,6 +52,13 @@ /// unsigned getNextUniqueID() { return UniqueID++; } + /// RecordLabel - Records location information and associates it with a + /// debug label. Returns unique label id. + unsigned RecordLabel(unsigned Line, unsigned Col, unsigned SrcFile) { +// FIXME - actually record. +return getNextUniqueID(); + } + bool doInitialization(); bool doFinalization(); Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.86 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.87 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.86 Wed Jan 4 09:04:11 2006 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Wed Jan 4 19:25:28 2006 @@ -355,12 +355,17 @@ LOCATION, // DEBUG_LOC - This node is used to represent source line information -// embedded in the code. It takes token chain as input, then a line number, -// then a column then a file id (provided by MachineDebugInfo), then a -// unique id (provided by MachineDebugInfo for label gen). It produces a -// token chain as output. +// embedded in the code. It takes a token chain as input, then a line +// number, then a column then a file id (provided by MachineDebugInfo.) It +// produces a token chain as output. DEBUG_LOC, +// DEBUG_LABEL - This node is used to mark a location in the code where a +// label should be generated for use by the debug information. It takes a +// token chain as input, the a unique id (provided by MachineDebugInfo.) It +// produces a token chain as output. +DEBUG_LABEL, + // BUILTIN_OP_END - This must be the last enum value in this list. 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/Target/IA64/IA64ISelLowering.cpp IA64ISelPattern.cpp
Changes in directory llvm/lib/Target/IA64: IA64ISelLowering.cpp updated: 1.9 -> 1.10 IA64ISelPattern.cpp updated: 1.71 -> 1.72 --- Log message: Added initial support for DEBUG_LABEL allowing debug specific labels to be inserted in the code. --- Diffs of the changes: (+0 -2) IA64ISelLowering.cpp |1 - IA64ISelPattern.cpp |1 - 2 files changed, 2 deletions(-) Index: llvm/lib/Target/IA64/IA64ISelLowering.cpp diff -u llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.9 llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.10 --- llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.9 Tue Dec 27 04:17:03 2005 +++ llvm/lib/Target/IA64/IA64ISelLowering.cpp Wed Jan 4 19:25:28 2006 @@ -74,7 +74,6 @@ // We don't have line number support yet. setOperationAction(ISD::LOCATION, MVT::Other, Expand); - setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); //IA64 has these, but they are not implemented setOperationAction(ISD::CTTZ , MVT::i64 , Expand); Index: llvm/lib/Target/IA64/IA64ISelPattern.cpp diff -u llvm/lib/Target/IA64/IA64ISelPattern.cpp:1.71 llvm/lib/Target/IA64/IA64ISelPattern.cpp:1.72 --- llvm/lib/Target/IA64/IA64ISelPattern.cpp:1.71 Thu Dec 22 15:15:41 2005 +++ llvm/lib/Target/IA64/IA64ISelPattern.cppWed Jan 4 19:25:28 2006 @@ -102,7 +102,6 @@ // We don't have line number support yet. setOperationAction(ISD::LOCATION, MVT::Other, Expand); - setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); computeRegisterProperties(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp PPCISelLowering.cpp PPCInstrInfo.td
Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.135 -> 1.136 PPCISelLowering.cpp updated: 1.56 -> 1.57 PPCInstrInfo.td updated: 1.168 -> 1.169 --- Log message: Added initial support for DEBUG_LABEL allowing debug specific labels to be inserted in the code. --- Diffs of the changes: (+16 -6) PPCAsmPrinter.cpp |6 +- PPCISelLowering.cpp |5 - PPCInstrInfo.td | 11 +++ 3 files changed, 16 insertions(+), 6 deletions(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.135 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.136 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.135 Wed Jan 4 16:28:25 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Wed Jan 4 19:25:28 2006 @@ -252,7 +252,9 @@ bool doFinalization(Module &M); void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); AU.addRequired(); + PPCAsmPrinter::getAnalysisUsage(AU); } }; @@ -418,6 +420,9 @@ /// method to print assembly for each instruction. /// bool DarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + // FIXME - is this the earliest this can be set. + DW.SetDebugInfo(&getAnalysis()); + SetupMachineFunction(MF); O << "\n\n"; @@ -486,7 +491,6 @@ Mang->setUseQuotes(true); // Emit initial debug information. - DW.SetDebugInfo(getAnalysisToUpdate()); DW.BeginModule(); return false; } Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.56 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.57 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.56Thu Dec 29 18:11:07 2005 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Wed Jan 4 19:25:28 2006 @@ -94,8 +94,11 @@ // PowerPC does not have truncstore for i1. setOperationAction(ISD::TRUNCSTORE, MVT::i1, Promote); - // PowerPC doesn't have line number support yet. + // Support label based line numbers. setOperationAction(ISD::LOCATION, MVT::Other, Expand); + // FIXME - use subtarget debug flags + if (TM.getSubtarget().isDarwin()) +setOperationAction(ISD::DEBUG_LABEL, MVT::Other, Expand); // We want to legalize GlobalAddress and ConstantPool nodes into the // appropriate instructions to materialize the address. Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.168 llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.169 --- llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.168 Wed Jan 4 09:04:11 2006 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.td Wed Jan 4 19:25:28 2006 @@ -955,11 +955,14 @@ // DWARF Pseudo Instructions // -def DWARF_LOC: Pseudo<(ops i32imm:$line, i32imm:$col, i32imm:$file, - i32imm:$id), - "; .loc $file, $line, $col\nLdebug_loc$id:", +def DWARF_LOC: Pseudo<(ops i32imm:$line, i32imm:$col, i32imm:$file), + "; .loc $file, $line, $col", [(dwarf_loc (i32 imm:$line), (i32 imm:$col), - (i32 imm:$file), (i32 imm:$id))]>; + (i32 imm:$file))]>; + +def DWARF_LABEL : Pseudo<(ops i32imm:$id), + "\nLdebug_loc$id:", + [(dwarf_label (i32 imm:$id))]>; //===--===// // PowerPC Instruction Patterns ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp X86ISelLowering.cpp X86ISelLowering.h X86InstrInfo.td
Changes in directory llvm/lib/Target/X86: X86ISelDAGToDAG.cpp updated: 1.19 -> 1.20 X86ISelLowering.cpp updated: 1.18 -> 1.19 X86ISelLowering.h updated: 1.9 -> 1.10 X86InstrInfo.td updated: 1.186 -> 1.187 --- Log message: DAG based isel call support. --- Diffs of the changes: (+197 -41) X86ISelDAGToDAG.cpp | 27 + X86ISelLowering.cpp | 141 X86ISelLowering.h | 11 X86InstrInfo.td | 59 + 4 files changed, 197 insertions(+), 41 deletions(-) Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.19 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.20 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.19Wed Dec 21 17:05:39 2005 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jan 4 18:27:02 2006 @@ -410,6 +410,33 @@ return CodeGenMap[N] = CurDAG->getTargetNode(Opc, VT, Result); break; } + +case ISD::ConstantFP: { + Opc = 0; + if (X86ScalarSSE) { +assert(cast(N)->isExactlyValue(+0.0) && + "SSE only supports +0.0"); +Opc = (NVT == MVT::f32) ? X86::FLD0SS : X86::FLD0SD; + } + + if (cast(N)->isExactlyValue(+0.0) || + cast(N)->isExactlyValue(-0.0)) +Opc = X86::FpLD0; + else if (cast(N)->isExactlyValue(+1.0) || + cast(N)->isExactlyValue(-1.0)) +Opc = X86::FpLD1; + + assert(Opc != 0 && "Unexpected constant!"); + + SDOperand Result = CurDAG->getTargetNode(Opc, NVT); + + if (cast(N)->getValue() < 0.0 || + cast(N)->isExactlyValue(-0.0)) +Result = CurDAG->getTargetNode(X86::FpCHS, NVT, Result); + + CodeGenMap[N] = Result; + return Result; +} } return SelectCode(N); Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.18 llvm/lib/Target/X86/X86ISelLowering.cpp:1.19 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.18Mon Dec 26 21:02:18 2005 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Wed Jan 4 18:27:02 2006 @@ -457,38 +457,117 @@ RetVals.push_back(MVT::i32); break; } - std::vector Ops; - Ops.push_back(Chain); - Ops.push_back(Callee); - Ops.push_back(DAG.getConstant(NumBytes, getPointerTy())); - Ops.push_back(DAG.getConstant(0, getPointerTy())); - SDOperand TheCall = DAG.getNode(isTailCall ? X86ISD::TAILCALL : X86ISD::CALL, - RetVals, Ops); - Chain = DAG.getNode(ISD::CALLSEQ_END, MVT::Other, TheCall); - SDOperand ResultVal; - switch (RetTyVT) { - case MVT::isVoid: break; - default: -ResultVal = TheCall.getValue(1); -break; - case MVT::i1: - case MVT::i8: - case MVT::i16: -ResultVal = DAG.getNode(ISD::TRUNCATE, RetTyVT, TheCall.getValue(1)); -break; - case MVT::f32: -// FIXME: we would really like to remember that this FP_ROUND operation is -// okay to eliminate if we allow excess FP precision. -ResultVal = DAG.getNode(ISD::FP_ROUND, MVT::f32, TheCall.getValue(1)); -break; - case MVT::i64: -ResultVal = DAG.getNode(ISD::BUILD_PAIR, MVT::i64, TheCall.getValue(1), -TheCall.getValue(2)); -break; - } + if (X86DAGIsel) { +std::vector NodeTys; +NodeTys.push_back(MVT::Other); // Returns a chain +NodeTys.push_back(MVT::Flag);// Returns a flag for retval copy to use. - return std::make_pair(ResultVal, Chain); +std::vector Ops; +Ops.push_back(Chain); +Ops.push_back(Callee); + +Chain = DAG.getNode(isTailCall ? X86ISD::TAILCALL : X86ISD::CALL, +NodeTys, Ops); +SDOperand InFlag = Chain.getValue(1); + +SDOperand RetVal; +if (RetTyVT != MVT::isVoid) { + switch (RetTyVT) { + default: assert(0 && "Unknown value type to return!"); + case MVT::i1: + case MVT::i8: +RetVal = DAG.getCopyFromReg(Chain, X86::AL, MVT::i8, InFlag); +Chain = RetVal.getValue(1); +break; + case MVT::i16: +RetVal = DAG.getCopyFromReg(Chain, X86::AX, MVT::i16, InFlag); +Chain = RetVal.getValue(1); +break; + case MVT::i32: +RetVal = DAG.getCopyFromReg(Chain, X86::EAX, MVT::i32, InFlag); +Chain = RetVal.getValue(1); +break; + case MVT::i64: { +SDOperand Lo = DAG.getCopyFromReg(Chain, X86::EAX, MVT::i32, InFlag); +SDOperand Hi = DAG.getCopyFromReg(Lo.getValue(1), X86::EDX, MVT::i32, + Lo.getValue(2)); +RetVal = DAG.getNode(ISD::BUILD_PAIR, MVT::i64, Lo, Hi); +Chain = Hi.getValue(1); +break; + } + case MVT::f32: + case MVT::f64: { +std::vector Tys; +Tys.push_back(MVT::f64); +Tys.push_back(MVT::Other); +std::vector Ops; +Ops.push_back(Chain); +Ops.push_back(InFlag); +RetVal = DAG.getNode(X86ISD::FP_GET_RESULT, Tys, Ops); +Chain = RetVal.ge
[llvm-commits] CVS: llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp
Changes in directory llvm/lib/Target/SparcV8: SparcV8ISelDAGToDAG.cpp updated: 1.37 -> 1.38 --- Log message: Remove some dead code. --- Diffs of the changes: (+0 -4) SparcV8ISelDAGToDAG.cpp |4 1 files changed, 4 deletions(-) Index: llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp diff -u llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp:1.37 llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp:1.38 --- llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp:1.37Fri Dec 23 01:08:39 2005 +++ llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp Wed Jan 4 18:26:14 2006 @@ -476,10 +476,6 @@ InFlag = Chain.getValue(1); } - std::vector RetVals; - RetVals.push_back(MVT::Other); - RetVals.push_back(MVT::Flag); - // If the callee is a GlobalAddress node (quite common, every direct call is) // turn it into a TargetGlobalAddress node so that legalize doesn't hack it. if (GlobalAddressSDNode *G = dyn_cast(Callee)) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llc/llc.cpp
Changes in directory llvm/tools/llc: llc.cpp updated: 1.125 -> 1.126 --- Log message: remove unused header --- Diffs of the changes: (+0 -1) llc.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/tools/llc/llc.cpp diff -u llvm/tools/llc/llc.cpp:1.125 llvm/tools/llc/llc.cpp:1.126 --- llvm/tools/llc/llc.cpp:1.125Wed Jan 4 16:28:25 2006 +++ llvm/tools/llc/llc.cpp Wed Jan 4 18:21:37 2006 @@ -27,7 +27,6 @@ #include "llvm/Support/FileUtilities.h" #include "llvm/Analysis/Verifier.h" #include "llvm/System/Signals.h" -#include "llvm/CodeGen/MachineDebugInfo.h" #include "llvm/Config/config.h" #include #include ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llc/llc.cpp
Changes in directory llvm/tools/llc: llc.cpp updated: 1.124 -> 1.125 --- Log message: Applied some recommend changes from sabre. The dominate one beginning "let the pass manager do it's thing." Fixes crash when compiling -g files and suppresses dwarf statements if no debug info is present. --- Diffs of the changes: (+0 -3) llc.cpp |3 --- 1 files changed, 3 deletions(-) Index: llvm/tools/llc/llc.cpp diff -u llvm/tools/llc/llc.cpp:1.124 llvm/tools/llc/llc.cpp:1.125 --- llvm/tools/llc/llc.cpp:1.124Wed Jan 4 07:42:02 2006 +++ llvm/tools/llc/llc.cpp Wed Jan 4 16:28:25 2006 @@ -239,9 +239,6 @@ } } -// Set up collection of debug information -Passes.add(createDebugInfoPass()); - // Ask the target to add backend passes as necessary. if (Target.addPassesToEmitFile(Passes, *Out, FileType, Fast)) { std::cerr << argv[0] << ": target '" << Target.getName() ___ 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/LegalizeDAG.cpp SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.251 -> 1.252 SelectionDAGISel.cpp updated: 1.119 -> 1.120 --- Log message: Applied some recommend changes from sabre. The dominate one beginning "let the pass manager do it's thing." Fixes crash when compiling -g files and suppresses dwarf statements if no debug info is present. --- Diffs of the changes: (+6 -5) LegalizeDAG.cpp |8 SelectionDAGISel.cpp |3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.251 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.252 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.251 Wed Jan 4 09:04:11 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Jan 4 16:28:25 2006 @@ -618,8 +618,8 @@ case TargetLowering::Promote: default: assert(0 && "This action is not supported yet!"); case TargetLowering::Expand: { - if (TLI.isOperationLegal(ISD::DEBUG_LOC, MVT::Other)) { -MachineDebugInfo &DebugInfo = getMachineDebugInfo(); + MachineDebugInfo *DebugInfo = DAG.getMachineDebugInfo(); + if (TLI.isOperationLegal(ISD::DEBUG_LOC, MVT::Other) && DebugInfo) { std::vector Ops; Ops.push_back(Tmp1); // chain Ops.push_back(Node->getOperand(1)); // line # @@ -628,9 +628,9 @@ cast(Node->getOperand(3))->getValue(); const std::string &dirname = cast(Node->getOperand(4))->getValue(); -unsigned srcfile = DebugInfo.RecordSource(fname, dirname); +unsigned srcfile = DebugInfo->getUniqueSourceID(fname, dirname); Ops.push_back(DAG.getConstant(srcfile, MVT::i32)); // source file id -unsigned id = DebugInfo.NextUniqueID(); +unsigned id = DebugInfo->getNextUniqueID(); Ops.push_back(DAG.getConstant(id, MVT::i32)); // label id Result = DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Ops); } else { Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.119 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.120 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.119Wed Dec 21 13:36:36 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jan 4 16:28:25 2006 @@ -21,6 +21,7 @@ #include "llvm/Instructions.h" #include "llvm/Intrinsics.h" #include "llvm/CodeGen/IntrinsicLowering.h" +#include "llvm/CodeGen/MachineDebugInfo.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineInstrBuilder.h" @@ -1640,7 +1641,7 @@ void SelectionDAGISel::SelectBasicBlock(BasicBlock *LLVMBB, MachineFunction &MF, FunctionLoweringInfo &FuncInfo) { - SelectionDAG DAG(TLI, MF); + SelectionDAG DAG(TLI, MF, getAnalysisToUpdate()); CurDAG = &DAG; std::vector > PHINodesToUpdate; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.134 -> 1.135 --- Log message: Applied some recommend changes from sabre. The dominate one beginning "let the pass manager do it's thing." Fixes crash when compiling -g files and suppresses dwarf statements if no debug info is present. --- Diffs of the changes: (+11 -7) PPCAsmPrinter.cpp | 18 +++--- 1 files changed, 11 insertions(+), 7 deletions(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.134 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.135 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.134 Wed Jan 4 07:52:30 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Wed Jan 4 16:28:25 2006 @@ -204,16 +204,16 @@ virtual bool runOnMachineFunction(MachineFunction &F) = 0; virtual bool doFinalization(Module &M) = 0; + }; /// DarwinDwarfWriter - Dwarf debug info writer customized for Darwin/Mac OS X /// struct DarwinDwarfWriter : public DwarfWriter { // Ctor. -DarwinDwarfWriter(std::ostream &o, AsmPrinter *ap, MachineDebugInfo &di) -: DwarfWriter(o, ap, di) +DarwinDwarfWriter(std::ostream &o, AsmPrinter *ap) +: DwarfWriter(o, ap) { - hasLEB128 = false; needsSet = true; DwarfAbbrevSection = ".section __DWARFA,__debug_abbrev,regular,debug"; DwarfInfoSection = ".section __DWARFA,__debug_info,regular,debug"; @@ -229,9 +229,7 @@ DarwinDwarfWriter DW; DarwinAsmPrinter(std::ostream &O, TargetMachine &TM) - : PPCAsmPrinter(O, TM), -// FIXME - MachineDebugInfo needs a proper location -DW(O, this, getMachineDebugInfo()) + : PPCAsmPrinter(O, TM), DW(O, this) { CommentString = ";"; GlobalPrefix = "_"; @@ -252,6 +250,11 @@ bool runOnMachineFunction(MachineFunction &F); bool doInitialization(Module &M); bool doFinalization(Module &M); + +void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(); +} + }; /// AIXAsmPrinter - PowerPC assembly printer, customized for AIX @@ -483,6 +486,7 @@ Mang->setUseQuotes(true); // Emit initial debug information. + DW.SetDebugInfo(getAnalysisToUpdate()); DW.BeginModule(); return false; } @@ -613,7 +617,7 @@ return false; // success } -/// runOnMachineFunction - This uses the printMachineInstruction() +/// runOnMachineFunction - This uses the e() /// method to print assembly for each instruction. /// bool AIXAsmPrinter::runOnMachineFunction(MachineFunction &MF) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/AsmPrinter.h DwarfWriter.h MachineDebugInfo.h SelectionDAG.h
Changes in directory llvm/include/llvm/CodeGen: AsmPrinter.h updated: 1.24 -> 1.25 DwarfWriter.h updated: 1.4 -> 1.5 MachineDebugInfo.h updated: 1.3 -> 1.4 SelectionDAG.h updated: 1.82 -> 1.83 --- Log message: Applied some recommend changes from sabre. The dominate one beginning "let the pass manager do it's thing." Fixes crash when compiling -g files and suppresses dwarf statements if no debug info is present. --- Diffs of the changes: (+88 -112) AsmPrinter.h | 45 ++-- DwarfWriter.h | 119 - MachineDebugInfo.h | 30 + SelectionDAG.h |6 ++ 4 files changed, 88 insertions(+), 112 deletions(-) Index: llvm/include/llvm/CodeGen/AsmPrinter.h diff -u llvm/include/llvm/CodeGen/AsmPrinter.h:1.24 llvm/include/llvm/CodeGen/AsmPrinter.h:1.25 --- llvm/include/llvm/CodeGen/AsmPrinter.h:1.24 Wed Jan 4 07:52:30 2006 +++ llvm/include/llvm/CodeGen/AsmPrinter.h Wed Jan 4 16:28:25 2006 @@ -36,7 +36,7 @@ /// unsigned FunctionNumber; - protected: + public: /// Output stream on which we're printing assembly code. /// std::ostream &O; @@ -162,7 +162,8 @@ /// HasDotTypeDotSizeDirective - True if the target has .type and .size /// directives, this is true for most ELF targets. bool HasDotTypeDotSizeDirective; // Defaults to true. - + + protected: AsmPrinter(std::ostream &o, TargetMachine &TM); public: @@ -194,7 +195,7 @@ /// doFinalization - Shut down the asmprinter. If you override this in your /// pass, you must make sure to call it explicitly. bool doFinalization(Module &M); - + /// SetupMachineFunction - This should be called when a new MachineFunction /// is being processed from runOnMachineFunction. void SetupMachineFunction(MachineFunction &MF); @@ -231,43 +232,7 @@ private: void EmitXXStructorList(Constant *List); - - public: -/// getCommentString - get the comment string. -/// -const char *getCommentString() { - return CommentString; -} - -/// getData8bitsDirective - get the 8-bit data directive string. -/// -const char *getData8bitsDirective() { - return Data8bitsDirective; -} - -/// getData16bitsDirective - get the 16-bit data directive string. -/// -const char *getData16bitsDirective() { - return Data16bitsDirective; -} - -/// getData32bitsDirective - get the 32-bit data directive string. -/// -const char *getData32bitsDirective() { - return Data32bitsDirective; -} - -/// getData64bitsDirective - get the 64-bit data directive string. -/// -const char *getData64bitsDirective() { - return Data64bitsDirective; -} - -/// getPrivateGlobalPrefix - get private label prefix. -/// -const char *getPrivateGlobalPrefix() { - return PrivateGlobalPrefix; -} + }; } Index: llvm/include/llvm/CodeGen/DwarfWriter.h diff -u llvm/include/llvm/CodeGen/DwarfWriter.h:1.4 llvm/include/llvm/CodeGen/DwarfWriter.h:1.5 --- llvm/include/llvm/CodeGen/DwarfWriter.h:1.4 Wed Jan 4 07:52:30 2006 +++ llvm/include/llvm/CodeGen/DwarfWriter.h Wed Jan 4 16:28:25 2006 @@ -14,8 +14,7 @@ #ifndef LLVM_CODEGEN_DWARFPRINTER_H #define LLVM_CODEGEN_DWARFPRINTER_H -#include -#include "llvm/CodeGen/MachineDebugInfo.h" +#include namespace llvm { @@ -429,6 +428,7 @@ // Forward declarations. // class AsmPrinter; + class MachineDebugInfo; //======// // DwarfWriter - emits dwarf debug and exception handling directives. @@ -447,12 +447,28 @@ /// DebugInfo - Collected debug information. /// -MachineDebugInfo &DebugInfo; +MachineDebugInfo *DebugInfo; +/// didInitial - Flag to indicate if initial emission has been done. +/// +bool didInitial; + + //===--===// +// Properties to be set by the derived class ctor, used to configure the +// dwarf writer. + /// hasLEB128 - True if target asm supports leb128 directives. /// bool hasLEB128; /// Defaults to false. +/// hasDotLoc - True if target asm supports .loc directives. +/// +bool hasDotLoc; /// Defaults to false. + +/// hasDotFile - True if target asm supports .file directives. +/// +bool hasDotFile; /// Defaults to false. + /// needsSet - True if target asm can't compute addresses on data /// directives. bool needsSet; /// Defaults to false. @@ -469,94 +485,89 @@ /// const char *DwarfLineSection; /// Defaults to ".debug_line". + //===--===// + public: // Ctor. -DwarfWriter(std::ostream &o, AsmPrinter *ap, MachineDebugInfo &di) +DwarfWriter(std::
[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp DwarfWriter.cpp MachineDebugInfo.cpp
Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.35 -> 1.36 DwarfWriter.cpp updated: 1.4 -> 1.5 MachineDebugInfo.cpp updated: 1.2 -> 1.3 --- Log message: Applied some recommend changes from sabre. The dominate one beginning "let the pass manager do it's thing." Fixes crash when compiling -g files and suppresses dwarf statements if no debug info is present. --- Diffs of the changes: (+150 -89) AsmPrinter.cpp |1 DwarfWriter.cpp | 132 +-- MachineDebugInfo.cpp | 106 3 files changed, 150 insertions(+), 89 deletions(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.35 llvm/lib/CodeGen/AsmPrinter.cpp:1.36 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.35Wed Jan 4 07:52:30 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Wed Jan 4 16:28:25 2006 @@ -16,7 +16,6 @@ #include "llvm/Constants.h" #include "llvm/Module.h" #include "llvm/CodeGen/MachineConstantPool.h" -#include "llvm/CodeGen/MachineDebugInfo.h" #include "llvm/Support/Mangler.h" #include "llvm/Support/MathExtras.h" #include "llvm/Target/TargetMachine.h" Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.4 llvm/lib/CodeGen/DwarfWriter.cpp:1.5 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.4Wed Jan 4 08:30:12 2006 +++ llvm/lib/CodeGen/DwarfWriter.cppWed Jan 4 16:28:25 2006 @@ -11,32 +11,35 @@ // //===--===// +#include "llvm/CodeGen/DwarfWriter.h" #include "llvm/CodeGen/AsmPrinter.h" -#include "llvm/CodeGen/DwarfWriter.h" +#include "llvm/CodeGen/MachineDebugInfo.h" #include "llvm/Support/CommandLine.h" +#include -namespace llvm { +using namespace llvm; static cl::opt DwarfVerbose("dwarf-verbose", cl::Hidden, cl::desc("Add comments to dwarf directives.")); /// EmitULEB128Bytes - Emit an assembler byte data directive to compose an -/// unsigned leb128 value. +/// unsigned leb128 value. Comment is added to the end of the directive if +/// DwarfVerbose is true (should not contain any newlines.) /// -void DwarfWriter::EmitULEB128Bytes(unsigned Value, std::string Comment) { +void DwarfWriter::EmitULEB128Bytes(unsigned Value, const char *Comment) const { if (hasLEB128) { O << "\t.uleb128\t" << Value; } else { -O << Asm->getData8bitsDirective(); +O << Asm->Data8bitsDirective; EmitULEB128(Value); } if (DwarfVerbose) { O << "\t" - << Asm->getCommentString() + << Asm->CommentString << " " << Comment << " " @@ -46,19 +49,20 @@ } /// EmitSLEB128Bytes - Emit an assembler byte data directive to compose a -/// signed leb128 value. +/// signed leb128 value. Comment is added to the end of the directive if +/// DwarfVerbose is true (should not contain any newlines.) /// -void DwarfWriter::EmitSLEB128Bytes(int Value, std::string Comment) { +void DwarfWriter::EmitSLEB128Bytes(int Value, const char *Comment) const { if (hasLEB128) { O << "\t.sleb128\t" << Value; } else { -O << Asm->getData8bitsDirective(); +O << Asm->Data8bitsDirective; EmitSLEB128(Value); } if (DwarfVerbose) { O << "\t" - << Asm->getCommentString() + << Asm->CommentString << " " << Comment << " " @@ -67,13 +71,75 @@ O << "\n"; } -/// BeginModule - Emit all dwarf sections that should come prior to the content. +/// EmitHex - Emit a hexidecimal string to the output stream. /// -void DwarfWriter::BeginModule() { - if (!DebugInfo.hasInfo()) return; - EmitComment("Dwarf Begin Module"); +void DwarfWriter::EmitHex(unsigned Value) const { + O << "0x" +<< std::hex +<< Value +<< std::dec; +} + +/// EmitComment - Emit a simple string comment. +/// +void DwarfWriter::EmitComment(const char *Comment) const { + O << "\t" +<< Asm->CommentString +<< " " +<< Comment +<< "\n"; +} + +/// EmitULEB128 - Emit a series of hexidecimal values (separated by commas) +/// representing an unsigned leb128 value. +/// +void DwarfWriter::EmitULEB128(unsigned Value) const { + do { +unsigned Byte = Value & 0x7f; +Value >>= 7; +if (Value) Byte |= 0x80; +EmitHex(Byte); +if (Value) O << ", "; + } while (Value); +} + +/// EmitSLEB128 - Emit a series of hexidecimal values (separated by commas) +/// representing a signed leb128 value. +/// +void DwarfWriter::EmitSLEB128(int Value) const { + int Sign = Value >> (8 * sizeof(Value) - 1); + bool IsMore; - // define base addresses for dwarf sections + do { +unsigned Byte = Value & 0x7f; +Value >>= 7; +IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0; +if (IsMore) Byte |= 0x80; +EmitHex(Byte); +if (IsMore) O << ", "; + } while (IsMore); +} + +/// EmitLabelName - Emit label name for internal use by dwarf. +/// +void DwarfWriter
[llvm-commits] [vector_llvm] CVS: llvm/lib/Transforms/Vector/SSE.cpp
Changes in directory llvm/lib/Transforms/Vector: SSE.cpp updated: 1.1.2.3 -> 1.1.2.4 --- Log message: Fixed a bug in SSE code generation for unpack. --- Diffs of the changes: (+49 -25) SSE.cpp | 74 ++-- 1 files changed, 49 insertions(+), 25 deletions(-) Index: llvm/lib/Transforms/Vector/SSE.cpp diff -u llvm/lib/Transforms/Vector/SSE.cpp:1.1.2.3 llvm/lib/Transforms/Vector/SSE.cpp:1.1.2.4 --- llvm/lib/Transforms/Vector/SSE.cpp:1.1.2.3 Wed Nov 16 12:32:56 2005 +++ llvm/lib/Transforms/Vector/SSE.cpp Wed Jan 4 14:28:05 2006 @@ -147,6 +147,31 @@ return false; } + static const Type *getSignedType(const Type *Ty) { +if (Ty->isSigned()) + return Ty; +switch(Ty->getTypeID()) { +case Type::UIntTyID: + return Type::IntTy; +default: + std::cerr << "Can't handle type " << Ty->getDescription() << "\n"; + exit(1); +} + } + + static const Type *promoteType(const Type *Ty) { +if (const FixedVectorType *VT = dyn_cast(Ty)) + return FixedVectorType::get(promoteType(VT->getElementType()), + VT->getNumElements()); +switch(Ty->getTypeID()) { +case Type::ShortTyID: + return Type::IntTy; +default: + std::cerr << "Can't promote type " << Ty->getDescription() << "\n"; + exit(1); +} + } + //===--===// // SSE implementation @@ -274,12 +299,19 @@ ExtractInst *extract0 = dyn_cast(*I++); ExtractInst *extract1 = dyn_cast(*I); assert(extract0 && extract1); - CallInst *unpackhi = VectorUtils::getCallInst(VT2, getSSEName("unpackhi", VT2), - combine1->getOperand(1), combine2->getOperand(1), - "unpackhi", extract0); - CallInst *unpacklo = VectorUtils::getCallInst(VT2, getSSEName("unpacklo", VT2), - combine1->getOperand(1), combine2->getOperand(1), - "unpacklo", extract0); + const FixedVectorType *HalfVT = + FixedVectorType::get(promoteType(VT2->getElementType()), +VT2->getNumElements() / 2); + CallInst *tmp = + VectorUtils::getCallInst(HalfVT, getSSEName("unpackhi", VT2), +combine1->getOperand(1), combine2->getOperand(1), +"unpackhi", extract0); + CastInst *unpackhi = new CastInst(tmp, VT2, "cast", extract0); + tmp = + VectorUtils::getCallInst(HalfVT, getSSEName("unpacklo", VT2), +combine1->getOperand(1), combine2->getOperand(1), +"unpacklo", extract0); + CastInst *unpacklo = new CastInst(tmp, VT2, "cast", extract0); if (cast(extract0->getOperand(1))->getValue() == 1) { extract0->replaceAllUsesWith(unpackhi); extract1->replaceAllUsesWith(unpacklo); @@ -371,18 +403,6 @@ } } - static const Type *getSignedType(const Type *Ty) { -if (Ty->isSigned()) - return Ty; -switch(Ty->getTypeID()) { -case Type::UIntTyID: - return Type::IntTy; -default: - std::cerr << "Can't handle type " << Ty->getDescription() << "\n"; -} -return 0; - } - void SSE::addComposeConstant(BinaryOperator &Add, Value *arg1, Value *arg2) { CallInst *compose = dyn_cast(arg1);//Add.getOperand(0)); @@ -398,14 +418,18 @@ const FixedVectorType *LongVT = dyn_cast(Add.getType()); const FixedVectorType *ShortVT = dyn_cast(op1->getType()); if (!LongVT || !ShortVT) return; -const FixedVectorType *HalfVT = FixedVectorType::get(getSignedType(LongVT->getElementType()), - LongVT->getNumElements() / 2); -CallInst *splat2 = VectorUtils::getCallInst(HalfVT, getSSEName("splat", HalfVT), - C, "splat", &Add); -CallInst *unpackLo = VectorUtils::getCallInst(HalfVT, getSSEName("unpacklo", ShortVT), +const FixedVectorType *HalfVT = + FixedVectorType::get(getSignedType(LongVT->getElementType()), + LongVT->getNumElements() / 2); +CallInst *splat2 = + VectorUtils::getCallInst(HalfVT, getSSEName("splat", HalfVT), + C, "splat", &Add); +CallInst *unpackLo = + VectorUtils::getCallInst(HalfVT, getSSEName("unpacklo", ShortVT), op1, op2, "unpackLo", &Add); -CallInst *unpackHi = VectorUtils::getCallInst(HalfVT, getSSEName("unpackhi", ShortVT), - op1, op2, "unpackHi", &Add); +CallInst *unpackHi = + VectorUtils::getCallInst(HalfVT, getSSEName("unpackhi", ShortVT), +
[llvm-commits] CVS: llvm/include/llvm/Pass.h
Changes in directory llvm/include/llvm: Pass.h updated: 1.52 -> 1.53 --- Log message: Be consistent in using class vs struct to make VC++ happy. And as it contains methods, virtual method even, class wins. --- Diffs of the changes: (+2 -1) Pass.h |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.52 llvm/include/llvm/Pass.h:1.53 --- llvm/include/llvm/Pass.h:1.52 Wed Jan 4 01:47:12 2006 +++ llvm/include/llvm/Pass.hWed Jan 4 11:21:23 2006 @@ -311,7 +311,8 @@ /// other basic block in the function. /// 3. Optimizations conform to all of the constraints of FunctionPasses. /// -struct BasicBlockPass : public FunctionPass { +class BasicBlockPass : public FunctionPass { +public: /// doInitialization - Virtual method overridden by subclasses to do /// any necessary per-module initialization. /// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/win32/CodeGen/CodeGen.vcproj
Changes in directory llvm/win32/CodeGen: CodeGen.vcproj updated: 1.17 -> 1.18 --- Log message: Teach Visual Studio about new file. --- Diffs of the changes: (+3 -0) CodeGen.vcproj |3 +++ 1 files changed, 3 insertions(+) Index: llvm/win32/CodeGen/CodeGen.vcproj diff -u llvm/win32/CodeGen/CodeGen.vcproj:1.17 llvm/win32/CodeGen/CodeGen.vcproj:1.18 --- llvm/win32/CodeGen/CodeGen.vcproj:1.17 Wed Dec 21 19:50:11 2005 +++ llvm/win32/CodeGen/CodeGen.vcproj Wed Jan 4 11:19:48 2006 @@ -139,6 +139,9 @@ RelativePath="..\..\lib\CodeGen\MachineCodeEmitter.cpp"> + + http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/MachineDebugInfo.cpp
Changes in directory llvm/lib/CodeGen: MachineDebugInfo.cpp updated: 1.1 -> 1.2 --- Log message: Add unique id to debug location for debug label use (work in progress.) --- Diffs of the changes: (+1 -0) MachineDebugInfo.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/MachineDebugInfo.cpp diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.1 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.2 --- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.1 Wed Jan 4 07:36:38 2006 +++ llvm/lib/CodeGen/MachineDebugInfo.cpp Wed Jan 4 09:04:11 2006 @@ -50,6 +50,7 @@ /// doFinalization - Tear down the debug state after completion of a module. /// bool MachineDebugInfo::doFinalization() { + return true; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/TargetSelectionDAG.td
Changes in directory llvm/lib/Target: TargetSelectionDAG.td updated: 1.38 -> 1.39 --- Log message: Add unique id to debug location for debug label use (work in progress.) --- Diffs of the changes: (+2 -2) TargetSelectionDAG.td |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/TargetSelectionDAG.td diff -u llvm/lib/Target/TargetSelectionDAG.td:1.38 llvm/lib/Target/TargetSelectionDAG.td:1.39 --- llvm/lib/Target/TargetSelectionDAG.td:1.38 Sun Jan 1 16:16:43 2006 +++ llvm/lib/Target/TargetSelectionDAG.td Wed Jan 4 09:04:11 2006 @@ -440,8 +440,8 @@ //===--===// // Dwarf support. // -def SDT_dwarf_loc : SDTypeProfile<0, 3, -[SDTCisInt<0>, SDTCisInt<1>, SDTCisInt<2>]>; +def SDT_dwarf_loc : SDTypeProfile<0, 4, + [SDTCisInt<0>, SDTCisInt<1>, SDTCisInt<2>, SDTCisInt<3>]>; def dwarf_loc : SDNode<"ISD::DEBUG_LOC", SDT_dwarf_loc,[SDNPHasChain]>; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstrInfo.td
Changes in directory llvm/lib/Target/PowerPC: PPCInstrInfo.td updated: 1.167 -> 1.168 --- Log message: Add unique id to debug location for debug label use (work in progress.) --- Diffs of the changes: (+4 -3) PPCInstrInfo.td |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.167 llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.168 --- llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.167 Thu Dec 29 18:12:56 2005 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.td Wed Jan 4 09:04:11 2006 @@ -955,10 +955,11 @@ // DWARF Pseudo Instructions // -def DWARF_LOC: Pseudo<(ops i32imm:$line, i32imm:$col, i32imm:$file), - "; .loc $file, $line, $col", +def DWARF_LOC: Pseudo<(ops i32imm:$line, i32imm:$col, i32imm:$file, + i32imm:$id), + "; .loc $file, $line, $col\nLdebug_loc$id:", [(dwarf_loc (i32 imm:$line), (i32 imm:$col), - (i32 imm:$file))]>; + (i32 imm:$file), (i32 imm:$id))]>; //===--===// // PowerPC Instruction Patterns ___ 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/DAGCombiner.cpp LegalizeDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.75 -> 1.76 LegalizeDAG.cpp updated: 1.250 -> 1.251 --- Log message: Add unique id to debug location for debug label use (work in progress.) --- Diffs of the changes: (+23 -15) DAGCombiner.cpp |3 ++- LegalizeDAG.cpp | 35 +-- 2 files changed, 23 insertions(+), 15 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.75 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.76 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.75 Fri Dec 23 14:08:28 2005 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Jan 4 09:04:11 2006 @@ -2117,7 +2117,8 @@ return DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Chain.getOperand(0), N->getOperand(1), N->getOperand(2), - N->getOperand(3)); + N->getOperand(3), + N->getOperand(4)); } return SDOperand(); Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.250 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.251 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.250 Wed Jan 4 07:42:59 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Jan 4 09:04:11 2006 @@ -628,8 +628,10 @@ cast(Node->getOperand(3))->getValue(); const std::string &dirname = cast(Node->getOperand(4))->getValue(); -unsigned id = DebugInfo.RecordSource(fname, dirname); -Ops.push_back(DAG.getConstant(id, MVT::i32)); // source file id +unsigned srcfile = DebugInfo.RecordSource(fname, dirname); +Ops.push_back(DAG.getConstant(srcfile, MVT::i32)); // source file id +unsigned id = DebugInfo.NextUniqueID(); +Ops.push_back(DAG.getConstant(id, MVT::i32)); // label id Result = DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Ops); } else { Result = Tmp1; // chain @@ -659,22 +661,27 @@ break; case ISD::DEBUG_LOC: -assert(Node->getNumOperands() == 4 && "Invalid DEBUG_LOC node!"); +assert(Node->getNumOperands() == 5 && "Invalid DEBUG_LOC node!"); switch (TLI.getOperationAction(ISD::DEBUG_LOC, MVT::Other)) { case TargetLowering::Promote: case TargetLowering::Expand: default: assert(0 && "This action is not supported yet!"); -case TargetLowering::Legal: - Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. - Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the line #. - Tmp3 = LegalizeOp(Node->getOperand(2)); // Legalize the col #. - Tmp4 = LegalizeOp(Node->getOperand(3)); // Legalize the source file id. - - if (Tmp1 != Node->getOperand(0) || - Tmp2 != Node->getOperand(1) || - Tmp3 != Node->getOperand(2) || - Tmp4 != Node->getOperand(3)) { -Result = DAG.getNode(ISD::DEBUG_LOC,MVT::Other, Tmp1, Tmp2, Tmp3, Tmp4); +case TargetLowering::Legal: { +SDOperand Tmp5; +Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. +Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the line #. +Tmp3 = LegalizeOp(Node->getOperand(2)); // Legalize the col #. +Tmp4 = LegalizeOp(Node->getOperand(3)); // Legalize the source file id. +Tmp5 = LegalizeOp(Node->getOperand(4)); // Legalize the label id. + +if (Tmp1 != Node->getOperand(0) || +Tmp2 != Node->getOperand(1) || +Tmp3 != Node->getOperand(2) || +Tmp4 != Node->getOperand(3) || +Tmp5 != Node->getOperand(4)) { + Result = + DAG.getNode(ISD::DEBUG_LOC,MVT::Other, Tmp1, Tmp2, Tmp3, Tmp4, Tmp5); +} } break; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
Changes in directory llvm/include/llvm/CodeGen: SelectionDAGNodes.h updated: 1.85 -> 1.86 --- Log message: Add unique id to debug location for debug label use (work in progress.) --- Diffs of the changes: (+3 -2) SelectionDAGNodes.h |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.85 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.86 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.85 Thu Dec 22 18:46:10 2005 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Wed Jan 4 09:04:11 2006 @@ -356,8 +356,9 @@ // DEBUG_LOC - This node is used to represent source line information // embedded in the code. It takes token chain as input, then a line number, -// then a column then a file id (provided by MachineDebugInfo. It produces -// a token chain as output. +// then a column then a file id (provided by MachineDebugInfo), then a +// unique id (provided by MachineDebugInfo for label gen). It produces a +// token chain as output. DEBUG_LOC, // BUILTIN_OP_END - This must be the last enum value in this list. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineDebugInfo.h
Changes in directory llvm/include/llvm/CodeGen: MachineDebugInfo.h updated: 1.2 -> 1.3 --- Log message: Add flag for debug presence. --- Diffs of the changes: (+5 -0) MachineDebugInfo.h |5 + 1 files changed, 5 insertions(+) Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.2 llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.3 --- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.2Wed Jan 4 07:46:37 2006 +++ llvm/include/llvm/CodeGen/MachineDebugInfo.hWed Jan 4 08:29:26 2006 @@ -47,6 +47,11 @@ {} ~MachineDebugInfo() { } + /// hasInfo - Returns true if debug info is present. + /// + // FIXME - need scheme to suppress debug output. + bool hasInfo() { return true; } + /// NextUniqueID - Returns a unique number for labels used by debugger. /// unsigned NextUniqueID() { return UniqueID++; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp
Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.3 -> 1.4 --- Log message: Add check for debug presence. --- Diffs of the changes: (+4 -0) DwarfWriter.cpp |4 1 files changed, 4 insertions(+) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.3 llvm/lib/CodeGen/DwarfWriter.cpp:1.4 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.3Wed Jan 4 07:52:30 2006 +++ llvm/lib/CodeGen/DwarfWriter.cppWed Jan 4 08:30:12 2006 @@ -70,6 +70,7 @@ /// BeginModule - Emit all dwarf sections that should come prior to the content. /// void DwarfWriter::BeginModule() { + if (!DebugInfo.hasInfo()) return; EmitComment("Dwarf Begin Module"); // define base addresses for dwarf sections @@ -84,6 +85,7 @@ /// EndModule - Emit all dwarf sections that should come after the content. /// void DwarfWriter::EndModule() { + if (!DebugInfo.hasInfo()) return; EmitComment("Dwarf End Module"); // Print out dwarf file info std::vector Sources = DebugInfo.getSourceFiles(); @@ -96,12 +98,14 @@ /// BeginFunction - Emit pre-function debug information. /// void DwarfWriter::BeginFunction() { + if (!DebugInfo.hasInfo()) return; EmitComment("Dwarf Begin Function"); } /// EndFunction - Emit post-function debug information. /// void DwarfWriter::EndFunction() { + if (!DebugInfo.hasInfo()) return; EmitComment("Dwarf End Function"); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp PPCTargetMachine.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.133 -> 1.134 PPCTargetMachine.cpp updated: 1.77 -> 1.78 --- Log message: Tie dwarf generation to darwin assembler. --- Diffs of the changes: (+35 -9) PPCAsmPrinter.cpp| 42 ++ PPCTargetMachine.cpp |2 +- 2 files changed, 35 insertions(+), 9 deletions(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.133 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.134 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.133 Fri Dec 23 19:00:15 2005 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Wed Jan 4 07:52:30 2006 @@ -25,6 +25,7 @@ #include "llvm/Module.h" #include "llvm/Assembly/Writer.h" #include "llvm/CodeGen/AsmPrinter.h" +#include "llvm/CodeGen/DwarfWriter.h" #include "llvm/CodeGen/MachineDebugInfo.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" @@ -205,13 +206,33 @@ virtual bool doFinalization(Module &M) = 0; }; + /// DarwinDwarfWriter - Dwarf debug info writer customized for Darwin/Mac OS X + /// + struct DarwinDwarfWriter : public DwarfWriter { +// Ctor. +DarwinDwarfWriter(std::ostream &o, AsmPrinter *ap, MachineDebugInfo &di) +: DwarfWriter(o, ap, di) +{ + hasLEB128 = false; + needsSet = true; + DwarfAbbrevSection = ".section __DWARFA,__debug_abbrev,regular,debug"; + DwarfInfoSection = ".section __DWARFA,__debug_info,regular,debug"; + DwarfLineSection = ".section __DWARFA,__debug_line,regular,debug"; +} + }; + /// DarwinAsmPrinter - PowerPC assembly printer, customized for Darwin/Mac OS /// X /// struct DarwinAsmPrinter : public PPCAsmPrinter { + +DarwinDwarfWriter DW; DarwinAsmPrinter(std::ostream &O, TargetMachine &TM) - : PPCAsmPrinter(O, TM) { + : PPCAsmPrinter(O, TM), +// FIXME - MachineDebugInfo needs a proper location +DW(O, this, getMachineDebugInfo()) + { CommentString = ";"; GlobalPrefix = "_"; PrivateGlobalPrefix = "L"; // Marker for constant pool idxs @@ -397,12 +418,8 @@ SetupMachineFunction(MF); O << "\n\n"; - // Print out dwarf file info - MachineDebugInfo &DebugInfo = MF.getDebugInfo(); - std::vector Sources = DebugInfo.getSourceFiles(); - for (unsigned i = 0, N = Sources.size(); i < N; i++) { -O << "\t; .file\t" << (i + 1) << "," << "\"" << Sources[i] << "\"" << "\n"; - } + // Emit pre-function debug information. + DW.BeginFunction(); // Print out constants referenced by the function EmitConstantPool(MF.getConstantPool()); @@ -449,6 +466,9 @@ } } + // Emit post-function debug information. + DW.EndFunction(); + // We didn't modify anything. return false; } @@ -461,6 +481,9 @@ // Darwin wants symbols to be quoted if they have complex names. Mang->setUseQuotes(true); + + // Emit initial debug information. + DW.BeginModule(); return false; } @@ -583,6 +606,9 @@ // code that does this, it is always safe to set. O << "\t.subsections_via_symbols\n"; + // Emit initial debug information. + DW.EndModule(); + AsmPrinter::doFinalization(M); return false; // success } @@ -592,7 +618,7 @@ /// bool AIXAsmPrinter::runOnMachineFunction(MachineFunction &MF) { SetupMachineFunction(MF); - + // Print out constants referenced by the function EmitConstantPool(MF.getConstantPool()); Index: llvm/lib/Target/PowerPC/PPCTargetMachine.cpp diff -u llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.77 llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.78 --- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.77 Mon Nov 7 20:12:47 2005 +++ llvm/lib/Target/PowerPC/PPCTargetMachine.cppWed Jan 4 07:52:30 2006 @@ -80,7 +80,7 @@ CodeGenFileType FileType, bool Fast) { if (FileType != TargetMachine::AssemblyFile) return true; - + // Run loop strength reduction before anything else. if (!Fast) PM.add(createLoopStrengthReducePass()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp DwarfWriter.cpp
Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.34 -> 1.35 DwarfWriter.cpp updated: 1.2 -> 1.3 --- Log message: Tie dwarf generation to darwin assembler. --- Diffs of the changes: (+96 -0) AsmPrinter.cpp |1 DwarfWriter.cpp | 95 2 files changed, 96 insertions(+) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.34 llvm/lib/CodeGen/AsmPrinter.cpp:1.35 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.34Wed Dec 28 00:29:02 2005 +++ llvm/lib/CodeGen/AsmPrinter.cpp Wed Jan 4 07:52:30 2006 @@ -16,6 +16,7 @@ #include "llvm/Constants.h" #include "llvm/Module.h" #include "llvm/CodeGen/MachineConstantPool.h" +#include "llvm/CodeGen/MachineDebugInfo.h" #include "llvm/Support/Mangler.h" #include "llvm/Support/MathExtras.h" #include "llvm/Target/TargetMachine.h" Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.2 llvm/lib/CodeGen/DwarfWriter.cpp:1.3 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.2Wed Dec 21 19:41:00 2005 +++ llvm/lib/CodeGen/DwarfWriter.cppWed Jan 4 07:52:30 2006 @@ -12,4 +12,99 @@ //===--===// +#include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/DwarfWriter.h" +#include "llvm/Support/CommandLine.h" + + +namespace llvm { + +static cl::opt +DwarfVerbose("dwarf-verbose", cl::Hidden, +cl::desc("Add comments to dwarf directives.")); + +/// EmitULEB128Bytes - Emit an assembler byte data directive to compose an +/// unsigned leb128 value. +/// +void DwarfWriter::EmitULEB128Bytes(unsigned Value, std::string Comment) { + if (hasLEB128) { +O << "\t.uleb128\t" + << Value; + } else { +O << Asm->getData8bitsDirective(); +EmitULEB128(Value); + } + if (DwarfVerbose) { +O << "\t" + << Asm->getCommentString() + << " " + << Comment + << " " + << Value; + } + O << "\n"; +} + +/// EmitSLEB128Bytes - Emit an assembler byte data directive to compose a +/// signed leb128 value. +/// +void DwarfWriter::EmitSLEB128Bytes(int Value, std::string Comment) { + if (hasLEB128) { +O << "\t.sleb128\t" + << Value; + } else { +O << Asm->getData8bitsDirective(); +EmitSLEB128(Value); + } + if (DwarfVerbose) { +O << "\t" + << Asm->getCommentString() + << " " + << Comment + << " " + << Value; + } + O << "\n"; +} + +/// BeginModule - Emit all dwarf sections that should come prior to the content. +/// +void DwarfWriter::BeginModule() { + EmitComment("Dwarf Begin Module"); + + // define base addresses for dwarf sections + Asm->SwitchSection(DwarfAbbrevSection, 0); + EmitLabel("abbrev", 0); + Asm->SwitchSection(DwarfInfoSection, 0); + EmitLabel("info", 0); + Asm->SwitchSection(DwarfLineSection, 0); + EmitLabel("line", 0); +} + +/// EndModule - Emit all dwarf sections that should come after the content. +/// +void DwarfWriter::EndModule() { + EmitComment("Dwarf End Module"); + // Print out dwarf file info + std::vector Sources = DebugInfo.getSourceFiles(); + for (unsigned i = 0, N = Sources.size(); i < N; i++) { +O << "\t; .file\t" << (i + 1) << "," << "\"" << Sources[i] << "\"" << "\n"; + } +} + + +/// BeginFunction - Emit pre-function debug information. +/// +void DwarfWriter::BeginFunction() { + EmitComment("Dwarf Begin Function"); +} + +/// EndFunction - Emit post-function debug information. +/// +void DwarfWriter::EndFunction() { + EmitComment("Dwarf End Function"); +} + + +} // End llvm namespace + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/AsmPrinter.h DwarfWriter.h
Changes in directory llvm/include/llvm/CodeGen: AsmPrinter.h updated: 1.23 -> 1.24 DwarfWriter.h updated: 1.3 -> 1.4 --- Log message: Tie dwarf generation to darwin assembler. --- Diffs of the changes: (+180 -3) AsmPrinter.h | 41 DwarfWriter.h | 142 +- 2 files changed, 180 insertions(+), 3 deletions(-) Index: llvm/include/llvm/CodeGen/AsmPrinter.h diff -u llvm/include/llvm/CodeGen/AsmPrinter.h:1.23 llvm/include/llvm/CodeGen/AsmPrinter.h:1.24 --- llvm/include/llvm/CodeGen/AsmPrinter.h:1.23 Tue Dec 13 00:31:41 2005 +++ llvm/include/llvm/CodeGen/AsmPrinter.h Wed Jan 4 07:52:30 2006 @@ -35,7 +35,7 @@ /// IncrementFunctionNumber(). /// unsigned FunctionNumber; - + protected: /// Output stream on which we're printing assembly code. /// @@ -165,6 +165,7 @@ AsmPrinter(std::ostream &o, TargetMachine &TM); + public: /// SwitchSection - Switch to the specified section of the executable if we /// are not already in it! If GV is non-null and if the global has an /// explicitly requested section, we switch to the section indicated for the @@ -175,6 +176,7 @@ /// void SwitchSection(const char *NewSection, const GlobalValue *GV); + protected: /// getFunctionNumber - Return a unique ID for the current function. /// unsigned getFunctionNumber() const { return FunctionNumber; } @@ -229,6 +231,43 @@ private: void EmitXXStructorList(Constant *List); + + public: +/// getCommentString - get the comment string. +/// +const char *getCommentString() { + return CommentString; +} + +/// getData8bitsDirective - get the 8-bit data directive string. +/// +const char *getData8bitsDirective() { + return Data8bitsDirective; +} + +/// getData16bitsDirective - get the 16-bit data directive string. +/// +const char *getData16bitsDirective() { + return Data16bitsDirective; +} + +/// getData32bitsDirective - get the 32-bit data directive string. +/// +const char *getData32bitsDirective() { + return Data32bitsDirective; +} + +/// getData64bitsDirective - get the 64-bit data directive string. +/// +const char *getData64bitsDirective() { + return Data64bitsDirective; +} + +/// getPrivateGlobalPrefix - get private label prefix. +/// +const char *getPrivateGlobalPrefix() { + return PrivateGlobalPrefix; +} }; } Index: llvm/include/llvm/CodeGen/DwarfWriter.h diff -u llvm/include/llvm/CodeGen/DwarfWriter.h:1.3 llvm/include/llvm/CodeGen/DwarfWriter.h:1.4 --- llvm/include/llvm/CodeGen/DwarfWriter.h:1.3 Wed Dec 21 19:40:06 2005 +++ llvm/include/llvm/CodeGen/DwarfWriter.h Wed Jan 4 07:52:30 2006 @@ -14,11 +14,14 @@ #ifndef LLVM_CODEGEN_DWARFPRINTER_H #define LLVM_CODEGEN_DWARFPRINTER_H +#include +#include "llvm/CodeGen/MachineDebugInfo.h" + namespace llvm { - //===--===// + //======// // Dwarf constants as gleaned from the DWARF Debugging Information Format V.3 - // reference manual http://dwarf.freestandards.org. + // reference manual http://dwarf.freestandards.org . // enum dwarf_constants { // Tags @@ -422,6 +425,141 @@ DW_CFA_lo_user = 0x1c, DW_CFA_hi_user = 0x3f }; + + // Forward declarations. + // + class AsmPrinter; + + //======// + // DwarfWriter - emits dwarf debug and exception handling directives. + // + class DwarfWriter { + + protected: + +/// O - Stream to .s file. +/// +std::ostream &O; + +/// Asm - Target of dwarf emission. +/// +AsmPrinter *Asm; + +/// DebugInfo - Collected debug information. +/// +MachineDebugInfo &DebugInfo; + +/// hasLEB128 - True if target asm supports leb128 directives. +/// +bool hasLEB128; /// Defaults to false. + +/// needsSet - True if target asm can't compute addresses on data +/// directives. +bool needsSet; /// Defaults to false. + +/// DwarfAbbrevSection - section directive arg for dwarf abbrev. +/// +const char *DwarfAbbrevSection; /// Defaults to ".debug_abbrev". + +/// DwarfInfoSection - section directive arg for dwarf info. +/// +const char *DwarfInfoSection; /// Defaults to ".debug_info". + +/// DwarfLineSection - section directive arg for dwarf info. +/// +const char *DwarfLineSection; /// Defaults to ".debug_line". + + public: + +// Ctor. +DwarfWriter(std::ostream &o, AsmPrinter *ap, MachineDebugInfo &di) +: O(o) +, Asm(ap) +, DebugInfo(di) +, hasLEB128(false) +, needsSet(false) +, DwarfAbbrevSection(".debug_abbrev") +, DwarfInfoSection
[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineDebugInfo.h
Changes in directory llvm/include/llvm/CodeGen: MachineDebugInfo.h updated: 1.1 -> 1.2 --- Log message: 1. Make MachineDebugInfo a pass. 2. Add label uniquing code. --- Diffs of the changes: (+21 -31) MachineDebugInfo.h | 52 +--- 1 files changed, 21 insertions(+), 31 deletions(-) Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.1 llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.2 --- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.1Fri Dec 16 16:45:28 2005 +++ llvm/include/llvm/CodeGen/MachineDebugInfo.hWed Jan 4 07:46:37 2006 @@ -15,6 +15,7 @@ #ifndef LLVM_CODEGEN_MACHINEDEBUGINFO_H #define LLVM_CODEGEN_MACHINEDEBUGINFO_H +#include "llvm/Pass.h" #include #include #include @@ -25,7 +26,7 @@ /// module. Queries can be made by different debugging schemes and reformated /// for specific use. /// -class MachineDebugInfo { +class MachineDebugInfo : public ImmutablePass { private: // convenience types typedef std::map StrIntMap; @@ -34,46 +35,35 @@ StrIntMap SourceMap; // Map of source file path to id unsigned SourceCount; // Number of source files (used to // generate id) + unsigned UniqueID;// Number used to unique labels used +// by debugger. public: // Ctor. - MachineDebugInfo() : SourceMap(), SourceCount(0) {} + MachineDebugInfo() + : SourceMap() + , SourceCount(0) + , UniqueID(1) + {} + ~MachineDebugInfo() { } - /// RecordSource - Register a source file with debug info. Returns an id. + /// NextUniqueID - Returns a unique number for labels used by debugger. /// - unsigned RecordSource(std::string fname, std::string dirname) { -// Compose a key -std::string path = dirname + "/" + fname; -// Check if the source file is already recorded -StrIntMapIter SMI = SourceMap.find(path); -// If already there return existing id -if (SMI != SourceMap.end()) return SMI->second; -// Bump up the count -++SourceCount; -// Record the count -SourceMap[path] = SourceCount; -// Return id -return SourceCount; - } - - /// getSourceFiles - Return a vector of files. Vector index + 1 equals id. - /// - std::vector getSourceFiles() { -std::vector Sources(SourceCount); - -for (StrIntMapIter SMI = SourceMap.begin(), E = SourceMap.end(); SMI != E; - SMI++) { - unsigned Index = SMI->second - 1; - std::string Path = SMI->first; - Sources[Index] = Path; -} -return Sources; - } + unsigned NextUniqueID() { return UniqueID++; } + + bool doInitialization(); + bool doFinalization(); + unsigned RecordSource(std::string fname, std::string dirname); + std::vector getSourceFiles(); }; // End class MachineDebugInfo //===--===// +// FIXME - temporary hack until we can find a place to hang debug info from. +MachineDebugInfo &getMachineDebugInfo(); +// FIXME - temporary hack until we can find a place to hand debug info from. +ModulePass *createDebugInfoPass(); } // End llvm namespace ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineFunction.h
Changes in directory llvm/include/llvm/CodeGen: MachineFunction.h updated: 1.56 -> 1.57 --- Log message: Move MachineDebugInfo to module level location. --- Diffs of the changes: (+0 -9) MachineFunction.h |9 - 1 files changed, 9 deletions(-) Index: llvm/include/llvm/CodeGen/MachineFunction.h diff -u llvm/include/llvm/CodeGen/MachineFunction.h:1.56 llvm/include/llvm/CodeGen/MachineFunction.h:1.57 --- llvm/include/llvm/CodeGen/MachineFunction.h:1.56Fri Dec 16 16:45:28 2005 +++ llvm/include/llvm/CodeGen/MachineFunction.h Wed Jan 4 07:44:43 2006 @@ -114,10 +114,6 @@ std::vector > LiveIns; std::vector LiveOuts; - /// DebugInfo - Keep track of debug information for the function. - /// - MachineDebugInfo DebugInfo; - public: MachineFunction(const Function *Fn, const TargetMachine &TM); ~MachineFunction(); @@ -218,11 +214,6 @@ return MBBNumbering.back(); } - /// getDebugInfo - Returns the DebugInfo. - MachineDebugInfo &getDebugInfo() { -return DebugInfo; - } - /// print - Print out the MachineFunction in a format suitable for debugging /// to the specified stream. /// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/MachineFunction.cpp
Changes in directory llvm/lib/CodeGen: MachineFunction.cpp updated: 1.82 -> 1.83 --- Log message: Moving MachineDebugInfo to module level location. --- Diffs of the changes: (+1 -1) MachineFunction.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/MachineFunction.cpp diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.82 llvm/lib/CodeGen/MachineFunction.cpp:1.83 --- llvm/lib/CodeGen/MachineFunction.cpp:1.82 Fri Dec 16 16:45:28 2005 +++ llvm/lib/CodeGen/MachineFunction.cppWed Jan 4 07:43:56 2006 @@ -108,7 +108,7 @@ MachineFunction::MachineFunction(const Function *F, const TargetMachine &TM) - : Annotation(MF_AID), Fn(F), Target(TM), UsedPhysRegs(0), DebugInfo() { + : Annotation(MF_AID), Fn(F), Target(TM), UsedPhysRegs(0) { SSARegMapping = new SSARegMap(); MFInfo = 0; FrameInfo = new MachineFrameInfo(); ___ 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/LegalizeDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.249 -> 1.250 --- Log message: Change how MachineDebugInfo is fetched. --- Diffs of the changes: (+1 -1) LegalizeDAG.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.249 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.250 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.249 Sat Dec 24 19:07:37 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Jan 4 07:42:59 2006 @@ -619,7 +619,7 @@ default: assert(0 && "This action is not supported yet!"); case TargetLowering::Expand: { if (TLI.isOperationLegal(ISD::DEBUG_LOC, MVT::Other)) { -MachineDebugInfo &DebugInfo = DAG.getMachineFunction().getDebugInfo(); +MachineDebugInfo &DebugInfo = getMachineDebugInfo(); std::vector Ops; Ops.push_back(Tmp1); // chain Ops.push_back(Node->getOperand(1)); // line # ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llc/llc.cpp
Changes in directory llvm/tools/llc: llc.cpp updated: 1.123 -> 1.124 --- Log message: Adding MachineDebugInfo as a immutable pass. --- Diffs of the changes: (+4 -0) llc.cpp |4 1 files changed, 4 insertions(+) Index: llvm/tools/llc/llc.cpp diff -u llvm/tools/llc/llc.cpp:1.123 llvm/tools/llc/llc.cpp:1.124 --- llvm/tools/llc/llc.cpp:1.123Thu Dec 29 20:50:44 2005 +++ llvm/tools/llc/llc.cpp Wed Jan 4 07:42:02 2006 @@ -27,6 +27,7 @@ #include "llvm/Support/FileUtilities.h" #include "llvm/Analysis/Verifier.h" #include "llvm/System/Signals.h" +#include "llvm/CodeGen/MachineDebugInfo.h" #include "llvm/Config/config.h" #include #include @@ -237,6 +238,9 @@ sys::RemoveFileOnSignal(sys::Path(OutputFilename)); } } + +// Set up collection of debug information +Passes.add(createDebugInfoPass()); // Ask the target to add backend passes as necessary. if (Target.addPassesToEmitFile(Passes, *Out, FileType, Fast)) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/Xcode/LLVM.xcodeproj/project.pbxproj
Changes in directory llvm/Xcode/LLVM.xcodeproj: project.pbxproj updated: 1.15 -> 1.16 --- Log message: Adding new files. --- Diffs of the changes: (+4 -0) project.pbxproj |4 1 files changed, 4 insertions(+) Index: llvm/Xcode/LLVM.xcodeproj/project.pbxproj diff -u llvm/Xcode/LLVM.xcodeproj/project.pbxproj:1.15 llvm/Xcode/LLVM.xcodeproj/project.pbxproj:1.16 --- llvm/Xcode/LLVM.xcodeproj/project.pbxproj:1.15 Wed Dec 21 14:47:34 2005 +++ llvm/Xcode/LLVM.xcodeproj/project.pbxproj Wed Jan 4 07:37:32 2006 @@ -113,6 +113,8 @@ CF490D890906A78C0072DB1C /* PPC.td */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PPC.td; sourceTree = ""; }; CF490E2F0907BBF80072DB1C /* SubtargetEmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubtargetEmitter.h; sourceTree = ""; }; CF490E300907BBF80072DB1C /* SubtargetEmitter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubtargetEmitter.cpp; sourceTree = ""; }; + CF6529A6095B21A8007F884E /* MachineDebugInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MachineDebugInfo.cpp; sourceTree = ""; }; + CF6B5AFD095C82C300D1EA42 /* DAGCombiner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DAGCombiner.cpp; sourceTree = ""; }; CF6F487109505E1500BC9E82 /* MachineDebugInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachineDebugInfo.h; sourceTree = ""; }; CF9BCD0808C74DE0001E7011 /* SubtargetFeature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubtargetFeature.h; sourceTree = ""; }; CF9BCD1508C75070001E7011 /* SubtargetFeature.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubtargetFeature.cpp; sourceTree = ""; }; @@ -1136,6 +1138,7 @@ DE66ED7508ABEC2B00323D32 /* LiveVariables.cpp */, DE66ED7608ABEC2B00323D32 /* MachineBasicBlock.cpp */, DE66ED7708ABEC2B00323D32 /* MachineCodeEmitter.cpp */, + CF6529A6095B21A8007F884E /* MachineDebugInfo.cpp */, DE66ED7808ABEC2B00323D32 /* MachineFunction.cpp */, DE66ED7908ABEC2B00323D32 /* MachineInstr.cpp */, DE66ED7B08ABEC2B00323D32 /* Passes.cpp */, @@ -1158,6 +1161,7 @@ DE66ED8308ABEC2B00323D32 /* SelectionDAG */ = { isa = PBXGroup; children = ( + CF6B5AFD095C82C300D1EA42 /* DAGCombiner.cpp */, DE66ED9008ABEC2B00323D32 /* LegalizeDAG.cpp */, DE694D9F08B51E0C0039C106 /* ScheduleDAG.cpp */, DE66ED9208ABEC2B00323D32 /* SelectionDAG.cpp */, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/MachineDebugInfo.cpp
Changes in directory llvm/lib/CodeGen: MachineDebugInfo.cpp added (r1.1) --- Log message: Extending MachineDebugInfo. --- Diffs of the changes: (+90 -0) MachineDebugInfo.cpp | 90 +++ 1 files changed, 90 insertions(+) Index: llvm/lib/CodeGen/MachineDebugInfo.cpp diff -c /dev/null llvm/lib/CodeGen/MachineDebugInfo.cpp:1.1 *** /dev/null Wed Jan 4 07:36:49 2006 --- llvm/lib/CodeGen/MachineDebugInfo.cpp Wed Jan 4 07:36:38 2006 *** *** 0 --- 1,90 + //===-- llvm/CodeGen/MachineDebugInfo.cpp ---*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by James M. Laskey and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===--===// + // + // Collect debug information for a module. This information should be in a + // neutral form that can be used by different debugging schemes. + // + //===--===// + + #include "llvm/CodeGen/MachineDebugInfo.h" + + using namespace llvm; + + // Handle the Pass registration stuff necessary to use TargetData's. + namespace { + RegisterPass X("machinedebuginfo", "Debug Information", + PassInfo::Analysis | PassInfo::Optimization); + } + + namespace llvm { + + /// DebugInfo - Keep track of debug information for the function. + /// + // FIXME - making it global until we can find a proper place to hang it from. + MachineDebugInfo *DebugInfo; + + // FIXME - temporary hack until we can find a place to hand debug info from. + ModulePass *createDebugInfoPass() { + if (!DebugInfo) DebugInfo = new MachineDebugInfo(); + return (ModulePass *)DebugInfo; + } + + /// getDebugInfo - Returns the DebugInfo. + MachineDebugInfo &getMachineDebugInfo() { + assert(DebugInfo && "DebugInfo pass not created"); + return *DebugInfo; + } + + /// doInitialization - Initialize the debug state for a new module. + /// + bool MachineDebugInfo::doInitialization() { + return true; + } + + /// doFinalization - Tear down the debug state after completion of a module. + /// + bool MachineDebugInfo::doFinalization() { + return true; + } + + /// RecordSource - Register a source file with debug info. Returns an id. + /// + unsigned MachineDebugInfo::RecordSource(std::string fname, + std::string dirname) { + // Compose a key + std::string path = dirname + "/" + fname; + // Check if the source file is already recorded + StrIntMapIter SMI = SourceMap.find(path); + // If already there return existing id + if (SMI != SourceMap.end()) return SMI->second; + // Bump up the count + ++SourceCount; + // Record the count + SourceMap[path] = SourceCount; + // Return id + return SourceCount; + } + + /// getSourceFiles - Return a vector of files. Vector index + 1 equals id. + /// + std::vector MachineDebugInfo::getSourceFiles() { + std::vector Sources(SourceCount); + + for (StrIntMapIter SMI = SourceMap.begin(), E = SourceMap.end(); SMI != E; +SMI++) { + unsigned Index = SMI->second - 1; + std::string Path = SMI->first; + Sources[Index] = Path; + } + return Sources; + } + + + }; + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits