From 9ffcbf66b99adbfc72639b7ce3d1e13d8f1af302 Mon Sep 17 00:00:00 2001 From: Samuel Hammersberg Date: Tue, 18 Apr 2023 15:28:03 +0200 Subject: [PATCH] Added support for running GC profiller. --- src/Codegen/CompilerState.hs | 2 ++ src/Codegen/Emits.hs | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Codegen/CompilerState.hs b/src/Codegen/CompilerState.hs index 3aa4123..114a651 100644 --- a/src/Codegen/CompilerState.hs +++ b/src/Codegen/CompilerState.hs @@ -138,4 +138,6 @@ defaultStart = , UnsafeRaw "declare external void @cheap_init()\n" , UnsafeRaw "declare external ptr @cheap_alloc(i64)\n" , UnsafeRaw "declare external void @cheap_dispose()\n" + , UnsafeRaw "declare external ptr @cheap_the()\n" + , UnsafeRaw "declare external void @cheap_set_profiler(ptr, i1)\n" ] \ No newline at end of file diff --git a/src/Codegen/Emits.hs b/src/Codegen/Emits.hs index 0309514..481af4f 100644 --- a/src/Codegen/Emits.hs +++ b/src/Codegen/Emits.hs @@ -127,7 +127,11 @@ compileScs (MIR.DData (MIR.Data typ ts) : xs) = do compileScs xs firstMainContent :: [LLVMIr] -firstMainContent = [UnsafeRaw "call void @cheap_init()\n"] +firstMainContent = + [ UnsafeRaw "%prof = call ptr @cheap_the()\n" + , UnsafeRaw "call void @cheap_set_profiler(ptr %prof, i1 true)\n" + , UnsafeRaw "call void @cheap_init()\n" + ] lastMainContent :: LLVMValue -> [LLVMIr] lastMainContent var =