aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
diff options
context:
space:
mode:
authorJustin Holewinski <jholewinski@nvidia.com>2013-03-24 21:17:47 +0000
committerJustin Holewinski <jholewinski@nvidia.com>2013-03-24 21:17:47 +0000
commit1ce53cb526d23a3988fb12a5294ab1fcb2eb840f (patch)
tree6bea124ccd32b23b0cfcce79afae821a43b8c472 /lib/Target/NVPTX/NVPTXAsmPrinter.cpp
parentd28e30fcf44b22c897914343fce9061eb62d3b47 (diff)
downloadexternal_llvm-1ce53cb526d23a3988fb12a5294ab1fcb2eb840f.zip
external_llvm-1ce53cb526d23a3988fb12a5294ab1fcb2eb840f.tar.gz
external_llvm-1ce53cb526d23a3988fb12a5294ab1fcb2eb840f.tar.bz2
[NVPTX] Fix handling of vector arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177847 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/NVPTX/NVPTXAsmPrinter.cpp')
-rw-r--r--lib/Target/NVPTX/NVPTXAsmPrinter.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
index 0115e1f..c0e8670 100644
--- a/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ b/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -1481,7 +1481,7 @@ void NVPTXAsmPrinter::emitFunctionParamList(const Function *F,
O << "(\n";
for (I = F->arg_begin(), E = F->arg_end(); I != E; ++I, paramIndex++) {
- const Type *Ty = I->getType();
+ Type *Ty = I->getType();
if (!first)
O << ",\n";
@@ -1504,6 +1504,22 @@ void NVPTXAsmPrinter::emitFunctionParamList(const Function *F,
}
if (PAL.hasAttribute(paramIndex+1, Attribute::ByVal) == false) {
+ if (Ty->isVectorTy()) {
+ // Just print .param .b8 .align <a> .param[size];
+ // <a> = PAL.getparamalignment
+ // size = typeallocsize of element type
+ unsigned align = PAL.getParamAlignment(paramIndex+1);
+ if (align == 0)
+ align = TD->getABITypeAlignment(Ty);
+
+ unsigned sz = TD->getTypeAllocSize(Ty);
+ O << "\t.param .align " << align
+ << " .b8 ";
+ printParamName(I, paramIndex, O);
+ O << "[" << sz << "]";
+
+ continue;
+ }
// Just a scalar
const PointerType *PTy = dyn_cast<PointerType>(Ty);
if (isKernelFunc) {