Skip to content

Commit 2e1edeb

Browse files
committed
Add handling of structure returns and parameters in aarch64 calling convention
1 parent b104c24 commit 2e1edeb

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

arch/arm64/arch_arm64.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2646,9 +2646,42 @@ class Arm64CallingConvention : public CallingConvention
26462646

26472647

26482648
virtual uint32_t GetIntegerReturnValueRegister() override { return REG_X0; }
2649+
virtual uint32_t GetHighIntegerReturnValueRegister() override { return REG_X1; }
26492650

26502651

26512652
virtual uint32_t GetFloatReturnValueRegister() override { return REG_V0; }
2653+
2654+
2655+
bool IsReturnTypeRegisterCompatible(Type* type) override
2656+
{
2657+
if (!type)
2658+
return false;
2659+
if (type->IsFloat())
2660+
return true;
2661+
return type->GetWidth() <= 16;
2662+
}
2663+
2664+
2665+
Variable GetIndirectReturnValueLocation() override
2666+
{
2667+
return Variable::Register(REG_X8);
2668+
}
2669+
2670+
2671+
bool IsArgumentTypeRegisterCompatible(Type* type) override
2672+
{
2673+
if (!type)
2674+
return false;
2675+
if (type->IsFloat())
2676+
return true;
2677+
return type->GetWidth() <= 16;
2678+
}
2679+
2680+
2681+
bool AreNonRegisterArgumentsIndirect() override
2682+
{
2683+
return true;
2684+
}
26522685
};
26532686

26542687

@@ -2664,6 +2697,12 @@ class AppleArm64CallingConvention: public Arm64CallingConvention
26642697
{
26652698
return false;
26662699
}
2700+
2701+
2702+
virtual bool AreStackArgumentsNaturallyAligned() override
2703+
{
2704+
return true;
2705+
}
26672706
};
26682707

26692708

0 commit comments

Comments
 (0)