From 02dfcf5134195d9a0fc13bfbee235e6f8b5730f1 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 23 Aug 2008 18:51:24 +0200 Subject: MLKLLVMCompiler: Add +insertPointerTrace:. --- MLKLLVMCompiler.mm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm index 729db50..81a2361 100644 --- a/MLKLLVMCompiler.mm +++ b/MLKLLVMCompiler.mm @@ -335,9 +335,23 @@ static Constant Type::Int32Ty, PointerTy, NULL); - + builder.CreateCall (function, createGlobalStringPtr ([message UTF8String])); } + ++(void) insertPointerTrace:(Value *)pointerValue +{ + Constant *function = + module->getOrInsertFunction ("printf", + Type::Int32Ty, + PointerTy, + PointerTy, + NULL); + + builder.CreateCall2 (function, + createGlobalStringPtr ("%p\n"), + builder.CreateBitCast (pointerValue, PointerTy)); +} @end -- cgit v1.2.3