File tree Expand file tree Collapse file tree 2 files changed +13
-14
lines changed Expand file tree Collapse file tree 2 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ private struct Word {
1717 Node[] inlineNodes;
1818 bool error;
1919 Type[] params;
20+ size_t numReturns;
21+
22+ int StackEffect () => (- (cast (int ) params.length) + (cast (int ) numReturns));
2023}
2124
2225private struct RM86Opts {
@@ -279,6 +282,16 @@ class BackendRM86 : CompilerBackend {
279282 }
280283 else {
281284 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+
282295 output ~= format(" call %s\n " , node.name);
283296 }
284297 else {
Original file line number Diff line number Diff line change @@ -525,21 +525,7 @@ class BackendX86_64 : CompilerBackend {
525525 }
526526 }
527527 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-
538528 output ~= format(" call __func__%s\n " , node.name.Sanitise());
539-
540- if (word.error) {
541- output ~= " pop r15\n " ;
542- }
543529 }
544530 }
545531
You can’t perform that action at this time.
0 commit comments