diff options
Diffstat (limited to 'lib/CodeGen/SelectionDAG')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 8 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | 14 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 16 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 22 |
4 files changed, 41 insertions, 19 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 1dbcf8529d..9a4bec2acc 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -1060,7 +1060,8 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { unsigned Col = cast<ConstantSDNode>(ColOp)->getValue(); unsigned ID = MMI->RecordLabel(Line, Col, SrcFile); Ops.push_back(DAG.getConstant(ID, MVT::i32)); - Result = DAG.getNode(ISD::LABEL, MVT::Other,&Ops[0],Ops.size()); + Ops.push_back(DAG.getConstant(0, MVT::i32)); // a debug label + Result = DAG.getNode(ISD::LABEL, MVT::Other, &Ops[0], Ops.size()); } } else { Result = Tmp1; // chain @@ -1103,13 +1104,14 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { break; case ISD::LABEL: - assert(Node->getNumOperands() == 2 && "Invalid LABEL node!"); + assert(Node->getNumOperands() == 3 && "Invalid LABEL node!"); switch (TLI.getOperationAction(ISD::LABEL, MVT::Other)) { 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 label id. - Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2); + Tmp3 = LegalizeOp(Node->getOperand(2)); // Legalize the "flavor" operand. + Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2, Tmp3); break; case TargetLowering::Expand: Result = LegalizeOp(Node->getOperand(0)); diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp index c9fc812259..ac35b40d92 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp @@ -733,18 +733,16 @@ void ScheduleDAG::EmitNode(SDNode *Node, unsigned InstanceNo, } // Now that we have emitted all operands, emit this instruction itself. - if (Opc == TargetInstrInfo::LABEL && + if (ISD::isDebugLabel(Node) && !BB->empty() && &MF->front() == BB) { - // If we are inserting a LABEL and this happens to be the first label in - // the entry block, it is the "function start" label. Make sure there are - // no other instructions before it. + // If we are inserting a debug label and this happens to be the first + // debug label in the entry block, it is the "function start" label. + // Make sure there are no other instructions before it. unsigned NumLabels = 0; MachineBasicBlock::iterator MBBI = BB->begin(); while (MBBI != BB->end()) { - if (MBBI->getOpcode() == TargetInstrInfo::LABEL) { - if (++NumLabels > 1) - break; - } + if (!MBBI->isDebugLabel() || ++NumLabels > 1) + break; ++MBBI; } if (NumLabels <= 1) diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 118f980c10..28d7006ac9 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -173,6 +173,22 @@ bool ISD::isBuildVectorAllZeros(const SDNode *N) { return true; } +/// isDebugLabel - Return true if the specified node represents a debug +/// label (i.e. ISD::LABEL or TargetInstrInfo::LANEL node and third operand +/// is 0). +bool ISD::isDebugLabel(const SDNode *N) { + SDOperand Zero; + if (N->getOpcode() == ISD::LABEL) + Zero = N->getOperand(2); + else if (N->isTargetOpcode() && + N->getTargetOpcode() == TargetInstrInfo::LABEL) + // Chain moved to last operand. + Zero = N->getOperand(1); + else + return false; + return isa<ConstantSDNode>(Zero) && cast<ConstantSDNode>(Zero)->isNullValue(); +} + /// getSetCCSwappedOperands - Return the operation corresponding to (Y op X) /// when given the operation for (X op Y). ISD::CondCode ISD::getSetCCSwappedOperands(ISD::CondCode Operation) { diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 04c4e0153e..4d1e7ebefb 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -2621,7 +2621,8 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { if (MMI && RSI.getContext() && MMI->Verify(RSI.getContext())) { unsigned LabelID = MMI->RecordRegionStart(RSI.getContext()); DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(), - DAG.getConstant(LabelID, MVT::i32))); + DAG.getConstant(LabelID, MVT::i32), + DAG.getConstant(0, MVT::i32))); } return 0; @@ -2631,8 +2632,9 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { DbgRegionEndInst &REI = cast<DbgRegionEndInst>(I); if (MMI && REI.getContext() && MMI->Verify(REI.getContext())) { unsigned LabelID = MMI->RecordRegionEnd(REI.getContext()); - DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, - getRoot(), DAG.getConstant(LabelID, MVT::i32))); + DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(), + DAG.getConstant(LabelID, MVT::i32), + DAG.getConstant(0, MVT::i32))); } return 0; @@ -2643,8 +2645,9 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { if (MMI && FSI.getSubprogram() && MMI->Verify(FSI.getSubprogram())) { unsigned LabelID = MMI->RecordRegionStart(FSI.getSubprogram()); - DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, - getRoot(), DAG.getConstant(LabelID, MVT::i32))); + DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(), + DAG.getConstant(LabelID, MVT::i32), + DAG.getConstant(0, MVT::i32))); } return 0; @@ -2972,7 +2975,8 @@ void SelectionDAGLowering::LowerCallTo(CallSite CS, SDOperand Callee, // used to detect deletion of the invoke via the MachineModuleInfo. BeginLabel = MMI->NextLabelID(); DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(), - DAG.getConstant(BeginLabel, MVT::i32))); + DAG.getConstant(BeginLabel, MVT::i32), + DAG.getConstant(1, MVT::i32))); } std::pair<SDOperand,SDOperand> Result = @@ -2989,7 +2993,8 @@ void SelectionDAGLowering::LowerCallTo(CallSite CS, SDOperand Callee, // can be used to detect deletion of the invoke via the MachineModuleInfo. EndLabel = MMI->NextLabelID(); DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(), - DAG.getConstant(EndLabel, MVT::i32))); + DAG.getConstant(EndLabel, MVT::i32), + DAG.getConstant(1, MVT::i32))); // Inform MachineModuleInfo of range. MMI->addInvoke(LandingPad, BeginLabel, EndLabel); @@ -4573,7 +4578,8 @@ void SelectionDAGISel::BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB, // landing pad can thus be detected via the MachineModuleInfo. unsigned LabelID = MMI->addLandingPad(BB); DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, DAG.getEntryNode(), - DAG.getConstant(LabelID, MVT::i32))); + DAG.getConstant(LabelID, MVT::i32), + DAG.getConstant(1, MVT::i32))); // Mark exception register as live in. unsigned Reg = TLI.getExceptionAddressRegister(); |