blob: c8bd7bf2d84e230e02ffec3e798000fbc3799659 [file] [log] [blame]
Eric Christopher50880d02010-09-18 18:52:28 +00001//===-- PTXISelLowering.cpp - PTX DAG Lowering Implementation -------------===//
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 file implements the PTXTargetLowering class.
11//
12//===----------------------------------------------------------------------===//
13
Che-Liang Chioub48f2c22010-10-19 13:14:40 +000014#include "PTX.h"
Eric Christopher50880d02010-09-18 18:52:28 +000015#include "PTXISelLowering.h"
Che-Liang Chiou3278c422010-11-08 03:00:52 +000016#include "PTXMachineFunctionInfo.h"
Eric Christopher50880d02010-09-18 18:52:28 +000017#include "PTXRegisterInfo.h"
Justin Holewinski67a91842011-06-23 18:10:03 +000018#include "PTXSubtarget.h"
Eric Christopher50880d02010-09-18 18:52:28 +000019#include "llvm/Support/ErrorHandling.h"
Justin Holewinskie0aef2d2011-06-16 17:50:00 +000020#include "llvm/CodeGen/CallingConvLower.h"
Che-Liang Chioub48f2c22010-10-19 13:14:40 +000021#include "llvm/CodeGen/MachineFunction.h"
22#include "llvm/CodeGen/MachineRegisterInfo.h"
Eric Christopher50880d02010-09-18 18:52:28 +000023#include "llvm/CodeGen/SelectionDAG.h"
24#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
Justin Holewinski4bdd4ed2011-08-09 17:36:31 +000025#include "llvm/Support/Debug.h"
Che-Liang Chioufd8978b2011-03-02 03:20:28 +000026#include "llvm/Support/raw_ostream.h"
Eric Christopher50880d02010-09-18 18:52:28 +000027
28using namespace llvm;
29
Justin Holewinskie0aef2d2011-06-16 17:50:00 +000030//===----------------------------------------------------------------------===//
31// Calling Convention Implementation
32//===----------------------------------------------------------------------===//
33
34#include "PTXGenCallingConv.inc"
35
36//===----------------------------------------------------------------------===//
37// TargetLowering Implementation
38//===----------------------------------------------------------------------===//
39
Eric Christopher50880d02010-09-18 18:52:28 +000040PTXTargetLowering::PTXTargetLowering(TargetMachine &TM)
41 : TargetLowering(TM, new TargetLoweringObjectFileELF()) {
42 // Set up the register classes.
Justin Holewinski1b91bcd2011-06-16 17:49:58 +000043 addRegisterClass(MVT::i1, PTX::RegPredRegisterClass);
44 addRegisterClass(MVT::i16, PTX::RegI16RegisterClass);
45 addRegisterClass(MVT::i32, PTX::RegI32RegisterClass);
46 addRegisterClass(MVT::i64, PTX::RegI64RegisterClass);
47 addRegisterClass(MVT::f32, PTX::RegF32RegisterClass);
48 addRegisterClass(MVT::f64, PTX::RegF64RegisterClass);
Che-Liang Chioufd8978b2011-03-02 03:20:28 +000049
Justin Holewinski4fea05a2011-04-28 00:19:52 +000050 setBooleanContents(ZeroOrOneBooleanContent);
Duncan Sands28b77e92011-09-06 19:07:46 +000051 setBooleanVectorContents(ZeroOrOneBooleanContent); // FIXME: Is this correct?
Dan Bailey84149462011-06-25 18:16:28 +000052 setMinFunctionAlignment(2);
Dan Baileyb05a8a82011-06-24 19:27:10 +000053
Dan Bailey84149462011-06-25 18:16:28 +000054 ////////////////////////////////////
55 /////////// Expansion //////////////
56 ////////////////////////////////////
Dan Baileyb05a8a82011-06-24 19:27:10 +000057
Dan Bailey84149462011-06-25 18:16:28 +000058 // (any/zero/sign) extload => load + (any/zero/sign) extend
Dan Baileyb05a8a82011-06-24 19:27:10 +000059
Justin Holewinski4fea05a2011-04-28 00:19:52 +000060 setLoadExtAction(ISD::EXTLOAD, MVT::i16, Expand);
61 setLoadExtAction(ISD::ZEXTLOAD, MVT::i16, Expand);
Dan Baileyb05a8a82011-06-24 19:27:10 +000062 setLoadExtAction(ISD::SEXTLOAD, MVT::i16, Expand);
Dan Bailey84149462011-06-25 18:16:28 +000063
64 // f32 extload => load + fextend
65
66 setLoadExtAction(ISD::EXTLOAD, MVT::f32, Expand);
67
68 // f64 truncstore => trunc + store
69
70 setTruncStoreAction(MVT::f64, MVT::f32, Expand);
71
72 // sign_extend_inreg => sign_extend
73
74 setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i1, Expand);
75
76 // br_cc => brcond
77
Che-Liang Chiou88d33672011-03-18 11:08:52 +000078 setOperationAction(ISD::BR_CC, MVT::Other, Expand);
79
Dan Bailey84149462011-06-25 18:16:28 +000080 // select_cc => setcc
81
Justin Holewinski2d525c52011-04-28 00:19:56 +000082 setOperationAction(ISD::SELECT_CC, MVT::Other, Expand);
83 setOperationAction(ISD::SELECT_CC, MVT::f32, Expand);
84 setOperationAction(ISD::SELECT_CC, MVT::f64, Expand);
Dan Bailey84149462011-06-25 18:16:28 +000085
86 ////////////////////////////////////
87 //////////// Legal /////////////////
88 ////////////////////////////////////
89
90 setOperationAction(ISD::ConstantFP, MVT::f32, Legal);
91 setOperationAction(ISD::ConstantFP, MVT::f64, Legal);
92
93 ////////////////////////////////////
94 //////////// Custom ////////////////
95 ////////////////////////////////////
96
97 // customise setcc to use bitwise logic if possible
98
Justin Holewinski2d525c52011-04-28 00:19:56 +000099 setOperationAction(ISD::SETCC, MVT::i1, Custom);
Eli Friedmanfc5d3052011-05-06 20:34:06 +0000100
Dan Bailey84149462011-06-25 18:16:28 +0000101 // customize translation of memory addresses
102
103 setOperationAction(ISD::GlobalAddress, MVT::i32, Custom);
104 setOperationAction(ISD::GlobalAddress, MVT::i64, Custom);
Eli Friedmanfc5d3052011-05-06 20:34:06 +0000105
Eric Christopher50880d02010-09-18 18:52:28 +0000106 // Compute derived properties from the register classes
107 computeRegisterProperties();
108}
109
Duncan Sands28b77e92011-09-06 19:07:46 +0000110EVT PTXTargetLowering::getSetCCResultType(EVT VT) const {
Justin Holewinski2d525c52011-04-28 00:19:56 +0000111 return MVT::i1;
112}
113
Che-Liang Chioufc7072c2010-12-22 10:38:51 +0000114SDValue PTXTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
115 switch (Op.getOpcode()) {
Che-Liang Chiou88d33672011-03-18 11:08:52 +0000116 default:
117 llvm_unreachable("Unimplemented operand");
Justin Holewinski2d525c52011-04-28 00:19:56 +0000118 case ISD::SETCC:
119 return LowerSETCC(Op, DAG);
Che-Liang Chiou88d33672011-03-18 11:08:52 +0000120 case ISD::GlobalAddress:
121 return LowerGlobalAddress(Op, DAG);
Che-Liang Chioufc7072c2010-12-22 10:38:51 +0000122 }
123}
124
Eric Christopher50880d02010-09-18 18:52:28 +0000125const char *PTXTargetLowering::getTargetNodeName(unsigned Opcode) const {
126 switch (Opcode) {
Che-Liang Chiou8e5d01c2011-02-10 12:01:24 +0000127 default:
128 llvm_unreachable("Unknown opcode");
Justin Holewinski8af78c92011-03-18 19:24:28 +0000129 case PTXISD::COPY_ADDRESS:
130 return "PTXISD::COPY_ADDRESS";
Justin Holewinskia5ccb4e2011-06-23 18:10:05 +0000131 case PTXISD::LOAD_PARAM:
132 return "PTXISD::LOAD_PARAM";
Justin Holewinski67a91842011-06-23 18:10:03 +0000133 case PTXISD::STORE_PARAM:
134 return "PTXISD::STORE_PARAM";
Che-Liang Chiou8e5d01c2011-02-10 12:01:24 +0000135 case PTXISD::EXIT:
136 return "PTXISD::EXIT";
137 case PTXISD::RET:
138 return "PTXISD::RET";
Justin Holewinski4bdd4ed2011-08-09 17:36:31 +0000139 case PTXISD::CALL:
140 return "PTXISD::CALL";
Eric Christopher50880d02010-09-18 18:52:28 +0000141 }
142}
143
144//===----------------------------------------------------------------------===//
Che-Liang Chioufc7072c2010-12-22 10:38:51 +0000145// Custom Lower Operation
146//===----------------------------------------------------------------------===//
147
Justin Holewinski2d525c52011-04-28 00:19:56 +0000148SDValue PTXTargetLowering::LowerSETCC(SDValue Op, SelectionDAG &DAG) const {
149 assert(Op.getValueType() == MVT::i1 && "SetCC type must be 1-bit integer");
150 SDValue Op0 = Op.getOperand(0);
151 SDValue Op1 = Op.getOperand(1);
152 SDValue Op2 = Op.getOperand(2);
153 DebugLoc dl = Op.getDebugLoc();
154 ISD::CondCode CC = cast<CondCodeSDNode>(Op.getOperand(2))->get();
Justin Holewinskiec3141b2011-06-16 15:17:11 +0000155
Justin Holewinski2d525c52011-04-28 00:19:56 +0000156 // Look for X == 0, X == 1, X != 0, or X != 1
157 // We can simplify these to bitwise logic
Justin Holewinskiec3141b2011-06-16 15:17:11 +0000158
Justin Holewinski2d525c52011-04-28 00:19:56 +0000159 if (Op1.getOpcode() == ISD::Constant &&
160 (cast<ConstantSDNode>(Op1)->getZExtValue() == 1 ||
161 cast<ConstantSDNode>(Op1)->isNullValue()) &&
162 (CC == ISD::SETEQ || CC == ISD::SETNE)) {
163
Justin Holewinskiec3141b2011-06-16 15:17:11 +0000164 return DAG.getNode(ISD::AND, dl, MVT::i1, Op0, Op1);
Justin Holewinski2d525c52011-04-28 00:19:56 +0000165 }
Justin Holewinskiec3141b2011-06-16 15:17:11 +0000166
Justin Holewinski2d525c52011-04-28 00:19:56 +0000167 return DAG.getNode(ISD::SETCC, dl, MVT::i1, Op0, Op1, Op2);
168}
169
Che-Liang Chioufc7072c2010-12-22 10:38:51 +0000170SDValue PTXTargetLowering::
171LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const {
172 EVT PtrVT = getPointerTy();
173 DebugLoc dl = Op.getDebugLoc();
174 const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
Justin Holewinski8af78c92011-03-18 19:24:28 +0000175
Justin Holewinskid6625762011-03-23 16:58:51 +0000176 assert(PtrVT.isSimple() && "Pointer must be to primitive type.");
177
Justin Holewinski8af78c92011-03-18 19:24:28 +0000178 SDValue targetGlobal = DAG.getTargetGlobalAddress(GV, dl, PtrVT);
179 SDValue movInstr = DAG.getNode(PTXISD::COPY_ADDRESS,
180 dl,
Justin Holewinskid6625762011-03-23 16:58:51 +0000181 PtrVT.getSimpleVT(),
Justin Holewinski8af78c92011-03-18 19:24:28 +0000182 targetGlobal);
183
184 return movInstr;
Che-Liang Chioufc7072c2010-12-22 10:38:51 +0000185}
186
187//===----------------------------------------------------------------------===//
Eric Christopher50880d02010-09-18 18:52:28 +0000188// Calling Convention Implementation
189//===----------------------------------------------------------------------===//
190
191SDValue PTXTargetLowering::
192 LowerFormalArguments(SDValue Chain,
193 CallingConv::ID CallConv,
194 bool isVarArg,
195 const SmallVectorImpl<ISD::InputArg> &Ins,
196 DebugLoc dl,
197 SelectionDAG &DAG,
198 SmallVectorImpl<SDValue> &InVals) const {
Che-Liang Chioub48f2c22010-10-19 13:14:40 +0000199 if (isVarArg) llvm_unreachable("PTX does not support varargs");
200
Che-Liang Chiou3278c422010-11-08 03:00:52 +0000201 MachineFunction &MF = DAG.getMachineFunction();
Justin Holewinski67a91842011-06-23 18:10:03 +0000202 const PTXSubtarget& ST = getTargetMachine().getSubtarget<PTXSubtarget>();
Che-Liang Chiou3278c422010-11-08 03:00:52 +0000203 PTXMachineFunctionInfo *MFI = MF.getInfo<PTXMachineFunctionInfo>();
204
Che-Liang Chioub48f2c22010-10-19 13:14:40 +0000205 switch (CallConv) {
206 default:
207 llvm_unreachable("Unsupported calling convention");
208 break;
209 case CallingConv::PTX_Kernel:
Che-Liang Chiou8e5d01c2011-02-10 12:01:24 +0000210 MFI->setKernel(true);
Che-Liang Chioub48f2c22010-10-19 13:14:40 +0000211 break;
212 case CallingConv::PTX_Device:
Che-Liang Chiou3278c422010-11-08 03:00:52 +0000213 MFI->setKernel(false);
Che-Liang Chioub48f2c22010-10-19 13:14:40 +0000214 break;
215 }
216
Justin Holewinski67a91842011-06-23 18:10:03 +0000217 // We do one of two things here:
218 // IsKernel || SM >= 2.0 -> Use param space for arguments
219 // SM < 2.0 -> Use registers for arguments
Justin Holewinski35f4fb32011-06-24 16:27:49 +0000220 if (MFI->isKernel() || ST.useParamSpaceForDeviceArgs()) {
Justin Holewinskia5ccb4e2011-06-23 18:10:05 +0000221 // We just need to emit the proper LOAD_PARAM ISDs
Justin Holewinskie0aef2d2011-06-16 17:50:00 +0000222 for (unsigned i = 0, e = Ins.size(); i != e; ++i) {
Che-Liang Chiou8e5d01c2011-02-10 12:01:24 +0000223
Justin Holewinski67a91842011-06-23 18:10:03 +0000224 assert((!MFI->isKernel() || Ins[i].VT != MVT::i1) &&
225 "Kernels cannot take pred operands");
Che-Liang Chioub48f2c22010-10-19 13:14:40 +0000226
Justin Holewinskia5ccb4e2011-06-23 18:10:05 +0000227 SDValue ArgValue = DAG.getNode(PTXISD::LOAD_PARAM, dl, Ins[i].VT, Chain,
Justin Holewinskie0aef2d2011-06-16 17:50:00 +0000228 DAG.getTargetConstant(i, MVT::i32));
229 InVals.push_back(ArgValue);
Che-Liang Chioub48f2c22010-10-19 13:14:40 +0000230
Justin Holewinskie0aef2d2011-06-16 17:50:00 +0000231 // Instead of storing a physical register in our argument list, we just
232 // store the total size of the parameter, in bits. The ASM printer
233 // knows how to process this.
234 MFI->addArgReg(Ins[i].VT.getStoreSizeInBits());
235 }
Che-Liang Chioub48f2c22010-10-19 13:14:40 +0000236 }
Justin Holewinskie0aef2d2011-06-16 17:50:00 +0000237 else {
238 // For device functions, we use the PTX calling convention to do register
239 // assignments then create CopyFromReg ISDs for the allocated registers
Che-Liang Chioub48f2c22010-10-19 13:14:40 +0000240
Justin Holewinskie0aef2d2011-06-16 17:50:00 +0000241 SmallVector<CCValAssign, 16> ArgLocs;
242 CCState CCInfo(CallConv, isVarArg, MF, getTargetMachine(), ArgLocs,
243 *DAG.getContext());
244
245 CCInfo.AnalyzeFormalArguments(Ins, CC_PTX);
246
247 for (unsigned i = 0, e = ArgLocs.size(); i != e; ++i) {
248
249 CCValAssign& VA = ArgLocs[i];
250 EVT RegVT = VA.getLocVT();
251 TargetRegisterClass* TRC = 0;
252
253 assert(VA.isRegLoc() && "CCValAssign must be RegLoc");
254
255 // Determine which register class we need
256 if (RegVT == MVT::i1) {
257 TRC = PTX::RegPredRegisterClass;
258 }
259 else if (RegVT == MVT::i16) {
260 TRC = PTX::RegI16RegisterClass;
261 }
262 else if (RegVT == MVT::i32) {
263 TRC = PTX::RegI32RegisterClass;
264 }
265 else if (RegVT == MVT::i64) {
266 TRC = PTX::RegI64RegisterClass;
267 }
268 else if (RegVT == MVT::f32) {
269 TRC = PTX::RegF32RegisterClass;
270 }
271 else if (RegVT == MVT::f64) {
272 TRC = PTX::RegF64RegisterClass;
273 }
274 else {
275 llvm_unreachable("Unknown parameter type");
276 }
277
278 unsigned Reg = MF.getRegInfo().createVirtualRegister(TRC);
279 MF.getRegInfo().addLiveIn(VA.getLocReg(), Reg);
280
281 SDValue ArgValue = DAG.getCopyFromReg(Chain, dl, Reg, RegVT);
282 InVals.push_back(ArgValue);
283
284 MFI->addArgReg(VA.getLocReg());
285 }
286 }
Che-Liang Chiou3278c422010-11-08 03:00:52 +0000287
Eric Christopher50880d02010-09-18 18:52:28 +0000288 return Chain;
289}
290
291SDValue PTXTargetLowering::
292 LowerReturn(SDValue Chain,
293 CallingConv::ID CallConv,
294 bool isVarArg,
295 const SmallVectorImpl<ISD::OutputArg> &Outs,
296 const SmallVectorImpl<SDValue> &OutVals,
297 DebugLoc dl,
298 SelectionDAG &DAG) const {
Che-Liang Chioub48f2c22010-10-19 13:14:40 +0000299 if (isVarArg) llvm_unreachable("PTX does not support varargs");
Che-Liang Chiouf9930da2010-09-25 07:46:17 +0000300
301 switch (CallConv) {
302 default:
303 llvm_unreachable("Unsupported calling convention.");
304 case CallingConv::PTX_Kernel:
305 assert(Outs.size() == 0 && "Kernel must return void.");
306 return DAG.getNode(PTXISD::EXIT, dl, MVT::Other, Chain);
307 case CallingConv::PTX_Device:
Justin Holewinskie0aef2d2011-06-16 17:50:00 +0000308 //assert(Outs.size() <= 1 && "Can at most return one value.");
Che-Liang Chiouf9930da2010-09-25 07:46:17 +0000309 break;
310 }
311
Justin Holewinskie0aef2d2011-06-16 17:50:00 +0000312 MachineFunction& MF = DAG.getMachineFunction();
313 PTXMachineFunctionInfo *MFI = MF.getInfo<PTXMachineFunctionInfo>();
Che-Liang Chiouf9930da2010-09-25 07:46:17 +0000314
Che-Liang Chiouf9930da2010-09-25 07:46:17 +0000315 SDValue Flag;
Che-Liang Chiouf7172022011-02-28 06:34:09 +0000316
Justin Holewinskid8149c12011-06-23 18:10:13 +0000317 // Even though we could use the .param space for return arguments for
318 // device functions if SM >= 2.0 and the number of return arguments is
319 // only 1, we just always use registers since this makes the codegen
320 // easier.
321 SmallVector<CCValAssign, 16> RVLocs;
322 CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(),
323 getTargetMachine(), RVLocs, *DAG.getContext());
Justin Holewinskie0aef2d2011-06-16 17:50:00 +0000324
Justin Holewinskid8149c12011-06-23 18:10:13 +0000325 CCInfo.AnalyzeReturn(Outs, RetCC_PTX);
Justin Holewinskie0aef2d2011-06-16 17:50:00 +0000326
Justin Holewinskid8149c12011-06-23 18:10:13 +0000327 for (unsigned i = 0, e = RVLocs.size(); i != e; ++i) {
328 CCValAssign& VA = RVLocs[i];
Justin Holewinskie0aef2d2011-06-16 17:50:00 +0000329
Justin Holewinskid8149c12011-06-23 18:10:13 +0000330 assert(VA.isRegLoc() && "CCValAssign must be RegLoc");
Justin Holewinskie0aef2d2011-06-16 17:50:00 +0000331
Justin Holewinskid8149c12011-06-23 18:10:13 +0000332 unsigned Reg = VA.getLocReg();
Justin Holewinskie0aef2d2011-06-16 17:50:00 +0000333
Justin Holewinskid8149c12011-06-23 18:10:13 +0000334 DAG.getMachineFunction().getRegInfo().addLiveOut(Reg);
Justin Holewinskie0aef2d2011-06-16 17:50:00 +0000335
Justin Holewinskid8149c12011-06-23 18:10:13 +0000336 Chain = DAG.getCopyToReg(Chain, dl, Reg, OutVals[i], Flag);
Justin Holewinskie0aef2d2011-06-16 17:50:00 +0000337
Justin Holewinskid8149c12011-06-23 18:10:13 +0000338 // Guarantee that all emitted copies are stuck together,
339 // avoiding something bad
340 Flag = Chain.getValue(1);
Justin Holewinskie0aef2d2011-06-16 17:50:00 +0000341
Justin Holewinskid8149c12011-06-23 18:10:13 +0000342 MFI->addRetReg(Reg);
Che-Liang Chioufd8978b2011-03-02 03:20:28 +0000343 }
Justin Holewinskie0aef2d2011-06-16 17:50:00 +0000344
345 if (Flag.getNode() == 0) {
346 return DAG.getNode(PTXISD::RET, dl, MVT::Other, Chain);
Che-Liang Chiouf7172022011-02-28 06:34:09 +0000347 }
348 else {
Justin Holewinskie0aef2d2011-06-16 17:50:00 +0000349 return DAG.getNode(PTXISD::RET, dl, MVT::Other, Chain, Flag);
Che-Liang Chiouf7172022011-02-28 06:34:09 +0000350 }
Eric Christopher50880d02010-09-18 18:52:28 +0000351}
Justin Holewinski4bdd4ed2011-08-09 17:36:31 +0000352
353SDValue
354PTXTargetLowering::LowerCall(SDValue Chain, SDValue Callee,
355 CallingConv::ID CallConv, bool isVarArg,
356 bool &isTailCall,
357 const SmallVectorImpl<ISD::OutputArg> &Outs,
358 const SmallVectorImpl<SDValue> &OutVals,
359 const SmallVectorImpl<ISD::InputArg> &Ins,
360 DebugLoc dl, SelectionDAG &DAG,
361 SmallVectorImpl<SDValue> &InVals) const {
362
363 MachineFunction& MF = DAG.getMachineFunction();
364 PTXMachineFunctionInfo *MFI = MF.getInfo<PTXMachineFunctionInfo>();
Justin Holewinski4bdd4ed2011-08-09 17:36:31 +0000365
Duncan Sands1f6a3292011-08-12 14:54:45 +0000366 assert(getTargetMachine().getSubtarget<PTXSubtarget>().callsAreHandled() &&
367 "Calls are not handled for the target device");
Justin Holewinski4bdd4ed2011-08-09 17:36:31 +0000368
369 // Is there a more "LLVM"-way to create a variable-length array of values?
370 SDValue* ops = new SDValue[OutVals.size() + 2];
371
372 ops[0] = Chain;
373
374 if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) {
375 const GlobalValue *GV = G->getGlobal();
376 Callee = DAG.getTargetGlobalAddress(GV, dl, getPointerTy());
377 ops[1] = Callee;
378 } else {
379 assert(false && "Function must be a GlobalAddressSDNode");
380 }
381
382 for (unsigned i = 0; i != OutVals.size(); ++i) {
383 unsigned Size = OutVals[i].getValueType().getSizeInBits();
384 SDValue Index = DAG.getTargetConstant(MFI->getNextParam(Size), MVT::i32);
385 Chain = DAG.getNode(PTXISD::STORE_PARAM, dl, MVT::Other, Chain,
386 Index, OutVals[i]);
387 ops[i+2] = Index;
388 }
389
390 ops[0] = Chain;
391
392 Chain = DAG.getNode(PTXISD::CALL, dl, MVT::Other, ops, OutVals.size()+2);
393
394 delete [] ops;
395
396 return Chain;
397}