}
#endif // TARGET_AMD64
-#ifdef TARGET_LOONGARCH64
+#if defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64)
// Get layout information for the argument that the ArgIterator is currently visiting.
+ // TODO-RISCV64: support SIMD.
void GetArgLoc(int argOffset, ArgLocDesc *pLoc)
{
LIMITED_METHOD_CONTRACT;
const int floatRegOfsInBytes = argOffset - TransitionBlock::GetOffsetOfFloatArgumentRegisters();
_ASSERTE((floatRegOfsInBytes % FLOAT_REGISTER_SIZE) == 0);
- pLoc->m_idxFloatReg = floatRegOfsInBytes / 8;
+ pLoc->m_idxFloatReg = floatRegOfsInBytes / FLOAT_REGISTER_SIZE;
pLoc->m_cFloatReg = 1;
return;
}
-#endif // TARGET_LOONGARCH64
-
-#ifdef TARGET_RISCV64
- // Get layout information for the argument that the ArgIterator is currently visiting.
- void GetArgLoc(int argOffset, ArgLocDesc *pLoc)
- {
- LIMITED_METHOD_CONTRACT;
-
- pLoc->Init();
-
- if (m_hasArgLocDescForStructInRegs)
- {
- *pLoc = m_argLocDescForStructInRegs;
- return;
- }
-
- if (TransitionBlock::IsFloatArgumentRegisterOffset(argOffset))
- {
- // TODO-RISCV64: support SIMD.
- // Dividing by 8 as size of each register in FloatArgumentRegisters is 8 bytes.
- const int floatRegOfsInBytes = (argOffset - TransitionBlock::GetOffsetOfFloatArgumentRegisters());
- _ASSERTE((floatRegOfsInBytes % FLOAT_REGISTER_SIZE) == 0);
- pLoc->m_idxFloatReg = floatRegOfsInBytes / FLOAT_REGISTER_SIZE;
-
- assert(!m_argTypeHandle.IsHFA());
-
- pLoc->m_cFloatReg = 1;
-
- return;
- }
-
- int cSlots = (GetArgSize() + 7)/ 8;
-
- // Composites greater than 16bytes are passed by reference
- if (GetArgType() == ELEMENT_TYPE_VALUETYPE && GetArgSize() > ENREGISTERED_PARAMTYPE_MAXSIZE)
- {
- cSlots = 1;
- }
-
- if (!TransitionBlock::IsStackArgumentOffset(argOffset))
- {
- // At least one used integer register passed.
- pLoc->m_idxGenReg = TransitionBlock::GetArgumentIndexFromOffset(argOffset);
- pLoc->m_cGenReg = cSlots;
- }
- else
- {
- pLoc->m_byteStackIndex = TransitionBlock::GetStackArgumentByteIndexFromOffset(argOffset);
- pLoc->m_byteStackSize = cSlots << 3;
- }
-
- return;
- }
-#endif // TARGET_RISCV64
+#endif // TARGET_LOONGARCH64 || TARGET_RISCV64
protected:
DWORD m_dwFlags; // Cached flags
int m_nSizeOfArgStack; // Cached value of SizeOfArgStack