File tree 2 files changed +13
-14
lines changed
2 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ private struct Word {
17
17
Node[] inlineNodes;
18
18
bool error;
19
19
Type[] params;
20
+ size_t numReturns;
21
+
22
+ int StackEffect () => (- (cast (int ) params.length) + (cast (int ) numReturns));
20
23
}
21
24
22
25
private struct RM86Opts {
@@ -279,6 +282,16 @@ class BackendRM86 : CompilerBackend {
279
282
}
280
283
else {
281
284
if (word.raw) {
285
+ int stackEffect = word.StackEffect() * 8 ;
286
+
287
+ if (stackEffect != 0 ) {
288
+ output ~= format(" lea ax, [si + %d]\n " , stackEffect);
289
+ output ~= " push ax\n " ;
290
+ }
291
+ else {
292
+ output ~= " push si\n " ;
293
+ }
294
+
282
295
output ~= format(" call %s\n " , node.name);
283
296
}
284
297
else {
Original file line number Diff line number Diff line change @@ -525,21 +525,7 @@ class BackendX86_64 : CompilerBackend {
525
525
}
526
526
}
527
527
else {
528
- int stackEffect = word.StackEffect() * 8 ;
529
-
530
- if (stackEffect != 0 ) {
531
- output ~= format(" lea r14, [r15 + %d]\n " , stackEffect);
532
- output ~= " push r14\n " ;
533
- }
534
- else {
535
- output ~= " push r15\n " ;
536
- }
537
-
538
528
output ~= format(" call __func__%s\n " , node.name.Sanitise());
539
-
540
- if (word.error) {
541
- output ~= " pop r15\n " ;
542
- }
543
529
}
544
530
}
545
531
You can’t perform that action at this time.
0 commit comments