Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 1 | //===---- ScheduleDAGEmit.cpp - Emit routines for the ScheduleDAG class ---===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This implements the Emit routines for the ScheduleDAG class, which creates |
| 11 | // MachineInstrs according to the computed schedule. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #define DEBUG_TYPE "pre-RA-sched" |
Dan Gohman | 84fbac5 | 2009-02-06 17:22:58 +0000 | [diff] [blame] | 16 | #include "ScheduleDAGSDNodes.h" |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 17 | #include "llvm/CodeGen/MachineConstantPool.h" |
| 18 | #include "llvm/CodeGen/MachineFunction.h" |
| 19 | #include "llvm/CodeGen/MachineInstrBuilder.h" |
| 20 | #include "llvm/CodeGen/MachineRegisterInfo.h" |
| 21 | #include "llvm/Target/TargetData.h" |
| 22 | #include "llvm/Target/TargetMachine.h" |
| 23 | #include "llvm/Target/TargetInstrInfo.h" |
| 24 | #include "llvm/Target/TargetLowering.h" |
| 25 | #include "llvm/ADT/Statistic.h" |
| 26 | #include "llvm/Support/CommandLine.h" |
| 27 | #include "llvm/Support/Debug.h" |
| 28 | #include "llvm/Support/MathExtras.h" |
| 29 | using namespace llvm; |
| 30 | |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 31 | /// getInstrOperandRegClass - Return register class of the operand of an |
| 32 | /// instruction of the specified TargetInstrDesc. |
| 33 | static const TargetRegisterClass* |
| 34 | getInstrOperandRegClass(const TargetRegisterInfo *TRI, |
Evan Cheng | 770bcc7 | 2009-02-06 17:43:24 +0000 | [diff] [blame^] | 35 | const TargetInstrDesc &II, unsigned Op) { |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 36 | if (Op >= II.getNumOperands()) { |
| 37 | assert(II.isVariadic() && "Invalid operand # of instruction"); |
| 38 | return NULL; |
| 39 | } |
| 40 | if (II.OpInfo[Op].isLookupPtrRegClass()) |
Evan Cheng | 770bcc7 | 2009-02-06 17:43:24 +0000 | [diff] [blame^] | 41 | return TRI->getPointerRegClass(); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 42 | return TRI->getRegClass(II.OpInfo[Op].RegClass); |
| 43 | } |
| 44 | |
| 45 | /// EmitCopyFromReg - Generate machine code for an CopyFromReg node or an |
| 46 | /// implicit physical register output. |
Dan Gohman | 343f0c0 | 2008-11-19 23:18:57 +0000 | [diff] [blame] | 47 | void ScheduleDAGSDNodes::EmitCopyFromReg(SDNode *Node, unsigned ResNo, |
Evan Cheng | e57187c | 2009-01-16 20:57:18 +0000 | [diff] [blame] | 48 | bool IsClone, bool IsCloned, |
| 49 | unsigned SrcReg, |
Dan Gohman | 343f0c0 | 2008-11-19 23:18:57 +0000 | [diff] [blame] | 50 | DenseMap<SDValue, unsigned> &VRBaseMap) { |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 51 | unsigned VRBase = 0; |
| 52 | if (TargetRegisterInfo::isVirtualRegister(SrcReg)) { |
| 53 | // Just use the input register directly! |
| 54 | SDValue Op(Node, ResNo); |
| 55 | if (IsClone) |
| 56 | VRBaseMap.erase(Op); |
| 57 | bool isNew = VRBaseMap.insert(std::make_pair(Op, SrcReg)).second; |
| 58 | isNew = isNew; // Silence compiler warning. |
| 59 | assert(isNew && "Node emitted out of order - early"); |
| 60 | return; |
| 61 | } |
| 62 | |
| 63 | // If the node is only used by a CopyToReg and the dest reg is a vreg, use |
| 64 | // the CopyToReg'd destination register instead of creating a new vreg. |
| 65 | bool MatchReg = true; |
Evan Cheng | 1cd3327 | 2008-09-16 23:12:11 +0000 | [diff] [blame] | 66 | const TargetRegisterClass *UseRC = NULL; |
Evan Cheng | e57187c | 2009-01-16 20:57:18 +0000 | [diff] [blame] | 67 | if (!IsClone && !IsCloned) |
| 68 | for (SDNode::use_iterator UI = Node->use_begin(), E = Node->use_end(); |
| 69 | UI != E; ++UI) { |
| 70 | SDNode *User = *UI; |
| 71 | bool Match = true; |
| 72 | if (User->getOpcode() == ISD::CopyToReg && |
| 73 | User->getOperand(2).getNode() == Node && |
| 74 | User->getOperand(2).getResNo() == ResNo) { |
| 75 | unsigned DestReg = cast<RegisterSDNode>(User->getOperand(1))->getReg(); |
| 76 | if (TargetRegisterInfo::isVirtualRegister(DestReg)) { |
| 77 | VRBase = DestReg; |
| 78 | Match = false; |
| 79 | } else if (DestReg != SrcReg) |
| 80 | Match = false; |
| 81 | } else { |
| 82 | for (unsigned i = 0, e = User->getNumOperands(); i != e; ++i) { |
| 83 | SDValue Op = User->getOperand(i); |
| 84 | if (Op.getNode() != Node || Op.getResNo() != ResNo) |
| 85 | continue; |
| 86 | MVT VT = Node->getValueType(Op.getResNo()); |
| 87 | if (VT == MVT::Other || VT == MVT::Flag) |
| 88 | continue; |
| 89 | Match = false; |
| 90 | if (User->isMachineOpcode()) { |
| 91 | const TargetInstrDesc &II = TII->get(User->getMachineOpcode()); |
| 92 | const TargetRegisterClass *RC = |
Evan Cheng | 770bcc7 | 2009-02-06 17:43:24 +0000 | [diff] [blame^] | 93 | getInstrOperandRegClass(TRI, II, i+II.getNumDefs()); |
Evan Cheng | e57187c | 2009-01-16 20:57:18 +0000 | [diff] [blame] | 94 | if (!UseRC) |
| 95 | UseRC = RC; |
| 96 | else if (RC) |
| 97 | assert(UseRC == RC && |
| 98 | "Multiple uses expecting different register classes!"); |
| 99 | } |
Evan Cheng | 1cd3327 | 2008-09-16 23:12:11 +0000 | [diff] [blame] | 100 | } |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 101 | } |
Evan Cheng | e57187c | 2009-01-16 20:57:18 +0000 | [diff] [blame] | 102 | MatchReg &= Match; |
| 103 | if (VRBase) |
| 104 | break; |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 105 | } |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 106 | |
Evan Cheng | 1cd3327 | 2008-09-16 23:12:11 +0000 | [diff] [blame] | 107 | MVT VT = Node->getValueType(ResNo); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 108 | const TargetRegisterClass *SrcRC = 0, *DstRC = 0; |
Evan Cheng | 1cd3327 | 2008-09-16 23:12:11 +0000 | [diff] [blame] | 109 | SrcRC = TRI->getPhysicalRegisterRegClass(SrcReg, VT); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 110 | |
| 111 | // Figure out the register class to create for the destreg. |
| 112 | if (VRBase) { |
| 113 | DstRC = MRI.getRegClass(VRBase); |
Evan Cheng | 1cd3327 | 2008-09-16 23:12:11 +0000 | [diff] [blame] | 114 | } else if (UseRC) { |
| 115 | assert(UseRC->hasType(VT) && "Incompatible phys register def and uses!"); |
| 116 | DstRC = UseRC; |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 117 | } else { |
Evan Cheng | 1cd3327 | 2008-09-16 23:12:11 +0000 | [diff] [blame] | 118 | DstRC = TLI->getRegClassFor(VT); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | // If all uses are reading from the src physical register and copying the |
| 122 | // register is either impossible or very expensive, then don't create a copy. |
| 123 | if (MatchReg && SrcRC->getCopyCost() < 0) { |
| 124 | VRBase = SrcReg; |
| 125 | } else { |
| 126 | // Create the reg, emit the copy. |
| 127 | VRBase = MRI.createVirtualRegister(DstRC); |
Evan Cheng | 1cd3327 | 2008-09-16 23:12:11 +0000 | [diff] [blame] | 128 | bool Emitted = |
Dan Gohman | f711939 | 2009-01-16 22:10:20 +0000 | [diff] [blame] | 129 | TII->copyRegToReg(*BB, End, VRBase, SrcReg, DstRC, SrcRC); |
Evan Cheng | 1cd3327 | 2008-09-16 23:12:11 +0000 | [diff] [blame] | 130 | Emitted = Emitted; // Silence compiler warning. |
| 131 | assert(Emitted && "Unable to issue a copy instruction!"); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | SDValue Op(Node, ResNo); |
| 135 | if (IsClone) |
| 136 | VRBaseMap.erase(Op); |
| 137 | bool isNew = VRBaseMap.insert(std::make_pair(Op, VRBase)).second; |
| 138 | isNew = isNew; // Silence compiler warning. |
| 139 | assert(isNew && "Node emitted out of order - early"); |
| 140 | } |
| 141 | |
| 142 | /// getDstOfCopyToRegUse - If the only use of the specified result number of |
| 143 | /// node is a CopyToReg, return its destination register. Return 0 otherwise. |
Dan Gohman | 343f0c0 | 2008-11-19 23:18:57 +0000 | [diff] [blame] | 144 | unsigned ScheduleDAGSDNodes::getDstOfOnlyCopyToRegUse(SDNode *Node, |
| 145 | unsigned ResNo) const { |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 146 | if (!Node->hasOneUse()) |
| 147 | return 0; |
| 148 | |
| 149 | SDNode *User = *Node->use_begin(); |
| 150 | if (User->getOpcode() == ISD::CopyToReg && |
| 151 | User->getOperand(2).getNode() == Node && |
| 152 | User->getOperand(2).getResNo() == ResNo) { |
| 153 | unsigned Reg = cast<RegisterSDNode>(User->getOperand(1))->getReg(); |
| 154 | if (TargetRegisterInfo::isVirtualRegister(Reg)) |
| 155 | return Reg; |
| 156 | } |
| 157 | return 0; |
| 158 | } |
| 159 | |
Dan Gohman | 343f0c0 | 2008-11-19 23:18:57 +0000 | [diff] [blame] | 160 | void ScheduleDAGSDNodes::CreateVirtualRegisters(SDNode *Node, MachineInstr *MI, |
Evan Cheng | e57187c | 2009-01-16 20:57:18 +0000 | [diff] [blame] | 161 | const TargetInstrDesc &II, |
| 162 | bool IsClone, bool IsCloned, |
Evan Cheng | 5c3c5a4 | 2009-01-09 22:44:02 +0000 | [diff] [blame] | 163 | DenseMap<SDValue, unsigned> &VRBaseMap) { |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 164 | assert(Node->getMachineOpcode() != TargetInstrInfo::IMPLICIT_DEF && |
| 165 | "IMPLICIT_DEF should have been handled as a special case elsewhere!"); |
| 166 | |
| 167 | for (unsigned i = 0; i < II.getNumDefs(); ++i) { |
| 168 | // If the specific node value is only used by a CopyToReg and the dest reg |
| 169 | // is a vreg, use the CopyToReg'd destination register instead of creating |
| 170 | // a new vreg. |
| 171 | unsigned VRBase = 0; |
Evan Cheng | e57187c | 2009-01-16 20:57:18 +0000 | [diff] [blame] | 172 | |
| 173 | if (!IsClone && !IsCloned) |
| 174 | for (SDNode::use_iterator UI = Node->use_begin(), E = Node->use_end(); |
| 175 | UI != E; ++UI) { |
| 176 | SDNode *User = *UI; |
| 177 | if (User->getOpcode() == ISD::CopyToReg && |
| 178 | User->getOperand(2).getNode() == Node && |
| 179 | User->getOperand(2).getResNo() == i) { |
| 180 | unsigned Reg = cast<RegisterSDNode>(User->getOperand(1))->getReg(); |
| 181 | if (TargetRegisterInfo::isVirtualRegister(Reg)) { |
| 182 | VRBase = Reg; |
| 183 | MI->addOperand(MachineOperand::CreateReg(Reg, true)); |
| 184 | break; |
| 185 | } |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 186 | } |
| 187 | } |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 188 | |
| 189 | // Create the result registers for this node and add the result regs to |
| 190 | // the machine instruction. |
| 191 | if (VRBase == 0) { |
Evan Cheng | 770bcc7 | 2009-02-06 17:43:24 +0000 | [diff] [blame^] | 192 | const TargetRegisterClass *RC = getInstrOperandRegClass(TRI, II, i); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 193 | assert(RC && "Isn't a register operand!"); |
| 194 | VRBase = MRI.createVirtualRegister(RC); |
| 195 | MI->addOperand(MachineOperand::CreateReg(VRBase, true)); |
| 196 | } |
| 197 | |
| 198 | SDValue Op(Node, i); |
Evan Cheng | 5c3c5a4 | 2009-01-09 22:44:02 +0000 | [diff] [blame] | 199 | if (IsClone) |
| 200 | VRBaseMap.erase(Op); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 201 | bool isNew = VRBaseMap.insert(std::make_pair(Op, VRBase)).second; |
| 202 | isNew = isNew; // Silence compiler warning. |
| 203 | assert(isNew && "Node emitted out of order - early"); |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | /// getVR - Return the virtual register corresponding to the specified result |
| 208 | /// of the specified node. |
Dan Gohman | 343f0c0 | 2008-11-19 23:18:57 +0000 | [diff] [blame] | 209 | unsigned ScheduleDAGSDNodes::getVR(SDValue Op, |
| 210 | DenseMap<SDValue, unsigned> &VRBaseMap) { |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 211 | if (Op.isMachineOpcode() && |
| 212 | Op.getMachineOpcode() == TargetInstrInfo::IMPLICIT_DEF) { |
| 213 | // Add an IMPLICIT_DEF instruction before every use. |
| 214 | unsigned VReg = getDstOfOnlyCopyToRegUse(Op.getNode(), Op.getResNo()); |
| 215 | // IMPLICIT_DEF can produce any type of result so its TargetInstrDesc |
| 216 | // does not include operand register class info. |
| 217 | if (!VReg) { |
| 218 | const TargetRegisterClass *RC = TLI->getRegClassFor(Op.getValueType()); |
| 219 | VReg = MRI.createVirtualRegister(RC); |
| 220 | } |
Bill Wendling | f2ad58d | 2009-02-03 01:02:39 +0000 | [diff] [blame] | 221 | BuildMI(BB, Op.getDebugLoc(), TII->get(TargetInstrInfo::IMPLICIT_DEF),VReg); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 222 | return VReg; |
| 223 | } |
| 224 | |
| 225 | DenseMap<SDValue, unsigned>::iterator I = VRBaseMap.find(Op); |
| 226 | assert(I != VRBaseMap.end() && "Node emitted out of order - late"); |
| 227 | return I->second; |
| 228 | } |
| 229 | |
| 230 | |
| 231 | /// AddOperand - Add the specified operand to the specified machine instr. II |
| 232 | /// specifies the instruction information for the node, and IIOpNum is the |
| 233 | /// operand number (in the II) that we are adding. IIOpNum and II are used for |
| 234 | /// assertions only. |
Dan Gohman | 343f0c0 | 2008-11-19 23:18:57 +0000 | [diff] [blame] | 235 | void ScheduleDAGSDNodes::AddOperand(MachineInstr *MI, SDValue Op, |
| 236 | unsigned IIOpNum, |
| 237 | const TargetInstrDesc *II, |
| 238 | DenseMap<SDValue, unsigned> &VRBaseMap) { |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 239 | if (Op.isMachineOpcode()) { |
| 240 | // Note that this case is redundant with the final else block, but we |
| 241 | // include it because it is the most common and it makes the logic |
| 242 | // simpler here. |
| 243 | assert(Op.getValueType() != MVT::Other && |
| 244 | Op.getValueType() != MVT::Flag && |
| 245 | "Chain and flag operands should occur at end of operand list!"); |
| 246 | // Get/emit the operand. |
| 247 | unsigned VReg = getVR(Op, VRBaseMap); |
| 248 | const TargetInstrDesc &TID = MI->getDesc(); |
| 249 | bool isOptDef = IIOpNum < TID.getNumOperands() && |
| 250 | TID.OpInfo[IIOpNum].isOptionalDef(); |
Dale Johannesen | 86b49f8 | 2008-09-24 01:07:17 +0000 | [diff] [blame] | 251 | MI->addOperand(MachineOperand::CreateReg(VReg, isOptDef)); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 252 | |
| 253 | // Verify that it is right. |
| 254 | assert(TargetRegisterInfo::isVirtualRegister(VReg) && "Not a vreg?"); |
| 255 | #ifndef NDEBUG |
| 256 | if (II) { |
| 257 | // There may be no register class for this operand if it is a variadic |
| 258 | // argument (RC will be NULL in this case). In this case, we just assume |
| 259 | // the regclass is ok. |
Evan Cheng | 770bcc7 | 2009-02-06 17:43:24 +0000 | [diff] [blame^] | 260 | const TargetRegisterClass *RC= getInstrOperandRegClass(TRI, *II, IIOpNum); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 261 | assert((RC || II->isVariadic()) && "Expected reg class info!"); |
| 262 | const TargetRegisterClass *VRC = MRI.getRegClass(VReg); |
| 263 | if (RC && VRC != RC) { |
| 264 | cerr << "Register class of operand and regclass of use don't agree!\n"; |
| 265 | cerr << "Operand = " << IIOpNum << "\n"; |
Dan Gohman | a23b3b8 | 2008-11-13 21:21:28 +0000 | [diff] [blame] | 266 | cerr << "Op->Val = "; Op.getNode()->dump(DAG); cerr << "\n"; |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 267 | cerr << "MI = "; MI->print(cerr); |
| 268 | cerr << "VReg = " << VReg << "\n"; |
| 269 | cerr << "VReg RegClass size = " << VRC->getSize() |
| 270 | << ", align = " << VRC->getAlignment() << "\n"; |
| 271 | cerr << "Expected RegClass size = " << RC->getSize() |
| 272 | << ", align = " << RC->getAlignment() << "\n"; |
| 273 | cerr << "Fatal error, aborting.\n"; |
| 274 | abort(); |
| 275 | } |
| 276 | } |
| 277 | #endif |
| 278 | } else if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op)) { |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 279 | MI->addOperand(MachineOperand::CreateImm(C->getZExtValue())); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 280 | } else if (ConstantFPSDNode *F = dyn_cast<ConstantFPSDNode>(Op)) { |
Dan Gohman | 4fbd796 | 2008-09-12 18:08:03 +0000 | [diff] [blame] | 281 | const ConstantFP *CFP = F->getConstantFPValue(); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 282 | MI->addOperand(MachineOperand::CreateFPImm(CFP)); |
| 283 | } else if (RegisterSDNode *R = dyn_cast<RegisterSDNode>(Op)) { |
Dale Johannesen | 86b49f8 | 2008-09-24 01:07:17 +0000 | [diff] [blame] | 284 | MI->addOperand(MachineOperand::CreateReg(R->getReg(), false)); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 285 | } else if (GlobalAddressSDNode *TGA = dyn_cast<GlobalAddressSDNode>(Op)) { |
| 286 | MI->addOperand(MachineOperand::CreateGA(TGA->getGlobal(),TGA->getOffset())); |
| 287 | } else if (BasicBlockSDNode *BB = dyn_cast<BasicBlockSDNode>(Op)) { |
| 288 | MI->addOperand(MachineOperand::CreateMBB(BB->getBasicBlock())); |
| 289 | } else if (FrameIndexSDNode *FI = dyn_cast<FrameIndexSDNode>(Op)) { |
| 290 | MI->addOperand(MachineOperand::CreateFI(FI->getIndex())); |
| 291 | } else if (JumpTableSDNode *JT = dyn_cast<JumpTableSDNode>(Op)) { |
| 292 | MI->addOperand(MachineOperand::CreateJTI(JT->getIndex())); |
| 293 | } else if (ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(Op)) { |
| 294 | int Offset = CP->getOffset(); |
| 295 | unsigned Align = CP->getAlignment(); |
| 296 | const Type *Type = CP->getType(); |
| 297 | // MachineConstantPool wants an explicit alignment. |
| 298 | if (Align == 0) { |
| 299 | Align = TM.getTargetData()->getPreferredTypeAlignmentShift(Type); |
| 300 | if (Align == 0) { |
| 301 | // Alignment of vector types. FIXME! |
Duncan Sands | ceb4d1a | 2009-01-12 20:38:59 +0000 | [diff] [blame] | 302 | Align = TM.getTargetData()->getTypePaddedSize(Type); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 303 | Align = Log2_64(Align); |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | unsigned Idx; |
| 308 | if (CP->isMachineConstantPoolEntry()) |
| 309 | Idx = ConstPool->getConstantPoolIndex(CP->getMachineCPVal(), Align); |
| 310 | else |
| 311 | Idx = ConstPool->getConstantPoolIndex(CP->getConstVal(), Align); |
| 312 | MI->addOperand(MachineOperand::CreateCPI(Idx, Offset)); |
Bill Wendling | 056292f | 2008-09-16 21:48:12 +0000 | [diff] [blame] | 313 | } else if (ExternalSymbolSDNode *ES = dyn_cast<ExternalSymbolSDNode>(Op)) { |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 314 | MI->addOperand(MachineOperand::CreateES(ES->getSymbol())); |
| 315 | } else { |
| 316 | assert(Op.getValueType() != MVT::Other && |
| 317 | Op.getValueType() != MVT::Flag && |
| 318 | "Chain and flag operands should occur at end of operand list!"); |
| 319 | unsigned VReg = getVR(Op, VRBaseMap); |
Dale Johannesen | 86b49f8 | 2008-09-24 01:07:17 +0000 | [diff] [blame] | 320 | MI->addOperand(MachineOperand::CreateReg(VReg, false)); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 321 | |
| 322 | // Verify that it is right. Note that the reg class of the physreg and the |
| 323 | // vreg don't necessarily need to match, but the target copy insertion has |
| 324 | // to be able to handle it. This handles things like copies from ST(0) to |
| 325 | // an FP vreg on x86. |
| 326 | assert(TargetRegisterInfo::isVirtualRegister(VReg) && "Not a vreg?"); |
| 327 | if (II && !II->isVariadic()) { |
Evan Cheng | 770bcc7 | 2009-02-06 17:43:24 +0000 | [diff] [blame^] | 328 | assert(getInstrOperandRegClass(TRI, *II, IIOpNum) && |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 329 | "Don't have operand info for this instruction!"); |
| 330 | } |
| 331 | } |
| 332 | } |
| 333 | |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 334 | /// EmitSubregNode - Generate machine code for subreg nodes. |
| 335 | /// |
Dan Gohman | 343f0c0 | 2008-11-19 23:18:57 +0000 | [diff] [blame] | 336 | void ScheduleDAGSDNodes::EmitSubregNode(SDNode *Node, |
| 337 | DenseMap<SDValue, unsigned> &VRBaseMap) { |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 338 | unsigned VRBase = 0; |
| 339 | unsigned Opc = Node->getMachineOpcode(); |
| 340 | |
| 341 | // If the node is only used by a CopyToReg and the dest reg is a vreg, use |
| 342 | // the CopyToReg'd destination register instead of creating a new vreg. |
| 343 | for (SDNode::use_iterator UI = Node->use_begin(), E = Node->use_end(); |
| 344 | UI != E; ++UI) { |
| 345 | SDNode *User = *UI; |
| 346 | if (User->getOpcode() == ISD::CopyToReg && |
| 347 | User->getOperand(2).getNode() == Node) { |
| 348 | unsigned DestReg = cast<RegisterSDNode>(User->getOperand(1))->getReg(); |
| 349 | if (TargetRegisterInfo::isVirtualRegister(DestReg)) { |
| 350 | VRBase = DestReg; |
| 351 | break; |
| 352 | } |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | if (Opc == TargetInstrInfo::EXTRACT_SUBREG) { |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 357 | unsigned SubIdx = cast<ConstantSDNode>(Node->getOperand(1))->getZExtValue(); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 358 | |
| 359 | // Create the extract_subreg machine instruction. |
Bill Wendling | f2ad58d | 2009-02-03 01:02:39 +0000 | [diff] [blame] | 360 | MachineInstr *MI = BuildMI(MF, Node->getDebugLoc(), |
| 361 | TII->get(TargetInstrInfo::EXTRACT_SUBREG)); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 362 | |
| 363 | // Figure out the register class to create for the destreg. |
Evan Cheng | 536ab13 | 2009-01-22 09:10:11 +0000 | [diff] [blame] | 364 | const TargetRegisterClass *SRC = TLI->getRegClassFor(Node->getValueType(0)); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 365 | |
| 366 | if (VRBase) { |
| 367 | // Grab the destination register |
| 368 | #ifndef NDEBUG |
| 369 | const TargetRegisterClass *DRC = MRI.getRegClass(VRBase); |
| 370 | assert(SRC && DRC && SRC == DRC && |
| 371 | "Source subregister and destination must have the same class"); |
| 372 | #endif |
| 373 | } else { |
| 374 | // Create the reg |
| 375 | assert(SRC && "Couldn't find source register class"); |
| 376 | VRBase = MRI.createVirtualRegister(SRC); |
| 377 | } |
| 378 | |
| 379 | // Add def, source, and subreg index |
| 380 | MI->addOperand(MachineOperand::CreateReg(VRBase, true)); |
| 381 | AddOperand(MI, Node->getOperand(0), 0, 0, VRBaseMap); |
| 382 | MI->addOperand(MachineOperand::CreateImm(SubIdx)); |
Dan Gohman | f711939 | 2009-01-16 22:10:20 +0000 | [diff] [blame] | 383 | BB->insert(End, MI); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 384 | } else if (Opc == TargetInstrInfo::INSERT_SUBREG || |
| 385 | Opc == TargetInstrInfo::SUBREG_TO_REG) { |
| 386 | SDValue N0 = Node->getOperand(0); |
| 387 | SDValue N1 = Node->getOperand(1); |
| 388 | SDValue N2 = Node->getOperand(2); |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 389 | unsigned SubIdx = cast<ConstantSDNode>(N2)->getZExtValue(); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 390 | |
| 391 | |
| 392 | // Figure out the register class to create for the destreg. |
| 393 | const TargetRegisterClass *TRC = 0; |
| 394 | if (VRBase) { |
| 395 | TRC = MRI.getRegClass(VRBase); |
| 396 | } else { |
Evan Cheng | 536ab13 | 2009-01-22 09:10:11 +0000 | [diff] [blame] | 397 | TRC = TLI->getRegClassFor(Node->getValueType(0)); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 398 | assert(TRC && "Couldn't determine register class for insert_subreg"); |
| 399 | VRBase = MRI.createVirtualRegister(TRC); // Create the reg |
| 400 | } |
| 401 | |
| 402 | // Create the insert_subreg or subreg_to_reg machine instruction. |
Bill Wendling | f2ad58d | 2009-02-03 01:02:39 +0000 | [diff] [blame] | 403 | MachineInstr *MI = BuildMI(MF, Node->getDebugLoc(), TII->get(Opc)); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 404 | MI->addOperand(MachineOperand::CreateReg(VRBase, true)); |
| 405 | |
| 406 | // If creating a subreg_to_reg, then the first input operand |
| 407 | // is an implicit value immediate, otherwise it's a register |
| 408 | if (Opc == TargetInstrInfo::SUBREG_TO_REG) { |
| 409 | const ConstantSDNode *SD = cast<ConstantSDNode>(N0); |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 410 | MI->addOperand(MachineOperand::CreateImm(SD->getZExtValue())); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 411 | } else |
| 412 | AddOperand(MI, N0, 0, 0, VRBaseMap); |
| 413 | // Add the subregster being inserted |
| 414 | AddOperand(MI, N1, 0, 0, VRBaseMap); |
| 415 | MI->addOperand(MachineOperand::CreateImm(SubIdx)); |
Dan Gohman | f711939 | 2009-01-16 22:10:20 +0000 | [diff] [blame] | 416 | BB->insert(End, MI); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 417 | } else |
| 418 | assert(0 && "Node is not insert_subreg, extract_subreg, or subreg_to_reg"); |
| 419 | |
| 420 | SDValue Op(Node, 0); |
| 421 | bool isNew = VRBaseMap.insert(std::make_pair(Op, VRBase)).second; |
| 422 | isNew = isNew; // Silence compiler warning. |
| 423 | assert(isNew && "Node emitted out of order - early"); |
| 424 | } |
| 425 | |
| 426 | /// EmitNode - Generate machine code for an node and needed dependencies. |
| 427 | /// |
Evan Cheng | e57187c | 2009-01-16 20:57:18 +0000 | [diff] [blame] | 428 | void ScheduleDAGSDNodes::EmitNode(SDNode *Node, bool IsClone, bool IsCloned, |
Dan Gohman | 343f0c0 | 2008-11-19 23:18:57 +0000 | [diff] [blame] | 429 | DenseMap<SDValue, unsigned> &VRBaseMap) { |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 430 | // If machine instruction |
| 431 | if (Node->isMachineOpcode()) { |
| 432 | unsigned Opc = Node->getMachineOpcode(); |
| 433 | |
| 434 | // Handle subreg insert/extract specially |
| 435 | if (Opc == TargetInstrInfo::EXTRACT_SUBREG || |
| 436 | Opc == TargetInstrInfo::INSERT_SUBREG || |
| 437 | Opc == TargetInstrInfo::SUBREG_TO_REG) { |
| 438 | EmitSubregNode(Node, VRBaseMap); |
| 439 | return; |
| 440 | } |
| 441 | |
| 442 | if (Opc == TargetInstrInfo::IMPLICIT_DEF) |
| 443 | // We want a unique VR for each IMPLICIT_DEF use. |
| 444 | return; |
| 445 | |
| 446 | const TargetInstrDesc &II = TII->get(Opc); |
| 447 | unsigned NumResults = CountResults(Node); |
| 448 | unsigned NodeOperands = CountOperands(Node); |
| 449 | unsigned MemOperandsEnd = ComputeMemOperandsEnd(Node); |
| 450 | bool HasPhysRegOuts = (NumResults > II.getNumDefs()) && |
| 451 | II.getImplicitDefs() != 0; |
| 452 | #ifndef NDEBUG |
| 453 | unsigned NumMIOperands = NodeOperands + NumResults; |
| 454 | assert((II.getNumOperands() == NumMIOperands || |
| 455 | HasPhysRegOuts || II.isVariadic()) && |
| 456 | "#operands for dag node doesn't match .td file!"); |
| 457 | #endif |
| 458 | |
| 459 | // Create the new machine instruction. |
Bill Wendling | f2ad58d | 2009-02-03 01:02:39 +0000 | [diff] [blame] | 460 | MachineInstr *MI = BuildMI(MF, Node->getDebugLoc(), II); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 461 | |
| 462 | // Add result register values for things that are defined by this |
| 463 | // instruction. |
| 464 | if (NumResults) |
Evan Cheng | e57187c | 2009-01-16 20:57:18 +0000 | [diff] [blame] | 465 | CreateVirtualRegisters(Node, MI, II, IsClone, IsCloned, VRBaseMap); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 466 | |
| 467 | // Emit all of the actual operands of this instruction, adding them to the |
| 468 | // instruction as appropriate. |
| 469 | for (unsigned i = 0; i != NodeOperands; ++i) |
| 470 | AddOperand(MI, Node->getOperand(i), i+II.getNumDefs(), &II, VRBaseMap); |
| 471 | |
| 472 | // Emit all of the memory operands of this instruction |
| 473 | for (unsigned i = NodeOperands; i != MemOperandsEnd; ++i) |
| 474 | AddMemOperand(MI, cast<MemOperandSDNode>(Node->getOperand(i))->MO); |
| 475 | |
Dan Gohman | f711939 | 2009-01-16 22:10:20 +0000 | [diff] [blame] | 476 | if (II.usesCustomDAGSchedInsertionHook()) { |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 477 | // Insert this instruction into the basic block using a target |
| 478 | // specific inserter which may returns a new basic block. |
| 479 | BB = TLI->EmitInstrWithCustomInserter(MI, BB); |
Dan Gohman | f711939 | 2009-01-16 22:10:20 +0000 | [diff] [blame] | 480 | Begin = End = BB->end(); |
Bill Wendling | f2ad58d | 2009-02-03 01:02:39 +0000 | [diff] [blame] | 481 | } else { |
Dan Gohman | f711939 | 2009-01-16 22:10:20 +0000 | [diff] [blame] | 482 | BB->insert(End, MI); |
Bill Wendling | f2ad58d | 2009-02-03 01:02:39 +0000 | [diff] [blame] | 483 | } |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 484 | |
| 485 | // Additional results must be an physical register def. |
| 486 | if (HasPhysRegOuts) { |
| 487 | for (unsigned i = II.getNumDefs(); i < NumResults; ++i) { |
| 488 | unsigned Reg = II.getImplicitDefs()[i - II.getNumDefs()]; |
| 489 | if (Node->hasAnyUseOfValue(i)) |
Evan Cheng | e57187c | 2009-01-16 20:57:18 +0000 | [diff] [blame] | 490 | EmitCopyFromReg(Node, i, IsClone, IsCloned, Reg, VRBaseMap); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 491 | } |
| 492 | } |
| 493 | return; |
| 494 | } |
| 495 | |
| 496 | switch (Node->getOpcode()) { |
| 497 | default: |
| 498 | #ifndef NDEBUG |
Dan Gohman | a23b3b8 | 2008-11-13 21:21:28 +0000 | [diff] [blame] | 499 | Node->dump(DAG); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 500 | #endif |
| 501 | assert(0 && "This target-independent node should have been selected!"); |
| 502 | break; |
| 503 | case ISD::EntryToken: |
| 504 | assert(0 && "EntryToken should have been excluded from the schedule!"); |
| 505 | break; |
| 506 | case ISD::TokenFactor: // fall thru |
| 507 | break; |
| 508 | case ISD::CopyToReg: { |
| 509 | unsigned SrcReg; |
| 510 | SDValue SrcVal = Node->getOperand(2); |
| 511 | if (RegisterSDNode *R = dyn_cast<RegisterSDNode>(SrcVal)) |
| 512 | SrcReg = R->getReg(); |
| 513 | else |
| 514 | SrcReg = getVR(SrcVal, VRBaseMap); |
| 515 | |
| 516 | unsigned DestReg = cast<RegisterSDNode>(Node->getOperand(1))->getReg(); |
| 517 | if (SrcReg == DestReg) // Coalesced away the copy? Ignore. |
| 518 | break; |
| 519 | |
| 520 | const TargetRegisterClass *SrcTRC = 0, *DstTRC = 0; |
| 521 | // Get the register classes of the src/dst. |
| 522 | if (TargetRegisterInfo::isVirtualRegister(SrcReg)) |
| 523 | SrcTRC = MRI.getRegClass(SrcReg); |
| 524 | else |
| 525 | SrcTRC = TRI->getPhysicalRegisterRegClass(SrcReg,SrcVal.getValueType()); |
| 526 | |
| 527 | if (TargetRegisterInfo::isVirtualRegister(DestReg)) |
| 528 | DstTRC = MRI.getRegClass(DestReg); |
| 529 | else |
| 530 | DstTRC = TRI->getPhysicalRegisterRegClass(DestReg, |
| 531 | Node->getOperand(1).getValueType()); |
Dan Gohman | f711939 | 2009-01-16 22:10:20 +0000 | [diff] [blame] | 532 | TII->copyRegToReg(*BB, End, DestReg, SrcReg, DstTRC, SrcTRC); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 533 | break; |
| 534 | } |
| 535 | case ISD::CopyFromReg: { |
| 536 | unsigned SrcReg = cast<RegisterSDNode>(Node->getOperand(1))->getReg(); |
Evan Cheng | e57187c | 2009-01-16 20:57:18 +0000 | [diff] [blame] | 537 | EmitCopyFromReg(Node, 0, IsClone, IsCloned, SrcReg, VRBaseMap); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 538 | break; |
| 539 | } |
| 540 | case ISD::INLINEASM: { |
| 541 | unsigned NumOps = Node->getNumOperands(); |
| 542 | if (Node->getOperand(NumOps-1).getValueType() == MVT::Flag) |
| 543 | --NumOps; // Ignore the flag operand. |
| 544 | |
| 545 | // Create the inline asm machine instruction. |
Bill Wendling | f2ad58d | 2009-02-03 01:02:39 +0000 | [diff] [blame] | 546 | MachineInstr *MI = BuildMI(MF, Node->getDebugLoc(), |
| 547 | TII->get(TargetInstrInfo::INLINEASM)); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 548 | |
| 549 | // Add the asm string as an external symbol operand. |
Bill Wendling | 056292f | 2008-09-16 21:48:12 +0000 | [diff] [blame] | 550 | const char *AsmStr = |
| 551 | cast<ExternalSymbolSDNode>(Node->getOperand(1))->getSymbol(); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 552 | MI->addOperand(MachineOperand::CreateES(AsmStr)); |
| 553 | |
| 554 | // Add all of the operand registers to the instruction. |
| 555 | for (unsigned i = 2; i != NumOps;) { |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 556 | unsigned Flags = |
| 557 | cast<ConstantSDNode>(Node->getOperand(i))->getZExtValue(); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 558 | unsigned NumVals = Flags >> 3; |
| 559 | |
| 560 | MI->addOperand(MachineOperand::CreateImm(Flags)); |
| 561 | ++i; // Skip the ID value. |
| 562 | |
| 563 | switch (Flags & 7) { |
| 564 | default: assert(0 && "Bad flags!"); |
| 565 | case 2: // Def of register. |
| 566 | for (; NumVals; --NumVals, ++i) { |
| 567 | unsigned Reg = cast<RegisterSDNode>(Node->getOperand(i))->getReg(); |
| 568 | MI->addOperand(MachineOperand::CreateReg(Reg, true)); |
| 569 | } |
| 570 | break; |
Dale Johannesen | 913d3df | 2008-09-12 17:49:03 +0000 | [diff] [blame] | 571 | case 6: // Def of earlyclobber register. |
| 572 | for (; NumVals; --NumVals, ++i) { |
| 573 | unsigned Reg = cast<RegisterSDNode>(Node->getOperand(i))->getReg(); |
| 574 | MI->addOperand(MachineOperand::CreateReg(Reg, true, false, false, |
| 575 | false, 0, true)); |
| 576 | } |
| 577 | break; |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 578 | case 1: // Use of register. |
| 579 | case 3: // Immediate. |
| 580 | case 4: // Addressing mode. |
| 581 | // The addressing mode has been selected, just add all of the |
| 582 | // operands to the machine instruction. |
| 583 | for (; NumVals; --NumVals, ++i) |
Dale Johannesen | 86b49f8 | 2008-09-24 01:07:17 +0000 | [diff] [blame] | 584 | AddOperand(MI, Node->getOperand(i), 0, 0, VRBaseMap); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 585 | break; |
| 586 | } |
| 587 | } |
Dan Gohman | f711939 | 2009-01-16 22:10:20 +0000 | [diff] [blame] | 588 | BB->insert(End, MI); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 589 | break; |
| 590 | } |
| 591 | } |
| 592 | } |
| 593 | |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 594 | /// EmitSchedule - Emit the machine code in scheduled order. |
Dan Gohman | 343f0c0 | 2008-11-19 23:18:57 +0000 | [diff] [blame] | 595 | MachineBasicBlock *ScheduleDAGSDNodes::EmitSchedule() { |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 596 | DenseMap<SDValue, unsigned> VRBaseMap; |
| 597 | DenseMap<SUnit*, unsigned> CopyVRBaseMap; |
| 598 | for (unsigned i = 0, e = Sequence.size(); i != e; i++) { |
| 599 | SUnit *SU = Sequence[i]; |
| 600 | if (!SU) { |
| 601 | // Null SUnit* is a noop. |
| 602 | EmitNoop(); |
| 603 | continue; |
| 604 | } |
Dan Gohman | f449bf3 | 2008-11-14 00:06:09 +0000 | [diff] [blame] | 605 | |
Dan Gohman | f449bf3 | 2008-11-14 00:06:09 +0000 | [diff] [blame] | 606 | // For pre-regalloc scheduling, create instructions corresponding to the |
| 607 | // SDNode and any flagged SDNodes and append them to the block. |
Evan Cheng | c29a56d | 2009-01-12 03:19:55 +0000 | [diff] [blame] | 608 | if (!SU->getNode()) { |
| 609 | // Emit a copy. |
| 610 | EmitPhysRegCopy(SU, CopyVRBaseMap); |
| 611 | continue; |
| 612 | } |
| 613 | |
Dan Gohman | d23e0f8 | 2008-11-13 23:24:17 +0000 | [diff] [blame] | 614 | SmallVector<SDNode *, 4> FlaggedNodes; |
Evan Cheng | e57187c | 2009-01-16 20:57:18 +0000 | [diff] [blame] | 615 | for (SDNode *N = SU->getNode()->getFlaggedNode(); N; |
| 616 | N = N->getFlaggedNode()) |
Dan Gohman | d23e0f8 | 2008-11-13 23:24:17 +0000 | [diff] [blame] | 617 | FlaggedNodes.push_back(N); |
| 618 | while (!FlaggedNodes.empty()) { |
Evan Cheng | e57187c | 2009-01-16 20:57:18 +0000 | [diff] [blame] | 619 | EmitNode(FlaggedNodes.back(), SU->OrigNode != SU, SU->isCloned,VRBaseMap); |
Dan Gohman | d23e0f8 | 2008-11-13 23:24:17 +0000 | [diff] [blame] | 620 | FlaggedNodes.pop_back(); |
| 621 | } |
Evan Cheng | e57187c | 2009-01-16 20:57:18 +0000 | [diff] [blame] | 622 | EmitNode(SU->getNode(), SU->OrigNode != SU, SU->isCloned, VRBaseMap); |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 623 | } |
| 624 | |
Dan Gohman | 94b8d7e | 2008-09-03 16:01:59 +0000 | [diff] [blame] | 625 | return BB; |
| 626 | } |