blob: a408a9623ca4d3f7d7b27335da65332ea1a6ffca [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"
35#include <queue>
36#include <set>
37
38using namespace llvm;
39
40//===----------------------------------------------------------------------===//
41// Instruction Selector Implementation
42//===----------------------------------------------------------------------===//
43
44//===----------------------------------------------------------------------===//
45// MipsDAGToDAGISel - MIPS specific code to select MIPS machine
46// instructions for SelectionDAG operations.
47//===----------------------------------------------------------------------===//
48namespace {
49
50class VISIBILITY_HIDDEN MipsDAGToDAGISel : public SelectionDAGISel {
51
52 /// TM - Keep a reference to MipsTargetMachine.
53 MipsTargetMachine &TM;
54
55 /// MipsLowering - This object fully describes how to lower LLVM code to an
56 /// Mips-specific SelectionDAG.
57 MipsTargetLowering MipsLowering;
58
59 /// Subtarget - Keep a pointer to the MipsSubtarget around so that we can
60 /// make the right decision when generating code for different targets.
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000061 const MipsSubtarget &Subtarget;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000062
63public:
Dan Gohman1002c022008-07-07 18:00:37 +000064 explicit MipsDAGToDAGISel(MipsTargetMachine &tm) :
65 SelectionDAGISel(MipsLowering),
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000066 TM(tm), MipsLowering(*TM.getTargetLowering()),
67 Subtarget(tm.getSubtarget<MipsSubtarget>()) {}
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000068
Dan Gohmanf350b272008-08-23 02:25:05 +000069 virtual void InstructionSelect();
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000070
71 // Pass Name
72 virtual const char *getPassName() const {
73 return "MIPS DAG->DAG Pattern Instruction Selection";
74 }
75
76
77private:
78 // Include the pieces autogenerated from the target description.
79 #include "MipsGenDAGISel.inc"
80
Dan Gohman475871a2008-07-27 21:46:04 +000081 SDValue getGlobalBaseReg();
82 SDNode *Select(SDValue N);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000083
84 // Complex Pattern.
Dan Gohman475871a2008-07-27 21:46:04 +000085 bool SelectAddr(SDValue Op, SDValue N,
86 SDValue &Base, SDValue &Offset);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000087
88
89 // getI32Imm - Return a target constant with the specified
90 // value, of type i32.
Dan Gohman475871a2008-07-27 21:46:04 +000091 inline SDValue getI32Imm(unsigned Imm) {
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000092 return CurDAG->getTargetConstant(Imm, MVT::i32);
93 }
94
95
96 #ifndef NDEBUG
97 unsigned Indent;
98 #endif
99};
100
101}
102
Evan Chengdb8d56b2008-06-30 20:45:06 +0000103/// InstructionSelect - This callback is invoked by
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000104/// SelectionDAGISel when it has created a SelectionDAG for us to codegen.
105void MipsDAGToDAGISel::
Dan Gohmanf350b272008-08-23 02:25:05 +0000106InstructionSelect()
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000107{
108 DEBUG(BB->dump());
109 // Codegen the basic block.
110 #ifndef NDEBUG
111 DOUT << "===== Instruction selection begins:\n";
112 Indent = 0;
113 #endif
114
115 // Select target instructions for the DAG.
Dan Gohmanad3460c2008-08-21 16:36:34 +0000116 SelectRoot();
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000117
118 #ifndef NDEBUG
119 DOUT << "===== Instruction selection ends:\n";
120 #endif
121
Dan Gohmanf350b272008-08-23 02:25:05 +0000122 CurDAG->RemoveDeadNodes();
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000123}
124
Bruno Cardoso Lopes753a9872007-11-12 19:49:57 +0000125/// getGlobalBaseReg - Output the instructions required to put the
126/// GOT address into a register.
Dan Gohman475871a2008-07-27 21:46:04 +0000127SDValue MipsDAGToDAGISel::getGlobalBaseReg() {
Bruno Cardoso Lopes753a9872007-11-12 19:49:57 +0000128 MachineFunction* MF = BB->getParent();
129 unsigned GP = 0;
Chris Lattner84bc5422007-12-31 04:13:23 +0000130 for(MachineRegisterInfo::livein_iterator ii = MF->getRegInfo().livein_begin(),
131 ee = MF->getRegInfo().livein_end(); ii != ee; ++ii)
Bruno Cardoso Lopes753a9872007-11-12 19:49:57 +0000132 if (ii->first == Mips::GP) {
133 GP = ii->second;
134 break;
135 }
136 assert(GP && "GOT PTR not in liveins");
137 return CurDAG->getCopyFromReg(CurDAG->getEntryNode(),
138 GP, MVT::i32);
139}
140
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000141/// ComplexPattern used on MipsInstrInfo
142/// Used on Mips Load/Store instructions
143bool MipsDAGToDAGISel::
Dan Gohman475871a2008-07-27 21:46:04 +0000144SelectAddr(SDValue Op, SDValue Addr, SDValue &Offset, SDValue &Base)
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000145{
146 // if Address is FI, get the TargetFrameIndex.
147 if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>(Addr)) {
148 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), MVT::i32);
149 Offset = CurDAG->getTargetConstant(0, MVT::i32);
150 return true;
151 }
152
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000153 // on PIC code Load GA
154 if (TM.getRelocationModel() == Reloc::PIC_) {
Bruno Cardoso Lopes753a9872007-11-12 19:49:57 +0000155 if ((Addr.getOpcode() == ISD::TargetGlobalAddress) ||
156 (Addr.getOpcode() == ISD::TargetJumpTable)){
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000157 Base = CurDAG->getRegister(Mips::GP, MVT::i32);
158 Offset = Addr;
159 return true;
160 }
161 } else {
Bill Wendling056292f2008-09-16 21:48:12 +0000162 if ((Addr.getOpcode() == ISD::TargetExternalSymbol ||
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000163 Addr.getOpcode() == ISD::TargetGlobalAddress))
164 return false;
165 }
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000166
Bruno Cardoso Lopes7ff6fa22007-08-18 02:16:30 +0000167 // Operand is a result from an ADD.
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000168 if (Addr.getOpcode() == ISD::ADD) {
169 if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Addr.getOperand(1))) {
170 if (Predicate_immSExt16(CN)) {
171
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000172 // If the first operand is a FI, get the TargetFI Node
173 if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>
174 (Addr.getOperand(0))) {
175 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), MVT::i32);
176 } else {
177 Base = Addr.getOperand(0);
178 }
179
Dan Gohmanf5aeb1a2008-09-12 16:56:44 +0000180 Offset = CurDAG->getTargetConstant(CN->getZExtValue(), MVT::i32);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000181 return true;
182 }
183 }
184 }
185
Bruno Cardoso Lopesa4e82002007-07-11 23:24:41 +0000186 Base = Addr;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000187 Offset = CurDAG->getTargetConstant(0, MVT::i32);
188 return true;
189}
190
191/// Select instructions not customized! Used for
192/// expanded, promoted and normal instructions
193SDNode* MipsDAGToDAGISel::
Dan Gohman475871a2008-07-27 21:46:04 +0000194Select(SDValue N)
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000195{
Gabor Greifba36cb52008-08-28 21:40:38 +0000196 SDNode *Node = N.getNode();
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000197 unsigned Opcode = Node->getOpcode();
198
199 // Dump information about the Node being selected
200 #ifndef NDEBUG
201 DOUT << std::string(Indent, ' ') << "Selecting: ";
202 DEBUG(Node->dump(CurDAG));
203 DOUT << "\n";
204 Indent += 2;
205 #endif
206
207 // If we have a custom node, we already have selected!
Dan Gohmane8be6c62008-07-17 19:10:17 +0000208 if (Node->isMachineOpcode()) {
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000209 #ifndef NDEBUG
210 DOUT << std::string(Indent-2, ' ') << "== ";
211 DEBUG(Node->dump(CurDAG));
212 DOUT << "\n";
213 Indent -= 2;
214 #endif
215 return NULL;
216 }
217
218 ///
Bruno Cardoso Lopesb42abeb2007-09-24 20:15:11 +0000219 // Instruction Selection not handled by the auto-generated
220 // tablegen selection should be handled here.
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000221 ///
222 switch(Opcode) {
223
224 default: break;
225
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000226 case ISD::SUBE:
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000227 case ISD::ADDE: {
Dan Gohman475871a2008-07-27 21:46:04 +0000228 SDValue InFlag = Node->getOperand(2), CmpLHS;
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000229 unsigned Opc = InFlag.getOpcode(), MOp;
230
231 assert(((Opc == ISD::ADDC || Opc == ISD::ADDE) ||
232 (Opc == ISD::SUBC || Opc == ISD::SUBE)) &&
233 "(ADD|SUB)E flag operand must come from (ADD|SUB)C/E insn");
234
235 if (Opcode == ISD::ADDE) {
236 CmpLHS = InFlag.getValue(0);
237 MOp = Mips::ADDu;
238 } else {
239 CmpLHS = InFlag.getOperand(0);
240 MOp = Mips::SUBu;
241 }
242
Dan Gohman475871a2008-07-27 21:46:04 +0000243 SDValue Ops[] = { CmpLHS, InFlag.getOperand(1) };
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000244
Dan Gohman475871a2008-07-27 21:46:04 +0000245 SDValue LHS = Node->getOperand(0);
246 SDValue RHS = Node->getOperand(1);
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000247 AddToISelQueue(LHS);
248 AddToISelQueue(RHS);
249
Duncan Sands83ec4b62008-06-06 12:08:01 +0000250 MVT VT = LHS.getValueType();
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000251 SDNode *Carry = CurDAG->getTargetNode(Mips::SLTu, VT, Ops, 2);
252 SDNode *AddCarry = CurDAG->getTargetNode(Mips::ADDu, VT,
Dan Gohman475871a2008-07-27 21:46:04 +0000253 SDValue(Carry,0), RHS);
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000254
Gabor Greifba36cb52008-08-28 21:40:38 +0000255 return CurDAG->SelectNodeTo(N.getNode(), MOp, VT, MVT::Flag,
Dan Gohman475871a2008-07-27 21:46:04 +0000256 LHS, SDValue(AddCarry,0));
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000257 }
258
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000259 /// Mul/Div with two results
260 case ISD::SDIVREM:
261 case ISD::UDIVREM:
262 case ISD::SMUL_LOHI:
263 case ISD::UMUL_LOHI: {
Dan Gohman475871a2008-07-27 21:46:04 +0000264 SDValue Op1 = Node->getOperand(0);
265 SDValue Op2 = Node->getOperand(1);
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000266 AddToISelQueue(Op1);
267 AddToISelQueue(Op2);
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000268
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000269 unsigned Op;
270 if (Opcode == ISD::UMUL_LOHI || Opcode == ISD::SMUL_LOHI)
271 Op = (Opcode == ISD::UMUL_LOHI ? Mips::MULTu : Mips::MULT);
272 else
273 Op = (Opcode == ISD::UDIVREM ? Mips::DIVu : Mips::DIV);
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000274
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000275 SDNode *Node = CurDAG->getTargetNode(Op, MVT::Flag, Op1, Op2);
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000276
Dan Gohman475871a2008-07-27 21:46:04 +0000277 SDValue InFlag = SDValue(Node, 0);
Bruno Cardoso Lopes7b76da12008-07-09 04:45:36 +0000278 SDNode *Lo = CurDAG->getTargetNode(Mips::MFLO, MVT::i32,
279 MVT::Flag, InFlag);
Dan Gohman475871a2008-07-27 21:46:04 +0000280 InFlag = SDValue(Lo,1);
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000281 SDNode *Hi = CurDAG->getTargetNode(Mips::MFHI, MVT::i32, InFlag);
282
283 if (!N.getValue(0).use_empty())
Dan Gohman475871a2008-07-27 21:46:04 +0000284 ReplaceUses(N.getValue(0), SDValue(Lo,0));
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000285
286 if (!N.getValue(1).use_empty())
Dan Gohman475871a2008-07-27 21:46:04 +0000287 ReplaceUses(N.getValue(1), SDValue(Hi,0));
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000288
289 return NULL;
Bruno Cardoso Lopes07cec752008-06-06 00:58:26 +0000290 }
291
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000292 /// Special Muls
293 case ISD::MUL:
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000294 case ISD::MULHS:
295 case ISD::MULHU: {
Dan Gohman475871a2008-07-27 21:46:04 +0000296 SDValue MulOp1 = Node->getOperand(0);
297 SDValue MulOp2 = Node->getOperand(1);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000298 AddToISelQueue(MulOp1);
299 AddToISelQueue(MulOp2);
300
301 unsigned MulOp = (Opcode == ISD::MULHU ? Mips::MULTu : Mips::MULT);
302 SDNode *MulNode = CurDAG->getTargetNode(MulOp, MVT::Flag, MulOp1, MulOp2);
303
Dan Gohman475871a2008-07-27 21:46:04 +0000304 SDValue InFlag = SDValue(MulNode, 0);
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000305
306 if (MulOp == ISD::MUL)
307 return CurDAG->getTargetNode(Mips::MFLO, MVT::i32, InFlag);
308 else
309 return CurDAG->getTargetNode(Mips::MFHI, MVT::i32, InFlag);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000310 }
311
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000312 /// Div/Rem operations
313 case ISD::SREM:
314 case ISD::UREM:
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000315 case ISD::SDIV:
316 case ISD::UDIV: {
Dan Gohman475871a2008-07-27 21:46:04 +0000317 SDValue Op1 = Node->getOperand(0);
318 SDValue Op2 = Node->getOperand(1);
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000319 AddToISelQueue(Op1);
320 AddToISelQueue(Op2);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000321
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000322 unsigned Op, MOp;
323 if (Opcode == ISD::SDIV || Opcode == ISD::UDIV) {
324 Op = (Opcode == ISD::SDIV ? Mips::DIV : Mips::DIVu);
325 MOp = Mips::MFLO;
326 } else {
327 Op = (Opcode == ISD::SREM ? Mips::DIV : Mips::DIVu);
328 MOp = Mips::MFHI;
329 }
330 SDNode *Node = CurDAG->getTargetNode(Op, MVT::Flag, Op1, Op2);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000331
Dan Gohman475871a2008-07-27 21:46:04 +0000332 SDValue InFlag = SDValue(Node, 0);
Bruno Cardoso Lopes0af5e092008-06-06 06:37:31 +0000333 return CurDAG->getTargetNode(MOp, MVT::i32, InFlag);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000334 }
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000335
Bruno Cardoso Lopes753a9872007-11-12 19:49:57 +0000336 // Get target GOT address.
337 case ISD::GLOBAL_OFFSET_TABLE: {
Dan Gohman475871a2008-07-27 21:46:04 +0000338 SDValue Result = getGlobalBaseReg();
Bruno Cardoso Lopes753a9872007-11-12 19:49:57 +0000339 ReplaceUses(N, Result);
340 return NULL;
341 }
342
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000343 /// Handle direct and indirect calls when using PIC. On PIC, when
344 /// GOT is smaller than about 64k (small code) the GA target is
345 /// loaded with only one instruction. Otherwise GA's target must
346 /// be loaded with 3 instructions.
347 case MipsISD::JmpLink: {
348 if (TM.getRelocationModel() == Reloc::PIC_) {
349 //bool isCodeLarge = (TM.getCodeModel() == CodeModel::Large);
Dan Gohman475871a2008-07-27 21:46:04 +0000350 SDValue Chain = Node->getOperand(0);
351 SDValue Callee = Node->getOperand(1);
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000352 AddToISelQueue(Chain);
Dan Gohman475871a2008-07-27 21:46:04 +0000353 SDValue T9Reg = CurDAG->getRegister(Mips::T9, MVT::i32);
354 SDValue InFlag(0, 0);
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000355
356 if ( (isa<GlobalAddressSDNode>(Callee)) ||
Bill Wendling056292f2008-09-16 21:48:12 +0000357 (isa<ExternalSymbolSDNode>(Callee)) )
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000358 {
359 /// Direct call for global addresses and external symbols
Dan Gohman475871a2008-07-27 21:46:04 +0000360 SDValue GPReg = CurDAG->getRegister(Mips::GP, MVT::i32);
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000361
362 // Use load to get GOT target
Dan Gohman475871a2008-07-27 21:46:04 +0000363 SDValue Ops[] = { Callee, GPReg, Chain };
364 SDValue Load = SDValue(CurDAG->getTargetNode(Mips::LW, MVT::i32,
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000365 MVT::Other, Ops, 3), 0);
366 Chain = Load.getValue(1);
367 AddToISelQueue(Chain);
368
369 // Call target must be on T9
370 Chain = CurDAG->getCopyToReg(Chain, T9Reg, Load, InFlag);
371 } else
372 /// Indirect call
373 Chain = CurDAG->getCopyToReg(Chain, T9Reg, Callee, InFlag);
374
375 AddToISelQueue(Chain);
376
377 // Emit Jump and Link Register
378 SDNode *ResNode = CurDAG->getTargetNode(Mips::JALR, MVT::Other,
379 MVT::Flag, T9Reg, Chain);
Dan Gohman475871a2008-07-27 21:46:04 +0000380 Chain = SDValue(ResNode, 0);
381 InFlag = SDValue(ResNode, 1);
382 ReplaceUses(SDValue(Node, 0), Chain);
383 ReplaceUses(SDValue(Node, 1), InFlag);
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +0000384 return ResNode;
385 }
386 }
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000387 }
388
389 // Select the default instruction
390 SDNode *ResNode = SelectCode(N);
391
392 #ifndef NDEBUG
393 DOUT << std::string(Indent-2, ' ') << "=> ";
Gabor Greifba36cb52008-08-28 21:40:38 +0000394 if (ResNode == NULL || ResNode == N.getNode())
395 DEBUG(N.getNode()->dump(CurDAG));
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000396 else
397 DEBUG(ResNode->dump(CurDAG));
398 DOUT << "\n";
399 Indent -= 2;
400 #endif
401
402 return ResNode;
403}
404
405/// createMipsISelDag - This pass converts a legalized DAG into a
406/// MIPS-specific DAG, ready for instruction scheduling.
407FunctionPass *llvm::createMipsISelDag(MipsTargetMachine &TM) {
408 return new MipsDAGToDAGISel(TM);
409}