Mercurial > pub > dyncall > dyncall
comparison dyncall/dyncall_callvm_mips_o32.c @ 302:d55f9d508074
- mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
- cleanup of some mips files, removed unnecessary file, renamings..
- doc/manual cleanups, changelog entry
author | Tassilo Philipp |
---|---|
date | Mon, 21 May 2018 02:48:12 +0200 |
parents | f5577f6bf97a |
children | b104c5beec8b |
comparison
equal
deleted
inserted
replaced
301:74948b02cfa0 | 302:d55f9d508074 |
---|---|
75 self->mArgCount++; | 75 self->mArgCount++; |
76 } | 76 } |
77 | 77 |
78 static void dc_callvm_argPointer_mips_o32(DCCallVM* in_self, DCpointer x) | 78 static void dc_callvm_argPointer_mips_o32(DCCallVM* in_self, DCpointer x) |
79 { | 79 { |
80 dc_callvm_argInt_mips_o32(in_self, * (DCint*) &x ); | 80 dc_callvm_argInt_mips_o32(in_self, *(DCint*)&x); |
81 } | 81 } |
82 | 82 |
83 static void dc_callvm_argBool_mips_o32(DCCallVM* in_self, DCbool x) | 83 static void dc_callvm_argBool_mips_o32(DCCallVM* in_self, DCbool x) |
84 { | 84 { |
85 dc_callvm_argInt_mips_o32(in_self, (DCint)x); | 85 dc_callvm_argInt_mips_o32(in_self, (DCint)x); |
98 static void dc_callvm_argLong_mips_o32(DCCallVM* in_self, DClong x) | 98 static void dc_callvm_argLong_mips_o32(DCCallVM* in_self, DClong x) |
99 { | 99 { |
100 dc_callvm_argInt_mips_o32(in_self, (DCint)x); | 100 dc_callvm_argInt_mips_o32(in_self, (DCint)x); |
101 } | 101 } |
102 | 102 |
103 static void dc_callvm_argLongLong_mips_o32(DCCallVM* in_self, DClonglong Lv) | 103 static void dc_callvm_argLongLong_mips_o32(DCCallVM* in_self, DClonglong x) |
104 { | 104 { |
105 DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self; | 105 DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self; |
106 | 106 |
107 /* 64-bit values need to be aligned on 8 byte boundaries */ | 107 /* 64-bit values need to be aligned on 8 byte boundaries */ |
108 dcVecSkip(&self->mVecHead, dcVecSize(&self->mVecHead) & 4); | 108 dcVecSkip(&self->mVecHead, dcVecSize(&self->mVecHead) & 4); |
109 dcVecAppend(&self->mVecHead, &Lv, sizeof(DClonglong)); | 109 dcVecAppend(&self->mVecHead, &x, sizeof(DClonglong)); |
110 self->mArgCount += 1; | 110 self->mArgCount++; |
111 } | 111 } |
112 | 112 |
113 static void dc_callvm_argFloat_mips_o32(DCCallVM* in_self, DCfloat x) | 113 static void dc_callvm_argFloat_mips_o32(DCCallVM* in_self, DCfloat x) |
114 { | 114 { |
115 DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self; | 115 DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self; |
116 | 116 |
117 dcVecAppend(&self->mVecHead, &x, sizeof(DCfloat) ); | 117 dcVecAppend(&self->mVecHead, &x, sizeof(DCfloat)); |
118 | |
119 #if defined(DC__ABI_HARDFLOAT) | |
118 if (self->mArgCount < 2) { | 120 if (self->mArgCount < 2) { |
119 #if defined(DC__Endian_LITTLE) | 121 # if defined(DC__Endian_LITTLE) |
120 self->mRegData.u[self->mArgCount].f[0] = x; | 122 self->mRegData.u[self->mArgCount].f[0] = x; |
121 #else | 123 # else |
122 self->mRegData.u[self->mArgCount].f[1] = x; | 124 self->mRegData.u[self->mArgCount].f[1] = x; |
123 #endif | 125 # endif |
124 #if 0 | 126 # if 0 |
125 self->mRegData.u[self->mArgCount].f[1] = x; | 127 self->mRegData.u[self->mArgCount].f[1] = x; |
126 call kernel | 128 call kernel |
127 | 129 |
128 mips: | 130 mips: |
129 lwc1 $f12, 4($5) <--- byte offset 4 | 131 lwc1 $f12, 4($5) <--- byte offset 4 |
130 lwc1 $f13, 0($5) | 132 lwc1 $f13, 0($5) |
131 lwc1 $f14, 12($5) <--- byte offset 12 | 133 lwc1 $f14, 12($5) <--- byte offset 12 |
132 lwc1 $f15, 8($5) | 134 lwc1 $f15, 8($5) |
133 mipsel: | 135 mipsel: |
134 lwc1 $f12, 0($5) <--- byte offset 4 | 136 lwc1 $f12, 0($5) <--- byte offset 4 |
135 lwc1 $f13, 4($5) | 137 lwc1 $f13, 4($5) |
136 lwc1 $f14, 8($5) <--- byte offset 12 | 138 lwc1 $f14, 8($5) <--- byte offset 12 |
137 lwc1 $f15, 12($5) | 139 lwc1 $f15, 12($5) |
138 | 140 |
139 #if defined(DC__Endian_LITTLE) | 141 # if defined(DC__Endian_LITTLE) |
140 /* index 0 and 2 */ | 142 /* index 0 and 2 */ |
141 self->mRegData.floats[self->mArgCount*2] = x; | 143 self->mRegData.floats[self->mArgCount*2] = x; |
142 #else | 144 # else |
143 /* index 1 and 3 */ | 145 /* index 1 and 3 */ |
144 self->mRegData.floats[self->mArgCount*2+1] = x; | 146 self->mRegData.floats[self->mArgCount*2+1] = x; |
145 #endif | 147 # endif |
146 #endif | 148 # endif |
147 } | 149 } |
150 #endif /* DC__ABI_HARDFLOAT */ | |
151 | |
148 self->mArgCount++; | 152 self->mArgCount++; |
149 } | 153 } |
150 | 154 |
151 static void dc_callvm_argDouble_mips_o32(DCCallVM* in_self, DCdouble x) | 155 static void dc_callvm_argDouble_mips_o32(DCCallVM* in_self, DCdouble x) |
152 { | 156 { |
153 DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self; | 157 DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self; |
154 /* 64-bit values need to be aligned on 8 byte boundaries */ | 158 /* 64-bit values need to be aligned on 8 byte boundaries */ |
155 dcVecSkip(&self->mVecHead, dcVecSize(&self->mVecHead) & 4); | 159 dcVecSkip(&self->mVecHead, dcVecSize(&self->mVecHead) & 4); |
156 dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble) ); | 160 dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble)); |
161 | |
162 #if defined(DC__ABI_HARDFLOAT) | |
157 if (self->mArgCount < 2) | 163 if (self->mArgCount < 2) |
158 self->mRegData.u[self->mArgCount].d = x; | 164 self->mRegData.u[self->mArgCount].d = x; |
165 #endif /* DC__ABI_HARDFLOAT */ | |
166 | |
159 self->mArgCount++; | 167 self->mArgCount++; |
160 } | 168 } |
161 | 169 |
162 /* Call. */ | 170 /* Call. */ |
163 void dc_callvm_call_mips_o32(DCCallVM* in_self, DCpointer target) | 171 void dc_callvm_call_mips_o32(DCCallVM* in_self, DCpointer target) |