From eabc5f39af854fc78674f4851b23a3e5225a1de4 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Fri, 22 Feb 2008 17:49:45 +0000 Subject: Pass alignment on ByVal parameters, from FE, all the way through. It is now used for codegen. llvm-svn: 47484 --- llvm/lib/VMCore/Instructions.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'llvm/lib/VMCore/Instructions.cpp') diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp index 4197f80c922..b3a78b729f5 100644 --- a/llvm/lib/VMCore/Instructions.cpp +++ b/llvm/lib/VMCore/Instructions.cpp @@ -61,6 +61,13 @@ bool CallSite::paramHasAttr(uint16_t i, ParameterAttributes attr) const { else return cast(I)->paramHasAttr(i, attr); } +uint16_t CallSite::getParamAlignment(uint16_t i) const { + if (CallInst *CI = dyn_cast(I)) + return CI->getParamAlignment(i); + else + return cast(I)->getParamAlignment(i); +} + bool CallSite::doesNotAccessMemory() const { if (CallInst *CI = dyn_cast(I)) return CI->doesNotAccessMemory(); @@ -384,6 +391,14 @@ bool CallInst::paramHasAttr(uint16_t i, ParameterAttributes attr) const { return false; } +uint16_t CallInst::getParamAlignment(uint16_t i) const { + if (ParamAttrs && ParamAttrs->getParamAlignment(i)) + return ParamAttrs->getParamAlignment(i); + if (const Function *F = getCalledFunction()) + return F->getParamAlignment(i); + return 0; +} + /// @brief Determine if the call does not access memory. bool CallInst::doesNotAccessMemory() const { return paramHasAttr(0, ParamAttr::ReadNone); @@ -508,6 +523,13 @@ bool InvokeInst::paramHasAttr(uint16_t i, ParameterAttributes attr) const { return false; } +uint16_t InvokeInst::getParamAlignment(uint16_t i) const { + if (ParamAttrs && ParamAttrs->getParamAlignment(i)) + return ParamAttrs->getParamAlignment(i); + if (const Function *F = getCalledFunction()) + return F->getParamAlignment(i); + return 0; +} /// @brief Determine if the call does not access memory. bool InvokeInst::doesNotAccessMemory() const { -- cgit v1.2.3