Skip to content

Commit fca99fe

Browse files
authored
Merge pull request #167 from CodaFi/readme-and-weep
Update README
2 parents 0a8fb8e + ef8ccf1 commit fca99fe

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

README.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -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())
175175
typealias 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!
180183
print(fn(true)) // 0.00917431192660551...
181184
print(fn(false)) // 0.0112359550561798...
@@ -186,7 +189,7 @@ print(fn(false)) // 0.0112359550561798...
186189
There are a couple annoying steps you need to accomplish before building
187190
LLVMSwift:
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

Comments
 (0)