summaryrefslogtreecommitdiff
path: root/lib/Target/PTX/PTXISelLowering.cpp
diff options
context:
space:
mode:
authorChe-Liang Chiou <clchiou@gmail.com>2010-11-08 03:00:52 +0000
committerChe-Liang Chiou <clchiou@gmail.com>2010-11-08 03:00:52 +0000
commit3278c4260c015a1097afa5c6c88bdc16612ef9d0 (patch)
tree4b485830a066eea735143daa99e86d16fa661ff4 /lib/Target/PTX/PTXISelLowering.cpp
parentd77f2a45aa5d3bca6bf2eabed070b3fc60adf14b (diff)
downloadllvm-3278c4260c015a1097afa5c6c88bdc16612ef9d0.tar.gz
llvm-3278c4260c015a1097afa5c6c88bdc16612ef9d0.tar.bz2
llvm-3278c4260c015a1097afa5c6c88bdc16612ef9d0.tar.xz
Add physical register counting functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118397 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PTX/PTXISelLowering.cpp')
-rw-r--r--lib/Target/PTX/PTXISelLowering.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Target/PTX/PTXISelLowering.cpp b/lib/Target/PTX/PTXISelLowering.cpp
index 5bd722188a..ae6920805a 100644
--- a/lib/Target/PTX/PTXISelLowering.cpp
+++ b/lib/Target/PTX/PTXISelLowering.cpp
@@ -13,6 +13,7 @@
#include "PTX.h"
#include "PTXISelLowering.h"
+#include "PTXMachineFunctionInfo.h"
#include "PTXRegisterInfo.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/CodeGen/MachineFunction.h"
@@ -107,6 +108,9 @@ SDValue PTXTargetLowering::
SmallVectorImpl<SDValue> &InVals) const {
if (isVarArg) llvm_unreachable("PTX does not support varargs");
+ MachineFunction &MF = DAG.getMachineFunction();
+ PTXMachineFunctionInfo *MFI = MF.getInfo<PTXMachineFunctionInfo>();
+
lower_argument_func lower_argument;
switch (CallConv) {
@@ -114,9 +118,11 @@ SDValue PTXTargetLowering::
llvm_unreachable("Unsupported calling convention");
break;
case CallingConv::PTX_Kernel:
+ MFI->setKernel();
lower_argument = lower_kernel_argument;
break;
case CallingConv::PTX_Device:
+ MFI->setKernel(false);
lower_argument = lower_device_argument;
break;
}
@@ -137,8 +143,15 @@ SDValue PTXTargetLowering::
unsigned reg;
SDValue arg = lower_argument(i, Chain, dl, VT, entry, DAG, &reg);
InVals.push_back(arg);
+
+ if (!MFI->isDoneAddArg())
+ MFI->addArgReg(reg);
}
+ // Make sure we don't add argument registers twice
+ if (!MFI->isDoneAddArg())
+ MFI->doneAddArg();
+
return Chain;
}
@@ -174,6 +187,10 @@ SDValue PTXTargetLowering::
SDValue Flag;
unsigned reg = PTX::R0;
+ MachineFunction &MF = DAG.getMachineFunction();
+ PTXMachineFunctionInfo *MFI = MF.getInfo<PTXMachineFunctionInfo>();
+ MFI->setRetReg(reg);
+
// If this is the first return lowered for this function, add the regs to the
// liveout set for the function
if (DAG.getMachineFunction().getRegInfo().liveout_empty())