Skip to content
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

LLVM intrinsics refactor, adding bitswap. #2691

Closed
wants to merge 2 commits into from

Conversation

mirek
Copy link
Contributor

@mirek mirek commented May 30, 2016

Changes:

  • ::Intrinsics lib changed to module
  • split by topic, i.e. Intrinsics::BitManipulation
  • separate llvm api (explicit, 1-1 naming etc.) from crystal api
    (overloading, crystal names etc.)
  • added bit swapping (should it be called flip or something else
    instead of bswap?)

The rationale behind separating into topic modules is that there are a
lot of intrinsic functions and that's how they are documented at
http://llvm.org/docs/LangRef.html#llvm-readcyclecounter-intrinsic.

Separation between llvm and crystal apis means that you can look up llvm
docs and know what the function does and crystal functions are... well,
crystallised with overloading for crystal types, our documentation etc.

mirek added 2 commits May 30, 2016 13:49

Verified

This commit was signed with the committer’s verified signature.
jhass Jonne Haß
Changes:
* `::Intrinsics` lib changed to module
* split by topic, i.e. `Intrinsics::BitManipulation`
* separate llvm api (explicit, 1-1 naming etc.) from crystal api
  (overloading, crystal names etc.)
* added bit swapping (should it be called `flip` or something else
  instead of `bswap`?)

The rationale behind separating into topic modules is that there are a
lot of intrinsic functions and that's how they are documented at
http://llvm.org/docs/LangRef.html#llvm-readcyclecounter-intrinsic.

Separation between llvm and crystal apis means that you can look up llvm
docs and know what the function does and crystal functions are... well,
crystallised with overloading for crystal types, our documentation etc.
@asterite
Copy link
Member

The Intrinsics lib is there to be used by the standard library to implement some basic operations. It's not intended to be used outside the standard library's implementation (because the standard library provides wrappers for that functionality).

As you can see, all the Intrinsics functions are used inside other types, such as Int32, Pointer, etc. We are probably missing a bit-swap operation for integers.

I also usually don't like having mini-modules and then include them in a bigger module, it makes things harder to look up, and it probably increases compile times (but this is just a personal opinion).

I'll close this. But next time please open an issue, I don't like closing PR but it's better to discuss things first before jumping into an implementation/change.

@asterite asterite closed this May 30, 2016
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.

None yet

2 participants