summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-08-23 18:51:24 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-08-23 18:51:24 +0200
commit02dfcf5134195d9a0fc13bfbee235e6f8b5730f1 (patch)
tree5fb5d4caaee9f537334ce51dd1b972818f2eac84
parent93a399f0efd42a7c958a576b2a91f8dce2535809 (diff)
MLKLLVMCompiler: Add +insertPointerTrace:.
-rw-r--r--MLKLLVMCompiler.mm16
1 files changed, 15 insertions, 1 deletions
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