76 X86_64_INTEGERSI_CLASS,
93static enum x86_64_reg_class
94merge_classes (
enum x86_64_reg_class class1,
enum x86_64_reg_class class2)
103 if (class1 == X86_64_NO_CLASS)
105 if (class2 == X86_64_NO_CLASS)
109 if (class1 == X86_64_MEMORY_CLASS || class2 == X86_64_MEMORY_CLASS)
110 return X86_64_MEMORY_CLASS;
113 if ((class1 == X86_64_INTEGERSI_CLASS && class2 == X86_64_SSESF_CLASS)
114 || (class2 == X86_64_INTEGERSI_CLASS && class1 == X86_64_SSESF_CLASS))
115 return X86_64_INTEGERSI_CLASS;
116 if (class1 == X86_64_INTEGER_CLASS || class1 == X86_64_INTEGERSI_CLASS
117 || class2 == X86_64_INTEGER_CLASS || class2 == X86_64_INTEGERSI_CLASS)
118 return X86_64_INTEGER_CLASS;
121 return X86_64_SSE_CLASS;
132classify_argument( typelib_TypeDescriptionReference *pTypeRef,
enum x86_64_reg_class classes[],
int byteOffset )
noexcept
134 switch ( pTypeRef->eTypeClass )
136 case typelib_TypeClass_CHAR:
137 case typelib_TypeClass_BOOLEAN:
138 case typelib_TypeClass_BYTE:
139 case typelib_TypeClass_SHORT:
140 case typelib_TypeClass_UNSIGNED_SHORT:
141 case typelib_TypeClass_LONG:
142 case typelib_TypeClass_UNSIGNED_LONG:
143 case typelib_TypeClass_HYPER:
144 case typelib_TypeClass_UNSIGNED_HYPER:
145 case typelib_TypeClass_ENUM:
146 if ( ( byteOffset % 8 + pTypeRef->pType->nSize ) <= 4 )
147 classes[0] = X86_64_INTEGERSI_CLASS;
149 classes[0] = X86_64_INTEGER_CLASS;
151 case typelib_TypeClass_FLOAT:
152 if ( ( byteOffset % 8 ) == 0 )
153 classes[0] = X86_64_SSESF_CLASS;
155 classes[0] = X86_64_SSE_CLASS;
157 case typelib_TypeClass_DOUBLE:
158 classes[0] = X86_64_SSE_CLASS;
160 case typelib_TypeClass_STRING:
161 case typelib_TypeClass_TYPE:
162 case typelib_TypeClass_ANY:
163 case typelib_TypeClass_SEQUENCE:
164 case typelib_TypeClass_INTERFACE:
166 case typelib_TypeClass_STRUCT:
169 TYPELIB_DANGER_GET( &pTypeDescr, pTypeRef );
171 const int UNITS_PER_WORD = 8;
172 int words = ( pTypeDescr->nSize + UNITS_PER_WORD - 1 ) / UNITS_PER_WORD;
176 if ( pTypeDescr->nSize > 16 )
178 TYPELIB_DANGER_RELEASE( pTypeDescr );
182 for (
int i = 0;
i < words;
i++ )
183 classes[
i] = X86_64_NO_CLASS;
185 const typelib_CompoundTypeDescription *pStruct =
reinterpret_cast<const typelib_CompoundTypeDescription*
>( pTypeDescr );
188 for ( sal_Int32 nMember = 0; nMember < pStruct->nMembers; ++nMember )
190 typelib_TypeDescriptionReference *pTypeInStruct = pStruct->ppTypeRefs[ nMember ];
191 int offset = byteOffset + pStruct->pMemberOffsets[ nMember ];
197 TYPELIB_DANGER_RELEASE( pTypeDescr );
201 for (
int i = 0;
i < num;
i++ )
203 int pos = offset / 8;
205 if (classes[
i +
pos] == X86_64_MEMORY_CLASS) {
206 TYPELIB_DANGER_RELEASE( pTypeDescr );
212 TYPELIB_DANGER_RELEASE( pTypeDescr );
236 for (
n--;
n >= 0;
n-- )
237 switch ( classes[
n] )
239 case X86_64_INTEGER_CLASS:
240 case X86_64_INTEGERSI_CLASS:
243 case X86_64_SSE_CLASS:
244 case X86_64_SSESF_CLASS:
255 if (pTypeRef->eTypeClass == typelib_TypeClass_VOID) {
266 return ReturnKind::Memory;
268 if (
n == 2 && (classes[0] == X86_64_SSE_CLASS || classes[0] == X86_64_SSESF_CLASS)
269 && (classes[1] == X86_64_INTEGER_CLASS || classes[1] == X86_64_INTEGERSI_CLASS))
271 return ReturnKind::RegistersFpInt;
273 if (
n == 2 && (classes[0] == X86_64_INTEGER_CLASS || classes[0] == X86_64_INTEGERSI_CLASS)
274 && (classes[1] == X86_64_SSE_CLASS || classes[1] == X86_64_SSESF_CLASS))
276 return ReturnKind::RegistersIntFp;
278 return ReturnKind::RegistersGeneral;
281void x86_64::fill_struct( typelib_TypeDescriptionReference *pTypeRef,
const sal_uInt64 *pGPR,
const double *pSSE,
void *pStruct )
noexcept
288 sal_uInt64 *pStructAlign =
static_cast<sal_uInt64 *
>( pStruct );
289 for (
int i = 0;
i !=
n; ++
i )
290 switch ( classes[i] )
292 case X86_64_INTEGER_CLASS:
293 case X86_64_INTEGERSI_CLASS:
294 *pStructAlign++ = *pGPR++;
296 case X86_64_SSE_CLASS:
297 case X86_64_SSESF_CLASS:
298 *pStructAlign++ = *
reinterpret_cast<const sal_uInt64 *
>( pSSE++ );
static int classify_argument(typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_class classes[], int byteOffset) noexcept
static enum x86_64_reg_class merge_classes(enum x86_64_reg_class class1, enum x86_64_reg_class class2) noexcept
struct _typelib_TypeDescription typelib_TypeDescription
bool examine_argument(typelib_TypeDescriptionReference *pTypeRef, int &nUsedGPR, int &nUsedSSE) noexcept
bool return_in_hidden_param(typelib_TypeDescriptionReference *pTypeRef) noexcept
Does function that returns this type use a hidden parameter, or registers?
void fill_struct(typelib_TypeDescriptionReference *pTypeRef, const sal_uInt64 *pGPR, const double *pSSE, void *pStruct) noexcept
ReturnKind getReturnKind(typelib_TypeDescriptionReference *type) noexcept