summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-02-22 17:49:45 +0000
committerDale Johannesen <dalej@apple.com>2008-02-22 17:49:45 +0000
commiteabc5f39af854fc78674f4851b23a3e5225a1de4 (patch)
tree9cd1637966e0cc33aad0e5b42f575e7d7b51d344 /llvm/lib/CodeGen
parenteac159c1f0890fc9ab014fec1531bf7d78e510a6 (diff)
downloadbcm5719-llvm-eabc5f39af854fc78674f4851b23a3e5225a1de4.tar.gz
bcm5719-llvm-eabc5f39af854fc78674f4851b23a3e5225a1de4.zip
Pass alignment on ByVal parameters, from FE, all
the way through. It is now used for codegen. llvm-svn: 47484
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 96dde98be9c..62610dbe228 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -3118,6 +3118,7 @@ void SelectionDAGLowering::LowerCallTo(CallSite CS, SDOperand Callee,
Entry.isSRet = CS.paramHasAttr(attrInd, ParamAttr::StructRet);
Entry.isNest = CS.paramHasAttr(attrInd, ParamAttr::Nest);
Entry.isByVal = CS.paramHasAttr(attrInd, ParamAttr::ByVal);
+ Entry.Alignment = CS.getParamAlignment(attrInd);
Args.push_back(Entry);
}
@@ -4146,6 +4147,10 @@ TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
const Type *ElementTy = Ty->getElementType();
unsigned FrameAlign = Log2_32(getByValTypeAlignment(ElementTy));
unsigned FrameSize = getTargetData()->getABITypeSize(ElementTy);
+ // For ByVal, alignment should be passed from FE. BE will guess if
+ // this info is not there but there are cases it cannot get right.
+ if (F.getParamAlignment(j))
+ FrameAlign = Log2_32(F.getParamAlignment(j));
Flags |= (FrameAlign << ISD::ParamFlags::ByValAlignOffs);
Flags |= (FrameSize << ISD::ParamFlags::ByValSizeOffs);
}
@@ -4255,6 +4260,10 @@ TargetLowering::LowerCallTo(SDOperand Chain, const Type *RetTy,
const Type *ElementTy = Ty->getElementType();
unsigned FrameAlign = Log2_32(getByValTypeAlignment(ElementTy));
unsigned FrameSize = getTargetData()->getABITypeSize(ElementTy);
+ // For ByVal, alignment should come from FE. BE will guess if this
+ // info is not there but there are cases it cannot get right.
+ if (Args[i].Alignment)
+ FrameAlign = Log2_32(Args[i].Alignment);
Flags |= (FrameAlign << ISD::ParamFlags::ByValAlignOffs);
Flags |= (FrameSize << ISD::ParamFlags::ByValSizeOffs);
}
OpenPOWER on IntegriCloud