From a3f73278b198d0366c590ec8bd7fb8cad5c2931d Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 26 Oct 2021 23:39:36 -0700 Subject: task: juggling function outputs between registers --- tutorial/task9-solution.mu | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tutorial/task9-solution.mu (limited to 'tutorial/task9-solution.mu') diff --git a/tutorial/task9-solution.mu b/tutorial/task9-solution.mu new file mode 100644 index 00000000..9ecf0ee8 --- /dev/null +++ b/tutorial/task9-solution.mu @@ -0,0 +1,23 @@ +fn f -> _/eax: int { + return 2 +} + +fn g -> _/eax: int { + return 3 +} + +fn add-f-and-g -> _/eax: int { + var _x/eax: int <- f + var x/ecx: int <- copy _x + var y/eax: int <- g + x <- add y + return x +} + +fn test-add-f-and-g { + var result/eax: int <- add-f-and-g + check-ints-equal result, 5, "F - test-add-f-and-g\n" +} + +fn main { +} -- cgit 1.4.1-2-gfad0 Soul of a tiny new machine. More thorough tests → More comprehensible and rewrite-friendly software → More resilient society.Kartik K. Agaram <vc@akkartik.com>
about summary refs log tree commit diff stats
path: root/translate_mu
blob: 646bba204057034bdc8a9657687f135f952c3105 (plain) (blame)
1
2
3
4
5
6
7
8
9