LLVMCEXT.st
changeset 24 7e7ddd55174c
child 29 6ea02617c9ab
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LLVMCEXT.st	Mon Aug 10 19:26:29 2015 +0100
@@ -0,0 +1,104 @@
+"
+    Copyright (C) 2015-now Jan Vrany
+
+    This code is not an open-source (yet). You may use this code
+    for your own experiments and projects, given that:
+
+    * all modification to the code will be sent to the
+      original author for inclusion in future releases
+    * this is not used in any commercial software
+
+    This license is provisional and may (will) change in
+    a future.
+"
+"{ Package: 'jv:llvm_s' }"
+
+"{ NameSpace: Smalltalk }"
+
+Object subclass:#LLVMCEXT
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'LLVM-S-Internal'
+!
+
+!LLVMCEXT class methodsFor:'documentation'!
+
+copyright
+"
+    Copyright (C) 2015-now Jan Vrany
+
+    This code is not an open-source (yet). You may use this code
+    for your own experiments and projects, given that:
+
+    * all modification to the code will be sent to the
+      original author for inclusion in future releases
+    * this is not used in any commercial software
+
+    This license is provisional and may (will) change in
+    a future.
+"
+!
+
+documentation
+"
+    This class contains call out to LLVM C API extensions library
+    (which is part of llvm-s bindings).
+
+    This library exposes important LLVM C++ API tp C users, including:
+    * access to intrinsics
+
+    [author:]
+        Jan Vrany <jan.vrany@fit.cvut.cz>
+
+    [instance variables:]
+
+    [class variables:]
+
+    [see also:]
+
+"
+! !
+
+!LLVMCEXT class methodsFor:'accessing'!
+
+libraryName
+    | pkgDir |
+    pkgDir := Smalltalk getPackageDirectoryForPackage: #jv:llvm_s.
+    pkgDir isNil ifTrue:[ 
+        self error: 'Cannot find package directory for jv:llvm_c. Check #packagePath'.
+    ].
+    OperatingSystem isUNIXlike ifTrue:[ 
+        ^ (pkgDir / 'llvm_c_ext' / 'lib' / 'libLLVM-C-EXT.so') pathName
+    ].
+    self error:'Unsupported operating system'
+
+    "Created: / 10-08-2015 / 16:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!LLVMCEXT class methodsFor:'primitives'!
+
+GetIntrinsicByName: mod _: name _: count _: types
+    "@param mod: LLVMValueRef
+     @param name: const char *
+     @param count: int32
+     @param types: LLVMTypeRef*
+     @return: LLVMValue
+    "
+
+    <cdecl: LLVMFunction "LLVMGetIntrinsicByName" ( LLVMModule charPointer int32 pointer ) >
+    self primitiveFailed
+
+    "Created: / 10-08-2015 / 17:02:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!LLVMCEXT class methodsFor:'documentation'!
+
+version
+    ^ 'Path: jv/llvm_s/LLVMCEXT.st, Version: 1.0, User: jv, Time: 2015-08-10T19:13:47.892+01'
+!
+
+version_HG
+    ^ 'Path: jv/llvm_s/LLVMCEXT.st, Version: 1.0, User: jv, Time: 2015-08-10T19:13:47.892+01'
+! !
+