diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-23 18:51:24 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-23 18:51:24 +0200 |
commit | 02dfcf5134195d9a0fc13bfbee235e6f8b5730f1 (patch) | |
tree | 5fb5d4caaee9f537334ce51dd1b972818f2eac84 | |
parent | 93a399f0efd42a7c958a576b2a91f8dce2535809 (diff) |
MLKLLVMCompiler: Add +insertPointerTrace:.
-rw-r--r-- | MLKLLVMCompiler.mm | 16 |
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 |