From 457c2c7f6a4ad2da6be164bc4f60600abf1050ab Mon Sep 17 00:00:00 2001 From: William Chen Date: Wed, 3 Feb 2021 10:07:26 -0800 Subject: [PATCH] Add union type for call param passing. --- src/mapleall/maple_be/src/be/lower.cpp | 4 ++-- src/mapleall/maple_be/src/cg/aarch64/aarch64_abi.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mapleall/maple_be/src/be/lower.cpp b/src/mapleall/maple_be/src/be/lower.cpp index db9ef265a9..340f152218 100644 --- a/src/mapleall/maple_be/src/be/lower.cpp +++ b/src/mapleall/maple_be/src/be/lower.cpp @@ -1186,11 +1186,11 @@ StmtNode *CGLowerer::LowerCall(CallNode &callNode, StmtNode *&nextStmt, BlockNod MIRPtrType *pretType = static_cast((calleeFunc->GetNthParamType(0))); CHECK_FATAL(pretType != nullptr, "nullptr is not expected"); retType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(pretType->GetPointedTyIdx()); - CHECK_FATAL(retType->GetKind() == kTypeStruct, "make sure retType is a struct type"); + CHECK_FATAL((retType->GetKind() == kTypeStruct) || (retType->GetKind() == kTypeUnion), "make sure retType is a struct type"); } /* if return type is not of a struct, return */ - if (retType->GetKind() != kTypeStruct) { + if ((retType->GetKind() != kTypeStruct) && (retType->GetKind() != kTypeUnion)) { return &callNode; } diff --git a/src/mapleall/maple_be/src/cg/aarch64/aarch64_abi.cpp b/src/mapleall/maple_be/src/cg/aarch64/aarch64_abi.cpp index 15a272e27d..20b3fc9709 100644 --- a/src/mapleall/maple_be/src/cg/aarch64/aarch64_abi.cpp +++ b/src/mapleall/maple_be/src/cg/aarch64/aarch64_abi.cpp @@ -211,7 +211,7 @@ int32 ClassifyAggregate(BECommon &be, MIRType &mirType, AArch64ArgumentClass cla for (i = 0; i < sizeOfTyInDwords; ++i) { classes[i] = kAArch64NoClass; } - if ((mirType.GetKind() != kTypeStruct) && (mirType.GetKind() != kTypeArray)) { + if ((mirType.GetKind() != kTypeStruct) && (mirType.GetKind() != kTypeArray) && (mirType.GetKind() != kTypeUnion)) { return ProcessNonStructAndNonArrayWhenClassifyAggregate(mirType, classes, classesLength); } int32 subNumRegs; -- Gitee