diff options
| author | Anton Korobeynikov <asl@math.spbu.ru> | 2008-01-20 14:00:07 +0000 |
|---|---|---|
| committer | Anton Korobeynikov <asl@math.spbu.ru> | 2008-01-20 14:00:07 +0000 |
| commit | ea74c7e498274960c2b09b7988b4cfefff43137f (patch) | |
| tree | 938e8f41ef149becee60b7d07e415eb0881dd2b9 /lib/Target | |
| parent | 99e635ca69200009d899dce03258237ec1484dfe (diff) | |
| download | external_llvm-ea74c7e498274960c2b09b7988b4cfefff43137f.zip external_llvm-ea74c7e498274960c2b09b7988b4cfefff43137f.tar.gz external_llvm-ea74c7e498274960c2b09b7988b4cfefff43137f.tar.bz2 | |
Honour ByVal parameter attribute for name decoration
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46200 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
| -rw-r--r-- | lib/Target/X86/X86AsmPrinter.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index f9756f0..ef8cbea 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; |
