]> gitweb.factorcode.org Git - factor.git/commitdiff
remove llvm.bindings, made obsolete by llvm.wrappers and friends
authorMatthew Willis <matthew.willis@mac.com>
Tue, 30 Jun 2009 02:57:24 +0000 (11:57 +0900)
committerMatthew Willis <matthew.willis@mac.com>
Tue, 30 Jun 2009 02:57:24 +0000 (11:57 +0900)
extra/llvm/bindings/bindings-tests.factor [deleted file]
extra/llvm/bindings/bindings.factor [deleted file]

diff --git a/extra/llvm/bindings/bindings-tests.factor b/extra/llvm/bindings/bindings-tests.factor
deleted file mode 100644 (file)
index 59eaf27..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-USING: accessors alien compiler.units kernel
-llvm.bindings llvm.core tools.test words ;
-
-IN: scratchpad
-
-: add-abi ( x y -- x+y ) ! to be filled in by llvm
-    drop ;
-
-: llvm-add ( x y -- x+y )
-    "test" <module> [
-        {
-            { [ 32 LLVMIntType ] "add" }
-            { [ 32 LLVMIntType ] "x" }
-            { [ 32 LLVMIntType ] "y" }
-        } <function> [
-            "entry" <builder> [
-                builder value>> "x" get-param "y" get-param "sum" LLVMBuildAdd
-                builder value>> swap LLVMBuildRet drop
-            ] with-builder
-        ] with-function
-        
-        <engine>
-    ] with-module
-    
-    [
-        "add" find-function global>pointer
-        [ "int" { "int" "int" } "cdecl" alien-indirect ] curry \ add-abi swap
-        (( x y -- x+y )) [ define-declared ] with-compilation-unit
-        add-abi ! call our new word
-    ] with-engine ; inline
-
-[ 7 ] [ 3 4 llvm-add ] unit-test
\ No newline at end of file
diff --git a/extra/llvm/bindings/bindings.factor b/extra/llvm/bindings/bindings.factor
deleted file mode 100644 (file)
index 390b55a..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-USING: accessors alien.c-types alien.strings arrays
-central destructors kernel llvm.core llvm.engine
-quotations sequences specialized-arrays.alien ;
-
-IN: llvm.bindings
-
-: llvm-throw ( char** -- )
-    [ alien>string ] [ LLVMDisposeMessage ] bi throw ;
-
-DISPOSABLE-CENTRAL: module
-CENTRAL: function
-DISPOSABLE-CENTRAL: builder
-DISPOSABLE-CENTRAL: engine
-
-: <dispose> ( alien class -- disposable ) new swap >>value ;
-
-TUPLE: LLVMModule value disposed ;
-M: LLVMModule dispose* value>> LLVMDisposeModule ;
-
-: <module> ( name -- module )
-    LLVMModuleCreateWithName LLVMModule <dispose> ;
-
-TUPLE: LLVMModuleProvider value disposed ;
-M: LLVMModuleProvider dispose* value>> LLVMDisposeModuleProvider ;
-
-: <provider> ( -- module-provider )
-    module t >>disposed value>> LLVMCreateModuleProviderForExistingModule
-    LLVMModuleProvider <dispose> ;
-
-: (add-block) ( name -- basic-block )
-    function swap LLVMAppendBasicBlock ;
-
-TUPLE: LLVMBuilder value disposed ;
-M: LLVMBuilder dispose* value>> LLVMDisposeBuilder ;
-
-: <builder> ( name -- builder )
-    (add-block) LLVMCreateBuilder [ swap LLVMPositionBuilderAtEnd ] keep
-    LLVMBuilder <dispose> ;
-
-TUPLE: LLVMExecutionEngine value disposed ;
-M: LLVMExecutionEngine dispose* value>> LLVMDisposeExecutionEngine ;
-
-: <engine> ( -- engine )
-    <provider> [
-        dup value>> f <void*> f <void*>
-        [ swapd 0 swap LLVMCreateJITCompiler drop ] 2keep
-        *void* [ llvm-throw ] when* *void* LLVMExecutionEngine <dispose>
-        swap t >>disposed drop
-    ] with-disposal ;
-
-: resolve-type ( callable/alien -- type )
-    dup callable? [ call( -- type ) ] when ;
-
-: <function-type> ( args -- type )
-    [ resolve-type ] map
-    unclip swap [ >void*-array ] keep length 0 LLVMFunctionType ;
-
-: >>cc ( function calling-convention -- function )
-    dupd LLVMSetFunctionCallConv ;
-
-: params>> ( function -- array )
-    dup LLVMCountParams "LLVMValueRef" <c-array> [ LLVMGetParams ] keep
-    byte-array>void*-array >array ;
-
-: get-param ( name -- value )
-    function params>> swap [ swap LLVMGetValueName = ] curry find nip ;
-
-: set-param-names ( names function -- )
-    params>> swap [ LLVMSetValueName ] 2each ;
-
-: <function> ( args -- function )
-    module value>> over first second pick
-    [ first ] map <function-type> LLVMAddFunction LLVMCCallConv >>cc tuck
-    [ rest [ second ] map ] dip set-param-names ;
-
-: global>pointer ( value -- alien ) engine value>> swap LLVMGetPointerToGlobal ;
-
-: find-function ( name -- fn )
-    engine value>> swap f <void*> [ LLVMFindFunction drop ] keep *void* ;
\ No newline at end of file