blob: b31bcbdc0b365b83da4d2d444033ce1277270d32 [file] [log] [blame]
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +00001//===-- MipsISelDAGToDAG.cpp - A dag to dag inst selector for Mips --------===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file defines an instruction selector for the MIPS target.
11//
12//===----------------------------------------------------------------------===//
13
14#define DEBUG_TYPE "mips-isel"
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000015#include "Mips.h"
16#include "MipsISelLowering.h"
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +000017#include "MipsMachineFunction.h"
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000018#include "MipsRegisterInfo.h"
19#include "MipsSubtarget.h"
20#include "MipsTargetMachine.h"
21#include "llvm/GlobalValue.h"
22#include "llvm/Instructions.h"
23#include "llvm/Intrinsics.h"
24#include "llvm/Support/CFG.h"
25#include "llvm/Type.h"
26#include "llvm/CodeGen/MachineConstantPool.h"
27#include "llvm/CodeGen/MachineFunction.h"
28#include "llvm/CodeGen/MachineFrameInfo.h"
29#include "llvm/CodeGen/MachineInstrBuilder.h"
Chris Lattner84bc5422007-12-31 04:13:23 +000030#include "llvm/CodeGen/MachineRegisterInfo.h"
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000031#include "llvm/CodeGen/SelectionDAGISel.h"
32#include "llvm/Target/TargetMachine.h"
33#include "llvm/Support/Compiler.h"
34#include "llvm/Support/Debug.h"
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000035using namespace llvm;
36
37//===----------------------------------------------------------------------===//
38// Instruction Selector Implementation
39//===----------------------------------------------------------------------===//
40
41//===----------------------------------------------------------------------===//
42// MipsDAGToDAGISel - MIPS specific code to select MIPS machine
43// instructions for SelectionDAG operations.
44//===----------------------------------------------------------------------===//
45namespace {
46
47class VISIBILITY_HIDDEN MipsDAGToDAGISel : public SelectionDAGISel {
48
49 /// TM - Keep a reference to MipsTargetMachine.
50 MipsTargetMachine &TM;
51
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000052 /// Subtarget - Keep a pointer to the MipsSubtarget around so that we can
53 /// make the right decision when generating code for different targets.
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000054 const MipsSubtarget &Subtarget;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000055
56public:
Dan Gohman1002c022008-07-07 18:00:37 +000057 explicit MipsDAGToDAGISel(MipsTargetMachine &tm) :
Dan Gohmanda8ac5f2008-10-03 16:55:19 +000058 SelectionDAGISel(*tm.getTargetLowering()),
59 TM(tm), Subtarget(tm.getSubtarget<MipsSubtarget>()) {}
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000060
Dan Gohmanf350b272008-08-23 02:25:05 +000061 virtual void InstructionSelect();
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000062
63 // Pass Name
64 virtual const char *getPassName() const {
65 return "MIPS DAG->DAG Pattern Instruction Selection";
66 }
67
68
69private:
70 // Include the pieces autogenerated from the target description.
71 #include "MipsGenDAGISel.inc"
72
Dan Gohman475871a2008-07-27 21:46:04 +000073 SDValue getGlobalBaseReg();
74 SDNode *Select(SDValue N);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000075
76 // Complex Pattern.
Dan Gohman475871a2008-07-27 21:46:04 +000077 bool SelectAddr(SDValue Op, SDValue N,
78 SDValue &Base, SDValue &Offset);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000079
80
81 // getI32Imm - Return a target constant with the specified
82 // value, of type i32.
Dan Gohman475871a2008-07-27 21:46:04 +000083 inline SDValue getI32Imm(unsigned Imm) {
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000084 return CurDAG->getTargetConstant(Imm, MVT::i32);
85 }
86
87
88 #ifndef NDEBUG
89 unsigned Indent;
90 #endif
91};
92
93}
94
Evan Chengdb8d56b2008-06-30 20:45:06 +000095/// InstructionSelect - This callback is invoked by
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000096/// SelectionDAGISel when it has created a SelectionDAG for us to codegen.
97void MipsDAGToDAGISel::
Dan Gohmanf350b272008-08-23 02:25:05 +000098InstructionSelect()
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000099{
100 DEBUG(BB->dump());
101 // Codegen the basic block.
102 #ifndef NDEBUG
103 DOUT << "===== Instruction selection begins:\n";
104 Indent = 0;
105 #endif
106
107 // Select target instructions for the DAG.
David Greene8ad4c002008-10-27 21:56:29 +0000108 SelectRoot(*CurDAG);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000109
110 #ifndef NDEBUG
111 DOUT << "===== Instruction selection ends:\n";
112 #endif
113
Dan Gohmanf350b272008-08-23 02:25:05 +0000114 CurDAG->RemoveDeadNodes();
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000115}
116
Bruno Cardoso Lopes753a9872007-11-12 19:49:57 +0000117/// getGlobalBaseReg - Output the instructions required to put the
118/// GOT address into a register.
Dan Gohman475871a2008-07-27 21:46:04 +0000119SDValue MipsDAGToDAGISel::getGlobalBaseReg() {
Bruno Cardoso Lopes753a9872007-11-12 19:49:57 +0000120 MachineFunction* MF = BB->getParent();
121 unsigned GP = 0;
Chris Lattner84bc5422007-12-31 04:13:23 +0000122 for(MachineRegisterInfo::livein_iterator ii = MF->getRegInfo().livein_begin(),
123 ee = MF->getRegInfo().livein_end(); ii != ee; ++ii)
Bruno Cardoso Lopes753a9872007-11-12 19:49:57 +0000124 if (ii->first == Mips::GP) {
125 GP = ii->second;
126 break;
127 }
128 assert(GP && "GOT PTR not in liveins");
129 return CurDAG->getCopyFromReg(CurDAG->getEntryNode(),
130 GP, MVT::i32);
131}
132
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000133/// ComplexPattern used on MipsInstrInfo
134/// Used on Mips Load/Store instructions
135bool MipsDAGToDAGISel::
Dan Gohman475871a2008-07-27 21:46:04 +0000136SelectAddr(SDValue Op, SDValue Addr, SDValue &Offset, SDValue &Base)
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000137{
138 // if Address is FI, get the TargetFrameIndex.
139 if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>(Addr)) {
140 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), MVT::i32);
141 Offset = CurDAG->getTargetConstant(0, MVT::i32);
142 return true;
143 }
144
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000145 // on PIC code Load GA
146 if (TM.getRelocationModel() == Reloc::PIC_) {
Bruno Cardoso Lopes753a9872007-11-12 19:49:57 +0000147 if ((Addr.getOpcode() == ISD::TargetGlobalAddress) ||
148 (Addr.getOpcode() == ISD::TargetJumpTable)){
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000149 Base = CurDAG->getRegister(Mips::GP, MVT::i32);
150 Offset = Addr;
151 return true;
152 }
153 } else {
Bill Wendling056292f2008-09-16 21:48:12 +0000154 if ((Addr.getOpcode() == ISD::TargetExternalSymbol ||
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000155 Addr.getOpcode() == ISD::TargetGlobalAddress))
156 return false;
157 }
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000158
Bruno Cardoso Lopes7ff6fa22007-08-18 02:16:30 +0000159 // Operand is a result from an ADD.
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000160 if (Addr.getOpcode() == ISD::ADD) {
161 if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Addr.getOperand(1))) {
162 if (Predicate_immSExt16(CN)) {
163
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000164 // If the first operand is a FI, get the TargetFI Node
165 if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>
166 (Addr.getOperand(0))) {
167 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), MVT::i32);
168 } else {
169 Base = Addr.getOperand(0);
170 }
171
Dan Gohmanf5aeb1a2008-09-12 16:56:44 +0000172 Offset = CurDAG->getTargetConstant(CN->getZExtValue(), MVT::i32);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000173 return true;
174 }
175 }
176 }
177
Bruno Cardoso Lopesa4e82002007-07-11 23:24:41 +0000178 Base = Addr;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000179 Offset = CurDAG->getTargetConstant(0, MVT::i32);
180 return true;
181}
182
183/// Select instructions not customized! Used for
184/// expanded, promoted and normal instructions
185SDNode* MipsDAGToDAGISel::
Dan Gohman475871a2008-07-27 21:46:04 +0000186Select(SDValue N)
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000187{
Gabor Greifba36cb52008-08-28 21:40:38 +0000188 SDNode *Node = N.getNode();
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000189 unsigned Opcode = Node->getOpcode();
190
191 // Dump information about the Node being selected
192 #ifndef NDEBUG
193 DOUT << std::string(Indent, ' ') << "Selecting: ";
194 DEBUG(Node->dump(CurDAG));
195 DOUT << "\n";
196 Indent += 2;
197 #endif
198
199 // If we have a custom node, we already have selected!
Dan Gohmane8be6c62008-07-17 19:10:17 +0000200 if (Node->isMachineOpcode()) {
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000201 #ifndef NDEBUG
202 DOUT << std::string(Indent-2, ' ') << "== ";
203 DEBUG(Node->dump(CurDAG));
204 DOUT << "\n";
205 Indent -= 2;
206 #endif
207 return NULL;
208 }
209
210 ///
Bruno Cardoso Lopesb42abeb2007-09-24 20:15:11 +0000211 // Instruction Selection not handled by the auto-generated
212 // tablegen selection should be handled here.
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000213 ///
214 switch(Opcode) {
215
216 default: break;
217
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000218 case ISD::SUBE:
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000219 case ISD::ADDE: {
Dan Gohman475871a2008-07-27 21:46:04 +0000220 SDValue InFlag = Node->getOperand(2), CmpLHS;
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000221 unsigned Opc = InFlag.getOpcode(), MOp;
222
223 assert(((Opc == ISD::ADDC || Opc == ISD::ADDE) ||
224 (Opc == ISD::SUBC || Opc == ISD::SUBE)) &&
225 "(ADD|SUB)E flag operand must come from (ADD|SUB)C/E insn");
226
227 if (Opcode == ISD::ADDE) {
228 CmpLHS = InFlag.getValue(0);
229 MOp = Mips::ADDu;
230 } else {
231 CmpLHS = InFlag.getOperand(0);
232 MOp = Mips::SUBu;
233 }
234
Dan Gohman475871a2008-07-27 21:46:04 +0000235 SDValue Ops[] = { CmpLHS, InFlag.getOperand(1) };
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000236
Dan Gohman475871a2008-07-27 21:46:04 +0000237 SDValue LHS = Node->getOperand(0);
238 SDValue RHS = Node->getOperand(1);
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000239 AddToISelQueue(LHS);
240 AddToISelQueue(RHS);
241
Duncan Sands83ec4b62008-06-06 12:08:01 +0000242 MVT VT = LHS.getValueType();
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000243 SDNode *Carry = CurDAG->getTargetNode(Mips::SLTu, VT, Ops, 2);
244 SDNode *AddCarry = CurDAG->getTargetNode(Mips::ADDu, VT,
Dan Gohman475871a2008-07-27 21:46:04 +0000245 SDValue(Carry,0), RHS);
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000246
Gabor Greifba36cb52008-08-28 21:40:38 +0000247 return CurDAG->SelectNodeTo(N.getNode(), MOp, VT, MVT::Flag,
Dan Gohman475871a2008-07-27 21:46:04 +0000248 LHS, SDValue(AddCarry,0));
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000249 }
250
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000251 /// Mul/Div with two results
252 case ISD::SDIVREM:
253 case ISD::UDIVREM:
254 case ISD::SMUL_LOHI:
255 case ISD::UMUL_LOHI: {
Dan Gohman475871a2008-07-27 21:46:04 +0000256 SDValue Op1 = Node->getOperand(0);
257 SDValue Op2 = Node->getOperand(1);
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000258 AddToISelQueue(Op1);
259 AddToISelQueue(Op2);
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000260
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000261 unsigned Op;
262 if (Opcode == ISD::UMUL_LOHI || Opcode == ISD::SMUL_LOHI)
263 Op = (Opcode == ISD::UMUL_LOHI ? Mips::MULTu : Mips::MULT);
264 else
265 Op = (Opcode == ISD::UDIVREM ? Mips::DIVu : Mips::DIV);
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000266
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000267 SDNode *Node = CurDAG->getTargetNode(Op, MVT::Flag, Op1, Op2);
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000268
Dan Gohman475871a2008-07-27 21:46:04 +0000269 SDValue InFlag = SDValue(Node, 0);
Bruno Cardoso Lopes7b76da12008-07-09 04:45:36 +0000270 SDNode *Lo = CurDAG->getTargetNode(Mips::MFLO, MVT::i32,
271 MVT::Flag, InFlag);
Dan Gohman475871a2008-07-27 21:46:04 +0000272 InFlag = SDValue(Lo,1);
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000273 SDNode *Hi = CurDAG->getTargetNode(Mips::MFHI, MVT::i32, InFlag);
274
275 if (!N.getValue(0).use_empty())
Dan Gohman475871a2008-07-27 21:46:04 +0000276 ReplaceUses(N.getValue(0), SDValue(Lo,0));
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000277
278 if (!N.getValue(1).use_empty())
Dan Gohman475871a2008-07-27 21:46:04 +0000279 ReplaceUses(N.getValue(1), SDValue(Hi,0));
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000280
281 return NULL;
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000282 }
283
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000284 /// Special Muls
285 case ISD::MUL:
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000286 case ISD::MULHS:
287 case ISD::MULHU: {
Dan Gohman475871a2008-07-27 21:46:04 +0000288 SDValue MulOp1 = Node->getOperand(0);
289 SDValue MulOp2 = Node->getOperand(1);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000290 AddToISelQueue(MulOp1);
291 AddToISelQueue(MulOp2);
292
293 unsigned MulOp = (Opcode == ISD::MULHU ? Mips::MULTu : Mips::MULT);
294 SDNode *MulNode = CurDAG->getTargetNode(MulOp, MVT::Flag, MulOp1, MulOp2);
295
Dan Gohman475871a2008-07-27 21:46:04 +0000296 SDValue InFlag = SDValue(MulNode, 0);
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000297
298 if (MulOp == ISD::MUL)
299 return CurDAG->getTargetNode(Mips::MFLO, MVT::i32, InFlag);
300 else
301 return CurDAG->getTargetNode(Mips::MFHI, MVT::i32, InFlag);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000302 }
303
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000304 /// Div/Rem operations
305 case ISD::SREM:
306 case ISD::UREM:
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000307 case ISD::SDIV:
308 case ISD::UDIV: {
Dan Gohman475871a2008-07-27 21:46:04 +0000309 SDValue Op1 = Node->getOperand(0);
310 SDValue Op2 = Node->getOperand(1);
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000311 AddToISelQueue(Op1);
312 AddToISelQueue(Op2);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000313
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000314 unsigned Op, MOp;
315 if (Opcode == ISD::SDIV || Opcode == ISD::UDIV) {
316 Op = (Opcode == ISD::SDIV ? Mips::DIV : Mips::DIVu);
317 MOp = Mips::MFLO;
318 } else {
319 Op = (Opcode == ISD::SREM ? Mips::DIV : Mips::DIVu);
320 MOp = Mips::MFHI;
321 }
322 SDNode *Node = CurDAG->getTargetNode(Op, MVT::Flag, Op1, Op2);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000323
Dan Gohman475871a2008-07-27 21:46:04 +0000324 SDValue InFlag = SDValue(Node, 0);
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000325 return CurDAG->getTargetNode(MOp, MVT::i32, InFlag);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000326 }
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000327
Bruno Cardoso Lopes753a9872007-11-12 19:49:57 +0000328 // Get target GOT address.
329 case ISD::GLOBAL_OFFSET_TABLE: {
Dan Gohman475871a2008-07-27 21:46:04 +0000330 SDValue Result = getGlobalBaseReg();
Bruno Cardoso Lopes753a9872007-11-12 19:49:57 +0000331 ReplaceUses(N, Result);
332 return NULL;
333 }
334
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000335 /// Handle direct and indirect calls when using PIC. On PIC, when
336 /// GOT is smaller than about 64k (small code) the GA target is
337 /// loaded with only one instruction. Otherwise GA's target must
338 /// be loaded with 3 instructions.
339 case MipsISD::JmpLink: {
340 if (TM.getRelocationModel() == Reloc::PIC_) {
341 //bool isCodeLarge = (TM.getCodeModel() == CodeModel::Large);
Dan Gohman475871a2008-07-27 21:46:04 +0000342 SDValue Chain = Node->getOperand(0);
343 SDValue Callee = Node->getOperand(1);
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000344 AddToISelQueue(Chain);
Dan Gohman475871a2008-07-27 21:46:04 +0000345 SDValue T9Reg = CurDAG->getRegister(Mips::T9, MVT::i32);
346 SDValue InFlag(0, 0);
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000347
348 if ( (isa<GlobalAddressSDNode>(Callee)) ||
Bill Wendling056292f2008-09-16 21:48:12 +0000349 (isa<ExternalSymbolSDNode>(Callee)) )
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000350 {
351 /// Direct call for global addresses and external symbols
Dan Gohman475871a2008-07-27 21:46:04 +0000352 SDValue GPReg = CurDAG->getRegister(Mips::GP, MVT::i32);
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000353
354 // Use load to get GOT target
Dan Gohman475871a2008-07-27 21:46:04 +0000355 SDValue Ops[] = { Callee, GPReg, Chain };
356 SDValue Load = SDValue(CurDAG->getTargetNode(Mips::LW, MVT::i32,
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000357 MVT::Other, Ops, 3), 0);
358 Chain = Load.getValue(1);
359 AddToISelQueue(Chain);
360
361 // Call target must be on T9
362 Chain = CurDAG->getCopyToReg(Chain, T9Reg, Load, InFlag);
363 } else
364 /// Indirect call
365 Chain = CurDAG->getCopyToReg(Chain, T9Reg, Callee, InFlag);
366
367 AddToISelQueue(Chain);
368
369 // Emit Jump and Link Register
370 SDNode *ResNode = CurDAG->getTargetNode(Mips::JALR, MVT::Other,
371 MVT::Flag, T9Reg, Chain);
Dan Gohman475871a2008-07-27 21:46:04 +0000372 Chain = SDValue(ResNode, 0);
373 InFlag = SDValue(ResNode, 1);
374 ReplaceUses(SDValue(Node, 0), Chain);
375 ReplaceUses(SDValue(Node, 1), InFlag);
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000376 return ResNode;
377 }
378 }
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000379 }
380
381 // Select the default instruction
382 SDNode *ResNode = SelectCode(N);
383
384 #ifndef NDEBUG
385 DOUT << std::string(Indent-2, ' ') << "=> ";
Gabor Greifba36cb52008-08-28 21:40:38 +0000386 if (ResNode == NULL || ResNode == N.getNode())
387 DEBUG(N.getNode()->dump(CurDAG));
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000388 else
389 DEBUG(ResNode->dump(CurDAG));
390 DOUT << "\n";
391 Indent -= 2;
392 #endif
393
394 return ResNode;
395}
396
397/// createMipsISelDag - This pass converts a legalized DAG into a
398/// MIPS-specific DAG, ready for instruction scheduling.
399FunctionPass *llvm::createMipsISelDag(MipsTargetMachine &TM) {
400 return new MipsDAGToDAGISel(TM);
401}