LLVMModule.st
changeset 33 feabf14b6c1d
parent 24 7e7ddd55174c
child 35 fd459b38f324
--- a/LLVMModule.st	Mon Aug 17 09:16:53 2015 +0100
+++ b/LLVMModule.st	Mon Aug 17 08:53:26 2015 +0100
@@ -54,17 +54,39 @@
     ^ LLVM GetDataLayout: self.
 
     "Created: / 11-07-2015 / 06:57:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+debugInfoBuilder
+    ^ LLVMDIBuilder newForModule: self
+
+    "Created: / 13-08-2015 / 06:35:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !LLVMModule methodsFor:'adding & removing'!
 
+addFlag: key value: value behavior: behavior
+    self assertIsString: key.
+    self assertIsMetadata: value.
+    self assertIsIntegerUnsigned: behavior.
+
+    LLVMCEXT ModuleAddModuleFlag: self _: behavior _: key _: value
+
+    "Created: / 15-08-2015 / 06:58:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 15-08-2015 / 22:06:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 addFunctionNamed: name type: type
+    | function |
     self assertIsString: name.  
     self assert: type kind == LLVMFunctionTypeKind.
-    ^ LLVM AddFunction: self _: name _: type.
+
+    function := LLVM AddFunction: self _: name _: type.
+    "/ TODO: Certainly a hack. must find a better way to do this.
+    function changeClassTo: LLVMFunction.
+    ^ function
 
     "Created: / 07-07-2015 / 21:59:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 10-08-2015 / 17:07:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-08-2015 / 13:05:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 addGlobalNamed: name type: type value: value
@@ -104,12 +126,28 @@
     "Created: / 11-07-2015 / 09:37:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+getIntrinsicNamed: name 
+    | function |
+
+    function := self getIntrinsicNamed: name types: #().
+    "/ TODO: Certainly a hack. must find a better way to do this.
+    function changeClassTo: LLVMFunction.
+    ^ function
+
+    "Created: / 14-08-2015 / 14:10:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 getIntrinsicNamed: name types: types
+    | intrinsic |    
     self assertIsString: name.  
     self assertIsTypeArray: types.
-    ^ LLVMCEXT GetIntrinsicByName: self _: name _: types size _: types asLLVMObjectArray.
+    intrinsic := LLVMCEXT GetIntrinsicByName: self _: name _: types size _: types asLLVMObjectArray.
+    "/ TODO: Certainly a hack. must find a better way to do this.
+    intrinsic changeClassTo: LLVMFunction.
+    ^ intrinsic
 
     "Created: / 10-08-2015 / 17:06:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 17-08-2015 / 07:43:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !LLVMModule methodsFor:'debugging'!