@@ -171,11 +171,14 @@ LLVMSwift provides a JIT abstraction to make executing code in LLVM modules quic
171171
172172``` swift
173173// Setup the JIT
174- let jit = try ! JIT (module : module, machine : TargetMachine ())
174+ let jit = try JIT (machine : TargetMachine ())
175175typealias FnPtr = @convention (c) (Bool ) -> Double
176+ _ = try jit.addEagerlyCompiledIR (module) { (name) -> JIT.TargetAddress in
177+ return JIT.TargetAddress ()
178+ }
176179// Retrieve a handle to the function we're going to invoke
177- let fnAddr = jit.addressOfFunction ( name : " calculateFibs" )
178- let fn = unsafeBitCast (fnAddr , to : FnPtr.self )
180+ let addr = try jit.address ( of : " calculateFibs" )
181+ let fn = unsafeBitCast (addr , to : FnPtr.self )
179182// Call the function!
180183print (fn (true )) // 0.00917431192660551...
181184print (fn (false )) // 0.0112359550561798...
@@ -186,7 +189,7 @@ print(fn(false)) // 0.0112359550561798...
186189There are a couple annoying steps you need to accomplish before building
187190LLVMSwift:
188191
189- - Install LLVM 5 .0+ using your favorite package manager. For example:
192+ - Install LLVM 7 .0+ using your favorite package manager. For example:
190193 - ` brew install llvm `
191194- Ensure ` llvm-config ` is in your ` PATH `
192195 - That will reside in the ` /bin ` folder wherever your package manager
@@ -200,7 +203,7 @@ compiler projects!
200203### Installation with Swift Package Manager
201204
202205``` swift
203- .package (url : " https://github.com/llvm-swift/LLVMSwift.git" , from : " 0.2 .0" )
206+ .package (url : " https://github.com/llvm-swift/LLVMSwift.git" , from : " 0.4 .0" )
204207```
205208
206209### Installation without Swift Package Manager
0 commit comments