comparison dyncall/dyncall_callvm_mips_n64.c @ 131:21537652361e

- fixed mips64 n32 build (not sure if working, though) - cosmetics, comments cleanups
author cslag
date Thu, 07 Jul 2016 14:51:30 +0200
parents 9a554d1c4da6
children f5577f6bf97a
comparison
equal deleted inserted replaced
130:01a2aee8d30b 131:21537652361e
4 Library: dyncall 4 Library: dyncall
5 File: dyncall/dyncall_callvm_mips_n64.c 5 File: dyncall/dyncall_callvm_mips_n64.c
6 Description: mips "n64" ABI callvm implementation 6 Description: mips "n64" ABI callvm implementation
7 License: 7 License:
8 8
9 Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>, 9 Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
10 Tassilo Philipp <tphilipp@potion-studios.com> 10 Tassilo Philipp <tphilipp@potion-studios.com>
11 11
12 Permission to use, copy, modify, and distribute this software for any 12 Permission to use, copy, modify, and distribute this software for any
13 purpose with or without fee is hereby granted, provided that the above 13 purpose with or without fee is hereby granted, provided that the above
14 copyright notice and this permission notice appear in all copies. 14 copyright notice and this permission notice appear in all copies.
137 dcVecSkip(&self->mVecHead, sizeof(DCfloat) ); 137 dcVecSkip(&self->mVecHead, sizeof(DCfloat) );
138 } 138 }
139 } 139 }
140 140
141 141
142 /* Ellipsis calls: 142 /* Ellipsis calls:
143 - float is promoted to double (due to ANSI C). 143 - float is promoted to double (due to ANSI C).
144 - double is passed via integer register-file (due to MIPS ABI). 144 - double is passed via integer register-file (due to MIPS ABI).
145 */ 145 */
146 146
147 static void dc_callvm_argDouble_mips_n64_ellipsis(DCCallVM* in_self, DCdouble x) 147 static void dc_callvm_argDouble_mips_n64_ellipsis(DCCallVM* in_self, DCdouble x)
159 159
160 void dc_callvm_call_mips_n64(DCCallVM* in_self, DCpointer target) 160 void dc_callvm_call_mips_n64(DCCallVM* in_self, DCpointer target)
161 { 161 {
162 DCCallVM_mips_n64* self = (DCCallVM_mips_n64*)in_self; 162 DCCallVM_mips_n64* self = (DCCallVM_mips_n64*)in_self;
163 /* at minimum provide 16-bytes 163 /* at minimum provide 16-bytes
164 which hold the first four integer register as spill area 164 which hold the first four integer register as spill area
165 and are automatically loaded to $4-$7 165 and are automatically loaded to $4-$7
166 */ 166 */
167 size_t size = DC_MAX(16, ( ( (unsigned) dcVecSize(&self->mVecHead) ) +7UL ) & (-8UL) ); 167 size_t size = DC_MAX(16, ( ( (unsigned) dcVecSize(&self->mVecHead) ) +7UL ) & (-8UL) );
168 dcCall_mips_n64(target, &self->mRegData, size, dcVecData(&self->mVecHead)); 168 dcCall_mips_n64(target, &self->mRegData, size, dcVecData(&self->mVecHead));
169 } 169 }
175 &dc_callvm_free_mips_n64 175 &dc_callvm_free_mips_n64
176 , &dc_callvm_reset_mips_n64 176 , &dc_callvm_reset_mips_n64
177 , &dc_callvm_mode_mips_n64 177 , &dc_callvm_mode_mips_n64
178 , &dc_callvm_argBool_mips_n64 178 , &dc_callvm_argBool_mips_n64
179 , &dc_callvm_argChar_mips_n64 179 , &dc_callvm_argChar_mips_n64
180 , &dc_callvm_argShort_mips_n64 180 , &dc_callvm_argShort_mips_n64
181 , &dc_callvm_argInt_mips_n64 181 , &dc_callvm_argInt_mips_n64
182 , &dc_callvm_argLong_mips_n64 182 , &dc_callvm_argLong_mips_n64
183 , &dc_callvm_argLongLong_mips_n64 183 , &dc_callvm_argLongLong_mips_n64
184 , &dc_callvm_argFloat_mips_n64 184 , &dc_callvm_argFloat_mips_n64
185 , &dc_callvm_argDouble_mips_n64 185 , &dc_callvm_argDouble_mips_n64
239 break; 239 break;
240 case DC_CALL_C_ELLIPSIS_VARARGS: 240 case DC_CALL_C_ELLIPSIS_VARARGS:
241 vt = &gVT_mips_n64_ellipsis; 241 vt = &gVT_mips_n64_ellipsis;
242 break; 242 break;
243 default: 243 default:
244 self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE; 244 self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE;
245 return; 245 return;
246 } 246 }
247 dc_callvm_base_init(&self->mInterface, vt); 247 dc_callvm_base_init(&self->mInterface, vt);
248 } 248 }
249 249