1 //===--- ScheduleDAGSDNodes.cpp - Implement the ScheduleDAGSDNodes class --===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This implements the ScheduleDAG class, which is a base class used by
11 // scheduling implementation classes.
13 //===----------------------------------------------------------------------===//
15 #define DEBUG_TYPE "pre-RA-sched"
16 #include "SDNodeDbgValue.h"
17 #include "ScheduleDAGSDNodes.h"
18 #include "InstrEmitter.h"
19 #include "llvm/CodeGen/SelectionDAG.h"
20 #include "llvm/Target/TargetMachine.h"
21 #include "llvm/Target/TargetInstrInfo.h"
22 #include "llvm/Target/TargetLowering.h"
23 #include "llvm/Target/TargetRegisterInfo.h"
24 #include "llvm/Target/TargetSubtarget.h"
25 #include "llvm/ADT/DenseMap.h"
26 #include "llvm/ADT/SmallPtrSet.h"
27 #include "llvm/ADT/SmallSet.h"
28 #include "llvm/ADT/SmallVector.h"
29 #include "llvm/ADT/Statistic.h"
30 #include "llvm/Support/Debug.h"
31 #include "llvm/Support/raw_ostream.h"
34 STATISTIC(LoadsClustered, "Number of loads clustered together");
36 ScheduleDAGSDNodes::ScheduleDAGSDNodes(MachineFunction &mf)
38 InstrItins(mf.getTarget().getInstrItineraryData()) {}
40 /// Run - perform scheduling.
42 void ScheduleDAGSDNodes::Run(SelectionDAG *dag, MachineBasicBlock *bb,
43 MachineBasicBlock::iterator insertPos) {
45 ScheduleDAG::Run(bb, insertPos);
48 /// NewSUnit - Creates a new SUnit and return a ptr to it.
50 SUnit *ScheduleDAGSDNodes::NewSUnit(SDNode *N) {
52 const SUnit *Addr = 0;
56 SUnits.push_back(SUnit(N, (unsigned)SUnits.size()));
57 assert((Addr == 0 || Addr == &SUnits[0]) &&
58 "SUnits std::vector reallocated on the fly!");
59 SUnits.back().OrigNode = &SUnits.back();
60 SUnit *SU = &SUnits.back();
61 const TargetLowering &TLI = DAG->getTargetLoweringInfo();
63 (N->isMachineOpcode() &&
64 N->getMachineOpcode() == TargetOpcode::IMPLICIT_DEF))
65 SU->SchedulingPref = Sched::None;
67 SU->SchedulingPref = TLI.getSchedulingPreference(N);
71 SUnit *ScheduleDAGSDNodes::Clone(SUnit *Old) {
72 SUnit *SU = NewSUnit(Old->getNode());
73 SU->OrigNode = Old->OrigNode;
74 SU->Latency = Old->Latency;
75 SU->isCall = Old->isCall;
76 SU->isTwoAddress = Old->isTwoAddress;
77 SU->isCommutable = Old->isCommutable;
78 SU->hasPhysRegDefs = Old->hasPhysRegDefs;
79 SU->hasPhysRegClobbers = Old->hasPhysRegClobbers;
80 SU->SchedulingPref = Old->SchedulingPref;
85 /// CheckForPhysRegDependency - Check if the dependency between def and use of
86 /// a specified operand is a physical register dependency. If so, returns the
87 /// register and the cost of copying the register.
88 static void CheckForPhysRegDependency(SDNode *Def, SDNode *User, unsigned Op,
89 const TargetRegisterInfo *TRI,
90 const TargetInstrInfo *TII,
91 unsigned &PhysReg, int &Cost) {
92 if (Op != 2 || User->getOpcode() != ISD::CopyToReg)
95 unsigned Reg = cast<RegisterSDNode>(User->getOperand(1))->getReg();
96 if (TargetRegisterInfo::isVirtualRegister(Reg))
99 unsigned ResNo = User->getOperand(2).getResNo();
100 if (Def->isMachineOpcode()) {
101 const TargetInstrDesc &II = TII->get(Def->getMachineOpcode());
102 if (ResNo >= II.getNumDefs() &&
103 II.ImplicitDefs[ResNo - II.getNumDefs()] == Reg) {
105 const TargetRegisterClass *RC =
106 TRI->getMinimalPhysRegClass(Reg, Def->getValueType(ResNo));
107 Cost = RC->getCopyCost();
112 static void AddGlue(SDNode *N, SDValue Glue, bool AddGlue, SelectionDAG *DAG) {
113 SmallVector<EVT, 4> VTs;
114 SDNode *GlueDestNode = Glue.getNode();
116 // Don't add glue from a node to itself.
117 if (GlueDestNode == N) return;
119 // Don't add glue to something which already has glue.
120 if (N->getValueType(N->getNumValues() - 1) == MVT::Glue) return;
122 for (unsigned I = 0, E = N->getNumValues(); I != E; ++I)
123 VTs.push_back(N->getValueType(I));
126 VTs.push_back(MVT::Glue);
128 SmallVector<SDValue, 4> Ops;
129 for (unsigned I = 0, E = N->getNumOperands(); I != E; ++I)
130 Ops.push_back(N->getOperand(I));
135 SDVTList VTList = DAG->getVTList(&VTs[0], VTs.size());
136 MachineSDNode::mmo_iterator Begin = 0, End = 0;
137 MachineSDNode *MN = dyn_cast<MachineSDNode>(N);
139 // Store memory references.
141 Begin = MN->memoperands_begin();
142 End = MN->memoperands_end();
145 DAG->MorphNodeTo(N, N->getOpcode(), VTList, &Ops[0], Ops.size());
147 // Reset the memory references
149 MN->setMemRefs(Begin, End);
152 /// ClusterNeighboringLoads - Force nearby loads together by "gluing" them.
153 /// This function finds loads of the same base and different offsets. If the
154 /// offsets are not far apart (target specific), it add MVT::Glue inputs and
155 /// outputs to ensure they are scheduled together and in order. This
156 /// optimization may benefit some targets by improving cache locality.
157 void ScheduleDAGSDNodes::ClusterNeighboringLoads(SDNode *Node) {
159 unsigned NumOps = Node->getNumOperands();
160 if (Node->getOperand(NumOps-1).getValueType() == MVT::Other)
161 Chain = Node->getOperand(NumOps-1).getNode();
165 // Look for other loads of the same chain. Find loads that are loading from
166 // the same base pointer and different offsets.
167 SmallPtrSet<SDNode*, 16> Visited;
168 SmallVector<int64_t, 4> Offsets;
169 DenseMap<long long, SDNode*> O2SMap; // Map from offset to SDNode.
170 bool Cluster = false;
172 for (SDNode::use_iterator I = Chain->use_begin(), E = Chain->use_end();
175 if (User == Node || !Visited.insert(User))
177 int64_t Offset1, Offset2;
178 if (!TII->areLoadsFromSameBasePtr(Base, User, Offset1, Offset2) ||
180 // FIXME: Should be ok if they addresses are identical. But earlier
181 // optimizations really should have eliminated one of the loads.
183 if (O2SMap.insert(std::make_pair(Offset1, Base)).second)
184 Offsets.push_back(Offset1);
185 O2SMap.insert(std::make_pair(Offset2, User));
186 Offsets.push_back(Offset2);
187 if (Offset2 < Offset1)
195 // Sort them in increasing order.
196 std::sort(Offsets.begin(), Offsets.end());
198 // Check if the loads are close enough.
199 SmallVector<SDNode*, 4> Loads;
200 unsigned NumLoads = 0;
201 int64_t BaseOff = Offsets[0];
202 SDNode *BaseLoad = O2SMap[BaseOff];
203 Loads.push_back(BaseLoad);
204 for (unsigned i = 1, e = Offsets.size(); i != e; ++i) {
205 int64_t Offset = Offsets[i];
206 SDNode *Load = O2SMap[Offset];
207 if (!TII->shouldScheduleLoadsNear(BaseLoad, Load, BaseOff, Offset,NumLoads))
208 break; // Stop right here. Ignore loads that are further away.
209 Loads.push_back(Load);
216 // Cluster loads by adding MVT::Glue outputs and inputs. This also
217 // ensure they are scheduled in order of increasing addresses.
218 SDNode *Lead = Loads[0];
219 AddGlue(Lead, SDValue(0, 0), true, DAG);
221 SDValue InGlue = SDValue(Lead, Lead->getNumValues() - 1);
222 for (unsigned I = 1, E = Loads.size(); I != E; ++I) {
223 bool OutGlue = I < E - 1;
224 SDNode *Load = Loads[I];
226 AddGlue(Load, InGlue, OutGlue, DAG);
229 InGlue = SDValue(Load, Load->getNumValues() - 1);
235 /// ClusterNodes - Cluster certain nodes which should be scheduled together.
237 void ScheduleDAGSDNodes::ClusterNodes() {
238 for (SelectionDAG::allnodes_iterator NI = DAG->allnodes_begin(),
239 E = DAG->allnodes_end(); NI != E; ++NI) {
241 if (!Node || !Node->isMachineOpcode())
244 unsigned Opc = Node->getMachineOpcode();
245 const TargetInstrDesc &TID = TII->get(Opc);
247 // Cluster loads from "near" addresses into combined SUnits.
248 ClusterNeighboringLoads(Node);
252 void ScheduleDAGSDNodes::BuildSchedUnits() {
253 // During scheduling, the NodeId field of SDNode is used to map SDNodes
254 // to their associated SUnits by holding SUnits table indices. A value
255 // of -1 means the SDNode does not yet have an associated SUnit.
256 unsigned NumNodes = 0;
257 for (SelectionDAG::allnodes_iterator NI = DAG->allnodes_begin(),
258 E = DAG->allnodes_end(); NI != E; ++NI) {
263 // Reserve entries in the vector for each of the SUnits we are creating. This
264 // ensure that reallocation of the vector won't happen, so SUnit*'s won't get
266 // FIXME: Multiply by 2 because we may clone nodes during scheduling.
267 // This is a temporary workaround.
268 SUnits.reserve(NumNodes * 2);
270 // Add all nodes in depth first order.
271 SmallVector<SDNode*, 64> Worklist;
272 SmallPtrSet<SDNode*, 64> Visited;
273 Worklist.push_back(DAG->getRoot().getNode());
274 Visited.insert(DAG->getRoot().getNode());
276 while (!Worklist.empty()) {
277 SDNode *NI = Worklist.pop_back_val();
279 // Add all operands to the worklist unless they've already been added.
280 for (unsigned i = 0, e = NI->getNumOperands(); i != e; ++i)
281 if (Visited.insert(NI->getOperand(i).getNode()))
282 Worklist.push_back(NI->getOperand(i).getNode());
284 if (isPassiveNode(NI)) // Leaf node, e.g. a TargetImmediate.
287 // If this node has already been processed, stop now.
288 if (NI->getNodeId() != -1) continue;
290 SUnit *NodeSUnit = NewSUnit(NI);
292 // See if anything is glued to this node, if so, add them to glued
293 // nodes. Nodes can have at most one glue input and one glue output. Glue
294 // is required to be the last operand and result of a node.
296 // Scan up to find glued preds.
298 while (N->getNumOperands() &&
299 N->getOperand(N->getNumOperands()-1).getValueType() == MVT::Glue) {
300 N = N->getOperand(N->getNumOperands()-1).getNode();
301 assert(N->getNodeId() == -1 && "Node already inserted!");
302 N->setNodeId(NodeSUnit->NodeNum);
303 if (N->isMachineOpcode() && TII->get(N->getMachineOpcode()).isCall())
304 NodeSUnit->isCall = true;
307 // Scan down to find any glued succs.
309 while (N->getValueType(N->getNumValues()-1) == MVT::Glue) {
310 SDValue GlueVal(N, N->getNumValues()-1);
312 // There are either zero or one users of the Glue result.
313 bool HasGlueUse = false;
314 for (SDNode::use_iterator UI = N->use_begin(), E = N->use_end();
316 if (GlueVal.isOperandOf(*UI)) {
318 assert(N->getNodeId() == -1 && "Node already inserted!");
319 N->setNodeId(NodeSUnit->NodeNum);
321 if (N->isMachineOpcode() && TII->get(N->getMachineOpcode()).isCall())
322 NodeSUnit->isCall = true;
325 if (!HasGlueUse) break;
328 // If there are glue operands involved, N is now the bottom-most node
329 // of the sequence of nodes that are glued together.
331 NodeSUnit->setNode(N);
332 assert(N->getNodeId() == -1 && "Node already inserted!");
333 N->setNodeId(NodeSUnit->NodeNum);
335 // Assign the Latency field of NodeSUnit using target-provided information.
336 ComputeLatency(NodeSUnit);
340 void ScheduleDAGSDNodes::AddSchedEdges() {
341 const TargetSubtarget &ST = TM.getSubtarget<TargetSubtarget>();
343 // Check to see if the scheduler cares about latencies.
344 bool UnitLatencies = ForceUnitLatencies();
346 // Pass 2: add the preds, succs, etc.
347 for (unsigned su = 0, e = SUnits.size(); su != e; ++su) {
348 SUnit *SU = &SUnits[su];
349 SDNode *MainNode = SU->getNode();
351 if (MainNode->isMachineOpcode()) {
352 unsigned Opc = MainNode->getMachineOpcode();
353 const TargetInstrDesc &TID = TII->get(Opc);
354 for (unsigned i = 0; i != TID.getNumOperands(); ++i) {
355 if (TID.getOperandConstraint(i, TOI::TIED_TO) != -1) {
356 SU->isTwoAddress = true;
360 if (TID.isCommutable())
361 SU->isCommutable = true;
364 // Find all predecessors and successors of the group.
365 for (SDNode *N = SU->getNode(); N; N = N->getGluedNode()) {
366 if (N->isMachineOpcode() &&
367 TII->get(N->getMachineOpcode()).getImplicitDefs()) {
368 SU->hasPhysRegClobbers = true;
369 unsigned NumUsed = InstrEmitter::CountResults(N);
370 while (NumUsed != 0 && !N->hasAnyUseOfValue(NumUsed - 1))
371 --NumUsed; // Skip over unused values at the end.
372 if (NumUsed > TII->get(N->getMachineOpcode()).getNumDefs())
373 SU->hasPhysRegDefs = true;
376 for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
377 SDNode *OpN = N->getOperand(i).getNode();
378 if (isPassiveNode(OpN)) continue; // Not scheduled.
379 SUnit *OpSU = &SUnits[OpN->getNodeId()];
380 assert(OpSU && "Node has no SUnit!");
381 if (OpSU == SU) continue; // In the same group.
383 EVT OpVT = N->getOperand(i).getValueType();
384 assert(OpVT != MVT::Glue && "Glued nodes should be in same sunit!");
385 bool isChain = OpVT == MVT::Other;
387 unsigned PhysReg = 0;
389 // Determine if this is a physical register dependency.
390 CheckForPhysRegDependency(OpN, N, i, TRI, TII, PhysReg, Cost);
391 assert((PhysReg == 0 || !isChain) &&
392 "Chain dependence via physreg data?");
393 // FIXME: See ScheduleDAGSDNodes::EmitCopyFromReg. For now, scheduler
394 // emits a copy from the physical register to a virtual register unless
395 // it requires a cross class copy (cost < 0). That means we are only
396 // treating "expensive to copy" register dependency as physical register
397 // dependency. This may change in the future though.
401 // If this is a ctrl dep, latency is 1.
402 unsigned OpLatency = isChain ? 1 : OpSU->Latency;
403 const SDep &dep = SDep(OpSU, isChain ? SDep::Order : SDep::Data,
405 if (!isChain && !UnitLatencies) {
406 ComputeOperandLatency(OpN, N, i, const_cast<SDep &>(dep));
407 ST.adjustSchedDependency(OpSU, SU, const_cast<SDep &>(dep));
416 /// BuildSchedGraph - Build the SUnit graph from the selection dag that we
417 /// are input. This SUnit graph is similar to the SelectionDAG, but
418 /// excludes nodes that aren't interesting to scheduling, and represents
419 /// glued together nodes with a single SUnit.
420 void ScheduleDAGSDNodes::BuildSchedGraph(AliasAnalysis *AA) {
421 // Cluster certain nodes which should be scheduled together.
423 // Populate the SUnits array.
425 // Compute all the scheduling dependencies between nodes.
429 void ScheduleDAGSDNodes::ComputeLatency(SUnit *SU) {
430 // Check to see if the scheduler cares about latencies.
431 if (ForceUnitLatencies()) {
436 if (!InstrItins || InstrItins->isEmpty()) {
441 // Compute the latency for the node. We use the sum of the latencies for
442 // all nodes glued together into this SUnit.
444 for (SDNode *N = SU->getNode(); N; N = N->getGluedNode())
445 if (N->isMachineOpcode())
446 SU->Latency += TII->getInstrLatency(InstrItins, N);
449 void ScheduleDAGSDNodes::ComputeOperandLatency(SDNode *Def, SDNode *Use,
450 unsigned OpIdx, SDep& dep) const{
451 // Check to see if the scheduler cares about latencies.
452 if (ForceUnitLatencies())
455 if (dep.getKind() != SDep::Data)
458 unsigned DefIdx = Use->getOperand(OpIdx).getResNo();
459 if (Use->isMachineOpcode())
460 // Adjust the use operand index by num of defs.
461 OpIdx += TII->get(Use->getMachineOpcode()).getNumDefs();
462 int Latency = TII->getOperandLatency(InstrItins, Def, DefIdx, Use, OpIdx);
463 if (Latency > 1 && Use->getOpcode() == ISD::CopyToReg &&
465 unsigned Reg = cast<RegisterSDNode>(Use->getOperand(1))->getReg();
466 if (TargetRegisterInfo::isVirtualRegister(Reg))
467 // This copy is a liveout value. It is likely coalesced, so reduce the
468 // latency so not to penalize the def.
469 // FIXME: need target specific adjustment here?
470 Latency = (Latency > 1) ? Latency - 1 : 1;
473 dep.setLatency(Latency);
476 void ScheduleDAGSDNodes::dumpNode(const SUnit *SU) const {
477 if (!SU->getNode()) {
478 dbgs() << "PHYS REG COPY\n";
482 SU->getNode()->dump(DAG);
484 SmallVector<SDNode *, 4> GluedNodes;
485 for (SDNode *N = SU->getNode()->getGluedNode(); N; N = N->getGluedNode())
486 GluedNodes.push_back(N);
487 while (!GluedNodes.empty()) {
489 GluedNodes.back()->dump(DAG);
491 GluedNodes.pop_back();
497 bool operator()(const std::pair<unsigned, MachineInstr*> &A,
498 const std::pair<unsigned, MachineInstr*> &B) {
499 return A.first < B.first;
504 // ProcessSourceNode - Process nodes with source order numbers. These are added
505 // to a vector which EmitSchedule uses to determine how to insert dbg_value
506 // instructions in the right order.
507 static void ProcessSourceNode(SDNode *N, SelectionDAG *DAG,
508 InstrEmitter &Emitter,
509 DenseMap<SDValue, unsigned> &VRBaseMap,
510 SmallVector<std::pair<unsigned, MachineInstr*>, 32> &Orders,
511 SmallSet<unsigned, 8> &Seen) {
512 unsigned Order = DAG->GetOrdering(N);
513 if (!Order || !Seen.insert(Order))
516 MachineBasicBlock *BB = Emitter.getBlock();
517 if (Emitter.getInsertPos() == BB->begin() || BB->back().isPHI()) {
518 // Did not insert any instruction.
519 Orders.push_back(std::make_pair(Order, (MachineInstr*)0));
523 Orders.push_back(std::make_pair(Order, prior(Emitter.getInsertPos())));
524 if (!N->getHasDebugValue())
526 // Opportunistically insert immediate dbg_value uses, i.e. those with source
527 // order number right after the N.
528 MachineBasicBlock::iterator InsertPos = Emitter.getInsertPos();
529 SmallVector<SDDbgValue*,2> &DVs = DAG->GetDbgValues(N);
530 for (unsigned i = 0, e = DVs.size(); i != e; ++i) {
531 if (DVs[i]->isInvalidated())
533 unsigned DVOrder = DVs[i]->getOrder();
534 if (DVOrder == ++Order) {
535 MachineInstr *DbgMI = Emitter.EmitDbgValue(DVs[i], VRBaseMap);
537 Orders.push_back(std::make_pair(DVOrder, DbgMI));
538 BB->insert(InsertPos, DbgMI);
540 DVs[i]->setIsInvalidated();
546 /// EmitSchedule - Emit the machine code in scheduled order.
547 MachineBasicBlock *ScheduleDAGSDNodes::EmitSchedule() {
548 InstrEmitter Emitter(BB, InsertPos);
549 DenseMap<SDValue, unsigned> VRBaseMap;
550 DenseMap<SUnit*, unsigned> CopyVRBaseMap;
551 SmallVector<std::pair<unsigned, MachineInstr*>, 32> Orders;
552 SmallSet<unsigned, 8> Seen;
553 bool HasDbg = DAG->hasDebugValues();
555 // If this is the first BB, emit byval parameter dbg_value's.
556 if (HasDbg && BB->getParent()->begin() == MachineFunction::iterator(BB)) {
557 SDDbgInfo::DbgIterator PDI = DAG->ByvalParmDbgBegin();
558 SDDbgInfo::DbgIterator PDE = DAG->ByvalParmDbgEnd();
559 for (; PDI != PDE; ++PDI) {
560 MachineInstr *DbgMI= Emitter.EmitDbgValue(*PDI, VRBaseMap);
562 BB->insert(InsertPos, DbgMI);
566 for (unsigned i = 0, e = Sequence.size(); i != e; i++) {
567 SUnit *SU = Sequence[i];
569 // Null SUnit* is a noop.
574 // For pre-regalloc scheduling, create instructions corresponding to the
575 // SDNode and any glued SDNodes and append them to the block.
576 if (!SU->getNode()) {
578 EmitPhysRegCopy(SU, CopyVRBaseMap);
582 SmallVector<SDNode *, 4> GluedNodes;
583 for (SDNode *N = SU->getNode()->getGluedNode(); N;
584 N = N->getGluedNode())
585 GluedNodes.push_back(N);
586 while (!GluedNodes.empty()) {
587 SDNode *N = GluedNodes.back();
588 Emitter.EmitNode(GluedNodes.back(), SU->OrigNode != SU, SU->isCloned,
590 // Remember the source order of the inserted instruction.
592 ProcessSourceNode(N, DAG, Emitter, VRBaseMap, Orders, Seen);
593 GluedNodes.pop_back();
595 Emitter.EmitNode(SU->getNode(), SU->OrigNode != SU, SU->isCloned,
597 // Remember the source order of the inserted instruction.
599 ProcessSourceNode(SU->getNode(), DAG, Emitter, VRBaseMap, Orders,
603 // Insert all the dbg_values which have not already been inserted in source
606 MachineBasicBlock::iterator BBBegin = BB->getFirstNonPHI();
608 // Sort the source order instructions and use the order to insert debug
610 std::sort(Orders.begin(), Orders.end(), OrderSorter());
612 SDDbgInfo::DbgIterator DI = DAG->DbgBegin();
613 SDDbgInfo::DbgIterator DE = DAG->DbgEnd();
614 // Now emit the rest according to source order.
615 unsigned LastOrder = 0;
616 for (unsigned i = 0, e = Orders.size(); i != e && DI != DE; ++i) {
617 unsigned Order = Orders[i].first;
618 MachineInstr *MI = Orders[i].second;
619 // Insert all SDDbgValue's whose order(s) are before "Order".
623 unsigned LastDIOrder = 0;
626 (*DI)->getOrder() >= LastOrder && (*DI)->getOrder() < Order; ++DI) {
628 assert((*DI)->getOrder() >= LastDIOrder &&
629 "SDDbgValue nodes must be in source order!");
630 LastDIOrder = (*DI)->getOrder();
632 if ((*DI)->isInvalidated())
634 MachineInstr *DbgMI = Emitter.EmitDbgValue(*DI, VRBaseMap);
637 // Insert to start of the BB (after PHIs).
638 BB->insert(BBBegin, DbgMI);
640 // Insert at the instruction, which may be in a different
641 // block, if the block was split by a custom inserter.
642 MachineBasicBlock::iterator Pos = MI;
643 MI->getParent()->insert(llvm::next(Pos), DbgMI);
649 // Add trailing DbgValue's before the terminator. FIXME: May want to add
650 // some of them before one or more conditional branches?
652 MachineBasicBlock *InsertBB = Emitter.getBlock();
653 MachineBasicBlock::iterator Pos= Emitter.getBlock()->getFirstTerminator();
654 if (!(*DI)->isInvalidated()) {
655 MachineInstr *DbgMI= Emitter.EmitDbgValue(*DI, VRBaseMap);
657 InsertBB->insert(Pos, DbgMI);
663 BB = Emitter.getBlock();
664 InsertPos = Emitter.getInsertPos();