Initial work on llvm bindings, with test

db4
Matthew Willis 2009-06-15 21:42:13 +09:00
parent 56cb3c6f59
commit a021ba53fe
6 changed files with 503 additions and 0 deletions

1
work/llvm/authors.txt Normal file
View File

@ -0,0 +1 @@
Matthew Willis

325
work/llvm/core/core.factor Normal file
View File

@ -0,0 +1,325 @@
USING: alien.libraries alien.syntax ;
IN: llvm.core
<<
"LLVMSystem" "/usr/local/lib/libLLVMSystem.dylib" "cdecl" add-library
"LLVMSupport" "/usr/local/lib/libLLVMSupport.dylib" "cdecl" add-library
"LLVMCore" "/usr/local/lib/libLLVMCore.dylib" "cdecl" add-library
>>
! llvm-c/Core.h
LIBRARY: LLVMCore
TYPEDEF: uint unsigned
TYPEDEF: unsigned enum
CONSTANT: LLVMZExtAttribute BIN: 1
CONSTANT: LLVMSExtAttribute BIN: 10
CONSTANT: LLVMNoReturnAttribute BIN: 100
CONSTANT: LLVMInRegAttribute BIN: 1000
CONSTANT: LLVMStructRetAttribute BIN: 10000
CONSTANT: LLVMNoUnwindAttribute BIN: 100000
CONSTANT: LLVMNoAliasAttribute BIN: 1000000
CONSTANT: LLVMByValAttribute BIN: 10000000
CONSTANT: LLVMNestAttribute BIN: 100000000
CONSTANT: LLVMReadNoneAttribute BIN: 1000000000
CONSTANT: LLVMReadOnlyAttribute BIN: 10000000000
TYPEDEF: enum LLVMAttribute;
C-ENUM:
LLVMVoidTypeKind
LLVMFloatTypeKind
LLVMDoubleTypeKind
LLVMX86_FP80TypeKind
LLVMFP128TypeKind
LLVMPPC_FP128TypeKind
LLVMLabelTypeKind
LLVMIntegerTypeKind
LLVMFunctionTypeKind
LLVMStructTypeKind
LLVMArrayTypeKind
LLVMPointerTypeKind
LLVMOpaqueTypeKind
LLVMVectorTypeKind ;
TYPEDEF: enum LLVMTypeKind
C-ENUM:
LLVMExternalLinkage
LLVMLinkOnceLinkage
LLVMWeakLinkage
LLVMAppendingLinkage
LLVMInternalLinkage
LLVMDLLImportLinkage
LLVMDLLExportLinkage
LLVMExternalWeakLinkage
LLVMGhostLinkage ;
TYPEDEF: enum LLVMLinkage
C-ENUM:
LLVMDefaultVisibility
LLVMHiddenVisibility
LLVMProtectedVisibility ;
TYPEDEF: enum LLVMVisibility
CONSTANT: LLVMCCallConv 0
CONSTANT: LLVMFastCallConv 8
CONSTANT: LLVMColdCallConv 9
CONSTANT: LLVMX86StdcallCallConv 64
CONSTANT: LLVMX86FastcallCallConv 65
TYPEDEF: enum LLVMCallConv
CONSTANT: LLVMIntEQ 32
CONSTANT: LLVMIntNE 33
CONSTANT: LLVMIntUGT 34
CONSTANT: LLVMIntUGE 35
CONSTANT: LLVMIntULT 36
CONSTANT: LLVMIntULE 37
CONSTANT: LLVMIntSGT 38
CONSTANT: LLVMIntSGE 39
CONSTANT: LLVMIntSLT 40
CONSTANT: LLVMIntSLE 41
TYPEDEF: enum LLVMIntPredicate
C-ENUM:
LLVMRealPredicateFalse
LLVMRealOEQ
LLVMRealOGT
LLVMRealOGE
LLVMRealOLT
LLVMRealOLE
LLVMRealONE
LLVMRealORD
LLVMRealUNO
LLVMRealUEQ
LLVMRealUGT
LLVMRealUGE
LLVMRealULT
LLVMRealULE
LLVMRealUNE
LLVMRealPredicateTrue ;
TYPEDEF: enum LLVMRealPredicate
! Opaque Types
TYPEDEF: void* LLVMModuleRef
TYPEDEF: void* LLVMPassManagerRef
TYPEDEF: void* LLVMModuleProviderRef
TYPEDEF: void* LLVMTypeRef
TYPEDEF: void* LLVMValueRef
TYPEDEF: void* LLVMBasicBlockRef
TYPEDEF: void* LLVMBuilderRef
! Functions
FUNCTION: void LLVMDisposeMessage ( char *Message ) ;
FUNCTION: LLVMModuleRef LLVMModuleCreateWithName ( char* ModuleID ) ;
FUNCTION: int LLVMAddTypeName ( LLVMModuleRef M, char* Name, LLVMTypeRef Ty ) ;
FUNCTION: void LLVMDisposeModule ( LLVMModuleRef M ) ;
FUNCTION: void LLVMDumpModule ( LLVMModuleRef M ) ;
FUNCTION: LLVMModuleProviderRef
LLVMCreateModuleProviderForExistingModule ( LLVMModuleRef M ) ;
FUNCTION: void LLVMDisposeModuleProvider ( LLVMModuleProviderRef MP ) ;
FUNCTION: LLVMTypeRef LLVMIntType ( unsigned NumBits ) ;
FUNCTION: LLVMTypeRef
LLVMFunctionType ( LLVMTypeRef ReturnType,
LLVMTypeRef* ParamTypes,
unsigned ParamCount,
int IsVarArg ) ;
FUNCTION: unsigned LLVMCountParams ( LLVMValueRef Fn ) ;
FUNCTION: void LLVMGetParams ( LLVMValueRef Fn, LLVMValueRef* Params ) ;
FUNCTION: LLVMValueRef
LLVMAddFunction ( LLVMModuleRef M, char* Name, LLVMTypeRef FunctionTy ) ;
FUNCTION: unsigned LLVMGetFunctionCallConv ( LLVMValueRef Fn ) ;
FUNCTION: void LLVMSetFunctionCallConv ( LLVMValueRef Fn, unsigned CC ) ;
FUNCTION: LLVMBasicBlockRef
LLVMAppendBasicBlock ( LLVMValueRef Fn, char* Name ) ;
FUNCTION: LLVMValueRef LLVMGetBasicBlockParent ( LLVMBasicBlockRef BB ) ;
! Values
FUNCTION: LLVMTypeRef LLVMTypeOf ( LLVMValueRef Val ) ;
FUNCTION: char* LLVMGetValueName ( LLVMValueRef Val ) ;
FUNCTION: void LLVMSetValueName ( LLVMValueRef Val, char* Name ) ;
FUNCTION: void LLVMDumpValue ( LLVMValueRef Val ) ;
! Instruction Builders
FUNCTION: LLVMBuilderRef LLVMCreateBuilder ( ) ;
FUNCTION: void LLVMPositionBuilder
( LLVMBuilderRef Builder, LLVMBasicBlockRef Block, LLVMValueRef Instr ) ;
FUNCTION: void LLVMPositionBuilderBefore
( LLVMBuilderRef Builder, LLVMValueRef Instr ) ;
FUNCTION: void LLVMPositionBuilderAtEnd
( LLVMBuilderRef Builder, LLVMBasicBlockRef Block ) ;
FUNCTION: LLVMBasicBlockRef LLVMGetInsertBlock
( LLVMBuilderRef Builder ) ;
FUNCTION: void LLVMClearInsertionPosition
( LLVMBuilderRef Builder ) ;
FUNCTION: void LLVMInsertIntoBuilder
( LLVMBuilderRef Builder, LLVMValueRef Instr ) ;
FUNCTION: void LLVMDisposeBuilder
( LLVMBuilderRef Builder ) ;
! IB Terminators
FUNCTION: LLVMValueRef LLVMBuildRetVoid
( LLVMBuilderRef Builder ) ;
FUNCTION: LLVMValueRef LLVMBuildRet
( LLVMBuilderRef Builder, LLVMValueRef V ) ;
FUNCTION: LLVMValueRef LLVMBuildBr
( LLVMBuilderRef Builder, LLVMBasicBlockRef Dest ) ;
FUNCTION: LLVMValueRef LLVMBuildCondBr
( LLVMBuilderRef Builder, LLVMValueRef If, LLVMBasicBlockRef Then, LLVMBasicBlockRef Else ) ;
FUNCTION: LLVMValueRef LLVMBuildSwitch
( LLVMBuilderRef Builder, LLVMValueRef V, LLVMBasicBlockRef Else, unsigned NumCases ) ;
FUNCTION: LLVMValueRef LLVMBuildInvoke
( LLVMBuilderRef Builder, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs,
LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildUnwind
( LLVMBuilderRef Builder ) ;
FUNCTION: LLVMValueRef LLVMBuildUnreachable
( LLVMBuilderRef Builder ) ;
! IB Add Case to Switch
FUNCTION: void LLVMAddCase
( LLVMValueRef Switch, LLVMValueRef OnVal, LLVMBasicBlockRef Dest ) ;
! IB Arithmetic
FUNCTION: LLVMValueRef LLVMBuildAdd
( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildSub
( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildMul
( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildUDiv
( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildSDiv
( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildFDiv
( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildURem
( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildSRem
( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildFRem
( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildShl
( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildLShr
( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildAShr
( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildAnd
( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildOr
( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildXor
( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildNeg
( LLVMBuilderRef Builder, LLVMValueRef V, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildNot
( LLVMBuilderRef Builder, LLVMValueRef V, char* Name ) ;
! IB Memory
FUNCTION: LLVMValueRef LLVMBuildMalloc
( LLVMBuilderRef Builder, LLVMTypeRef Ty, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildArrayMalloc
( LLVMBuilderRef Builder, LLVMTypeRef Ty, LLVMValueRef Val, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildAlloca
( LLVMBuilderRef Builder, LLVMTypeRef Ty, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildArrayAlloca
( LLVMBuilderRef Builder, LLVMTypeRef Ty, LLVMValueRef Val, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildFree
( LLVMBuilderRef Builder, LLVMValueRef PointerVal ) ;
FUNCTION: LLVMValueRef LLVMBuildLoad
( LLVMBuilderRef Builder, LLVMValueRef PointerVal, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildStore
( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMValueRef Ptr ) ;
FUNCTION: LLVMValueRef LLVMBuildGEP
( LLVMBuilderRef B, LLVMValueRef Pointer, LLVMValueRef *Indices,
unsigned NumIndices, char* Name ) ;
! IB Casts
FUNCTION: LLVMValueRef LLVMBuildTrunc
( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildZExt
( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildSExt
( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildFPToUI
( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildFPToSI
( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildUIToFP
( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildSIToFP
( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildFPTrunc
( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildFPExt
( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildPtrToInt
( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildIntToPtr
( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildBitCast
( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, char* Name ) ;
! IB Comparisons
FUNCTION: LLVMValueRef LLVMBuildICmp
( LLVMBuilderRef Builder, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildFCmp
( LLVMBuilderRef Builder, LLVMRealPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, char* Name ) ;
! IB Misc Instructions
FUNCTION: LLVMValueRef LLVMBuildPhi
( LLVMBuilderRef Builder, LLVMTypeRef Ty, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildCall
( LLVMBuilderRef Builder, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildSelect
( LLVMBuilderRef Builder, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildVAArg
( LLVMBuilderRef Builder, LLVMValueRef List, LLVMTypeRef Ty, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildExtractElement
( LLVMBuilderRef Builder, LLVMValueRef VecVal, LLVMValueRef Index, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildInsertElement
( LLVMBuilderRef Builder, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildShuffleVector
( LLVMBuilderRef Builder, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildExtractValue
( LLVMBuilderRef Builder, LLVMValueRef AggVal, unsigned Index, char* Name ) ;
FUNCTION: LLVMValueRef LLVMBuildInsertValue
( LLVMBuilderRef Builder, LLVMValueRef AggVal, LLVMValueRef EltVal, unsigned Index, char* Name ) ;

View File

@ -0,0 +1,59 @@
USING: alien.libraries alien.syntax llvm.core ;
IN: llvm.engine
<<
"LLVMExecutionEngine" "/usr/local/lib/libLLVMExecutionEngine.dylib" "cdecl" add-library
"LLVMTarget" "/usr/local/lib/libLLVMTarget.dylib" "cdecl" add-library
"LLVMAnalysis" "/usr/local/lib/libLLVMAnalysis.dylib" "cdecl" add-library
"LLVMipa" "/usr/local/lib/libLLVMipa.dylib" "cdecl" add-library
"LLVMTransformUtils" "/usr/local/lib/libLLVMTransformUtils.dylib" "cdecl" add-library
"LLVMScalarOpts" "/usr/local/lib/libLLVMScalarOpts.dylib" "cdecl" add-library
"LLVMCodeGen" "/usr/local/lib/libLLVMCodeGen.dylib" "cdecl" add-library
"LLVMAsmPrinter" "/usr/local/lib/libLLVMAsmPrinter.dylib" "cdecl" add-library
"LLVMSelectionDAG" "/usr/local/lib/libLLVMSelectionDAG.dylib" "cdecl" add-library
"LLVMX86CodeGen" "/usr/local/lib/libLLVMX86CodeGen.dylib" "cdecl" add-library
"LLVMJIT" "/usr/local/lib/libLLVMJIT.dylib" "cdecl" add-library
"LLVMInterpreter.dylib" "/usr/local/lib/libLLVMInterpreter.dylib" "cdecl" add-library
>>
! llvm-c/ExecutionEngine.h
LIBRARY: LLVMExecutionEngine
TYPEDEF: void* LLVMGenericValueRef
TYPEDEF: void* LLVMExecutionEngineRef
FUNCTION: LLVMGenericValueRef LLVMCreateGenericValueOfInt
( LLVMTypeRef Ty, ulonglong N, int IsSigned ) ;
FUNCTION: ulonglong LLVMGenericValueToInt
( LLVMGenericValueRef GenVal, int IsSigned ) ;
FUNCTION: int LLVMCreateExecutionEngine
( LLVMExecutionEngineRef *OutEE, LLVMModuleProviderRef MP, char** OutError ) ;
FUNCTION: int LLVMCreateJITCompiler
( LLVMExecutionEngineRef* OutJIT, LLVMModuleProviderRef MP, unsigned OptLevel, char** OutError ) ;
FUNCTION: void LLVMDisposeExecutionEngine ( LLVMExecutionEngineRef EE ) ;
FUNCTION: int LLVMFindFunction
( LLVMExecutionEngineRef EE, char* Name, LLVMValueRef* OutFn ) ;
FUNCTION: void* LLVMGetPointerToGlobal ( LLVMExecutionEngineRef EE, LLVMValueRef Global ) ;
FUNCTION: LLVMGenericValueRef LLVMRunFunction
( LLVMExecutionEngineRef EE, LLVMValueRef F, unsigned NumArgs, LLVMGenericValueRef* Args ) ;

View File

@ -0,0 +1,32 @@
USING: accessors alien compiler.units kernel
llvm tools.test words llvm.core ;
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

85
work/llvm/llvm.factor Normal file
View File

@ -0,0 +1,85 @@
USING: accessors alien.c-types alien.strings arrays
central destructors kernel llvm.core llvm.engine
quotations sequences specialized-arrays.alien ;
IN: llvm
: llvm-throw ( char** -- )
*void* [ 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* ;
: llvm-int ( n -- Value )
32 LLVMIntType swap 1 LLVMCreateGenericValueOfInt ;
: prepare-args ( function seq -- f numargs args )
over LLVMCountParams swap [ llvm-int ] map f suffix >void*-array ;

1
work/llvm/tags.txt Normal file
View File

@ -0,0 +1 @@
bindings