mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 21:18:19 +00:00
ARM: HFAs must be passed in consecutive registers
When using the ARM AAPCS, HFAs (Homogeneous Floating-point Aggregates) must be passed in a block of consecutive floating-point registers, or on the stack. This means that unused floating-point registers cannot be back-filled with part of an HFA, however this can currently happen. This patch, along with the corresponding clang patch (http://reviews.llvm.org/D3083) prevents this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208413 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -7128,8 +7128,13 @@ TargetLowering::LowerCallTo(TargetLowering::CallLoweringInfo &CLI) const {
|
||||
for (unsigned i = 0, e = Args.size(); i != e; ++i) {
|
||||
SmallVector<EVT, 4> ValueVTs;
|
||||
ComputeValueVTs(*this, Args[i].Ty, ValueVTs);
|
||||
for (unsigned Value = 0, NumValues = ValueVTs.size();
|
||||
Value != NumValues; ++Value) {
|
||||
Type *FinalType = Args[i].Ty;
|
||||
if (Args[i].isByVal)
|
||||
FinalType = cast<PointerType>(Args[i].Ty)->getElementType();
|
||||
bool NeedsRegBlock = functionArgumentNeedsConsecutiveRegisters(
|
||||
FinalType, CLI.CallConv, CLI.IsVarArg);
|
||||
for (unsigned Value = 0, NumValues = ValueVTs.size(); Value != NumValues;
|
||||
++Value) {
|
||||
EVT VT = ValueVTs[Value];
|
||||
Type *ArgTy = VT.getTypeForEVT(CLI.RetTy->getContext());
|
||||
SDValue Op = SDValue(Args[i].Node.getNode(),
|
||||
@@ -7171,6 +7176,11 @@ TargetLowering::LowerCallTo(TargetLowering::CallLoweringInfo &CLI) const {
|
||||
}
|
||||
if (Args[i].isNest)
|
||||
Flags.setNest();
|
||||
if (NeedsRegBlock) {
|
||||
Flags.setInConsecutiveRegs();
|
||||
if (Value == NumValues - 1)
|
||||
Flags.setInConsecutiveRegsLast();
|
||||
}
|
||||
Flags.setOrigAlign(OriginalAlignment);
|
||||
|
||||
MVT PartVT = getRegisterType(CLI.RetTy->getContext(), VT);
|
||||
@@ -7356,6 +7366,11 @@ void SelectionDAGISel::LowerArguments(const Function &F) {
|
||||
ComputeValueVTs(*TLI, I->getType(), ValueVTs);
|
||||
bool isArgValueUsed = !I->use_empty();
|
||||
unsigned PartBase = 0;
|
||||
Type *FinalType = I->getType();
|
||||
if (F.getAttributes().hasAttribute(Idx, Attribute::ByVal))
|
||||
FinalType = cast<PointerType>(FinalType)->getElementType();
|
||||
bool NeedsRegBlock = TLI->functionArgumentNeedsConsecutiveRegisters(
|
||||
FinalType, F.getCallingConv(), F.isVarArg());
|
||||
for (unsigned Value = 0, NumValues = ValueVTs.size();
|
||||
Value != NumValues; ++Value) {
|
||||
EVT VT = ValueVTs[Value];
|
||||
@@ -7397,6 +7412,11 @@ void SelectionDAGISel::LowerArguments(const Function &F) {
|
||||
}
|
||||
if (F.getAttributes().hasAttribute(Idx, Attribute::Nest))
|
||||
Flags.setNest();
|
||||
if (NeedsRegBlock) {
|
||||
Flags.setInConsecutiveRegs();
|
||||
if (Value == NumValues - 1)
|
||||
Flags.setInConsecutiveRegsLast();
|
||||
}
|
||||
Flags.setOrigAlign(OriginalAlignment);
|
||||
|
||||
MVT RegisterVT = TLI->getRegisterType(*CurDAG->getContext(), VT);
|
||||
|
||||
Reference in New Issue
Block a user