Skip to content

Another try at intrinsics #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 22, 2019
Merged

Another try at intrinsics #180

merged 1 commit into from
Mar 22, 2019

Conversation

CodaFi
Copy link
Member

@CodaFi CodaFi commented Mar 22, 2019

Use dynamic member lookup to index into the intrinsic table. Unfortunately, we don't quite have the APIs to do this, so I've had to add a shim library to let us grab the extent and members of the intrinsics table. If we commit to this API, we can upstream these bindings to LLVM and keep moving. It's probably a good idea to have llvmshims for prototyping anyways...

To deal with overloads, provide the non-overloaded name of the selector and any parameter types you need to resolve the thing. Once it's been resolved, you can look up the function by its full name or the intrinsic by its non-overloaded name with Module.intrinsic(named:parameters:).

guard let logf16 = module.intrinsic(Intrinsic.ID.llvm_log, parameters: [ FloatType.half ]) else {
  fatalError("Unknown intrinsic?")
}
_ = builder.buildCall(logf16, args: [half])

@CodaFi CodaFi force-pushed the intr'act branch 4 times, most recently from 600bcf6 to 6101cec Compare March 22, 2019 15:17
@CodaFi
Copy link
Member Author

CodaFi commented Mar 22, 2019

⛵️

@CodaFi CodaFi merged commit 749b257 into llvm-swift:master Mar 22, 2019
@CodaFi CodaFi deleted the intr'act branch March 22, 2019 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant