summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2008-01-21 20:45:28 +0000
committerTanya Lattner <tonic@nondot.org>2008-01-21 20:45:28 +0000
commit6bd6920799c7215b51795e5a873b69ab02d732ae (patch)
tree539b2a4bf57756681a2fe29db3ec0f1f9a6ecef9
parent53e6bb75cf670d33531f4658ef321b93a2bebb8b (diff)
downloadllvm-6bd6920799c7215b51795e5a873b69ab02d732ae.tar.gz
Merge from mainline.
Honour ByVal parameter attribute for name decoration. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_22@46214 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/X86AsmPrinter.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp
index f9756f046f62..ef8cbea590dc 100644
--- a/lib/Target/X86/X86AsmPrinter.cpp
+++ b/lib/Target/X86/X86AsmPrinter.cpp
@@ -25,6 +25,7 @@
#include "llvm/Constants.h"
#include "llvm/Module.h"
#include "llvm/DerivedTypes.h"
+#include "llvm/ParameterAttributes.h"
#include "llvm/Type.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Support/Mangler.h"
@@ -48,11 +49,19 @@ static X86MachineFunctionInfo calculateFunctionInfo(const Function *F,
return Info;
}
+ unsigned argNum = 1;
for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end();
- AI != AE; ++AI)
+ AI != AE; ++AI, ++argNum) {
+ const Type* Ty = AI->getType();
+
+ // 'Dereference' type in case of byval parameter attribute
+ if (F->paramHasAttr(argNum, ParamAttr::ByVal))
+ Ty = cast<PointerType>(Ty)->getElementType();
+
// Size should be aligned to DWORD boundary
- Size += ((TD->getABITypeSize(AI->getType()) + 3)/4)*4;
-
+ Size += ((TD->getABITypeSize(Ty) + 3)/4)*4;
+ }
+
// We're not supporting tooooo huge arguments :)
Info.setBytesToPopOnReturn((unsigned int)Size);
return Info;