From c7998b22773500ed8cbc8f993f22e6acb14d4453 Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Tue, 26 Sep 2023 13:22:14 +0200 Subject: [PATCH] JIT: Remove CallArgABIInformation::IsStruct Since we store signature types now this bit is no longer necessary. --- src/coreclr/jit/gentree.cpp | 2 +- src/coreclr/jit/gentree.h | 3 --- src/coreclr/jit/lower.cpp | 2 +- src/coreclr/jit/lsraxarch.cpp | 2 +- src/coreclr/jit/morph.cpp | 28 +++++----------------------- 5 files changed, 8 insertions(+), 29 deletions(-) diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index d42175f98300ef..c9f6e61b9e979d 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -1427,7 +1427,7 @@ bool CallArg::IsUserArg() const void CallArg::CheckIsStruct() { GenTree* node = GetNode(); - if (AbiInfo.IsStruct) + if (varTypeIsStruct(GetSignatureType())) { if (!varTypeIsStruct(node) && !node->OperIs(GT_FIELD_LIST)) { diff --git a/src/coreclr/jit/gentree.h b/src/coreclr/jit/gentree.h index dc115bd491e689..7651267083ba2f 100644 --- a/src/coreclr/jit/gentree.h +++ b/src/coreclr/jit/gentree.h @@ -4347,7 +4347,6 @@ struct CallArgABIInformation #endif , ArgType(TYP_UNDEF) , IsBackFilled(false) - , IsStruct(false) , PassedByRef(false) #if FEATURE_ARG_SPLIT , m_isSplit(false) @@ -4396,8 +4395,6 @@ struct CallArgABIInformation // True when the argument fills a register slot skipped due to alignment // requirements of previous arguments. bool IsBackFilled : 1; - // True if this is a struct arg - bool IsStruct : 1; // True iff the argument is passed by reference. bool PassedByRef : 1; diff --git a/src/coreclr/jit/lower.cpp b/src/coreclr/jit/lower.cpp index 25cfb5409d957a..bb31df9240a57a 100644 --- a/src/coreclr/jit/lower.cpp +++ b/src/coreclr/jit/lower.cpp @@ -1489,7 +1489,7 @@ GenTree* Lowering::NewPutArg(GenTreeCall* call, GenTree* arg, CallArg* callArg, call, putInIncomingArgArea); #if defined(DEBUG) && defined(FEATURE_PUT_STRUCT_ARG_STK) - if (callArg->AbiInfo.IsStruct) + if (varTypeIsStruct(callArg->GetSignatureType())) { // We use GT_BLK only for non-SIMD struct arguments. if (arg->OperIs(GT_BLK)) diff --git a/src/coreclr/jit/lsraxarch.cpp b/src/coreclr/jit/lsraxarch.cpp index 5d54c08ebb7902..fe6859e13011e1 100644 --- a/src/coreclr/jit/lsraxarch.cpp +++ b/src/coreclr/jit/lsraxarch.cpp @@ -1269,7 +1269,7 @@ int LinearScan::BuildCall(GenTreeCall* call) if (argNode->OperGet() == GT_FIELD_LIST) { assert(argNode->isContained()); - assert(varTypeIsStruct(argNode) || abiInfo.IsStruct); + assert(varTypeIsStruct(arg.GetSignatureType())); unsigned regIndex = 0; for (GenTreeFieldList::Use& use : argNode->AsFieldList()->Uses()) diff --git a/src/coreclr/jit/morph.cpp b/src/coreclr/jit/morph.cpp index 39617fb20a27d8..8cc25ba6b68bc1 100644 --- a/src/coreclr/jit/morph.cpp +++ b/src/coreclr/jit/morph.cpp @@ -827,10 +827,6 @@ void CallArg::Dump(Compiler* comp) { printf(", wellKnown[%s]", getWellKnownArgName(m_wellKnownArg)); } - if (AbiInfo.IsStruct) - { - printf(", isStruct"); - } printf("]\n"); } #endif @@ -880,8 +876,6 @@ void CallArgs::SetTemp(CallArg* arg, unsigned tmpNum) // void CallArgs::ArgsComplete(Compiler* comp, GenTreeCall* call) { - bool hasStructRegArg = false; - unsigned argCount = CountArgs(); // Previous argument with GTF_EXCEPT @@ -914,17 +908,9 @@ void CallArgs::ArgsComplete(Compiler* comp, GenTreeCall* call) #if FEATURE_ARG_SPLIT else if (arg.AbiInfo.IsSplit()) { - hasStructRegArg = true; assert(m_hasStackArgs); } -#endif // FEATURE_ARG_SPLIT - else // we have a register argument, next we look for a struct type. - { - if (varTypeIsStruct(argx) UNIX_AMD64_ABI_ONLY(|| arg.AbiInfo.IsStruct)) - { - hasStructRegArg = true; - } - } +#endif // FEATURE_ARG_SPLIT /* If the argument tree contains an assignment (GTF_ASG) then the argument and and every earlier argument (except constants) must be evaluated into temps @@ -2793,9 +2779,8 @@ void CallArgs::AddFinalArgsAndDetermineABIInfo(Compiler* comp, GenTreeCall* call } #endif // TARGET_ARM - arg.AbiInfo = CallArgABIInformation(); - arg.AbiInfo.ArgType = argx->TypeGet(); - arg.AbiInfo.IsStruct = isStructArg; + arg.AbiInfo = CallArgABIInformation(); + arg.AbiInfo.ArgType = argx->TypeGet(); if (isRegArg) { @@ -3014,7 +2999,7 @@ void CallArgs::AddFinalArgsAndDetermineABIInfo(Compiler* comp, GenTreeCall* call arg.AbiInfo.SetMultiRegNums(); - if (arg.AbiInfo.IsStruct) + if (varTypeIsStruct(arg.GetSignatureType())) { arg.AbiInfo.PassedByRef = passStructByRef; arg.AbiInfo.ArgType = (structBaseType == TYP_UNKNOWN) ? argx->TypeGet() : structBaseType; @@ -3202,10 +3187,7 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call) argx->gtType = TYP_I_IMPL; } - // Struct arguments may be morphed into a node that is not a struct type. - // In such case the CallArgABIInformation keeps track of whether the original node (before morphing) - // was a struct and the struct classification. - bool isStructArg = arg.AbiInfo.IsStruct; + bool isStructArg = varTypeIsStruct(arg.GetSignatureType()); GenTree* argObj = argx->gtEffectiveVal(true /*commaOnly*/); bool makeOutArgCopy = false;