diff options
author | Tom Stellard <[email protected]> | 2012-09-17 19:06:25 +0000 |
---|---|---|
committer | Tom Stellard <[email protected]> | 2012-09-17 21:09:43 +0000 |
commit | 059a56bddb6bd769632e5999cb23c7bdcb79bea1 (patch) | |
tree | 43991052a5faeaa1b3a5da5780e0f0c5a86b290f /src/gallium/drivers/radeon/R600ISelLowering.cpp | |
parent | 9fac1d1c3aa0c33339c6438cfbc51dc2066151dc (diff) |
radeon/llvm: Move kernel arg lowering into R600TargetLowering class
Diffstat (limited to 'src/gallium/drivers/radeon/R600ISelLowering.cpp')
-rw-r--r-- | src/gallium/drivers/radeon/R600ISelLowering.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/R600ISelLowering.cpp b/src/gallium/drivers/radeon/R600ISelLowering.cpp index 5a82920c377..dc75a450bdc 100644 --- a/src/gallium/drivers/radeon/R600ISelLowering.cpp +++ b/src/gallium/drivers/radeon/R600ISelLowering.cpp @@ -16,6 +16,7 @@ #include "R600Defines.h" #include "R600InstrInfo.h" #include "R600MachineFunctionInfo.h" +#include "llvm/Argument.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/SelectionDAG.h" @@ -576,3 +577,30 @@ SDValue R600TargetLowering::LowerSETCC(SDValue Op, SelectionDAG &DAG) const Cond); return Cond; } + +// XXX Only kernel functions are supporte, so we can assume for now that +// every function is a kernel function, but in the future we should use +// separate calling conventions for kernel and non-kernel functions. +// Only kernel functions are supported, so we can assume for now +SDValue R600TargetLowering::LowerFormalArguments( + SDValue Chain, + CallingConv::ID CallConv, + bool isVarArg, + const SmallVectorImpl<ISD::InputArg> &Ins, + DebugLoc DL, SelectionDAG &DAG, + SmallVectorImpl<SDValue> &InVals) const +{ + unsigned ParamOffsetBytes = 36; + for (unsigned i = 0, e = Ins.size(); i < e; ++i) { + EVT VT = Ins[i].VT; + PointerType *PtrTy = PointerType::get(VT.getTypeForEVT(*DAG.getContext()), + AMDGPUAS::PARAM_I_ADDRESS); + SDValue Arg = DAG.getLoad(VT, DL, DAG.getRoot(), + DAG.getConstant(ParamOffsetBytes, MVT::i32), + MachinePointerInfo(new Argument(PtrTy)), + false, false, false, 4); + InVals.push_back(Arg); + ParamOffsetBytes += (VT.getStoreSize()); + } + return Chain; +} |