summaryrefslogtreecommitdiff
path: root/lang/ocaml/patches/patch-ac
blob: 24fbeacf61979ecdc134b91fda70b1f7bf2a90b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$NetBSD: patch-ac,v 1.4 2005/02/04 21:35:51 adrianp Exp $

--- asmcomp/power/emit.mlp.orig	2004-10-14 15:39:35.000000000 +0100
+++ asmcomp/power/emit.mlp	2004-10-14 15:41:11.000000000 +0100
@@ -793,6 +793,30 @@
       emit_instr i None;
       emit_all i.next
 
+(* Emission of the profiling prelude *)
+
+let emit_profile () =
+  match Config.system with
+    "bsd" ->
+      `        stwu 1, -32(1)\n`;
+      `        mflr 0\n`;
+      `        stw 0, 4(1)\n`;
+      `        stw 2, 8(1)\n`;
+      `        stw 3, 12(1)\n`;
+      `        stw 4, 16(1)\n`;
+      `        stw 5, 20(1)\n`;
+      `        stw 6, 24(1)\n`;
+      `        stw 7, 28(1)\n`;
+      `        bl {emit_symbol "_mcount"}\n`;
+      `        lwz 2, 8(1)\n`;
+      `        lwz 3, 12(1)\n`;
+      `        lwz 4, 16(1)\n`;
+      `        lwz 5, 20(1)\n`;
+      `        lwz 6, 24(1)\n`;
+      `        lwz 7, 28(1)\n`;
+      `        addic 1, 1, 32\n`;
+  | _ -> () (*unsupported yet*)
+
 (* Emission of a function declaration *)
 
 let fundecl fundecl =